From aaf1fd3e85b15b06b5c83c1c420b3b772ab4d900 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 20 Jun 2026 14:14:18 +0530 Subject: [PATCH 1/9] Harden auth, sync, and Supabase security --- .env.example | 10 +- .github/workflows/ci.yml | 6 +- .github/workflows/regenerate-release.yml | 2 + .github/workflows/release.yml | 2 + .github/workflows/schema-lint.yml | 14 +- ADMIN.md | 32 +- README.md | 9 +- index.html | 1 + package.json | 3 + public/pwa-local.js | 64 +- public/restore-and-launch.js | 113 +- public/sw.js | 38 +- public/sync/backup-normalizer.js | 160 ++- public/sync/local-data-adapter.js | 219 +++- scripts/test-boot-performance.mjs | 236 ++++ scripts/test-data-integrity.mjs | 367 +++++++ scripts/test-server-security.mjs | 187 ++++ scripts/verify-sql-hardening.sql | 241 ++++ server.mjs | 582 ++++------ server/backup-manager.mjs | 106 +- sql/007_comprehensive_sql_rls_hardening.sql | 1094 +++++++++++++++++++ 21 files changed, 2946 insertions(+), 540 deletions(-) create mode 100644 scripts/test-boot-performance.mjs create mode 100644 scripts/test-data-integrity.mjs create mode 100644 scripts/test-server-security.mjs create mode 100644 scripts/verify-sql-hardening.sql create mode 100644 sql/007_comprehensive_sql_rls_hardening.sql diff --git a/.env.example b/.env.example index 45f0ef9..cc056c5 100644 --- a/.env.example +++ b/.env.example @@ -14,6 +14,14 @@ SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsI # Port for the local server (default: 3000) PORT=3000 +# Bind address (default: loopback only). Set 0.0.0.0 only when LAN access is +# intentionally required and the host firewall/network is trusted. +ISOTOPE_BIND_HOST=127.0.0.1 + +# Optional comma-separated browser origins allowed to call the local server. +# Same-origin requests are always allowed. +CORS_ALLOWED_ORIGINS= + # ── Admin / Owner only — leave blank for normal users ───────────────────── # Set ENABLE_ADMIN_MODE=true to unlock /__admin diagnostics ENABLE_ADMIN_MODE=false @@ -32,7 +40,7 @@ ADMIN_EMAILS= # Defaults to ADMIN_EMAIL when blank. BROWSER_PROOF_EMAIL= -# Supabase management API token (owner diagnostics only) +# Supabase management API token (owner diagnostics only, server-side only) SUPABASE_ACCESS_TOKEN= # GitHub PAT (owner diagnostics / update checks only) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a26c35..ce2df0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -201,7 +201,9 @@ jobs: isotope-complete.sql community-patch-v4.sql sql/006_security_policy_cleanup.sql + sql/007_comprehensive_sql_rls_hardening.sql sql/backup_manifests.sql + scripts/verify-sql-hardening.sql sql/verify-security.sql .env.example README.md @@ -250,7 +252,7 @@ jobs: - name: 📋 Schema file stats run: | set -euo pipefail - for f in isotope-complete.sql community-patch-v4.sql sql/006_security_policy_cleanup.sql sql/backup_manifests.sql sql/verify-security.sql performance-patch.sql; do + for f in isotope-complete.sql community-patch-v4.sql sql/006_security_policy_cleanup.sql sql/007_comprehensive_sql_rls_hardening.sql sql/backup_manifests.sql sql/verify-security.sql scripts/verify-sql-hardening.sql performance-patch.sql; do if [ -f "$f" ]; then echo "=== $f ===" echo " Size : $(wc -c < "$f") bytes" @@ -332,7 +334,7 @@ jobs: unzip -q "isotope-v${VERSION}-ci-test.zip" -d "$TMPDIR" echo "Verifying extracted release..." FAIL=0 - for f in server.mjs package.json setup.sh install-termux.sh bin/isotope .env.example public/sync/backup-normalizer.js public/sync/local-data-adapter.js server/backup-manager.mjs scripts/prove-new-browser-restore.mjs sql/backup_manifests.sql docs/sync-system.md docs/storage-backup-system.md docs/supabase-connection-map.md; do + for f in server.mjs package.json setup.sh install-termux.sh bin/isotope .env.example public/sync/backup-normalizer.js public/sync/local-data-adapter.js server/backup-manager.mjs scripts/prove-new-browser-restore.mjs sql/backup_manifests.sql sql/007_comprehensive_sql_rls_hardening.sql scripts/verify-sql-hardening.sql docs/sync-system.md docs/storage-backup-system.md docs/supabase-connection-map.md; do if [ -f "$TMPDIR/$f" ]; then echo " ✅ $f" else diff --git a/.github/workflows/regenerate-release.yml b/.github/workflows/regenerate-release.yml index 4c2f95b..fb73615 100644 --- a/.github/workflows/regenerate-release.yml +++ b/.github/workflows/regenerate-release.yml @@ -106,6 +106,8 @@ jobs: scripts/compare-remote-assets.mjs isotope-complete.sql sql/backup_manifests.sql + sql/007_comprehensive_sql_rls_hardening.sql + scripts/verify-sql-hardening.sql docs/sync-system.md docs/storage-backup-system.md docs/supabase-connection-map.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c86fb92..f59f2f9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -182,6 +182,8 @@ jobs: scripts/compare-remote-assets.mjs sql/backup_manifests.sql sql/006_security_policy_cleanup.sql + sql/007_comprehensive_sql_rls_hardening.sql + scripts/verify-sql-hardening.sql docs/sync-system.md docs/storage-backup-system.md docs/supabase-connection-map.md diff --git a/.github/workflows/schema-lint.yml b/.github/workflows/schema-lint.yml index 496332a..f228bbd 100644 --- a/.github/workflows/schema-lint.yml +++ b/.github/workflows/schema-lint.yml @@ -135,16 +135,22 @@ jobs: fi echo "Stripping Supabase-cloud-only statements..." - grep -v \ + awk ' + /^CREATE EVENT TRIGGER / { skip_event_trigger = 1 } + skip_event_trigger { + if ($0 ~ /;[[:space:]]*$/) skip_event_trigger = 0 + next + } + /^DROP EVENT TRIGGER / { next } + { print } + ' isotope-complete.sql | grep -v \ -e 'ALTER PUBLICATION' \ -e 'supabase_realtime' \ - -e 'CREATE EVENT TRIGGER' \ - -e 'DROP EVENT TRIGGER' \ -e 'pg_net\.' \ -e 'http_request' \ -e 'supabase_admin' \ -e 'net\.http' \ - isotope-complete.sql > /tmp/schema_test.sql + > /tmp/schema_test.sql echo "Running schema against PostgreSQL 16..." set +e diff --git a/ADMIN.md b/ADMIN.md index 251b657..3fef2b2 100644 --- a/ADMIN.md +++ b/ADMIN.md @@ -35,7 +35,7 @@ SUPABASE_ACCESS_TOKEN= Access via: - **Header:** `X-Admin-Secret: ` -- **Query string:** `/__admin/verify?secret=` +- **Browser:** open `/__admin/login` and unlock locally `SUPABASE_ACCESS_TOKEN` is only needed for SQL apply through `/__admin/patch`. The service-role key and PAT must stay private and server-side. @@ -360,12 +360,13 @@ typeof window.__isoGetValidJwt ## 8. Supabase Proxy — `/__supa/*` -All Supabase API calls from the frontend are proxied through `/__supa/*`. The server: +Supported Supabase API calls from the frontend may be proxied through `/__supa/*`. The server: 1. Strips `/__supa` prefix 2. Forwards to your `SUPABASE_URL` -3. Passes through all request headers (Authorization, apikey, Content-Type) -4. Adds `apikey: SUPABASE_ANON_KEY` if missing +3. Allows only Auth, REST, Storage, Functions, Realtime, and GraphQL paths +4. Removes caller `apikey`, cookies, admin secrets, and service-role credentials +5. Uses `SUPABASE_ANON_KEY` plus the caller's authenticated user JWT 5. Streams the response back This allows the app to work behind the local preview proxy without CORS issues, and makes swapping Supabase projects (via env vars) transparent to the frontend. @@ -394,7 +395,7 @@ The server intercepts and patches selected compiled JavaScript bundles at reques | Bundle | What is patched | |--------|----------------| | `App bundle` (main JS) | `planType` hardcoded → `ranker`; circuit breaker disabled; community URL patched | -| `AI store` | `getApiKey()` → reads from `window.__IK__` (injected by server from env vars) | +| `AI store` | No server secret injection; browser AI settings remain user-managed | | `Focus/AI bundle` | Replaces hardcoded production Supabase URL with self-hosted URL | | `Auth bundle` | Username-as-email support; auth flow patches; stale `IsotopeAI v2.0` badge → `v3.1` | | `Invites bundle` | `token_input` → `p_code` (accept_invite + get_invite_details) | @@ -402,18 +403,11 @@ The server intercepts and patches selected compiled JavaScript bundles at reques | `PWAManager` bundle | Service-worker activation reload routed through `window.__isoReloadGuard()` | | Store and Events chunks | Served as empty modules | -### `window.__IK__` injection +### AI credentials -The server injects this object into every HTML response: -```javascript -window.__IK__ = { - supa: "https://YOUR_SUPABASE_URL", - anon: "YOUR_ANON_KEY", - gemini: "GEMINI_API_KEY", // if set - groq: "GROQ_API_KEY", // if set -}; -``` -This allows AI features to use server-configured API keys without them appearing in static JS files. +Server environment AI credentials are never inserted into HTML or JavaScript +served to the browser. Browser-side AI integrations must use explicit +user-managed credentials or a dedicated authenticated server endpoint. --- @@ -423,8 +417,10 @@ This allows AI features to use server-configured API keys without them appearing |----------|----------|---------|---------| | `SUPABASE_URL` | Yes | Built-in project | Your Supabase project URL | | `SUPABASE_ANON_KEY` | Yes | Built-in key | Public/anon JWT key | -| `SUPABASE_SERVICE_ROLE_KEY` | Strongly recommended | _(none)_ | Bypasses RLS; needed for community features | -| `SUPABASE_ACCESS_TOKEN` | Yes (for patch) | _(none)_ | Management API PAT for one-click patch | +| `SUPABASE_SERVICE_ROLE_KEY` | Owner tools only | _(none)_ | Server-only management authority; never exposed to clients | +| `SUPABASE_ACCESS_TOKEN` | Optional | _(none)_ | Server-only Management API PAT for one-click SQL patching | +| `ISOTOPE_BIND_HOST` | Optional | `127.0.0.1` | Explicit local/LAN bind address | +| `CORS_ALLOWED_ORIGINS` | Optional | _(empty)_ | Additional comma-separated browser origins | | `ADMIN_EMAIL` | Optional | _(empty)_ | Supabase admin email for browser unlock and optional bootstrap | | `ADMIN_EMAILS` | Optional | _(empty)_ | Comma-separated Supabase admin email allowlist | | `ADMIN_PASSWORD` | Optional | _(empty)_ | Admin account password for optional bootstrap | diff --git a/README.md b/README.md index cd43482..1e4c77d 100644 --- a/README.md +++ b/README.md @@ -159,12 +159,13 @@ Steps: 1. Create a free project at https://supabase.com 2. Open SQL Editor. 3. Paste and run [isotope-complete.sql](./isotope-complete.sql). -4. Create these Storage buckets if they do not already exist: +4. Paste and run [sql/007_comprehensive_sql_rls_hardening.sql](./sql/007_comprehensive_sql_rls_hardening.sql). +5. Create these Storage buckets if they do not already exist: - `avatars` - `user-content` - `notes` -5. Copy your Project URL and anon key. -6. Put them in `.env`. +6. Copy your Project URL and anon key. +7. Put them in `.env`. Example: @@ -289,7 +290,7 @@ node scripts/validate-storage-cleanup.mjs --user --dry-run | Port is busy | `isotope stop` or set `PORT=3001` in `.env` | | Login fails | Check `SUPABASE_URL` and `SUPABASE_ANON_KEY` | | Sync is blocked | Restore the cloud backup first | -| Storage permission error | Re-run `isotope-complete.sql` | +| Storage permission error | Re-run `sql/007_comprehensive_sql_rls_hardening.sql` | | Android widget is missing | `isotope reinstall-widgets` | | Update failed | `isotope doctor`, then `isotope repair` | diff --git a/index.html b/index.html index d18210d..5e1afbb 100644 --- a/index.html +++ b/index.html @@ -34,6 +34,7 @@ } + diff --git a/package.json b/package.json index 5a40836..9894c68 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,10 @@ "backup:prove-restore": "node scripts/prove-new-browser-restore.mjs", "storage:cleanup:dry-run": "node scripts/validate-storage-cleanup.mjs --dry-run", "security:verify": "node scripts/verify-supabase-security.mjs", + "test:data-integrity": "node scripts/test-data-integrity.mjs", + "test:server-security": "node scripts/test-server-security.mjs", "test:auth-bridge": "node scripts/test-auth-bridge.mjs", + "test:boot-performance": "node scripts/test-boot-performance.mjs", "test:runtime-glue": "node scripts/prove-runtime-glue.mjs", "test:supabase-sync": "node scripts/prove-supabase-sync.mjs" }, diff --git a/public/pwa-local.js b/public/pwa-local.js index 334de48..61c9dff 100644 --- a/public/pwa-local.js +++ b/public/pwa-local.js @@ -5,6 +5,10 @@ var STATUS_ID = '__iso_offline_status__'; var DISMISS_KEY = 'isotope_offline_status_dismissed'; var swActivationReloadGuard = false; + var hadControllerAtRegistration = false; + var serverCheckPromise = null; + var lastServerCheckAt = 0; + var SERVER_CHECK_DEDUPE_MS = 5000; var state = { browserOnline: navigator.onLine, serverOnline: true, @@ -129,42 +133,54 @@ el.classList.add('show'); } - function publishStatus() { + function publishStatus(dispatchEvent) { state.lastSnapshotAt = readLastSnapshotAt(); window.__isoLocalStatus = state; window.__isoBrowserOffline = !state.browserOnline; window.__isoLocalServerOffline = state.browserOnline && !state.serverOnline; - try { - window.dispatchEvent(new CustomEvent('isotope:local-status', { detail: { - browserOnline: state.browserOnline, - serverOnline: state.serverOnline, - swVersion: state.swVersion, - swSha: state.swSha, - lastSnapshotAt: state.lastSnapshotAt - }})); - } catch (e) {} + if (dispatchEvent !== false) { + try { + window.dispatchEvent(new CustomEvent('isotope:local-status', { detail: { + browserOnline: state.browserOnline, + serverOnline: state.serverOnline, + swVersion: state.swVersion, + swSha: state.swSha, + lastSnapshotAt: state.lastSnapshotAt + }})); + } catch (e) {} + } } - function checkServer() { + function checkServer(options) { + options = options || {}; if (!navigator.onLine) { state.browserOnline = false; state.serverOnline = false; - publishStatus(); + publishStatus(options.dispatchEvent); renderStatus(); - return; + return Promise.resolve(false); + } + var now = Date.now(); + if (serverCheckPromise) return serverCheckPromise; + if (!options.force && lastServerCheckAt && now - lastServerCheckAt < SERVER_CHECK_DEDUPE_MS) { + return Promise.resolve(state.serverOnline); } state.browserOnline = true; - fetch('/api/version', { cache: 'no-store' }) + lastServerCheckAt = now; + serverCheckPromise = fetch('/api/version', { cache: 'no-store' }) .then(function (r) { state.serverOnline = !!(r && r.ok); }) .catch(function () { state.serverOnline = false; }) .finally(function () { - publishStatus(); + serverCheckPromise = null; + publishStatus(options.dispatchEvent); renderStatus(); }); + return serverCheckPromise; } function registerServiceWorker() { if (!('serviceWorker' in navigator)) return; + hadControllerAtRegistration = !!navigator.serviceWorker.controller; navigator.serviceWorker.register('/sw.js', { scope: '/' }) .then(function (registration) { if (registration.waiting) registration.waiting.postMessage({ type: 'SKIP_WAITING' }); @@ -176,16 +192,18 @@ if (data.type === 'ISOTOPE_SW_READY' || data.type === 'ISOTOPE_SW_VERSION') { var newVersion = data.version || ''; var newSha = data.sha || ''; - // One-shot reload guard: only reload on first SW activation with new version - if (!swActivationReloadGuard && newVersion && newVersion !== state.swVersion) { + var previousVersion = state.swVersion; + state.swVersion = newVersion; + state.swSha = newSha; + // A first install has no prior controller and must not reload the page + // that initiated registration. Controlled pages still reload once when + // an updated worker activates. + if (hadControllerAtRegistration && !swActivationReloadGuard && + newVersion && newVersion !== previousVersion) { swActivationReloadGuard = true; - state.swVersion = newVersion; - state.swSha = newSha; window.location.reload(); return; } - state.swVersion = newVersion; - state.swSha = newSha; } }); } @@ -215,7 +233,9 @@ function init() { registerServiceWorker(); - checkServer(); + // update-checker.js runs its own delayed version preflight. Do not emit the + // initial local-status event and trigger an immediate duplicate probe. + checkServer({ dispatchEvent: false }); // Visibility-change recheck: triggers when user returns to the tab. // This replaces aggressive 10s polling with event-driven refresh. document.addEventListener('visibilitychange', function () { diff --git a/public/restore-and-launch.js b/public/restore-and-launch.js index 26fa8f8..85a3125 100644 --- a/public/restore-and-launch.js +++ b/public/restore-and-launch.js @@ -41,6 +41,7 @@ const SUPA_REF = (() => { try { return new URL(SUPA_URL).hostname.split('.')[0] || ''; } catch (_) { return ''; } })(); +const SUPABASE_CANONICAL_TOKEN_KEY = SUPA_REF ? 'sb-' + SUPA_REF + '-auth-token' : ''; // Zustand store keys const ZUSTAND_AUTH_KEY = 'isotope-auth'; @@ -141,21 +142,39 @@ function clearStore(db, storeName) { */ function findSessionRaw() { try { - const legacy = localStorage.getItem(SUPABASE_TOKEN_KEY); - if (legacy) return legacy; - if (SUPA_REF) { - const standard = localStorage.getItem('sb-' + SUPA_REF + '-auth-token'); - if (standard) return standard; - } - const lastRaw = localStorage.getItem('isotope-last-session-raw'); - if (lastRaw) return lastRaw; - for (let i = 0; i < localStorage.length; i++) { - const k = localStorage.key(i); - if (k && k.startsWith('sb-') && k.endsWith('-auth-token')) { - const v = localStorage.getItem(k); - if (v) return v; + const candidates = []; + const seenKeys = new Set(); + const addCandidate = (key, priority) => { + if (!key || seenKeys.has(key)) return; + seenKeys.add(key); + const raw = localStorage.getItem(key); + const session = parseSession(raw); + if (!session) return; + const jwtPayload = decodeJwtPayload(session.access_token); + candidates.push({ + raw, + priority, + expiresAt: Number(session.expires_at || jwtPayload?.exp || 0), + }); + }; + + // Prefer the canonical project-scoped Supabase key when sessions are equally + // fresh, but never let an older mirror hide a newer valid session. + addCandidate(SUPABASE_CANONICAL_TOKEN_KEY, 3); + addCandidate(SUPABASE_TOKEN_KEY, 2); + addCandidate('isotope-last-session-raw', 1); + // Unknown project keys are compatibility fallbacks only. They must not + // outrank a valid session from this app's canonical/mirror keys. + if (candidates.length === 0) { + for (let i = 0; i < localStorage.length; i++) { + const k = localStorage.key(i); + if (k && k.startsWith('sb-') && k.endsWith('-auth-token')) { + addCandidate(k, 0); + } } } + candidates.sort((a, b) => (b.expiresAt - a.expiresAt) || (b.priority - a.priority)); + return candidates.length ? candidates[0].raw : null; } catch (_) {} return null; } @@ -224,13 +243,46 @@ function saveRefreshedSession(session) { const raw = JSON.stringify(session); try { localStorage.setItem(SUPABASE_TOKEN_KEY, raw); - if (SUPA_REF) localStorage.setItem('sb-' + SUPA_REF + '-auth-token', raw); + if (SUPABASE_CANONICAL_TOKEN_KEY) localStorage.setItem(SUPABASE_CANONICAL_TOKEN_KEY, raw); localStorage.setItem('isotope-last-jwt', session.access_token); if (session.refresh_token) localStorage.setItem('isotope-last-rt', session.refresh_token); localStorage.setItem('isotope-last-session-raw', raw); } catch (_) {} } +function isSameSession(candidate, staleSession) { + if (!candidate || !staleSession) return false; + if (candidate.user?.id !== staleSession.user?.id) return false; + return candidate.access_token === staleSession.access_token || + (!!candidate.refresh_token && candidate.refresh_token === staleSession.refresh_token); +} + +function clearStaleSessionMirrors(staleSession) { + if (!staleSession) return; + try { + const tokenKeys = new Set([ + SUPABASE_TOKEN_KEY, + SUPABASE_CANONICAL_TOKEN_KEY, + 'isotope-last-session-raw', + ].filter(Boolean)); + for (let i = 0; i < localStorage.length; i++) { + const key = localStorage.key(i); + if (key && key.startsWith('sb-') && key.endsWith('-auth-token')) tokenKeys.add(key); + } + for (const key of tokenKeys) { + if (isSameSession(parseSession(localStorage.getItem(key)), staleSession)) { + localStorage.removeItem(key); + } + } + if (localStorage.getItem('isotope-last-jwt') === staleSession.access_token) { + localStorage.removeItem('isotope-last-jwt'); + } + if (staleSession.refresh_token && localStorage.getItem('isotope-last-rt') === staleSession.refresh_token) { + localStorage.removeItem('isotope-last-rt'); + } + } catch (_) {} +} + async function refreshStoredSessionIfNeeded(session) { refreshStoredSessionIfNeeded.lastFailure = null; if (!session || !session.access_token) return null; @@ -251,7 +303,9 @@ async function refreshStoredSessionIfNeeded(session) { clearTimeout(tid); const data = await resp.json().catch(() => null); if (!resp.ok || !data || !data.access_token || !data.user || !data.user.id) { - refreshStoredSessionIfNeeded.lastFailure = (resp.status === 400 || resp.status === 401) ? 'auth' : 'network'; + const definitiveAuthFailure = resp.status === 400 || resp.status === 401; + refreshStoredSessionIfNeeded.lastFailure = definitiveAuthFailure ? 'auth' : 'network'; + if (definitiveAuthFailure) clearStaleSessionMirrors(session); return null; } saveRefreshedSession(data); @@ -733,15 +787,12 @@ async function ensureSchema() { } } -// ── Asset preload ─────────────────────────────────────────────────────────── - -function preloadAssets() { - const link = document.createElement('link'); - link.rel = 'modulepreload'; - link.crossOrigin = ''; - link.href = '/assets/vendor-react-BfU3Zn2J.js'; - document.head.appendChild(link); +// ── App launch ────────────────────────────────────────────────────────────── +let appLaunchStarted = false; +function launchApp() { + if (appLaunchStarted) return; + appLaunchStarted = true; const script = document.createElement('script'); script.type = 'module'; script.crossOrigin = ''; @@ -749,6 +800,14 @@ function preloadAssets() { document.head.appendChild(script); } +function notifyMountedAppOfBootResolution() { + try { + window.dispatchEvent(new PopStateEvent('popstate', { state: window.history.state })); + } catch (_) { + try { window.dispatchEvent(new Event('popstate')); } catch (_) {} + } +} + // ── Main ──────────────────────────────────────────────────────────────────── (async () => { @@ -756,6 +815,9 @@ function preloadAssets() { onboarding: { state: 'unknown' }, source: 'boot', }); + // Start fetching and mounting the entry immediately. AppAccessGate blocks + // route content while the boot state remains authChecking/cloudLoading. + launchApp(); if (window.location.pathname !== '/demo') { try { sessionStorage.removeItem('isotope-demo-mode'); } catch (_) {} @@ -868,6 +930,7 @@ function preloadAssets() { window.history.replaceState(null, '', '/dashboard'); } - // Step 4: preload the app bundle - preloadAssets(); + // An early-mounted BrowserRouter must re-read the final replaceState URL and + // boot state even when the resolved deep link itself did not change. + notifyMountedAppOfBootResolution(); })(); diff --git a/public/sw.js b/public/sw.js index 2f3aef7..060a37c 100644 --- a/public/sw.js +++ b/public/sw.js @@ -9,43 +9,7 @@ const SHELL_CACHE = CACHE_PREFIX + '-shell-' + APP_VERSION + '-' + APP_SHA.slice const RUNTIME_CACHE = CACHE_PREFIX + '-runtime-' + APP_VERSION + '-' + APP_SHA.slice(0, 12); const SHELL_URLS = [ - '/', - '/index.html', - '/offline.html', - '/manifest.webmanifest', - '/favicon.svg', - '/logo-full.svg', - '/logo-icon.svg', - '/icons/icon.svg', - '/icons/icon-192x192.png', - '/icons/icon-512x512.png', - '/icons/maskable-icon-512x512.png', - '/auth-bridge.js', - '/boot-recovery.js', - '/restore-and-launch.js', - '/sync/backup-normalizer.js', - '/sync/local-data-adapter.js', - '/ux-setup.js', - '/focus-bg-import.js', - '/update-checker.js', - '/pwa-local.js', - '/assets/index-CrO6t5EW.css', - '/assets/vendor-katex-ASjZcBK0.css', - '/assets/index-BPYJFSVW.js', - '/assets/index-B45N-99N.js', - '/assets/vendor-react-BfU3Zn2J.js', - '/assets/vendor-router-CmoTwRnm.js', - '/assets/vendor-query-Dco3bNuU.js', - '/assets/vendor-supabase-CdzVlbop.js', - '/assets/App-pJGjDiPw.js', - '/assets/Onboarding-qvAqCBbb.js', - '/assets/Dashboard-dypAV-0H.js', - '/assets/Focus-BmgY-9vP.js', - '/assets/Study-pAdAenIl.js', - '/assets/Tasks-BYRFOrek.js', - '/assets/Community-DIqF5406.js', - '/assets/CommunityHub-gANxZssO.js', - '/fonts/fonts.css' + '/offline.html' ]; const RUNTIME_GLUE_PATHS = new Set([ diff --git a/public/sync/backup-normalizer.js b/public/sync/backup-normalizer.js index 2c93dd4..8f95c2a 100644 --- a/public/sync/backup-normalizer.js +++ b/public/sync/backup-normalizer.js @@ -22,6 +22,8 @@ const ARRAY_COLLECTION_KEYS = [ 'mockTests', ]; +const TOMBSTONE_COLLECTION_KEYS = [...COLLECTION_KEYS]; + const RICH_COLLECTION_KEYS = [ 'tasks', 'sessions', @@ -95,6 +97,78 @@ function emptyDataShape() { }; } +function emptyTombstoneShape() { + return Object.fromEntries(TOMBSTONE_COLLECTION_KEYS.map((key) => [key, []])); +} + +function normalizeTombstoneEntry(value) { + if (typeof value === 'string' || typeof value === 'number') { + return { id: String(value), deletedAt: null }; + } + if (!value || typeof value !== 'object') return null; + const id = value.id || value._id || value.record_id || value.recordId; + if (!id) return null; + return { + id: String(id), + deletedAt: value.deletedAt || value.deleted_at || value.timestamp || null, + }; +} + +function normalizeTombstones(...sources) { + const out = emptyTombstoneShape(); + for (const source of sources) { + if (!source || typeof source !== 'object') continue; + for (const key of TOMBSTONE_COLLECTION_KEYS) { + const entries = Array.isArray(source[key]) ? source[key] : []; + const byId = new Map(out[key].map((entry) => [entry.id, entry])); + for (const value of entries) { + const incoming = normalizeTombstoneEntry(value); + if (!incoming) continue; + const existing = byId.get(incoming.id); + if (!existing || meaningfulTimestamp(incoming.deletedAt) >= meaningfulTimestamp(existing.deletedAt)) { + byId.set(incoming.id, incoming); + } + } + out[key] = Array.from(byId.values()); + } + } + return out; +} + +function hasTombstones(tombstones) { + return TOMBSTONE_COLLECTION_KEYS.some((key) => (tombstones?.[key] || []).length > 0); +} + +function getBackupMetadata(normalizedOrRaw) { + if (normalizedOrRaw?.collection_counts && normalizedOrRaw?.data) { + return { + tombstones: normalizeTombstones(normalizedOrRaw.tombstones), + intentional_empty: normalizedOrRaw.intentional_empty === true || normalizedOrRaw.operation === 'reset', + operation: normalizedOrRaw.operation || null, + reset_at: normalizedOrRaw.reset_at || null, + }; + } + const raw = normalizedOrRaw?.raw || normalizedOrRaw || {}; + const localBackup = cleanObject(raw.local_backup); + const operation = raw.operation || localBackup?.operation || raw.data?.operation || null; + const intentionalEmpty = raw.intentional_empty === true + || localBackup?.intentional_empty === true + || raw.data?.intentional_empty === true + || operation === 'reset'; + return { + tombstones: normalizeTombstones( + raw.tombstones, + raw.deletions, + raw.data?.tombstones, + localBackup?.tombstones, + localBackup?.data?.tombstones, + ), + intentional_empty: intentionalEmpty, + operation: intentionalEmpty ? 'reset' : operation, + reset_at: raw.reset_at || raw.resetAt || localBackup?.reset_at || localBackup?.resetAt || null, + }; +} + function normalizeDataShape(...sources) { const out = emptyDataShape(); for (const source of sources) { @@ -215,8 +289,13 @@ function normalizeAnyBackup(input, meta = {}) { const size = Number(meta.size_bytes || meta.size || 0) || dataSizeBytes(input); const counts = getCollectionCounts({ data }); const meaningfulDataAt = getLatestRecordTimestamp(data); + const backupMetadata = getBackupMetadata(raw); const normalized = { - valid: kind !== 'unknown' || ARRAY_COLLECTION_KEYS.some((key) => data[key].length > 0) || !!data.profile, + valid: kind !== 'unknown' + || ARRAY_COLLECTION_KEYS.some((key) => data[key].length > 0) + || !!data.profile + || backupMetadata.intentional_empty + || hasTombstones(backupMetadata.tombstones), kind, exported_at: exportedAt, app_version: appVersion, @@ -230,12 +309,18 @@ function normalizeAnyBackup(input, meta = {}) { bucket: meta.bucket || null, updated_at: meta.updated_at || null, meaningful_data_at: meaningfulDataAt ? new Date(meaningfulDataAt).toISOString() : null, + tombstones: backupMetadata.tombstones, + intentional_empty: backupMetadata.intentional_empty, + operation: backupMetadata.operation, + reset_at: backupMetadata.reset_at, raw, }; normalized.empty = isBackupEmpty(normalized); normalized.rich = isBackupRich(normalized); normalized.rich_score = richScoreFromCounts(counts, size); - normalized.reason = normalized.rich ? 'rich backup' : (normalized.empty ? 'profile-only or empty backup' : 'valid sparse backup'); + normalized.reason = normalized.intentional_empty + ? 'intentional empty reset' + : (normalized.rich ? 'rich backup' : (normalized.empty ? 'profile-only or empty backup' : 'valid sparse backup')); return normalized; } @@ -281,6 +366,14 @@ function compareBackupCandidates(a, b) { if (!left && right) return -1; if (left.valid && !right.valid) return 1; if (!left.valid && right.valid) return -1; + if (left.intentional_empty && !right.intentional_empty) { + const resetDelta = meaningfulTimestamp(left.reset_at || left.exported_at) - candidateTime(right); + if (resetDelta >= 0) return 1; + } + if (!left.intentional_empty && right.intentional_empty) { + const resetDelta = meaningfulTimestamp(right.reset_at || right.exported_at) - candidateTime(left); + if (resetDelta >= 0) return -1; + } if (left.rich && right.empty) return 1; if (left.empty && right.rich) return -1; if (left.rich && !right.rich) return 1; @@ -301,6 +394,12 @@ function latestRecordTime(record) { return meaningfulTimestamp(record?.updatedAt || record?.updated_at || record?.lastModified || record?.createdAt || record?.created_at); } +function tombstoneWins(tombstone, record) { + const deletedAt = meaningfulTimestamp(tombstone?.deletedAt); + const recordTime = latestRecordTime(record); + return deletedAt === 0 || recordTime === 0 || deletedAt >= recordTime; +} + function mergeById(localRecords, cloudRecords) { const out = new Map(); const push = (record, source) => { @@ -344,8 +443,28 @@ function nonEmptyObjectMerge(base, overlay) { } function mergeBackupData(local, cloud) { - const localData = getBackupData(local || {}); - const cloudData = getBackupData(cloud || {}); + const localNormalized = normalizeAnyBackup(local || {}); + const cloudNormalized = normalizeAnyBackup(cloud || {}); + const localData = localNormalized.data; + const cloudData = cloudNormalized.data; + const resetCandidates = [localNormalized, cloudNormalized] + .filter((item) => item.intentional_empty) + .sort((a, b) => meaningfulTimestamp(b.reset_at || b.exported_at) - meaningfulTimestamp(a.reset_at || a.exported_at)); + const winningReset = resetCandidates[0] || null; + if (winningReset) { + const other = winningReset === localNormalized ? cloudNormalized : localNormalized; + const resetTime = meaningfulTimestamp(winningReset.reset_at || winningReset.exported_at); + const otherTime = Math.max(getLatestRecordTimestamp(other.data), meaningfulTimestamp(other.exported_at)); + if (resetTime === 0 || resetTime >= otherTime) { + return { + ...emptyDataShape(), + tombstones: normalizeTombstones(localNormalized.tombstones, cloudNormalized.tombstones), + operation: 'reset', + intentional_empty: true, + reset_at: winningReset.reset_at || winningReset.exported_at || null, + }; + } + } const merged = emptyDataShape(); merged.profile = nonEmptyObjectMerge(cloudData.profile || {}, localData.profile || {}); for (const key of ARRAY_COLLECTION_KEYS) { @@ -360,18 +479,47 @@ function mergeBackupData(local, cloud) { } else { merged.timerState = localTimer || cloudTimer || null; } + const tombstones = normalizeTombstones(localNormalized.tombstones, cloudNormalized.tombstones); + for (const key of ARRAY_COLLECTION_KEYS) { + const recordsById = new Map(merged[key].map((record) => [String(record.id || record._id || ''), record])); + merged[key] = merged[key].filter((record) => { + const id = String(record.id || record._id || ''); + const tombstone = tombstones[key].find((entry) => entry.id === id); + return !tombstone || !tombstoneWins(tombstone, record); + }); + tombstones[key] = tombstones[key].filter((entry) => { + const record = recordsById.get(entry.id); + return !record || tombstoneWins(entry, record); + }); + } + for (const key of ['profile', 'timerState']) { + const record = merged[key]; + const id = key === 'profile' ? String(record?.id || 'primary') : String(record?.id || 'current'); + const tombstone = tombstones[key].find((entry) => entry.id === id); + if (record && tombstone && tombstoneWins(tombstone, record)) merged[key] = null; + tombstones[key] = tombstones[key].filter((entry) => !record || tombstoneWins(entry, record)); + } + if (hasTombstones(tombstones)) merged.tombstones = tombstones; return merged; } function buildCanonicalBackupPayload(normalizedOrRaw, options = {}) { const normalized = normalizedOrRaw?.collection_counts ? normalizedOrRaw : normalizeAnyBackup(normalizedOrRaw, options); - return { + const metadata = getBackupMetadata(normalizedOrRaw); + const payload = { version: 1, source: 'isotopeai', exportedAt: options.exportedAt || normalized.exported_at || new Date().toISOString(), appVersion: options.appVersion || normalized.app_version || 'unknown', data: getBackupData(normalized), }; + if (hasTombstones(metadata.tombstones)) payload.tombstones = metadata.tombstones; + if (metadata.intentional_empty) { + payload.operation = 'reset'; + payload.intentional_empty = true; + payload.reset_at = metadata.reset_at || payload.exportedAt; + } + return payload; } function buildCloudSnapshotMirror(userId, normalizedOrRaw, options = {}) { @@ -397,6 +545,7 @@ if (typeof window !== 'undefined') { window.IsotopeBackupNormalizer = { COLLECTION_KEYS, ARRAY_COLLECTION_KEYS, + TOMBSTONE_COLLECTION_KEYS, normalizeAnyBackup, getBackupData, getCollectionCounts, @@ -413,6 +562,7 @@ if (typeof window !== 'undefined') { export { COLLECTION_KEYS, ARRAY_COLLECTION_KEYS, + TOMBSTONE_COLLECTION_KEYS, normalizeAnyBackup, getBackupData, getCollectionCounts, diff --git a/public/sync/local-data-adapter.js b/public/sync/local-data-adapter.js index f2e8150..8afaa42 100644 --- a/public/sync/local-data-adapter.js +++ b/public/sync/local-data-adapter.js @@ -130,15 +130,19 @@ function writeJson(key, value) { try { window.localStorage.setItem(key, JSON.stringify(value)); } catch {} } +function writeJsonStrict(key, value) { + window.localStorage.setItem(key, JSON.stringify(value)); +} + function normalizeRecordForStore(collection, record, index) { if (!record || typeof record !== 'object') return null; if (collection === 'profile') return { ...record, id: record.id || 'primary' }; if (collection === 'timerState') return { ...record, id: 'current' }; - return { ...record, id: record.id || `${collection}-${Date.now()}-${index}` }; + return { ...record, id: record.id || `${collection}-restored-${index}` }; } async function readStoreAll(storeName) { - const db = await openDb().catch(() => null); + const db = await openDb(); if (!db || !db.objectStoreNames.contains(storeName)) return []; try { const tx = db.transaction(storeName, 'readonly'); @@ -146,15 +150,19 @@ async function readStoreAll(storeName) { await transactionDone(tx); db.close(); return Array.isArray(rows) ? rows : []; - } catch { + } catch (error) { try { db.close(); } catch {} - return []; + throw error; } } async function clearAndWriteStore(storeName, records) { - const db = await openDb().catch(() => null); - if (!db || !db.objectStoreNames.contains(storeName)) return false; + const db = await openDb(); + if (!db) return false; + if (!db.objectStoreNames.contains(storeName)) { + db.close(); + throw new Error(`IndexedDB store is missing: ${storeName}`); + } try { const tx = db.transaction(storeName, 'readwrite'); const store = tx.objectStore(storeName); @@ -163,9 +171,9 @@ async function clearAndWriteStore(storeName, records) { await transactionDone(tx); db.close(); return true; - } catch { + } catch (error) { try { db.close(); } catch {} - return false; + throw error; } } @@ -198,11 +206,11 @@ async function writeCollection(name, records, options = {}) { if (name === 'profile') { const profile = records && typeof records === 'object' && !Array.isArray(records) ? records : null; if (profile) { - writeJson(key, profile); await clearAndWriteStore(store, [normalizeRecordForStore(name, profile, 0)]); + writeJsonStrict(key, profile); } else if (options.replace !== false) { - writeJson(key, null); await clearAndWriteStore(store, []); + writeJsonStrict(key, null); } if (options.refresh !== false) dispatchSyncRefresh(name); return; @@ -210,19 +218,19 @@ async function writeCollection(name, records, options = {}) { if (name === 'timerState') { const timer = records && typeof records === 'object' && !Array.isArray(records) ? records : null; if (timer) { - writeJson(key, timer); await clearAndWriteStore(store, [normalizeRecordForStore(name, timer, 0)]); + writeJsonStrict(key, timer); } else if (options.replace !== false) { - try { window.localStorage.removeItem(key); } catch {} await clearAndWriteStore(store, []); + window.localStorage.removeItem(key); } if (options.refresh !== false) dispatchSyncRefresh(name); return; } const list = Array.isArray(records) ? records : []; const safe = list.map((record, index) => normalizeRecordForStore(name, record, index)).filter(Boolean); - writeJson(key, safe); await clearAndWriteStore(store, safe); + writeJsonStrict(key, safe); if (options.refresh !== false) dispatchSyncRefresh(name); } @@ -269,29 +277,168 @@ async function isLocalWorkspaceEmpty() { return isBackupEmpty({ collection_counts: await countLocalData(), size_bytes: 0 }); } -async function writeAllLocalData(backupData, options = {}) { +function prepareDataForStorage(backupData) { const data = getBackupData({ data: backupData || {} }); - await Promise.all([ - writeCollection('tasks', data.tasks, { refresh: false }), - writeCollection('sessions', data.sessions, { refresh: false }), - writeCollection('subjects', data.subjects, { refresh: false }), - writeCollection('habits', data.habits, { refresh: false }), - writeCollection('dailyLogs', data.dailyLogs, { refresh: false }), - writeCollection('tests', data.tests, { refresh: false }), - writeCollection('exams', data.exams, { refresh: false }), - writeCollection('mockTests', data.mockTests, { refresh: false }), - writeCollection('profile', data.profile, { refresh: false, replace: options.replace !== false }), - writeCollection('timerState', data.timerState, { refresh: false, replace: options.replace !== false }), - ]); - const meta = { - source_path: options.source_path || null, - hash: options.hash || null, - restored_at: new Date().toISOString(), - collection_counts: getCollectionCounts({ data }), - }; - writeJson('isotope_restore_metadata', meta); - refreshAllStores(); - return meta; + const prepared = { ...data }; + for (const key of Object.keys(COLLECTION_TO_STORE)) { + if (key === 'profile' || key === 'timerState') continue; + prepared[key] = data[key] + .map((record, index) => normalizeRecordForStore(key, record, index)) + .filter(Boolean); + } + return prepared; +} + +function recordsForStore(name, data) { + if (name === 'profile') { + return data.profile ? [normalizeRecordForStore(name, data.profile, 0)] : []; + } + if (name === 'timerState') { + return data.timerState ? [normalizeRecordForStore(name, data.timerState, 0)] : []; + } + return data[name]; +} + +async function writeAllIndexedDb(data) { + const db = await openDb(); + if (!db) return false; + const stores = Object.values(COLLECTION_TO_STORE); + const missing = stores.filter((store) => !db.objectStoreNames.contains(store)); + if (missing.length > 0) { + db.close(); + throw new Error(`IndexedDB stores are missing: ${missing.join(', ')}`); + } + try { + const tx = db.transaction(stores, 'readwrite'); + for (const [name, storeName] of Object.entries(COLLECTION_TO_STORE)) { + const store = tx.objectStore(storeName); + store.clear(); + for (const record of recordsForStore(name, data)) store.put(record); + } + await transactionDone(tx); + return true; + } finally { + try { db.close(); } catch {} + } +} + +function writeAllLocalStorage(data) { + for (const [name, key] of Object.entries(COLLECTION_TO_STORAGE_KEY)) { + if (name === 'timerState' && !data.timerState) { + window.localStorage.removeItem(key); + } else { + writeJsonStrict(key, data[name]); + } + } +} + +function snapshotLocalStorage() { + const snapshot = new Map(); + for (const key of Object.values(COLLECTION_TO_STORAGE_KEY)) { + snapshot.set(key, window.localStorage.getItem(key)); + } + snapshot.set('isotope_restore_metadata', window.localStorage.getItem('isotope_restore_metadata')); + return snapshot; +} + +function restoreLocalStorageSnapshot(snapshot) { + for (const [key, value] of snapshot) { + if (value === null) window.localStorage.removeItem(key); + else window.localStorage.setItem(key, value); + } +} + +function sameCounts(left, right) { + return Object.keys(left).every((key) => Number(left[key] || 0) === Number(right[key] || 0)) + && Object.keys(right).every((key) => Number(left[key] || 0) === Number(right[key] || 0)); +} + +async function readAllIndexedDbData() { + const data = {}; + for (const [name, storeName] of Object.entries(COLLECTION_TO_STORE)) { + const rows = await readStoreAll(storeName); + if (name === 'profile') { + const first = rows[0] || null; + if (!first) data.profile = null; + else { + const { id, ...profile } = first; + data.profile = id === 'primary' ? profile : first; + } + } else if (name === 'timerState') { + const first = rows.find((row) => row.id === 'current') || rows[0] || null; + if (!first) data.timerState = null; + else { + const { id, ...timer } = first; + data.timerState = id === 'current' ? timer : first; + } + } else { + data[name] = rows; + } + } + return getBackupData({ data }); +} + +function readAllLocalStorageData() { + const data = {}; + for (const [name, key] of Object.entries(COLLECTION_TO_STORAGE_KEY)) { + const fallback = name === 'profile' || name === 'timerState' ? null : []; + data[name] = readJson(key, fallback); + } + return getBackupData({ data }); +} + +function verifyRestoredData(expectedData, actualData, label) { + const expectedCounts = getCollectionCounts({ data: expectedData }); + const actualCounts = getCollectionCounts({ data: actualData }); + if (!sameCounts(expectedCounts, actualCounts)) { + throw new Error(`${label} count verification failed: expected ${JSON.stringify(expectedCounts)}, got ${JSON.stringify(actualCounts)}`); + } + const expectedHash = hashBackup({ data: expectedData }); + const actualHash = hashBackup({ data: actualData }); + if (expectedHash !== actualHash) { + throw new Error(`${label} hash verification failed: expected ${expectedHash}, got ${actualHash}`); + } + return { counts: actualCounts, hash: actualHash }; +} + +async function writeAllLocalData(backupData, options = {}) { + const data = prepareDataForStorage(backupData); + if (options.replace === false) { + if (!data.profile) data.profile = await readCollection('profile'); + if (!data.timerState) data.timerState = await readCollection('timerState'); + } + const localStorageBefore = snapshotLocalStorage(); + const indexedDbBefore = canUseIndexedDB() ? await readAllIndexedDbData() : null; + const indexedDbWritten = await writeAllIndexedDb(data); + try { + writeAllLocalStorage(data); + const localStorageVerification = verifyRestoredData( + data, + readAllLocalStorageData(), + 'LocalStorage restore', + ); + if (indexedDbWritten) { + verifyRestoredData(data, await readAllIndexedDbData(), 'IndexedDB restore'); + } + const meta = { + source_path: options.source_path || null, + hash: options.hash || null, + data_hash: localStorageVerification.hash, + restored_at: new Date().toISOString(), + collection_counts: localStorageVerification.counts, + }; + writeJsonStrict('isotope_restore_metadata', meta); + refreshAllStores(); + return meta; + } catch (error) { + try { restoreLocalStorageSnapshot(localStorageBefore); } catch {} + if (indexedDbWritten && indexedDbBefore) { + try { await writeAllIndexedDb(indexedDbBefore); } catch (rollbackError) { + error.rollbackError = rollbackError; + } + } + throw error; + } } function writeRestoreMetadata(meta) { @@ -299,7 +446,7 @@ function writeRestoreMetadata(meta) { ...(meta || {}), restored_at: meta?.restored_at || new Date().toISOString(), }; - writeJson('isotope_restore_metadata', payload); + writeJsonStrict('isotope_restore_metadata', payload); return payload; } diff --git a/scripts/test-boot-performance.mjs b/scripts/test-boot-performance.mjs new file mode 100644 index 0000000..a87810a --- /dev/null +++ b/scripts/test-boot-performance.mjs @@ -0,0 +1,236 @@ +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import vm from 'node:vm'; + +const indexHtml = fs.readFileSync(new URL('../index.html', import.meta.url), 'utf8'); +const restoreSource = fs.readFileSync(new URL('../public/restore-and-launch.js', import.meta.url), 'utf8'); +const swSource = fs.readFileSync(new URL('../public/sw.js', import.meta.url), 'utf8'); +const pwaSource = fs.readFileSync(new URL('../public/pwa-local.js', import.meta.url), 'utf8'); + +assert.equal( + (indexHtml.match(/vendor-react-BfU3Zn2J\.js/g) || []).length, + 1, + 'vendor React modulepreload must appear exactly once' +); +assert.match(indexHtml, /rel="modulepreload"[^>]+index-BPYJFSVW\.js/, 'entry bundle must be discovered from HTML'); +assert.doesNotMatch( + restoreSource, + /link\.href\s*=\s*['"]\/assets\/vendor-react-BfU3Zn2J\.js/, + 'restore launcher must not append a duplicate vendor preload' +); +assert.ok( + restoreSource.indexOf('launchApp();') < restoreSource.indexOf('await purgeStaleFakeData()'), + 'entry mount must start before asynchronous boot cleanup' +); +assert.match(restoreSource, /notifyMountedAppOfBootResolution\(\)/, 'early mount must be notified after boot routing'); + +const shellMatch = swSource.match(/const SHELL_URLS = \[([\s\S]*?)\];/); +assert.ok(shellMatch, 'service worker shell list missing'); +const shellUrls = Array.from(shellMatch[1].matchAll(/'([^']+)'/g), (match) => match[1]); +assert.deepEqual(shellUrls, ['/offline.html'], 'first SW install should precache only the offline fallback'); +assert.match(pwaSource, /hadControllerAtRegistration\s*=\s*!!navigator\.serviceWorker\.controller/); +assert.match( + pwaSource, + /if \(hadControllerAtRegistration && !swActivationReloadGuard/, + 'SW activation reload must require a prior controller' +); +assert.match(pwaSource, /serverCheckPromise/, 'server version probes must share an in-flight request'); +assert.match( + pwaSource, + /checkServer\(\{ dispatchEvent: false \}\)/, + 'initial status check must not trigger update-checker duplicate preflight' +); + +async function verifyFreshServiceWorkerInstall() { + const serviceWorkerListeners = {}; + const documentListeners = {}; + const windowListeners = {}; + let versionFetches = 0; + let reloads = 0; + const statusElement = { + classList: { add() {}, remove() {} }, + innerHTML: '', + querySelector() { return null; }, + setAttribute() {}, + }; + const context = vm.createContext({ + CustomEvent: class CustomEvent { + constructor(type, init) { + this.type = type; + this.detail = init?.detail; + } + }, + Date, + Promise, + clearInterval() {}, + clearTimeout, + console, + document: { + body: { appendChild() {} }, + head: { appendChild() {} }, + hidden: false, + readyState: 'complete', + addEventListener(type, listener) { documentListeners[type] = listener; }, + createElement() { return statusElement; }, + getElementById(id) { + if (id === '__iso_offline_status_css__') return {}; + if (id === '__iso_offline_status__') return statusElement; + return null; + }, + }, + fetch: async (url) => { + if (url === '/api/version') versionFetches += 1; + return { ok: true }; + }, + localStorage: createLocalStorage(), + navigator: { + onLine: true, + serviceWorker: { + controller: null, + async register() { return { waiting: null }; }, + addEventListener(type, listener) { serviceWorkerListeners[type] = listener; }, + }, + }, + setInterval() { return 1; }, + setTimeout, + window: { + __ISO_BOOT_STATE__: {}, + addEventListener(type, listener) { windowListeners[type] = listener; }, + dispatchEvent() {}, + location: { reload() { reloads += 1; } }, + }, + }); + vm.runInContext(pwaSource, context); + await new Promise((resolve) => setTimeout(resolve, 0)); + serviceWorkerListeners.message({ + data: { type: 'ISOTOPE_SW_READY', version: '3.3.8', sha: 'fresh' }, + }); + assert.equal(reloads, 0, 'fresh SW install must not reload an uncontrolled page'); + windowListeners.online(); + await new Promise((resolve) => setTimeout(resolve, 0)); + assert.equal(versionFetches, 1, 'near-simultaneous version probes must be deduplicated'); +} + +function createLocalStorage(initial = {}) { + const data = new Map(Object.entries(initial)); + return { + get length() { return data.size; }, + key(index) { return Array.from(data.keys())[index] ?? null; }, + getItem(key) { return data.has(key) ? data.get(key) : null; }, + setItem(key, value) { data.set(key, String(value)); }, + removeItem(key) { data.delete(key); }, + snapshot() { return Object.fromEntries(data); }, + }; +} + +function session({ access, refresh, expiresAt, userId = 'user-1' }) { + return JSON.stringify({ + access_token: access, + refresh_token: refresh, + expires_at: expiresAt, + user: { id: userId }, + }); +} + +function loadRestoreHelpers(localStorage, fetchImpl = async () => { + throw new Error('unexpected fetch'); +}) { + const helperSource = restoreSource.slice(0, restoreSource.indexOf('// ── Main')); + const context = vm.createContext({ + AbortController, + URL, + atob, + clearTimeout, + console, + fetch: fetchImpl, + indexedDB: {}, + localStorage, + setTimeout, + window: { + __ISO_SUPA_URL__: 'https://project.supabase.co', + __ISO_ANON__: 'anon', + dispatchEvent() {}, + }, + }); + vm.runInContext(`${helperSource} +globalThis.__restoreTest = { + findSessionRaw, + parseSession, + refreshStoredSessionIfNeeded +};`, context); + return context.__restoreTest; +} + +await verifyFreshServiceWorkerInstall(); + +const nowSeconds = Math.floor(Date.now() / 1000); +{ + const staleLegacy = session({ access: 'legacy-old', refresh: 'rt-old', expiresAt: nowSeconds + 300 }); + const canonical = session({ access: 'canonical-new', refresh: 'rt-new', expiresAt: nowSeconds + 3600 }); + const storage = createLocalStorage({ + 'isotope-auth-token': staleLegacy, + 'sb-project-auth-token': canonical, + 'isotope-last-session-raw': staleLegacy, + 'sb-unrelated-auth-token': session({ + access: 'unrelated-project', + refresh: 'unrelated-refresh', + expiresAt: nowSeconds + 10800, + userId: 'other-user', + }), + }); + const helpers = loadRestoreHelpers(storage); + assert.equal(helpers.parseSession(helpers.findSessionRaw()).access_token, 'canonical-new'); +} + +{ + const canonicalOld = session({ access: 'canonical-old', refresh: 'rt-old', expiresAt: nowSeconds + 300 }); + const legacyNew = session({ access: 'legacy-new', refresh: 'rt-new', expiresAt: nowSeconds + 7200 }); + const storage = createLocalStorage({ + 'sb-project-auth-token': canonicalOld, + 'isotope-auth-token': legacyNew, + }); + const helpers = loadRestoreHelpers(storage); + assert.equal( + helpers.parseSession(helpers.findSessionRaw()).access_token, + 'legacy-new', + 'freshest valid session should beat a stale canonical mirror' + ); +} + +{ + const stale = JSON.parse(session({ + access: 'stale-access', + refresh: 'missing-refresh', + expiresAt: nowSeconds - 60, + })); + const staleRaw = JSON.stringify(stale); + const newerRaw = session({ + access: 'newer-access', + refresh: 'newer-refresh', + expiresAt: nowSeconds + 7200, + }); + const storage = createLocalStorage({ + 'isotope-auth-token': staleRaw, + 'sb-project-auth-token': staleRaw, + 'sb-other-auth-token': newerRaw, + 'isotope-last-session-raw': staleRaw, + 'isotope-last-jwt': stale.access_token, + 'isotope-last-rt': stale.refresh_token, + }); + const helpers = loadRestoreHelpers(storage, async () => ({ + ok: false, + status: 400, + async json() { return { error_code: 'refresh_token_not_found' }; }, + })); + assert.equal(await helpers.refreshStoredSessionIfNeeded(stale), null); + assert.equal(helpers.refreshStoredSessionIfNeeded.lastFailure, 'auth'); + const remaining = storage.snapshot(); + assert.equal(remaining['isotope-auth-token'], undefined); + assert.equal(remaining['sb-project-auth-token'], undefined); + assert.equal(remaining['isotope-last-session-raw'], undefined); + assert.equal(remaining['isotope-last-jwt'], undefined); + assert.equal(remaining['isotope-last-rt'], undefined); + assert.equal(remaining['sb-other-auth-token'], newerRaw, 'unrelated newer session must be preserved'); +} + +console.log('PASS boot performance and session mirror verification'); diff --git a/scripts/test-data-integrity.mjs b/scripts/test-data-integrity.mjs new file mode 100644 index 0000000..93b90b5 --- /dev/null +++ b/scripts/test-data-integrity.mjs @@ -0,0 +1,367 @@ +#!/usr/bin/env node +import assert from 'node:assert/strict'; +import { + buildCanonicalBackupPayload, + compareBackupCandidates, + mergeBackupData, + normalizeAnyBackup, +} from '../public/sync/backup-normalizer.js'; +import { createBackupManager } from '../server/backup-manager.mjs'; + +const EMPTY_DATA = { + profile: null, + timerState: null, + tasks: [], + sessions: [], + subjects: [], + habits: [], + dailyLogs: [], + tests: [], + exams: [], + mockTests: [], +}; + +function backup(data, extra = {}) { + return { + version: 1, + source: 'isotopeai', + exportedAt: extra.exportedAt || '2026-06-19T10:00:00.000Z', + appVersion: 'test', + data: { ...EMPTY_DATA, ...data }, + ...extra, + }; +} + +function createLocalStorage(seed = {}) { + const values = new Map(Object.entries(seed)); + const control = { failKey: null, failCount: 0 }; + return { + control, + getItem(key) { + return values.has(key) ? values.get(key) : null; + }, + setItem(key, value) { + if (control.failKey === key && control.failCount > 0) { + control.failCount -= 1; + throw new Error(`Injected localStorage failure for ${key}`); + } + values.set(key, String(value)); + }, + removeItem(key) { + values.delete(key); + }, + snapshot() { + return Object.fromEntries(values); + }, + }; +} + +function cloneRows(rows) { + return new Map(Array.from(rows, ([key, value]) => [key, structuredClone(value)])); +} + +function createFakeIndexedDB() { + const stores = new Map(); + const control = { + failStore: null, + dropOnRead: null, + }; + const objectStoreNames = { + contains(name) { + return stores.has(name); + }, + }; + + function makeDb(version) { + return { + version, + objectStoreNames, + createObjectStore(name, options = {}) { + if (!stores.has(name)) stores.set(name, { keyPath: options.keyPath || 'id', rows: new Map() }); + return {}; + }, + close() {}, + transaction(names, mode) { + const storeNames = Array.isArray(names) ? names : [names]; + const staged = new Map(storeNames.map((name) => [name, cloneRows(stores.get(name).rows)])); + const tx = { + error: null, + oncomplete: null, + onerror: null, + onabort: null, + failed: false, + objectStore(name) { + if (!staged.has(name)) throw new Error(`Unknown store ${name}`); + const def = stores.get(name); + return { + clear() { + staged.get(name).clear(); + if (control.failStore === name) { + tx.failed = true; + tx.error = new Error(`Injected IndexedDB failure for ${name}`); + } + return {}; + }, + put(record) { + if (control.failStore === name) { + tx.failed = true; + tx.error = new Error(`Injected IndexedDB failure for ${name}`); + return {}; + } + staged.get(name).set(record[def.keyPath], structuredClone(record)); + return {}; + }, + getAll() { + const req = {}; + queueMicrotask(() => { + let rows = Array.from( + staged.get(name).values(), + (value) => structuredClone(value), + ); + if (control.dropOnRead === name) rows = rows.slice(0, Math.max(0, rows.length - 1)); + req.result = rows; + req.onsuccess?.(); + }); + return req; + }, + }; + }, + }; + setTimeout(() => { + if (tx.failed) { + tx.onabort?.(); + return; + } + if (mode === 'readwrite') { + for (const [name, rows] of staged) stores.get(name).rows = rows; + } + tx.oncomplete?.(); + }, 0); + return tx; + }, + }; + } + + let version = 0; + return { + control, + stores, + open(_name, requestedVersion) { + const req = {}; + queueMicrotask(() => { + const nextVersion = requestedVersion || Math.max(1, version); + const needsUpgrade = version === 0 || nextVersion > version; + version = nextVersion; + req.result = makeDb(version); + if (needsUpgrade) { + req.transaction = req.result.transaction([], 'versionchange'); + req.onupgradeneeded?.({ target: { transaction: req.transaction } }); + } + req.onsuccess?.(); + }); + return req; + }, + }; +} + +function createStorageHarness() { + const objects = new Map(); + const uploadCounts = new Map(); + const failUploads = new Map(); + let listFailure = null; + const deps = { + appVersion: 'test', + async supaStorageDownloadAsUser(_bucket, path) { + return objects.has(path) + ? { status: 200, body: Buffer.from(objects.get(path)) } + : { status: 404, body: Buffer.from('not found') }; + }, + async supaStorageUploadAsUser(_bucket, path, body) { + uploadCounts.set(path, (uploadCounts.get(path) || 0) + 1); + const remaining = failUploads.get(path) || 0; + if (remaining > 0) { + failUploads.set(path, remaining - 1); + return { status: 503, body: 'injected upload failure' }; + } + objects.set(path, body.toString('utf8')); + return { status: 200, body: {} }; + }, + async supaStorageListAsUser() { + if (listFailure) return listFailure; + return { status: 200, body: [] }; + }, + async supaStorageRemoveAsUser() { + return { status: 200, body: {} }; + }, + assertSupaOk(res, label) { + if (res.status >= 200 && res.status < 300) return res; + throw new Error(`${label} failed: ${String(res.body)}`); + }, + isStorageAlreadyExists() { + return false; + }, + }; + return { manager: createBackupManager(deps), objects, uploadCounts, failUploads, setListFailure(value) { listFailure = value; } }; +} + +async function testNormalizerIntegrity() { + const rich = backup({ + tasks: [{ id: 'task-1', title: 'keep', updatedAt: '2026-06-19T09:00:00.000Z' }], + }, { exportedAt: '2026-06-19T09:00:00.000Z' }); + const ordinaryEmpty = backup({}, { exportedAt: '2026-06-19T11:00:00.000Z' }); + assert.equal(mergeBackupData(ordinaryEmpty, rich).tasks.length, 1, 'ordinary empty backup must not erase rich data'); + + const reset = backup({}, { + exportedAt: '2026-06-19T12:00:00.000Z', + operation: 'reset', + intentional_empty: true, + reset_at: '2026-06-19T12:00:00.000Z', + }); + const resetMerge = mergeBackupData(reset, rich); + assert.equal(resetMerge.tasks.length, 0, 'newer intentional reset must clear rich data'); + assert.equal(resetMerge.operation, 'reset'); + assert(compareBackupCandidates(normalizeAnyBackup(reset), normalizeAnyBackup(rich)) > 0, 'newer reset must outrank stale rich backup'); + + const deleted = backup({}, { + exportedAt: '2026-06-19T11:00:00.000Z', + tombstones: { tasks: [{ id: 'task-1', deletedAt: '2026-06-19T10:00:00.000Z' }] }, + }); + const tombstoneMerge = mergeBackupData(deleted, rich); + assert.equal(tombstoneMerge.tasks.length, 0, 'newer tombstone must prevent resurrection'); + assert.equal(tombstoneMerge.tombstones.tasks[0].id, 'task-1'); + + const newerRecord = backup({ + tasks: [{ id: 'task-1', title: 'recreated', updatedAt: '2026-06-19T13:00:00.000Z' }], + }, { exportedAt: '2026-06-19T13:00:00.000Z' }); + const recreated = mergeBackupData(newerRecord, deleted); + assert.equal(recreated.tasks[0].title, 'recreated', 'newer recreation must supersede stale tombstone'); + assert.equal(recreated.tombstones, undefined, 'superseded tombstone must not be propagated'); + + const canonicalReset = buildCanonicalBackupPayload(reset); + assert.equal(canonicalReset.operation, 'reset'); + assert.equal(canonicalReset.intentional_empty, true); + const canonicalDeleted = buildCanonicalBackupPayload(deleted); + assert.equal(canonicalDeleted.tombstones.tasks[0].id, 'task-1'); +} + +async function testBackupManagerIntegrity() { + const userId = 'user-1'; + const harness = createStorageHarness(); + const rich = backup({ + tasks: [{ id: 'task-1', updatedAt: '2026-06-19T09:00:00.000Z' }], + }, { exportedAt: '2026-06-19T10:00:00.000Z' }); + const mirrorPath = `${userId}/cloud-snapshot/latest.json`; + harness.failUploads.set(mirrorPath, 1); + + await assert.rejects( + harness.manager.writeCanonicalBackup(userId, 'jwt', rich), + (error) => error.code === 'CANONICAL_BACKUP_INCOMPLETE' && error.payload?.retryable === true, + ); + const latestPath = `${userId}/backups/latest.json`; + const historyPath = Array.from(harness.objects.keys()).find((path) => path.includes('/backups/history/')); + assert(harness.objects.has(latestPath), 'latest must remain recoverable after secondary failure'); + assert(historyPath, 'successful history copy must survive mirror failure'); + assert(!harness.objects.has(mirrorPath), 'failed mirror must remain visibly missing'); + + const repaired = await harness.manager.writeCanonicalBackup(userId, 'jwt', rich); + assert.equal(repaired.history_repaired, false, 'retry must not rewrite an already consistent history copy'); + assert.equal(repaired.cloud_snapshot_repaired, true, 'retry must repair the missing mirror'); + assert.equal(harness.uploadCounts.get(latestPath), 1, 'retry must reuse the committed canonical latest'); + assert.equal(harness.uploadCounts.get(historyPath), 1, 'retry must reuse the committed history copy'); + + const best = { selected_internal: { rich: true, collection_counts: { tasks: 1 } } }; + assert.throws( + () => harness.manager.assertNoEmptyOverwrite(normalizeAnyBackup(backup({})), best), + (error) => error.code === 'BLOCKED_EMPTY_OVERWRITE', + ); + assert.doesNotThrow(() => harness.manager.assertNoEmptyOverwrite(normalizeAnyBackup(backup({}, { + operation: 'reset', + intentional_empty: true, + })), best)); + + harness.setListFailure({ status: 503, body: 'list unavailable' }); + await assert.rejects( + harness.manager.findBestCloudBackup(userId, 'jwt'), + /Storage list .* failed: list unavailable/, + 'candidate listing failures must be surfaced', + ); +} + +async function testLocalRestoreIntegrity() { + const staleTask = [{ id: 'old-task', title: 'stale' }]; + const localStorage = createLocalStorage({ + isotope_tasks_v2: JSON.stringify(staleTask), + }); + const indexedDB = createFakeIndexedDB(); + globalThis.window = { + indexedDB, + localStorage, + dispatchEvent() {}, + }; + globalThis.CustomEvent = class CustomEvent { + constructor(type, init) { + this.type = type; + this.detail = init?.detail; + } + }; + const adapter = await import(`../public/sync/local-data-adapter.js?integrity=${Date.now()}`); + await adapter.readCollection('tasks'); + indexedDB.stores.get('tasks').rows.set('old-task', staleTask[0]); + + const restoredData = { + ...EMPTY_DATA, + tasks: [{ id: 'new-task', title: 'fresh' }], + sessions: [{ id: 'session-1', duration: 25 }], + }; + indexedDB.control.failStore = 'sessions'; + await assert.rejects( + adapter.writeAllLocalData(restoredData), + /Injected IndexedDB failure for sessions/, + 'IndexedDB restore failure must propagate', + ); + assert.equal(localStorage.getItem('isotope_restore_metadata'), null, 'failed restore must not write success metadata'); + assert.deepEqual(JSON.parse(localStorage.getItem('isotope_tasks_v2')), staleTask, 'localStorage must not be updated before IndexedDB commits'); + assert(indexedDB.stores.get('tasks').rows.has('old-task'), 'failed multi-store transaction must preserve stale IndexedDB atomically'); + + indexedDB.control.failStore = null; + indexedDB.control.dropOnRead = 'tasks'; + await assert.rejects( + adapter.writeAllLocalData(restoredData), + /IndexedDB restore count verification failed/, + 'post-write count verification must reject incomplete results', + ); + assert.equal(localStorage.getItem('isotope_restore_metadata'), null, 'verification failure must not write success metadata'); + + indexedDB.control.dropOnRead = null; + indexedDB.stores.get('tasks').rows.clear(); + indexedDB.stores.get('tasks').rows.set('old-task', staleTask[0]); + localStorage.control.failKey = 'isotope_sessions_v2'; + localStorage.control.failCount = 1; + await assert.rejects( + adapter.writeAllLocalData(restoredData), + /Injected localStorage failure for isotope_sessions_v2/, + 'localStorage failure must propagate', + ); + assert.deepEqual(JSON.parse(localStorage.getItem('isotope_tasks_v2')), staleTask, 'localStorage failure must roll back earlier localStorage writes'); + assert(indexedDB.stores.get('tasks').rows.has('old-task'), 'localStorage failure must roll back the IndexedDB commit'); + assert(!indexedDB.stores.get('tasks').rows.has('new-task'), 'rolled-back IndexedDB must not retain restored rows'); + + const result = await adapter.applyBackupToLocal(backup(restoredData), { source_path: 'test-backup' }); + assert.equal(result.ok, true); + assert.deepEqual(result.after_counts.tasks, 1); + assert.deepEqual(result.after_counts.sessions, 1); + const metadata = JSON.parse(localStorage.getItem('isotope_restore_metadata')); + assert.equal(metadata.collection_counts.tasks, 1); + assert(metadata.data_hash, 'successful restore metadata must include verified data hash'); +} + +const tests = [ + ['normalizer tombstones, reset, and rich-vs-empty', testNormalizerIntegrity], + ['canonical retry repair and listing errors', testBackupManagerIntegrity], + ['IndexedDB restore propagation and verification', testLocalRestoreIntegrity], +]; + +for (const [name, test] of tests) { + await test(); + console.log(`PASS ${name}`); +} diff --git a/scripts/test-server-security.mjs b/scripts/test-server-security.mjs new file mode 100644 index 0000000..5126f2e --- /dev/null +++ b/scripts/test-server-security.mjs @@ -0,0 +1,187 @@ +import assert from 'node:assert/strict'; +import https from 'node:https'; +import { PassThrough, Readable } from 'node:stream'; + +const anonKey = makeJwt({ iss: 'supabase', role: 'anon' }); +const serviceKey = makeJwt({ iss: 'supabase', role: 'service_role' }); +const userJwt = makeJwt({ + iss: 'https://security-test.supabase.co/auth/v1', + role: 'authenticated', + sub: '11111111-1111-4111-8111-111111111111', +}); +const geminiSecret = 'gemini-regression-secret-value'; +const groqSecret = 'groq-regression-secret-value'; + +process.env.ISOTOPE_TEST_MODE = '1'; +process.env.SUPABASE_URL = 'https://security-test.supabase.co'; +process.env.SUPABASE_ANON_KEY = anonKey; +process.env.SUPABASE_SERVICE_ROLE_KEY = serviceKey; +process.env.ENABLE_ADMIN_MODE = 'true'; +process.env.ADMIN_SECRET = 'admin-regression-secret'; +process.env.GEMINI_API_KEY = geminiSecret; +process.env.GROQ_API_KEY = groqSecret; + +const { + bindHost, + buildSupabaseProxyHeaders, + injectScripts, + isAdminMutationOriginAllowed, + isCorsOriginAllowed, + resolveSupabaseProxyTarget, + server, +} = await import('../server.mjs'); + +assert.equal(bindHost, '127.0.0.1', 'the default bind host must be loopback'); + +const anonymousHeaders = buildSupabaseProxyHeaders({ + apikey: serviceKey, + 'x-admin-secret': process.env.ADMIN_SECRET, +}); +assert.equal(anonymousHeaders.apikey, anonKey, 'anonymous proxy traffic must use the anon apikey'); +assert.equal(anonymousHeaders.authorization, `Bearer ${anonKey}`, 'anonymous proxy traffic must use anon authorization'); +assert.equal(anonymousHeaders['x-admin-secret'], undefined, 'admin credentials must not be forwarded upstream'); + +const userHeaders = buildSupabaseProxyHeaders({ + authorization: `Bearer ${userJwt}`, + apikey: serviceKey, +}); +assert.equal(userHeaders.apikey, anonKey, 'authenticated proxy traffic must still use the anon apikey'); +assert.equal(userHeaders.authorization, `Bearer ${userJwt}`, 'authenticated proxy traffic must preserve the user JWT'); + +assert.throws( + () => buildSupabaseProxyHeaders({ authorization: `Bearer ${serviceKey}` }), + /Service-role credentials are not accepted/, + 'the general proxy must reject service-role bearer credentials' +); +assert.equal( + resolveSupabaseProxyTarget('/__supa/rest/v1/profiles?select=id', 'GET'), + '/rest/v1/profiles?select=id' +); +assert.throws( + () => resolveSupabaseProxyTarget('/__supa/auth/v1/admin/users', 'GET'), + /path is not allowed/ +); + +const html = injectScripts(''); +assert.doesNotMatch(html, new RegExp(escapeRegExp(geminiSecret)), 'served HTML must not contain the Gemini key'); +assert.doesNotMatch(html, new RegExp(escapeRegExp(groqSecret)), 'served HTML must not contain the Groq key'); +assert.doesNotMatch(html, /window\.__IK__/, 'served HTML must not expose the former browser key bridge'); + +const sameOriginReq = { + headers: { host: '127.0.0.1:3000', origin: 'http://127.0.0.1:3000' }, + socket: {}, +}; +const hostileOriginReq = { + headers: { host: '127.0.0.1:3000', origin: 'https://attacker.example' }, + socket: {}, +}; +assert.equal(isCorsOriginAllowed(sameOriginReq), true, 'same-origin local requests must remain allowed'); +assert.equal(isCorsOriginAllowed(hostileOriginReq), false, 'arbitrary origins must not receive CORS access'); +assert.equal(isAdminMutationOriginAllowed({ + method: 'POST', + headers: { host: '127.0.0.1:3000', origin: 'http://127.0.0.1:3000' }, + socket: {}, +}), true, 'same-origin browser admin mutations must remain allowed'); +assert.equal(isAdminMutationOriginAllowed({ + method: 'POST', + headers: { host: '127.0.0.1:3000', origin: 'https://attacker.example' }, + socket: {}, +}), false, 'cross-site browser admin mutations must be blocked'); +assert.equal(isAdminMutationOriginAllowed({ + method: 'POST', + headers: { host: '127.0.0.1:3000', 'x-admin-secret': process.env.ADMIN_SECRET }, + socket: {}, +}), true, 'explicit CLI admin authentication must not require a browser Origin'); + +await new Promise((resolve, reject) => { + server.once('error', reject); + server.listen(0, '127.0.0.1', resolve); +}); +try { + const address = server.address(); + const base = `http://127.0.0.1:${address.port}`; + + const rootResponse = await fetch(base + '/', { headers: { Origin: base } }); + assert.equal(rootResponse.status, 200); + assert.equal(rootResponse.headers.get('access-control-allow-origin'), base); + const servedHtml = await rootResponse.text(); + assert.equal(servedHtml.includes(geminiSecret), false, 'actual served HTML must not contain the Gemini key'); + assert.equal(servedHtml.includes(groqSecret), false, 'actual served HTML must not contain the Groq key'); + + const hostileResponse = await fetch(base + '/', { + headers: { Origin: 'https://attacker.example' }, + }); + assert.equal(hostileResponse.status, 200, 'ordinary same-site serving behavior should remain intact'); + assert.equal(hostileResponse.headers.get('access-control-allow-origin'), null); + + const hostilePreflight = await fetch(base + '/__supa/rest/v1/profiles', { + method: 'OPTIONS', + headers: { + Origin: 'https://attacker.example', + 'Access-Control-Request-Method': 'GET', + }, + }); + assert.equal(hostilePreflight.status, 403); + assert.equal(hostilePreflight.headers.get('access-control-allow-origin'), null); + + const querySecret = await fetch(base + '/__admin/verify?secret=' + encodeURIComponent(process.env.ADMIN_SECRET), { + redirect: 'manual', + }); + assert.equal(querySecret.status, 200, 'unauthenticated admin GET should show the login page'); + assert.match(await querySecret.text(), /Admin Unlock/, 'admin secrets in URLs must not authenticate'); + + const originalHttpsRequest = https.request; + const capturedRequests = []; + https.request = (options, callback) => { + capturedRequests.push(options); + const request = new PassThrough(); + process.nextTick(() => { + const response = Readable.from(['[]']); + response.statusCode = 200; + response.headers = { 'content-type': 'application/json' }; + callback(response); + }); + return request; + }; + try { + const anonymousProxy = await fetch(base + '/__supa/rest/v1/profiles?select=id'); + assert.equal(anonymousProxy.status, 200); + assert.equal(capturedRequests[0].headers.apikey, anonKey); + assert.equal(capturedRequests[0].headers.authorization, `Bearer ${anonKey}`); + + const userProxy = await fetch(base + '/__supa/rest/v1/profiles?select=id', { + headers: { Authorization: `Bearer ${userJwt}` }, + }); + assert.equal(userProxy.status, 200); + assert.equal(capturedRequests[1].headers.apikey, anonKey); + assert.equal(capturedRequests[1].headers.authorization, `Bearer ${userJwt}`); + } finally { + https.request = originalHttpsRequest; + } + + const serviceRoleProxy = await fetch(base + '/__supa/rest/v1/profiles', { + headers: { Authorization: `Bearer ${serviceKey}` }, + }); + assert.equal(serviceRoleProxy.status, 403); + assert.match(await serviceRoleProxy.text(), /Service-role credentials are not accepted/); +} finally { + await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve())); +} + +console.log('PASS server proxy authority, HTML secret isolation, and CORS policy'); + +function makeJwt(payload) { + return [ + encode({ alg: 'HS256', typ: 'JWT' }), + encode(payload), + 'test-signature', + ].join('.'); +} + +function encode(value) { + return Buffer.from(JSON.stringify(value)).toString('base64url'); +} + +function escapeRegExp(value) { + return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} diff --git a/scripts/verify-sql-hardening.sql b/scripts/verify-sql-hardening.sql new file mode 100644 index 0000000..6300d1c --- /dev/null +++ b/scripts/verify-sql-hardening.sql @@ -0,0 +1,241 @@ +-- Post-migration catalog verification for +-- sql/007_comprehensive_sql_rls_hardening.sql. +-- +-- Run in the Supabase SQL editor after applying migration 007. The DO blocks +-- fail on security regressions; the final queries report duplicate indexes and +-- the effective policy/grant surface for review. + +do $$ +declare + v_names text; +begin + select string_agg(format('%I.%I', n.nspname, c.relname), ', ' order by n.nspname, c.relname) + into v_names + from pg_class c + join pg_namespace n on n.oid = c.relnamespace + where n.nspname = 'public' + and c.relkind in ('r', 'p') + and c.relname = any (array[ + 'users', 'user_display_profiles', 'user_profiles', 'user_points', 'user_stats_summary', + 'daily_user_stats', 'study_sessions_log', 'user_presence', + 'user_onboarding', 'user_settings', 'user_roles', 'backup_manifests', + 'sync_items', 'notifications', 'groups', 'group_members', + 'group_chat_messages', 'group_invites', 'group_announcements', + 'group_milestones', 'group_challenges', 'group_challenge_participants', + 'store_items', 'user_inventory', 'community_events', + 'community_event_attendees', 'user_tours' + ]) + and not c.relrowsecurity; + + if v_names is not null then + raise exception 'RLS is disabled on managed tables: %', v_names; + end if; +end +$$; + +do $$ +declare + v_names text; +begin + select string_agg(p.oid::regprocedure::text, ', ' order by p.oid::regprocedure::text) + into v_names + from pg_proc p + join pg_namespace n on n.oid = p.pronamespace + where n.nspname in ('public', 'private') + and p.prosecdef + and not coalesce(p.proconfig, '{}'::text[]) @> array['search_path=""']; + + if v_names is not null then + raise exception 'SECURITY DEFINER functions without empty search_path: %', v_names; + end if; +end +$$; + +do $$ +declare + v_names text; +begin + select string_agg(p.oid::regprocedure::text, ', ' order by p.oid::regprocedure::text) + into v_names + from pg_proc p + join pg_namespace n on n.oid = p.pronamespace + where n.nspname in ('public', 'private') + and exists ( + select 1 + from aclexplode(coalesce(p.proacl, acldefault('f', p.proowner))) acl + where acl.grantee = 0 + and acl.privilege_type = 'EXECUTE' + ); + + if v_names is not null then + raise exception 'Functions executable by PUBLIC: %', v_names; + end if; +end +$$; + +do $$ +begin + if exists ( + select 1 + from pg_namespace n + cross join lateral aclexplode(coalesce(n.nspacl, acldefault('n', n.nspowner))) acl + where n.nspname = 'public' + and acl.grantee = 0 + and acl.privilege_type = 'CREATE' + ) + or has_schema_privilege('anon', 'public', 'CREATE') + or has_schema_privilege('authenticated', 'public', 'CREATE') then + raise exception 'API roles can create objects in the public schema'; + end if; + + if has_table_privilege('anon', 'public.users', 'SELECT') + or has_column_privilege('anon', 'public.users', 'email', 'SELECT') then + raise exception 'anon can read public.users or public.users.email'; + end if; + + if exists ( + select 1 + from information_schema.columns + where table_schema = 'public' + and table_name = 'user_display_profiles' + and column_name = 'email' + ) then + raise exception 'public.user_display_profiles exposes email'; + end if; + + if exists ( + select 1 + from pg_class c + join pg_namespace n on n.oid = c.relnamespace + where n.nspname = 'public' + and c.relname = 'user_display_profiles' + and c.relkind in ('v', 'm') + ) then + raise exception 'public.user_display_profiles must be a table, not a definer view'; + end if; + + if not has_table_privilege('anon', 'public.user_display_profiles', 'SELECT') + or not has_table_privilege('authenticated', 'public.user_display_profiles', 'SELECT') then + raise exception 'safe display view is not readable by expected API roles'; + end if; +end +$$; + +do $$ +declare + v_names text; +begin + select string_agg( + format('%I.%I granted to %I', table_schema, table_name, grantee), + ', ' order by table_schema, table_name, grantee + ) + into v_names + from information_schema.role_table_grants + where grantee in ('PUBLIC', 'anon', 'authenticated') + and table_schema = 'public' + and privilege_type in ('INSERT', 'UPDATE', 'DELETE') + and table_name = any (array[ + 'user_roles', 'group_milestones', 'store_items', 'community_events' + ]); + + if v_names is not null then + raise exception 'API roles have writes on read-only tables: %', v_names; + end if; +end +$$; + +do $$ +begin + if has_column_privilege('authenticated', 'public.group_members', 'group_id', 'UPDATE') + or has_column_privilege('authenticated', 'public.group_members', 'user_id', 'UPDATE') + or has_column_privilege('authenticated', 'public.group_chat_messages', 'group_id', 'UPDATE') + or has_column_privilege('authenticated', 'public.group_chat_messages', 'user_id', 'UPDATE') + or has_column_privilege('authenticated', 'public.group_challenge_participants', 'challenge_id', 'UPDATE') + or has_column_privilege('authenticated', 'public.group_challenge_participants', 'user_id', 'UPDATE') + or has_column_privilege('authenticated', 'public.user_points', 'lifetime_points', 'UPDATE') + or has_table_privilege('authenticated', 'public.user_points', 'DELETE') then + raise exception 'authenticated can rewrite protected relationship or points columns'; + end if; + + if to_regclass('public.user_inventory') is not null + and ( + has_column_privilege('authenticated', 'public.user_inventory', 'user_id', 'UPDATE') + or has_column_privilege('authenticated', 'public.user_inventory', 'item_id', 'UPDATE') + ) then + raise exception 'authenticated can rewrite inventory ownership keys'; + end if; +end +$$; + +do $$ +declare + v_using text; + v_check text; +begin + select qual, with_check + into v_using, v_check + from pg_policies + where schemaname = 'public' + and tablename = 'group_members' + and policyname = 'group_members_update_managed'; + + if v_using is null + or v_check is null + or v_using not like '%can_manage_group%' + or v_check not like '%can_manage_group%' + or v_using like '%user_id = ( SELECT auth.uid()%' then + raise exception 'group member update policy permits unmanaged role changes'; + end if; +end +$$; + +-- Must return zero rows. Multiple permissive policies for the same role and +-- command are ORed together and are commonly an accidental broadening. +select schemaname, tablename, role_name, cmd, array_agg(policyname order by policyname) +from ( + select p.schemaname, p.tablename, p.policyname, p.cmd, unnest(p.roles) as role_name + from pg_policies p + where p.permissive = 'PERMISSIVE' + and p.schemaname in ('public', 'storage') +) expanded +group by schemaname, tablename, role_name, cmd +having count(*) > 1 +order by schemaname, tablename, role_name, cmd; + +-- Review structural duplicate indexes. Constraint-owned indexes are included +-- for context and should not be dropped solely from this report. +select + n.nspname as schema_name, + t.relname as table_name, + array_agg(i.relname order by i.relname) as duplicate_indexes, + min(pg_get_indexdef(x.indexrelid)) as example_definition +from pg_index x +join pg_class i on i.oid = x.indexrelid +join pg_class t on t.oid = x.indrelid +join pg_namespace n on n.oid = t.relnamespace +where n.nspname = 'public' +group by + n.nspname, + t.relname, + x.indisunique, + x.indisprimary, + x.indexprs::text, + x.indpred::text, + x.indclass, + x.indkey, + x.indcollation, + x.indoption +having count(*) > 1 +order by n.nspname, t.relname; + +select + schemaname, + tablename, + policyname, + roles, + cmd, + qual, + with_check +from pg_policies +where schemaname in ('public', 'storage') +order by schemaname, tablename, policyname; diff --git a/server.mjs b/server.mjs index cc11afe..b5d4e39 100644 --- a/server.mjs +++ b/server.mjs @@ -79,6 +79,37 @@ if (_dotenvResults.length) { } const port = process.env.PORT || 3000; +const bindHost = String(process.env.ISOTOPE_BIND_HOST || '127.0.0.1').trim() || '127.0.0.1'; +const CORS_ALLOWED_ORIGINS = new Set( + String(process.env.CORS_ALLOWED_ORIGINS || '') + .split(',') + .map((origin) => origin.trim()) + .filter(Boolean) +); + +function requestOrigin(req) { + const host = String(req.headers.host || '').trim(); + if (!host) return ''; + const forwardedProto = String(req.headers['x-forwarded-proto'] || '').split(',')[0].trim().toLowerCase(); + const protocol = forwardedProto === 'https' || req.socket?.encrypted ? 'https' : 'http'; + return `${protocol}://${host}`; +} + +function isCorsOriginAllowed(req, origin = req.headers.origin) { + const candidate = String(origin || '').trim(); + if (!candidate) return true; + return candidate === requestOrigin(req) || CORS_ALLOWED_ORIGINS.has(candidate); +} + +function applyCorsHeaders(req, res) { + const origin = String(req.headers.origin || '').trim(); + if (!origin || !isCorsOriginAllowed(req, origin)) return false; + res.setHeader('Access-Control-Allow-Origin', origin); + res.setHeader('Vary', 'Origin'); + res.setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS'); + res.setHeader('Access-Control-Allow-Headers', 'Content-Type,Authorization,apikey,x-client-info,prefer,range,X-Admin-Secret'); + return true; +} const MIME_TYPES = { '.html': 'text/html; charset=utf-8', @@ -233,13 +264,8 @@ const ADMIN_MODE_READY = ENABLE_ADMIN_MODE && !!SUPA_SERVICE_KEY && !!ADMIN_COO function isAdminAuthed(req) { if (!ADMIN_MODE_READY) return false; const headerTok = (req.headers['x-admin-secret'] || '').trim(); - let queryTok = ''; - try { - const sp = new URL('http://x' + req.url).searchParams; - queryTok = sp.get('secret') || ''; - } catch {} const cookieTok = readCookie(req, 'iso_admin'); - return (!!ADMIN_SECRET && (headerTok === ADMIN_SECRET || queryTok === ADMIN_SECRET)) || cookieTok === adminCookieValue(); + return (!!ADMIN_SECRET && headerTok === ADMIN_SECRET) || cookieTok === adminCookieValue(); } function readCookie(req, name) { @@ -263,6 +289,19 @@ function isRequestHttps(req) { return !!(req.socket && req.socket.encrypted); } +function isAdminMutationOriginAllowed(req) { + const method = String(req.method || 'GET').toUpperCase(); + if (!['POST', 'PUT', 'PATCH', 'DELETE'].includes(method)) return true; + if (ADMIN_SECRET && String(req.headers['x-admin-secret'] || '').trim() === ADMIN_SECRET) return true; + const source = String(req.headers.origin || req.headers.referer || '').trim(); + if (!source) return false; + try { + return new URL(source).origin === requestOrigin(req); + } catch { + return false; + } +} + function escapeHtml(value) { return String(value || '').replace(/[&<>"']/g, (ch) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' @@ -393,26 +432,6 @@ if (CUSTOM_SUPA) { console.log('[Cloud] Supabase cloud sync target ready'); } -// ── AI key injection ────────────────────────────────────────────────────────── -function buildKeyScript() { - const keys = {}; - if (GEMINI_API_KEY) keys.gemini = GEMINI_API_KEY; - if (GROQ_API_KEY) keys.groq = GROQ_API_KEY; - if (Object.keys(keys).length === 0) return ''; - return ``; -} -const KEY_SCRIPT = buildKeyScript(); - // ── Username-auth client helper (injected into every HTML page) ─────────────── // Build dynamically so SUPA_REF reflects the actual SUPA_URL env var at startup function buildUsernameAuthScript() { @@ -1517,8 +1536,8 @@ function buildUsernameAuthScript() { username: prof.username || '', display_name: prof.display_name || prof.name || prof.username || '', avatar_url: prof.avatar_url || prof.avatar || null, - plan_type: 'ranker', - billing_status:'active', + plan_type: prof.plan_type || null, + billing_status:prof.billing_status || null, coins: Number(prof.coins) || 0, gems: Number(prof.gems) || 0, synced_at: Date.now() @@ -1604,17 +1623,16 @@ function buildUsernameAuthScript() { var jwt = data.session && data.session.access_token; // Track onboarding from the login response first var onboarding_completed = data.onboarding_completed === true; - // Profile sync is BEST-EFFORT — network failure must NOT prevent login. - // The double-login bug was caused by syncProfileAfterLogin throwing and - // being caught by the outer catch, making __isoLogin return {ok:false}. + // Profile sync is best-effort and deliberately detached from the login + // response. The server already returned the routing decision; waiting for + // the full cloud bootstrap made every successful login pay another network + // round trip before navigation. if (jwt) { - try { - var snap = await syncProfileAfterLogin(jwt); - if (snap) onboarding_completed = snap.onboarding_completed === true; - } catch(syncErr) { + Promise.resolve().then(function() { + return syncProfileAfterLogin(jwt); + }).catch(function(syncErr) { console.warn('[Auth] Profile sync after login failed (non-fatal):', syncErr && syncErr.message); - // Still succeed — the session is valid, the app will retry sync later. - } + }); // AUTH GATE: new valid session → unblock sync immediately try { if (window.__isoSyncAuthUnblock) window.__isoSyncAuthUnblock(); } catch(_ue) {} } @@ -2207,114 +2225,15 @@ function buildLocalDataGuardScript() { } const LOCAL_DATA_GUARD_SCRIPT = buildLocalDataGuardScript(); -// ── Combined premium bypass + profile upgrade ───────────────────────────────── -// -// TWO mechanisms work together: -// -// 1. RESPONSE PATCH – every Supabase JSON response has plan_type→ranker so -// client-side premium checks always pass. -// -// 2. PROFILE UPGRADE – after login (or on page load with existing session) we -// PATCH the real Supabase profiles row to plan_type='ranker'. -// Once saved, is_premium_user() in PostgreSQL returns true, so normal -// authenticated RLS policies pass. On success: reload once to flush React -// Query stale cache. -// +// ── Supabase runtime compatibility layer ────────────────────────────────────── +// Keeps the existing edge-function fallbacks and auth/session compatibility +// without mutating billing fields or rewriting Supabase responses in the browser. const PREMIUM_SCRIPT = ` - - - - + + - diff --git a/lighthouserc.cjs b/lighthouserc.cjs new file mode 100644 index 0000000..27cab51 --- /dev/null +++ b/lighthouserc.cjs @@ -0,0 +1,38 @@ +module.exports = { + ci: { + collect: { + startServerCommand: + 'PORT=4173 ISOTOPE_BIND_HOST=127.0.0.1 ' + + 'SUPABASE_URL=https://placeholder.supabase.co ' + + 'SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiYW5vbiIsInJlZiI6InRlc3QifQ.signature ' + + 'SESSION_SECRET=lighthouse_ci_local_only node server.mjs', + startServerReadyPattern: 'IsotopeAI running on', + startServerReadyTimeout: 30000, + url: [ + 'http://127.0.0.1:4173/auth', + ], + numberOfRuns: 3, + settings: { + chromeFlags: '--headless=new --no-sandbox --disable-dev-shm-usage', + onlyCategories: ['performance', 'accessibility', 'best-practices', 'seo'], + }, + }, + assert: { + assertions: { + 'categories:performance': ['error', { minScore: 0.75 }], + 'categories:accessibility': ['error', { minScore: 0.9 }], + 'categories:best-practices': ['error', { minScore: 0.9 }], + 'categories:seo': ['error', { minScore: 0.9 }], + 'first-contentful-paint': ['error', { maxNumericValue: 2500 }], + 'largest-contentful-paint': ['error', { maxNumericValue: 4000 }], + 'cumulative-layout-shift': ['error', { maxNumericValue: 0.1 }], + 'total-blocking-time': ['error', { maxNumericValue: 500 }], + }, + }, + upload: { + target: 'filesystem', + outputDir: 'artifacts/lighthouse', + reportFilenamePattern: '%%HOSTNAME%%-%%PATHNAME%%-%%DATETIME%%.report.%%EXTENSION%%', + }, + }, +}; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..347c15c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3971 @@ +{ + "name": "isotope-code", + "version": "3.3.8", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "isotope-code", + "version": "3.3.8", + "devDependencies": { + "@lhci/cli": "0.15.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@formatjs/ecma402-abstract": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-2.3.6.tgz", + "integrity": "sha512-HJnTFeRM2kVFVr5gr5kH1XP6K0JcJtE7Lzvtr3FS/so5f1kpsqqqxy5JF+FRaO6H2qmcMfAUIox7AJteieRtVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@formatjs/fast-memoize": "2.2.7", + "@formatjs/intl-localematcher": "0.6.2", + "decimal.js": "^10.4.3", + "tslib": "^2.8.0" + } + }, + "node_modules/@formatjs/fast-memoize": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-2.2.7.tgz", + "integrity": "sha512-Yabmi9nSvyOMrlSeGGWDiH7rf3a7sIwplbvo/dlz9WCIjzIQAfy1RMf4S0X3yG724n5Ghu2GmEl5NJIV6O9sZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@formatjs/icu-messageformat-parser": { + "version": "2.11.4", + "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.11.4.tgz", + "integrity": "sha512-7kR78cRrPNB4fjGFZg3Rmj5aah8rQj9KPzuLsmcSn4ipLXQvC04keycTI1F7kJYDwIXtT2+7IDEto842CfZBtw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@formatjs/ecma402-abstract": "2.3.6", + "@formatjs/icu-skeleton-parser": "1.8.16", + "tslib": "^2.8.0" + } + }, + "node_modules/@formatjs/icu-skeleton-parser": { + "version": "1.8.16", + "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.8.16.tgz", + "integrity": "sha512-H13E9Xl+PxBd8D5/6TVUluSpxGNvFSlN/b3coUp0e0JpuWXXnQDiavIpY3NnvSp4xhEMoXyyBvVfdFX8jglOHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@formatjs/ecma402-abstract": "2.3.6", + "tslib": "^2.8.0" + } + }, + "node_modules/@formatjs/intl-localematcher": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.6.2.tgz", + "integrity": "sha512-XOMO2Hupl0wdd172Y06h6kLpBz6Dv+J4okPLl4LPtzbr8f66WbIoy4ev98EBuZ6ZK4h5ydTN6XneT4QVpD7cdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@lhci/cli": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@lhci/cli/-/cli-0.15.1.tgz", + "integrity": "sha512-yhC0oXnXqGHYy1xl4D8YqaydMZ/khFAnXGY/o2m/J3PqPa/D0nj3V6TLoH02oVMFeEF2AQim7UbmdXMiXx2tOw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@lhci/utils": "0.15.1", + "chrome-launcher": "^0.13.4", + "compression": "^1.7.4", + "debug": "^4.3.1", + "express": "^4.17.1", + "inquirer": "^6.3.1", + "isomorphic-fetch": "^3.0.0", + "lighthouse": "12.6.1", + "lighthouse-logger": "1.2.0", + "open": "^7.1.0", + "proxy-agent": "^6.4.0", + "tmp": "^0.1.0", + "uuid": "^8.3.1", + "yargs": "^15.4.1", + "yargs-parser": "^13.1.2" + }, + "bin": { + "lhci": "src/cli.js" + } + }, + "node_modules/@lhci/utils": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@lhci/utils/-/utils-0.15.1.tgz", + "integrity": "sha512-WclJnUQJeOMY271JSuaOjCv/aA0pgvuHZS29NFNdIeI14id8eiFsjith85EGKYhljgoQhJ2SiW4PsVfFiakNNw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.3.1", + "isomorphic-fetch": "^3.0.0", + "js-yaml": "^3.13.1", + "lighthouse": "12.6.1", + "tree-kill": "^1.2.1" + } + }, + "node_modules/@paulirish/trace_engine": { + "version": "0.0.53", + "resolved": "https://registry.npmjs.org/@paulirish/trace_engine/-/trace_engine-0.0.53.tgz", + "integrity": "sha512-PUl/vlfo08Oj804VI5nDPeSk9vyslnBlVzDDwFt8SUVxY8+KdGMkra/vrXjEEHe8gb7+RqVTfOIlGw0nyrEelA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "legacy-javascript": "latest", + "third-party-web": "latest" + } + }, + "node_modules/@puppeteer/browsers": { + "version": "2.13.2", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.13.2.tgz", + "integrity": "sha512-5EUZSUIc37H6aIXyWO0Z4y8NlF8NnjgmqeQgOGiswAU7pY0HOo16ho4+alIWmSfdZnjqBRawMsP3I5YqLSn6kw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.4.3", + "extract-zip": "^2.0.1", + "progress": "^2.0.3", + "proxy-agent": "^6.5.0", + "semver": "^7.7.4", + "tar-fs": "^3.1.1", + "yargs": "^17.7.2" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@puppeteer/browsers/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@puppeteer/browsers/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "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/@puppeteer/browsers/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "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/@puppeteer/browsers/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@puppeteer/browsers/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@puppeteer/browsers/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@puppeteer/browsers/node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@puppeteer/browsers/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "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/@puppeteer/browsers/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@puppeteer/browsers/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "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/@puppeteer/browsers/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/@puppeteer/browsers/node_modules/yargs": { + "version": "17.7.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.3.tgz", + "integrity": "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==", + "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/@puppeteer/browsers/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/@sentry-internal/tracing": { + "version": "7.120.4", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.120.4.tgz", + "integrity": "sha512-Fz5+4XCg3akeoFK+K7g+d7HqGMjmnLoY2eJlpONJmaeT9pXY7yfUyXKZMmMajdE2LxxKJgQ2YKvSCaGVamTjHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sentry/core": "7.120.4", + "@sentry/types": "7.120.4", + "@sentry/utils": "7.120.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/core": { + "version": "7.120.4", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.120.4.tgz", + "integrity": "sha512-TXu3Q5kKiq8db9OXGkWyXUbIxMMuttB5vJ031yolOl5T/B69JRyAoKuojLBjRv1XX583gS1rSSoX8YXX7ATFGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sentry/types": "7.120.4", + "@sentry/utils": "7.120.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/integrations": { + "version": "7.120.4", + "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.120.4.tgz", + "integrity": "sha512-kkBTLk053XlhDCg7OkBQTIMF4puqFibeRO3E3YiVc4PGLnocXMaVpOSCkMqAc1k1kZ09UgGi8DxfQhnFEjUkpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sentry/core": "7.120.4", + "@sentry/types": "7.120.4", + "@sentry/utils": "7.120.4", + "localforage": "^1.8.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/node": { + "version": "7.120.4", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.120.4.tgz", + "integrity": "sha512-qq3wZAXXj2SRWhqErnGCSJKUhPSlZ+RGnCZjhfjHpP49KNpcd9YdPTIUsFMgeyjdh6Ew6aVCv23g1hTP0CHpYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sentry-internal/tracing": "7.120.4", + "@sentry/core": "7.120.4", + "@sentry/integrations": "7.120.4", + "@sentry/types": "7.120.4", + "@sentry/utils": "7.120.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/types": { + "version": "7.120.4", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.120.4.tgz", + "integrity": "sha512-cUq2hSSe6/qrU6oZsEP4InMI5VVdD86aypE+ENrQ6eZEVLTCYm1w6XhW1NvIu3UuWh7gZec4a9J7AFpYxki88Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@sentry/utils": { + "version": "7.120.4", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.120.4.tgz", + "integrity": "sha512-zCKpyDIWKHwtervNK2ZlaK8mMV7gVUijAgFeJStH+CU/imcdquizV3pFLlSQYRswG+Lbyd6CT/LGRh3IbtkCFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sentry/types": "7.120.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "26.0.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.0.0.tgz", + "integrity": "sha512-vf2YFi1iY9lHGwNJMs01biZFbKJkrZR1T6/MlzjhJLPdntOHLhTrDSnSVcdtvjihi4VQNlrFRIxLsDBlQpAipA==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~8.3.0" + } + }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/accepts/node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/axe-core": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.12.1.tgz", + "integrity": "sha512-s7iGf5GaVMxEG0ENN9x+xTr7GFZCb1ZP/1uATUpCEK2X78nDB3RwbtFCo9pGAf9ru+VwoQ464DkaLEeRM08wJA==", + "dev": true, + "license": "MPL-2.0", + "engines": { + "node": ">=4" + } + }, + "node_modules/b4a": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.8.1.tgz", + "integrity": "sha512-aiqre1Nr0B/6DgE2N5vwTc+2/oQZ4Wh1t4NznYY4E00y8LCt6NqdRv81so00oo27D8MVKTpUa/MwUUtBLXCoDw==", + "dev": true, + "license": "Apache-2.0", + "peerDependencies": { + "react-native-b4a": "*" + }, + "peerDependenciesMeta": { + "react-native-b4a": { + "optional": true + } + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/bare-events": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.9.1.tgz", + "integrity": "sha512-Z0oHEHAFDZkffN8Qc39zNZjQlMDkPJRyyyZieU1VH7u8c5S+qHZ2S8ixdKIAxEjfHO7FJxXmJWgteOghVanIsg==", + "dev": true, + "license": "Apache-2.0", + "peerDependencies": { + "bare-abort-controller": "*" + }, + "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + } + } + }, + "node_modules/bare-fs": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.7.2.tgz", + "integrity": "sha512-aTvMFUWkBmjzKtEQMDGGDNF8bkfpD5N1b/FCwt7A3wrU4t1o/e/85Wzkluh6JlODCjqVESYCkQCdTXqZ9G7VFg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bare-events": "^2.5.4", + "bare-path": "^3.0.0", + "bare-stream": "^2.6.4", + "bare-url": "^2.2.2", + "fast-fifo": "^1.3.2" + }, + "engines": { + "bare": ">=1.16.0" + }, + "peerDependencies": { + "bare-buffer": "*" + }, + "peerDependenciesMeta": { + "bare-buffer": { + "optional": true + } + } + }, + "node_modules/bare-os": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.9.1.tgz", + "integrity": "sha512-6M5XjcnsygQNPMCMPXSK379xrJFiZ/AEMNBmFEmQW8d/789VQATvriyi5r0HYTL9TkQ26rn3kgdTG3aisbrXkQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "bare": ">=1.14.0" + } + }, + "node_modules/bare-path": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.0.1.tgz", + "integrity": "sha512-ghj2DSK/2e99a1anTVPCV4m4YIYtrbXhfM7V3D7XZLOTsybnYyaJloymGqssQc8l/or0UoDyRtNQkmkEF/ysgQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bare-os": "^3.0.1" + } + }, + "node_modules/bare-stream": { + "version": "2.13.3", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.3.tgz", + "integrity": "sha512-Kc+brLqvEqGkjyfiwJmImAOqLZL7OsoLKuavx+hJjgVV3nLTOjloJyPMFxjUPerGGHrNH0fLU06jjykMLWrERQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "b4a": "^1.8.1", + "streamx": "^2.25.0", + "teex": "^1.0.1" + }, + "peerDependencies": { + "bare-abort-controller": "*", + "bare-buffer": "*", + "bare-events": "*" + }, + "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + }, + "bare-buffer": { + "optional": true + }, + "bare-events": { + "optional": true + } + } + }, + "node_modules/bare-url": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.4.5.tgz", + "integrity": "sha512-K+y9xF1tN+CdPu4qWwr0QiK1Al07eFPGYK5M2pDXcmHdMdgC/tT/bpmMe1hrmRHaidKLkXrC+cRNYf3XVDUhSQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bare-path": "^3.0.0" + } + }, + "node_modules/basic-ftp": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.3.1.tgz", + "integrity": "sha512-bopVNp6ugyA150DDuZfPFdt1KZ5a94ZDiwX4hMgZDzF+GttD80lEy8kj98kbyhLXnPvhtIo93mdnLIjpCAeeOw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/body-parser": { + "version": "1.20.5", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.5.tgz", + "integrity": "sha512-3grm+/2tUOvu2cjJkvsIxrv/wVpfXQW4PsQHYm7yk4vfpu7Ekl6nEsYBoJUL6qDwZUx8wUhQ8tR2qz+ad9c9OA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "~1.2.0", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "on-finished": "~2.4.1", + "qs": "~6.15.1", + "raw-body": "~2.5.3", + "type-is": "~1.6.18", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz", + "integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "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", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "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/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true, + "license": "MIT" + }, + "node_modules/chrome-launcher": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-0.13.4.tgz", + "integrity": "sha512-nnzXiDbGKjDSK6t2I+35OAPBy5Pw/39bgkb/ZAFwMhwJbdYBp6aH+vW28ZgtjdU890Q7D+3wN/tB8N66q5Gi2A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/node": "*", + "escape-string-regexp": "^1.0.5", + "is-wsl": "^2.2.0", + "lighthouse-logger": "^1.0.0", + "mkdirp": "^0.5.3", + "rimraf": "^3.0.2" + } + }, + "node_modules/chromium-bidi": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-14.0.0.tgz", + "integrity": "sha512-9gYlLtS6tStdRWzrtXaTMnqcM4dudNegMXJxkR0I/CXObHalYeYcAMPrL19eroNZHtJ8DQmu1E+ZNOYu/IXMXw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "mitt": "^3.0.1", + "zod": "^3.24.1" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, + "node_modules/cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "restore-cursor": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cli-width": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", + "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", + "dev": true, + "license": "ISC" + }, + "node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "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/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/compression": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.8.1.tgz", + "integrity": "sha512-9mAqGPHLakhCLeNyxPkK4xVo746zQ/czLH1Ky+vkitMnWfWZps8r0qXuwhwizagCRttsL4lfG4pIOvaWLpAP0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "compressible": "~2.0.18", + "debug": "2.6.9", + "negotiator": "~0.6.4", + "on-headers": "~1.1.0", + "safe-buffer": "5.2.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/compression/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/compression/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", + "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==", + "dev": true, + "license": "MIT" + }, + "node_modules/crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/csp_evaluator": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/csp_evaluator/-/csp_evaluator-1.1.5.tgz", + "integrity": "sha512-EL/iN9etCTzw/fBnp0/uj0f5BOOGvZut2mzsiiBZ/FdT6gFQCKRO/tmcKOxn5drWZ2Ndm/xBb1SI4zwWbGtmIw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, + "node_modules/define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/devtools-protocol": { + "version": "0.0.1467305", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1467305.tgz", + "integrity": "sha512-LxwMLqBoPPGpMdRL4NkLFRNy3QLp6Uqa7GNp1v6JaBheop2QrB9Q7q0A/q/CYYP9sBfZdHOyszVx4gc9zyk7ow==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "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", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "dev": true, + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "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==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/enquirer": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", + "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^4.1.1", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/enquirer/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/enquirer/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "dev": true, + "license": "MIT" + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "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", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/events-universal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz", + "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bare-events": "^2.7.0" + } + }, + "node_modules/express": { + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.22.2.tgz", + "integrity": "sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "~1.20.5", + "content-disposition": "~0.5.4", + "content-type": "~1.0.4", + "cookie": "~0.7.1", + "cookie-signature": "~1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.3.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "~0.1.12", + "proxy-addr": "~2.0.7", + "qs": "~6.15.1", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "~0.19.0", + "serve-static": "~1.16.2", + "setprototypeof": "1.2.0", + "statuses": "~2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/express/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "license": "MIT", + "dependencies": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/finalhandler": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz", + "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "~2.4.1", + "parseurl": "~1.3.3", + "statuses": "~2.0.2", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "license": "ISC" + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "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-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-uri": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz", + "integrity": "sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "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/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/http-link-header": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/http-link-header/-/http-link-header-1.1.3.tgz", + "integrity": "sha512-3cZ0SRL8fb9MUlU3mKM61FcQvPfXx2dBrZW3Vbg5CXa8jFlK8OaEpePenLe1oEXQduhz8b0QjsqfS59QP4AJDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/image-ssim": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/image-ssim/-/image-ssim-0.2.0.tgz", + "integrity": "sha512-W7+sO6/yhxy83L0G7xR8YAc5Z5QFtYEXXRV6EaE8tuYBZJnA3gVgp3q7X7muhLZVodeb9UfvjSbwt9VJwjIYAg==", + "dev": true, + "license": "MIT" + }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/inquirer": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", + "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-escapes": "^3.2.0", + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^2.0.0", + "lodash": "^4.17.12", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.4.0", + "string-width": "^2.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/intl-messageformat": { + "version": "10.7.18", + "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.7.18.tgz", + "integrity": "sha512-m3Ofv/X/tV8Y3tHXLohcuVuhWKo7BBq62cqY15etqmLxg2DZ34AGGgQDeR+SCta2+zICb1NX83af0GJmbQ1++g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@formatjs/ecma402-abstract": "2.3.6", + "@formatjs/fast-memoize": "2.2.7", + "@formatjs/icu-messageformat-parser": "2.11.4", + "tslib": "^2.8.0" + } + }, + "node_modules/ip-address": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.2.0.tgz", + "integrity": "sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "dev": true, + "license": "MIT", + "dependencies": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } + }, + "node_modules/jpeg-js": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", + "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/js-library-detector": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/js-library-detector/-/js-library-detector-6.7.0.tgz", + "integrity": "sha512-c80Qupofp43y4cJ7+8TTDN/AsDwLi5oOm/plBrWI+iQt485vKXCco+yVmOwEgdo9VOdsYTuV0UlTeetVPTriXA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/js-yaml": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", + "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/legacy-javascript": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/legacy-javascript/-/legacy-javascript-0.0.1.tgz", + "integrity": "sha512-lPyntS4/aS7jpuvOlitZDFifBCb4W8L/3QU0PLbUTUj+zYah8rfVjYic88yG7ZKTxhS5h9iz7duT8oUXKszLhg==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/lie": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", + "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "immediate": "~3.0.5" + } + }, + "node_modules/lighthouse": { + "version": "12.6.1", + "resolved": "https://registry.npmjs.org/lighthouse/-/lighthouse-12.6.1.tgz", + "integrity": "sha512-85WDkjcXAVdlFem9Y6SSxqoKiz/89UsDZhLpeLJIsJ4LlHxw047XTZhlFJmjYCB7K5S1erSBAf5cYLcfyNbH3A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@paulirish/trace_engine": "0.0.53", + "@sentry/node": "^7.0.0", + "axe-core": "^4.10.3", + "chrome-launcher": "^1.2.0", + "configstore": "^5.0.1", + "csp_evaluator": "1.1.5", + "devtools-protocol": "0.0.1467305", + "enquirer": "^2.3.6", + "http-link-header": "^1.1.1", + "intl-messageformat": "^10.5.3", + "jpeg-js": "^0.4.4", + "js-library-detector": "^6.7.0", + "lighthouse-logger": "^2.0.1", + "lighthouse-stack-packs": "1.12.2", + "lodash-es": "^4.17.21", + "lookup-closest-locale": "6.2.0", + "metaviewport-parser": "0.3.0", + "open": "^8.4.0", + "parse-cache-control": "1.0.1", + "puppeteer-core": "^24.10.0", + "robots-parser": "^3.0.1", + "semver": "^5.3.0", + "speedline-core": "^1.4.3", + "third-party-web": "^0.26.6", + "tldts-icann": "^6.1.16", + "ws": "^7.0.0", + "yargs": "^17.3.1", + "yargs-parser": "^21.0.0" + }, + "bin": { + "chrome-debug": "core/scripts/manual-chrome-launcher.js", + "lighthouse": "cli/index.js", + "smokehouse": "cli/test/smokehouse/frontends/smokehouse-bin.js" + }, + "engines": { + "node": ">=18.20" + } + }, + "node_modules/lighthouse-logger": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.2.0.tgz", + "integrity": "sha512-wzUvdIeJZhRsG6gpZfmSCfysaxNEr43i+QT+Hie94wvHDKFLi4n7C2GqZ4sTC+PH5b5iktmXJvU87rWvhP3lHw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "debug": "^2.6.8", + "marky": "^1.2.0" + } + }, + "node_modules/lighthouse-logger/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/lighthouse-logger/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/lighthouse-stack-packs": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/lighthouse-stack-packs/-/lighthouse-stack-packs-1.12.2.tgz", + "integrity": "sha512-Ug8feS/A+92TMTCK6yHYLwaFMuelK/hAKRMdldYkMNwv+d9PtWxjXEg6rwKtsUXTADajhdrhXyuNCJ5/sfmPFw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/lighthouse/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lighthouse/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "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/lighthouse/node_modules/chrome-launcher": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-1.2.1.tgz", + "integrity": "sha512-qmFR5PLMzHyuNJHwOloHPAHhbaNglkfeV/xDtt5b7xiFFyU1I+AZZX0PYseMuhenJSSirgxELYIbswcoc+5H4A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/node": "*", + "escape-string-regexp": "^4.0.0", + "is-wsl": "^2.2.0", + "lighthouse-logger": "^2.0.1" + }, + "bin": { + "print-chrome-path": "bin/print-chrome-path.cjs" + }, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/lighthouse/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "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/lighthouse/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/lighthouse/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/lighthouse/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lighthouse/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lighthouse/node_modules/lighthouse-logger": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-2.0.2.tgz", + "integrity": "sha512-vWl2+u5jgOQuZR55Z1WM0XDdrJT6mzMP8zHUct7xTlWhuQs+eV0g+QL0RQdFjT54zVmbhLCP8vIVpy1wGn/gCg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.4.1", + "marky": "^1.2.2" + } + }, + "node_modules/lighthouse/node_modules/open": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz", + "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lighthouse/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "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/lighthouse/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lighthouse/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "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/lighthouse/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/lighthouse/node_modules/yargs": { + "version": "17.7.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.3.tgz", + "integrity": "sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==", + "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/lighthouse/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/localforage": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", + "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "lie": "3.1.1" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash-es": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz", + "integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==", + "dev": true, + "license": "MIT" + }, + "node_modules/lookup-closest-locale": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/lookup-closest-locale/-/lookup-closest-locale-6.2.0.tgz", + "integrity": "sha512-/c2kL+Vnp1jnV6K6RpDTHK3dgg0Tu2VVp+elEiJpjfS1UyY7AjOYHohRug6wT0OpoX2qFgNORndE9RqesfVxWQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/marky": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/marky/-/marky-1.3.0.tgz", + "integrity": "sha512-ocnPZQLNpvbedwTy9kNrQEsknEfgvcLMvOtz3sFeWApDq1MXH1TqkCIx58xlpESsfwQOnuBO9beyQuNGzVvuhQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/metaviewport-parser": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/metaviewport-parser/-/metaviewport-parser-0.3.0.tgz", + "integrity": "sha512-EoYJ8xfjQ6kpe9VbVHvZTZHiOl4HL1Z18CrZ+qahvLXT7ZO4YTC2JMyt5FaUp9JJp6J4Ybb/z7IsCXZt86/QkQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "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==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "dev": true, + "license": "MIT" + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha512-r65nCZhrbXXb6dXOACihYApHw2Q6pV0M3V0PSxd74N0+D8nzAdEAITq2oAjA1jVnKI+tGvEBUpqiMh0+rW6zDQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/negotiator": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", + "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/netmask": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.1.1.tgz", + "integrity": "sha512-eonl3sLUha+S1GzTPxychyhnUzKyeQkZ7jLjKrBagJgPla13F+uQ71HgpFefyHgqrjEbCPkDArxYsjY8/+gLKA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/on-headers": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.1.0.tgz", + "integrity": "sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha512-oyyPpiMaKARvvcgip+JV+7zci5L8D1W9RZIz2l1o08AM3pfspitVWnPt3mzHcBPp12oYMTy0pqrFs/C+m3EwsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/open": { + "version": "7.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz", + "integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pac-proxy-agent": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz", + "integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==", + "dev": true, + "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", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "dev": true, + "license": "MIT", + "dependencies": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/parse-cache-control": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", + "integrity": "sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==", + "dev": true + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz", + "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==", + "dev": true, + "license": "MIT" + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true, + "license": "MIT" + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-agent": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.5.0.tgz", + "integrity": "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.6", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.1.0", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true, + "license": "MIT" + }, + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/puppeteer-core": { + "version": "24.43.1", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-24.43.1.tgz", + "integrity": "sha512-T5ScUMAsmhdNbgDR41AGESYeS6V9MSgetkSnVhhW+gXvzC42VesKCn5ld87gAZDJ6vLHL9GkRvY9WtQWSnwFbw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@puppeteer/browsers": "2.13.2", + "chromium-bidi": "14.0.0", + "debug": "^4.4.3", + "devtools-protocol": "0.0.1608973", + "typed-query-selector": "^2.12.2", + "webdriver-bidi-protocol": "0.4.1", + "ws": "^8.20.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/puppeteer-core/node_modules/devtools-protocol": { + "version": "0.0.1608973", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1608973.tgz", + "integrity": "sha512-Tpm17fxYzt+J7VrGdc1k8YdRqS3YV7se/M6KeemEqvUbq/n7At1rWVuXMxQgpWkdwSdIEKYbU//Bve+Shm4YNQ==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/puppeteer-core/node_modules/ws": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", + "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/qs": { + "version": "6.15.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz", + "integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz", + "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.4.24", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true, + "license": "ISC" + }, + "node_modules/restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha512-6IzJLuGi4+R14vwagDHX+JrXmPVtPpn4mffDJ1UdR7/Edm87fl6yi8mMBIVvFtJaNTUvjughmW4hwLhRG7gC1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/robots-parser": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/robots-parser/-/robots-parser-3.0.1.tgz", + "integrity": "sha512-s+pyvQeIKIZ0dx5iJiQk1tPLJAWln39+MI5jtM8wnyws+G5azk+dMnMX0qfbqNetKKNgcWWOdi0sfm+FbQbgdQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/rxjs/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true, + "license": "0BSD" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "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", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/send": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz", + "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "~0.5.2", + "http-errors": "~2.0.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.4.1", + "range-parser": "~1.2.1", + "statuses": "~2.0.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/serve-static": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz", + "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "~0.19.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "dev": true, + "license": "ISC" + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true, + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "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.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "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", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "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", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.9.tgz", + "integrity": "sha512-LJhUYUvItdQ0LkJTmPeaEObWXAqFyfmP85x0tch/ez9cahmhlBBLbIqDFnvBnUJGagb0JbIQrkBs1wJ+yRYpEw==", + "dev": true, + "license": "MIT", + "dependencies": { + "ip-address": "^10.1.1", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", + "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", + "dev": true, + "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", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/speedline-core": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/speedline-core/-/speedline-core-1.4.3.tgz", + "integrity": "sha512-DI7/OuAUD+GMpR6dmu8lliO2Wg5zfeh+/xsdyJZCzd8o5JgFUjCeLsBDuZjIQJdwXS3J0L/uZYrELKYqx+PXog==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "image-ssim": "^0.2.0", + "jpeg-js": "^0.4.1" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/streamx": { + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.28.0.tgz", + "integrity": "sha512-1Yowhzjf0ivGMrTIkY9hav5TxobO9qIVqUE41fiCGMGgc3CLlf4MY+9AHmZqBWgDTue0fY9zWjYFVyf6Diuobw==", + "dev": true, + "license": "MIT", + "dependencies": { + "events-universal": "^1.0.0", + "fast-fifo": "^1.3.2", + "text-decoder": "^1.1.0" + } + }, + "node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tar-fs": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.2.tgz", + "integrity": "sha512-QGxxTxxyleAdyM3kpFs14ymbYmNFrfY+pHj7Z8FgtbZ7w2//VAgLMac7sT6nRpIHjppXO2AwwEOg0bPFVRcmXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + }, + "optionalDependencies": { + "bare-fs": "^4.0.1", + "bare-path": "^3.0.0" + } + }, + "node_modules/tar-stream": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.2.0.tgz", + "integrity": "sha512-ojzvCvVaNp6aOTFmG7jaRD0meowIAuPc3cMMhSgKiVWws1GyHbGd/xvnyuRKcKlMpt3qvxx6r0hreCNITP9hIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "b4a": "^1.6.4", + "bare-fs": "^4.5.5", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, + "node_modules/teex": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz", + "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "streamx": "^2.12.5" + } + }, + "node_modules/text-decoder": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.7.tgz", + "integrity": "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "b4a": "^1.6.4" + } + }, + "node_modules/third-party-web": { + "version": "0.26.7", + "resolved": "https://registry.npmjs.org/third-party-web/-/third-party-web-0.26.7.tgz", + "integrity": "sha512-buUzX4sXC4efFX6xg2bw6/eZsCUh8qQwSavC4D9HpONMFlRbcHhD8Je5qwYdCpViR6q0qla2wPP+t91a2vgolg==", + "dev": true, + "license": "MIT" + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tldts-core": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz", + "integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tldts-icann": { + "version": "6.1.86", + "resolved": "https://registry.npmjs.org/tldts-icann/-/tldts-icann-6.1.86.tgz", + "integrity": "sha512-NFxmRT2lAEMcCOBgeZ0NuM0zsK/xgmNajnY6n4S1mwAKocft2s2ise1O3nQxrH3c+uY6hgHUV9GGNVp7tUE4Sg==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^6.1.86" + } + }, + "node_modules/tmp": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.7.tgz", + "integrity": "sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.14" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true, + "license": "MIT" + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typed-query-selector": { + "version": "2.12.2", + "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.2.tgz", + "integrity": "sha512-EOPFbyIub4ngnEdqi2yOcNeDLaX/0jcE1JoAXQDDMIthap7FoN795lc/SHfIq2d416VufXpM8z/lD+WRm2gfOQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/undici-types": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz", + "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "crypto-random-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).", + "dev": true, + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/webdriver-bidi-protocol": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.4.1.tgz", + "integrity": "sha512-ARrjNjtWRRs2w4Tk7nqrf2gBI0QXWuOmMCx2hU+1jUt6d00MjMxURrhxhGbrsoiZKJrhTSTzbIrc554iKI10qw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-fetch": { + "version": "3.6.20", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", + "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==", + "dev": true, + "license": "MIT" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "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/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "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/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/ws": { + "version": "7.5.11", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.11.tgz", + "integrity": "sha512-zS54Oen9bITtp7kp2XM3AydrCIq1D+HwJOuH+c+e4LfpL/lotP5osijd+UoMnxwAam1GN8R4KtLAyIrIcBNpiA==", + "dev": true, + "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/xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "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/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/zod": { + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/package.json b/package.json index 9894c68..01dd1fe 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,18 @@ "test:auth-bridge": "node scripts/test-auth-bridge.mjs", "test:boot-performance": "node scripts/test-boot-performance.mjs", "test:runtime-glue": "node scripts/prove-runtime-glue.mjs", - "test:supabase-sync": "node scripts/prove-supabase-sync.mjs" + "test:supabase-sync": "node scripts/prove-supabase-sync.mjs", + "audit:generate": "node scripts/generate-current-audit.mjs", + "audit:verify": "node scripts/verify-current-audit.mjs", + "lighthouse": "lhci autorun" }, "engines": { "node": ">=18.0.0" + }, + "devDependencies": { + "@lhci/cli": "0.15.1" + }, + "overrides": { + "tmp": "0.2.7" } } diff --git a/public/auth-bridge.js b/public/auth-bridge.js index dd34591..c837c73 100644 --- a/public/auth-bridge.js +++ b/public/auth-bridge.js @@ -6,6 +6,11 @@ var DEFAULT_SUPA_URL = 'https://vteqquoqvksshmfhuepu.supabase.co'; var DEFAULT_SUPA_ANON = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZ0ZXFxdW9xdmtzc2htZmh1ZXB1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODAwODU2NzUsImV4cCI6MjA5NTY2MTY3NX0.ZkRislOhJRQUjVa1y5ixu-xBhlgkXWWyZKI_CClWj64'; + var DEFAULT_REQUEST_DEADLINE_MS = 15000; + var loginFlights = []; + var signupFlights = []; + var bootstrapFlights = []; + function supaUrl() { return String(window.__ISO_SUPA_URL__ || DEFAULT_SUPA_URL).replace(/\/+$/, ''); } @@ -48,11 +53,35 @@ } catch (e) {} } + function requestDeadlineMs() { + var configured = Number(window.__ISO_AUTH_DEADLINE_MS__); + return Number.isFinite(configured) && configured > 0 ? configured : DEFAULT_REQUEST_DEADLINE_MS; + } + function jsonFetch(url, options) { - return fetch(url, options).then(function (response) { + var controller = new AbortController(); + var requestOptions = {}; + Object.keys(options || {}).forEach(function (key) { + requestOptions[key] = options[key]; + }); + requestOptions.signal = controller.signal; + var deadline = setTimeout(function () { + controller.abort(); + }, requestDeadlineMs()); + + return fetch(url, requestOptions).then(function (response) { return response.json().catch(function () { return {}; }).then(function (data) { return { response: response, data: data }; }); + }).catch(function (error) { + if (controller.signal.aborted) { + var timeoutError = new Error('Request timed out.'); + timeoutError.name = 'TimeoutError'; + throw timeoutError; + } + throw error; + }).finally(function () { + clearTimeout(deadline); }); } @@ -77,7 +106,7 @@ }); } - function bootstrap(session) { + function runBootstrap(session) { if (!session || !session.access_token) return Promise.resolve(null); return jsonFetch('/__auth/bootstrap', { method: 'GET', @@ -101,6 +130,31 @@ }).catch(function () { return null; }); } + function removeFlight(flights, flight) { + var index = flights.indexOf(flight); + if (index !== -1) flights.splice(index, 1); + } + + function bootstrap(session) { + if (!session || !session.access_token) return Promise.resolve(null); + for (var i = 0; i < bootstrapFlights.length; i += 1) { + if (bootstrapFlights[i].token === session.access_token) { + return bootstrapFlights[i].promise; + } + } + + var flight = { + token: session.access_token, + promise: null + }; + flight.promise = runBootstrap(session).finally(function () { + flight.token = null; + removeFlight(bootstrapFlights, flight); + }); + bootstrapFlights.push(flight); + return flight.promise; + } + function notifyAuth(session, bootstrapData) { try { if (typeof window.__isoSyncAuthUnblock === 'function') window.__isoSyncAuthUnblock(); } catch (e) {} try { @@ -112,10 +166,8 @@ try { window.dispatchEvent(new Event('isotope:sync_refresh')); } catch (e) {} } - async function login(email, password) { + async function runLogin(cleanEmail, password) { try { - var cleanEmail = String(email || '').trim().toLowerCase(); - if (!cleanEmail || !password) return { ok: false, success: false, err: 'Email and password are required.' }; var result = await supabaseAuth('/auth/v1/token?grant_type=password', { email: cleanEmail, password: password @@ -141,10 +193,33 @@ } } - async function signUp(email, password) { + function login(email, password) { + var cleanEmail = String(email || '').trim().toLowerCase(); + if (!cleanEmail || !password) { + return Promise.resolve({ ok: false, success: false, err: 'Email and password are required.' }); + } + for (var i = 0; i < loginFlights.length; i += 1) { + if (loginFlights[i].email === cleanEmail && loginFlights[i].password === password) { + return loginFlights[i].promise; + } + } + + var flight = { + email: cleanEmail, + password: password, + promise: null + }; + flight.promise = runLogin(cleanEmail, password).finally(function () { + flight.email = null; + flight.password = null; + removeFlight(loginFlights, flight); + }); + loginFlights.push(flight); + return flight.promise; + } + + async function runSignUp(cleanEmail, password) { try { - var cleanEmail = String(email || '').trim().toLowerCase(); - if (!cleanEmail || !password) return { ok: false, success: false, err: 'Email and password are required.' }; var result = await supabaseAuth('/auth/v1/signup', { email: cleanEmail, password: password @@ -172,6 +247,31 @@ } } + function signUp(email, password) { + var cleanEmail = String(email || '').trim().toLowerCase(); + if (!cleanEmail || !password) { + return Promise.resolve({ ok: false, success: false, err: 'Email and password are required.' }); + } + for (var i = 0; i < signupFlights.length; i += 1) { + if (signupFlights[i].email === cleanEmail && signupFlights[i].password === password) { + return signupFlights[i].promise; + } + } + + var flight = { + email: cleanEmail, + password: password, + promise: null + }; + flight.promise = runSignUp(cleanEmail, password).finally(function () { + flight.email = null; + flight.password = null; + removeFlight(signupFlights, flight); + }); + signupFlights.push(flight); + return flight.promise; + } + window.__isoLogin = login; window.__isoUp = signUp; var bridgeApi = { diff --git a/public/focus-bg-import.js b/public/focus-bg-import.js index cc51122..c9b81c9 100644 --- a/public/focus-bg-import.js +++ b/public/focus-bg-import.js @@ -21,6 +21,8 @@ var _styleObs = null; var _focusBgApiPromise = null; var _routeTimer = null; + var _routeObserver = null; + var _applyGeneration = 0; var _modalOpen = false; var _activeTab = 'image'; var _lastAppliedBlur = 0; @@ -487,6 +489,7 @@ } function applyBackground(url, isVideo, ownsObjectUrl) { + var generation = ++_applyGeneration; if (_objectUrl && _objectUrl !== url) { try { URL.revokeObjectURL(_objectUrl); } catch (e) {} } @@ -496,6 +499,7 @@ var attempts = 0; (function retry() { + if (generation !== _applyGeneration || !isOnFocus()) return; var ok = isVideo ? applyVideoToDom(url) : applyToDom(url); if (!ok && ++attempts < 24) { setTimeout(retry, 220); @@ -506,6 +510,7 @@ } function clearBackground() { + _applyGeneration++; if (_objectUrl) { try { URL.revokeObjectURL(_objectUrl); } catch (e) {} } @@ -936,9 +941,18 @@ function syncButtonPlacement() { var btn = document.getElementById('__iso_fbg_btn__'); if (!isOnFocus()) { + _applyGeneration++; if (btn) btn.remove(); + if (_routeObserver) { + _routeObserver.disconnect(); + _routeObserver = null; + } return; } + if (!_routeObserver) { + _routeObserver = new MutationObserver(function () { scheduleRouteWork(160); }); + _routeObserver.observe(document.documentElement, { childList: true, subtree: true }); + } if (!btn) btn = createToolbarButton(); var bar = findControlBar(); @@ -984,12 +998,8 @@ window.__isoRefreshFocusBgBlur = refreshBlur; window.__isoGetFocusBgBlur = function () { return _lastAppliedBlur; }; - new MutationObserver(function () { scheduleRouteWork(160); }) - .observe(document.documentElement, { childList: true, subtree: true }); - - // setInterval removed: the MutationObserver above already triggers - // scheduleRouteWork on DOM changes, which calls refreshBlur when on the - // Focus page. Polling every 850 ms was redundant and wasteful on battery. + // The route-scoped MutationObserver starts only while /focus is active and + // disconnects on route exit. History/popstate listeners restart it on entry. function init() { loadSaved(); diff --git a/public/focus-bg-loader.js b/public/focus-bg-loader.js new file mode 100644 index 0000000..f2c367e --- /dev/null +++ b/public/focus-bg-loader.js @@ -0,0 +1,43 @@ +/* Loads the Focus background editor only on Focus routes. */ +(function () { + 'use strict'; + + var loaded = false; + var scheduled = null; + + function isFocusRoute() { + return window.location.pathname === '/focus' || window.location.pathname.indexOf('/focus/') === 0; + } + + function loadForCurrentRoute() { + if (loaded || !isFocusRoute()) return; + loaded = true; + var script = document.createElement('script'); + script.src = '/focus-bg-import.js'; + script.defer = true; + script.onerror = function () { loaded = false; }; + document.head.appendChild(script); + } + + function schedule() { + clearTimeout(scheduled); + scheduled = setTimeout(loadForCurrentRoute, 0); + } + + ['pushState', 'replaceState'].forEach(function (method) { + var original = history[method]; + if (typeof original !== 'function') return; + history[method] = function () { + var result = original.apply(this, arguments); + schedule(); + return result; + }; + }); + + window.addEventListener('popstate', schedule); + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', schedule, { once: true }); + } else { + schedule(); + } +})(); diff --git a/public/restore-and-launch.js b/public/restore-and-launch.js index 85a3125..68e8d55 100644 --- a/public/restore-and-launch.js +++ b/public/restore-and-launch.js @@ -819,21 +819,46 @@ function notifyMountedAppOfBootResolution() { // route content while the boot state remains authChecking/cloudLoading. launchApp(); + // Resolve logged-out visits before IndexedDB maintenance. Fresh-profile and + // signed-out users should see Auth immediately instead of waiting for two + // storage transactions that do not affect the route decision. + let session = parseSession(findSessionRaw()); + if (!session) { + const loggedOutDecision = publishBootState(BOOT_STATES.READY_LOGGED_OUT, { + onboarding: { state: 'unknown' }, + source: 'auth', + }); + const currentPath = window.location.pathname; + const isRoot = currentPath === '/' || currentPath === ''; + const isOnboardingPath = currentPath === '/onboarding' || currentPath.startsWith('/onboarding/'); + const isProtectedPath = PROTECTED_ROUTE_RE.test(currentPath); + if (isRoot || isProtectedPath || isOnboardingPath) { + window.history.replaceState(null, '', '/auth'); + } + notifyMountedAppOfBootResolution(); + const runMaintenance = () => { + purgeStaleFakeData().then(ensureSchema).catch((e) => { + console.warn('[isotope] Deferred startup cleanup warning:', e); + }); + }; + if (typeof requestIdleCallback === 'function') requestIdleCallback(runMaintenance, { timeout: 2000 }); + else setTimeout(runMaintenance, 0); + return loggedOutDecision; + } + if (window.location.pathname !== '/demo') { try { sessionStorage.removeItem('isotope-demo-mode'); } catch (_) {} } - // Step 1: clean up any stale / fake data from old script versions - try { - await purgeStaleFakeData(); - await ensureSchema(); - } catch (e) { - console.warn('[isotope] Startup cleanup warning:', e); - } + // Authenticated maintenance is non-blocking; it cannot change whether this + // session is valid or which cloud route should win. + Promise.resolve() + .then(purgeStaleFakeData) + .then(ensureSchema) + .catch((e) => console.warn('[isotope] Startup cleanup warning:', e)); // Step 2: authenticated cloud bootstrap before routing/app preload. // Refresh expired/near-expired access tokens before any route decision or sync. - let session = parseSession(findSessionRaw()); if (session) { const refreshed = await refreshStoredSessionIfNeeded(session); if (refreshed) session = refreshed; @@ -898,11 +923,6 @@ function notifyMountedAppOfBootResolution() { }); } } - } else { - bootDecision = publishBootState(BOOT_STATES.READY_LOGGED_OUT, { - onboarding: { state: 'unknown' }, - source: 'auth', - }); } // Step 3: routing. Deep links are preserved unless their resolved boot state diff --git a/public/sw.js b/public/sw.js index 060a37c..c0d7637 100644 --- a/public/sw.js +++ b/public/sw.js @@ -20,6 +20,7 @@ const RUNTIME_GLUE_PATHS = new Set([ '/pwa-local.js', '/boot-recovery.js', '/ux-setup.js', + '/focus-bg-loader.js', '/focus-bg-import.js', '/update-checker.js', '/sw.js', diff --git a/public/update-checker.js b/public/update-checker.js index 3a84a2c..e8de8a9 100644 --- a/public/update-checker.js +++ b/public/update-checker.js @@ -16,6 +16,9 @@ '__isotope_update_available__' ]; var timer = null; + var checkPromise = null; + var lastCheckAt = 0; + var MIN_CHECK_GAP = 60 * 1000; function escHtml(str) { return String(str || '').replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); @@ -179,8 +182,14 @@ }); } - function runCheck() { - localServerPreflight() + function runCheck(force) { + if (document.hidden || !navigator.onLine) return Promise.resolve(null); + if (checkPromise) return checkPromise; + if (!force && lastCheckAt && Date.now() - lastCheckAt < MIN_CHECK_GAP) { + return Promise.resolve(null); + } + lastCheckAt = Date.now(); + checkPromise = localServerPreflight() .then(function (version) { if (!version) return null; window.__isoLocalServerOffline = false; @@ -210,19 +219,23 @@ .catch(function (err) { console.warn('[IsotopeUpdateChecker] Error:', err.message); hideBanner(); + }) + .finally(function () { + checkPromise = null; }); + return checkPromise; } function startPolling() { clearInterval(timer); - timer = setInterval(runCheck, POLL_INTERVAL); + if (!document.hidden) timer = setInterval(runCheck, POLL_INTERVAL); } window.__isoShowUpdateCommand = showDialog; window.__isoApplyUpdate = showDialog; window.addEventListener('online', function () { - runCheck(); + runCheck(true); startPolling(); }); window.addEventListener('offline', function () { @@ -240,10 +253,14 @@ return; } startPolling(); - runCheck(); + runCheck(false); }); document.addEventListener('visibilitychange', function () { - if (!document.hidden && navigator.onLine) runCheck(); + if (document.hidden) clearInterval(timer); + else if (navigator.onLine) { + startPolling(); + runCheck(false); + } }); window.addEventListener('beforeunload', function () { clearInterval(timer); @@ -251,7 +268,7 @@ function init() { startPolling(); - setTimeout(runCheck, 4000); + setTimeout(function () { runCheck(false); }, 4000); } if (document.readyState === 'loading') { diff --git a/scripts/generate-current-audit.mjs b/scripts/generate-current-audit.mjs new file mode 100644 index 0000000..56fadc1 --- /dev/null +++ b/scripts/generate-current-audit.mjs @@ -0,0 +1,738 @@ +#!/usr/bin/env node + +import { createHash } from "node:crypto"; +import { + lstat, + mkdir, + readFile, + realpath, + writeFile, +} from "node:fs/promises"; +import path from "node:path"; +import { fileURLToPath, pathToFileURL } from "node:url"; +import { execFileSync } from "node:child_process"; + +const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url)); +const REPO_ROOT = path.resolve(SCRIPT_DIR, ".."); +const OUTPUT_DIR = "audit/current"; +const TEXT_EXTENSIONS = new Set([ + "", + ".bat", + ".cjs", + ".css", + ".csv", + ".env", + ".gitignore", + ".html", + ".js", + ".json", + ".jsx", + ".md", + ".mjs", + ".ps1", + ".sh", + ".sql", + ".svg", + ".ts", + ".tsx", + ".txt", + ".webmanifest", + ".xml", + ".yaml", + ".yml", +]); + +const TYPE_BY_EXTENSION = new Map([ + [".bat", "shell-script"], + [".cjs", "javascript"], + [".css", "stylesheet"], + [".csv", "data"], + [".gif", "image"], + [".html", "html"], + [".ico", "image"], + [".jpeg", "image"], + [".jpg", "image"], + [".js", "javascript"], + [".json", "json"], + [".jsx", "javascript"], + [".md", "markdown"], + [".mjs", "javascript"], + [".mp3", "audio"], + [".mp4", "video"], + [".pdf", "document"], + [".png", "image"], + [".ps1", "shell-script"], + [".sh", "shell-script"], + [".sql", "sql"], + [".svg", "image-vector"], + [".ts", "typescript"], + [".tsx", "typescript"], + [".ttf", "font"], + [".txt", "text"], + [".wav", "audio"], + [".webmanifest", "json"], + [".webp", "image"], + [".woff", "font"], + [".woff2", "font"], + [".xml", "xml"], + [".yaml", "yaml"], + [".yml", "yaml"], + [".zip", "archive"], +]); + +const RISK_PATTERNS = [ + { + id: "timers.interval", + pattern: /\bsetInterval\s*\(/g, + }, + { + id: "timers.timeout", + pattern: /\bsetTimeout\s*\(/g, + }, + { + id: "network.fetch", + pattern: /\bfetch\s*\(/g, + }, + { + id: "network.http_client", + pattern: /\b(?:axios|XMLHttpRequest|EventSource)\b/g, + }, + { + id: "network.websocket", + pattern: /\b(?:WebSocket|wss?:\/\/)\b/g, + }, + { + id: "network.supabase_client", + pattern: /\b(?:createClient|supabase\.co|SUPABASE_URL)\b/g, + }, + { + id: "storage.web", + pattern: /\b(?:localStorage|sessionStorage|indexedDB)\b/g, + }, + { + id: "storage.cache_api", + pattern: /\b(?:caches\.|CacheStorage|Cache-Control)\b/g, + }, + { + id: "storage.filesystem", + pattern: /\b(?:readFile|writeFile|appendFile|createReadStream|createWriteStream)\b/g, + }, + { + id: "secrets.identifiers", + pattern: + /\b(?:API_KEY|ANON_KEY|SERVICE_ROLE_KEY|SUPABASE_KEY|SUPABASE_URL|JWT_SECRET|ACCESS_TOKEN|REFRESH_TOKEN|CLIENT_SECRET|PRIVATE_KEY|DATABASE_URL)\b/g, + }, + { + id: "injection.eval", + pattern: /\b(?:eval|Function)\s*\(/g, + }, + { + id: "injection.inner_html", + pattern: /\b(?:innerHTML|outerHTML|insertAdjacentHTML|dangerouslySetInnerHTML)\b/g, + }, + { + id: "sql.statements", + pattern: + /\b(?:SELECT|INSERT|UPDATE|DELETE|CREATE|ALTER|DROP|GRANT|REVOKE)\b/gi, + }, + { + id: "sql.rls", + pattern: + /\b(?:ROW LEVEL SECURITY|ENABLE ROW LEVEL SECURITY|CREATE POLICY|ALTER POLICY|auth\.uid\s*\()\b/gi, + }, + { + id: "connection.reconnect_loop", + pattern: + /\b(?:reconnect|retryConnection|scheduleReconnect|connectionRetry|backoff)\b/gi, + }, + { + id: "connection.persistent_channel", + pattern: /\.(?:channel|subscribe)\s*\(|\b(?:heartbeat|keepalive)\b/gi, + }, + { + id: "connection.online_state_listener", + pattern: + /addEventListener\s*\(\s*["'](?:online|offline|visibilitychange)["']/g, + }, + { + id: "connection.hardcoded_localhost", + pattern: /\bhttps?:\/\/(?:localhost|127\.0\.0\.1)(?::\d+)?/g, + }, +]; + +function git(args, options = {}) { + return execFileSync("git", args, { + cwd: REPO_ROOT, + encoding: options.encoding ?? "utf8", + maxBuffer: 256 * 1024 * 1024, + stdio: ["ignore", "pipe", "pipe"], + }); +} + +function splitNull(value) { + return value.split("\0").filter(Boolean); +} + +function normalizeRepoPath(value) { + return value.replaceAll("\\", "/").replace(/^\.\/+/, ""); +} + +function isAuditPath(filePath) { + return filePath === "audit" || filePath.startsWith("audit/"); +} + +function isSensitivePath(filePath) { + const basename = path.posix.basename(filePath).toLowerCase(); + if ( + (basename === ".env" || basename.startsWith(".env.")) && + !/\.(?:example|sample|template)$/.test(basename) + ) { + return true; + } + return /(?:^|\/)(?:id_rsa|id_ed25519|credentials?)(?:\.|$)/i.test(filePath) || + /\.(?:key|p12|pfx|pem)$/i.test(filePath); +} + +async function pathExists(filePath) { + try { + await lstat(filePath); + return true; + } catch (error) { + if (error?.code === "ENOENT") return false; + throw error; + } +} + +async function collectSourcePaths() { + const tracked = splitNull(git(["ls-files", "-z"])).map(normalizeRepoPath); + const untracked = splitNull( + git(["ls-files", "--others", "--exclude-standard", "-z"]), + ).map(normalizeRepoPath); + const candidates = new Set( + [...tracked, ...untracked].filter((filePath) => !isAuditPath(filePath)), + ); + + const excludedSensitiveCount = [...candidates].filter(isSensitivePath).length; + const paths = [...candidates].filter((filePath) => !isSensitivePath(filePath)); + paths.sort((a, b) => a.localeCompare(b, "en")); + + const missing = []; + for (const filePath of paths) { + if (!(await pathExists(path.join(REPO_ROOT, filePath)))) { + missing.push(filePath); + } + } + if (missing.length > 0) { + throw new Error( + `Cannot audit missing current source files:\n${missing + .map((filePath) => `- ${filePath}`) + .join("\n")}`, + ); + } + + return { + paths, + trackedCount: tracked.filter((filePath) => !isAuditPath(filePath)).length, + untrackedCount: untracked.filter((filePath) => !isAuditPath(filePath)).length, + excludedSensitiveCount, + }; +} + +function sha256(buffer) { + return createHash("sha256").update(buffer).digest("hex"); +} + +function detectText(buffer, extension) { + if (!TEXT_EXTENSIONS.has(extension)) return false; + const sample = buffer.subarray(0, Math.min(buffer.length, 16 * 1024)); + return !sample.includes(0); +} + +function detectType(filePath, isText) { + const basename = path.posix.basename(filePath); + const extension = path.posix.extname(filePath).toLowerCase(); + if (basename === "Dockerfile") return "container-config"; + if (basename === "LICENSE") return "license"; + if (basename === "VERSION") return "version"; + if (basename.startsWith(".env")) return "environment-template"; + if (basename.startsWith(".git")) return "git-config"; + return TYPE_BY_EXTENSION.get(extension) ?? (isText ? "text" : "binary"); +} + +function looksLikeWrapper(text, size) { + if (!text || size > 4096) return false; + const withoutComments = text + .replace(/\/\*[\s\S]*?\*\//g, "") + .replace(/^\s*\/\/.*$/gm, "") + .trim(); + return ( + withoutComments.length > 0 && + /(?:\bimport\b|\bexport\b)/.test(withoutComments) && + !/(?:\bfunction\b|=>|\bclass\b|\bfetch\s*\(|\bsetTimeout\s*\()/.test( + withoutComments, + ) + ); +} + +function classifyFile(filePath, type, text, size) { + const extension = path.posix.extname(filePath).toLowerCase(); + const executableAsset = [".js", ".css"].includes(extension); + const inGeneratedAssets = filePath.startsWith("public/assets/"); + + if (filePath.startsWith("artifacts/")) { + return { + origin: "generated", + kind: "artifact-snapshot", + editable: false, + }; + } + if ( + inGeneratedAssets || + /^public\/workbox-[A-Za-z0-9_-]+\.(?:js|css)$/.test(filePath) + ) { + if (executableAsset && looksLikeWrapper(text, size)) { + return { + origin: "generated", + kind: "bundle-wrapper", + editable: false, + }; + } + return { + origin: "generated", + kind: executableAsset ? "bundle" : "bundle-asset", + editable: false, + }; + } + if ( + /(?:^|\/)(?:package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$/.test(filePath) + ) { + return { + origin: "generated", + kind: "dependency-lock", + editable: false, + }; + } + if ( + type === "image" || + type === "image-vector" || + type === "font" || + type === "audio" || + type === "video" || + type === "archive" + ) { + return { + origin: "authored", + kind: "static-asset", + editable: true, + }; + } + if ( + filePath === "index.html" || + filePath.startsWith("public/") && + ["javascript", "html", "json", "stylesheet"].includes(type) + ) { + return { + origin: "authored", + kind: "runtime", + editable: true, + }; + } + if ( + filePath === "server.mjs" || + filePath.startsWith("server/") || + filePath.startsWith("src/") + ) { + return { + origin: "authored", + kind: "source", + editable: true, + }; + } + if ( + filePath.startsWith("scripts/") || + /\.(?:sh|bat|ps1)$/.test(filePath) + ) { + return { + origin: "authored", + kind: "tooling", + editable: true, + }; + } + if (type === "sql") { + return { + origin: "authored", + kind: "database", + editable: true, + }; + } + if (["markdown", "license"].includes(type) || filePath.startsWith("docs/")) { + return { + origin: "authored", + kind: "documentation", + editable: true, + }; + } + return { + origin: "authored", + kind: "configuration", + editable: true, + }; +} + +function countMatches(text, pattern) { + pattern.lastIndex = 0; + let count = 0; + while (pattern.exec(text) !== null) { + count += 1; + if (pattern.lastIndex === 0) pattern.lastIndex += 1; + } + pattern.lastIndex = 0; + return count; +} + +function detectRisks(text) { + if (text === null) return []; + return RISK_PATTERNS.map(({ id, pattern }) => ({ + id, + count: countMatches(text, pattern), + })).filter(({ count }) => count > 0); +} + +function extensionCandidates(candidate) { + if (path.posix.extname(candidate)) return [candidate]; + return [ + candidate, + `${candidate}.js`, + `${candidate}.mjs`, + `${candidate}.cjs`, + `${candidate}.ts`, + `${candidate}.tsx`, + `${candidate}.jsx`, + `${candidate}.json`, + `${candidate}.css`, + path.posix.join(candidate, "index.js"), + path.posix.join(candidate, "index.ts"), + path.posix.join(candidate, "index.tsx"), + ]; +} + +function resolveReference(sourcePath, rawReference, pathSet, basenameIndex) { + const cleaned = rawReference + .replace(/[?#].*$/, "") + .replace(/^file:\/\//, "") + .trim(); + if ( + !cleaned || + /^(?:https?:|wss?:|data:|blob:|mailto:|tel:|node:)/i.test(cleaned) + ) { + return []; + } + + const candidates = []; + if (cleaned.startsWith("@/")) { + candidates.push(`src/${cleaned.slice(2)}`); + } else if (cleaned.startsWith("/")) { + candidates.push(`public${cleaned}`, cleaned.slice(1)); + } else if (cleaned.startsWith(".")) { + candidates.push( + path.posix.normalize(path.posix.join(path.posix.dirname(sourcePath), cleaned)), + ); + } else { + candidates.push(cleaned); + if (cleaned.startsWith("public/")) candidates.push(cleaned); + } + + const resolved = new Set(); + for (const candidate of candidates) { + for (const extended of extensionCandidates(normalizeRepoPath(candidate))) { + if (pathSet.has(extended)) resolved.add(extended); + } + } + + if (resolved.size === 0 && !cleaned.includes("/")) { + for (const match of basenameIndex.get(cleaned) ?? []) resolved.add(match); + } + return [...resolved]; +} + +function extractReferences(sourcePath, text, pathSet, basenameIndex) { + if (text === null) return []; + const rawReferences = new Set(); + const patterns = [ + /(?:from\s*|import\s*\(|require\s*\(|new\s+URL\s*\()\s*["'`]([^"'`]+)["'`]/g, + /(?:src|href|content|url)\s*=\s*["']([^"']+)["']/gi, + /["'`]((?:\.{0,2}\/|\/|@\/)[^"'`\s]+)["'`]/g, + /\b([A-Za-z0-9_@./-]+\.(?:c?m?js|jsx|tsx?|css|json|html?|svg|png|jpe?g|webp|gif|woff2?|ttf|wav|mp3|mp4|webmanifest|sql|md))(?:[?#][^\s"'`)]*)?/g, + ]; + + for (const pattern of patterns) { + pattern.lastIndex = 0; + let match; + while ((match = pattern.exec(text)) !== null) { + rawReferences.add(match[1]); + } + } + + const references = new Set(); + for (const rawReference of rawReferences) { + for (const resolved of resolveReference( + sourcePath, + rawReference, + pathSet, + basenameIndex, + )) { + if (resolved !== sourcePath) references.add(resolved); + } + } + return [...references].sort((a, b) => a.localeCompare(b, "en")); +} + +function identifyEntrypoint(filePath) { + if (filePath === "index.html") return "browser-entry"; + if (filePath === "server.mjs") return "server-entry"; + if ( + filePath === "public/sw.js" || + filePath === "public/firebase-messaging-sw.js" + ) { + return "worker-entry"; + } + if (filePath === "package.json" || filePath === "vite.config.ts") { + return "build-entry"; + } + if ( + filePath.startsWith(".github/workflows/") || + filePath.startsWith("scripts/") || + filePath.startsWith("bin/") || + /^(?:start|setup|doctor|update|install)[^/]*\.(?:sh|bat|ps1)$/.test(filePath) + ) { + return "tool-entry"; + } + return null; +} + +function computeActiveSet(filesByPath) { + const active = new Set(); + const queue = []; + for (const file of filesByPath.values()) { + if (file.entrypoint) { + active.add(file.path); + queue.push(file.path); + } + } + + for (let index = 0; index < queue.length; index += 1) { + const current = filesByPath.get(queue[index]); + for (const reference of current.references) { + if (!active.has(reference)) { + active.add(reference); + queue.push(reference); + } + } + } + return active; +} + +function summarizeCounts(files, selector) { + const counts = {}; + for (const file of files) { + const key = selector(file); + counts[key] = (counts[key] ?? 0) + 1; + } + return Object.fromEntries( + Object.entries(counts).sort(([a], [b]) => a.localeCompare(b, "en")), + ); +} + +function renderSummary(manifest) { + const lines = [ + "# Current file audit", + "", + `Schema: ${manifest.schemaVersion}`, + `Worktree fingerprint: ${manifest.repository.worktreeFingerprint}`, + `Audited files: ${manifest.scope.auditedFileCount}`, + `Git-tracked non-audit files: ${manifest.scope.trackedNonAuditFileCount}`, + `Untracked non-audit files: ${manifest.scope.untrackedNonAuditFileCount}`, + `Excluded sensitive paths: ${manifest.scope.excludedSensitivePathCount}`, + `Active/reachable files: ${manifest.summary.activeFileCount}`, + "", + "## Classification", + "", + ]; + + for (const [classification, count] of Object.entries( + manifest.summary.classifications, + )) { + lines.push(`- ${classification}: ${count}`); + } + + lines.push("", "## Risk signals", ""); + if (Object.keys(manifest.summary.riskSignals).length === 0) { + lines.push("- none"); + } else { + for (const [signal, count] of Object.entries(manifest.summary.riskSignals)) { + lines.push(`- ${signal}: ${count}`); + } + } + + lines.push( + "", + "## Safety and interpretation", + "", + "- This directory is the reproducible source of truth for the current worktree; older per-file reports under `audit/` are historical snapshots and may be stale.", + "- The audit contains hashes, sizes, classifications, paths, graph edges, and signal counts only.", + "- It never stores source snippets, environment values, matched secret values, or file contents.", + "- `generated:bundle-wrapper` is intentionally distinct from full generated bundles.", + "- `active` means reachable from a declared runtime, build, workflow, or tool entrypoint through detected static references.", + "- Regenerate with `node scripts/generate-current-audit.mjs`.", + "- Verify freshness with `node scripts/verify-current-audit.mjs`.", + "", + ); + return `${lines.join("\n")}`; +} + +export async function buildCurrentAudit() { + const { paths, trackedCount, untrackedCount, excludedSensitiveCount } = + await collectSourcePaths(); + const trackedSet = new Set(splitNull(git(["ls-files", "-z"]))); + const pathSet = new Set(paths); + const textByPath = new Map(); + const basenameIndex = new Map(); + for (const filePath of paths) { + const basename = path.posix.basename(filePath); + if (!basenameIndex.has(basename)) basenameIndex.set(basename, []); + basenameIndex.get(basename).push(filePath); + } + + const files = []; + for (const filePath of paths) { + const absolutePath = path.join(REPO_ROOT, filePath); + const stats = await lstat(absolutePath); + const buffer = await readFile(absolutePath); + const extension = path.posix.extname(filePath).toLowerCase(); + const isText = stats.isSymbolicLink() + ? false + : detectText(buffer, extension); + const text = isText ? buffer.toString("utf8") : null; + textByPath.set(filePath, text); + const type = stats.isSymbolicLink() ? "symlink" : detectType(filePath, isText); + const classification = classifyFile(filePath, type, text, buffer.length); + files.push({ + path: filePath, + source: trackedSet.has(filePath) ? "git-tracked" : "worktree-untracked", + sha256: sha256(buffer), + size: buffer.length, + type, + text: isText, + classification: `${classification.origin}:${classification.kind}`, + editableSource: classification.editable, + entrypoint: identifyEntrypoint(filePath), + references: [], + consumers: [], + activeConsumers: [], + active: false, + riskSignals: detectRisks(text), + }); + } + + const filesByPath = new Map(files.map((file) => [file.path, file])); + for (const file of files) { + file.references = extractReferences( + file.path, + textByPath.get(file.path), + pathSet, + basenameIndex, + ); + for (const reference of file.references) { + filesByPath.get(reference).consumers.push(file.path); + } + } + for (const file of files) { + file.consumers.sort((a, b) => a.localeCompare(b, "en")); + } + + const activeSet = computeActiveSet(filesByPath); + for (const file of files) { + file.active = activeSet.has(file.path); + file.activeConsumers = file.consumers.filter((consumer) => + activeSet.has(consumer), + ); + } + + const worktreeFingerprint = sha256( + Buffer.from( + files + .map((file) => `${file.path}\0${file.sha256}\0${file.size}\n`) + .join(""), + ), + ); + const riskTotals = {}; + for (const file of files) { + for (const signal of file.riskSignals) { + riskTotals[signal.id] = (riskTotals[signal.id] ?? 0) + signal.count; + } + } + + const manifest = { + schemaVersion: 1, + repository: { + worktreeFingerprint, + }, + scope: { + source: "Git index paths with current worktree content", + excludedPathPrefixes: ["audit/"], + sensitivePathPolicy: + "Omit live environment, private-key, and credential paths; never emit contents or matched values", + trackedNonAuditFileCount: trackedCount, + untrackedNonAuditFileCount: untrackedCount, + excludedSensitivePathCount: excludedSensitiveCount, + auditedFileCount: files.length, + }, + summary: { + totalBytes: files.reduce((sum, file) => sum + file.size, 0), + activeFileCount: files.filter((file) => file.active).length, + classifications: summarizeCounts(files, (file) => file.classification), + types: summarizeCounts(files, (file) => file.type), + riskSignals: Object.fromEntries( + Object.entries(riskTotals).sort(([a], [b]) => a.localeCompare(b, "en")), + ), + }, + files, + }; + + const manifestText = `${JSON.stringify(manifest, null, 2)}\n`; + const summaryText = renderSummary(manifest); + return { + manifest, + outputs: new Map([ + [`${OUTPUT_DIR}/manifest.json`, manifestText], + [`${OUTPUT_DIR}/README.md`, summaryText], + ]), + }; +} + +export async function writeCurrentAudit() { + const { manifest, outputs } = await buildCurrentAudit(); + await mkdir(path.join(REPO_ROOT, OUTPUT_DIR), { recursive: true }); + for (const [filePath, content] of outputs) { + await writeFile(path.join(REPO_ROOT, filePath), content, "utf8"); + } + return manifest; +} + +async function main() { + const manifest = await writeCurrentAudit(); + process.stdout.write( + `Generated ${OUTPUT_DIR}/manifest.json and ${OUTPUT_DIR}/README.md for ` + + `${manifest.scope.auditedFileCount} current files.\n`, + ); +} + +const invokedPath = process.argv[1] + ? pathToFileURL(await realpath(process.argv[1])).href + : null; +if (invokedPath === import.meta.url) { + main().catch((error) => { + process.stderr.write(`${error.stack ?? error.message}\n`); + process.exitCode = 1; + }); +} diff --git a/scripts/test-auth-bridge.mjs b/scripts/test-auth-bridge.mjs index e418757..7f11a3b 100644 --- a/scripts/test-auth-bridge.mjs +++ b/scripts/test-auth-bridge.mjs @@ -33,6 +33,7 @@ const fakeSession = { let tokenCalls = 0; let signupCalls = 0; let bootstrapCalls = 0; +let fetchMode = 'success'; function assertAnonAuthRequest(textUrl, options) { assert.ok(textUrl.startsWith('https://runtimeproject.supabase.co/'), `unexpected Supabase URL: ${textUrl}`); @@ -40,6 +41,22 @@ function assertAnonAuthRequest(textUrl, options) { assert.equal(options.headers.apikey, 'runtime.anon.jwt'); assert.equal(options.headers.Authorization, 'Bearer runtime.anon.jwt'); assert.equal(options.cache, 'no-store'); + assert.ok(options.signal instanceof AbortSignal); +} + +function abortableHang(signal) { + return new Promise((resolve, reject) => { + signal.addEventListener('abort', () => { + const error = new Error('aborted'); + error.name = 'AbortError'; + reject(error); + }, { once: true }); + }); +} + +async function successfulResponse(data) { + await new Promise((resolve) => setTimeout(resolve, 5)); + return { ok: true, status: 200, json: async () => data }; } global.window = { @@ -67,7 +84,8 @@ global.fetch = async (url, options = {}) => { const body = JSON.parse(options.body || '{}'); assert.equal(body.email, 'student@example.com'); assert.equal(body.password, 'secret-password'); - return { ok: true, status: 200, json: async () => fakeSession }; + if (fetchMode === 'timeout-login') return abortableHang(options.signal); + return successfulResponse(fakeSession); } if (textUrl.includes('/auth/v1/signup')) { signupCalls += 1; @@ -76,21 +94,20 @@ global.fetch = async (url, options = {}) => { const body = JSON.parse(options.body || '{}'); assert.equal(body.email, 'new@example.com'); assert.equal(body.password, 'secret-password'); - return { ok: true, status: 200, json: async () => ({ ...fakeSession, user: fakeSession.user }) }; + if (fetchMode === 'timeout-signup') return abortableHang(options.signal); + return successfulResponse({ ...fakeSession, user: fakeSession.user }); } if (textUrl === '/__auth/bootstrap') { bootstrapCalls += 1; assert.equal(options.headers.Authorization, `Bearer ${fakeSession.access_token}`); - return { + assert.ok(options.signal instanceof AbortSignal); + if (fetchMode === 'timeout-bootstrap') return abortableHang(options.signal); + return successfulResponse({ ok: true, - status: 200, - json: async () => ({ - ok: true, - user_id: fakeSession.user.id, - onboarding_completed: true, - profile: { email: fakeSession.user.email }, - }), - }; + user_id: fakeSession.user.id, + onboarding_completed: true, + profile: { email: fakeSession.user.email }, + }); } throw new Error(`Unexpected fetch: ${textUrl}`); }; @@ -104,12 +121,29 @@ assert.equal(typeof window.__isoUp, 'function'); // reads Supabase config lazily at login/signup time, not only at script load. window.__ISO_SUPA_URL__ = 'https://runtimeproject.supabase.co'; window.__ISO_ANON__ = 'runtime.anon.jwt'; +window.__ISO_AUTH_DEADLINE_MS__ = 25; assert.equal(window.__ISO_AUTH_BRIDGE__.project_ref, 'runtimeproject'); -const login = await window.__isoLogin('STUDENT@example.com', 'secret-password'); +const loginPromise = window.__isoLogin('STUDENT@example.com', 'secret-password'); +const duplicateLoginPromise = window.__isoLogin('student@example.com', 'secret-password'); +const signupPromise = window.__isoUp('new@example.com', 'secret-password'); +const duplicateSignupPromise = window.__isoUp('NEW@example.com', 'secret-password'); +assert.strictEqual(loginPromise, duplicateLoginPromise); +assert.strictEqual(signupPromise, duplicateSignupPromise); + +const [login, duplicateLogin, signup, duplicateSignup] = await Promise.all([ + loginPromise, + duplicateLoginPromise, + signupPromise, + duplicateSignupPromise, +]); assert.equal(login.ok, true); assert.equal(login.success, true); assert.equal(login.onboarding_completed, true); +assert.strictEqual(login, duplicateLogin); +assert.equal(signup.ok, true); +assert.equal(signup.success, true); +assert.strictEqual(signup, duplicateSignup); const ref = 'runtimeproject'; for (const key of [ @@ -128,12 +162,34 @@ assert.ok(events.includes('isotope:auth-session')); assert.ok(events.includes('isotope:auth-unblock')); assert.ok(events.includes('isotope:sync_refresh')); -const signup = await window.__isoUp('new@example.com', 'secret-password'); -assert.equal(signup.ok, true); -assert.equal(signup.success, true); - assert.equal(tokenCalls, 1); assert.equal(signupCalls, 1); +assert.equal(bootstrapCalls, 1); + +fetchMode = 'timeout-login'; +const timedOutLogin = await window.__isoLogin('student@example.com', 'secret-password'); +assert.deepEqual(timedOutLogin, { + ok: false, + success: false, + err: 'Request timed out.', +}); + +fetchMode = 'timeout-signup'; +const timedOutSignup = await window.__isoUp('new@example.com', 'secret-password'); +assert.deepEqual(timedOutSignup, { + ok: false, + success: false, + err: 'Request timed out.', +}); + +fetchMode = 'timeout-bootstrap'; +const loginWithTimedOutBootstrap = await window.__isoLogin('student@example.com', 'secret-password'); +assert.equal(loginWithTimedOutBootstrap.ok, true); +assert.equal(loginWithTimedOutBootstrap.success, true); +assert.equal(loginWithTimedOutBootstrap.bootstrap, null); + +assert.equal(tokenCalls, 3); +assert.equal(signupCalls, 2); assert.equal(bootstrapCalls, 2); -console.log('PASS auth bridge globals and session storage'); +console.log('PASS auth bridge deadlines, single-flight, globals, and session storage'); diff --git a/scripts/test-boot-performance.mjs b/scripts/test-boot-performance.mjs index a87810a..da1b8a8 100644 --- a/scripts/test-boot-performance.mjs +++ b/scripts/test-boot-performance.mjs @@ -6,6 +6,7 @@ const indexHtml = fs.readFileSync(new URL('../index.html', import.meta.url), 'ut const restoreSource = fs.readFileSync(new URL('../public/restore-and-launch.js', import.meta.url), 'utf8'); const swSource = fs.readFileSync(new URL('../public/sw.js', import.meta.url), 'utf8'); const pwaSource = fs.readFileSync(new URL('../public/pwa-local.js', import.meta.url), 'utf8'); +const serverSource = fs.readFileSync(new URL('../server.mjs', import.meta.url), 'utf8'); assert.equal( (indexHtml.match(/vendor-react-BfU3Zn2J\.js/g) || []).length, @@ -19,8 +20,29 @@ assert.doesNotMatch( 'restore launcher must not append a duplicate vendor preload' ); assert.ok( - restoreSource.indexOf('launchApp();') < restoreSource.indexOf('await purgeStaleFakeData()'), - 'entry mount must start before asynchronous boot cleanup' + restoreSource.indexOf('launchApp();') < restoreSource.indexOf('let session = parseSession(findSessionRaw())'), + 'entry mount must start before the boot session decision' +); +assert.match( + restoreSource, + /publishBootState\(BOOT_STATES\.READY_LOGGED_OUT[\s\S]*?requestIdleCallback\(runMaintenance/, + 'logged-out boot must resolve before deferred IndexedDB maintenance' +); +assert.doesNotMatch( + indexHtml, + /]+src="\/focus-bg-import\.js"/, + 'Focus background implementation must not load globally' +); +assert.match(indexHtml, /src="\/focus-bg-loader\.js"/, 'Focus route loader must remain active'); +assert.doesNotMatch( + indexHtml, + /]+vendor-katex-ASjZcBK0\.css/, + 'KaTeX CSS must stay route-lazy instead of render-blocking globally' +); +assert.equal( + (indexHtml.match(/sync\/backup-normalizer\.js/g) || []).length, + 0, + 'backup normalizer must be loaded through the local-data adapter only' ); assert.match(restoreSource, /notifyMountedAppOfBootResolution\(\)/, 'early mount must be notified after boot routing'); @@ -40,6 +62,25 @@ assert.match( /checkServer\(\{ dispatchEvent: false \}\)/, 'initial status check must not trigger update-checker duplicate preflight' ); +const bootstrapHandler = serverSource.slice( + serverSource.indexOf("// ── /__auth/bootstrap GET"), + serverSource.indexOf("// ── /__auth/snapshot POST"), +); +assert.doesNotMatch( + bootstrapHandler, + /findBestCloudBackup/, + 'login bootstrap must not scan full backup history' +); +assert.match( + serverSource, + /Session sync requires a stable session_id/, + 'session sync must reject retry-unstable generated IDs' +); +assert.match( + serverSource, + /snapshot_refresh_queued = true/, + 'committed session sync must treat snapshot refresh as best-effort' +); async function verifyFreshServiceWorkerInstall() { const serviceWorkerListeners = {}; diff --git a/scripts/verify-current-audit.mjs b/scripts/verify-current-audit.mjs new file mode 100644 index 0000000..b389c21 --- /dev/null +++ b/scripts/verify-current-audit.mjs @@ -0,0 +1,55 @@ +#!/usr/bin/env node + +import { readFile, realpath } from "node:fs/promises"; +import path from "node:path"; +import { fileURLToPath, pathToFileURL } from "node:url"; +import { buildCurrentAudit } from "./generate-current-audit.mjs"; + +const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url)); +const REPO_ROOT = path.resolve(SCRIPT_DIR, ".."); + +// This verifier is itself inventoried, so changing it invalidates the audit. +async function main() { + const { manifest, outputs } = await buildCurrentAudit(); + const failures = []; + + for (const [filePath, expected] of outputs) { + let actual; + try { + actual = await readFile(path.join(REPO_ROOT, filePath), "utf8"); + } catch (error) { + if (error?.code === "ENOENT") { + failures.push(`${filePath}: missing`); + continue; + } + throw error; + } + if (actual !== expected) failures.push(`${filePath}: stale`); + } + + if (failures.length > 0) { + process.stderr.write( + `Current-file audit verification failed:\n${failures + .map((failure) => `- ${failure}`) + .join("\n")}\n` + + "Run: node scripts/generate-current-audit.mjs\n", + ); + process.exitCode = 1; + return; + } + + process.stdout.write( + `Current-file audit is fresh for ${manifest.scope.auditedFileCount} files ` + + `(${manifest.repository.worktreeFingerprint}).\n`, + ); +} + +const invokedPath = process.argv[1] + ? pathToFileURL(await realpath(process.argv[1])).href + : null; +if (invokedPath === import.meta.url) { + main().catch((error) => { + process.stderr.write(`${error.stack ?? error.message}\n`); + process.exitCode = 1; + }); +} diff --git a/server.mjs b/server.mjs index b5d4e39..177363b 100644 --- a/server.mjs +++ b/server.mjs @@ -150,6 +150,7 @@ const RUNTIME_GLUE_PATHS = new Set([ '/pwa-local.js', '/boot-recovery.js', '/ux-setup.js', + '/focus-bg-loader.js', '/focus-bg-import.js', '/update-checker.js', '/sw.js', @@ -800,18 +801,36 @@ function buildUsernameAuthScript() { async function withTimeout(promiseFactory, timeoutMs, label) { var controller = typeof AbortController !== 'undefined' ? new AbortController() : null; - var tid; - var timeout = new Promise(function(_, reject) { - tid = setTimeout(function() { + var operation = Promise.resolve().then(function() { + return promiseFactory(controller ? controller.signal : null); + }); + return new Promise(function(resolve, reject) { + var finished = false; + var tid = setTimeout(async function() { try { if (controller) controller.abort(); } catch(e) {} + // Keep the sync lock while cooperative cancellation propagates. A short + // grace period prevents a timed-out request from immediately racing a + // second write against the same cloud state. + await Promise.race([ + operation.catch(function(){}), + new Promise(function(done) { setTimeout(done, 5000); }) + ]); + if (finished) return; + finished = true; reject(new Error(label || 'Operation timed out')); }, timeoutMs || 45000); + operation.then(function(value) { + if (finished) return; + finished = true; + clearTimeout(tid); + resolve(value); + }, function(error) { + if (finished) return; + finished = true; + clearTimeout(tid); + reject(error); + }); }); - try { - return await Promise.race([promiseFactory(controller ? controller.signal : null), timeout]); - } finally { - clearTimeout(tid); - } } var syncCoordinator = window.__isoSyncCoordinator || { @@ -825,7 +844,8 @@ function buildUsernameAuthScript() { async function withSyncLock(name, options, fn) { options = options || {}; var now = Date.now(); - var lockTimeoutMs = options.lockTimeoutMs || 90000; + var operationTimeoutMs = options.timeoutMs || 90000; + var lockTimeoutMs = Math.max(options.lockTimeoutMs || 90000, operationTimeoutMs + 6000); if (syncCoordinator.active && now - syncCoordinator.startedAt < lockTimeoutMs) { writeSyncMetadata({ last_sync_status: 'syncing', last_error: null, active_operation: syncCoordinator.activeName || 'sync' }); return { ok: false, skipped: true, reason: 'already_running', active: syncCoordinator.activeName }; @@ -844,7 +864,7 @@ function buildUsernameAuthScript() { syncCoordinator.startedAt = now; try { writeSyncMetadata({ last_sync_status: 'syncing', last_error: null, active_operation: syncCoordinator.activeName, active_started_at: new Date(now).toISOString() }); - return await withTimeout(function(){ return fn(); }, options.timeoutMs || lockTimeoutMs, (name || 'Sync') + ' timed out'); + return await withTimeout(function(signal){ return fn(signal); }, operationTimeoutMs, (name || 'Sync') + ' timed out'); } finally { syncCoordinator.active = false; syncCoordinator.activeName = null; @@ -2589,9 +2609,11 @@ const PREMIUM_SCRIPT = `