diff --git a/.dockerignore b/.dockerignore
index bc16e55..e3e1b9a 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -16,5 +16,8 @@ backups
.venv
__pycache__
node_modules
+**/node_modules
+frontend/dist
+frontend/.vite
evidence
.DS_Store
diff --git a/.env.example b/.env.example
index 7a28197..1887ed2 100644
--- a/.env.example
+++ b/.env.example
@@ -12,6 +12,8 @@ POSTGRES_DB=messenger
SESSION_TTL_SECONDS=3600
SESSION_STORE=postgres
+# Keep false only for local HTTP. Set true when the public entrypoint uses HTTPS.
+SESSION_COOKIE_SECURE=false
CURSOR_SIGNING_KEY_FILE=/run/secrets/cursor_signing_key
API_REPLICAS=2
diff --git a/REPORT.md b/REPORT.md
index 2cea2d6..c5ec443 100644
--- a/REPORT.md
+++ b/REPORT.md
@@ -5,9 +5,10 @@
- Итоговая цель: оценка «5»; трек будет выбран после реализации уровня «4»
- Commit/PR: заполняется автором после локального коммита и публикации
- Использованные источники и библиотеки: преподавательские README/OpenAPI/tests,
- документация Go, pgx, PostgreSQL, Docker Compose и Nginx. Для разбора
- архитектуры, рефакторинга, реализации и проверок использовался OpenAI Codex;
- решения проверены тестами и описанными ниже воспроизводимыми сценариями.
+ документация Go, pgx, PostgreSQL, Docker Compose, Nginx, React, TypeScript,
+ Vite, TanStack Query, React Router, Lucide и Vitest. Для разбора архитектуры,
+ рефакторинга, реализации и проверок использовался OpenAI Codex; решения
+ проверены тестами и описанными ниже воспроизводимыми сценариями.
## Запуск из чистого clone
@@ -39,6 +40,14 @@ docker compose --env-file .env up -d --wait api
make test-persistence ACTION_SCRIPT=./scripts/restart.sh
```
+По этому же адресу Nginx отдаёт production-сборку React. Переход на
+`http://localhost:8080` открывает Messenger, а `/api/v1/*` и health endpoints
+остаются доступны автоматическим проверкам. Отдельный Node.js на машине для
+обычного запуска не нужен: multi-stage image сам выполняет `npm ci`, Vitest,
+TypeScript build и копирует статические файлы в Nginx. Для production с HTTPS
+нужно установить `SESSION_COOKIE_SECURE=true`; локально по HTTP значение остаётся
+`false`.
+
`stop-one.sh` оставляет выбранную тестом реплику остановленной. Команда `up` в
примере явно возвращает желаемые две реплики перед следующей проверкой.
Обычная остановка не удаляет named volumes:
@@ -124,6 +133,37 @@ commit откатывает и бизнес-эффект, и запись клю
фиксируется как успешный результат. Перед replay снова выполняются обычная
проверка bearer-сессии и проверка членства в чате.
+### Frontend и браузерная сессия
+
+Клиент находится в `frontend/` и собран на React + TypeScript + Vite. TanStack
+Query отвечает за серверное состояние и периодическое обновление списков,
+React Router — за маршруты login/register, выбранного чата и профиля. UI сделан
+адаптивным: на широком экране одновременно видны навигация, список и разговор,
+а на узком список и чат переключаются как отдельные мобильные экраны. Фон чата
+добавлен из предоставленного изображения; нейтральная графитово-белая палитра,
+мягкая системная типографика и скруглённая геометрия компонентов подобраны
+самостоятельно, без копирования Telegram.
+
+Токен не хранится в `localStorage` и недоступен JavaScript. Успешный login
+по-прежнему возвращает преподавательский JSON с bearer token, но дополнительно
+ставит host-only cookie `mtusi_session` с `Path=/`, `HttpOnly` и
+`SameSite=Strict`. Флаг `Secure` управляется `SESSION_COOKIE_SECURE`: `false`
+нужен только локальному HTTP, на HTTPS должен быть `true`.
+
+Контрактные `/api/v1/*` сознательно остались Bearer-only. Nginx предоставляет
+отдельный браузерный адаптер `/web-api/v1/*`: берёт token из HttpOnly-cookie,
+формирует `Authorization: Bearer ...`, удаляет исходный `Cookie` и проксирует на
+обычный `/api/v1/*`. Поэтому преподавательские тесты и внешние API-клиенты не
+получили скрытый альтернативный способ авторизации. Same-origin deployment,
+`SameSite=Strict`, JSON-only изменяющие запросы и отсутствие CORS для сторонних
+origin уменьшают CSRF-поверхность. Logout удаляет серверную сессию и истекает
+cookie.
+
+Список чатов показывает только данные, реально существующие в контракте: title
+и число участников. Превью последнего сообщения и unread counter не имитируются,
+поскольку backend их пока не отдаёт. При неопределённой ошибке отправки клиент
+сохраняет текст вместе с `Idempotency-Key`; повтор использует тот же ключ.
+
## Доказательства критериев
| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства |
@@ -136,6 +176,7 @@ commit откатывает и бизнес-эффект, и запись клю
| Failover каждой API-реплики | два последовательных запуска `make test-failover ACTION_SCRIPT=./scripts/stop-one.sh` с восстановлением между ними | реально остановлены `api-2`, затем `api-1`; получено 142/143 успешных записи, 0 ошибок, восстановление 0.963/0.750 с | `scripts/stop-one.sh`, `evidence/lab3-summary.md` |
| Persistence после рестартов | `make test-persistence ACTION_SCRIPT=./scripts/restart.sh` | PASS; прежняя сессия и данные доступны после рестарта PostgreSQL, Redis, API и LB | `scripts/restart.sh`, `evidence/lab3-summary.md` |
| Миграции перед API | `docker compose --env-file .env ps -a` и логи `migrate` | миграции 1 и 2 применены; one-shot контейнер завершился с кодом 0; API healthy | `migrations/000002_message_idempotency.up.sql`, `evidence/lab3-summary.md` |
+| React frontend и HttpOnly BFF | `docker compose build load-balancer`; browser QA; cookie-only curl-сценарий | Vitest/TypeScript/Vite build PASS; register/login 201; прямой `/api` 401; `/web-api` 200; logout 204, после logout 401; browser console без warning/error | `frontend/`, `infrastructure/nginx/Dockerfile`, `infrastructure/nginx/nginx.conf` |
## Эксперименты и отказы
@@ -164,8 +205,9 @@ API-реплики; лимиты CPU/RAM пока не задавались, м
очистки без изменения схемы.
- Resource limits, количественный нагрузочный эксперимент и сценарий rolling
update ещё не реализованы; это следующий этап уровня «4».
-- Frontend на React + TypeScript + Vite будет отдельным этапом и отдельным
- коммитом после фиксации уровня «3». Тогда же будет спроектирована cookie-based
- авторизация с учётом текущего bearer-контракта API.
+- Текущий API не содержит endpoint поиска пользователей, аватаров, изменения
+ имени/пароля и агрегатов last message/unread. Поэтому UI принимает UUID
+ участников при создании чата, а профиль честно показывает только доступные
+ поля. Эти функции требуют сначала расширить и зафиксировать API-контракт.
- Трек уровня «5» пока не заявлен: сначала необходимо завершить и измерить
обязательный уровень «4».
diff --git a/cmd/server/main.go b/cmd/server/main.go
index 4a1fca8..38cd83a 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -101,6 +101,7 @@ func main() {
databasePool,
cfg.ReadinessTimeout,
),
+ handlers.WithSessionCookieSecure(cfg.SessionCookieSecure),
)
mux := http.NewServeMux()
diff --git a/compose.yaml b/compose.yaml
index e854ed5..dc1485d 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -1,10 +1,11 @@
services:
load-balancer:
- image: nginx:1.30.6-alpine@sha256:970364228b1e4f932abc22d321932816782cca8a20b85a77552a7cfe9acfb3b5
+ build:
+ context: .
+ dockerfile: infrastructure/nginx/Dockerfile
+ image: mtusi2026lab3-web
ports:
- "127.0.0.1:${APP_PORT:-8080}:8080"
- volumes:
- - ./infrastructure/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
api:
condition: service_healthy
@@ -96,6 +97,7 @@ services:
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
IDEMPOTENCY_TTL_SECONDS: ${IDEMPOTENCY_TTL_SECONDS:-86400}
SESSION_STORE: ${SESSION_STORE:-postgres}
+ SESSION_COOKIE_SECURE: ${SESSION_COOKIE_SECURE:-false}
CURSOR_SIGNING_KEY_FILE: ${CURSOR_SIGNING_KEY_FILE:-/run/secrets/cursor_signing_key}
CACHE_URL: ${CACHE_URL:-redis://redis:6379/0}
diff --git a/frontend/.dockerignore b/frontend/.dockerignore
new file mode 100644
index 0000000..0e75fe5
--- /dev/null
+++ b/frontend/.dockerignore
@@ -0,0 +1,3 @@
+node_modules
+dist
+coverage
diff --git a/frontend/index.html b/frontend/index.html
new file mode 100644
index 0000000..74b8e76
--- /dev/null
+++ b/frontend/index.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+ MTUCI Messenger
+
+
+
+
+
+
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
new file mode 100644
index 0000000..556c03b
--- /dev/null
+++ b/frontend/package-lock.json
@@ -0,0 +1,1688 @@
+{
+ "name": "mtusi-messenger-web",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "mtusi-messenger-web",
+ "version": "0.1.0",
+ "dependencies": {
+ "@tanstack/react-query": "^5.104.5",
+ "lucide-react": "^1.61.0",
+ "react": "^19.3.1",
+ "react-dom": "^19.3.1",
+ "react-router-dom": "^7.18.4"
+ },
+ "devDependencies": {
+ "@types/react": "^19.3.0",
+ "@types/react-dom": "^19.3.0",
+ "@vitejs/plugin-react": "^6.1.2",
+ "typescript": "^7.0.2",
+ "vite": "^8.3.5",
+ "vitest": "^5.0.5"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz",
+ "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@oxc-project/types": {
+ "version": "0.155.0",
+ "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.155.0.tgz",
+ "integrity": "sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/oxc-project"
+ }
+ },
+ "node_modules/@rolldown/binding-android-arm-eabi": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.15.tgz",
+ "integrity": "sha512-aLcgK9gIJ3YRvrrtfSBbRa27F5WrpiTaPulnFpsHPxpUHgFlSgnU4854MHwoRGEBhfRJDWCS2WQ7lIjskE9Olw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-android-arm64": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.15.tgz",
+ "integrity": "sha512-xD7DdZCrbThKuxNg7ooQmvp07ys4J/pnSEMTG3/OdOWl6daC67m/Q4fL78sRHMxTH/N4fGUbYhcPM0MF5WFHkg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-darwin-arm64": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.15.tgz",
+ "integrity": "sha512-m2WuQ6r0B4OTYxyPpNLtXaMRbRDUbG8YQV2Q3KTdSSK8Th6KHCnC8jVCJt8bvYeSB5WivkkNbc85mKadaSdOxA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-darwin-x64": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.15.tgz",
+ "integrity": "sha512-5RtnsHM36nodM9WbMy+zip0LGS/G+y5wro5RHrpOlr4ac24+1zSi9kiV2MP1myZeZ/ifEHfulQcWjnAXzc2C2A==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-freebsd-x64": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.15.tgz",
+ "integrity": "sha512-g3l09pyFqhu+135JKkbkwiKGQmwU5hUMUPJ4VdBADvuqR8d33L6H578rh8m7rtxbdp+VmX/+nzI7nvhSZlzpUQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm-gnueabihf": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.15.tgz",
+ "integrity": "sha512-nIe3VugI97nGQtspPxDqA4sXMUpeiocKIP/CqpY/u/vgbT+alX+cVxu1C/oVBPKg4feNTmYovE91v4DgXvXNwQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm64-gnu": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.15.tgz",
+ "integrity": "sha512-iTBjXx+B5QSvgI89lJfmqh4wTh8NabR1YZIIN3hNx4zSG0EVfVqkOvLulNpG4251pbd6/IAmZ/LefVk1Y4rPhw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm64-musl": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.15.tgz",
+ "integrity": "sha512-uN26XOnVR7rqQupG3V9oAG2EGGatWjcJHOeDOHUFCh4TBWmP2tHTFoVN13aYbwfm0aHqJAEmcwhAu6sooIjfqQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-ppc64-gnu": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.15.tgz",
+ "integrity": "sha512-9nWkcdd+H+XhaA3fQIwpHnKIrfx/PQ6rO0pivr78Og07tXlUlctBBJoEYLPfhTmCR/QxEVdn6uPjHV5SymPhdw==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-s390x-gnu": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.15.tgz",
+ "integrity": "sha512-Ggh0ciFjLwIusLSLz7LZYEaGdxOAUJXI+Qu5JCbhPJJHEt8vP+IjRATTJheiJsdzzTYgUiHUiw3X1Ea3ZpMBdA==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-x64-gnu": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.15.tgz",
+ "integrity": "sha512-FHg60rS6DBePAYZ9X9F67x+JObFdmgn6tupA1C/a3B+CufFmTD4mX+e8M75tCiAO3foR/6xwVBI0KQiI7sn/rw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-x64-musl": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.15.tgz",
+ "integrity": "sha512-/cvV/7v5VGz/moiz0XKRj2dE8DzsKyhIu1KpOvJGPjRywg3yscON889UGvAe8zfiJLHup7VLjBduoGWi3HusWQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-openharmony-arm64": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.15.tgz",
+ "integrity": "sha512-MyzC5Hrv/sm+Z7TSGKP/j8001RO2xQm1zOpCNVL4j0cY/VhBZviludA2YFQ7i4lH6ZAXxQm0lcMdBzM+99mE7w==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-win32-arm64-msvc": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.15.tgz",
+ "integrity": "sha512-+PgYiS+AH5omy6L45ZLxybasauJaj3M8buoT83D+nzPmCayXlxUV9hydhciCKVyIg0B/v0BtXPDE1uGqNwCPpg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-win32-x64-msvc": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.15.tgz",
+ "integrity": "sha512-HFZd2QNQYn1JbIi+Hpd7H+r/lkWxcfIu28nirZ6eCn2LafuvmExMlb/P96Sfx5tf7pPArw39IdhmCF8vmV+NhQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/pluginutils": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",
+ "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@tanstack/query-core": {
+ "version": "5.104.5",
+ "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.104.5.tgz",
+ "integrity": "sha512-Q94gI8Opd+CbdVNOdj8ZCyV8WqLYitrDq1t96Xc8WZT6lY0r5iRnJLXYDxMex7EEf2v+mXvn4FcjaBKSxXZQ9A==",
+ "license": "MIT",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/tannerlinsley"
+ }
+ },
+ "node_modules/@tanstack/react-query": {
+ "version": "5.104.5",
+ "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.104.5.tgz",
+ "integrity": "sha512-RORgFe052U+93weaNuqg7qHq7vNVNzXN/VrXqD4bbAuQCWUqOl2lV5Ui9flWk5CVvMyL/Bh27QWhzwH0aaOx9g==",
+ "license": "MIT",
+ "dependencies": {
+ "@tanstack/query-core": "5.104.5"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/tannerlinsley"
+ },
+ "peerDependencies": {
+ "@types/react": "^18 || ^19",
+ "react": "^18 || ^19"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@types/chai": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
+ "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/deep-eql": "*",
+ "assertion-error": "^2.0.1"
+ }
+ },
+ "node_modules/@types/deep-eql": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
+ "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
+ "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/react": {
+ "version": "19.3.0",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz",
+ "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "csstype": "^3.2.2"
+ }
+ },
+ "node_modules/@types/react-dom": {
+ "version": "19.3.0",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz",
+ "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "^19.3.0"
+ }
+ },
+ "node_modules/@typescript/typescript-aix-ppc64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz",
+ "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-darwin-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz",
+ "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-darwin-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz",
+ "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-freebsd-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz",
+ "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-freebsd-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz",
+ "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-arm": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz",
+ "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz",
+ "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-loong64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz",
+ "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-mips64el": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz",
+ "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-ppc64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz",
+ "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-riscv64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz",
+ "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-s390x": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz",
+ "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz",
+ "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-netbsd-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz",
+ "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-netbsd-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz",
+ "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-openbsd-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz",
+ "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-openbsd-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz",
+ "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-sunos-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz",
+ "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-win32-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz",
+ "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-win32-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz",
+ "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@vitejs/plugin-react": {
+ "version": "6.1.2",
+ "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.1.2.tgz",
+ "integrity": "sha512-fhJNGUdscQa4HkI0xFxwonWyhnVReCPDbXI7FH7jmzpnVCrFQI7PRrhWecO263610vOrs9tr2Y4xcf8uAdFxbw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@rolldown/pluginutils": "^1.0.1"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "peerDependencies": {
+ "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0",
+ "babel-plugin-react-compiler": "^1.0.0",
+ "oxc-transform-react": "^0.152.0",
+ "vite": "^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@rolldown/plugin-babel": {
+ "optional": true
+ },
+ "babel-plugin-react-compiler": {
+ "optional": true
+ },
+ "oxc-transform-react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@vitest/mocker": {
+ "version": "5.0.5",
+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz",
+ "integrity": "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/trace-mapping": "0.3.31",
+ "@vitest/spy": "5.0.5",
+ "estree-walker": "^3.0.3",
+ "magic-string": "^1.4.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "msw": "^2.4.9 || ^3.0.0",
+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "msw": {
+ "optional": true
+ },
+ "vite": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@vitest/spy": {
+ "version": "5.0.5",
+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.5.tgz",
+ "integrity": "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/assertion-error": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/chai": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz",
+ "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz",
+ "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/csstype": {
+ "version": "3.2.3",
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
+ "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/detect-libc": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/es-module-lexer": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz",
+ "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/estree-walker": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "^1.0.0"
+ }
+ },
+ "node_modules/expect-type": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz",
+ "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
+ "node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/lightningcss": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",
+ "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",
+ "dev": true,
+ "license": "MPL-2.0",
+ "dependencies": {
+ "detect-libc": "^2.0.3"
+ },
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ },
+ "optionalDependencies": {
+ "lightningcss-android-arm64": "1.33.0",
+ "lightningcss-darwin-arm64": "1.33.0",
+ "lightningcss-darwin-x64": "1.33.0",
+ "lightningcss-freebsd-x64": "1.33.0",
+ "lightningcss-linux-arm-gnueabihf": "1.33.0",
+ "lightningcss-linux-arm64-gnu": "1.33.0",
+ "lightningcss-linux-arm64-musl": "1.33.0",
+ "lightningcss-linux-x64-gnu": "1.33.0",
+ "lightningcss-linux-x64-musl": "1.33.0",
+ "lightningcss-win32-arm64-msvc": "1.33.0",
+ "lightningcss-win32-x64-msvc": "1.33.0"
+ }
+ },
+ "node_modules/lightningcss-android-arm64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz",
+ "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-darwin-arm64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",
+ "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-darwin-x64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",
+ "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-freebsd-x64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",
+ "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm-gnueabihf": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",
+ "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm64-gnu": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",
+ "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm64-musl": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",
+ "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-x64-gnu": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",
+ "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-x64-musl": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",
+ "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-win32-arm64-msvc": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",
+ "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-win32-x64-msvc": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",
+ "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lucide-react": {
+ "version": "1.61.0",
+ "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.61.0.tgz",
+ "integrity": "sha512-v2SQPPPNjnr+BlhL9Spuzmo5yR+hLkftfuE4E3jaxdNPgSH0hJKPcLJBP7yAta87jQNPsSERS59PJjCJ/CorBA==",
+ "license": "ISC",
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/magic-string": {
+ "version": "1.4.3",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz",
+ "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.6.0"
+ }
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.20",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
+ "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/obug": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz",
+ "integrity": "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==",
+ "dev": true,
+ "funding": [
+ "https://github.com/sponsors/sxzz",
+ "https://opencollective.com/debug"
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/picomatch": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
+ "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/postcss": {
+ "version": "8.5.31",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.31.tgz",
+ "integrity": "sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.20",
+ "picocolors": "^1.1.1",
+ "source-map-js": "^1.2.2"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/react": {
+ "version": "19.3.1",
+ "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz",
+ "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/react-dom": {
+ "version": "19.3.1",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz",
+ "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==",
+ "license": "MIT",
+ "dependencies": {
+ "scheduler": "^0.28.0"
+ },
+ "peerDependencies": {
+ "react": "^19.3.1"
+ }
+ },
+ "node_modules/react-router": {
+ "version": "7.18.4",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.4.tgz",
+ "integrity": "sha512-PUPQcMhMGRAslLcvtlPz/kmzBEWPhLdgLFrL7pLNepBL6dX0lWj4WD2cUYVgYCuT3jxvghYFg81cDTj44DhetQ==",
+ "license": "MIT",
+ "dependencies": {
+ "cookie": "^1.0.1",
+ "set-cookie-parser": "^2.6.0"
+ },
+ "engines": {
+ "node": ">=20.0.0"
+ },
+ "peerDependencies": {
+ "react": ">=18",
+ "react-dom": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/react-router-dom": {
+ "version": "7.18.4",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.4.tgz",
+ "integrity": "sha512-yrfmJHIpDG7taCpqKjT1G5B6q3O2K+RN8/fgNf0lTjCwiPbQ0ei6vXX9ZjQR+7ld8Tr7Z5xmyMnZ8YJrphWQUw==",
+ "license": "MIT",
+ "dependencies": {
+ "react-router": "7.18.4"
+ },
+ "engines": {
+ "node": ">=20.0.0"
+ },
+ "peerDependencies": {
+ "react": ">=18",
+ "react-dom": ">=18"
+ }
+ },
+ "node_modules/rolldown": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.15.tgz",
+ "integrity": "sha512-6odND+fel5zVw3I4Yc2e69gvguDnX0CAAGiNDZSq4ik5WUcaLrkD2GLuog0XcODbor31hZ5ayEMgVDno+KPV5g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@oxc-project/types": "=0.155.0",
+ "@rolldown/pluginutils": "^1.0.0"
+ },
+ "bin": {
+ "rolldown": "bin/cli.mjs"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "optionalDependencies": {
+ "@rolldown/binding-android-arm-eabi": "1.2.15",
+ "@rolldown/binding-android-arm64": "1.2.15",
+ "@rolldown/binding-darwin-arm64": "1.2.15",
+ "@rolldown/binding-darwin-x64": "1.2.15",
+ "@rolldown/binding-freebsd-x64": "1.2.15",
+ "@rolldown/binding-linux-arm-gnueabihf": "1.2.15",
+ "@rolldown/binding-linux-arm64-gnu": "1.2.15",
+ "@rolldown/binding-linux-arm64-musl": "1.2.15",
+ "@rolldown/binding-linux-ppc64-gnu": "1.2.15",
+ "@rolldown/binding-linux-s390x-gnu": "1.2.15",
+ "@rolldown/binding-linux-x64-gnu": "1.2.15",
+ "@rolldown/binding-linux-x64-musl": "1.2.15",
+ "@rolldown/binding-openharmony-arm64": "1.2.15",
+ "@rolldown/binding-win32-arm64-msvc": "1.2.15",
+ "@rolldown/binding-win32-x64-msvc": "1.2.15"
+ }
+ },
+ "node_modules/scheduler": {
+ "version": "0.28.0",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz",
+ "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==",
+ "license": "MIT"
+ },
+ "node_modules/set-cookie-parser": {
+ "version": "2.7.2",
+ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz",
+ "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==",
+ "license": "MIT"
+ },
+ "node_modules/source-map-js": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
+ "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/std-env": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz",
+ "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tinybench": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.2.tgz",
+ "integrity": "sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=20.0.0"
+ }
+ },
+ "node_modules/tinyexec": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz",
+ "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/tinyglobby": {
+ "version": "0.2.17",
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.4"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/SuperchupuDev"
+ }
+ },
+ "node_modules/typescript": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz",
+ "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc"
+ },
+ "engines": {
+ "node": ">=16.20.0"
+ },
+ "optionalDependencies": {
+ "@typescript/typescript-aix-ppc64": "7.0.2",
+ "@typescript/typescript-darwin-arm64": "7.0.2",
+ "@typescript/typescript-darwin-x64": "7.0.2",
+ "@typescript/typescript-freebsd-arm64": "7.0.2",
+ "@typescript/typescript-freebsd-x64": "7.0.2",
+ "@typescript/typescript-linux-arm": "7.0.2",
+ "@typescript/typescript-linux-arm64": "7.0.2",
+ "@typescript/typescript-linux-loong64": "7.0.2",
+ "@typescript/typescript-linux-mips64el": "7.0.2",
+ "@typescript/typescript-linux-ppc64": "7.0.2",
+ "@typescript/typescript-linux-riscv64": "7.0.2",
+ "@typescript/typescript-linux-s390x": "7.0.2",
+ "@typescript/typescript-linux-x64": "7.0.2",
+ "@typescript/typescript-netbsd-arm64": "7.0.2",
+ "@typescript/typescript-netbsd-x64": "7.0.2",
+ "@typescript/typescript-openbsd-arm64": "7.0.2",
+ "@typescript/typescript-openbsd-x64": "7.0.2",
+ "@typescript/typescript-sunos-x64": "7.0.2",
+ "@typescript/typescript-win32-arm64": "7.0.2",
+ "@typescript/typescript-win32-x64": "7.0.2"
+ }
+ },
+ "node_modules/vite": {
+ "version": "8.3.5",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.5.tgz",
+ "integrity": "sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "lightningcss": "^1.33.0",
+ "picomatch": "^4.0.7",
+ "postcss": "^8.5.30",
+ "rolldown": "~1.2.14",
+ "tinyglobby": "^0.2.17"
+ },
+ "bin": {
+ "vite": "bin/vite.js"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/vitejs/vite?sponsor=1"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ },
+ "peerDependencies": {
+ "@types/node": "^20.19.0 || >=22.12.0",
+ "@vitejs/devtools": "^0.7.1 || ^0.8.0",
+ "esbuild": "^0.27.0 || ^0.28.0",
+ "jiti": ">=1.21.0",
+ "less": "^4.0.0",
+ "sass": "^1.70.0",
+ "sass-embedded": "^1.70.0",
+ "stylus": ">=0.54.8",
+ "sugarss": "^5.0.0",
+ "terser": "^5.16.0",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "@vitejs/devtools": {
+ "optional": true
+ },
+ "esbuild": {
+ "optional": true
+ },
+ "jiti": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "sass-embedded": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "terser": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/vitest": {
+ "version": "5.0.5",
+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.5.tgz",
+ "integrity": "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/chai": "^5.2.2",
+ "@vitest/mocker": "5.0.5",
+ "chai": "^6.3.0",
+ "es-module-lexer": "^2.3.2",
+ "expect-type": "^1.4.0",
+ "magic-string": "^1.4.3",
+ "obug": "^3.0.0",
+ "picomatch": "^4.0.7",
+ "std-env": "^4.3.0",
+ "tinybench": "^6.2.2",
+ "tinyexec": "^1.3.1",
+ "tinyglobby": "^0.2.17",
+ "why-is-node-running": "3.2.1"
+ },
+ "bin": {
+ "vitest": "vitest.mjs"
+ },
+ "engines": {
+ "node": "^22.12.0 || ^24.0.0 || >=26.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "@edge-runtime/vm": "*",
+ "@opentelemetry/api": "^1.9.0",
+ "@types/node": "^22.0.0 || >=24.0.0",
+ "@vitest/browser-playwright": "5.0.5",
+ "@vitest/browser-preview": "5.0.5",
+ "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
+ "@vitest/coverage-istanbul": "5.0.5",
+ "@vitest/coverage-v8": "5.0.5",
+ "@vitest/ui": "5.0.5",
+ "happy-dom": "*",
+ "jsdom": "*",
+ "vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@edge-runtime/vm": {
+ "optional": true
+ },
+ "@opentelemetry/api": {
+ "optional": true
+ },
+ "@types/node": {
+ "optional": true
+ },
+ "@vitest/browser-playwright": {
+ "optional": true
+ },
+ "@vitest/browser-preview": {
+ "optional": true
+ },
+ "@vitest/browser-webdriverio": {
+ "optional": true
+ },
+ "@vitest/coverage-istanbul": {
+ "optional": true
+ },
+ "@vitest/coverage-v8": {
+ "optional": true
+ },
+ "@vitest/ui": {
+ "optional": true
+ },
+ "happy-dom": {
+ "optional": true
+ },
+ "jsdom": {
+ "optional": true
+ },
+ "vite": {
+ "optional": false
+ }
+ }
+ },
+ "node_modules/why-is-node-running": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz",
+ "integrity": "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "why-is-node-running": "cli.js"
+ },
+ "engines": {
+ "node": ">=20.11"
+ }
+ }
+ }
+}
diff --git a/frontend/package.json b/frontend/package.json
new file mode 100644
index 0000000..8f151c3
--- /dev/null
+++ b/frontend/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "mtusi-messenger-web",
+ "private": true,
+ "version": "0.1.0",
+ "type": "module",
+ "scripts": {
+ "dev": "vite --host 0.0.0.0",
+ "build": "tsc -b && vite build",
+ "test": "vitest run",
+ "test:watch": "vitest"
+ },
+ "dependencies": {
+ "@tanstack/react-query": "^5.104.5",
+ "lucide-react": "^1.61.0",
+ "react": "^19.3.1",
+ "react-dom": "^19.3.1",
+ "react-router-dom": "^7.18.4"
+ },
+ "devDependencies": {
+ "@types/react": "^19.3.0",
+ "@types/react-dom": "^19.3.0",
+ "@vitejs/plugin-react": "^6.1.2",
+ "typescript": "^7.0.2",
+ "vite": "^8.3.5",
+ "vitest": "^5.0.5"
+ }
+}
diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts
new file mode 100644
index 0000000..9a227eb
--- /dev/null
+++ b/frontend/src/api/client.ts
@@ -0,0 +1,158 @@
+import type {
+ ApiErrorBody,
+ Chat,
+ CreateChatInput,
+ LoginInput,
+ Message,
+ Page,
+ RegisterInput,
+ Session,
+ User,
+} from "./types";
+
+const publicApi = "/api/v1";
+const browserApi = "/web-api/v1";
+
+export class ApiError extends Error {
+ readonly status: number;
+ readonly code?: string;
+ readonly requestId?: string;
+
+ constructor(status: number, body: ApiErrorBody) {
+ super(body.error?.message || `HTTP ${status}`);
+ this.name = "ApiError";
+ this.status = status;
+ this.code = body.error?.code;
+ this.requestId = body.error?.request_id;
+ }
+}
+
+type RequestOptions = Omit & {
+ body?: unknown;
+};
+
+async function request(path: string, options: RequestOptions = {}): Promise {
+ const headers = new Headers(options.headers);
+ if (options.body !== undefined) {
+ headers.set("Content-Type", "application/json");
+ }
+
+ const response = await fetch(path, {
+ ...options,
+ headers,
+ credentials: "same-origin",
+ body: options.body === undefined ? undefined : JSON.stringify(options.body),
+ });
+
+ if (!response.ok) {
+ let body: ApiErrorBody = {};
+ try {
+ body = (await response.json()) as ApiErrorBody;
+ } catch {
+ // Preserve a useful HTTP-level error when a proxy returned non-JSON.
+ }
+ throw new ApiError(response.status, body);
+ }
+
+ if (response.status === 204) {
+ return undefined as T;
+ }
+ return (await response.json()) as T;
+}
+
+function encodeBasic({ username, password }: LoginInput): string {
+ const bytes = new TextEncoder().encode(`${username}:${password}`);
+ let binary = "";
+ for (const byte of bytes) {
+ binary += String.fromCharCode(byte);
+ }
+ return btoa(binary);
+}
+
+async function collectPages(path: string): Promise {
+ const items: T[] = [];
+ let cursor: string | null = null;
+
+ for (let pageIndex = 0; pageIndex < 100; pageIndex += 1) {
+ const search = new URLSearchParams({ limit: "100" });
+ if (cursor) {
+ search.set("cursor", cursor);
+ }
+ const page = await request>(`${path}?${search.toString()}`);
+ items.push(...page.items);
+ cursor = page.next_cursor;
+ if (!cursor) {
+ return items;
+ }
+ }
+ throw new Error("pagination safety limit exceeded");
+}
+
+export const api = {
+ register(input: RegisterInput): Promise {
+ return request(`${publicApi}/users`, {
+ method: "POST",
+ body: {
+ username: input.username,
+ display_name: input.displayName,
+ password: input.password,
+ },
+ });
+ },
+
+ login(input: LoginInput): Promise {
+ return request(`${publicApi}/auth/sessions`, {
+ method: "POST",
+ headers: {
+ Authorization: `Basic ${encodeBasic(input)}`,
+ },
+ });
+ },
+
+ logout(): Promise {
+ return request(`${browserApi}/auth/sessions/current`, {
+ method: "DELETE",
+ });
+ },
+
+ me(): Promise {
+ return request(`${browserApi}/users/me`);
+ },
+
+ chats(): Promise {
+ return collectPages(`${browserApi}/chats`);
+ },
+
+ chat(chatID: string): Promise {
+ return request(`${browserApi}/chats/${encodeURIComponent(chatID)}`);
+ },
+
+ createChat(input: CreateChatInput): Promise {
+ return request(`${browserApi}/chats`, {
+ method: "POST",
+ body: {
+ title: input.title,
+ member_ids: input.memberIds,
+ },
+ });
+ },
+
+ messages(chatID: string): Promise {
+ return collectPages(
+ `${browserApi}/chats/${encodeURIComponent(chatID)}/messages`,
+ );
+ },
+
+ sendMessage(chatID: string, text: string, idempotencyKey: string): Promise {
+ return request(
+ `${browserApi}/chats/${encodeURIComponent(chatID)}/messages`,
+ {
+ method: "POST",
+ headers: {
+ "Idempotency-Key": idempotencyKey,
+ },
+ body: { text },
+ },
+ );
+ },
+};
diff --git a/frontend/src/api/types.ts b/frontend/src/api/types.ts
new file mode 100644
index 0000000..21283d8
--- /dev/null
+++ b/frontend/src/api/types.ts
@@ -0,0 +1,57 @@
+export type User = {
+ id: string;
+ username: string;
+ display_name: string;
+ created_at: string;
+};
+
+export type Session = {
+ token: string;
+ token_type: "Bearer";
+ expires_at: string;
+ user: User;
+};
+
+export type Chat = {
+ id: string;
+ title: string;
+ member_ids: string[];
+ created_at: string;
+};
+
+export type Message = {
+ id: string;
+ chat_id: string;
+ sender_id: string;
+ text: string;
+ created_at: string;
+};
+
+export type Page = {
+ items: T[];
+ next_cursor: string | null;
+};
+
+export type ApiErrorBody = {
+ error?: {
+ code?: string;
+ message?: string;
+ request_id?: string;
+ };
+};
+
+export type RegisterInput = {
+ username: string;
+ displayName: string;
+ password: string;
+};
+
+export type CreateChatInput = {
+ title: string;
+ memberIds: string[];
+};
+
+export type LoginInput = {
+ username: string;
+ password: string;
+};
diff --git a/frontend/src/app/App.tsx b/frontend/src/app/App.tsx
new file mode 100644
index 0000000..c6aa7ae
--- /dev/null
+++ b/frontend/src/app/App.tsx
@@ -0,0 +1,51 @@
+import { Navigate, Outlet, Route, Routes, useLocation } from "react-router-dom";
+
+import { useAuth } from "../auth/AuthProvider";
+import { LoadingScreen } from "../components/LoadingScreen";
+import { AuthPage } from "../pages/AuthPage";
+import { MessengerPage } from "../pages/MessengerPage";
+
+function ProtectedRoute() {
+ const { user, isLoading } = useAuth();
+ const location = useLocation();
+
+ if (isLoading) {
+ return ;
+ }
+ if (!user) {
+ return ;
+ }
+ return ;
+}
+
+function PublicOnlyRoute() {
+ const { user, isLoading } = useAuth();
+
+ if (isLoading) {
+ return ;
+ }
+ if (user) {
+ return ;
+ }
+ return ;
+}
+
+export function App() {
+ return (
+
+ }>
+ } />
+ } />
+
+
+ }>
+ } />
+ } />
+ } />
+
+
+ } />
+ } />
+
+ );
+}
diff --git a/frontend/src/assets/chat-background.jpg b/frontend/src/assets/chat-background.jpg
new file mode 100644
index 0000000..899884b
Binary files /dev/null and b/frontend/src/assets/chat-background.jpg differ
diff --git a/frontend/src/auth/AuthProvider.tsx b/frontend/src/auth/AuthProvider.tsx
new file mode 100644
index 0000000..5154fad
--- /dev/null
+++ b/frontend/src/auth/AuthProvider.tsx
@@ -0,0 +1,90 @@
+import { useQuery, useQueryClient } from "@tanstack/react-query";
+import {
+ createContext,
+ useCallback,
+ useContext,
+ type PropsWithChildren,
+} from "react";
+
+import { api, ApiError } from "../api/client";
+import type { LoginInput, RegisterInput, User } from "../api/types";
+
+type AuthContextValue = {
+ user: User | null;
+ isLoading: boolean;
+ login: (input: LoginInput) => Promise;
+ register: (input: RegisterInput) => Promise;
+ logout: () => Promise;
+};
+
+const AuthContext = createContext(null);
+const meQueryKey = ["current-user"] as const;
+
+async function loadCurrentUser(): Promise {
+ try {
+ return await api.me();
+ } catch (error) {
+ if (error instanceof ApiError && error.status === 401) {
+ return null;
+ }
+ throw error;
+ }
+}
+
+export function AuthProvider({ children }: PropsWithChildren) {
+ const queryClient = useQueryClient();
+ const meQuery = useQuery({
+ queryKey: meQueryKey,
+ queryFn: loadCurrentUser,
+ retry: false,
+ staleTime: 30_000,
+ });
+
+ const login = useCallback(
+ async (input: LoginInput) => {
+ const session = await api.login(input);
+ queryClient.setQueryData(meQueryKey, session.user);
+ },
+ [queryClient],
+ );
+
+ const register = useCallback(
+ async (input: RegisterInput) => {
+ await api.register(input);
+ const session = await api.login({
+ username: input.username,
+ password: input.password,
+ });
+ queryClient.setQueryData(meQueryKey, session.user);
+ },
+ [queryClient],
+ );
+
+ const logout = useCallback(async () => {
+ await api.logout();
+ queryClient.setQueryData(meQueryKey, null);
+ queryClient.removeQueries({ queryKey: ["chats"] });
+ }, [queryClient]);
+
+ return (
+
+ {children}
+
+ );
+}
+
+export function useAuth(): AuthContextValue {
+ const context = useContext(AuthContext);
+ if (!context) {
+ throw new Error("useAuth must be used within AuthProvider");
+ }
+ return context;
+}
diff --git a/frontend/src/components/Avatar.tsx b/frontend/src/components/Avatar.tsx
new file mode 100644
index 0000000..6fd07fb
--- /dev/null
+++ b/frontend/src/components/Avatar.tsx
@@ -0,0 +1,26 @@
+import { initials } from "../lib/format";
+
+type AvatarProps = {
+ label: string;
+ seed?: string;
+ size?: "small" | "medium" | "large";
+};
+
+function tone(seed: string): number {
+ let hash = 0;
+ for (const character of seed) {
+ hash = (hash * 31 + character.codePointAt(0)!) >>> 0;
+ }
+ return hash % 5;
+}
+
+export function Avatar({ label, seed = label, size = "medium" }: AvatarProps) {
+ return (
+
+ {initials(label)}
+
+ );
+}
diff --git a/frontend/src/components/ChatList.tsx b/frontend/src/components/ChatList.tsx
new file mode 100644
index 0000000..1426d01
--- /dev/null
+++ b/frontend/src/components/ChatList.tsx
@@ -0,0 +1,121 @@
+import { MessageSquarePlus, Search, UsersRound, X } from "lucide-react";
+import { useMemo, useState } from "react";
+import { useNavigate } from "react-router-dom";
+
+import type { Chat, User } from "../api/types";
+import { formatMemberCount } from "../lib/format";
+import { Avatar } from "./Avatar";
+
+type ChatListProps = {
+ chats: Chat[];
+ currentUser: User;
+ error: boolean;
+ isLoading: boolean;
+ selectedChatID?: string;
+ onCreateChat: () => void;
+};
+
+export function ChatList({
+ chats,
+ currentUser,
+ error,
+ isLoading,
+ selectedChatID,
+ onCreateChat,
+}: ChatListProps) {
+ const navigate = useNavigate();
+ const [search, setSearch] = useState("");
+
+ const filteredChats = useMemo(() => {
+ const normalized = search.trim().toLocaleLowerCase("ru");
+ if (!normalized) {
+ return chats;
+ }
+ return chats.filter((chat) =>
+ chat.title.toLocaleLowerCase("ru").includes(normalized),
+ );
+ }, [chats, search]);
+
+ return (
+
+
+
+
+
+ setSearch(event.target.value)}
+ placeholder="Поиск"
+ value={search}
+ />
+ {search && (
+ setSearch("")} type="button">
+
+
+ )}
+
+
+
+ {isLoading && (
+
+ )}
+ {error && (
+
+
Не удалось загрузить список чатов.
+
+ )}
+ {!isLoading && !error && filteredChats.length === 0 && (
+
+
+
{search ? "Ничего не найдено" : "У вас пока нет чатов"}
+ {!search && (
+
+ Создать первый
+
+ )}
+
+ )}
+ {filteredChats.map((chat) => (
+
navigate(`/app/chats/${chat.id}`)}
+ type="button"
+ >
+
+
+ {chat.title}
+ {formatMemberCount(chat.member_ids.length)}
+
+ {chat.member_ids.includes(currentUser.id) && (
+
+ •
+
+ )}
+
+ ))}
+
+
+
+
+ );
+}
diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsx
new file mode 100644
index 0000000..64ffaad
--- /dev/null
+++ b/frontend/src/components/ChatView.tsx
@@ -0,0 +1,236 @@
+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import {
+ ArrowLeft,
+ CheckCheck,
+ RefreshCcw,
+ Send,
+ ShieldCheck,
+ UsersRound,
+} from "lucide-react";
+import {
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+ type FormEvent,
+ type KeyboardEvent,
+} from "react";
+
+import { api } from "../api/client";
+import type { Chat, Message, User } from "../api/types";
+import {
+ dayKey,
+ formatDay,
+ formatMemberCount,
+ formatMessageTime,
+ shortID,
+} from "../lib/format";
+import { createIdempotencyKey } from "../lib/idempotency";
+import { Avatar } from "./Avatar";
+
+type ChatViewProps = {
+ chat: Chat;
+ currentUser: User;
+ onBack: () => void;
+};
+
+type SendEnvelope = {
+ text: string;
+ idempotencyKey: string;
+};
+
+export function ChatView({ chat, currentUser, onBack }: ChatViewProps) {
+ const queryClient = useQueryClient();
+ const messagesEnd = useRef(null);
+ const [draft, setDraft] = useState("");
+ const [failedEnvelope, setFailedEnvelope] = useState(null);
+
+ const messagesQuery = useQuery({
+ queryKey: ["messages", chat.id],
+ queryFn: () => api.messages(chat.id),
+ refetchInterval: 3_000,
+ staleTime: 1_000,
+ });
+
+ const messages = messagesQuery.data ?? [];
+
+ useEffect(() => {
+ messagesEnd.current?.scrollIntoView({
+ behavior: messages.length > 1 ? "smooth" : "auto",
+ block: "end",
+ });
+ }, [chat.id, messages.length]);
+
+ const mutation = useMutation({
+ mutationFn: (envelope: SendEnvelope) =>
+ api.sendMessage(chat.id, envelope.text, envelope.idempotencyKey),
+ onSuccess: (message) => {
+ setFailedEnvelope(null);
+ queryClient.setQueryData(
+ ["messages", chat.id],
+ (current = []) => {
+ if (current.some((item) => item.id === message.id)) {
+ return current;
+ }
+ return [...current, message];
+ },
+ );
+ },
+ onError: (_error, envelope) => {
+ setFailedEnvelope(envelope);
+ },
+ });
+
+ const groups = useMemo(() => {
+ const result: Array<{ key: string; label: string; messages: Message[] }> = [];
+ for (const message of messages) {
+ const key = dayKey(message.created_at);
+ const current = result.at(-1);
+ if (!current || current.key !== key) {
+ result.push({
+ key,
+ label: formatDay(message.created_at),
+ messages: [message],
+ });
+ } else {
+ current.messages.push(message);
+ }
+ }
+ return result;
+ }, [messages]);
+
+ function send(envelope: SendEnvelope) {
+ if (!mutation.isPending) {
+ mutation.mutate(envelope);
+ }
+ }
+
+ function submit(event: FormEvent) {
+ event.preventDefault();
+ const text = draft.trim();
+ if (!text || Array.from(text).length > 4_000) {
+ return;
+ }
+ const envelope = { text, idempotencyKey: createIdempotencyKey() };
+ setDraft("");
+ setFailedEnvelope(null);
+ send(envelope);
+ }
+
+ function handleKeyDown(event: KeyboardEvent) {
+ if (event.key === "Enter" && !event.shiftKey) {
+ event.preventDefault();
+ event.currentTarget.form?.requestSubmit();
+ }
+ }
+
+ return (
+
+
+
+
+
+
+ {messagesQuery.isLoading && (
+
+
+ Загружаем историю
+
+ )}
+
+ {messagesQuery.isError && (
+
+
История временно недоступна
+
messagesQuery.refetch()} type="button">
+ Повторить
+
+
+ )}
+
+ {!messagesQuery.isLoading && !messagesQuery.isError && messages.length === 0 && (
+
+
+
Сообщений пока нет. Начните разговор.
+
+ )}
+
+ {groups.map((group) => (
+
+
{group.label}
+ {group.messages.map((message) => {
+ const own = message.sender_id === currentUser.id;
+ return (
+
+
+ {own ? "Вы" : shortID(message.sender_id)}
+
+ {message.text}
+
+ {formatMessageTime(message.created_at)}
+ {own && }
+
+
+ );
+ })}
+
+ ))}
+
+
+
+
+
+
+ );
+}
diff --git a/frontend/src/components/CreateChatDialog.tsx b/frontend/src/components/CreateChatDialog.tsx
new file mode 100644
index 0000000..875084c
--- /dev/null
+++ b/frontend/src/components/CreateChatDialog.tsx
@@ -0,0 +1,148 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { Plus, UserRoundPlus, X } from "lucide-react";
+import { useEffect, useState, type FormEvent } from "react";
+import { useNavigate } from "react-router-dom";
+
+import { api, ApiError } from "../api/client";
+import type { Chat, User } from "../api/types";
+import { shortID } from "../lib/format";
+
+type CreateChatDialogProps = {
+ currentUser: User;
+ onClose: () => void;
+};
+
+const uuidPattern =
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
+
+export function CreateChatDialog({
+ currentUser,
+ onClose,
+}: CreateChatDialogProps) {
+ const navigate = useNavigate();
+ const queryClient = useQueryClient();
+ const [title, setTitle] = useState("");
+ const [memberInput, setMemberInput] = useState("");
+ const [validationError, setValidationError] = useState("");
+
+ useEffect(() => {
+ function closeOnEscape(event: KeyboardEvent) {
+ if (event.key === "Escape") {
+ onClose();
+ }
+ }
+ window.addEventListener("keydown", closeOnEscape);
+ return () => window.removeEventListener("keydown", closeOnEscape);
+ }, [onClose]);
+
+ const mutation = useMutation({
+ mutationFn: api.createChat,
+ onSuccess: (chat) => {
+ queryClient.setQueryData(["chats"], (current = []) => [
+ ...current,
+ chat,
+ ]);
+ onClose();
+ navigate(`/app/chats/${chat.id}`);
+ },
+ });
+
+ function submit(event: FormEvent) {
+ event.preventDefault();
+ setValidationError("");
+
+ const enteredIDs = memberInput
+ .split(/[\s,;]+/)
+ .map((value) => value.trim())
+ .filter(Boolean);
+ const memberIds = Array.from(new Set([currentUser.id, ...enteredIDs]));
+
+ if (!title.trim() || Array.from(title.trim()).length > 100) {
+ setValidationError("Название должно содержать от 1 до 100 символов");
+ return;
+ }
+ const invalidID = enteredIDs.find((id) => !uuidPattern.test(id));
+ if (invalidID) {
+ setValidationError(`Некорректный UUID: ${invalidID}`);
+ return;
+ }
+ mutation.mutate({ title: title.trim(), memberIds });
+ }
+
+ const serverError =
+ mutation.error instanceof ApiError
+ ? mutation.error.message
+ : mutation.error
+ ? "Не удалось создать чат"
+ : "";
+
+ return (
+
+
event.stopPropagation()}
+ role="dialog"
+ >
+
+
+
Новый разговор
+
Создать чат
+
+
+
+
+
+
+
+
+ Название
+
+
+
setTitle(event.target.value)}
+ placeholder="Например, Команда проекта"
+ required
+ value={title}
+ />
+
+
+
+
+ UUID участников
+
+
+ setMemberInput(event.target.value)}
+ placeholder="Вставьте UUID через пробел, запятую или с новой строки"
+ rows={4}
+ value={memberInput}
+ />
+
+
+ Ваш ID добавлен автоматически: {shortID(currentUser.id)}
+
+
+
+ {(validationError || serverError) && (
+
+ {validationError || serverError}
+
+ )}
+
+
+ {mutation.isPending ? "Создаём…" : "Создать чат"}
+
+
+
+
+ );
+}
diff --git a/frontend/src/components/EmptyChat.tsx b/frontend/src/components/EmptyChat.tsx
new file mode 100644
index 0000000..a2f3ee3
--- /dev/null
+++ b/frontend/src/components/EmptyChat.tsx
@@ -0,0 +1,29 @@
+import { MessageSquarePlus } from "lucide-react";
+
+type EmptyChatProps = {
+ hasChats: boolean;
+ onCreateChat: () => void;
+};
+
+export function EmptyChat({ hasChats, onCreateChat }: EmptyChatProps) {
+ return (
+
+
+
+
MTUCI Messenger
+
{hasChats ? "Выберите чат" : "Начните разговор"}
+
+ {hasChats
+ ? "История и новые сообщения появятся здесь."
+ : "Создайте первый чат и пригласите участников по UUID."}
+
+ {!hasChats && (
+
+
+ Создать чат
+
+ )}
+
+
+ );
+}
diff --git a/frontend/src/components/LoadingScreen.tsx b/frontend/src/components/LoadingScreen.tsx
new file mode 100644
index 0000000..63f0636
--- /dev/null
+++ b/frontend/src/components/LoadingScreen.tsx
@@ -0,0 +1,11 @@
+export function LoadingScreen() {
+ return (
+
+
+ M
+
+ Подключаемся к Messenger
+
+
+ );
+}
diff --git a/frontend/src/components/NavigationRail.tsx b/frontend/src/components/NavigationRail.tsx
new file mode 100644
index 0000000..5b0670f
--- /dev/null
+++ b/frontend/src/components/NavigationRail.tsx
@@ -0,0 +1,42 @@
+import { MessagesSquare, UserRound } from "lucide-react";
+import { Link } from "react-router-dom";
+
+import type { User } from "../api/types";
+import { Avatar } from "./Avatar";
+
+type NavigationRailProps = {
+ user: User;
+ profileOpen: boolean;
+};
+
+export function NavigationRail({ user, profileOpen }: NavigationRailProps) {
+ return (
+
+
+ M
+
+
+
+
+
+ Чаты
+
+
+
+ Профиль
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/frontend/src/components/ProfileDrawer.tsx b/frontend/src/components/ProfileDrawer.tsx
new file mode 100644
index 0000000..f1d25d5
--- /dev/null
+++ b/frontend/src/components/ProfileDrawer.tsx
@@ -0,0 +1,123 @@
+import {
+ CalendarDays,
+ Check,
+ Copy,
+ LogOut,
+ ShieldCheck,
+ UserRound,
+ X,
+} from "lucide-react";
+import { useState } from "react";
+import { useNavigate } from "react-router-dom";
+
+import type { User } from "../api/types";
+import { useAuth } from "../auth/AuthProvider";
+import { Avatar } from "./Avatar";
+
+type ProfileDrawerProps = {
+ user: User;
+};
+
+const createdAtFormatter = new Intl.DateTimeFormat("ru-RU", {
+ day: "numeric",
+ month: "long",
+ year: "numeric",
+});
+
+export function ProfileDrawer({ user }: ProfileDrawerProps) {
+ const { logout } = useAuth();
+ const navigate = useNavigate();
+ const [copied, setCopied] = useState(false);
+ const [error, setError] = useState("");
+ const [isLoggingOut, setIsLoggingOut] = useState(false);
+
+ async function copyID() {
+ await navigator.clipboard.writeText(user.id);
+ setCopied(true);
+ window.setTimeout(() => setCopied(false), 1800);
+ }
+
+ async function submitLogout() {
+ setError("");
+ setIsLoggingOut(true);
+ try {
+ await logout();
+ navigate("/login", { replace: true });
+ } catch {
+ setError("Не удалось завершить сессию. Попробуйте ещё раз.");
+ setIsLoggingOut(false);
+ }
+ }
+
+ return (
+ <>
+ navigate("/app")}
+ type="button"
+ />
+
+
+ Ваш аккаунт
+ navigate("/app")}
+ type="button"
+ >
+
+
+
+
+
+
+
{user.display_name}
+
@{user.username}
+
+
+ серверная сессия
+
+
+
+
+
+
ID аккаунта
+
+ {user.id}
+
+ {copied ? : }
+
+
+
+
+
Дата регистрации
+ {createdAtFormatter.format(new Date(user.created_at))}
+
+
+
+
+
Следующие версии
+
Аватар, редактирование имени и смена пароля появятся после API-контрактов.
+
+
+ {error && {error}
}
+
+
+
+ {isLoggingOut ? "Завершаем…" : "Выйти из аккаунта"}
+
+
+ >
+ );
+}
diff --git a/frontend/src/lib/format.ts b/frontend/src/lib/format.ts
new file mode 100644
index 0000000..cfe4ff3
--- /dev/null
+++ b/frontend/src/lib/format.ts
@@ -0,0 +1,58 @@
+const timeFormatter = new Intl.DateTimeFormat("ru-RU", {
+ hour: "2-digit",
+ minute: "2-digit",
+});
+
+const dayFormatter = new Intl.DateTimeFormat("ru-RU", {
+ day: "numeric",
+ month: "long",
+});
+
+const fullDateFormatter = new Intl.DateTimeFormat("ru-RU", {
+ day: "numeric",
+ month: "long",
+ year: "numeric",
+});
+
+export function formatMessageTime(value: string): string {
+ return timeFormatter.format(new Date(value));
+}
+
+export function formatDay(value: string): string {
+ const date = new Date(value);
+ const now = new Date();
+ const sameYear = date.getFullYear() === now.getFullYear();
+ return (sameYear ? dayFormatter : fullDateFormatter).format(date);
+}
+
+export function dayKey(value: string): string {
+ const date = new Date(value);
+ return [date.getFullYear(), date.getMonth(), date.getDate()].join("-");
+}
+
+export function formatMemberCount(count: number): string {
+ const mod10 = count % 10;
+ const mod100 = count % 100;
+ if (mod10 === 1 && mod100 !== 11) {
+ return `${count} участник`;
+ }
+ if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) {
+ return `${count} участника`;
+ }
+ return `${count} участников`;
+}
+
+export function shortID(id: string): string {
+ return id.length > 12 ? `${id.slice(0, 8)}…` : id;
+}
+
+export function initials(value: string): string {
+ const parts = value.trim().split(/\s+/).filter(Boolean);
+ if (parts.length === 0) {
+ return "?";
+ }
+ return parts
+ .slice(0, 2)
+ .map((part) => Array.from(part)[0]?.toUpperCase() ?? "")
+ .join("");
+}
diff --git a/frontend/src/lib/idempotency.test.ts b/frontend/src/lib/idempotency.test.ts
new file mode 100644
index 0000000..de97fcc
--- /dev/null
+++ b/frontend/src/lib/idempotency.test.ts
@@ -0,0 +1,19 @@
+import { describe, expect, it, vi } from "vitest";
+
+import { createIdempotencyKey } from "./idempotency";
+
+describe("createIdempotencyKey", () => {
+ it("creates an API-compatible unique key", () => {
+ vi.stubGlobal("crypto", {
+ randomUUID: () => "12345678-1234-1234-1234-123456789abc",
+ });
+
+ const key = createIdempotencyKey();
+
+ expect(key).toMatch(/^[A-Za-z0-9._:-]{1,128}$/);
+ expect(key).toContain("12345678123412341234123456789abc");
+ expect(key.length).toBeLessThanOrEqual(128);
+
+ vi.unstubAllGlobals();
+ });
+});
diff --git a/frontend/src/lib/idempotency.ts b/frontend/src/lib/idempotency.ts
new file mode 100644
index 0000000..123e107
--- /dev/null
+++ b/frontend/src/lib/idempotency.ts
@@ -0,0 +1,4 @@
+export function createIdempotencyKey(): string {
+ const random = crypto.randomUUID().replaceAll("-", "");
+ return `web-${Date.now().toString(36)}-${random}`;
+}
diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx
new file mode 100644
index 0000000..0e9fe8b
--- /dev/null
+++ b/frontend/src/main.tsx
@@ -0,0 +1,32 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { StrictMode } from "react";
+import { createRoot } from "react-dom/client";
+import { BrowserRouter } from "react-router-dom";
+
+import { App } from "./app/App";
+import { AuthProvider } from "./auth/AuthProvider";
+import "./styles.css";
+
+const queryClient = new QueryClient({
+ defaultOptions: {
+ queries: {
+ retry: 1,
+ refetchOnWindowFocus: true,
+ },
+ mutations: {
+ retry: false,
+ },
+ },
+});
+
+createRoot(document.getElementById("root")!).render(
+
+
+
+
+
+
+
+
+ ,
+);
diff --git a/frontend/src/pages/AuthPage.tsx b/frontend/src/pages/AuthPage.tsx
new file mode 100644
index 0000000..01d81ff
--- /dev/null
+++ b/frontend/src/pages/AuthPage.tsx
@@ -0,0 +1,190 @@
+import {
+ ArrowRight,
+ Eye,
+ EyeOff,
+ LockKeyhole,
+ MessageCircleMore,
+ UserRound,
+} from "lucide-react";
+import { useState, type FormEvent } from "react";
+import { Link, useNavigate } from "react-router-dom";
+
+import { ApiError } from "../api/client";
+import { useAuth } from "../auth/AuthProvider";
+
+type AuthMode = "login" | "register";
+
+type AuthPageProps = {
+ initialMode: AuthMode;
+};
+
+function errorMessage(error: unknown): string {
+ if (error instanceof ApiError) {
+ if (error.status === 401) {
+ return "Неверный логин или пароль";
+ }
+ if (error.status === 409) {
+ return "Такой username уже занят";
+ }
+ return error.message;
+ }
+ return "Не удалось связаться с сервером. Попробуйте ещё раз.";
+}
+
+export function AuthPage({ initialMode }: AuthPageProps) {
+ const { login, register } = useAuth();
+ const navigate = useNavigate();
+ const [username, setUsername] = useState("");
+ const [displayName, setDisplayName] = useState("");
+ const [password, setPassword] = useState("");
+ const [showPassword, setShowPassword] = useState(false);
+ const [error, setError] = useState("");
+ const [isSubmitting, setIsSubmitting] = useState(false);
+
+ const isRegister = initialMode === "register";
+
+ async function submit(event: FormEvent) {
+ event.preventDefault();
+ setError("");
+
+ if (!/^[a-z0-9_]{3,32}$/.test(username)) {
+ setError("Username: 3–32 символа, только a–z, цифры и _");
+ return;
+ }
+ if (isRegister && displayName.trim().length === 0) {
+ setError("Укажите отображаемое имя");
+ return;
+ }
+ if (password.length < 12 || Array.from(password).length > 128) {
+ setError("Пароль должен содержать от 12 до 128 символов");
+ return;
+ }
+
+ setIsSubmitting(true);
+ try {
+ if (isRegister) {
+ await register({ username, displayName: displayName.trim(), password });
+ } else {
+ await login({ username, password });
+ }
+ navigate("/app", { replace: true });
+ } catch (submitError) {
+ setError(errorMessage(submitError));
+ } finally {
+ setIsSubmitting(false);
+ }
+ }
+
+ return (
+
+
+
+
+ M
+
+
MTUCI Messenger
+
+
+
+
Распределённый мессенджер
+
Разговоры, которые остаются с вами.
+
+ Минималистичный клиент поверх отказоустойчивого Go API. Одна сессия,
+ несколько реплик, никаких лишних отвлечений.
+
+
+
+ защищённая серверная сессия
+
+
+
+
+
+
+
+
{isRegister ? "Новый аккаунт" : "С возвращением"}
+
{isRegister ? "Создать профиль" : "Войти в Messenger"}
+
+ {isRegister
+ ? "Данные профиля можно будет расширить в следующих версиях."
+ : "Продолжите общение с того места, где остановились."}
+
+
+
+ {isRegister && (
+
+ Отображаемое имя
+
+
+ setDisplayName(event.target.value)}
+ placeholder="Как к вам обращаться"
+ required
+ value={displayName}
+ />
+
+
+ )}
+
+
+ Username
+
+
+ setUsername(event.target.value.toLowerCase())}
+ placeholder="username"
+ required
+ value={username}
+ />
+
+
+
+
+ Пароль
+
+
+ setPassword(event.target.value)}
+ placeholder="Минимум 12 символов"
+ required
+ type={showPassword ? "text" : "password"}
+ value={password}
+ />
+ setShowPassword((value) => !value)}
+ type="button"
+ >
+ {showPassword ? : }
+
+
+
+
+ {error && {error}
}
+
+
+ {isSubmitting ? "Подождите…" : isRegister ? "Создать аккаунт" : "Войти"}
+ {!isSubmitting && }
+
+
+
+
+ {isRegister ? "Уже есть аккаунт?" : "Впервые здесь?"}{" "}
+
+ {isRegister ? "Войти" : "Создать профиль"}
+
+
+
+
+
+ );
+}
diff --git a/frontend/src/pages/MessengerPage.tsx b/frontend/src/pages/MessengerPage.tsx
new file mode 100644
index 0000000..ba3b993
--- /dev/null
+++ b/frontend/src/pages/MessengerPage.tsx
@@ -0,0 +1,81 @@
+import { useQuery } from "@tanstack/react-query";
+import { useState } from "react";
+import { useNavigate, useParams } from "react-router-dom";
+
+import { api } from "../api/client";
+import { useAuth } from "../auth/AuthProvider";
+import { ChatList } from "../components/ChatList";
+import { ChatView } from "../components/ChatView";
+import { CreateChatDialog } from "../components/CreateChatDialog";
+import { EmptyChat } from "../components/EmptyChat";
+import { NavigationRail } from "../components/NavigationRail";
+import { ProfileDrawer } from "../components/ProfileDrawer";
+
+type MessengerPageProps = {
+ profileOpen?: boolean;
+};
+
+export function MessengerPage({ profileOpen = false }: MessengerPageProps) {
+ const { user } = useAuth();
+ const { chatId } = useParams();
+ const navigate = useNavigate();
+ const [createChatOpen, setCreateChatOpen] = useState(false);
+
+ const chatsQuery = useQuery({
+ queryKey: ["chats"],
+ queryFn: api.chats,
+ refetchInterval: 10_000,
+ staleTime: 5_000,
+ });
+
+ if (!user) {
+ return null;
+ }
+
+ const chats = chatsQuery.data ?? [];
+ const selectedChat = chatId
+ ? chats.find((chat) => chat.id === chatId)
+ : undefined;
+
+ return (
+
+
+
+ setCreateChatOpen(true)}
+ selectedChatID={chatId}
+ />
+
+ {selectedChat ? (
+ navigate("/app")}
+ />
+ ) : (
+ 0}
+ onCreateChat={() => setCreateChatOpen(true)}
+ />
+ )}
+
+ {profileOpen && }
+ {createChatOpen && (
+ setCreateChatOpen(false)}
+ />
+ )}
+
+ );
+}
diff --git a/frontend/src/styles.css b/frontend/src/styles.css
new file mode 100644
index 0000000..c15aa72
--- /dev/null
+++ b/frontend/src/styles.css
@@ -0,0 +1,1793 @@
+:root {
+ color-scheme: dark;
+ --font-sans: Inter, "Segoe UI Variable Text", "Segoe UI", Roboto, Helvetica,
+ Arial, sans-serif;
+ --font-display: ui-rounded, "Segoe UI Variable Display", "Segoe UI", sans-serif;
+ font-family: var(--font-sans);
+ color: #f4f5f6;
+ background: #08090b;
+ font-synthesis: none;
+ text-rendering: optimizeLegibility;
+
+ --ink: #f4f5f6;
+ --muted: #a2a5aa;
+ --quiet: #71757c;
+ --line: rgba(255, 255, 255, 0.09);
+ --line-strong: rgba(255, 255, 255, 0.17);
+ --surface-0: #08090b;
+ --surface-1: #0e1013;
+ --surface-2: #15171b;
+ --surface-3: #1d2025;
+ --accent: #cfd2d6;
+ --accent-bright: #f4f5f6;
+ --danger: #c8cbd0;
+ --success: #d8dade;
+ --shadow: 0 24px 72px rgba(0, 0, 0, 0.42);
+ --radius-xs: 8px;
+ --radius-sm: 12px;
+ --radius-md: 16px;
+ --radius-lg: 24px;
+ --radius-pill: 999px;
+}
+
+* {
+ box-sizing: border-box;
+}
+
+html,
+body,
+#root {
+ width: 100%;
+ height: 100%;
+ margin: 0;
+}
+
+body {
+ min-width: 320px;
+ overflow: hidden;
+}
+
+button,
+input,
+textarea {
+ font: inherit;
+}
+
+button,
+a {
+ -webkit-tap-highlight-color: transparent;
+}
+
+button {
+ color: inherit;
+}
+
+a {
+ color: inherit;
+}
+
+::selection {
+ color: #0c0d0b;
+ background: var(--accent-bright);
+}
+
+:focus-visible {
+ outline: 2px solid var(--accent-bright);
+ outline-offset: 2px;
+}
+
+.eyebrow {
+ margin: 0;
+ color: var(--accent-bright);
+ font-size: 0.7rem;
+ font-weight: 750;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+}
+
+.brand-mark,
+.rail-brand {
+ display: grid;
+ place-items: center;
+ width: 42px;
+ height: 42px;
+ border: 1px solid rgba(255, 255, 255, 0.5);
+ color: var(--accent-bright);
+ background: rgba(13, 14, 12, 0.78);
+ font-family: var(--font-display);
+ font-size: 1.35rem;
+ font-weight: 700;
+ text-decoration: none;
+ transform: rotate(-4deg);
+}
+
+.brand-mark--large {
+ width: 58px;
+ height: 58px;
+ font-size: 1.75rem;
+}
+
+.status-dot,
+.presence-dot {
+ display: inline-block;
+ width: 7px;
+ height: 7px;
+ border-radius: 50%;
+ background: var(--success);
+ box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.09);
+}
+
+.loading-screen {
+ display: grid;
+ place-items: center;
+ align-content: center;
+ min-height: 100%;
+ gap: 16px;
+ color: var(--muted);
+ background:
+ linear-gradient(rgba(10, 11, 9, 0.82), rgba(10, 11, 9, 0.94)),
+ url("./assets/chat-background.jpg") center / cover;
+}
+
+.loading-screen p {
+ margin: 0;
+ font-size: 0.85rem;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+}
+
+.loading-line {
+ position: relative;
+ display: block;
+ width: 84px;
+ height: 2px;
+ overflow: hidden;
+ background: rgba(255, 255, 255, 0.08);
+}
+
+.loading-line::after {
+ position: absolute;
+ inset: 0;
+ width: 42%;
+ content: "";
+ background: var(--accent-bright);
+ animation: loading 1.2s ease-in-out infinite;
+}
+
+@keyframes loading {
+ from { transform: translateX(-120%); }
+ to { transform: translateX(280%); }
+}
+
+.auth-page {
+ display: grid;
+ min-height: 100%;
+ grid-template-columns: minmax(0, 1.2fr) minmax(420px, 0.8fr);
+ background: var(--surface-0);
+}
+
+.auth-story {
+ position: relative;
+ display: flex;
+ min-height: 100%;
+ flex-direction: column;
+ justify-content: space-between;
+ padding: clamp(28px, 4vw, 64px);
+ overflow: hidden;
+ isolation: isolate;
+ background:
+ linear-gradient(115deg, rgba(7, 8, 7, 0.94), rgba(7, 8, 7, 0.35)),
+ url("./assets/chat-background.jpg") center / cover;
+}
+
+.auth-story::after {
+ position: absolute;
+ z-index: -1;
+ right: -12%;
+ bottom: -20%;
+ width: 58%;
+ aspect-ratio: 1;
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ border-radius: 50%;
+ content: "";
+}
+
+.auth-brand {
+ display: flex;
+ align-items: center;
+ gap: 14px;
+ font-size: 0.8rem;
+ font-weight: 700;
+ letter-spacing: 0.12em;
+ text-transform: uppercase;
+}
+
+.auth-copy {
+ max-width: 690px;
+ margin-bottom: 5vh;
+}
+
+.auth-copy h1 {
+ max-width: 650px;
+ margin: 18px 0 22px;
+ font-family: var(--font-display);
+ font-size: clamp(3rem, 6vw, 6.6rem);
+ font-weight: 400;
+ line-height: 0.94;
+ letter-spacing: -0.055em;
+}
+
+.auth-copy > p:not(.eyebrow) {
+ max-width: 530px;
+ margin: 0;
+ color: #c5c2b7;
+ font-size: clamp(1rem, 1.4vw, 1.15rem);
+ line-height: 1.7;
+}
+
+.auth-status {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ margin-top: 34px;
+ color: var(--muted);
+ font-size: 0.78rem;
+ letter-spacing: 0.05em;
+}
+
+.auth-panel {
+ display: grid;
+ place-items: center;
+ padding: clamp(24px, 5vw, 80px);
+ border-left: 1px solid var(--line);
+ background: rgba(17, 18, 15, 0.98);
+}
+
+.auth-card {
+ width: min(100%, 420px);
+}
+
+.auth-card__icon {
+ width: 30px;
+ height: 30px;
+ margin-bottom: 28px;
+ color: var(--accent-bright);
+}
+
+.auth-card h2 {
+ margin: 10px 0 10px;
+ font-family: var(--font-display);
+ font-size: clamp(2rem, 4vw, 3.25rem);
+ font-weight: 400;
+ line-height: 1.05;
+}
+
+.auth-card__lead {
+ margin: 0 0 32px;
+ color: var(--muted);
+ line-height: 1.55;
+}
+
+.auth-form,
+.dialog-form {
+ display: grid;
+ gap: 20px;
+}
+
+.auth-form label,
+.dialog-form label {
+ display: grid;
+ gap: 8px;
+ color: #c9c6bb;
+ font-size: 0.78rem;
+ font-weight: 650;
+}
+
+.input-shell,
+.textarea-shell {
+ display: flex;
+ align-items: center;
+ min-height: 52px;
+ gap: 12px;
+ padding: 0 14px;
+ border: 1px solid var(--line);
+ background: var(--surface-2);
+ transition:
+ border-color 160ms ease,
+ background 160ms ease;
+}
+
+.textarea-shell {
+ align-items: flex-start;
+ padding-top: 14px;
+}
+
+.input-shell:focus-within,
+.textarea-shell:focus-within {
+ border-color: rgba(255, 255, 255, 0.65);
+ background: #1c1d17;
+}
+
+.input-shell > svg,
+.textarea-shell > svg {
+ width: 18px;
+ height: 18px;
+ flex: 0 0 auto;
+ color: var(--quiet);
+}
+
+.input-shell input,
+.textarea-shell textarea {
+ width: 100%;
+ min-width: 0;
+ border: 0;
+ outline: 0;
+ color: var(--ink);
+ background: transparent;
+}
+
+.textarea-shell textarea {
+ resize: vertical;
+ line-height: 1.5;
+}
+
+.input-shell input::placeholder,
+.textarea-shell textarea::placeholder {
+ color: #66665e;
+}
+
+.icon-button,
+.soft-icon-button,
+.copy-button,
+.mobile-back-button {
+ display: inline-grid;
+ place-items: center;
+ border: 0;
+ cursor: pointer;
+ background: transparent;
+}
+
+.icon-button {
+ padding: 5px;
+ color: var(--quiet);
+}
+
+.icon-button svg,
+.soft-icon-button svg,
+.copy-button svg,
+.mobile-back-button svg {
+ width: 19px;
+ height: 19px;
+}
+
+.soft-icon-button {
+ width: 40px;
+ height: 40px;
+ border: 1px solid var(--line);
+ color: #bbb8aa;
+ background: rgba(255, 255, 255, 0.025);
+ transition: 160ms ease;
+}
+
+.soft-icon-button:hover {
+ border-color: rgba(255, 255, 255, 0.45);
+ color: var(--accent-bright);
+ background: rgba(255, 255, 255, 0.07);
+}
+
+.primary-button {
+ display: inline-flex;
+ min-height: 50px;
+ align-items: center;
+ justify-content: center;
+ gap: 10px;
+ padding: 0 20px;
+ border: 1px solid var(--accent-bright);
+ cursor: pointer;
+ color: #11120f;
+ background: var(--accent-bright);
+ font-size: 0.83rem;
+ font-weight: 750;
+ letter-spacing: 0.03em;
+ transition:
+ background 160ms ease,
+ transform 160ms ease;
+}
+
+.primary-button:hover:not(:disabled) {
+ background: #d1b77d;
+ transform: translateY(-1px);
+}
+
+.primary-button:disabled {
+ cursor: not-allowed;
+ opacity: 0.55;
+}
+
+.primary-button svg {
+ width: 18px;
+ height: 18px;
+}
+
+.form-error {
+ padding: 11px 13px;
+ border-left: 2px solid var(--danger);
+ color: #e2b0a9;
+ background: rgba(255, 255, 255, 0.08);
+ font-size: 0.8rem;
+ line-height: 1.45;
+}
+
+.auth-switch {
+ margin: 28px 0 0;
+ color: var(--muted);
+ font-size: 0.83rem;
+ text-align: center;
+}
+
+.auth-switch a,
+.text-button {
+ color: var(--accent-bright);
+ text-decoration: none;
+}
+
+.auth-switch a:hover {
+ text-decoration: underline;
+}
+
+.messenger-shell {
+ display: grid;
+ width: 100%;
+ height: 100dvh;
+ overflow: hidden;
+ grid-template-columns: 76px 340px minmax(0, 1fr);
+ grid-template-areas: "rail sidebar conversation";
+ background: var(--surface-0);
+}
+
+.navigation-rail {
+ z-index: 20;
+ display: flex;
+ grid-area: rail;
+ flex-direction: column;
+ align-items: center;
+ padding: 20px 10px 18px;
+ border-right: 1px solid var(--line);
+ background: #0c0d0b;
+}
+
+.rail-actions {
+ display: grid;
+ width: 100%;
+ gap: 8px;
+ margin-top: 44px;
+}
+
+.rail-action {
+ position: relative;
+ display: grid;
+ min-height: 58px;
+ place-items: center;
+ gap: 4px;
+ padding: 8px 4px;
+ border: 1px solid transparent;
+ color: var(--quiet);
+ font-size: 0.61rem;
+ text-decoration: none;
+ transition: 160ms ease;
+}
+
+.rail-action svg {
+ width: 21px;
+ height: 21px;
+}
+
+.rail-action:hover,
+.rail-action--active {
+ color: var(--accent-bright);
+ background: rgba(255, 255, 255, 0.065);
+}
+
+.rail-action--active::before {
+ position: absolute;
+ left: -11px;
+ width: 2px;
+ height: 26px;
+ content: "";
+ background: var(--accent-bright);
+}
+
+.rail-profile {
+ position: relative;
+ margin-top: auto;
+ text-decoration: none;
+}
+
+.rail-profile .presence-dot {
+ position: absolute;
+ right: -1px;
+ bottom: 1px;
+ width: 6px;
+ height: 6px;
+ outline: 3px solid #0c0d0b;
+}
+
+.avatar {
+ display: inline-grid;
+ flex: 0 0 auto;
+ place-items: center;
+ overflow: hidden;
+ border: 1px solid rgba(255, 255, 255, 0.09);
+ border-radius: 50%;
+ color: #f5f1e8;
+ font-family: var(--font-display);
+ font-weight: 700;
+ letter-spacing: -0.03em;
+}
+
+.avatar--small { width: 38px; height: 38px; font-size: 0.76rem; }
+.avatar--medium { width: 48px; height: 48px; font-size: 0.92rem; }
+.avatar--large { width: 92px; height: 92px; font-size: 1.7rem; }
+.avatar--tone-0 { background: linear-gradient(145deg, #4a483c, #25251f); }
+.avatar--tone-1 { background: linear-gradient(145deg, #625841, #28251e); }
+.avatar--tone-2 { background: linear-gradient(145deg, #3f5049, #202724); }
+.avatar--tone-3 { background: linear-gradient(145deg, #5b4744, #28201f); }
+.avatar--tone-4 { background: linear-gradient(145deg, #49445b, #22202b); }
+
+.chat-sidebar {
+ z-index: 5;
+ display: grid;
+ min-width: 0;
+ grid-area: sidebar;
+ grid-template-rows: auto auto minmax(0, 1fr) auto;
+ border-right: 1px solid var(--line);
+ background: rgba(20, 21, 17, 0.99);
+}
+
+.chat-sidebar__header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 27px 22px 18px;
+}
+
+.chat-sidebar__header h1 {
+ margin: 4px 0 0;
+ font-family: var(--font-display);
+ font-size: 1.9rem;
+ font-weight: 400;
+}
+
+.search-box {
+ display: flex;
+ align-items: center;
+ min-height: 44px;
+ gap: 10px;
+ margin: 0 14px 12px;
+ padding: 0 13px;
+ border: 1px solid transparent;
+ background: var(--surface-2);
+}
+
+.search-box:focus-within {
+ border-color: rgba(255, 255, 255, 0.36);
+}
+
+.search-box > svg {
+ width: 17px;
+ color: var(--quiet);
+}
+
+.search-box input {
+ width: 100%;
+ min-width: 0;
+ border: 0;
+ outline: 0;
+ color: var(--ink);
+ background: transparent;
+ font-size: 0.82rem;
+}
+
+.search-box button {
+ display: grid;
+ padding: 2px;
+ border: 0;
+ cursor: pointer;
+ color: var(--quiet);
+ background: transparent;
+}
+
+.search-box button svg {
+ width: 15px;
+ height: 15px;
+}
+
+.chat-list {
+ min-height: 0;
+ padding: 0 8px 12px;
+ overflow: auto;
+ scrollbar-color: #3b3a31 transparent;
+ scrollbar-width: thin;
+}
+
+.chat-row {
+ position: relative;
+ display: flex;
+ width: 100%;
+ min-height: 68px;
+ align-items: center;
+ gap: 12px;
+ padding: 9px 10px;
+ border: 1px solid transparent;
+ cursor: pointer;
+ text-align: left;
+ background: transparent;
+ transition: 140ms ease;
+}
+
+.chat-row:hover {
+ background: rgba(255, 255, 255, 0.025);
+}
+
+.chat-row--active {
+ border-color: rgba(255, 255, 255, 0.15);
+ background: rgba(255, 255, 255, 0.12);
+}
+
+.chat-row--active::before {
+ position: absolute;
+ left: -9px;
+ width: 2px;
+ height: 34px;
+ content: "";
+ background: var(--accent-bright);
+}
+
+.chat-row__body {
+ display: grid;
+ min-width: 0;
+ flex: 1;
+ gap: 5px;
+}
+
+.chat-row__body strong,
+.chat-row__body small {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.chat-row__body strong {
+ color: #e7e4db;
+ font-size: 0.86rem;
+}
+
+.chat-row__body small {
+ color: var(--quiet);
+ font-size: 0.72rem;
+}
+
+.chat-row__status {
+ color: var(--accent-bright);
+ font-size: 1.2rem;
+}
+
+.sidebar-state {
+ display: grid;
+ place-items: center;
+ gap: 12px;
+ padding: 58px 24px;
+ color: var(--quiet);
+ font-size: 0.8rem;
+ text-align: center;
+}
+
+.sidebar-state svg {
+ width: 26px;
+ height: 26px;
+}
+
+.sidebar-state p {
+ margin: 0;
+}
+
+.sidebar-state--error {
+ color: #d79a92;
+}
+
+.text-button {
+ border: 0;
+ cursor: pointer;
+ background: transparent;
+}
+
+.sidebar-footer {
+ display: flex;
+ min-height: 44px;
+ align-items: center;
+ gap: 9px;
+ padding: 0 20px;
+ border-top: 1px solid var(--line);
+ color: var(--quiet);
+ font-size: 0.67rem;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+}
+
+.conversation {
+ position: relative;
+ display: grid;
+ min-width: 0;
+ min-height: 0;
+ grid-area: conversation;
+ grid-template-rows: 68px minmax(0, 1fr) auto;
+ overflow: hidden;
+ background: var(--surface-0);
+}
+
+.conversation-header {
+ z-index: 4;
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ padding: 0 24px;
+ border-bottom: 1px solid var(--line);
+ background: rgba(15, 16, 13, 0.96);
+ backdrop-filter: blur(18px);
+}
+
+.conversation-header__title {
+ display: grid;
+ min-width: 0;
+ gap: 3px;
+}
+
+.conversation-header__title strong {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-size: 0.9rem;
+}
+
+.conversation-header__title span,
+.conversation-header__security {
+ color: var(--quiet);
+ font-size: 0.7rem;
+}
+
+.conversation-header__security {
+ display: flex;
+ align-items: center;
+ gap: 7px;
+ margin-left: auto;
+}
+
+.conversation-header__security svg {
+ width: 16px;
+ height: 16px;
+ color: var(--success);
+}
+
+.mobile-back-button {
+ display: none;
+ padding: 7px;
+ color: var(--muted);
+}
+
+.message-canvas,
+.conversation--empty {
+ position: relative;
+ min-height: 0;
+ overflow: hidden;
+ background:
+ linear-gradient(rgba(8, 9, 8, 0.49), rgba(8, 9, 8, 0.68)),
+ url("./assets/chat-background.jpg") center / cover;
+}
+
+.message-canvas__shade {
+ position: absolute;
+ inset: 0;
+ pointer-events: none;
+ background:
+ linear-gradient(90deg, rgba(4, 5, 4, 0.16), transparent 45%, rgba(4, 5, 4, 0.16)),
+ radial-gradient(circle at 50% 40%, transparent 0 25%, rgba(5, 6, 5, 0.2) 75%);
+}
+
+.message-stream {
+ position: relative;
+ z-index: 1;
+ height: 100%;
+ padding: 24px clamp(20px, 8vw, 120px) 34px;
+ overflow-y: auto;
+ scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
+ scrollbar-width: thin;
+}
+
+.message-day {
+ display: flex;
+ flex-direction: column;
+}
+
+.date-divider {
+ position: sticky;
+ z-index: 2;
+ top: 0;
+ align-self: center;
+ margin: 8px 0 18px;
+}
+
+.date-divider span {
+ display: inline-flex;
+ padding: 6px 12px;
+ border: 1px solid rgba(255, 255, 255, 0.075);
+ border-radius: 999px;
+ color: #c5c1b4;
+ background: rgba(16, 17, 14, 0.83);
+ box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
+ backdrop-filter: blur(10px);
+ font-size: 0.69rem;
+}
+
+.message-bubble {
+ position: relative;
+ display: grid;
+ width: fit-content;
+ max-width: min(72%, 720px);
+ align-self: flex-start;
+ gap: 5px;
+ margin: 3px 0;
+ padding: 10px 13px 7px;
+ border: 1px solid rgba(255, 255, 255, 0.075);
+ border-radius: 4px 16px 16px 16px;
+ background: rgba(24, 25, 20, 0.95);
+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
+}
+
+.message-bubble--own {
+ align-self: flex-end;
+ border-color: rgba(255, 255, 255, 0.19);
+ border-radius: 16px 4px 16px 16px;
+ background: rgba(92, 78, 50, 0.96);
+}
+
+.message-bubble__sender {
+ color: var(--accent-bright);
+ font-size: 0.7rem;
+ font-weight: 700;
+}
+
+.message-bubble--own .message-bubble__sender {
+ color: #e1c993;
+}
+
+.message-bubble p {
+ margin: 0;
+ color: #f1eee6;
+ font-size: 0.9rem;
+ line-height: 1.45;
+ overflow-wrap: anywhere;
+ white-space: pre-wrap;
+}
+
+.message-bubble__meta {
+ display: inline-flex;
+ align-items: center;
+ justify-content: flex-end;
+ gap: 5px;
+ margin-left: 24px;
+ color: rgba(235, 231, 220, 0.55);
+ font-size: 0.62rem;
+}
+
+.message-bubble__meta svg {
+ width: 14px;
+ height: 14px;
+ color: #dbc284;
+}
+
+.floating-state {
+ display: grid;
+ width: fit-content;
+ max-width: 340px;
+ place-items: center;
+ gap: 12px;
+ margin: 20vh auto 30px;
+ padding: 15px 18px;
+ border: 1px solid var(--line);
+ color: #c0bdb2;
+ background: rgba(14, 15, 12, 0.86);
+ box-shadow: var(--shadow);
+ backdrop-filter: blur(12px);
+ font-size: 0.78rem;
+ text-align: center;
+}
+
+.floating-state p {
+ margin: 0;
+}
+
+.floating-state svg {
+ width: 24px;
+ color: var(--accent-bright);
+}
+
+.floating-state button,
+.send-error button {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ border: 0;
+ cursor: pointer;
+ color: var(--accent-bright);
+ background: transparent;
+ font-size: 0.75rem;
+}
+
+.floating-state button svg {
+ width: 15px;
+ height: 15px;
+}
+
+.floating-state--error {
+ color: #d9aaa3;
+}
+
+.composer {
+ z-index: 4;
+ padding: 11px clamp(16px, 5vw, 72px) 13px;
+ border-top: 1px solid var(--line);
+ background: rgba(14, 15, 12, 0.97);
+}
+
+.composer form {
+ display: flex;
+ min-height: 48px;
+ align-items: flex-end;
+ gap: 10px;
+ padding: 6px 7px 6px 16px;
+ border: 1px solid var(--line);
+ background: var(--surface-2);
+}
+
+.composer textarea {
+ width: 100%;
+ max-height: 130px;
+ min-height: 30px;
+ padding: 7px 0 3px;
+ resize: none;
+ border: 0;
+ outline: 0;
+ color: var(--ink);
+ background: transparent;
+ line-height: 1.45;
+}
+
+.composer textarea::placeholder {
+ color: #68685f;
+}
+
+.composer__counter {
+ align-self: center;
+ color: var(--quiet);
+ font-size: 0.62rem;
+}
+
+.send-button {
+ display: grid;
+ width: 38px;
+ height: 38px;
+ flex: 0 0 auto;
+ place-items: center;
+ border: 0;
+ cursor: pointer;
+ color: #11120f;
+ background: var(--accent-bright);
+}
+
+.send-button:disabled {
+ cursor: not-allowed;
+ color: var(--quiet);
+ background: #292a23;
+}
+
+.send-button svg {
+ width: 17px;
+ height: 17px;
+}
+
+.send-error {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ padding: 0 8px 9px;
+ color: #d9aaa3;
+ font-size: 0.72rem;
+}
+
+.conversation--empty {
+ display: grid;
+ grid-area: conversation;
+ place-items: center;
+ padding: 28px;
+}
+
+.empty-chat-card {
+ display: grid;
+ width: min(100%, 410px);
+ place-items: center;
+ padding: 34px;
+ border: 1px solid rgba(255, 255, 255, 0.09);
+ background: rgba(13, 14, 12, 0.85);
+ box-shadow: var(--shadow);
+ backdrop-filter: blur(16px);
+ text-align: center;
+}
+
+.empty-chat-card__line {
+ width: 42px;
+ height: 2px;
+ margin-bottom: 25px;
+ background: var(--accent-bright);
+}
+
+.empty-chat-card h2 {
+ margin: 8px 0 12px;
+ font-family: var(--font-display);
+ font-size: 2.2rem;
+ font-weight: 400;
+}
+
+.empty-chat-card > p:not(.eyebrow) {
+ margin: 0 0 24px;
+ color: var(--muted);
+ line-height: 1.55;
+}
+
+.dialog-backdrop,
+.drawer-backdrop {
+ position: fixed;
+ z-index: 90;
+ inset: 0;
+ border: 0;
+ background: rgba(5, 6, 5, 0.73);
+ backdrop-filter: blur(5px);
+}
+
+.dialog-backdrop {
+ display: grid;
+ place-items: center;
+ padding: 20px;
+}
+
+.dialog-card {
+ width: min(100%, 520px);
+ padding: 26px;
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ background: #151611;
+ box-shadow: var(--shadow);
+}
+
+.dialog-card__header {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ margin-bottom: 28px;
+}
+
+.dialog-card h2 {
+ margin: 6px 0 0;
+ font-family: var(--font-display);
+ font-size: 2rem;
+ font-weight: 400;
+}
+
+.dialog-form label small {
+ color: var(--quiet);
+ font-weight: 400;
+ line-height: 1.4;
+}
+
+.dialog-form code {
+ color: var(--accent-bright);
+}
+
+.profile-drawer {
+ position: fixed;
+ z-index: 100;
+ top: 0;
+ left: 76px;
+ display: flex;
+ width: min(390px, calc(100vw - 76px));
+ height: 100dvh;
+ flex-direction: column;
+ padding: 24px;
+ border-right: 1px solid rgba(255, 255, 255, 0.16);
+ background: #141510;
+ box-shadow: 28px 0 80px rgba(0, 0, 0, 0.38);
+ animation: drawer-in 180ms ease-out;
+}
+
+@keyframes drawer-in {
+ from { transform: translateX(-20px); opacity: 0; }
+ to { transform: translateX(0); opacity: 1; }
+}
+
+.profile-drawer__header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+}
+
+.profile-identity {
+ display: grid;
+ place-items: center;
+ padding: 46px 0 32px;
+ text-align: center;
+}
+
+.profile-identity h2 {
+ margin: 17px 0 4px;
+ font-family: var(--font-display);
+ font-size: 1.8rem;
+ font-weight: 400;
+}
+
+.profile-identity > p {
+ margin: 0;
+ color: var(--muted);
+ font-size: 0.82rem;
+}
+
+.profile-badge {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ margin-top: 16px;
+ padding: 6px 10px;
+ border: 1px solid rgba(255, 255, 255, 0.18);
+ color: #abc29c;
+ background: rgba(255, 255, 255, 0.06);
+ font-size: 0.66rem;
+ text-transform: uppercase;
+}
+
+.profile-badge svg {
+ width: 14px;
+ height: 14px;
+}
+
+.profile-details {
+ display: grid;
+ gap: 1px;
+ margin: 0;
+ background: var(--line);
+}
+
+.profile-details > div {
+ display: grid;
+ gap: 10px;
+ padding: 15px;
+ background: var(--surface-2);
+}
+
+.profile-details dt {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ color: var(--quiet);
+ font-size: 0.67rem;
+ text-transform: uppercase;
+}
+
+.profile-details dt svg {
+ width: 15px;
+ height: 15px;
+}
+
+.profile-details dd {
+ display: flex;
+ min-width: 0;
+ align-items: center;
+ justify-content: space-between;
+ gap: 10px;
+ margin: 0;
+ color: #d8d5ca;
+ font-size: 0.8rem;
+}
+
+.profile-details code {
+ overflow: hidden;
+ color: #c5c0af;
+ font-size: 0.69rem;
+ text-overflow: ellipsis;
+}
+
+.copy-button {
+ flex: 0 0 auto;
+ padding: 4px;
+ color: var(--accent-bright);
+}
+
+.profile-roadmap {
+ margin-top: 18px;
+ padding: 15px;
+ border: 1px dashed rgba(255, 255, 255, 0.18);
+}
+
+.profile-roadmap strong {
+ color: #d8d3c4;
+ font-size: 0.76rem;
+}
+
+.profile-roadmap p {
+ margin: 7px 0 0;
+ color: var(--quiet);
+ font-size: 0.72rem;
+ line-height: 1.5;
+}
+
+.logout-button {
+ display: flex;
+ min-height: 46px;
+ align-items: center;
+ justify-content: center;
+ gap: 9px;
+ margin-top: auto;
+ border: 1px solid rgba(255, 255, 255, 0.25);
+ cursor: pointer;
+ color: #d99c94;
+ background: rgba(255, 255, 255, 0.05);
+}
+
+.logout-button:hover:not(:disabled) {
+ background: rgba(255, 255, 255, 0.1);
+}
+
+.logout-button:disabled {
+ cursor: not-allowed;
+ opacity: 0.6;
+}
+
+.logout-button svg {
+ width: 18px;
+ height: 18px;
+}
+
+@media (max-width: 1080px) {
+ .messenger-shell {
+ grid-template-columns: 68px 300px minmax(0, 1fr);
+ }
+
+ .profile-drawer {
+ left: 68px;
+ }
+
+ .message-stream {
+ padding-right: 40px;
+ padding-left: 40px;
+ }
+
+ .auth-page {
+ grid-template-columns: 1fr minmax(390px, 0.75fr);
+ }
+
+ .auth-copy h1 {
+ font-size: clamp(2.8rem, 5.8vw, 5rem);
+ }
+}
+
+@media (max-width: 760px) {
+ .auth-page {
+ grid-template-columns: 1fr;
+ overflow-y: auto;
+ }
+
+ .auth-story {
+ min-height: 34vh;
+ padding: 24px;
+ }
+
+ .auth-copy {
+ margin: 80px 0 0;
+ }
+
+ .auth-copy h1 {
+ margin: 12px 0;
+ font-size: clamp(2.45rem, 12vw, 4.2rem);
+ }
+
+ .auth-copy > p:not(.eyebrow),
+ .auth-status {
+ display: none;
+ }
+
+ .auth-panel {
+ padding: 40px 22px 54px;
+ border-top: 1px solid var(--line);
+ border-left: 0;
+ }
+
+ .auth-card__icon {
+ display: none;
+ }
+
+ .messenger-shell {
+ grid-template-columns: 1fr;
+ grid-template-rows: minmax(0, 1fr) 62px;
+ grid-template-areas:
+ "content"
+ "rail";
+ }
+
+ .navigation-rail {
+ display: grid;
+ grid-area: rail;
+ grid-template-columns: 1fr 1fr 1fr;
+ padding: 5px 12px;
+ border-top: 1px solid var(--line);
+ border-right: 0;
+ }
+
+ .rail-brand {
+ align-self: center;
+ justify-self: start;
+ width: 36px;
+ height: 36px;
+ }
+
+ .rail-actions {
+ display: contents;
+ margin: 0;
+ }
+
+ .rail-action {
+ min-height: 50px;
+ }
+
+ .rail-action--active::before {
+ top: -6px;
+ left: calc(50% - 14px);
+ width: 28px;
+ height: 2px;
+ }
+
+ .rail-profile {
+ align-self: center;
+ justify-self: end;
+ margin: 0;
+ }
+
+ .chat-sidebar,
+ .conversation,
+ .conversation--empty {
+ grid-area: content;
+ }
+
+ .conversation,
+ .conversation--empty {
+ display: none;
+ }
+
+ .messenger-shell--chat-open .chat-sidebar {
+ display: none;
+ }
+
+ .messenger-shell--chat-open .conversation {
+ display: grid;
+ }
+
+ .mobile-back-button {
+ display: inline-grid;
+ }
+
+ .conversation-header {
+ padding: 0 12px;
+ }
+
+ .conversation-header__security {
+ display: none;
+ }
+
+ .message-stream {
+ padding: 18px 12px 26px;
+ }
+
+ .message-bubble {
+ max-width: 88%;
+ }
+
+ .composer {
+ padding: 9px 10px 10px;
+ }
+
+ .profile-drawer {
+ left: 0;
+ width: min(390px, 88vw);
+ height: calc(100dvh - 62px);
+ }
+
+ .dialog-backdrop {
+ align-items: end;
+ padding: 0;
+ }
+
+ .dialog-card {
+ width: 100%;
+ max-height: 88dvh;
+ overflow-y: auto;
+ border-right: 0;
+ border-bottom: 0;
+ border-left: 0;
+ }
+}
+
+@media (max-width: 420px) {
+ .chat-sidebar__header {
+ padding: 20px 18px 15px;
+ }
+
+ .profile-drawer {
+ width: 100vw;
+ }
+
+ .message-bubble {
+ max-width: 94%;
+ }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ scroll-behavior: auto !important;
+ animation-duration: 0.01ms !important;
+ animation-iteration-count: 1 !important;
+ transition-duration: 0.01ms !important;
+ }
+}
+
+/* Monochrome refinement: neutral color, softer type and shared geometry. */
+.eyebrow {
+ color: #c9ccd1;
+ letter-spacing: 0.13em;
+}
+
+.brand-mark,
+.rail-brand {
+ border-color: var(--line-strong);
+ border-radius: var(--radius-sm);
+ color: var(--accent-bright);
+ background: rgba(8, 9, 11, 0.82);
+ font-family: var(--font-display);
+ transform: none;
+}
+
+.status-dot,
+.presence-dot {
+ background: var(--success);
+ box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.07);
+}
+
+.loading-screen {
+ background:
+ linear-gradient(rgba(7, 8, 10, 0.84), rgba(7, 8, 10, 0.96)),
+ url("./assets/chat-background.jpg") center / cover;
+}
+
+.loading-line {
+ border-radius: var(--radius-pill);
+}
+
+.auth-story {
+ background:
+ linear-gradient(115deg, rgba(5, 6, 8, 0.96), rgba(5, 6, 8, 0.42)),
+ url("./assets/chat-background.jpg") center / cover;
+}
+
+.auth-story::after {
+ border-color: rgba(255, 255, 255, 0.12);
+}
+
+.auth-copy h1,
+.auth-card h2,
+.chat-sidebar__header h1,
+.empty-chat-card h2,
+.dialog-card h2,
+.profile-identity h2 {
+ font-family: var(--font-display);
+ font-weight: 600;
+ letter-spacing: -0.035em;
+}
+
+.auth-copy h1 {
+ font-size: clamp(3rem, 5.6vw, 6.2rem);
+ line-height: 0.98;
+}
+
+.auth-copy > p:not(.eyebrow),
+.auth-form label,
+.dialog-form label {
+ color: #c7c9cd;
+}
+
+.auth-panel {
+ background: rgba(14, 16, 19, 0.98);
+}
+
+.auth-card__icon,
+.auth-switch a,
+.text-button,
+.copy-button,
+.floating-state svg,
+.floating-state button,
+.send-error button,
+.dialog-form code {
+ color: var(--accent-bright);
+}
+
+.input-shell,
+.textarea-shell,
+.search-box,
+.composer form {
+ border-radius: var(--radius-md);
+}
+
+.input-shell:focus-within,
+.textarea-shell:focus-within,
+.search-box:focus-within,
+.composer form:focus-within {
+ border-color: rgba(255, 255, 255, 0.38);
+ background: var(--surface-3);
+}
+
+.input-shell input::placeholder,
+.textarea-shell textarea::placeholder,
+.composer textarea::placeholder {
+ color: #696d74;
+}
+
+.icon-button,
+.copy-button,
+.mobile-back-button {
+ border-radius: var(--radius-xs);
+}
+
+.soft-icon-button,
+.primary-button,
+.send-button,
+.logout-button {
+ border-radius: var(--radius-sm);
+}
+
+.soft-icon-button {
+ color: #b9bcc1;
+ background: rgba(255, 255, 255, 0.035);
+}
+
+.soft-icon-button:hover {
+ border-color: var(--line-strong);
+ color: var(--accent-bright);
+ background: rgba(255, 255, 255, 0.08);
+}
+
+.primary-button,
+.send-button {
+ border-color: var(--accent-bright);
+ color: #0b0c0e;
+ background: var(--accent-bright);
+}
+
+.primary-button:hover:not(:disabled) {
+ background: #ffffff;
+}
+
+.form-error,
+.send-error,
+.sidebar-state--error,
+.floating-state--error {
+ color: #d5d7db;
+}
+
+.form-error {
+ border-radius: var(--radius-sm);
+ background: rgba(255, 255, 255, 0.055);
+}
+
+.navigation-rail {
+ background: #090a0c;
+}
+
+.rail-action {
+ border-radius: var(--radius-sm);
+}
+
+.rail-action:hover,
+.rail-action--active {
+ color: var(--accent-bright);
+ background: rgba(255, 255, 255, 0.065);
+}
+
+.rail-action--active::before,
+.chat-row--active::before,
+.empty-chat-card__line {
+ border-radius: var(--radius-pill);
+ background: var(--accent-bright);
+}
+
+.rail-profile .presence-dot {
+ outline-color: #090a0c;
+}
+
+.avatar {
+ color: #f4f5f6;
+ font-family: var(--font-display);
+}
+
+.avatar--tone-0 { background: linear-gradient(145deg, #484b51, #24262a); }
+.avatar--tone-1 { background: linear-gradient(145deg, #5b5f66, #292c31); }
+.avatar--tone-2 { background: linear-gradient(145deg, #40444a, #202226); }
+.avatar--tone-3 { background: linear-gradient(145deg, #555960, #272a2f); }
+.avatar--tone-4 { background: linear-gradient(145deg, #464950, #222429); }
+
+.chat-sidebar {
+ background: rgba(14, 16, 19, 0.99);
+}
+
+.chat-row {
+ border-radius: var(--radius-md);
+}
+
+.chat-row:hover {
+ background: rgba(255, 255, 255, 0.045);
+}
+
+.chat-row--active {
+ border-color: rgba(255, 255, 255, 0.12);
+ background: rgba(255, 255, 255, 0.08);
+}
+
+.chat-row__body strong {
+ color: #eceef0;
+}
+
+.chat-row__status {
+ color: var(--accent-bright);
+}
+
+.sidebar-state--error {
+ color: #c9ccd1;
+}
+
+.conversation-header,
+.composer {
+ background: rgba(12, 14, 17, 0.96);
+}
+
+.message-canvas,
+.conversation--empty {
+ background:
+ linear-gradient(rgba(7, 8, 10, 0.48), rgba(7, 8, 10, 0.72)),
+ url("./assets/chat-background.jpg") center / cover;
+}
+
+.message-canvas__shade {
+ background:
+ linear-gradient(90deg, rgba(0, 0, 0, 0.2), transparent 45%, rgba(0, 0, 0, 0.2)),
+ radial-gradient(circle at 50% 40%, transparent 0 25%, rgba(0, 0, 0, 0.24) 75%);
+}
+
+.message-stream {
+ scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
+}
+
+.date-divider span {
+ border-color: var(--line-strong);
+ color: #c8cbd0;
+ background: rgba(14, 16, 19, 0.86);
+}
+
+.message-bubble {
+ border-color: rgba(255, 255, 255, 0.1);
+ border-radius: 8px 18px 18px 18px;
+ background: rgba(20, 22, 26, 0.96);
+}
+
+.message-bubble--own {
+ border-color: rgba(255, 255, 255, 0.15);
+ border-radius: 18px 8px 18px 18px;
+ background: rgba(58, 61, 67, 0.97);
+}
+
+.message-bubble__sender,
+.message-bubble--own .message-bubble__sender,
+.message-bubble__meta svg {
+ color: #e0e2e5;
+}
+
+.message-bubble p {
+ color: #f2f3f4;
+}
+
+.message-bubble__meta {
+ color: rgba(239, 240, 242, 0.56);
+}
+
+.floating-state,
+.empty-chat-card {
+ border-radius: var(--radius-lg);
+ color: #c8cbd0;
+ background: rgba(12, 14, 17, 0.88);
+}
+
+.composer form {
+ border-color: rgba(255, 255, 255, 0.1);
+}
+
+.send-button:disabled {
+ color: var(--quiet);
+ background: #282b30;
+}
+
+.dialog-backdrop,
+.drawer-backdrop {
+ background: rgba(4, 5, 7, 0.74);
+}
+
+.dialog-card {
+ border-color: var(--line-strong);
+ border-radius: var(--radius-lg);
+ background: #111317;
+}
+
+.profile-drawer {
+ border-color: var(--line-strong);
+ border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
+ background: #101216;
+}
+
+.profile-badge {
+ border-color: var(--line-strong);
+ border-radius: var(--radius-pill);
+ color: #d7d9dd;
+ background: rgba(255, 255, 255, 0.055);
+}
+
+.profile-details {
+ overflow: hidden;
+ border-radius: var(--radius-md);
+}
+
+.profile-details dd,
+.profile-roadmap strong {
+ color: #d9dbde;
+}
+
+.profile-details code {
+ color: #c7c9cd;
+}
+
+.profile-roadmap {
+ border-color: var(--line-strong);
+ border-radius: var(--radius-md);
+}
+
+.logout-button {
+ border-color: var(--line-strong);
+ color: #d9dbdf;
+ background: rgba(255, 255, 255, 0.035);
+}
+
+.logout-button:hover:not(:disabled) {
+ background: rgba(255, 255, 255, 0.08);
+}
+
+@media (max-width: 760px) {
+ .dialog-card {
+ border-radius: var(--radius-lg) var(--radius-lg) 0 0;
+ }
+
+ .profile-drawer {
+ border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
+ }
+}
diff --git a/frontend/src/vite-env.d.ts b/frontend/src/vite-env.d.ts
new file mode 100644
index 0000000..11f02fe
--- /dev/null
+++ b/frontend/src/vite-env.d.ts
@@ -0,0 +1 @@
+///
diff --git a/frontend/tsconfig.app.json b/frontend/tsconfig.app.json
new file mode 100644
index 0000000..7a7a882
--- /dev/null
+++ b/frontend/tsconfig.app.json
@@ -0,0 +1,21 @@
+{
+ "compilerOptions": {
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
+ "target": "ES2022",
+ "useDefineForClassFields": true,
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
+ "allowJs": false,
+ "skipLibCheck": true,
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "strict": true,
+ "forceConsistentCasingInFileNames": true,
+ "module": "ESNext",
+ "moduleResolution": "Bundler",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "react-jsx"
+ },
+ "include": ["src"]
+}
diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json
new file mode 100644
index 0000000..1ffef60
--- /dev/null
+++ b/frontend/tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "files": [],
+ "references": [
+ { "path": "./tsconfig.app.json" },
+ { "path": "./tsconfig.node.json" }
+ ]
+}
diff --git a/frontend/tsconfig.node.json b/frontend/tsconfig.node.json
new file mode 100644
index 0000000..9f4e609
--- /dev/null
+++ b/frontend/tsconfig.node.json
@@ -0,0 +1,15 @@
+{
+ "compilerOptions": {
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
+ "target": "ES2023",
+ "lib": ["ES2023"],
+ "module": "ESNext",
+ "skipLibCheck": true,
+ "moduleResolution": "Bundler",
+ "allowImportingTsExtensions": true,
+ "verbatimModuleSyntax": true,
+ "moduleDetection": "force",
+ "noEmit": true
+ },
+ "include": ["vite.config.ts"]
+}
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
new file mode 100644
index 0000000..7cdb8c9
--- /dev/null
+++ b/frontend/vite.config.ts
@@ -0,0 +1,23 @@
+import { defineConfig } from "vitest/config";
+import react from "@vitejs/plugin-react";
+
+export default defineConfig({
+ plugins: [react()],
+ server: {
+ port: 5173,
+ strictPort: true,
+ proxy: {
+ "/api": "http://localhost:8080",
+ "/web-api": "http://localhost:8080",
+ "/health": "http://localhost:8080",
+ },
+ },
+ preview: {
+ port: 4173,
+ strictPort: true,
+ },
+ test: {
+ environment: "node",
+ include: ["src/**/*.test.ts"],
+ },
+});
diff --git a/infrastructure/nginx/Dockerfile b/infrastructure/nginx/Dockerfile
new file mode 100644
index 0000000..ec04993
--- /dev/null
+++ b/infrastructure/nginx/Dockerfile
@@ -0,0 +1,15 @@
+FROM node:24-alpine@sha256:44fce696f38ba8c987c4db89954051000bbd05ffd8d8659ba15ed4a8602e937f AS frontend-build
+
+WORKDIR /frontend
+COPY frontend/package.json frontend/package-lock.json ./
+RUN npm ci
+
+COPY frontend/ ./
+RUN npm test && npm run build
+
+FROM nginx:1.30.6-alpine@sha256:970364228b1e4f932abc22d321932816782cca8a20b85a77552a7cfe9acfb3b5
+
+COPY infrastructure/nginx/nginx.conf /etc/nginx/nginx.conf
+COPY --from=frontend-build /frontend/dist /usr/share/nginx/html
+
+EXPOSE 8080
diff --git a/infrastructure/nginx/nginx.conf b/infrastructure/nginx/nginx.conf
index 2bde5a9..bcb4d76 100644
--- a/infrastructure/nginx/nginx.conf
+++ b/infrastructure/nginx/nginx.conf
@@ -5,8 +5,15 @@ events {
}
http {
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
resolver 127.0.0.11 valid=1s ipv6=off;
+ map $cookie_mtusi_session $web_authorization {
+ default "Bearer $cookie_mtusi_session";
+ "" "";
+ }
+
upstream api_backend {
zone api_backend 64k;
least_conn;
@@ -16,26 +23,70 @@ http {
server {
listen 8080;
server_name _;
+ root /usr/share/nginx/html;
+ index index.html;
- location / {
+ add_header X-Content-Type-Options "nosniff" always;
+ add_header Referrer-Policy "no-referrer" always;
+ add_header X-Frame-Options "DENY" always;
+ add_header Content-Security-Policy "default-src 'self'; img-src 'self' data:; style-src 'self'; script-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'" always;
+
+ location /api/ {
proxy_pass http://api_backend;
proxy_http_version 1.1;
-
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Connection "";
-
+ proxy_set_header Cookie "";
proxy_connect_timeout 1s;
proxy_send_timeout 20s;
proxy_read_timeout 20s;
-
- # Safe methods may transparently move to another healthy peer.
- # Nginx deliberately does not retry non-idempotent POST requests:
- # the client retries message POSTs with its Idempotency-Key.
proxy_next_upstream error timeout http_502 http_503 http_504;
proxy_next_upstream_tries 2;
}
+
+ location /web-api/ {
+ rewrite ^/web-api/(.*)$ /api/$1 break;
+ proxy_pass http://api_backend;
+ proxy_http_version 1.1;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header Connection "";
+ proxy_set_header Authorization $web_authorization;
+ proxy_set_header Cookie "";
+ proxy_connect_timeout 1s;
+ proxy_send_timeout 20s;
+ proxy_read_timeout 20s;
+ proxy_next_upstream error timeout http_502 http_503 http_504;
+ proxy_next_upstream_tries 2;
+ }
+
+ location /health/ {
+ proxy_pass http://api_backend;
+ proxy_http_version 1.1;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header Connection "";
+ proxy_connect_timeout 1s;
+ proxy_read_timeout 5s;
+ proxy_next_upstream error timeout http_502 http_503 http_504;
+ proxy_next_upstream_tries 2;
+ }
+
+ location /assets/ {
+ try_files $uri =404;
+ expires 1y;
+ add_header Cache-Control "public, immutable";
+ }
+
+ location / {
+ try_files $uri $uri/ /index.html;
+ }
}
}
diff --git a/internal/config/config.go b/internal/config/config.go
index cd4edd4..6bcbcef 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -16,9 +16,10 @@ type Config struct {
HTTPPort string
InstanceID string
- SessionTTL time.Duration
- IdempotencyTTL time.Duration
- CursorSigningKey string
+ SessionTTL time.Duration
+ IdempotencyTTL time.Duration
+ SessionCookieSecure bool
+ CursorSigningKey string
DatabaseURL string
DatabaseMaxConns int32
@@ -60,6 +61,10 @@ func Load() (Config, error) {
return Config{}, err
}
+ sessionCookieSecure, err := boolFromEnv("SESSION_COOKIE_SECURE", false)
+ if err != nil {
+ return Config{}, err
+ }
databaseURL, err := requiredValueOrFile(
"DATABASE_URL",
"DATABASE_URL_FILE",
@@ -181,12 +186,13 @@ func Load() (Config, error) {
}
return Config{
- HTTPHost: envOrDefault("APP_HOST", "0.0.0.0"),
- HTTPPort: envOrDefault("APP_PORT", "8080"),
- InstanceID: instanceID,
- SessionTTL: sessionTTL,
- IdempotencyTTL: idempotencyTTL,
- CursorSigningKey: cursorSigningKey,
+ HTTPHost: envOrDefault("APP_HOST", "0.0.0.0"),
+ HTTPPort: envOrDefault("APP_PORT", "8080"),
+ InstanceID: instanceID,
+ SessionTTL: sessionTTL,
+ IdempotencyTTL: idempotencyTTL,
+ SessionCookieSecure: sessionCookieSecure,
+ CursorSigningKey: cursorSigningKey,
DatabaseURL: databaseURL,
DatabaseMaxConns: databaseMaxConns,
@@ -345,6 +351,20 @@ func int32FromEnv(name string, fallback, minimum int32) (int32, error) {
return int32(value), nil
}
+func boolFromEnv(name string, fallback bool) (bool, error) {
+ raw := strings.TrimSpace(os.Getenv(name))
+ if raw == "" {
+ return fallback, nil
+ }
+
+ value, err := strconv.ParseBool(raw)
+ if err != nil {
+ return false, fmt.Errorf("%s must be true or false: %w", name, err)
+ }
+
+ return value, nil
+}
+
func durationFromEnv(name string, fallback time.Duration) (time.Duration, error) {
raw := strings.TrimSpace(os.Getenv(name))
if raw == "" {
diff --git a/internal/config/session_cookie_test.go b/internal/config/session_cookie_test.go
new file mode 100644
index 0000000..05dff00
--- /dev/null
+++ b/internal/config/session_cookie_test.go
@@ -0,0 +1,29 @@
+package config
+
+import "testing"
+
+func TestBoolFromEnv(t *testing.T) {
+ t.Run("fallback", func(t *testing.T) {
+ t.Setenv("TEST_BOOL", "")
+ value, err := boolFromEnv("TEST_BOOL", true)
+ if err != nil || !value {
+ t.Fatalf("boolFromEnv() = %v, %v; want true, nil", value, err)
+ }
+ })
+
+ t.Run("explicit false", func(t *testing.T) {
+ t.Setenv("TEST_BOOL", "false")
+ value, err := boolFromEnv("TEST_BOOL", true)
+ if err != nil || value {
+ t.Fatalf("boolFromEnv() = %v, %v; want false, nil", value, err)
+ }
+ })
+
+ t.Run("invalid", func(t *testing.T) {
+ t.Setenv("TEST_BOOL", "sometimes")
+ _, err := boolFromEnv("TEST_BOOL", false)
+ if err == nil {
+ t.Fatal("boolFromEnv() error = nil, want validation error")
+ }
+ })
+}
diff --git a/internal/transport/http/handlers/delete_session.go b/internal/transport/http/handlers/delete_session.go
index d6c556b..f3eccc0 100644
--- a/internal/transport/http/handlers/delete_session.go
+++ b/internal/transport/http/handlers/delete_session.go
@@ -15,5 +15,6 @@ func (h *Handler) DeleteCurrentSession(w http.ResponseWriter, r *http.Request) {
"service is temporarily unavailable", requestID)
return
}
+ h.clearSessionCookie(w)
response.WriteJSON(w, http.StatusNoContent, nil, requestID)
}
diff --git a/internal/transport/http/handlers/handler.go b/internal/transport/http/handlers/handler.go
index f775c55..10e1917 100644
--- a/internal/transport/http/handlers/handler.go
+++ b/internal/transport/http/handlers/handler.go
@@ -30,9 +30,10 @@ type ReadinessChecker interface {
type Option func(*Handler)
type Handler struct {
- service *application.Service
- readinessChecker ReadinessChecker
- readinessTimeout time.Duration
+ service *application.Service
+ readinessChecker ReadinessChecker
+ readinessTimeout time.Duration
+ sessionCookieSecure bool
}
func NewHandler(
@@ -61,6 +62,12 @@ func WithReadiness(
}
}
+func WithSessionCookieSecure(secure bool) Option {
+ return func(handler *Handler) {
+ handler.sessionCookieSecure = secure
+ }
+}
+
func decodeJSON(r *http.Request, destination any) error {
mediaType, parameters, err := mime.ParseMediaType(
r.Header.Get("Content-Type"),
diff --git a/internal/transport/http/handlers/session_cookie.go b/internal/transport/http/handlers/session_cookie.go
new file mode 100644
index 0000000..78792fe
--- /dev/null
+++ b/internal/transport/http/handlers/session_cookie.go
@@ -0,0 +1,39 @@
+package handlers
+
+import (
+ "net/http"
+ "time"
+)
+
+const sessionCookieName = "mtusi_session"
+
+func (h *Handler) setSessionCookie(
+ w http.ResponseWriter,
+ token string,
+ expiresAt time.Time,
+) {
+ maxAge := int(time.Until(expiresAt).Seconds())
+ if maxAge < 1 {
+ maxAge = 1
+ }
+
+ h.writeSessionCookie(w, token, expiresAt, maxAge)
+}
+
+func (h *Handler) clearSessionCookie(w http.ResponseWriter) {
+ h.writeSessionCookie(w, "", time.Unix(1, 0).UTC(), -1)
+}
+
+func (h *Handler) writeSessionCookie(
+ w http.ResponseWriter,
+ value string,
+ expiresAt time.Time,
+ maxAge int,
+) {
+ http.SetCookie(w, &http.Cookie{
+ Name: sessionCookieName, Value: value, Path: "/",
+ Expires: expiresAt, MaxAge: maxAge,
+ HttpOnly: true, Secure: h.sessionCookieSecure,
+ SameSite: http.SameSiteStrictMode,
+ })
+}
diff --git a/internal/transport/http/handlers/session_cookie_test.go b/internal/transport/http/handlers/session_cookie_test.go
new file mode 100644
index 0000000..4ac601f
--- /dev/null
+++ b/internal/transport/http/handlers/session_cookie_test.go
@@ -0,0 +1,61 @@
+package handlers
+
+import (
+ "net/http"
+ "net/http/httptest"
+ "testing"
+ "time"
+)
+
+func TestSessionCookieIsHardened(t *testing.T) {
+ handler := &Handler{sessionCookieSecure: true}
+ recorder := httptest.NewRecorder()
+
+ handler.setSessionCookie(
+ recorder,
+ "secret-token",
+ time.Now().Add(time.Hour),
+ )
+
+ cookies := recorder.Result().Cookies()
+ if len(cookies) != 1 {
+ t.Fatalf("cookie count = %d, want 1", len(cookies))
+ }
+
+ cookie := cookies[0]
+ if cookie.Name != sessionCookieName || cookie.Value != "secret-token" {
+ t.Fatalf("unexpected cookie: %#v", cookie)
+ }
+ if cookie.Path != "/" || cookie.Domain != "" {
+ t.Fatalf("cookie scope = path %q domain %q", cookie.Path, cookie.Domain)
+ }
+ if !cookie.HttpOnly || !cookie.Secure {
+ t.Fatalf("cookie flags: HttpOnly=%v Secure=%v", cookie.HttpOnly, cookie.Secure)
+ }
+ if cookie.SameSite != http.SameSiteStrictMode {
+ t.Fatalf("SameSite = %v, want Strict", cookie.SameSite)
+ }
+ if cookie.MaxAge < 1 {
+ t.Fatalf("MaxAge = %d, want positive", cookie.MaxAge)
+ }
+}
+
+func TestClearSessionCookieExpiresIt(t *testing.T) {
+ handler := &Handler{}
+ recorder := httptest.NewRecorder()
+
+ handler.clearSessionCookie(recorder)
+
+ cookies := recorder.Result().Cookies()
+ if len(cookies) != 1 {
+ t.Fatalf("cookie count = %d, want 1", len(cookies))
+ }
+
+ cookie := cookies[0]
+ if cookie.Value != "" || cookie.MaxAge != -1 {
+ t.Fatalf("clear cookie = value %q MaxAge %d", cookie.Value, cookie.MaxAge)
+ }
+ if !cookie.Expires.Before(time.Now()) {
+ t.Fatalf("clear cookie expiry %v is not in the past", cookie.Expires)
+ }
+}
diff --git a/internal/transport/http/handlers/sessions.go b/internal/transport/http/handlers/sessions.go
index 34bddfa..5a30dc6 100644
--- a/internal/transport/http/handlers/sessions.go
+++ b/internal/transport/http/handlers/sessions.go
@@ -55,6 +55,8 @@ func (h *Handler) CreateSession(
return
}
+ h.setSessionCookie(w, session.Token, session.ExpiresAt)
+
response.WriteJSON(
w,
http.StatusCreated,