commit 23f75adb40e18abee5c40da82e001006e570baa2 Author: Dmitriy Belyaev Date: Sat Jun 27 14:07:10 2026 +0300 chore: initialize project repository diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6e0eb19 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.DS_Store +.env +.git +.venv +__pycache__/ +*.pyc +data/ +output/ +storage/ diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..ab821e7 --- /dev/null +++ b/.env.example @@ -0,0 +1,23 @@ +APP_ENV=production +APP_BASE_URL=https://vk2ok.bot.nstarikov.ru + +SQLITE_PATH=/app/data/vk2ok.sqlite3 +STORAGE_DIR=/app/storage + +REDIS_URL=redis://redis:6379/0 +CELERY_BROKER_URL=redis://redis:6379/0 +CELERY_RESULT_BACKEND=redis://redis:6379/1 + +VK_GROUP_ID=9828339 +VK_CONFIRMATION_CODE=58578d71 +VK_SECRET=590c3c72 +VK_API_VERSION=5.199 + +OK_APP_ID= +OK_PUBLIC_KEY= +OK_SECRET_KEY= +OK_ACCESS_TOKEN= +OK_SESSION_SECRET_KEY= +OK_GROUP_ID= + +YTDLP_COOKIES_PATH=/app/data/vk_cookies.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..887b8e5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.DS_Store +.env +.venv/ +__pycache__/ +*.pyc +node_modules/ +dist/ +.worktrees/ +data/ +storage/ diff --git a/Caddyfile.snippet b/Caddyfile.snippet new file mode 100644 index 0000000..483ce7d --- /dev/null +++ b/Caddyfile.snippet @@ -0,0 +1,3 @@ +vk2ok.bot.nstarikov.ru { + reverse_proxy vk2ok-api:8000 +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..af384ab --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM python:3.12-slim + +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 + +WORKDIR /app + +RUN apt-get update \ + && apt-get install -y --no-install-recommends ffmpeg ca-certificates curl fonts-dejavu-core \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt \ + && pip install --no-cache-dir yt-dlp + +COPY app ./app + +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..54505c1 --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# vk2ok + +Сервис принимает webhook VK на `https://vk2ok.bot.nstarikov.ru/webhook`, сохраняет событие в SQLite и ставит обработку в Redis/Celery. + +## Развертывание + +```bash +mkdir -p /var/www/bots/vk2ok +cd /var/www/bots/vk2ok +cp .env.example .env +docker compose up -d --build +``` + +В Caddy добавить: + +```caddyfile +vk2ok.bot.nstarikov.ru { + reverse_proxy vk2ok-api:8000 +} +``` + +После запуска в VK нажать "Подтвердить". На confirmation-запрос сервис вернет строку из `VK_CONFIRMATION_CODE`. + +## Проверка webhook + +```bash +curl -i https://vk2ok.bot.nstarikov.ru/health +curl -i -X POST https://vk2ok.bot.nstarikov.ru/webhook \ + -H 'content-type: application/json' \ + -d '{"type":"confirmation","group_id":9828339}' +``` + +Ожидаемый ответ второго запроса: + +```text +58578d71 +``` + +## Файлы + +- SQLite: `/var/www/bots/vk2ok/data/vk2ok.sqlite3` +- Видео и обложки: `/var/www/bots/vk2ok/storage` +- cookies VK для yt-dlp: `/var/www/bots/vk2ok/data/vk_cookies.txt` diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/app/__init__.py @@ -0,0 +1 @@ + diff --git a/app/config.py b/app/config.py new file mode 100644 index 0000000..237fc8c --- /dev/null +++ b/app/config.py @@ -0,0 +1,45 @@ +from functools import lru_cache +from pathlib import Path + +from pydantic_settings import BaseSettings, SettingsConfigDict + + +class Settings(BaseSettings): + model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore") + + app_env: str = "production" + app_base_url: str = "https://vk2ok.bot.nstarikov.ru" + + sqlite_path: str = "/app/data/vk2ok.sqlite3" + storage_dir: str = "/app/storage" + + redis_url: str = "redis://redis:6379/0" + celery_broker_url: str = "redis://redis:6379/0" + celery_result_backend: str = "redis://redis:6379/1" + + vk_group_id: str = "9828339" + vk_confirmation_code: str = "58578d71" + vk_secret: str = "590c3c72" + vk_api_version: str = "5.199" + + ok_app_id: str = "" + ok_public_key: str = "" + ok_secret_key: str = "" + ok_access_token: str = "" + ok_session_secret_key: str = "" + ok_group_id: str = "" + + ytdlp_cookies_path: str = "/app/data/vk_cookies.txt" + + @property + def sqlite_url(self) -> str: + return f"sqlite:///{self.sqlite_path}" + + @property + def storage_path(self) -> Path: + return Path(self.storage_dir) + + +@lru_cache +def get_settings() -> Settings: + return Settings() diff --git a/app/database.py b/app/database.py new file mode 100644 index 0000000..e7135fc --- /dev/null +++ b/app/database.py @@ -0,0 +1,63 @@ +from collections.abc import Generator +from pathlib import Path + +from sqlalchemy import create_engine, event +from sqlalchemy.orm import DeclarativeBase, Session, sessionmaker + +from app.config import get_settings + + +class Base(DeclarativeBase): + pass + + +settings = get_settings() +Path(settings.sqlite_path).parent.mkdir(parents=True, exist_ok=True) + +engine = create_engine( + settings.sqlite_url, + connect_args={"check_same_thread": False}, + future=True, +) + + +@event.listens_for(engine, "connect") +def configure_sqlite(dbapi_connection, _connection_record) -> None: + cursor = dbapi_connection.cursor() + cursor.execute("PRAGMA journal_mode=WAL") + cursor.execute("PRAGMA busy_timeout=5000") + cursor.execute("PRAGMA foreign_keys=ON") + cursor.close() + + +SessionLocal = sessionmaker(bind=engine, autoflush=False, autocommit=False, expire_on_commit=False) + + +def init_db() -> None: + from app import models # noqa: F401 + + Base.metadata.create_all(bind=engine) + with engine.begin() as connection: + post_media_columns = { + row[1] for row in connection.exec_driver_sql("PRAGMA table_info(post_media)").fetchall() + } + if "duration_seconds" not in post_media_columns: + connection.exec_driver_sql("ALTER TABLE post_media ADD COLUMN duration_seconds INTEGER") + if "playlist_title" not in post_media_columns: + connection.exec_driver_sql("ALTER TABLE post_media ADD COLUMN playlist_title TEXT") + post_columns = {row[1] for row in connection.exec_driver_sql("PRAGMA table_info(posts)").fetchall()} + if "content_key" not in post_columns: + connection.exec_driver_sql("ALTER TABLE posts ADD COLUMN content_key VARCHAR(128)") + connection.exec_driver_sql("CREATE INDEX IF NOT EXISTS ix_posts_content_key ON posts (content_key)") + if "publish_lock" not in post_columns: + connection.exec_driver_sql("ALTER TABLE posts ADD COLUMN publish_lock VARCHAR(128)") + connection.exec_driver_sql("CREATE INDEX IF NOT EXISTS ix_posts_publish_lock ON posts (publish_lock)") + video_columns = {row[1] for row in connection.exec_driver_sql("PRAGMA table_info(videos)").fetchall()} + if "upload_lock" not in video_columns: + connection.exec_driver_sql("ALTER TABLE videos ADD COLUMN upload_lock VARCHAR(128)") + connection.exec_driver_sql("CREATE INDEX IF NOT EXISTS ix_videos_upload_lock ON videos (upload_lock)") + + +def get_session() -> Generator[Session, None, None]: + with SessionLocal() as session: + yield session diff --git a/app/main.py b/app/main.py new file mode 100644 index 0000000..197d6ab --- /dev/null +++ b/app/main.py @@ -0,0 +1,16 @@ +from contextlib import asynccontextmanager + +from fastapi import FastAPI + +from app.database import init_db +from app.routes import router + + +@asynccontextmanager +async def lifespan(_app: FastAPI): + init_db() + yield + + +app = FastAPI(title="vk2ok", version="0.1.0", lifespan=lifespan) +app.include_router(router) diff --git a/app/models.py b/app/models.py new file mode 100644 index 0000000..20b2f3b --- /dev/null +++ b/app/models.py @@ -0,0 +1,91 @@ +from datetime import datetime + +from sqlalchemy import DateTime, ForeignKey, Integer, String, Text, UniqueConstraint, func +from sqlalchemy.orm import Mapped, mapped_column, relationship + +from app.database import Base + + +class VkEvent(Base): + __tablename__ = "vk_events" + + id: Mapped[int] = mapped_column(Integer, primary_key=True) + event_id: Mapped[str | None] = mapped_column(String(128), index=True) + event_type: Mapped[str] = mapped_column(String(64), index=True) + group_id: Mapped[str] = mapped_column(String(64), index=True) + raw_payload_json: Mapped[str] = mapped_column(Text) + status: Mapped[str] = mapped_column(String(32), default="queued", index=True) + error_message: Mapped[str | None] = mapped_column(Text) + received_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now()) + processed_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True)) + + +class Post(Base): + __tablename__ = "posts" + __table_args__ = (UniqueConstraint("vk_group_id", "vk_post_id", name="uq_posts_vk_group_post"),) + + id: Mapped[int] = mapped_column(Integer, primary_key=True) + vk_group_id: Mapped[str] = mapped_column(String(64), index=True) + vk_post_id: Mapped[str] = mapped_column(String(64), index=True) + vk_post_url: Mapped[str | None] = mapped_column(Text) + text: Mapped[str] = mapped_column(Text, default="") + content_key: Mapped[str | None] = mapped_column(String(128), index=True) + status: Mapped[str] = mapped_column(String(32), default="pending", index=True) + ok_topic_id: Mapped[str | None] = mapped_column(String(128), index=True) + publish_lock: Mapped[str | None] = mapped_column(String(128), index=True) + error_message: Mapped[str | None] = mapped_column(Text) + created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now()) + published_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True)) + + media: Mapped[list["PostMedia"]] = relationship(back_populates="post", cascade="all, delete-orphan") + + +class PostMedia(Base): + __tablename__ = "post_media" + + id: Mapped[int] = mapped_column(Integer, primary_key=True) + post_id: Mapped[int] = mapped_column(ForeignKey("posts.id", ondelete="CASCADE"), index=True) + media_type: Mapped[str] = mapped_column(String(32), index=True) + vk_attachment_id: Mapped[str | None] = mapped_column(String(128), index=True) + source_url: Mapped[str | None] = mapped_column(Text) + local_path: Mapped[str | None] = mapped_column(Text) + local_cover_path: Mapped[str | None] = mapped_column(Text) + ok_media_id: Mapped[str | None] = mapped_column(String(128), index=True) + duration_seconds: Mapped[int | None] = mapped_column(Integer) + playlist_title: Mapped[str | None] = mapped_column(Text) + sort_order: Mapped[int] = mapped_column(Integer, default=0) + status: Mapped[str] = mapped_column(String(32), default="pending", index=True) + error_message: Mapped[str | None] = mapped_column(Text) + + post: Mapped[Post] = relationship(back_populates="media") + + +class Video(Base): + __tablename__ = "videos" + + id: Mapped[int] = mapped_column(Integer, primary_key=True) + vk_video_id: Mapped[str | None] = mapped_column(String(128), index=True) + vk_video_url: Mapped[str] = mapped_column(Text) + title: Mapped[str | None] = mapped_column(Text) + description: Mapped[str | None] = mapped_column(Text) + local_video_path: Mapped[str | None] = mapped_column(Text) + local_cover_path: Mapped[str | None] = mapped_column(Text) + ok_video_id: Mapped[str | None] = mapped_column(String(128), index=True) + upload_lock: Mapped[str | None] = mapped_column(String(128), index=True) + status: Mapped[str] = mapped_column(String(32), default="pending", index=True) + error_message: Mapped[str | None] = mapped_column(Text) + created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now()) + updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now()) + + +class PublishJob(Base): + __tablename__ = "publish_jobs" + + id: Mapped[int] = mapped_column(Integer, primary_key=True) + post_id: Mapped[int] = mapped_column(ForeignKey("posts.id", ondelete="CASCADE"), index=True) + celery_task_id: Mapped[str | None] = mapped_column(String(128), index=True) + status: Mapped[str] = mapped_column(String(32), default="queued", index=True) + attempts: Mapped[int] = mapped_column(Integer, default=0) + last_error: Mapped[str | None] = mapped_column(Text) + created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now()) + updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now()) diff --git a/app/ok_api.py b/app/ok_api.py new file mode 100644 index 0000000..6c5ac00 --- /dev/null +++ b/app/ok_api.py @@ -0,0 +1,256 @@ +import hashlib +import json +import re +from pathlib import Path +from typing import Any + +import httpx + +from app.config import Settings + + +OK_API_URL = "https://api.ok.ru/fb.do" + + +class OkApiError(RuntimeError): + pass + + +TAG_STOPWORDS = { + "А", "Без", "Будет", "Был", "Была", "Были", "В", "Во", "Вот", "Все", "Для", "Если", + "Его", "Ее", "И", "Или", "Как", "Когда", "Кто", "На", "Над", "Не", "Но", "О", "Об", + "От", "По", "При", "Про", "С", "Со", "Так", "Что", "Это", "Этот", "Эта", "Эти", + "Видео", "Смотрите", "Хотите", "Открывайте", "Школы", "Геополитики", +} + + +def build_video_tags(title: str | None, description: str | None, limit: int = 12) -> str | None: + text = "\n".join(part for part in [title or "", description or ""] if part).replace("ё", "е") + if not text.strip(): + return None + + tags: list[str] = [] + + def add(tag: str) -> None: + clean = re.sub(r"[^\wА-Яа-яЁё\-\s]+", "", tag) + clean = re.sub(r"\s+", " ", clean).strip(" -_") + if len(clean) < 3 or clean in TAG_STOPWORDS or clean.lower() in {item.lower() for item in tags}: + return + tags.append(clean) + + for match in re.finditer(r"\b[А-ЯЁA-Z]{2,}(?:-[А-ЯЁA-Z]{2,})?\b", text): + add(match.group(0)) + + for match in re.finditer(r"\b[А-ЯЁ][а-яё]+(?:-[А-ЯЁ]?[а-яё]+)?\b", text): + add(match.group(0)) + + for match in re.finditer(r"\b[А-ЯЁ][а-яё]+(?:\s+[А-ЯЁ][а-яё]+){1,2}\b", text): + phrase = " ".join(word for word in match.group(0).split() if word not in TAG_STOPWORDS) + if phrase and len(phrase) <= 60: + add(phrase) + + tags = tags[:limit] + if not tags: + return None + result = ", ".join(tags) + return result[:1000] + + +def build_sig(params: dict[str, Any], session_secret_key: str) -> str: + signable = { + key: value + for key, value in params.items() + if key not in {"access_token", "sig"} and value is not None + } + payload = "".join(f"{key}={signable[key]}" for key in sorted(signable)) + return hashlib.md5(f"{payload}{session_secret_key}".encode("utf-8")).hexdigest() + + +def call_ok(settings: Settings, method: str, params: dict[str, Any] | None = None) -> dict[str, Any]: + if not settings.ok_access_token or not settings.ok_session_secret_key or not settings.ok_public_key: + raise OkApiError("OK credentials are not configured") + + request_params: dict[str, Any] = { + "application_key": settings.ok_public_key, + "format": "json", + "method": method, + "access_token": settings.ok_access_token, + } + request_params.update(params or {}) + request_params["sig"] = build_sig(request_params, settings.ok_session_secret_key) + + with httpx.Client(timeout=60) as client: + response = client.post(OK_API_URL, data=request_params) + response.raise_for_status() + if not response.text.strip(): + return {} + data = response.json() + if isinstance(data, dict) and data.get("error_code"): + raise OkApiError(json.dumps(data, ensure_ascii=False)) + return data + + +def upload_photo_to_group(settings: Settings, image_path: Path) -> str: + if not settings.ok_group_id: + raise OkApiError("OK_GROUP_ID is not configured") + + upload_data = call_ok(settings, "photosV2.getUploadUrl", {"gid": settings.ok_group_id, "count": 1}) + upload_url = upload_data.get("upload_url") + if not upload_url: + raise OkApiError(f"OK photo upload_url is missing: {upload_data}") + + with image_path.open("rb") as image_file: + files = {"pic1": (image_path.name, image_file, "image/jpeg")} + with httpx.Client(timeout=120) as client: + response = client.post(upload_url, files=files) + response.raise_for_status() + result = response.json() + + photos = result.get("photos") + if isinstance(photos, dict): + for photo_data in photos.values(): + if isinstance(photo_data, dict) and photo_data.get("token"): + return str(photo_data["token"]) + + token = result.get("token") or result.get("photo_token") + if token: + return str(token) + + raise OkApiError(f"OK photo token is missing: {result}") + + +def upload_video_cover(settings: Settings, image_path: Path) -> tuple[str, str]: + upload_data = call_ok(settings, "photosV2.getUploadUrl", {"count": 1}) + upload_url = upload_data.get("upload_url") + photo_ids = upload_data.get("photo_ids") or [] + photo_id = str(photo_ids[0]) if photo_ids else "" + if not upload_url or not photo_id: + raise OkApiError(f"OK cover upload data is missing: {upload_data}") + + with image_path.open("rb") as image_file: + files = {"pic1": (image_path.name, image_file, "image/jpeg")} + with httpx.Client(timeout=120) as client: + response = client.post(upload_url, files=files) + response.raise_for_status() + result = response.json() + photo_data = (result.get("photos") or {}).get(photo_id) or {} + token = photo_data.get("token") + if not token: + raise OkApiError(f"OK cover token is missing: {result}") + return photo_id, str(token) + + +def upload_video_to_group( + settings: Settings, + video_path: Path, + title: str | None, + description: str | None = None, + cover_path: Path | None = None, + publish_to_group_video: bool = True, +) -> str: + if publish_to_group_video and not settings.ok_group_id: + raise OkApiError("OK_GROUP_ID is not configured") + + upload_params: dict[str, Any] = { + "file_name": video_path.name, + "file_size": video_path.stat().st_size, + "post_form": "true", + } + if publish_to_group_video: + upload_params["gid"] = settings.ok_group_id + + upload_data = call_ok( + settings, + "video.getUploadUrl", + upload_params, + ) + upload_url = upload_data.get("upload_url") + video_id = upload_data.get("video_id") + if not upload_url or not video_id: + raise OkApiError(f"OK video upload data is missing: {upload_data}") + + with video_path.open("rb") as video_file: + files = {"data": (video_path.name, video_file, "video/mp4")} + with httpx.Client(timeout=3600) as client: + response = client.post(upload_url, files=files) + response.raise_for_status() + + update_params: dict[str, Any] = { + "vid": video_id, + "title": (title or video_path.stem)[:1000], + } + if description: + update_params["description"] = description[:4000] + tags = build_video_tags(title, description) + if tags: + update_params["tags"] = tags + if cover_path and cover_path.exists(): + cover_photo_id, cover_token = upload_video_cover(settings, cover_path) + update_params["cover_photo_id"] = cover_photo_id + update_params["cover_photo_upload_token"] = cover_token + call_ok(settings, "video.update", update_params) + return str(video_id) + + +def upload_moment_photo(settings: Settings, image_path: Path) -> tuple[str, str]: + upload_data = call_ok(settings, "moments.getUploadUrl", {"type": "PHOTO"}) + upload_url = upload_data.get("upload_url") + if not upload_url: + raise OkApiError(f"OK moment upload_url is missing: {upload_data}") + + with image_path.open("rb") as image_file: + files = {"pic1": (image_path.name, image_file, "image/jpeg")} + with httpx.Client(timeout=120) as client: + response = client.post(upload_url, files=files) + response.raise_for_status() + result = response.json() + + photos = result.get("photos") + if isinstance(photos, dict): + for photo_id, photo_data in photos.items(): + if isinstance(photo_data, dict) and photo_data.get("token"): + return str(photo_id), str(photo_data["token"]) + + raise OkApiError(f"OK moment photo token is missing: {result}") + + +def commit_group_moment(settings: Settings, photo_id: str, token: str) -> dict[str, Any]: + if not settings.ok_group_id: + raise OkApiError("OK_GROUP_ID is not configured") + + photo_items = [{"photo_id": photo_id, "token": token}] + params = { + "photos": json.dumps(photo_items, ensure_ascii=False), + "owner_ref": f"group:{settings.ok_group_id}", + } + try: + return call_ok(settings, "moments.commit", params) + except OkApiError: + params["photos"] = json.dumps({"photos": photo_items}, ensure_ascii=False) + return call_ok(settings, "moments.commit", params) + + +def post_group_mediatopic(settings: Settings, attachment: dict[str, Any]) -> dict[str, Any]: + if not settings.ok_group_id: + raise OkApiError("OK_GROUP_ID is not configured") + + return call_ok( + settings, + "mediatopic.post", + { + "type": "GROUP_THEME", + "gid": settings.ok_group_id, + "attachment": json.dumps(attachment, ensure_ascii=False), + }, + ) + + +def edit_mediatopic(settings: Settings, topic_id: str, attachment: dict[str, Any]) -> dict[str, Any]: + return call_ok( + settings, + "mediatopic.edit", + { + "topic_id": topic_id, + "attachment": json.dumps(attachment, ensure_ascii=False), + }, + ) diff --git a/app/routes.py b/app/routes.py new file mode 100644 index 0000000..65eb221 --- /dev/null +++ b/app/routes.py @@ -0,0 +1,51 @@ +import json + +from fastapi import APIRouter, Depends, HTTPException, Request +from fastapi.responses import PlainTextResponse +from sqlalchemy.orm import Session + +from app.config import Settings, get_settings +from app.database import get_session +from app.models import VkEvent +from app.worker import process_vk_event + +router = APIRouter() + + +@router.get("/health") +def health() -> dict[str, str]: + return {"status": "ok"} + + +@router.post("/webhook", response_class=PlainTextResponse) +async def vk_webhook( + request: Request, + session: Session = Depends(get_session), + settings: Settings = Depends(get_settings), +) -> PlainTextResponse: + payload = await request.json() + event_type = str(payload.get("type", "")) + group_id = str(payload.get("group_id", "")) + + if event_type == "confirmation": + if group_id != settings.vk_group_id: + raise HTTPException(status_code=403, detail="Unexpected VK group") + return PlainTextResponse(settings.vk_confirmation_code) + + if payload.get("secret") != settings.vk_secret: + raise HTTPException(status_code=403, detail="Invalid VK secret") + + event = VkEvent( + event_id=str(payload.get("event_id") or ""), + event_type=event_type, + group_id=group_id, + raw_payload_json=json.dumps(payload, ensure_ascii=False), + ) + session.add(event) + session.commit() + + task = process_vk_event.delay(event.id) + event.status = "queued" + session.commit() + + return PlainTextResponse("ok", headers={"X-Celery-Task-Id": task.id}) diff --git a/app/worker.py b/app/worker.py new file mode 100644 index 0000000..310f6f1 --- /dev/null +++ b/app/worker.py @@ -0,0 +1,1362 @@ +import hashlib +import json +import logging +import re +import subprocess +import uuid +from datetime import datetime +from pathlib import Path + +import httpx +from celery import Celery +from PIL import Image, ImageDraw, ImageEnhance, ImageFilter, ImageFont, ImageOps +from sqlalchemy import select + +from app.config import get_settings +from app.database import SessionLocal, init_db +from app.models import Post, PostMedia, Video, VkEvent +from app.ok_api import ( + OkApiError, + commit_group_moment, + edit_mediatopic, + post_group_mediatopic, + upload_moment_photo, + upload_photo_to_group, + upload_video_to_group, +) + +logger = logging.getLogger(__name__) +settings = get_settings() +SCHOOL_APP_URL = "https://ok.ru/app/512004845113" +SCHOOL_APP_PHRASE = "мини-приложение Школы Геополитики" +REMOVED_HASHTAGS = {"#подкаст"} +VK_CLIP_TITLE = "Clip by @nstarikov_club" +MOMENT_WIDTH = 1080 +MOMENT_HEIGHT = 1920 + +celery_app = Celery( + "vk2ok", + broker=settings.celery_broker_url, + backend=settings.celery_result_backend, +) +celery_app.conf.beat_schedule = { + "recover-queued-work-every-minute": { + "task": "app.worker.recover_queued_work", + "schedule": 60.0, + }, +} + + +def build_vk_post_url(owner_id: str | int | None, post_id: str | int | None) -> str | None: + if owner_id is None or post_id is None: + return None + return f"https://vk.com/wall{owner_id}_{post_id}" + + +def extract_video_download_url(video: dict) -> str | None: + if video.get("player"): + return str(video["player"]) + owner_id = video.get("owner_id") + video_id = video.get("id") + access_key = video.get("access_key") + if owner_id is None or video_id is None: + return None + url = f"https://vk.com/video{owner_id}_{video_id}" + if access_key: + return f"{url}_{access_key}" + return url + + +def extract_video_public_url(video: dict) -> str | None: + owner_id = video.get("owner_id") + video_id = video.get("id") + if owner_id is None or video_id is None: + return None + return f"https://vk.com/video{owner_id}_{video_id}" + + +def extract_largest_image_url(items: list[dict]) -> str | None: + largest = max(items, key=lambda item: item.get("width", 0) * item.get("height", 0), default={}) + return largest.get("url") + + +def extract_video_identity(video: dict) -> str: + owner_id = video.get("owner_id") + video_id = video.get("id") + if owner_id is None or video_id is None: + return str(video.get("id") or "") + return f"{owner_id}_{video_id}" + + +def video_identity_candidates(video_id: str | None) -> list[str]: + if not video_id: + return [] + candidates = [video_id] + short_id = video_id.rsplit("_", 1)[-1] + if short_id and short_id != video_id: + candidates.append(short_id) + return candidates + + +def create_or_get_video(session, video_data: dict) -> Video: + video_url = extract_video_download_url(video_data) + vk_video_id = extract_video_identity(video_data) + existing_video = None + if vk_video_id: + existing_video = session.scalar( + select(Video) + .where(Video.vk_video_id.in_(video_identity_candidates(vk_video_id))) + .order_by(Video.ok_video_id.is_(None), Video.id.asc()) + ) + if not existing_video and video_url: + public_url = extract_video_public_url(video_data) + url_candidates = [candidate for candidate in {video_url, public_url} if candidate] + existing_video = session.scalar( + select(Video) + .where(Video.vk_video_url.in_(url_candidates)) + .order_by(Video.ok_video_id.is_(None), Video.id.asc()) + ) + if existing_video: + if vk_video_id and existing_video.vk_video_id != vk_video_id: + existing_video.vk_video_id = vk_video_id + if video_url and not existing_video.vk_video_url: + existing_video.vk_video_url = video_url + existing_video.title = existing_video.title or video_data.get("title") + existing_video.description = existing_video.description or video_data.get("description") + return existing_video + + video = Video( + vk_video_id=vk_video_id, + vk_video_url=video_url or "", + title=video_data.get("title"), + description=video_data.get("description"), + status="pending", + ) + session.add(video) + session.flush() + return video + + +def queue_task(task, args: list, queue: str) -> None: + task.delay(*args) + + +def download_file(url: str, target_path: Path) -> None: + target_path.parent.mkdir(parents=True, exist_ok=True) + with httpx.Client(follow_redirects=True, timeout=120) as client: + response = client.get(url) + response.raise_for_status() + target_path.write_bytes(response.content) + + +def normalize_vk_link_markup(match: re.Match[str]) -> str: + parts = [part.strip() for part in match.group(1).split("|") if part.strip()] + if not parts: + return "" + + for part in reversed(parts): + if part.startswith(("http://", "https://")): + return part + + return parts[-1] + + +def normalize_post_text(text: str) -> str: + normalized = re.sub(r"\[([^\[\]\n]+?\|[^\[\]\n]+?)\]", normalize_vk_link_markup, text) + normalized = re.sub(r"(? str: + video_ids: list[str] = [] + photo_ids: list[str] = [] + for attachment in attachments: + attachment_type = attachment.get("type") + data = attachment.get(attachment_type) or {} + if attachment_type == "video": + video_id = extract_video_identity(data) + if video_id: + video_ids.append(video_id.rsplit("_", 1)[-1]) + elif attachment_type == "photo": + owner_id = data.get("owner_id") + photo_id = data.get("id") + if owner_id is not None and photo_id is not None: + photo_ids.append(f"{owner_id}_{photo_id}") + + if video_ids: + return "video:" + ",".join(sorted(set(video_ids))) + if photo_ids: + return "photo:" + ",".join(sorted(set(photo_ids))) + + normalized = re.sub(r"\s+", " ", normalize_post_text(text)).strip().lower() + if not normalized: + return "" + digest = hashlib.sha256(normalized.encode("utf-8")).hexdigest()[:32] + return "text:" + digest + + +def append_video_links(text: str, media_items: list[PostMedia]) -> str: + video_urls = [item.source_url for item in media_items if item.media_type == "video" and item.source_url] + normalized_text = normalize_post_text(text) + if not video_urls: + return normalized_text + lines = [normalized_text] if normalized_text else [] + lines.extend(str(url) for url in video_urls) + return "\n\n".join(lines) + + +def build_text_media(text: str) -> dict: + normalized_text = text.strip() + return {"type": "text", "text": normalized_text} + + +def build_bold_text_media(text: str) -> dict: + normalized_text = text.strip() + return { + "type": "text", + "text": "", + "text_tokens": [ + {"text": normalized_text, "font_styles": ["bold"]}, + ], + } + + +def split_text_media_blocks(text: str) -> list[dict]: + blocks: list[dict] = [] + buffer: list[str] = [] + lines = text.splitlines() + title_line_index = None + for index, line in enumerate(lines[:-1]): + stripped = line.strip() + if not stripped: + continue + if lines[index + 1].strip() == "" and not stripped.startswith(("http://", "https://", "#")): + title_line_index = index + break + + def flush_buffer() -> None: + normalized_buffer = "\n".join(buffer).strip() + if normalized_buffer: + blocks.append(build_text_media(normalized_buffer)) + buffer.clear() + + for index, line in enumerate(lines): + stripped = line.strip() + if stripped.lower() in REMOVED_HASHTAGS: + continue + if index == title_line_index: + flush_buffer() + blocks.append(build_bold_text_media(stripped)) + continue + if stripped.startswith(("http://", "https://", "#")): + flush_buffer() + blocks.append(build_text_media(stripped)) + continue + buffer.append(line) + + flush_buffer() + return blocks + + +def build_school_quote_media() -> dict: + return { + "type": "text", + "text": "", + "text_tokens": [ + {"text": "│ Хотите знать больше? Открывайте "}, + {"text": SCHOOL_APP_PHRASE, "link": SCHOOL_APP_URL}, + {"text": "!"}, + ], + } + + +def video_media_items(media_items: list[PostMedia]) -> list[dict]: + video_ids = [item.ok_media_id for item in media_items if item.media_type == "video" and item.ok_media_id] + if not video_ids: + return [] + return [{"type": "movie", "list": [{"id": video_id} for video_id in video_ids]}] + + +def video_for_media(session, media: PostMedia) -> Video | None: + if media.media_type != "video": + return None + if media.vk_attachment_id: + video = session.scalar( + select(Video) + .where(Video.vk_video_id.in_(video_identity_candidates(media.vk_attachment_id))) + .order_by(Video.ok_video_id.is_(None), Video.id.asc()) + ) + if video: + return video + if media.source_url: + return session.scalar( + select(Video) + .where(Video.vk_video_url == media.source_url) + .order_by(Video.ok_video_id.is_(None), Video.id.asc()) + ) + return None + + +def duplicate_video_query(session, video: Video): + candidates = video_identity_candidates(video.vk_video_id) + conditions = [] + if candidates: + conditions.append(Video.vk_video_id.in_(candidates)) + if video.vk_video_url: + conditions.append(Video.vk_video_url == video.vk_video_url) + if not conditions: + return session.query(Video).filter(Video.id == video.id) + condition = conditions[0] + for next_condition in conditions[1:]: + condition = condition | next_condition + return session.query(Video).filter(condition) + + +def canonical_video_for_upload(session, video: Video) -> Video: + return ( + duplicate_video_query(session, video) + .order_by( + Video.ok_video_id.is_(None), + Video.upload_lock.is_(None), + Video.id.asc(), + ) + .first() + or video + ) + + +def attach_ok_video_to_duplicate_rows(session, video: Video, ok_video_id: str) -> set[int]: + waiting_posts: set[int] = set() + videos = duplicate_video_query(session, video).all() + for duplicate in videos: + duplicate.ok_video_id = duplicate.ok_video_id or ok_video_id + duplicate.status = "ok_uploaded" + duplicate.upload_lock = None + + candidate_ids: set[str] = set() + for duplicate in videos: + candidate_ids.update(video_identity_candidates(duplicate.vk_video_id)) + if duplicate.vk_video_url: + candidate_ids.add(duplicate.vk_video_url) + + if not candidate_ids: + return waiting_posts + + media_rows = session.scalars( + select(PostMedia).where( + PostMedia.media_type == "video", + ( + PostMedia.vk_attachment_id.in_(candidate_ids) + | PostMedia.source_url.in_(candidate_ids) + ), + ) + ).all() + for media in media_rows: + media.ok_media_id = ok_video_id + media.status = "uploaded" + if media.post and media.post.status in {"waiting_video", "queued", "ok_publish_pending"}: + waiting_posts.add(media.post_id) + return waiting_posts + + +def queue_video_if_needed(video: Video) -> None: + if video.ok_video_id: + return + if video.upload_lock: + return + if video.status in {"pending", "vk_link_only"}: + download_vk_video.delay(video.id) + elif video.status == "downloaded": + upload_video_to_ok.delay(video.id) + + +def should_publish_to_group_video(video: Video) -> bool: + return (video.title or "").strip() != VK_CLIP_TITLE + + +def all_post_videos_ready(session, media_items: list[PostMedia]) -> bool: + for item in media_items: + if item.media_type != "video": + continue + if item.ok_media_id: + continue + video = video_for_media(session, item) + if video and video.ok_video_id: + item.ok_media_id = video.ok_video_id + item.status = "uploaded" + continue + if video: + queue_video_if_needed(video) + return False + return True + + +def normalize_video_match_text(value: str | None) -> str: + return re.sub(r"\s+", " ", (value or "").casefold()).strip() + + +def uploaded_video_fallback(session, video: Video) -> Video | None: + description = normalize_video_match_text(video.description) + title = normalize_video_match_text(video.title) + candidates = ( + session.query(Video) + .filter( + Video.id != video.id, + Video.ok_video_id.is_not(None), + Video.status == "ok_uploaded", + ) + .order_by(Video.id.desc()) + .limit(100) + .all() + ) + for candidate in candidates: + candidate_description = normalize_video_match_text(candidate.description) + if len(description) >= 160 and candidate_description[:160] == description[:160]: + return candidate + candidate_title = normalize_video_match_text(candidate.title) + if len(title) >= 80 and candidate_title[:80] == title[:80]: + return candidate + return None + + +def apply_uploaded_video_fallbacks(session, media_items: list[PostMedia]) -> None: + for item in media_items: + if item.media_type != "video" or item.ok_media_id: + continue + video = video_for_media(session, item) + if not video or video.ok_video_id: + continue + fallback = uploaded_video_fallback(session, video) + if not fallback or not fallback.ok_video_id: + continue + attach_ok_video_to_duplicate_rows(session, video, fallback.ok_video_id) + item.ok_media_id = fallback.ok_video_id + item.status = "uploaded" + + +def failed_post_video_message(session, media_items: list[PostMedia]) -> str | None: + for item in media_items: + if item.media_type != "video" or item.ok_media_id: + continue + video = video_for_media(session, item) + if video and video.status == "failed": + detail = video.error_message or video.title or video.vk_video_id or "unknown video" + return f"Video failed before OK upload: {detail}"[-4000:] + return None + + +def format_duration(seconds: int | None) -> str | None: + if seconds is None or seconds <= 0: + return None + minutes, remainder = divmod(int(seconds), 60) + hours, minutes = divmod(minutes, 60) + if hours: + return f"{hours}:{minutes:02d}:{remainder:02d}" + return f"{minutes}:{remainder:02d}" + + +def video_duration_seconds(media_items: list[PostMedia]) -> int | None: + for item in media_items: + if item.media_type == "video" and item.duration_seconds: + return item.duration_seconds + return None + + +def extract_video_playlist_title(video: dict) -> str | None: + for key in ("playlist", "album"): + value = video.get(key) + if isinstance(value, dict) and value.get("title"): + return str(value["title"]).strip() + if isinstance(value, str) and value.strip(): + return value.strip() + + for key in ("playlist_title", "album_title", "category_name", "section_title"): + value = video.get(key) + if isinstance(value, str) and value.strip(): + return value.strip() + return None + + +def video_playlist_title(media_items: list[PostMedia]) -> str | None: + for item in media_items: + if item.media_type == "video" and item.playlist_title: + return item.playlist_title + return None + + +def font(size: int, bold: bool = False, serif: bool = False, italic: bool = False) -> ImageFont.FreeTypeFont: + if serif: + linux_name = "DejaVuSerif-BoldItalic.ttf" if bold and italic else "DejaVuSerif-Bold.ttf" if bold else "DejaVuSerif-Italic.ttf" if italic else "DejaVuSerif.ttf" + mac_name = "Times New Roman Bold Italic.ttf" if bold and italic else "Times New Roman Bold.ttf" if bold else "Times New Roman Italic.ttf" if italic else "Times New Roman.ttf" + candidates = [ + f"/usr/share/fonts/truetype/dejavu/{linux_name}", + f"/System/Library/Fonts/Supplemental/{mac_name}", + "/Library/Fonts/Georgia.ttf", + ] + for candidate in candidates: + if Path(candidate).exists(): + return ImageFont.truetype(candidate, size=size) + + candidates = [ + "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" if bold else "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", + "/System/Library/Fonts/Supplemental/Arial Bold.ttf" if bold else "/System/Library/Fonts/Supplemental/Arial.ttf", + "/Library/Fonts/Arial Unicode.ttf", + ] + for candidate in candidates: + if Path(candidate).exists(): + return ImageFont.truetype(candidate, size=size) + return ImageFont.load_default() + + +def text_width(draw: ImageDraw.ImageDraw, text: str, text_font: ImageFont.ImageFont) -> int: + box = draw.textbbox((0, 0), text, font=text_font) + return box[2] - box[0] + + +def wrap_text(draw: ImageDraw.ImageDraw, text: str, text_font: ImageFont.ImageFont, max_width: int) -> list[str]: + lines: list[str] = [] + for paragraph in text.splitlines(): + words = paragraph.split() + if not words: + lines.append("") + continue + current = words[0] + for word in words[1:]: + candidate = f"{current} {word}" + if text_width(draw, candidate, text_font) <= max_width: + current = candidate + else: + lines.append(current) + current = word + lines.append(current) + return lines + + +def truncate_to_width(draw: ImageDraw.ImageDraw, text: str, text_font: ImageFont.ImageFont, max_width: int) -> str: + if text_width(draw, text, text_font) <= max_width: + return text + suffix = "..." + trimmed = text + while trimmed and text_width(draw, f"{trimmed}{suffix}", text_font) > max_width: + trimmed = trimmed[:-1].rstrip() + return f"{trimmed}{suffix}" if trimmed else suffix + + +def first_content_image_url(media_items: list[PostMedia]) -> str | None: + for item in media_items: + if item.media_type == "photo" and item.source_url: + return item.source_url + if item.media_type == "video" and item.local_cover_path: + return item.local_cover_path + if item.media_type == "video" and item.source_url: + preview_url = fetch_page_preview_image(item.source_url) + if preview_url: + return preview_url + return None + + +def fetch_page_preview_image(url: str) -> str | None: + try: + with httpx.Client(follow_redirects=True, timeout=20) as client: + response = client.get(url, headers={"User-Agent": "Mozilla/5.0"}) + response.raise_for_status() + except Exception: + return None + + match = re.search(r' int: + x, y = xy + lines = wrap_text(draw, text, text_font, max_width) + if max_lines and len(lines) > max_lines: + lines = lines[:max_lines] + if lines: + lines[-1] = lines[-1].rstrip(".,;: ") + "..." + for line in lines: + draw.text((x, y), line, font=text_font, fill=fill) + box = draw.textbbox((x, y), line or " ", font=text_font) + y += box[3] - box[1] + line_gap + return y + + +def wrapped_text_lines( + draw: ImageDraw.ImageDraw, + text: str, + text_font: ImageFont.ImageFont, + max_width: int, + max_lines: int | None = None, +) -> list[str]: + lines = wrap_text(draw, text, text_font, max_width) + if max_lines and len(lines) > max_lines: + lines = lines[:max_lines] + if lines: + lines[-1] = lines[-1].rstrip(".,;: ") + "..." + return lines + + +def wrapped_text_height( + draw: ImageDraw.ImageDraw, + lines: list[str], + text_font: ImageFont.ImageFont, + line_gap: int, +) -> int: + height = 0 + for line in lines: + box = draw.textbbox((0, 0), line or " ", font=text_font) + height += box[3] - box[1] + line_gap + return max(0, height - line_gap) + + +def rounded_image(image: Image.Image, size: tuple[int, int], radius: int) -> Image.Image: + image = ImageOps.fit(image.convert("RGB"), size, method=Image.Resampling.LANCZOS, centering=(0.5, 0.5)) + mask = Image.new("L", size, 0) + mask_draw = ImageDraw.Draw(mask) + mask_draw.rounded_rectangle((0, 0, size[0], size[1]), radius=radius, fill=255) + image.putalpha(mask) + return image + + +def load_remote_image(url: str, target_path: Path) -> Image.Image | None: + try: + download_file(url, target_path) + return Image.open(target_path).convert("RGB") + except Exception: + logger.exception("Failed to load image for OK moment: %s", url) + return None + + +def moment_image_urls(media_items: list[PostMedia]) -> list[str]: + urls: list[str] = [] + for item in media_items: + if item.media_type == "video": + if item.local_cover_path: + urls.append(item.local_cover_path) + elif item.source_url: + preview_url = fetch_page_preview_image(item.source_url) + if preview_url: + urls.append(preview_url) + elif item.media_type == "photo" and item.source_url: + urls.append(item.source_url) + + unique_urls: list[str] = [] + for url in urls: + if url and url not in unique_urls: + unique_urls.append(url) + return unique_urls + + +def load_moment_images(urls: list[str], target_dir: Path) -> list[Image.Image]: + images: list[Image.Image] = [] + for index, url in enumerate(urls[:6]): + image = load_remote_image(url, target_dir / f"cover-{index + 1}.jpg") + if image: + images.append(image) + return images + + +def moment_base() -> Image.Image: + background = Image.new("RGB", (MOMENT_WIDTH, MOMENT_HEIGHT), "#0D141B") + draw = ImageDraw.Draw(background) + for y in range(MOMENT_HEIGHT): + ratio = y / MOMENT_HEIGHT + r = int(10 + 18 * ratio) + g = int(17 + 29 * ratio) + b = int(25 + 38 * ratio) + draw.line((0, y, MOMENT_WIDTH, y), fill=(r, g, b)) + return background.convert("RGBA") + + +def add_editorial_fade(image: Image.Image, bottom_start: int = 900, bottom_alpha: int = 220) -> Image.Image: + fade = Image.new("RGBA", (MOMENT_WIDTH, MOMENT_HEIGHT), (0, 0, 0, 0)) + fade_draw = ImageDraw.Draw(fade) + for y in range(MOMENT_HEIGHT): + if y < 220: + alpha = int(116 * (1 - y / 220)) + elif y > bottom_start: + alpha = int(min(bottom_alpha, (y - bottom_start) / (MOMENT_HEIGHT - bottom_start) * bottom_alpha)) + else: + alpha = 0 + if alpha: + fade_draw.line((0, y, MOMENT_WIDTH, y), fill=(3, 7, 10, alpha)) + return Image.alpha_composite(image.convert("RGBA"), fade) + + +def full_bleed_image(image: Image.Image) -> Image.Image: + cover = ImageOps.fit(image.convert("RGB"), (MOMENT_WIDTH, MOMENT_HEIGHT), method=Image.Resampling.LANCZOS) + cover = ImageEnhance.Contrast(cover).enhance(1.05) + return ImageEnhance.Color(cover).enhance(0.96).convert("RGBA") + + +def abstract_text_background() -> Image.Image: + background = moment_base() + draw = ImageDraw.Draw(background) + for radius in range(120, 1420, 150): + color = (220, 178, 91, max(8, 52 - radius // 42)) + draw.ellipse( + (MOMENT_WIDTH // 2 - radius, 470 - radius, MOMENT_WIDTH // 2 + radius, 470 + radius), + outline=color, + width=3, + ) + for x in range(-MOMENT_HEIGHT, MOMENT_WIDTH, 64): + draw.line((x, MOMENT_HEIGHT, x + MOMENT_HEIGHT, 0), fill=(230, 194, 112, 24), width=2) + return background + + +def paste_framed_image( + canvas: Image.Image, + image: Image.Image, + box: tuple[int, int, int, int], + radius: int = 28, + shadow: bool = True, +) -> None: + x1, y1, x2, y2 = box + size = (x2 - x1, y2 - y1) + if shadow: + shadow_layer = Image.new("RGBA", canvas.size, (0, 0, 0, 0)) + shadow_draw = ImageDraw.Draw(shadow_layer) + shadow_draw.rounded_rectangle((x1 + 14, y1 + 22, x2 + 14, y2 + 22), radius=radius, fill=(0, 0, 0, 118)) + shadow_layer = shadow_layer.filter(ImageFilter.GaussianBlur(20)) + canvas.alpha_composite(shadow_layer) + + framed = rounded_image(image, size, radius) + canvas.alpha_composite(framed, (x1, y1)) + + +def paste_contained_image( + canvas: Image.Image, + image: Image.Image, + box: tuple[int, int, int, int], + radius: int = 28, +) -> tuple[int, int, int, int]: + x1, y1, x2, y2 = box + max_size = (x2 - x1, y2 - y1) + contained = ImageOps.contain(image.convert("RGB"), max_size, method=Image.Resampling.LANCZOS) + image_x = x1 + (max_size[0] - contained.width) // 2 + image_y = y1 + (max_size[1] - contained.height) // 2 + image_box = (image_x, image_y, image_x + contained.width, image_y + contained.height) + paste_framed_image(canvas, contained, image_box, radius=radius) + return image_box + + +def build_video_background(image: Image.Image) -> tuple[Image.Image, tuple[int, int, int, int]]: + base = moment_base() + blurred = ImageOps.fit(image.convert("RGB"), (MOMENT_WIDTH, MOMENT_HEIGHT), method=Image.Resampling.LANCZOS) + blurred = blurred.filter(ImageFilter.GaussianBlur(32)) + blurred = ImageEnhance.Brightness(blurred).enhance(0.34) + blurred = ImageEnhance.Color(blurred).enhance(0.78).convert("RGBA") + base = Image.alpha_composite(base, blurred) + base = Image.alpha_composite(base, Image.new("RGBA", (MOMENT_WIDTH, MOMENT_HEIGHT), (5, 9, 12, 126))) + image_box = paste_contained_image(base, image, (62, 150, 1018, 920), radius=32) + return base, image_box + + +def build_gallery_background(images: list[Image.Image], total_count: int) -> Image.Image: + base = moment_base() + blurred = ImageOps.fit(images[0], (MOMENT_WIDTH, MOMENT_HEIGHT), method=Image.Resampling.LANCZOS) + blurred = blurred.filter(ImageFilter.GaussianBlur(36)) + blurred = ImageEnhance.Brightness(blurred).enhance(0.36).convert("RGBA") + base = Image.alpha_composite(base, blurred) + overlay = Image.new("RGBA", (MOMENT_WIDTH, MOMENT_HEIGHT), (5, 9, 12, 72)) + base = Image.alpha_composite(base, overlay) + + if len(images) <= 3: + paste_framed_image(base, images[0], (70, 150, 1010, 920), radius=34) + if len(images) > 1: + paste_framed_image(base, images[1], (90, 820, 525, 1170), radius=24) + if len(images) > 2: + paste_framed_image(base, images[2], (555, 820, 990, 1170), radius=24) + else: + paste_framed_image(base, images[0], (64, 132, 680, 820), radius=32) + paste_framed_image(base, images[1], (704, 178, 1016, 520), radius=24) + paste_framed_image(base, images[2], (704, 548, 1016, 890), radius=24) + paste_framed_image(base, images[3], (112, 860, 972, 1175), radius=28) + if total_count > 4: + draw = ImageDraw.Draw(base) + draw.rounded_rectangle((815, 1062, 965, 1128), radius=20, fill=(7, 12, 16, 176)) + draw.text((842, 1074), f"+{total_count - 4} фото", font=font(28, bold=True), fill="#F5E7C2") + return base + + +def draw_clock_icon(draw: ImageDraw.ImageDraw, center: tuple[int, int], color: str) -> None: + x, y = center + radius = 11 + draw.ellipse((x - radius, y - radius, x + radius, y + radius), outline=color, width=3) + draw.line((x, y, x, y - 7), fill=color, width=3) + draw.line((x, y, x + 6, y + 4), fill=color, width=3) + + +def draw_moment_text( + canvas: Image.Image, + title: str, + body: str, + text_top: int, + title_lines: int = 4, + body_lines: int = 5, + badges: list[str] | None = None, +) -> None: + draw = ImageDraw.Draw(canvas) + margin = 74 + content_width = MOMENT_WIDTH - margin * 2 + rule_top = text_top - 34 + title_font = font(64, serif=True) + body_font = font(35, serif=True) + title_gap = 16 + body_gap = 12 + title_text_lines = wrapped_text_lines(draw, title, title_font, content_width, title_lines) + body_text_lines = wrapped_text_lines(draw, body, body_font, content_width, body_lines) if body else [] + title_height = wrapped_text_height(draw, title_text_lines, title_font, title_gap) + body_height = wrapped_text_height(draw, body_text_lines, body_font, body_gap) if body_text_lines else 0 + text_bottom = text_top + title_height + (30 + body_height if body_text_lines else 0) + panel_padding_x = 28 + panel_padding_y = 26 + panel_top = rule_top - panel_padding_y + panel_bottom = min(MOMENT_HEIGHT - 96, text_bottom + panel_padding_y) + panel_layer = Image.new("RGBA", (MOMENT_WIDTH, MOMENT_HEIGHT), (0, 0, 0, 0)) + panel_draw = ImageDraw.Draw(panel_layer) + panel_draw.rounded_rectangle( + ( + margin - panel_padding_x, + panel_top, + MOMENT_WIDTH - margin + panel_padding_x, + panel_bottom, + ), + radius=30, + fill=(0, 0, 0, 102), + ) + panel_layer = panel_layer.filter(ImageFilter.GaussianBlur(0.6)) + canvas.alpha_composite(panel_layer) + draw = ImageDraw.Draw(canvas) + + badge_x = margin + badge_y = rule_top - 62 + for index, badge in enumerate(badges or []): + badge_font = font(25, bold=True) + has_clock = index == 1 + max_badge_width = MOMENT_WIDTH - margin - badge_x + label = truncate_to_width(draw, badge, badge_font, max_badge_width - (62 if has_clock else 32)) + badge_width = text_width(draw, label, badge_font) + (62 if has_clock else 32) + if index == 0: + fill = (238, 192, 88, 236) + outline = None + text_fill = "#10161C" + else: + fill = (9, 14, 18, 180) + outline = (238, 192, 88, 170) + text_fill = "#F5E7C2" + draw.rounded_rectangle( + (badge_x, badge_y, badge_x + badge_width, badge_y + 40), + radius=16, + fill=fill, + outline=outline, + width=1, + ) + text_x = badge_x + 16 + if has_clock: + draw_clock_icon(draw, (badge_x + 26, badge_y + 20), "#F5E7C2") + text_x = badge_x + 46 + draw.text((text_x, badge_y + 7), label, font=badge_font, fill=text_fill) + badge_x += badge_width + 14 + draw.line((margin, rule_top + 4, MOMENT_WIDTH - margin, rule_top + 4), fill=(238, 192, 88, 92), width=2) + y = text_top + for line in title_text_lines: + draw.text((margin, y), line, font=title_font, fill="#F6F0E7") + box = draw.textbbox((margin, y), line or " ", font=title_font) + y += box[3] - box[1] + title_gap + if body_text_lines: + y += 30 + for line in body_text_lines: + draw.text((margin, y), line, font=body_font, fill="#EEE2D1") + box = draw.textbbox((margin, y), line or " ", font=body_font) + y += box[3] - box[1] + body_gap + + +def create_moment_card(post: Post, media_items: list[PostMedia]) -> Path: + target_path = Path(settings.storage_dir) / "moments" / str(post.id) / "miniapp.jpg" + target_path.parent.mkdir(parents=True, exist_ok=True) + + normalized_post_text = normalize_post_text(post.text) + title = normalized_post_text.splitlines()[0].strip() if normalized_post_text else "Школа Геополитики" + body = normalized_post_text + if body.startswith(title): + body = body[len(title):].strip() + + has_video = any(item.media_type == "video" for item in media_items) + video_duration = format_duration(video_duration_seconds(media_items)) + playlist_title = video_playlist_title(media_items) + video_badges = ["ВИДЕО"] + ([video_duration] if video_duration else []) + ([playlist_title] if playlist_title else []) + image_urls = moment_image_urls(media_items) + images = load_moment_images(image_urls, target_path.parent) + + if not images: + background = abstract_text_background() + background = add_editorial_fade(background, bottom_start=760, bottom_alpha=190) + draw_moment_text(background, title, body, text_top=760, title_lines=5, body_lines=8) + elif has_video: + background, video_box = build_video_background(images[0]) + background = add_editorial_fade(background, bottom_start=930, bottom_alpha=224) + draw_moment_text(background, title, body, text_top=1065, title_lines=4, body_lines=5, badges=video_badges) + elif len(images) == 1: + background = full_bleed_image(images[0]) + background = add_editorial_fade(background, bottom_start=900, bottom_alpha=224) + draw_moment_text(background, title, body, text_top=1110, title_lines=4, body_lines=5) + else: + background = build_gallery_background(images, len(image_urls)) + background = add_editorial_fade(background, bottom_start=990, bottom_alpha=222) + draw_moment_text(background, title, body, text_top=1235, title_lines=3, body_lines=4) + + background.convert("RGB").save(target_path, "JPEG", quality=94, optimize=True) + return target_path + + +def publish_moment_for_post(post: Post, media_items: list[PostMedia]) -> dict: + image_path = create_moment_card(post, media_items) + photo_id, token = upload_moment_photo(settings, image_path) + return commit_group_moment(settings, photo_id, token) + + +def topic_id_from_result(result) -> str: + if isinstance(result, dict): + return str(result.get("id") or result.get("topic_id") or result.get("media_topic_id") or result) + return str(result) + + +@celery_app.task(bind=True, autoretry_for=(Exception,), retry_backoff=True, retry_kwargs={"max_retries": 3}) +def process_vk_event(self, event_id: int) -> str: + init_db() + with SessionLocal() as session: + event = session.get(VkEvent, event_id) + if event is None: + return "missing" + + payload = json.loads(event.raw_payload_json) + obj = payload.get("object") or {} + if event.event_type == "video_new": + video = create_or_get_video(session, obj) + event.status = "processed" + event.processed_at = datetime.utcnow() + session.commit() + queue_video_if_needed(video) + return "processed" + + if event.event_type not in {"wall_post_new", "wall_repost"}: + event.status = "ignored" + event.processed_at = datetime.utcnow() + session.commit() + return "ignored" + + vk_group_id = str(payload.get("group_id") or settings.vk_group_id) + vk_post_id = str(obj.get("id") or obj.get("post_id") or "") + owner_id = obj.get("owner_id") or f"-{vk_group_id}" + + if not vk_post_id: + event.status = "failed" + event.error_message = "VK post id is missing" + session.commit() + return "failed" + + existing_post = session.scalar( + select(Post).where(Post.vk_group_id == vk_group_id, Post.vk_post_id == vk_post_id) + ) + if existing_post: + event.status = "duplicate" + event.processed_at = datetime.utcnow() + session.commit() + return "duplicate" + + attachments = obj.get("attachments") or [] + content_key = build_post_content_key(str(obj.get("text") or ""), attachments) + if content_key and content_key.startswith("video:"): + existing_content_post = session.scalar( + select(Post) + .where( + Post.vk_group_id == vk_group_id, + Post.content_key == content_key, + Post.status.notin_(["failed", "skipped", "duplicate"]), + ) + .order_by(Post.id.desc()) + ) + if existing_content_post: + event.status = "duplicate" + event.error_message = ( + f"Duplicate content_key={content_key}; " + f"existing_post_id={existing_content_post.id}; " + f"existing_ok_topic_id={existing_content_post.ok_topic_id}" + ) + event.processed_at = datetime.utcnow() + session.commit() + return "duplicate" + + post = Post( + vk_group_id=vk_group_id, + vk_post_id=vk_post_id, + vk_post_url=build_vk_post_url(owner_id, vk_post_id), + text=str(obj.get("text") or ""), + content_key=content_key or None, + ) + session.add(post) + session.flush() + + created_media: list[PostMedia] = [] + for index, attachment in enumerate(attachments): + attachment_type = attachment.get("type") + data = attachment.get(attachment_type) or {} + media = PostMedia( + post_id=post.id, + media_type=str(attachment_type or "unknown"), + vk_attachment_id=str(data.get("id") or ""), + sort_order=index, + ) + + if attachment_type == "video": + media.vk_attachment_id = extract_video_identity(data) + video_url = extract_video_public_url(data) + media.source_url = video_url + media.local_cover_path = extract_largest_image_url(data.get("image") or []) + media.duration_seconds = data.get("duration") + media.playlist_title = extract_video_playlist_title(data) + video = create_or_get_video(session, data) + if not video.description and post.text: + video.description = post.text + if video.ok_video_id: + media.ok_media_id = video.ok_video_id + media.status = "uploaded" + + if attachment_type == "photo": + media.source_url = extract_largest_image_url(data.get("sizes") or []) + + session.add(media) + created_media.append(media) + + media_items = sorted(created_media, key=lambda item: item.sort_order) + if all_post_videos_ready(session, media_items): + post.status = "queued" + should_publish = True + else: + post.status = "waiting_video" + should_publish = False + event.status = "processed" + event.processed_at = datetime.utcnow() + session.commit() + if should_publish: + publish_post_to_ok.delay(post.id) + return "processed" + + +@celery_app.task(bind=True, autoretry_for=(Exception,), retry_backoff=True, retry_kwargs={"max_retries": 2}) +def download_vk_video(self, video_id: int) -> str: + init_db() + with SessionLocal() as session: + video = session.get(Video, video_id) + if video is None or not video.vk_video_url: + return "missing" + if video.ok_video_id: + return "uploaded" + if video.local_video_path and Path(video.local_video_path).exists(): + if video.status != "downloaded": + video.status = "downloaded" + session.commit() + upload_video_to_ok.delay(video.id) + return "downloaded" + + target_dir = settings.storage_path / "vk" / str(video.id) + target_dir.mkdir(parents=True, exist_ok=True) + output_template = str(target_dir / "%(id)s.%(ext)s") + command = [ + "yt-dlp", + "--write-thumbnail", + "--convert-thumbnails", + "jpg", + "--write-info-json", + "--write-description", + "--no-playlist", + "-f", + "bv*+ba/b", + "--merge-output-format", + "mp4", + "-o", + output_template, + ] + cookies_path = Path(settings.ytdlp_cookies_path) + if cookies_path.exists(): + command.extend(["--cookies", str(cookies_path)]) + command.append(video.vk_video_url) + + video.status = "downloading" + session.commit() + result = subprocess.run(command, capture_output=True, text=True, check=False, timeout=3600) + if result.returncode != 0: + video.status = "failed" + video.error_message = result.stderr[-4000:] + session.commit() + raise RuntimeError(result.stderr) + + mp4_files = sorted(target_dir.glob("*.mp4")) + jpg_files = sorted(target_dir.glob("*.jpg")) + video.local_video_path = str(mp4_files[0]) if mp4_files else None + video.local_cover_path = str(jpg_files[0]) if jpg_files else None + video.status = "downloaded" + session.commit() + upload_video_to_ok.delay(video.id) + return "downloaded" + + +@celery_app.task(bind=True, autoretry_for=(Exception,), retry_backoff=True, retry_kwargs={"max_retries": 2}) +def upload_video_to_ok(self, video_id: int) -> str: + init_db() + with SessionLocal() as session: + video = session.get(Video, video_id) + if video is None: + return "missing" + if video.ok_video_id: + return "uploaded" + canonical_video = canonical_video_for_upload(session, video) + if canonical_video.id != video.id: + if canonical_video.ok_video_id: + waiting_posts = attach_ok_video_to_duplicate_rows(session, canonical_video, canonical_video.ok_video_id) + session.commit() + for post_id in waiting_posts: + publish_post_to_ok.delay(post_id) + return "reused_duplicate" + queue_video_if_needed(canonical_video) + return "duplicate_waiting" + + lock_id = str(uuid.uuid4()) + locked = session.query(Video).filter( + Video.id == video_id, + Video.ok_video_id.is_(None), + Video.upload_lock.is_(None), + ).update( + { + Video.upload_lock: lock_id, + Video.status: "ok_uploading", + Video.error_message: None, + }, + synchronize_session=False, + ) + session.commit() + if not locked: + return "upload_locked" + video = session.get(Video, video_id) + if video is not None: + session.refresh(video) + if video is None or video.upload_lock != lock_id or video.ok_video_id: + return "upload_locked" + if not video.local_video_path: + video.status = "pending" + video.upload_lock = None + session.commit() + download_vk_video.delay(video.id) + return "download_queued" + + video_path = Path(video.local_video_path) + if not video_path.exists(): + video.status = "pending" + video.error_message = f"Local video file is missing: {video.local_video_path}" + video.upload_lock = None + session.commit() + download_vk_video.delay(video.id) + return "download_queued" + + try: + cover_path = Path(video.local_cover_path) if video.local_cover_path else None + ok_video_id = upload_video_to_group( + settings, + video_path, + video.title, + video.description, + cover_path=cover_path, + publish_to_group_video=should_publish_to_group_video(video), + ) + except Exception as exc: + video.status = "failed" + video.error_message = str(exc) + video.upload_lock = None + session.commit() + raise + + video.ok_video_id = ok_video_id + video.upload_lock = None + video.status = "ok_uploaded" + + waiting_posts = attach_ok_video_to_duplicate_rows(session, video, ok_video_id) + + session.commit() + + for post_id in waiting_posts: + publish_post_to_ok.delay(post_id) + return "uploaded" + + +@celery_app.task(bind=True) +def publish_post_to_ok(self, post_id: int) -> str: + init_db() + with SessionLocal() as session: + post = session.get(Post, post_id) + if post is None: + return "missing" + if post.ok_topic_id: + return "already_published" + if post.status in {"published", "published_edit_failed", "moment_failed"}: + return "already_published" + lock_id = str(uuid.uuid4()) + locked = session.query(Post).filter( + Post.id == post_id, + Post.ok_topic_id.is_(None), + Post.publish_lock.is_(None), + ).update( + { + Post.publish_lock: lock_id, + Post.status: "publishing", + Post.error_message: None, + }, + synchronize_session=False, + ) + session.commit() + if not locked: + return "publish_locked" + post = session.get(Post, post_id) + if post is not None: + session.refresh(post) + if post is None or post.publish_lock != lock_id or post.ok_topic_id: + return "publish_locked" + post.status = "publishing" + post.error_message = None + session.commit() + + try: + media_items = sorted(post.media, key=lambda item: item.sort_order) + apply_uploaded_video_fallbacks(session, media_items) + video_error = failed_post_video_message(session, media_items) + if video_error: + post.status = "failed" + post.publish_lock = None + post.error_message = video_error + session.commit() + return "video_failed" + if not all_post_videos_ready(session, media_items): + post.status = "waiting_video" + post.publish_lock = None + post.error_message = "Waiting for OK video upload" + session.commit() + return "waiting_video" + + ok_media: list[dict] = [] + text = normalize_post_text(post.text) + if text: + ok_media.extend(split_text_media_blocks(text)) + ok_media.extend(video_media_items(media_items)) + + for item in media_items: + if item.media_type != "photo" or not item.source_url: + continue + local_path = Path(settings.storage_dir) / "photos" / str(post.id) / f"{item.id}.jpg" + download_file(item.source_url, local_path) + token = upload_photo_to_group(settings, local_path) + item.local_path = str(local_path) + item.ok_media_id = token + item.status = "uploaded" + ok_media.append({"type": "photo", "list": [{"id": token}]}) + session.commit() + + if not ok_media: + post.status = "skipped" + post.publish_lock = None + post.error_message = "Post has no publishable media" + session.commit() + return "skipped" + + attachment = {"media": ok_media} + result = post_group_mediatopic(settings, attachment) + post.ok_topic_id = topic_id_from_result(result) + post.status = "published" + post.publish_lock = None + post.published_at = datetime.utcnow() + session.commit() + + edited_media = [] + for media in ok_media: + if media.get("type") == "text": + media_text = str(media.get("text") or "") + if media.get("text_tokens"): + edited_media.append(media) + elif media_text: + edited_media.extend(split_text_media_blocks(media_text)) + else: + edited_media.append(media) + edited_media.append(build_school_quote_media()) + + try: + edit_mediatopic(settings, post.ok_topic_id, {"media": edited_media}) + except (httpx.HTTPError, OkApiError) as exc: + post.status = "published_edit_failed" + post.publish_lock = None + post.error_message = str(exc)[-4000:] + session.commit() + logger.exception("OK post was published but quote edit failed for post_id=%s", post.id) + return "published_edit_failed" + + try: + publish_moment_for_post(post, media_items) + except (httpx.HTTPError, OkApiError, OSError) as exc: + logger.exception("OK moment publishing failed for post_id=%s: %s", post.id, exc) + + session.commit() + return "published" + except (httpx.HTTPError, OkApiError, OSError) as exc: + post.status = "failed" + post.publish_lock = None + post.error_message = str(exc)[-4000:] + session.commit() + raise + + +@celery_app.task +def recover_queued_work() -> str: + init_db() + recovered = 0 + with SessionLocal() as session: + queued_events = ( + session.query(VkEvent) + .filter(VkEvent.status == "queued") + .order_by(VkEvent.id) + .limit(20) + .all() + ) + queued_posts = ( + session.query(Post) + .filter(Post.status.in_(["queued", "ok_publish_pending", "waiting_video"])) + .order_by(Post.id) + .limit(20) + .all() + ) + event_ids = [event.id for event in queued_events] + post_ids = [post.id for post in queued_posts] + + for event_id in event_ids: + process_vk_event.delay(event_id) + recovered += 1 + for post_id in post_ids: + publish_post_to_ok.delay(post_id) + recovered += 1 + return f"recovered:{recovered}" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a7144f9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,59 @@ +services: + api: + build: . + container_name: vk2ok-api + restart: unless-stopped + command: uvicorn app.main:app --host 0.0.0.0 --port 8000 + env_file: .env + volumes: + - ./data:/app/data + - ./storage:/app/storage + depends_on: + - redis + networks: + - caddy + - vk2ok_internal + + worker: + build: . + container_name: vk2ok-worker + restart: unless-stopped + command: celery -A app.worker.celery_app worker --loglevel=info --concurrency=2 + env_file: .env + volumes: + - ./data:/app/data + - ./storage:/app/storage + depends_on: + - redis + networks: + - vk2ok_internal + + beat: + build: . + container_name: vk2ok-beat + restart: unless-stopped + command: celery -A app.worker.celery_app beat --loglevel=info + env_file: .env + volumes: + - ./data:/app/data + depends_on: + - redis + networks: + - vk2ok_internal + + redis: + image: redis:7-alpine + container_name: vk2ok-redis + restart: unless-stopped + volumes: + - redis_data:/data + networks: + - vk2ok_internal + +volumes: + redis_data: + +networks: + caddy: + external: true + vk2ok_internal: diff --git a/docs/superpowers/plans/2026-06-27-video-cleanup.md b/docs/superpowers/plans/2026-06-27-video-cleanup.md new file mode 100644 index 0000000..8495e65 --- /dev/null +++ b/docs/superpowers/plans/2026-06-27-video-cleanup.md @@ -0,0 +1,65 @@ +# Video Cleanup Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Delete downloaded video artifacts after confirmed upload to OK while preserving retry files for failed uploads. + +**Architecture:** Add a focused cleanup helper to `app/worker.py` that validates the target directory is beneath the configured VK storage root, removes that directory, and clears persisted local paths. Invoke it only after `ok_video_id` has been assigned. Cleanup errors are logged without changing the successful upload status. + +**Tech Stack:** Python 3.12, pathlib, shutil, SQLAlchemy, Celery, Docker Compose + +--- + +### Task 1: Add Safe Artifact Cleanup + +**Files:** +- Modify: `app/worker.py` + +- [ ] **Step 1: Import directory removal support** + +Add `import shutil` alongside the existing standard-library imports. + +- [ ] **Step 2: Add the cleanup helper** + +Implement a helper with this contract: + +```python +def cleanup_uploaded_video_artifacts(video: Video) -> None: + video_root = (settings.storage_path / "vk").resolve() + paths = [video.local_video_path, video.local_cover_path] + directories = {Path(path).resolve().parent for path in paths if path} + for directory in directories: + if directory == video_root or video_root not in directory.parents: + raise ValueError(f"Refusing to clean path outside video storage: {directory}") + if directory.exists(): + shutil.rmtree(directory) + video.local_video_path = None + video.local_cover_path = None +``` + +- [ ] **Step 3: Invoke cleanup after successful upload** + +After assigning `video.ok_video_id` and setting `video.status = "ok_uploaded"`, call the helper inside a `try/except OSError` block. Log failures and retain the successful upload status. + +- [ ] **Step 4: Compile the worker** + +Run: `python3 -m compileall app/worker.py` + +Expected: `Compiling 'app/worker.py'...` with exit code 0. + +### Task 2: Deploy and Clean Existing Successful Downloads + +**Files:** +- Deploy: `app/worker.py` to `/var/www/bots/vk2ok/app/worker.py` + +- [ ] **Step 1: Rebuild services** + +Run `docker compose up -d --build api worker beat` in `/var/www/bots/vk2ok`. + +- [ ] **Step 2: Clean existing uploaded artifacts** + +Inside the API container, query `Video` rows where `ok_video_id IS NOT NULL` and either local path is set. Apply `cleanup_uploaded_video_artifacts` and commit each successful cleanup. + +- [ ] **Step 3: Verify health and storage state** + +Confirm all containers are running, Celery recovery returns normally, uploaded rows have null local paths, and no open publication work remains. diff --git a/docs/superpowers/specs/2026-06-27-video-cleanup-design.md b/docs/superpowers/specs/2026-06-27-video-cleanup-design.md new file mode 100644 index 0000000..3d4ffe3 --- /dev/null +++ b/docs/superpowers/specs/2026-06-27-video-cleanup-design.md @@ -0,0 +1,25 @@ +# Video Cleanup Design + +## Goal + +Remove all local artifacts produced by `yt-dlp` after a video has been successfully uploaded to OK and an `ok_video_id` has been persisted. + +## Behavior + +- Cleanup runs only after the OK upload succeeds. +- The complete per-video directory under `storage/vk/` is removed, including the MP4, thumbnail, description, and info JSON. +- `Video.local_video_path` and `Video.local_cover_path` are set to `None` after cleanup. +- Failed or incomplete uploads keep their files for retry and diagnosis. +- A cleanup failure does not turn a successful OK upload into a failed upload. It is logged and retained in `Video.error_message` for visibility. +- Existing `ok_uploaded` videos are cleaned once during deployment using the same path-safety rules. + +## Safety + +Cleanup may remove only a directory resolved beneath `settings.storage_path / "vk"`. Paths outside that root are rejected. Missing files or directories are treated as already cleaned. + +## Verification + +- Compile the worker module. +- Verify cleanup refuses paths outside the video storage root. +- Verify an existing per-video directory is removed and model paths are cleared. +- Deploy and confirm successful videos retain `ok_video_id`, have null local paths, and leave no corresponding local directory. diff --git a/dzen-assistant/.env.example b/dzen-assistant/.env.example new file mode 100644 index 0000000..ae2e481 --- /dev/null +++ b/dzen-assistant/.env.example @@ -0,0 +1,33 @@ +APP_ENV=production +PUBLIC_BASE_URL=https://dzen.nstarikov.ru +SQLITE_PATH=/app/data/dzen.sqlite3 +STORAGE_DIR=/app/data +REDIS_URL=redis://redis:6379/0 +CELERY_BROKER_URL=redis://redis:6379/0 +CELERY_RESULT_BACKEND=redis://redis:6379/1 + +# Optional: protect admin API later at Caddy or app level. +ADMIN_TOKEN=change-me + +# Existing server Whisper command. The file path is appended as the last argument. +# Leave empty to generate draft stubs until transcription is wired. +WHISPER_COMMAND= + +# yt-dlp cookies if VK needs auth. +YTDLP_COOKIES_PATH=/app/data/cookies.txt + +# VK API token for scanning the VK Video group via video.get. +VK_API_TOKEN= +VK_VIDEO_OWNER_ID=-9828339 + +# External OpenAI-compatible article editor agent. +LLM_API_URL= +LLM_API_KEY= +LLM_MODEL=agent +LLM_TIMEOUT_SECONDS=120 +LLM_MAX_TRANSCRIPT_CHARS=45000 + +# Processing limits. +MAX_CONCURRENT_VIDEOS=1 +FRAME_CANDIDATES=12 +RSS_LIMIT=100 diff --git a/dzen-assistant/.gitignore b/dzen-assistant/.gitignore new file mode 100644 index 0000000..2c09790 --- /dev/null +++ b/dzen-assistant/.gitignore @@ -0,0 +1,8 @@ +__pycache__/ +*.py[cod] +.env +data/ +storage/ +admin/node_modules/ +admin/dist/ + diff --git a/dzen-assistant/Caddyfile.server b/dzen-assistant/Caddyfile.server new file mode 100644 index 0000000..e811d24 --- /dev/null +++ b/dzen-assistant/Caddyfile.server @@ -0,0 +1,548 @@ +{ + email admin@nstarikov.ru +} + +# Сниппет: блокировка SEO-ботов, AI-ботов, сканеров +(snippet_block_bots) { + # SEO-боты + @seo_bots header_regexp User-Agent (?i)(AhrefsBot|SemrushBot|DotBot|MJ12bot|Baiduspider|AwarioBot|SeznamBot|Screaming.Frog|SiteAuditBot|DataForSeoBot|SerpstatBot|Uptimebot|PetalBot|ZoominfoBot|CriteoBot|trendictionbot|oBot|Sogou) + abort @seo_bots + + # AI-боты + @ai_bots header_regexp User-Agent (?i)(GPTBot|ClaudeBot|Claude-Web|Amazonbot|Applebot-Extended|CCBot|PerplexityBot|YouBot|anthropic) + abort @ai_bots + + # Сканеры уязвимостей и скрипты + @malicious header_regexp User-Agent (?i)(Nikto|sqlmap|masscan|zgrab|Scrapy|libwww-perl|lwp-trivial|PHP/) + abort @malicious + + # Python-скрейперы (не-legitimate) + @python_scraper header_regexp User-Agent (?i)(python-requests|python-urllib|aiohttp) + abort @python_scraper + + # Блокировка подозрительных путей и сканеров + @path_scan path_regexp (?i)(\.env|wp-|phpmyadmin|\.git|\.svn|\.DS_Store|xmlrpc\.php|wp-login|wp-admin|actuator|swagger|/shell\b|/cmd\b|/eval\b|/exec\b|\.asp$|\.aspx$|\.jsp$|\.php$) + abort @path_scan +} + +# Сниппет: security-заголовки +(snippet_security_headers) { + header { + Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" + X-Content-Type-Options "nosniff" + X-Frame-Options "SAMEORIGIN" + Referrer-Policy "strict-origin-when-cross-origin" + } +} + +# Сниппет: логирование +(snippet_log) { + log { + output file /var/log/caddy/{args[0]}.log + } +} + +# Сниппет: сжатие +(snippet_compress) { + encode zstd gzip +} + +api.nstarikov.ru { + import snippet_compress + import snippet_log api.nstarikov.ru + import snippet_block_bots + import snippet_security_headers + + # Блокировка сканеров по пути + @api_scan path_regexp (?i)(\.env|wp-|phpmyadmin|\.git|\.svn|\.DS_Store|xmlrpc\.php|wp-login|wp-admin|actuator|swagger|\.well-known|\.php$) + abort @api_scan + + # Ограничение доступа к /admin/login только с доверенного IP + @admin_login path /admin/login /admin/login/* + @admin_login_blocked not remote_ip 178.70.50.255 + handle @admin_login { + @blocked not remote_ip 178.70.50.255 + respond @blocked "Forbidden" 403 + reverse_proxy directus:8055 + } + + handle_path /stories/* { + reverse_proxy stories-previews:8000 + } + + handle { + reverse_proxy directus:8055 + } +} + +bot.nstarikov.ru { + import snippet_compress + import snippet_log bot.nstarikov.ru + import snippet_block_bots + + # 1. Telegram Bot API (local) + @bot_api path /bot* /file/bot* + handle @bot_api { + reverse_proxy crossposter_bot_api:8081 + } + + # 2. VK Webhook (our service - uses different secret) + @vk_webhook path /webhook/37a64119-6241-4892-a379-1fcd4a0395d9 + handle @vk_webhook { + reverse_proxy vk2directus:8000 + } + + # 3. Legacy webhook for crossposter + @webhook path /webhook/* + handle @webhook { + reverse_proxy crossposter_bot:8000 + } + + # VK to RuTube webhook and files proxy + handle_path /vk2rutube/* { + reverse_proxy vk2rutube-app:8000 + } + + # 4. Everything else -> Forbidden + + handle { + respond "Forbidden" 403 + } +} + +comments.nstarikov.ru { + import snippet_compress + import snippet_log comments.nstarikov.ru + import snippet_block_bots + + reverse_proxy remark42:8080 +} + +list.nstarikov.ru { + import snippet_compress + import snippet_log list.nstarikov.ru + import snippet_block_bots + + reverse_proxy listmonk:9001 +} + +n8n.nstarikov.ru { + import snippet_security_headers + import snippet_log n8n.nstarikov.ru + import snippet_block_bots + + header -Alt-Svc + header -Server + + reverse_proxy nstarikov-n8n:5678 { + transport http { + dial_timeout 5s + } + } +} + +nocodb.nstarikov.ru { + import snippet_compress + import snippet_log nocodb.nstarikov.ru + import snippet_block_bots + + @private not remote_ip 178.70.50.255 + respond @private "Forbidden" 403 + + reverse_proxy nocodb:8080 +} + +nstarikov.ru { + import snippet_compress + import snippet_log nstarikov.ru + import snippet_block_bots + + # Block and return 404 for the old geopolitics path + respond /geopolitics* "Not Found" 404 + + # Bot typing WebSocket proxy + handle /ws/typing/* { + reverse_proxy max-bot:8000 + } + + # Directus WebSocket proxy + handle /ws* { + rewrite * /websocket + reverse_proxy directus:8055 + } + + # Toolsy proxy for video proxy and Yandex profile API + handle /api/toolsy* { + uri strip_prefix /api/toolsy + reverse_proxy toolsy-proxy:8001 + } + + # Catch-all reverse proxy to Astro website + handle { + reverse_proxy nstarikov-astro:3000 + } +} + +po.nstarikov.ru { + import snippet_compress + import snippet_log po.nstarikov.ru + import snippet_block_bots + + @private not remote_ip 178.70.50.255 + respond @private "Forbidden" 403 + + reverse_proxy portainer:9000 +} + +podcast.nstarikov.ru { + import snippet_compress + import snippet_log podcast.nstarikov.ru + import snippet_block_bots + + reverse_proxy podcast.nstarikov.ru:4321 +} + +read.nstarikov.ru { + import snippet_compress + import snippet_log read.nstarikov.ru + import snippet_block_bots + + # Блокировка сканеров уязвимостей — ищут PHP-файлы + @php_scan path_regexp (?i)(\.php$|wp-content|wp-admin|wp-login|wordpress|wp-includes|xmlrpc\.php|wp-cron) + abort @php_scan + + # Блокировка подозрительных путей + @suspicious path_regexp (?i)(\.env|\.git|\.svn|\.DS_Store|actuator|swagger|adminer|phpmyadmin|/shell|/cmd|/eval|/exec|\.asp$|\.aspx$|\.jsp$|goods\.php|\.o\.php) + abort @suspicious + + reverse_proxy read.astro.ru:4321 +} + +tv.nstarikov.ru { + import snippet_compress + import snippet_log tv.nstarikov.ru + import snippet_block_bots + + reverse_proxy tv.nstarikov.ru:4321 +} + +dcr.nstarikov.ru { + import snippet_compress + import snippet_log dcr.nstarikov.ru + import snippet_block_bots + + basic_auth { + superadmin $2a$14$TtcPlXrL147mKF7FIHD8hOxrMhcmL.PwHT7vjgparlnr81./HqrcG + } + + reverse_proxy dcr-registry:5000 +} + +bot.kseniya-hram.ru { + import snippet_compress + import snippet_log bot.kseniya-hram.ru + import snippet_block_bots + + reverse_proxy kseniyahram-bot:3000 +} + +netdata.nstarikov.ru { + import snippet_log netdata.nstarikov.ru + import snippet_block_bots + + @blocked not remote_ip 178.70.50.255 + respond @blocked "Forbidden" 403 + + reverse_proxy netdata:19999 +} + +tv2api.bot.nstarikov.ru { + import snippet_compress + import snippet_log tv2api.bot.nstarikov.ru + import snippet_block_bots + + @vk_webhook path /webhook/37a64119-6241-4892-a379-1fcd4a0395d9 + handle @vk_webhook { + reverse_proxy vk2directus:8000 + } + + handle { + respond "Not Found" 404 + } +} + +video2audio.bot.nstarikov.ru { + import snippet_compress + import snippet_log video2audio.bot.nstarikov.ru + import snippet_block_bots + + reverse_proxy video2audio-bot-api:8081 +} + +vksigner.bot.nstarikov.ru { + import snippet_compress + import snippet_log vksigner.bot.nstarikov.ru + import snippet_block_bots + + # Блокировка сканеров — ищут PHP-файлы и уязвимости + @php_scan path_regexp (?i)(\.php$|wp-content|wp-admin|wp-login|wordpress|wp-includes|xmlrpc\.php|wp-cron) + abort @php_scan + + # Блокировка подозрительных путей + @suspicious path_regexp (?i)(\.env|\.git|\.svn|\.DS_Store|actuator|swagger|adminer|phpmyadmin|/shell|/cmd|/eval|/exec|\.asp$|\.aspx$|\.jsp$) + abort @suspicious + + reverse_proxy vk_signer_bot:8000 { + header_up X-Real-IP {remote_host} + header_up X-Forwarded-For {remote_host} + header_up X-Forwarded-Proto {scheme} + } +} + +vk-wall2stories.bot.nstarikov.ru { + import snippet_compress + import snippet_log vk-wall2stories.bot.nstarikov.ru + import snippet_block_bots + + reverse_proxy vk-stories-bot:8000 +} + +getmy-id.bot.nstarikov.ru { + import snippet_log getmy-id.bot.nstarikov.ru + import snippet_block_bots + + @webhook path /webhook/70c4a23a-e5ed-47ee-a60c-c67acba3ec0c + handle @webhook { + reverse_proxy http://getmy_id-bot:8000 + } + + handle { + reverse_proxy http://getmy_id-bot:8000 + } +} + +max.miniapps.nstarikov.ru { + import snippet_compress + import snippet_security_headers + import snippet_log max.miniapps.nstarikov.ru + header ?Access-Control-Allow-Origin "*" + header /index.html Cache-Control "no-cache" + header /sw.js Cache-Control "no-cache" + @static-js path_regexp \.js$ + @static-css path_regexp \.css$ + header @static-js Cache-Control "public, max-age=31536000, immutable" + header @static-css Cache-Control "public, max-age=31536000, immutable" + import snippet_block_bots + + tls { + issuer acme { + email admin@nstarikov.ru + } + } + + handle /api/toolsy* { + uri strip_prefix /api/toolsy + reverse_proxy toolsy-proxy:8001 + } + + # Bot proxy for notifications and typing WS + handle_path /bot* { + reverse_proxy max-bot:8000 + } + + handle_path /miniapp* { + root * /var/www/gp.nstarikov.ru/miniapps/max + @fallback { + not file {path} + not path_regexp \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|eot|ttf|json|map)$ + } + rewrite @fallback /index.html + file_server + } + + handle { + root * /var/www/gp.nstarikov.ru/miniapps/max + @fallback { + not file {path} + not path_regexp \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|eot|ttf|json|map)$ + } + rewrite @fallback /index.html + header -X-Frame-Options + header Content-Security-Policy "frame-ancestors 'self' nstarikov.ru *.nstarikov.ru vk.com *.vk.com ok.ru *.ok.ru;" + file_server + } +} + +tg.miniapps.nstarikov.ru { + import snippet_compress + import snippet_security_headers + import snippet_log tg.miniapps.nstarikov.ru + header ?Access-Control-Allow-Origin "*" + header /index.html Cache-Control "no-cache" + @static-js path_regexp \.js$ + @static-css path_regexp \.css$ + header @static-js Cache-Control "public, max-age=31536000, immutable" + header @static-css Cache-Control "public, max-age=31536000, immutable" + import snippet_block_bots + + tls { + issuer acme { + email admin@nstarikov.ru + } + } + + handle /api/toolsy* { + uri strip_prefix /api/toolsy + reverse_proxy toolsy-proxy:8001 + } + + # Bot proxy for notifications and typing WS + handle_path /bot* { + reverse_proxy max-bot:8000 + } + + # Telegram Bot webhook reverse proxy + handle_path /tg-bot* { + reverse_proxy tg-bot:8000 + } + + handle_path /miniapps/tg* { + root * /var/www/gp.nstarikov.ru/miniapps/telegram + @fallback { + not file {path} + not path_regexp \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|eot|ttf|json|map)$ + } + rewrite @fallback /index.html + file_server + } + + handle { + root * /var/www/gp.nstarikov.ru/miniapps/telegram + @fallback { + not file {path} + not path_regexp \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|eot|ttf|json|map)$ + } + rewrite @fallback /index.html + header -X-Frame-Options + header Content-Security-Policy "frame-ancestors 'self' nstarikov.ru *.nstarikov.ru vk.com *.vk.com ok.ru *.ok.ru;" + file_server + } +} + +vk.miniapps.nstarikov.ru { + import snippet_compress + import snippet_security_headers + import snippet_log vk.miniapps.nstarikov.ru + header ?Access-Control-Allow-Origin "*" + header /index.html Cache-Control "no-cache" + @static-js path_regexp \.js$ + @static-css path_regexp \.css$ + header @static-js Cache-Control "public, max-age=31536000, immutable" + header @static-css Cache-Control "public, max-age=31536000, immutable" + import snippet_block_bots + + tls { + issuer acme { + email admin@nstarikov.ru + } + } + + handle /api/toolsy* { + uri strip_prefix /api/toolsy + reverse_proxy toolsy-proxy:8001 + } + + # Bot proxy for notifications and typing WS + handle_path /bot* { + reverse_proxy max-bot:8000 + } + + handle_path /miniapps/vk* { + root * /var/www/gp.nstarikov.ru/miniapps/vk + @fallback { + not file {path} + not path_regexp \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|eot|ttf|json|map)$ + } + rewrite @fallback /index.html + file_server + } + + handle { + root * /var/www/gp.nstarikov.ru/miniapps/vk + @fallback { + not file {path} + not path_regexp \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|eot|ttf|json|map)$ + } + rewrite @fallback /index.html + header -X-Frame-Options + header Content-Security-Policy "frame-ancestors *;" + file_server + } +} + +max.nstarikov.ru { + import snippet_compress + import snippet_log max.nstarikov.ru + import snippet_block_bots + import snippet_security_headers + + handle /api/toolsy* { + uri strip_prefix /api/toolsy + reverse_proxy toolsy-proxy:8001 + } + + handle_path /bot* { + reverse_proxy max-bot:8000 + } + + handle_path /miniapp* { + root * /var/www/gp.nstarikov.ru/miniapps/max + @fallback { + not file {path} + not path_regexp \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|eot|ttf|json|map)$ + } + rewrite @fallback /index.html + file_server + } + + handle { + root * /var/www/gp.nstarikov.ru/miniapps/max + @fallback { + not file {path} + not path_regexp \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|eot|ttf|json|map)$ + } + rewrite @fallback /index.html + file_server + } +} + +vk2ok.bot.nstarikov.ru { + import snippet_compress + import snippet_log vk2ok.bot.nstarikov.ru + import snippet_block_bots + + reverse_proxy vk2ok-api:8000 +} + +http://dzen.nstarikov.ru { + @zen_verify path /zen_y2a3098Zp7skRQXDYdkEOwOXFDdQsSzU7bkouM0htBECx6zgC5CCqVZRxslhhjSg.html + respond @zen_verify "" 200 + + redir https://dzen.nstarikov.ru{uri} permanent +} + +dzen.nstarikov.ru { + import snippet_compress + import snippet_log dzen.nstarikov.ru + import snippet_block_bots + import snippet_security_headers + + @admin path /admin* /api* + basic_auth @admin { + admin $2a$14$P4L2AQE5GrhdJ9UWy2sNHuRryJarO3pReiGVVs3VGe/hX.ObQaqbO + } + + handle { + reverse_proxy dzen-assistant-api:8000 + } +} diff --git a/dzen-assistant/Caddyfile.snippet b/dzen-assistant/Caddyfile.snippet new file mode 100644 index 0000000..03783fb --- /dev/null +++ b/dzen-assistant/Caddyfile.snippet @@ -0,0 +1,13 @@ +dzen.nstarikov.ru { + reverse_proxy dzen-assistant-api:8000 +} + +# Safer production variant: +# dzen.nstarikov.ru { +# @admin path /admin* /api* +# basic_auth @admin { +# admin REPLACE_WITH_CADDY_HASHED_PASSWORD +# } +# +# reverse_proxy dzen-assistant-api:8000 +# } diff --git a/dzen-assistant/DEPLOY.md b/dzen-assistant/DEPLOY.md new file mode 100644 index 0000000..a3002a3 --- /dev/null +++ b/dzen-assistant/DEPLOY.md @@ -0,0 +1,87 @@ +# Deploy to nstarikov server + +Target path: + +```bash +/var/www/dzen.nstarikov.ru +``` + +## 1. Copy project + +```bash +mkdir -p /var/www/dzen.nstarikov.ru +cd /var/www/dzen.nstarikov.ru +``` + +Copy the contents of this `dzen-assistant` directory there. + +## 2. Configure environment + +```bash +cp .env.example .env +nano .env +``` + +Important values: + +```env +PUBLIC_BASE_URL=https://dzen.nstarikov.ru +WHISPER_COMMAND= +YTDLP_COOKIES_PATH=/app/data/cookies.txt +``` + +If VK requires an authenticated download, put cookies here: + +```bash +/var/www/dzen.nstarikov.ru/data/cookies.txt +``` + +## 3. Caddy + +Add to the existing Caddyfile: + +```caddyfile +dzen.nstarikov.ru { + reverse_proxy dzen-assistant-api:8000 +} +``` + +Safer variant for production: + +```caddyfile +dzen.nstarikov.ru { + @admin path /admin* /api* + basic_auth @admin { + admin REPLACE_WITH_CADDY_HASHED_PASSWORD + } + + reverse_proxy dzen-assistant-api:8000 +} +``` + +Make sure the app joins the external Docker network named `caddy`. + +## 4. Start + +```bash +docker compose up -d --build +``` + +## 5. Check + +```bash +curl -i https://dzen.nstarikov.ru/health +curl -i https://dzen.nstarikov.ru/feed +``` + +Admin: + +```text +https://dzen.nstarikov.ru/admin +``` + +## Notes + +- Keep `worker` concurrency at `1` while Whisper/LLM processing is local. +- The first MVP can draft article stubs even before Whisper is wired. Add transcription and LLM generation after the RSS import test passes. +- Admin protection should be added through Caddy basic auth, VPN, or a separate protected admin subdomain before exposing it publicly. diff --git a/dzen-assistant/Dockerfile b/dzen-assistant/Dockerfile new file mode 100644 index 0000000..dad64ac --- /dev/null +++ b/dzen-assistant/Dockerfile @@ -0,0 +1,26 @@ +FROM node:22-alpine AS admin-build +WORKDIR /admin +COPY admin/package*.json ./ +RUN npm install +COPY admin ./ +RUN npm run build + +FROM python:3.12-slim + +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 + +WORKDIR /app + +RUN apt-get update \ + && apt-get install -y --no-install-recommends ffmpeg ca-certificates curl libgomp1 \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt \ + && pip install --no-cache-dir yt-dlp + +COPY app ./app +COPY --from=admin-build /admin/dist ./admin_dist + +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/dzen-assistant/README.md b/dzen-assistant/README.md new file mode 100644 index 0000000..d3ad8af --- /dev/null +++ b/dzen-assistant/README.md @@ -0,0 +1,72 @@ +# dzen-assistant + +Автоматизированный RSS-конвейер для Дзена: + +- ищет новые ролики в VK/других источниках; +- скачивает видео через `yt-dlp`; +- транскрибирует через локальный Whisper; +- готовит черновики статей; +- выбирает и публикует кадры; +- отдает RSS по `https://dzen.nstarikov.ru/feed`. + +## Серверный путь + +```bash +/var/www/dzen.nstarikov.ru +``` + +## Быстрый запуск + +```bash +cd /var/www/dzen.nstarikov.ru +cp .env.example .env +docker compose up -d --build +``` + +## Caddy + +Добавить сервис в общую Docker-сеть Caddy и прописать: + +```caddyfile +dzen.nstarikov.ru { + reverse_proxy dzen-assistant-api:8000 +} +``` + +Публичные URL: + +- `https://dzen.nstarikov.ru/feed` +- `https://dzen.nstarikov.ru/posts/{slug}` +- `https://dzen.nstarikov.ru/media/{path}` +- `https://dzen.nstarikov.ru/admin` + +## Whisper + +Если на сервере уже есть Whisper-команда, укажите её в `.env`: + +```env +WHISPER_COMMAND=/path/to/whisper --model medium --language ru --output_format txt +``` + +Команда должна принимать путь к аудио/видео файлу последним аргументом и печатать/создавать текст. + +## LLM-редактор + +После Whisper воркер может отправлять транскрипт во внешний OpenAI-compatible агент: + +```env +LLM_API_URL=https://agent.example/v1 +LLM_API_KEY=... +LLM_MODEL=agent +``` + +Агент должен отвечать JSON со списком статей. Если агент временно недоступен, конвейер создаст простой +fallback-черновик из транскрипта. + +## MVP-поток + +1. Добавить источники в админке. +2. Запустить проверку источников. +3. Обработать найденный ролик. +4. Проверить черновик и кадры. +5. Опубликовать статью в RSS. diff --git a/dzen-assistant/admin/.gitignore b/dzen-assistant/admin/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/dzen-assistant/admin/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/dzen-assistant/admin/.prettierignore b/dzen-assistant/admin/.prettierignore new file mode 100644 index 0000000..0b4a1db --- /dev/null +++ b/dzen-assistant/admin/.prettierignore @@ -0,0 +1,7 @@ +node_modules/ +coverage/ +.pnpm-store/ +pnpm-lock.yaml +package-lock.json +pnpm-lock.yaml +yarn.lock diff --git a/dzen-assistant/admin/.prettierrc b/dzen-assistant/admin/.prettierrc new file mode 100644 index 0000000..9000bfa --- /dev/null +++ b/dzen-assistant/admin/.prettierrc @@ -0,0 +1,11 @@ +{ + "endOfLine": "lf", + "semi": false, + "singleQuote": false, + "tabWidth": 2, + "trailingComma": "es5", + "printWidth": 80, + "plugins": ["prettier-plugin-tailwindcss"], + "tailwindStylesheet": "src/index.css", + "tailwindFunctions": ["cn", "cva"] +} diff --git a/dzen-assistant/admin/README.md b/dzen-assistant/admin/README.md new file mode 100644 index 0000000..811328a --- /dev/null +++ b/dzen-assistant/admin/README.md @@ -0,0 +1,21 @@ +# React + TypeScript + Vite + shadcn/ui + +This is a template for a new Vite project with React, TypeScript, and shadcn/ui. + +## Adding components + +To add components to your app, run the following command: + +```bash +npx shadcn@latest add button +``` + +This will place the ui components in the `src/components` directory. + +## Using components + +To use the components in your app, import them as follows: + +```tsx +import { Button } from "@/components/ui/button" +``` diff --git a/dzen-assistant/admin/components.json b/dzen-assistant/admin/components.json new file mode 100644 index 0000000..9248c47 --- /dev/null +++ b/dzen-assistant/admin/components.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "nova", + "rsc": false, + "tsx": true, + "tailwind": { + "config": "tailwind.config.js", + "css": "src/index.css", + "baseColor": "neutral", + "cssVariables": true, + "prefix": "" + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + }, + "iconLibrary": "lucide" +} diff --git a/dzen-assistant/admin/eslint.config.js b/dzen-assistant/admin/eslint.config.js new file mode 100644 index 0000000..ef614d2 --- /dev/null +++ b/dzen-assistant/admin/eslint.config.js @@ -0,0 +1,22 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import tseslint from 'typescript-eslint' +import { defineConfig, globalIgnores } from 'eslint/config' + +export default defineConfig([ + globalIgnores(['dist']), + { + files: ['**/*.{ts,tsx}'], + extends: [ + js.configs.recommended, + tseslint.configs.recommended, + reactHooks.configs.flat.recommended, + reactRefresh.configs.vite, + ], + languageOptions: { + globals: globals.browser, + }, + }, +]) diff --git a/dzen-assistant/admin/index.html b/dzen-assistant/admin/index.html new file mode 100644 index 0000000..9c9f964 --- /dev/null +++ b/dzen-assistant/admin/index.html @@ -0,0 +1,13 @@ + + + + + + Дзен-ассистент + + +
+ + + + diff --git a/dzen-assistant/admin/package-lock.json b/dzen-assistant/admin/package-lock.json new file mode 100644 index 0000000..b942108 --- /dev/null +++ b/dzen-assistant/admin/package-lock.json @@ -0,0 +1,2783 @@ +{ + "name": "dzen-assistant-admin", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "dzen-assistant-admin", + "version": "0.1.0", + "dependencies": { + "@editorjs/editorjs": "^2.30.8", + "@editorjs/header": "^2.8.8", + "@editorjs/image": "^2.10.3", + "@editorjs/list": "^1.10.0", + "@editorjs/quote": "^2.7.6", + "@vitejs/plugin-react": "^4.3.4", + "class-variance-authority": "^0.7.1", + "clsx": "^2.1.1", + "lucide-react": "^0.468.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "tailwind-merge": "^2.6.0", + "tailwindcss-animate": "^1.0.7", + "vite": "^6.0.5" + }, + "devDependencies": { + "@types/node": "^22.10.2", + "@types/react": "^19.0.2", + "@types/react-dom": "^19.0.2", + "autoprefixer": "^10.4.20", + "postcss": "^8.4.49", + "tailwindcss": "^3.4.17", + "typescript": "^5.7.2" + } + }, + "node_modules/@alloc/quick-lru": { + "version": "5.2.0", + "resolved": "https://registry.npmmirror.com/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", + "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/generator/-/generator-7.29.7.tgz", + "integrity": "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", + "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/helpers/-/helpers-7.29.7.tgz", + "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", + "license": "MIT", + "dependencies": { + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.7" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz", + "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz", + "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==", + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/traverse/-/traverse-7.29.7.tgz", + "integrity": "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.7", + "resolved": "https://registry.npmmirror.com/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@codexteam/icons": { + "version": "0.0.5", + "resolved": "https://registry.npmmirror.com/@codexteam/icons/-/icons-0.0.5.tgz", + "integrity": "sha512-s6H2KXhLz2rgbMZSkRm8dsMJvyUNZsEjxobBEg9ztdrb1B2H3pEzY6iTwI4XUPJWJ3c3qRKwV4TrO3J5jUdoQA==", + "license": "MIT" + }, + "node_modules/@editorjs/caret": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/@editorjs/caret/-/caret-1.1.0.tgz", + "integrity": "sha512-dzUjrPV7mtqM0HR/7IwT1/1PfyMxUfe5MRXo9joFmBRDIcrQ5ikbqVxSL9+Hy5tQ+BUWBwqLUgX1UKTJylWW9Q==", + "license": "MIT", + "dependencies": { + "@editorjs/dom": "^1.1.0" + } + }, + "node_modules/@editorjs/dom": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/@editorjs/dom/-/dom-1.1.0.tgz", + "integrity": "sha512-aH8OeS3DXCDG2WP6yt/uS6Z9PstrA3Re930boIilxtMdF7Ht+pKJrq3OJnd7OCMPVO/y7UOAmtHNesVx6v4K2g==", + "license": "MIT", + "dependencies": { + "@editorjs/helpers": "^1.2.0" + } + }, + "node_modules/@editorjs/editorjs": { + "version": "2.31.6", + "resolved": "https://registry.npmmirror.com/@editorjs/editorjs/-/editorjs-2.31.6.tgz", + "integrity": "sha512-j2nxuFCD3DnoJDUD0hPO5tirpuQ6sWmmuHATl3EI7fG1it3Ml7jk0WJtu3E+TRLBd7zfNeJhDThbP3LnBEn2GA==", + "license": "Apache-2.0", + "dependencies": { + "@editorjs/caret": "^1.0.1", + "codex-notifier": "^1.1.2", + "codex-tooltip": "^1.0.5" + } + }, + "node_modules/@editorjs/header": { + "version": "2.8.9", + "resolved": "https://registry.npmmirror.com/@editorjs/header/-/header-2.8.9.tgz", + "integrity": "sha512-eBL9/PLDKiE9ADZycmgps3PLz9Lw8w6rPFXr0mfHuhHQI/ynP/q1vLpyruBrRCflTLD2Dlj5nYPoJjL5mP/MFw==", + "license": "MIT", + "dependencies": { + "@codexteam/icons": "^0.0.5", + "@editorjs/editorjs": "^2.30.7" + } + }, + "node_modules/@editorjs/helpers": { + "version": "1.2.2", + "resolved": "https://registry.npmmirror.com/@editorjs/helpers/-/helpers-1.2.2.tgz", + "integrity": "sha512-saDNARvY3xd70H4KE0eBq2hlV0Z7SpfI1/1iVqyVt5PqhlEOIR5rWJFH4c63BHTa6BfiR/+PMl1n7X/X7SlptQ==", + "license": "MIT", + "dependencies": { + "codex-tooltip": "^1.0.6" + } + }, + "node_modules/@editorjs/image": { + "version": "2.10.3", + "resolved": "https://registry.npmmirror.com/@editorjs/image/-/image-2.10.3.tgz", + "integrity": "sha512-ekCsGICZOIdghF/U2T34H7CItqaWAoJDXbkRD+x8l/LIo/7Ozf7KovYm21qz+CluArgV4RurVFHqwlz+O0vfJA==", + "license": "MIT", + "dependencies": { + "@codexteam/icons": "^0.3.0" + } + }, + "node_modules/@editorjs/image/node_modules/@codexteam/icons": { + "version": "0.3.3", + "resolved": "https://registry.npmmirror.com/@codexteam/icons/-/icons-0.3.3.tgz", + "integrity": "sha512-cp7mkZPgmBuSxigTm3Vb+DtVHYeX7qXfQd7o05vcLD8Ag5WvRlol2QSn5P10k0CDAJwmkH9nQGQLBycErS9lsQ==", + "license": "MIT" + }, + "node_modules/@editorjs/list": { + "version": "1.10.0", + "resolved": "https://registry.npmmirror.com/@editorjs/list/-/list-1.10.0.tgz", + "integrity": "sha512-zXCHaNcIscpefnteBOS3x+98f/qBgEVsv+OvtKoTDZipMNqck2uVG+X2qMQr8xcwtJrj9ySX54lUac9FDlAHnA==", + "license": "MIT", + "dependencies": { + "@codexteam/icons": "^0.0.4" + } + }, + "node_modules/@editorjs/list/node_modules/@codexteam/icons": { + "version": "0.0.4", + "resolved": "https://registry.npmmirror.com/@codexteam/icons/-/icons-0.0.4.tgz", + "integrity": "sha512-V8N/TY2TGyas4wLrPIFq7bcow68b3gu8DfDt1+rrHPtXxcexadKauRJL6eQgfG7Z0LCrN4boLRawR4S9gjIh/Q==", + "license": "MIT" + }, + "node_modules/@editorjs/quote": { + "version": "2.7.6", + "resolved": "https://registry.npmmirror.com/@editorjs/quote/-/quote-2.7.6.tgz", + "integrity": "sha512-D01KUMSDj2r+6Z+xjDkQqI+y6URpeHCvj0+P4pah+GtkG040lWjFb2H4pgHFXuol2cbfyAoraYSw85fuPheCvw==", + "license": "MIT", + "dependencies": { + "@codexteam/icons": "^0.3.2", + "@editorjs/dom": "^0.0.5" + } + }, + "node_modules/@editorjs/quote/node_modules/@codexteam/icons": { + "version": "0.3.3", + "resolved": "https://registry.npmmirror.com/@codexteam/icons/-/icons-0.3.3.tgz", + "integrity": "sha512-cp7mkZPgmBuSxigTm3Vb+DtVHYeX7qXfQd7o05vcLD8Ag5WvRlol2QSn5P10k0CDAJwmkH9nQGQLBycErS9lsQ==", + "license": "MIT" + }, + "node_modules/@editorjs/quote/node_modules/@editorjs/dom": { + "version": "0.0.5", + "resolved": "https://registry.npmmirror.com/@editorjs/dom/-/dom-0.0.5.tgz", + "integrity": "sha512-SZ78Gwpkp3EUhjBIp0lSojeQ35V9acF8SubJsMeOH/vlOUE40GOnvvwWZnF05lO7bIB0dOHhhJy4N7IIAWxP2w==", + "license": "MIT", + "dependencies": { + "@editorjs/helpers": "^0.0.4" + } + }, + "node_modules/@editorjs/quote/node_modules/@editorjs/helpers": { + "version": "0.0.4", + "resolved": "https://registry.npmmirror.com/@editorjs/helpers/-/helpers-0.0.4.tgz", + "integrity": "sha512-ieg3dzo2m1/ELze/RMNADiAiC5amXxIlVXoJ5vvXITOu/p/dPsrF+Oi3h5gBYvtGk9vg5LJUSG5YWU0tBUO1tw==", + "license": "MIT" + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmmirror.com/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmmirror.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmmirror.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmmirror.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmmirror.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.27", + "resolved": "https://registry.npmmirror.com/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", + "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz", + "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz", + "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz", + "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz", + "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz", + "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz", + "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz", + "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz", + "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz", + "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz", + "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz", + "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz", + "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==", + "cpu": [ + "loong64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz", + "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz", + "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz", + "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz", + "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz", + "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz", + "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz", + "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz", + "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz", + "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz", + "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz", + "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz", + "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz", + "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmmirror.com/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmmirror.com/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmmirror.com/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmmirror.com/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.19.20", + "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.19.20.tgz", + "integrity": "sha512-6tELRwSDYWW9EdZhbeZmYGZ1/7Djkt+Ah3/ScEYT9cDord7UJzasR/4D3VONg9tQI5CDp+/CZC1AXj2pCFOvpw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/react": { + "version": "19.2.17", + "resolved": "https://registry.npmmirror.com/@types/react/-/react-19.2.17.tgz", + "integrity": "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==", + "dev": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmmirror.com/@types/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "4.7.0", + "resolved": "https://registry.npmmirror.com/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", + "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.0", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.27", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.17.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "license": "MIT" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmmirror.com/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmmirror.com/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "license": "MIT" + }, + "node_modules/autoprefixer": { + "version": "10.5.0", + "resolved": "https://registry.npmmirror.com/autoprefixer/-/autoprefixer-10.5.0.tgz", + "integrity": "sha512-FMhOoZV4+qR6aTUALKX2rEqGG+oyATvwBt9IIzVR5rMa2HRWPkxf+P+PAJLD1I/H5/II+HuZcBJYEFBpq39ong==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/autoprefixer" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "browserslist": "^4.28.2", + "caniuse-lite": "^1.0.30001787", + "fraction.js": "^5.3.4", + "picocolors": "^1.1.1", + "postcss-value-parser": "^4.2.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.10.35", + "resolved": "https://registry.npmmirror.com/baseline-browser-mapping/-/baseline-browser-mapping-2.10.35.tgz", + "integrity": "sha512-honAfLBde0HAFLdNyBEfuuENkF6zR+ozxqxa/2zJKHBe1qzLqyTSeRKpdPEHAP03rlDGyQOPnCSxnVpVqQo9Mg==", + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmmirror.com/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.28.2", + "resolved": "https://registry.npmmirror.com/browserslist/-/browserslist-4.28.2.tgz", + "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.10.12", + "caniuse-lite": "^1.0.30001782", + "electron-to-chromium": "^1.5.328", + "node-releases": "^2.0.36", + "update-browserslist-db": "^1.2.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001797", + "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001797.tgz", + "integrity": "sha512-l8xKG+gwAIExZGl9FrF7KUwuOmk6wbEPC9Xoy/RtnWv1XG0Q4LFlagaLpUv3Kiza3W/wm27zy0yWJEieYKAP6w==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/class-variance-authority": { + "version": "0.7.1", + "resolved": "https://registry.npmmirror.com/class-variance-authority/-/class-variance-authority-0.7.1.tgz", + "integrity": "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==", + "license": "Apache-2.0", + "dependencies": { + "clsx": "^2.1.1" + }, + "funding": { + "url": "https://polar.sh/cva" + } + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/codex-notifier": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/codex-notifier/-/codex-notifier-1.1.2.tgz", + "integrity": "sha512-DCp6xe/LGueJ1N5sXEwcBc3r3PyVkEEDNWCVigfvywAkeXcZMk9K41a31tkEFBW0Ptlwji6/JlAb49E3Yrxbtg==", + "license": "MIT" + }, + "node_modules/codex-tooltip": { + "version": "1.0.6", + "resolved": "https://registry.npmmirror.com/codex-tooltip/-/codex-tooltip-1.0.6.tgz", + "integrity": "sha512-3MVjBjeJFQ4jGlPuYHYV3Yj0wnl1l9ppB5zeIFJeyo8Ala3WlZYtLK5yZEoyND2fxIyVmqsZORCftDGX3vbSGQ==", + "license": "MIT" + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "license": "MIT" + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmmirror.com/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", + "license": "Apache-2.0" + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmmirror.com/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "license": "MIT" + }, + "node_modules/electron-to-chromium": { + "version": "1.5.371", + "resolved": "https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.371.tgz", + "integrity": "sha512-e9htk9mAYL6AzmkEhSvVVw7IWGSBJ/Bqdn2eRyRLrj1g6sncN4WbFt5qnILYoCktktr45pyjIrOiRvBThQ808w==", + "license": "ISC" + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmmirror.com/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fastq": { + "version": "1.20.1", + "resolved": "https://registry.npmmirror.com/fastq/-/fastq-1.20.1.tgz", + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fraction.js": { + "version": "5.3.4", + "resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-5.3.4.tgz", + "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmmirror.com/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.16.2", + "resolved": "https://registry.npmmirror.com/is-core-module/-/is-core-module-2.16.2.tgz", + "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==", + "license": "MIT", + "dependencies": { + "hasown": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmmirror.com/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmmirror.com/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/jiti": { + "version": "1.21.7", + "resolved": "https://registry.npmmirror.com/jiti/-/jiti-1.21.7.tgz", + "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", + "license": "MIT", + "bin": { + "jiti": "bin/jiti.js" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmmirror.com/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmmirror.com/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmmirror.com/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmmirror.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/lucide-react": { + "version": "0.468.0", + "resolved": "https://registry.npmmirror.com/lucide-react/-/lucide-react-0.468.0.tgz", + "integrity": "sha512-6koYRhnM2N0GGZIdXzSeiNwguv1gt/FAjZOiPl76roBi3xKEXa4WmfpxgQwTTL4KipXjefrnf3oV4IsYhi4JFA==", + "license": "ISC", + "peerDependencies": { + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmmirror.com/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmmirror.com/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmmirror.com/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.12", + "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", + "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/node-releases": { + "version": "2.0.47", + "resolved": "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.47.tgz", + "integrity": "sha512-Uzmd6LXpouKo8EUK68IjH4+E01w/hXyV3R3g/geCJo+rXLNfh1xucB+LOzYEOQPSiUK3h/xZf0cQGcSsmyL2Og==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmmirror.com/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pirates": { + "version": "4.0.7", + "resolved": "https://registry.npmmirror.com/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/postcss": { + "version": "8.5.15", + "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", + "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.12", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-import": { + "version": "15.1.0", + "resolved": "https://registry.npmmirror.com/postcss-import/-/postcss-import-15.1.0.tgz", + "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.0.0", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-js": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/postcss-js/-/postcss-js-4.1.0.tgz", + "integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "camelcase-css": "^2.0.1" + }, + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "peerDependencies": { + "postcss": "^8.4.21" + } + }, + "node_modules/postcss-load-config": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/postcss-load-config/-/postcss-load-config-6.0.1.tgz", + "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "lilconfig": "^3.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/postcss-nested": { + "version": "6.2.0", + "resolved": "https://registry.npmmirror.com/postcss-nested/-/postcss-nested-6.2.0.tgz", + "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "postcss-selector-parser": "^6.1.1" + }, + "engines": { + "node": ">=12.0" + }, + "peerDependencies": { + "postcss": "^8.2.14" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.1.2", + "resolved": "https://registry.npmmirror.com/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", + "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmmirror.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "license": "MIT" + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/react": { + "version": "19.2.7", + "resolved": "https://registry.npmmirror.com/react/-/react-19.2.7.tgz", + "integrity": "sha512-HNe9WslTbXmFK8o8cmwgAeJFSBvt1bPdHCVKtaaV+WlAN36mpT4hcRpwbf3fY56ar2oIXzsBpOAiIRHAdY0OlQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.7", + "resolved": "https://registry.npmmirror.com/react-dom/-/react-dom-19.2.7.tgz", + "integrity": "sha512-t0BRVXvbiE/o20Hfw669rLbMCDWtYZLvmJigy2f0MxsXF+71pxhR3xOkspmsO8h3ZlNzyibAmtCa3l4lYKk6gQ==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.7" + } + }, + "node_modules/react-refresh": { + "version": "0.17.0", + "resolved": "https://registry.npmmirror.com/react-refresh/-/react-refresh-0.17.0.tgz", + "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "license": "MIT", + "dependencies": { + "pify": "^2.3.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmmirror.com/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.12", + "resolved": "https://registry.npmmirror.com/resolve/-/resolve-1.22.12.tgz", + "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.61.1", + "resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.61.1.tgz", + "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==", + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.61.1", + "@rollup/rollup-android-arm64": "4.61.1", + "@rollup/rollup-darwin-arm64": "4.61.1", + "@rollup/rollup-darwin-x64": "4.61.1", + "@rollup/rollup-freebsd-arm64": "4.61.1", + "@rollup/rollup-freebsd-x64": "4.61.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.61.1", + "@rollup/rollup-linux-arm-musleabihf": "4.61.1", + "@rollup/rollup-linux-arm64-gnu": "4.61.1", + "@rollup/rollup-linux-arm64-musl": "4.61.1", + "@rollup/rollup-linux-loong64-gnu": "4.61.1", + "@rollup/rollup-linux-loong64-musl": "4.61.1", + "@rollup/rollup-linux-ppc64-gnu": "4.61.1", + "@rollup/rollup-linux-ppc64-musl": "4.61.1", + "@rollup/rollup-linux-riscv64-gnu": "4.61.1", + "@rollup/rollup-linux-riscv64-musl": "4.61.1", + "@rollup/rollup-linux-s390x-gnu": "4.61.1", + "@rollup/rollup-linux-x64-gnu": "4.61.1", + "@rollup/rollup-linux-x64-musl": "4.61.1", + "@rollup/rollup-openbsd-x64": "4.61.1", + "@rollup/rollup-openharmony-arm64": "4.61.1", + "@rollup/rollup-win32-arm64-msvc": "4.61.1", + "@rollup/rollup-win32-ia32-msvc": "4.61.1", + "@rollup/rollup-win32-x64-gnu": "4.61.1", + "@rollup/rollup-win32-x64-msvc": "4.61.1", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmmirror.com/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmmirror.com/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sucrase": { + "version": "3.35.1", + "resolved": "https://registry.npmmirror.com/sucrase/-/sucrase-3.35.1.tgz", + "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "tinyglobby": "^0.2.11", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tailwind-merge": { + "version": "2.6.1", + "resolved": "https://registry.npmmirror.com/tailwind-merge/-/tailwind-merge-2.6.1.tgz", + "integrity": "sha512-Oo6tHdpZsGpkKG88HJ8RR1rg/RdnEkQEfMoEk2x1XRI3F1AxeU+ijRXpiVUF4UbLfcxxRGw6TbUINKYdWVsQTQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/dcastil" + } + }, + "node_modules/tailwindcss": { + "version": "3.4.19", + "resolved": "https://registry.npmmirror.com/tailwindcss/-/tailwindcss-3.4.19.tgz", + "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==", + "license": "MIT", + "dependencies": { + "@alloc/quick-lru": "^5.2.0", + "arg": "^5.0.2", + "chokidar": "^3.6.0", + "didyoumean": "^1.2.2", + "dlv": "^1.1.3", + "fast-glob": "^3.3.2", + "glob-parent": "^6.0.2", + "is-glob": "^4.0.3", + "jiti": "^1.21.7", + "lilconfig": "^3.1.3", + "micromatch": "^4.0.8", + "normalize-path": "^3.0.0", + "object-hash": "^3.0.0", + "picocolors": "^1.1.1", + "postcss": "^8.4.47", + "postcss-import": "^15.1.0", + "postcss-js": "^4.0.1", + "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0", + "postcss-nested": "^6.2.0", + "postcss-selector-parser": "^6.1.2", + "resolve": "^1.22.8", + "sucrase": "^3.35.0" + }, + "bin": { + "tailwind": "lib/cli.js", + "tailwindcss": "lib/cli.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tailwindcss-animate": { + "version": "1.0.7", + "resolved": "https://registry.npmmirror.com/tailwindcss-animate/-/tailwindcss-animate-1.0.7.tgz", + "integrity": "sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA==", + "license": "MIT", + "peerDependencies": { + "tailwindcss": ">=3.0.0 || insiders" + } + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmmirror.com/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmmirror.com/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmmirror.com/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "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/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmmirror.com/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmmirror.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "license": "Apache-2.0" + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/update-browserslist-db": { + "version": "1.2.3", + "resolved": "https://registry.npmmirror.com/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/vite": { + "version": "6.4.3", + "resolved": "https://registry.npmmirror.com/vite/-/vite-6.4.3.tgz", + "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "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/vite/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmmirror.com/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmmirror.com/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "license": "ISC" + } + } +} diff --git a/dzen-assistant/admin/package.json b/dzen-assistant/admin/package.json new file mode 100644 index 0000000..9e60e8c --- /dev/null +++ b/dzen-assistant/admin/package.json @@ -0,0 +1,36 @@ +{ + "name": "dzen-assistant-admin", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite --host 0.0.0.0", + "build": "tsc -p tsconfig.app.json && vite build", + "preview": "vite preview --host 0.0.0.0" + }, + "dependencies": { + "@editorjs/editorjs": "^2.30.8", + "@editorjs/header": "^2.8.8", + "@editorjs/image": "^2.10.3", + "@editorjs/list": "^1.10.0", + "@editorjs/quote": "^2.7.6", + "@vitejs/plugin-react": "^4.3.4", + "class-variance-authority": "^0.7.1", + "clsx": "^2.1.1", + "lucide-react": "^0.468.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "tailwind-merge": "^2.6.0", + "tailwindcss-animate": "^1.0.7", + "vite": "^6.0.5" + }, + "devDependencies": { + "@types/node": "^22.10.2", + "@types/react": "^19.0.2", + "@types/react-dom": "^19.0.2", + "autoprefixer": "^10.4.20", + "postcss": "^8.4.49", + "tailwindcss": "^3.4.17", + "typescript": "^5.7.2" + } +} diff --git a/dzen-assistant/admin/postcss.config.js b/dzen-assistant/admin/postcss.config.js new file mode 100644 index 0000000..b4a6220 --- /dev/null +++ b/dzen-assistant/admin/postcss.config.js @@ -0,0 +1,7 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} + diff --git a/dzen-assistant/admin/public/vite.svg b/dzen-assistant/admin/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/dzen-assistant/admin/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dzen-assistant/admin/src/App.tsx b/dzen-assistant/admin/src/App.tsx new file mode 100644 index 0000000..718aa98 --- /dev/null +++ b/dzen-assistant/admin/src/App.tsx @@ -0,0 +1,1208 @@ +import { useEffect, useMemo, useRef, useState } from "react" +import EditorJS, { type BlockAPI, type OutputData, type ToolConstructable } from "@editorjs/editorjs" +import Header from "@editorjs/header" +import ImageTool from "@editorjs/image" +import List from "@editorjs/list" +import Quote from "@editorjs/quote" +import { + AlertTriangle, + CheckCircle2, + Clock3, + ExternalLink, + FilePenLine, + FileText, + ImagePlus, + Loader2, + Radio, + RefreshCw, + Save, + Shuffle, + Sparkles, + Trash2, + X, +} from "lucide-react" + +import { Badge } from "@/components/ui/badge" +import { Button } from "@/components/ui/button" +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" +import { Textarea } from "@/components/ui/textarea" + +type Dashboard = { + sources: number + videos: number + newVideos: number + processingVideos: number + drafts: number + scheduled: number + published: number +} + +type VideoArticle = { + id: number + title: string + status: string +} + +type Video = { + id: number + title: string + sourceUrl: string + status: string + progressPercent: number + progressStage: string + durationSeconds?: number + createdAt?: string + publishedAt?: string + errorMessage?: string + articleIds: number[] + articles?: VideoArticle[] +} + +type Article = { + id: number + title: string + slug: string + status: string + url: string + createdAt?: string + publishedAt?: string +} + +type ArticlesPage = { + items: Article[] + total: number + limit: number + offset: number + hasMore: boolean +} + +type ArticleDetail = Article & { + contentHtml: string + editableHtml: string + videoId?: number +} + +type VideoLog = { + id: number + title: string + status: string + progressPercent: number + progressStage: string + progressLog: string + errorMessage?: string +} + +type EditorBlock = OutputData["blocks"][number] + +type RandomFrameTuneConfig = { + onReplace?: (block: BlockAPI) => void | Promise +} + +const ARTICLES_PAGE_SIZE = 10 + +class RandomFrameTune { + private readonly block: BlockAPI + private readonly config: RandomFrameTuneConfig + + static get isTune() { + return true + } + + constructor({ block, config }: { block: BlockAPI; config?: RandomFrameTuneConfig }) { + this.block = block + this.config = config ?? {} + } + + render() { + return { + icon: '', + label: "Другой кадр", + onActivate: () => { + void this.config.onReplace?.(this.block) + }, + } + } +} + +const editorI18n = { + messages: { + ui: { + blockTunes: { + toggler: { + "Click to tune": "Настроить блок", + "or drag to move": "или перетащите", + }, + }, + inlineToolbar: { + converter: { + "Convert to": "Преобразовать в", + }, + }, + toolbar: { + toolbox: { + Add: "Добавить", + }, + }, + popover: { + Filter: "Фильтр", + "Nothing found": "Ничего не найдено", + "Convert to": "Преобразовать в", + }, + }, + toolNames: { + Text: "Текст", + Link: "Ссылка", + Bold: "Жирный", + Italic: "Курсив", + Heading: "Заголовок", + List: "Список", + Quote: "Цитата", + Image: "Изображение", + }, + tools: { + link: { + "Add a link": "Вставьте ссылку", + }, + stub: { + "The block can not be displayed correctly.": "Блок не может быть отображен корректно.", + }, + header: { + "Heading 2": "Заголовок 2", + "Heading 3": "Заголовок 3", + "Enter a header": "Введите заголовок", + }, + list: { + Ordered: "Нумерованный", + Unordered: "Маркированный", + }, + quote: { + "Enter a quote": "Введите цитату", + "Enter a caption": "Автор или пояснение", + "Align Left": "По левому краю", + "Align Center": "По центру", + }, + image: { + Caption: "Подпись", + "Select an Image": "Выбрать изображение", + "With border": "С рамкой", + "Stretch image": "Растянуть изображение", + "With background": "С фоном", + "With caption": "С подписью", + "Couldn’t upload image. Please try another.": "Не удалось загрузить изображение. Попробуйте другое.", + }, + }, + blockTunes: { + delete: { + Delete: "Удалить", + "Click to delete": "Нажмите, чтобы удалить", + }, + moveUp: { + "Move up": "Переместить вверх", + }, + moveDown: { + "Move down": "Переместить вниз", + }, + randomFrame: { + "Другой кадр": "Другой кадр", + }, + }, + }, +} + +async function api(path: string, init?: RequestInit): Promise { + const isFormData = init?.body instanceof FormData + const response = await fetch(path, { + ...init, + headers: { ...(isFormData ? {} : { "content-type": "application/json" }), ...(init?.headers ?? {}) }, + }) + if (!response.ok) { + throw new Error(await response.text()) + } + return response.json() as Promise +} + +function escapeHtml(value: string) { + return value + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) +} + +function normalizeEditorText(value: string) { + const parser = new DOMParser() + const document = parser.parseFromString(`
${value || ""}
`, "text/html") + return (document.body.textContent || "") + .replace(/^#{1,6}\s*/, "") + .replace(/\s+/g, " ") + .trim() + .toLowerCase() + .replace(/ё/g, "е") +} + +function stripLeadingDuplicateTitleBlock(blocks: EditorBlock[], title?: string) { + const normalizedTitle = normalizeEditorText(title || "") + if (!normalizedTitle || blocks.length === 0) return blocks + const first = blocks[0] + if (!["paragraph", "header"].includes(first.type)) return blocks + const text = normalizeEditorText(String((first.data as Record).text || "")) + return text === normalizedTitle ? blocks.slice(1) : blocks +} + +function htmlToEditorData(html: string, title?: string): OutputData { + const parser = new DOMParser() + const document = parser.parseFromString(`
${html || ""}
`, "text/html") + const root = document.querySelector("main") + const blocks: EditorBlock[] = [] + + function pushParagraph(element: Element) { + const text = element.innerHTML.trim() + if (text) { + blocks.push({ type: "paragraph", data: { text } }) + } + } + + root?.childNodes.forEach((node) => { + if (node.nodeType === Node.TEXT_NODE) { + const text = node.textContent?.trim() + if (text) { + blocks.push({ type: "paragraph", data: { text: escapeHtml(text) } }) + } + return + } + if (!(node instanceof Element)) return + const tag = node.tagName.toLowerCase() + if (tag === "p") { + pushParagraph(node) + return + } + if (tag === "h2" || tag === "h3") { + blocks.push({ type: "header", data: { text: node.innerHTML.trim(), level: tag === "h2" ? 2 : 3 } }) + return + } + if (tag === "blockquote") { + blocks.push({ type: "quote", data: { text: node.innerHTML.trim(), caption: "", alignment: "left" } }) + return + } + if (tag === "ul" || tag === "ol") { + const items = Array.from(node.querySelectorAll(":scope > li")).map((item) => item.innerHTML.trim()).filter(Boolean) + blocks.push({ type: "list", data: { style: tag === "ol" ? "ordered" : "unordered", items } }) + return + } + if (tag === "figure") { + const image = node.querySelector("img") + if (!image) return + blocks.push({ + type: "image", + data: { + file: { url: image.getAttribute("src") || "" }, + caption: node.querySelector("figcaption")?.innerHTML.trim() || image.getAttribute("alt") || "", + withBorder: false, + withBackground: false, + stretched: false, + }, + }) + return + } + pushParagraph(node) + }) + + const cleanBlocks = stripLeadingDuplicateTitleBlock(blocks, title) + + return { + time: Date.now(), + blocks: cleanBlocks.length ? cleanBlocks : [{ type: "paragraph", data: { text: "" } }], + version: "2.30.8", + } +} + +function editorDataToHtml(data: OutputData, title?: string): string { + return stripLeadingDuplicateTitleBlock(data.blocks || [], title) + .map((block) => { + const item = block.data as Record + if (block.type === "header") { + const level = item.level === 3 ? 3 : 2 + return `${item.text || ""}` + } + if (block.type === "list") { + const tag = item.style === "ordered" ? "ol" : "ul" + const items = Array.isArray(item.items) ? item.items : [] + return `<${tag}>${items.map((value) => `
  • ${value}
  • `).join("")}` + } + if (block.type === "quote") { + return `
    ${item.text || ""}
    ` + } + if (block.type === "image") { + const url = item.file?.url || item.url || "" + if (!url) return "" + const caption = item.caption || "" + return `
    ${escapeHtml(caption)}
    ${caption}
    ` + } + return `

    ${item.text || ""}

    ` + }) + .filter(Boolean) + .join("\n") +} + +function formatDuration(seconds?: number) { + if (!seconds) return "—" + const minutes = Math.floor(seconds / 60) + const rest = seconds % 60 + return `${minutes}:${String(rest).padStart(2, "0")}` +} + +function parseApiDate(value?: string) { + if (!value) return null + const normalized = /(?:z|[+-]\d{2}:?\d{2})$/i.test(value) ? value : `${value}Z` + const date = new Date(normalized) + return Number.isNaN(date.getTime()) ? null : date +} + +function toDateTimeLocalValue(value?: string) { + const date = parseApiDate(value) + if (!date) return "" + const local = new Date(date.getTime() - date.getTimezoneOffset() * 60000) + return local.toISOString().slice(0, 16) +} + +function currentDateTimeLocalValue() { + const date = new Date() + const local = new Date(date.getTime() - date.getTimezoneOffset() * 60000) + return local.toISOString().slice(0, 16) +} + +function formatDateTime(value?: string) { + const date = parseApiDate(value) + if (!date) return "" + return new Intl.DateTimeFormat("ru-RU", { + day: "2-digit", + month: "short", + hour: "2-digit", + minute: "2-digit", + }).format(date) +} + +function formatVideoDate(value?: string) { + const date = parseApiDate(value) + if (!date) return "дата неизвестна" + return new Intl.DateTimeFormat("ru-RU", { + day: "2-digit", + month: "short", + year: "numeric", + hour: "2-digit", + minute: "2-digit", + }).format(date) +} + +function isScheduledForFuture(value?: string) { + const date = parseApiDate(value) + return Boolean(date && date.getTime() > Date.now()) +} + +function dateSortValue(value?: string) { + return parseApiDate(value)?.getTime() ?? 0 +} + +function statusVariant(status: string) { + if (status === "published" || status === "drafted") return "default" + if (status === "error") return "destructive" + if (status === "processing") return "secondary" + return "outline" +} + +function StatusBadge({ status }: { status: string }) { + const normalized = status.toLowerCase() + if (normalized === "published") { + return ( + + + Опубликовано + + ) + } + if (normalized === "drafted" || normalized === "draft") { + return ( + + + Черновик + + ) + } + if (normalized === "error") { + return ( + + + Ошибка + + ) + } + if (normalized === "processing" || normalized === "queued") { + return ( + + {normalized === "processing" ? : } + {normalized === "processing" ? "В работе" : "В очереди"} + + ) + } + return {status} +} + +function ArticlePlaceholder() { + return ( +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + ) +} + +export default function App() { + const [dashboard, setDashboard] = useState(null) + const [videos, setVideos] = useState([]) + const [articles, setArticles] = useState([]) + const [articlesHasMore, setArticlesHasMore] = useState(false) + const [articlesLoading, setArticlesLoading] = useState(false) + const [selectedLog, setSelectedLog] = useState(null) + const [selectedArticle, setSelectedArticle] = useState(null) + const [editorTitle, setEditorTitle] = useState("") + const [publishAt, setPublishAt] = useState("") + const [editorDirty, setEditorDirty] = useState(false) + const [editorBusy, setEditorBusy] = useState(false) + const [statusMessage, setStatusMessage] = useState("") + const [busy, setBusy] = useState(false) + const [videoActionId, setVideoActionId] = useState(null) + const editorHolderRef = useRef(null) + const editorInstanceRef = useRef(null) + const fileInputRef = useRef(null) + const logSocketRef = useRef(null) + const selectedArticleRef = useRef(null) + const editorTitleRef = useRef("") + const titleTextareaRef = useRef(null) + const articlesOffsetRef = useRef(0) + const articlesLoadingRef = useRef(false) + const articlesHasMoreRef = useRef(false) + + const feedUrl = useMemo(() => `${window.location.origin}/feed`, []) + const productionVideos = useMemo( + () => + videos + .filter((video) => !video.articles?.some((article) => article.status === "published")) + .sort((a, b) => dateSortValue(b.publishedAt || b.createdAt) - dateSortValue(a.publishedAt || a.createdAt)), + [videos] + ) + const activeVideos = useMemo(() => productionVideos.filter((video) => ["queued", "processing"].includes(video.status)), [productionVideos]) + const publishedArticles = useMemo( + () => + articles + .filter((article) => article.status === "published") + .sort((a, b) => dateSortValue(b.publishedAt || b.createdAt) - dateSortValue(a.publishedAt || a.createdAt)), + [articles] + ) + + async function loadArticlesPage(reset = false) { + if (articlesLoadingRef.current) return + const offset = reset ? 0 : articlesOffsetRef.current + articlesLoadingRef.current = true + setArticlesLoading(true) + try { + const page = await api(`/api/articles?status=published&limit=${ARTICLES_PAGE_SIZE}&offset=${offset}`) + articlesOffsetRef.current = offset + page.items.length + articlesHasMoreRef.current = page.hasMore + setArticlesHasMore(page.hasMore) + setArticles((current) => { + if (reset) return page.items + const existingIds = new Set(current.map((article) => article.id)) + return [...current, ...page.items.filter((article) => !existingIds.has(article.id))] + }) + } finally { + articlesLoadingRef.current = false + setArticlesLoading(false) + } + } + + async function refresh() { + const showArticlePlaceholders = articlesOffsetRef.current === 0 + if (showArticlePlaceholders) { + setArticlesLoading(true) + } + try { + const [nextDashboard, nextVideos, nextArticles] = await Promise.all([ + api("/api/dashboard"), + api("/api/videos"), + api(`/api/articles?status=published&limit=${ARTICLES_PAGE_SIZE}&offset=0`), + ]) + setDashboard(nextDashboard) + setVideos(nextVideos) + setArticles(nextArticles.items) + articlesOffsetRef.current = nextArticles.items.length + articlesHasMoreRef.current = nextArticles.hasMore + setArticlesHasMore(nextArticles.hasMore) + } finally { + if (showArticlePlaceholders) { + setArticlesLoading(false) + } + } + } + + useEffect(() => { + refresh().catch((error) => { + setStatusMessage(`Ошибка загрузки: ${error.message}`) + }) + }, []) + + useEffect(() => { + if (activeVideos.length === 0) return + const timer = window.setInterval(() => { + refresh().catch((error) => { + setStatusMessage(`Ошибка обновления: ${error.message}`) + }) + }, 5000) + return () => window.clearInterval(timer) + }, [activeVideos.length]) + + useEffect(() => () => { + logSocketRef.current?.close() + }, []) + + useEffect(() => { + selectedArticleRef.current = selectedArticle + }, [selectedArticle]) + + useEffect(() => { + editorTitleRef.current = editorTitle + const element = titleTextareaRef.current + if (element) { + element.style.height = "auto" + element.style.height = `${element.scrollHeight}px` + } + }, [editorTitle]) + + async function scanSources() { + setBusy(true) + try { + const result = await api<{ taskId: string }>("/api/sources/scan", { method: "POST" }) + setStatusMessage(`Проверяю VK Видео. Task: ${result.taskId}`) + await refresh() + } finally { + setBusy(false) + } + } + + async function processVideo(id: number, restart = false) { + setVideoActionId(id) + try { + const result = await api<{ taskId: string }>(`/api/videos/${id}/process`, { method: "POST" }) + setStatusMessage(`${restart ? "Перезапустил" : "Поставил"} ролик #${id} в обработку. Task: ${result.taskId}`) + await refresh() + } finally { + setVideoActionId(null) + } + } + + async function openVideoLog(id: number) { + logSocketRef.current?.close() + const result = await api(`/api/videos/${id}/logs`) + setSelectedLog(result) + const protocol = window.location.protocol === "https:" ? "wss:" : "ws:" + const socket = new WebSocket(`${protocol}//${window.location.host}/api/videos/${id}/logs/ws`) + logSocketRef.current = socket + socket.onmessage = (event) => { + try { + setSelectedLog(JSON.parse(event.data) as VideoLog) + } catch { + // Ignore malformed frames; the next server tick will replace the state. + } + } + socket.onerror = () => { + setStatusMessage("Не удалось подключиться к live-логам. Показываю последний полученный лог.") + } + socket.onclose = () => { + if (logSocketRef.current === socket) { + logSocketRef.current = null + } + } + } + + function closeVideoLog() { + logSocketRef.current?.close() + logSocketRef.current = null + setSelectedLog(null) + } + + async function openArticlePreview(id: number) { + const result = await api(`/api/articles/${id}`) + setSelectedArticle(result) + setEditorTitle(result.title) + setPublishAt(toDateTimeLocalValue(result.publishedAt) || currentDateTimeLocalValue()) + setEditorDirty(false) + } + + async function publishArticle(id: number, scheduledAt?: string) { + const result = await api<{ url: string; publishedAt?: string }>(`/api/articles/${id}/publish`, { + method: "POST", + body: JSON.stringify({ publishedAt: scheduledAt || null }), + }) + const isFuture = isScheduledForFuture(result.publishedAt) + setStatusMessage(isFuture ? `Запланировал статью на ${formatDateTime(result.publishedAt)}: ${result.url}` : `Принял статью и отправил в RSS: ${result.url}`) + await refresh() + } + + async function uploadImage(file: File) { + const body = new FormData() + body.append("file", file) + const result = await api<{ url: string }>("/api/uploads/images", { + method: "POST", + body, + }) + return result.url + } + + useEffect(() => { + if (!selectedArticle || !editorHolderRef.current) return + editorInstanceRef.current?.destroy() + editorHolderRef.current.innerHTML = "" + const editor = new EditorJS({ + holder: editorHolderRef.current, + data: htmlToEditorData(selectedArticle.editableHtml || selectedArticle.contentHtml, selectedArticle.title), + autofocus: false, + placeholder: "Начните писать...", + inlineToolbar: ["bold", "italic", "link"], + i18n: editorI18n, + tools: { + header: { + class: Header as unknown as ToolConstructable, + inlineToolbar: ["bold", "italic", "link"], + config: { + levels: [2, 3], + defaultLevel: 2, + placeholder: "Введите заголовок", + }, + }, + list: { + class: List as unknown as ToolConstructable, + inlineToolbar: true, + }, + quote: { + class: Quote as unknown as ToolConstructable, + inlineToolbar: true, + config: { + quotePlaceholder: "Цитата", + captionPlaceholder: "", + }, + }, + image: { + class: ImageTool as unknown as ToolConstructable, + tunes: ["randomFrame"], + config: { + captionPlaceholder: "Подпись к изображению", + uploader: { + uploadByFile: async (file: File) => ({ + success: 1, + file: { url: await uploadImage(file) }, + }), + uploadByUrl: async (url: string) => ({ + success: 1, + file: { url }, + }), + }, + }, + }, + randomFrame: { + class: RandomFrameTune as unknown as ToolConstructable, + config: { + onReplace: replaceWithRandomFrame, + }, + }, + }, + onChange: () => setEditorDirty(true), + }) + editorInstanceRef.current = editor + editor.isReady.catch((error) => { + setStatusMessage(`Ошибка редактора: ${error}`) + }) + return () => { + if (editorInstanceRef.current === editor) { + editorInstanceRef.current = null + } + editor.destroy() + } + }, [selectedArticle?.id]) + + async function insertImageFile(file: File) { + if (!file.type.startsWith("image/")) return + setEditorBusy(true) + try { + const url = await uploadImage(file) + const caption = editorTitle || selectedArticle?.title || file.name + editorInstanceRef.current?.blocks.insert("image", { file: { url }, caption }) + setEditorDirty(true) + } finally { + setEditorBusy(false) + } + } + + async function replaceWithRandomFrame(blockToReplace?: BlockAPI) { + const article = selectedArticleRef.current + if (!article?.videoId || !editorInstanceRef.current) return + const editor = editorInstanceRef.current + const index = editor.blocks.getCurrentBlockIndex() + const block = blockToReplace ?? (index >= 0 ? editor.blocks.getBlockByIndex(index) : undefined) + setEditorBusy(true) + block?.holder.classList.add("is-random-frame-loading") + try { + const result = await api<{ url: string; timestampSeconds: number }>(`/api/articles/${article.id}/random-frame`, { method: "POST" }) + const data = { + file: { url: result.url }, + caption: `${editorTitleRef.current || article.title} (${formatDuration(result.timestampSeconds)})`, + withBorder: false, + withBackground: false, + stretched: false, + } + if (block?.name === "image") { + await editor.blocks.update(block.id, data) + } else { + editor.blocks.insert("image", data, undefined, index >= 0 ? index + 1 : undefined, true) + } + setEditorDirty(true) + } finally { + block?.holder.classList.remove("is-random-frame-loading") + setEditorBusy(false) + } + } + + async function saveArticle(showMessage = true) { + if (!selectedArticle) return selectedArticle + setEditorBusy(true) + try { + const editorData = await editorInstanceRef.current?.save() + const result = await api(`/api/articles/${selectedArticle.id}`, { + method: "PATCH", + body: JSON.stringify({ + title: editorTitle, + editableHtml: editorDataToHtml(editorData ?? htmlToEditorData("", editorTitle), editorTitle), + }), + }) + setSelectedArticle(result) + setEditorTitle(result.title) + setEditorDirty(false) + await refresh() + if (showMessage) { + setStatusMessage(`Сохранил статью: ${result.title}`) + } + return result + } finally { + setEditorBusy(false) + } + } + + async function saveAndPublishArticle() { + if (!selectedArticle) return + const article = editorDirty ? await saveArticle(false) : selectedArticle + if (!article) return + const scheduledAt = publishAt ? new Date(publishAt).toISOString() : undefined + await publishArticle(article.id, scheduledAt) + setSelectedArticle(null) + } + + async function deleteArticle(id: number) { + const articleTitle = selectedArticle?.id === id ? selectedArticle.title : articles.find((article) => article.id === id)?.title + if (!window.confirm(`Удалить статью${articleTitle ? ` «${articleTitle}»` : ""}? Она пропадёт из списка и RSS.`)) return + await api<{ id: number; status: string }>(`/api/articles/${id}`, { method: "DELETE" }) + setStatusMessage(`Удалил статью${articleTitle ? `: ${articleTitle}` : ""}`) + if (selectedArticle?.id === id) { + setSelectedArticle(null) + } + await refresh() + } + + async function deleteVideo(id: number, title?: string) { + if (!window.confirm(`Удалить ролик${title ? ` «${title}»` : ""}? Он исчезнет из списка и больше не будет импортироваться из VK.`)) return + setVideoActionId(id) + try { + await api<{ id: number; status: string }>(`/api/videos/${id}`, { method: "DELETE" }) + setStatusMessage(`Удалил ролик${title ? `: ${title}` : ""}. Он исключен из повторного импорта.`) + await refresh() + } finally { + setVideoActionId(null) + } + } + + return ( +
    +
    +
    +
    +
    + +
    +
    +

    Дзен-ассистент

    +

    RSS-конвейер для статей из видео Николая Старикова

    +
    +
    +
    + + +
    +
    + +
    + {[ + ["Ролики", dashboard?.videos ?? 0], + ["Новые", dashboard?.newVideos ?? 0], + ["В работе", dashboard?.processingVideos ?? 0], + ["Черновики", dashboard?.drafts ?? 0], + ["Запланировано", dashboard?.scheduled ?? 0], + ["В RSS", dashboard?.published ?? 0], + ].map(([label, value]) => ( + + + {label} + {value} + + + ))} +
    + + {statusMessage ?
    {statusMessage}
    : null} + +
    + + +
    +
    + Ролики + Все ролики, прогресс обработки, логи и готовые черновики в одном списке. +
    + {activeVideos.length} в работе +
    +
    + + {productionVideos.length > 0 ? ( + productionVideos.map((video) => { + const draftArticle = video.articles?.find((article) => article.status !== "published") + const publishedArticle = video.articles?.find((article) => article.status === "published") + const fallbackArticleId = video.articleIds?.[0] + const draftArticleId = draftArticle?.id ?? (publishedArticle ? undefined : fallbackArticleId) + const progress = Math.max(0, Math.min(100, video.progressPercent || 0)) + const hasStarted = video.status !== "new" || progress > 0 + const isActive = ["queued", "processing"].includes(video.status) + const isSubmitting = videoActionId === video.id + const hasDraftAction = Boolean(draftArticleId) + return ( +
    +
    +
    +
    + {!hasDraftAction && !publishedArticle ? : null} + {publishedArticle ? : null} +

    {video.title || `Ролик #${video.id}`}

    +
    +
    + Опубликовано: {formatVideoDate(video.publishedAt)} + Длительность: {formatDuration(video.durationSeconds)} +
    + {hasStarted && video.progressStage ?

    {video.progressStage}

    : null} + {video.errorMessage ?

    {video.errorMessage}

    : null} +
    +
    + {draftArticleId ? ( + + ) : publishedArticle ? ( + + ) : isActive ? ( + + ) : ( + + )} + + +
    +
    + {hasStarted ? ( +
    +
    +
    +
    + {progress}% +
    + ) : null} +
    + ) + }) + ) : ( +
    Новых роликов и черновиков пока нет. Готовые материалы находятся в колонке «Статьи».
    + )} + + + + + + Статьи + Принятые материалы: уже вышедшие в RSS и отложенные по времени. + + { + const element = event.currentTarget + const distanceToBottom = element.scrollHeight - element.scrollTop - element.clientHeight + if (distanceToBottom < 180 && articlesHasMoreRef.current) { + void loadArticlesPage() + } + }} + > + {publishedArticles.length > 0 ? ( + publishedArticles.map((article) => ( +
    +
    + +
    + + + +
    +
    +
    + )) + ) : articlesLoading ? ( + Array.from({ length: 5 }).map((_, index) => ) + ) : ( +
    Принятых статей пока нет. Черновики открываются из роликов слева.
    + )} + {publishedArticles.length > 0 && articlesLoading + ? Array.from({ length: 3 }).map((_, index) => ) + : null} + {articlesHasMore && !articlesLoading ? ( + + ) : null} +
    +
    +
    +
    + {selectedLog ? ( +
    +
    +
    +
    +

    Логи обработки

    +

    {selectedLog.title || `Ролик #${selectedLog.id}`}

    +
    + +
    +
    +
    +
    +

    Статус

    + + {selectedLog.status} + +
    +
    +

    Этап

    +

    {selectedLog.progressStage || "—"}

    +
    +
    +

    Прогресс

    +

    {selectedLog.progressPercent || 0}%

    +
    +
    + {selectedLog.errorMessage ?

    {selectedLog.errorMessage}

    : null} +
    +                {selectedLog.progressLog || "Лог пока пуст."}
    +              
    +
    +
    +
    + ) : null} + {selectedArticle ? ( +
    +
    +
    +
    +
    + {isScheduledForFuture(selectedArticle.publishedAt) ? ( + + + Отложено + + ) : ( + + )} +

    Редактирование статьи

    + {editorDirty ? есть правки : null} +
    +

    Редактируйте блоки как в Medium. Для картинки выберите image-блок и нажмите кнопку случайного кадра.

    +
    +
    + { + const file = event.currentTarget.files?.[0] + event.currentTarget.value = "" + if (file) await insertImageFile(file) + }} + /> + + + + {selectedArticle.status !== "published" || isScheduledForFuture(selectedArticle.publishedAt) ? ( + <> + + + + ) : ( + + )} + + +
    +
    +
    +
    +