From 257059770d1d0fec88b25f1e39037dac1de5924c Mon Sep 17 00:00:00 2001 From: Vedank Purohit Date: Sun, 11 Jan 2026 20:20:12 +0530 Subject: [PATCH 1/9] feat: Add OCR and hybrid search capabilities --- api/main.py | 15 +- api/routes/events.py | 285 ++++++++++++ api/routes/search.py | 122 +++-- api/routes/setup.py | 183 ++++++++ api/routes/sync.py | 183 +++++++- api/schemas.py | 278 +++++++++++- api/tests/test_api.py | 239 ++++++++++ core/chunking.py | 320 +++++++++++++ core/config.py | 100 +++++ core/database.py | 699 ++++++++++++++++++++++++++++- core/embeddings.py | 16 + core/ocr.py | 239 ++++++++++ core/ocr_providers/__init__.py | 20 + core/ocr_providers/apple_vision.py | 131 ++++++ core/ocr_providers/tesseract.py | 156 +++++++ core/processor.py | 390 +++++++++++++++- core/text_embeddings.py | 388 ++++++++++++++++ main.py | 1 + pyproject.toml | 6 + scripts/cleanup_ocr.py | 109 +++++ tray/app.py | 30 +- uv.lock | 71 +++ web/src/app/page.tsx | 21 +- web/src/app/setup/page.tsx | 461 +++++++++++++++---- web/src/lib/api.ts | 6 +- web/src/types/index.ts | 4 + 26 files changed, 4321 insertions(+), 152 deletions(-) create mode 100644 api/routes/events.py create mode 100644 core/chunking.py create mode 100644 core/ocr.py create mode 100644 core/ocr_providers/__init__.py create mode 100644 core/ocr_providers/apple_vision.py create mode 100644 core/ocr_providers/tesseract.py create mode 100644 core/text_embeddings.py create mode 100644 scripts/cleanup_ocr.py diff --git a/api/main.py b/api/main.py index a939eb9..49e3552 100644 --- a/api/main.py +++ b/api/main.py @@ -13,7 +13,7 @@ from fastapi.responses import FileResponse, RedirectResponse from fastapi.staticfiles import StaticFiles -from api.routes import compression, incognito, recording, screenshots, search, setup, status, sync +from api.routes import compression, events, incognito, recording, screenshots, search, setup, status, sync from core.database import db @@ -48,6 +48,17 @@ async def lifespan(app: FastAPI): print(f"📁 Database: {db.db_path}") print(f"📊 Screenshots: {stats['total_screenshots']} total, {stats['synced']} synced") + # Auto-start OCR migration if needed (for existing screenshots without OCR) + # This does NOT process new screenshots - those still require manual sync + from core.config import config + from core.processor import processor_service + + if config.ocr.enabled: + ocr_pending = db.get_ocr_pending_count() + if ocr_pending > 0: + print(f"🔄 Starting OCR migration for {ocr_pending} existing screenshots...") + processor_service.start_ocr_migration() + yield # Shutdown @@ -122,6 +133,7 @@ async def strip_trailing_slash(request: Request, call_next): app.include_router(compression.router, prefix="/api/v1") app.include_router(incognito.router, prefix="/api/v1") app.include_router(setup.router, prefix="/api/v1") +app.include_router(events.router, prefix="/api/v1") # Serve static web UI if available @@ -195,4 +207,5 @@ async def root(): host="127.0.0.1", port=8742, reload=True, + log_level="warning", # Suppress verbose access logs ) diff --git a/api/routes/events.py b/api/routes/events.py new file mode 100644 index 0000000..ac894bd --- /dev/null +++ b/api/routes/events.py @@ -0,0 +1,285 @@ +""" +SSE Events API Routes +Server-Sent Events for real-time model download and sync progress updates. + +Events: +- model_download: Progress for CLIP/BGE model downloads +- sync_progress: Progress for sync operations (embeddings, OCR, text embeddings) +- model_status: Model loading/unloading status changes +""" + +import asyncio +import json +from collections.abc import AsyncGenerator +from contextlib import asynccontextmanager + +from fastapi import APIRouter +from fastapi.responses import StreamingResponse + +from core.database import db + +router = APIRouter(prefix="/events", tags=["Events"]) + +# Global event queue for broadcasting events to all connected clients +_event_subscribers: list[asyncio.Queue] = [] + + +def broadcast_event(event_type: str, data: dict): + """Broadcast an event to all connected SSE clients""" + event_data = {"type": event_type, **data} + for queue in _event_subscribers: + try: + queue.put_nowait(event_data) + except asyncio.QueueFull: + pass # Skip if queue is full + + +@asynccontextmanager +async def subscribe_to_events(): + """Context manager for subscribing to events""" + queue: asyncio.Queue = asyncio.Queue(maxsize=100) + _event_subscribers.append(queue) + try: + yield queue + finally: + _event_subscribers.remove(queue) + + +async def event_generator() -> AsyncGenerator[str, None]: + """Generate SSE events for connected clients""" + async with subscribe_to_events() as queue: + # Send initial status + yield format_sse_event("connected", {"message": "Connected to event stream"}) + + # Send initial model status + try: + from core.embeddings import get_model_status as get_clip_status + + clip_status = get_clip_status() + yield format_sse_event( + "model_status", + { + "model": "clip", + "loaded": clip_status["loaded"], + "device": clip_status["device"], + }, + ) + except Exception: + pass + + try: + from core.text_embeddings import get_model_status as get_bge_status + + bge_status = get_bge_status() + yield format_sse_event( + "model_status", + { + "model": "text_embedding", + "loaded": bge_status["loaded"], + "device": bge_status["device"], + }, + ) + except Exception: + pass + + # Send initial sync status + try: + from core.processor import processor_service + + progress = processor_service.progress + yield format_sse_event( + "sync_progress", + { + "is_syncing": progress.is_running, + "total": progress.total, + "processed": progress.processed, + "errors": progress.errors, + "current_phase": progress.current_phase, + "embeddings_done": progress.embeddings_done, + "ocr_done": progress.ocr_done, + "text_embeddings_done": progress.text_embeddings_done, + }, + ) + except Exception: + pass + + # Listen for new events + while True: + try: + # Wait for event with timeout (to send keepalive) + event = await asyncio.wait_for(queue.get(), timeout=30.0) + yield format_sse_event(event["type"], event) + except asyncio.TimeoutError: + # Send keepalive comment + yield ": keepalive\n\n" + + +def format_sse_event(event_type: str, data: dict) -> str: + """Format data as Server-Sent Event""" + return f"event: {event_type}\ndata: {json.dumps(data)}\n\n" + + +@router.get("/stream") +async def event_stream(): + """ + SSE endpoint for real-time events. + + Events sent: + - connected: Initial connection confirmation + - model_status: Model loading/unloading status (clip, text_embedding) + - model_download: Model download progress (progress %, size) + - sync_progress: Sync operation progress (phase, counts) + - ocr_progress: OCR processing progress + """ + return StreamingResponse( + event_generator(), + media_type="text/event-stream", + headers={ + "Cache-Control": "no-cache", + "Connection": "keep-alive", + "X-Accel-Buffering": "no", # Disable nginx buffering + }, + ) + + +@router.get("/status") +async def get_all_status(): + """ + Get current status of all models and sync operations. + + This is a polling alternative to SSE for clients that don't support it. + """ + # CLIP model status + clip_status = {"loaded": False, "device": None, "downloading": False} + try: + from core.embeddings import get_model_status as get_clip_status + + status = get_clip_status() + clip_status = { + "loaded": status["loaded"], + "device": status["device"], + "downloading": False, + } + except Exception: + pass + + # Text embedding model status + text_status = {"loaded": False, "device": None, "downloading": False} + try: + from core.text_embeddings import get_model_status as get_bge_status + + status = get_bge_status() + text_status = { + "loaded": status["loaded"], + "device": status["device"], + "downloading": False, + } + except Exception: + pass + + # OCR status + ocr_status = {"available": False, "provider": None} + try: + from core.ocr import ocr_service + + ocr_status = { + "available": ocr_service.is_available(), + "provider": ocr_service.get_provider_name() if ocr_service.is_available() else None, + } + except Exception: + pass + + # Sync status + sync_status = { + "is_syncing": False, + "total": 0, + "processed": 0, + "current_phase": "", + "embeddings_done": 0, + "ocr_done": 0, + "text_embeddings_done": 0, + } + try: + from core.processor import processor_service + + progress = processor_service.progress + sync_status = { + "is_syncing": progress.is_running, + "total": progress.total, + "processed": progress.processed, + "current_phase": progress.current_phase, + "embeddings_done": progress.embeddings_done, + "ocr_done": progress.ocr_done, + "text_embeddings_done": progress.text_embeddings_done, + } + except Exception: + pass + + # OCR stats + ocr_stats = {"pending": 0, "completed": 0} + try: + stats = db.get_ocr_stats() + ocr_stats = { + "pending": stats["without_ocr"], + "completed": stats["with_ocr"], + } + except Exception: + pass + + return { + "clip": clip_status, + "text_embedding": text_status, + "ocr": ocr_status, + "sync": sync_status, + "ocr_stats": ocr_stats, + } + + +# Helper function to be called from other modules +def emit_model_download_progress(model: str, progress: float, size_mb: int | None = None): + """Emit model download progress event""" + broadcast_event( + "model_download", + { + "model": model, + "progress": progress, + "size_mb": size_mb, + "status": "downloading" if progress < 100 else "complete", + }, + ) + + +def emit_model_status(model: str, loaded: bool, device: str | None = None): + """Emit model status change event""" + broadcast_event( + "model_status", + { + "model": model, + "loaded": loaded, + "device": device, + }, + ) + + +def emit_sync_progress( + is_syncing: bool, + total: int, + processed: int, + phase: str, + embeddings_done: int = 0, + ocr_done: int = 0, + text_embeddings_done: int = 0, +): + """Emit sync progress event""" + broadcast_event( + "sync_progress", + { + "is_syncing": is_syncing, + "total": total, + "processed": processed, + "current_phase": phase, + "embeddings_done": embeddings_done, + "ocr_done": ocr_done, + "text_embeddings_done": text_embeddings_done, + }, + ) diff --git a/api/routes/search.py b/api/routes/search.py index ebe29a4..5c92839 100644 --- a/api/routes/search.py +++ b/api/routes/search.py @@ -1,6 +1,15 @@ """ Search API Routes -Semantic search for screenshots +Semantic search for screenshots with hybrid search support. + +Search modes: +- auto: Hybrid search combining image + text (default, recommended) +- image: CLIP image embedding search only +- text_fuzzy: FTS5 trigram text search only +- text_semantic: BGE text embedding search only + +The hybrid search uses Reciprocal Rank Fusion (RRF) to combine results +from multiple sources. """ from fastapi import APIRouter, HTTPException @@ -27,15 +36,18 @@ async def search_screenshots(request: SearchRequest): """ Search for screenshots using natural language. - This loads the CLIP model (if not already loaded) and performs - semantic similarity search against all synced screenshots. + Supports multiple search modes: + - auto: Hybrid search combining image + text (recommended) + - image: CLIP semantic search only + - text_fuzzy: FTS5 trigram text search only + - text_semantic: BGE text embedding search only Optionally filter by date range using start_date and end_date. Examples: - - "blue shirt on amazon" - - "error message in terminal" - - "video call with team" + - "blue shirt on amazon" (visual search) + - "error: connection refused" (text search) + - "video call with team" (hybrid search) """ # Check if we have any synced screenshots stats = db.get_stats() @@ -45,37 +57,93 @@ async def search_screenshots(request: SearchRequest): detail="No synced screenshots. Run sync first to generate embeddings.", ) - # Generate query embedding + search_mode = request.search_mode.lower() + + # Generate embeddings based on search mode + image_embedding = None + text_embedding = None + try: - if request.safe_mode: - embedding = get_safe_search_embedding( - text=request.query, - safe_mode_level=request.safe_mode_level.value, - ) - elif request.negative_texts: - embedding = get_combined_embedding( - base_text=request.query, - negative_texts=request.negative_texts, - negative_weight=request.negative_weight, - ) - else: - embedding = get_text_embedding(request.query) + # CLIP image embedding (for image and auto modes) + if search_mode in ("auto", "image"): + if request.safe_mode: + image_embedding = get_safe_search_embedding( + text=request.query, + safe_mode_level=request.safe_mode_level.value, + ) + elif request.negative_texts: + image_embedding = get_combined_embedding( + base_text=request.query, + negative_texts=request.negative_texts, + negative_weight=request.negative_weight, + ) + else: + image_embedding = get_text_embedding(request.query) + + # BGE text embedding (for text_semantic and auto modes) + if search_mode in ("auto", "text_semantic"): + # Lazy import to avoid loading text model if not needed + from core.text_embeddings import text_embedding_service + + text_embedding = text_embedding_service.get_query_embedding(request.query) + except Exception as e: raise HTTPException( status_code=500, detail=f"Error generating embedding: {str(e)}", ) from e - # Search database - get more results than needed if filtering by date + # Search based on mode search_limit = request.limit * 3 if (request.start_date or request.end_date) else request.limit try: - results = db.search_similar( - embedding, - limit=search_limit, - similarity_metric=config.similarity_metric, - visibility=request.visibility.value, - ) + if search_mode == "image": + # Pure image search (legacy behavior) + results = db.search_similar( + image_embedding, + limit=search_limit, + similarity_metric=config.similarity_metric, + visibility=request.visibility.value, + ) + # Add empty match_sources for compatibility + for r in results: + r["match_sources"] = ["image"] + + elif search_mode == "text_fuzzy": + # Pure FTS5 text search + results = db.search_ocr_fts( + query=request.query, + limit=search_limit, + visibility=request.visibility.value, + ) + # Normalize response format + for r in results: + r["similarity"] = r.get("fts_rank", 0.5) # FTS rank as similarity + r["match_sources"] = ["text_fts"] + + elif search_mode == "text_semantic": + # Pure BGE text semantic search + results = db.search_text_embeddings( + query_embedding=text_embedding, + limit=search_limit, + visibility=request.visibility.value, + ) + # Normalize response format + for r in results: + r["similarity"] = r.get("text_similarity", 0) + r["match_sources"] = ["text_semantic_small", "text_semantic_large"] + + else: + # Hybrid search (auto mode - default) + results = db.search_hybrid( + query=request.query, + image_embedding=image_embedding, + text_embedding=text_embedding, + mode="auto", + limit=search_limit, + visibility=request.visibility.value, + ) + except Exception as e: raise HTTPException( status_code=500, diff --git a/api/routes/setup.py b/api/routes/setup.py index 01a1a49..5980769 100644 --- a/api/routes/setup.py +++ b/api/routes/setup.py @@ -132,3 +132,186 @@ async def set_autostart(request: AutostartSetRequest): return SuccessResponse(success=True, message="Auto-start disabled.") else: raise HTTPException(status_code=500, detail="Failed to disable auto-start.") + + +# ============================================================================= +# Model Status and Migration +# ============================================================================= + + +@router.get("/models") +async def get_model_status(): + """ + Get status of all ML models (CLIP, BGE, OCR). + + Returns download/loading status for each model to show on setup page. + Status values: "not_downloaded", "downloading", "ready" + """ + # CLIP model status + clip_status = "not_downloaded" + try: + from core.embeddings import get_model_status as get_clip_status + + status = get_clip_status() + # Check downloaded status (model could be downloaded but not loaded) + if status.get("loaded") or status.get("downloaded"): + clip_status = "ready" + except Exception: + pass + + # Text embedding model status + text_embedding_status = "not_downloaded" + try: + from core.text_embeddings import get_model_status as get_bge_status + + status = get_bge_status() + if status.get("loaded") or status.get("downloaded"): + text_embedding_status = "ready" + except Exception: + pass + + # OCR status + ocr_status = "not_available" + try: + from core.ocr import ocr_service + + if ocr_service.is_available(): + ocr_status = "ready" + except Exception: + pass + + return { + "clip": clip_status, + "text_embedding": text_embedding_status, + "ocr": ocr_status, + "all_ready": clip_status == "ready", # CLIP is required, others are optional + } + + +@router.post("/download-models") +async def download_models(): + """ + Trigger download of required ML models. + + Downloads CLIP and BGE models if not already downloaded. + This will block until models are downloaded. + """ + + from fastapi.responses import StreamingResponse + + async def download_stream(): + """Stream download progress as SSE events""" + import json + + # Download CLIP model + yield f"data: {json.dumps({'model': 'clip', 'status': 'starting'})}\n\n" + try: + from core.embeddings import is_downloaded as clip_is_downloaded + + if not clip_is_downloaded(): + yield f"data: {json.dumps({'model': 'clip', 'status': 'downloading'})}\n\n" + # Import will trigger download + from core.embeddings import get_text_embedding + + # Make a simple call to ensure model is downloaded + _ = get_text_embedding("test") + yield f"data: {json.dumps({'model': 'clip', 'status': 'ready'})}\n\n" + except Exception as e: + yield f"data: {json.dumps({'model': 'clip', 'status': 'error', 'error': str(e)})}\n\n" + + # Download BGE text embedding model + yield f"data: {json.dumps({'model': 'text_embedding', 'status': 'starting'})}\n\n" + try: + from core.text_embeddings import is_downloaded as bge_is_downloaded + + if not bge_is_downloaded(): + yield f"data: {json.dumps({'model': 'text_embedding', 'status': 'downloading'})}\n\n" + from core.text_embeddings import get_text_embedding as get_bge_embedding + + _ = get_bge_embedding("test") + yield f"data: {json.dumps({'model': 'text_embedding', 'status': 'ready'})}\n\n" + except Exception as e: + yield f"data: {json.dumps({'model': 'text_embedding', 'status': 'error', 'error': str(e)})}\n\n" + + yield f"data: {json.dumps({'status': 'complete'})}\n\n" + + return StreamingResponse( + download_stream(), + media_type="text/event-stream", + headers={ + "Cache-Control": "no-cache", + "Connection": "keep-alive", + }, + ) + + +@router.get("/migration") +async def get_migration_status(): + """ + Get OCR migration status for existing screenshots. + + Returns progress of OCR processing for screenshots that existed + before OCR was enabled. + """ + from api.schemas import MigrationStatus + from core.database import db + + try: + stats = db.get_ocr_stats() + total = stats["total_screenshots"] + with_ocr = stats["with_ocr"] + without_ocr = stats["without_ocr"] + + # Calculate progress + progress_percent = (with_ocr / total * 100) if total > 0 else 100.0 + + # Estimate remaining time (roughly 0.4s per image for OCR + embedding) + estimated_minutes = (without_ocr * 0.4) / 60 if without_ocr > 0 else None + + return MigrationStatus( + needs_migration=without_ocr > 0, + total_screenshots=total, + screenshots_with_ocr=with_ocr, + screenshots_without_ocr=without_ocr, + progress_percent=round(progress_percent, 1), + estimated_time_minutes=round(estimated_minutes, 1) if estimated_minutes else None, + ) + except Exception: + return MigrationStatus( + needs_migration=False, + total_screenshots=0, + screenshots_with_ocr=0, + screenshots_without_ocr=0, + progress_percent=100.0, + estimated_time_minutes=None, + ) + + +@router.get("/enhanced-status") +async def get_enhanced_setup_status(): + """ + Get comprehensive setup status including models and migration. + + Combines version check, model status, and migration progress + for the setup page. + """ + from api.schemas import EnhancedSetupStatus + + # Get model status + models = await get_model_status() + + # Get migration status + migration = await get_migration_status() + + return EnhancedSetupStatus( + current_version=VERSION, + last_seen_version=config.last_seen_version, + needs_setup=config.last_seen_version != VERSION, + platform=current_platform.name, + needs_permission=current_platform.needs_screen_permission(), + models_ready=models["all_ready"], + clip_status=models["clip"], + text_embedding_status=models["text_embedding"], + ocr_status=models["ocr"], + migration_status=migration if migration.needs_migration else None, + ) diff --git a/api/routes/sync.py b/api/routes/sync.py index f4cb1f1..28abd60 100644 --- a/api/routes/sync.py +++ b/api/routes/sync.py @@ -1,17 +1,27 @@ """ Sync API Routes -Process unsynced screenshots with CLIP embeddings +Process unsynced screenshots with CLIP embeddings + OCR text extraction. + +The sync process has multiple phases: +1. CLIP image embeddings (for visual semantic search) +2. OCR text extraction (for exact/fuzzy text search) +3. BGE text embeddings (for text semantic search) """ -from fastapi import APIRouter, BackgroundTasks +from fastapi import APIRouter, BackgroundTasks, HTTPException from api.schemas import ( + AllModelsStatus, + EnhancedSyncStatus, ModelStatus, + OCRConfig, + OCRStats, SuccessResponse, SyncStartRequest, SyncStartResponse, SyncStatus, ) +from core.config import config from core.database import db from core.embeddings import ( get_model_status, @@ -35,6 +45,21 @@ def progress_to_status(progress: SyncProgress) -> SyncStatus: ) +def progress_to_enhanced_status(progress: SyncProgress) -> EnhancedSyncStatus: + """Convert internal progress to enhanced API schema with OCR tracking""" + return EnhancedSyncStatus( + is_syncing=progress.is_running, + total=progress.total, + processed=progress.processed, + errors=progress.errors, + progress_percent=progress.percent, + current_phase=progress.current_phase, + embeddings_done=progress.embeddings_done, + ocr_done=progress.ocr_done, + text_embeddings_done=progress.text_embeddings_done, + ) + + @router.get("", response_model=SyncStatus) @router.get("/status", response_model=SyncStatus) async def get_sync_status(): @@ -50,8 +75,10 @@ async def start_sync( """ Start syncing unsynced screenshots. - This loads the CLIP model (if not already loaded) and generates - embeddings for screenshots that don't have them yet. + This processes screenshots in multiple phases: + 1. CLIP image embeddings (for visual semantic search) + 2. OCR text extraction (for exact/fuzzy text search) + 3. BGE text embeddings (for text semantic search) The sync runs in the background - use /sync/status to monitor progress. """ @@ -62,9 +89,12 @@ async def start_sync( unsynced_count=db.get_unsynced_count(), ) + # Check both CLIP unsynced AND OCR pending unsynced_count = db.get_unsynced_count() + ocr_pending = db.get_ocr_pending_count() if config.ocr.enabled else 0 + total_pending = unsynced_count + ocr_pending - if unsynced_count == 0: + if total_pending == 0: return SyncStartResponse( success=True, message="No screenshots to sync", @@ -78,8 +108,8 @@ async def start_sync( return SyncStartResponse( success=True, - message=f"Sync started for {unsynced_count} screenshots", - unsynced_count=unsynced_count, + message=f"Sync started for {total_pending} screenshots ({unsynced_count} new, {ocr_pending} OCR pending)", + unsynced_count=total_pending, ) @@ -166,3 +196,142 @@ async def set_auto_unload(seconds: int): success=True, message=f"Auto-unload set to {seconds} seconds", ) + + +# ============================================================================= +# OCR Management +# ============================================================================= + + +@router.get("/enhanced", response_model=EnhancedSyncStatus) +async def get_enhanced_sync_status(): + """Get detailed sync status including OCR phase information""" + return progress_to_enhanced_status(processor_service.progress) + + +@router.get("/ocr/status", response_model=OCRStats) +async def get_ocr_status(): + """Get OCR processing statistics + + Returns counts of screenshots with/without OCR, average confidence, etc. + """ + stats = db.get_ocr_stats() + return OCRStats( + total_screenshots=stats["total_screenshots"], + with_ocr=stats["with_ocr"], + without_ocr=stats["without_ocr"], + with_text=stats["with_text"], + avg_confidence=stats["avg_confidence"], + ) + + +@router.get("/ocr/config", response_model=OCRConfig) +async def get_ocr_config(): + """Get current OCR configuration""" + return OCRConfig( + enabled=config.ocr.enabled, + provider=config.ocr.provider, + ) + + +@router.put("/ocr/config", response_model=SuccessResponse) +async def update_ocr_config(new_config: OCRConfig): + """Update OCR configuration + + Note: Changing provider may require reprocessing all screenshots. + Use /sync/ocr/recompute to regenerate OCR data. + """ + config.ocr.enabled = new_config.enabled + config.ocr.provider = new_config.provider + config.save() + + return SuccessResponse( + success=True, + message=f"OCR config updated: enabled={new_config.enabled}, provider={new_config.provider}", + ) + + +@router.post("/ocr/recompute", response_model=SyncStartResponse) +async def recompute_ocr(): + """Recompute OCR for all screenshots + + Use this after changing OCR or text embedding models to regenerate + all text data. This will: + 1. Clear existing OCR data + 2. Re-run OCR on all screenshots + 3. Regenerate text chunks and embeddings + + Warning: This may take a long time for large databases. + """ + if processor_service.is_running: + raise HTTPException( + status_code=409, + detail="Cannot recompute while sync is running", + ) + + if not config.ocr.enabled: + raise HTTPException( + status_code=400, + detail="OCR is disabled. Enable it in settings first.", + ) + + total = db.get_screenshot_count() + + # Start recompute in background + import threading + + def run_recompute(): + processor_service.recompute_ocr() + + thread = threading.Thread(target=run_recompute, daemon=True) + thread.start() + + return SyncStartResponse( + success=True, + message=f"OCR recompute started for {total} screenshots", + unsynced_count=total, + ) + + +@router.get("/models", response_model=AllModelsStatus) +async def get_all_models_status(): + """Get status of all ML models (CLIP, BGE, OCR)""" + # CLIP status + clip_status = get_model_status() + clip = ModelStatus( + loaded=clip_status["loaded"], + device=clip_status["device"], + idle_seconds=clip_status["idle_seconds"], + auto_unload_seconds=clip_status["auto_unload_seconds"], + ) + + # Text embedding status (lazy import) + text_emb = None + try: + from core.text_embeddings import text_embedding_service + + text_status = text_embedding_service.get_model_status() + text_emb = ModelStatus( + loaded=text_status["loaded"], + device=text_status["device"], + idle_seconds=text_status["idle_seconds"], + auto_unload_seconds=text_status["auto_unload_seconds"], + ) + except Exception: + pass + + # OCR status + ocr_status = "not_available" + try: + from core.ocr import ocr_service + + if ocr_service.is_available(): + ocr_status = ocr_service.get_provider_name() + except Exception: + pass + + return AllModelsStatus( + clip=clip, + text_embedding=text_emb, + ocr=ocr_status, + ) diff --git a/api/schemas.py b/api/schemas.py index 228aa8e..e028c8c 100644 --- a/api/schemas.py +++ b/api/schemas.py @@ -166,10 +166,14 @@ class SyncStartResponse(BaseModel): class SearchRequest(BaseModel): - """Search request""" + """Search request with mode selection""" query: str = Field(..., min_length=1, max_length=500) limit: int = Field(default=20, ge=1, le=100) + search_mode: str = Field( + default="auto", + description="Search mode: 'auto' (hybrid), 'image', 'text_fuzzy', 'text_semantic'", + ) safe_mode: bool = Field(default=False) # Off by default for personal recall app safe_mode_level: SafeModeLevel = Field(default=SafeModeLevel.MID) negative_texts: list[str] | None = Field(default=None) @@ -183,6 +187,7 @@ class Config: "example": { "query": "blue shirt on website", "limit": 20, + "search_mode": "auto", "safe_mode": True, "safe_mode_level": "mid", "start_date": "251201000000", @@ -469,3 +474,274 @@ class ErrorResponse(BaseModel): success: bool = False error: str detail: str | None = None + + +# ============================================================================= +# OCR Types +# ============================================================================= + + +class OCRResult(BaseModel): + """Result from OCR text extraction""" + + text: str = Field(description="Extracted text (may be empty)") + confidence: float | None = Field(default=None, description="Average confidence 0-1") + word_count: int = Field(default=0, description="Number of words extracted") + language: str = Field(default="en", description="Detected language") + + +class ChunkInfo(BaseModel): + """A single text chunk with position info""" + + text: str + start_char: int + end_char: int + index: int + + +class ChunkedText(BaseModel): + """Result of dual-size chunking""" + + small: list[ChunkInfo] = Field(description="Small chunks (512 tokens)") + large: list[ChunkInfo] = Field(description="Large chunks (2048 tokens)") + + +class OCRStats(BaseModel): + """OCR processing statistics""" + + total_screenshots: int + with_ocr: int = Field(description="Screenshots with OCR processed") + without_ocr: int = Field(description="Screenshots pending OCR") + with_text: int = Field(description="Screenshots with non-empty text") + avg_confidence: float | None = Field(description="Average OCR confidence") + + +# ============================================================================= +# Search Types +# ============================================================================= + + +class SearchMode(str, Enum): + """Available search modes""" + + AUTO = "auto" # Hybrid - combines all methods (default) + IMAGE = "image" # CLIP image semantic search only + TEXT_FUZZY = "text_fuzzy" # FTS5 trigram text search only + TEXT_SEMANTIC = "text_semantic" # BGE text embedding search only + + +class MatchSource(str, Enum): + """Source that contributed to a search match""" + + IMAGE = "image" # CLIP image similarity + TEXT_FTS = "text_fts" # FTS5 fuzzy text match + TEXT_SEMANTIC_SMALL = "text_semantic_small" # BGE small chunk match + TEXT_SEMANTIC_LARGE = "text_semantic_large" # BGE large chunk match + + +class EnhancedSearchResult(BaseModel): + """Search result with OCR information""" + + id: int + image_path: str + timestamp: str + similarity: float = Field(description="Combined similarity score 0-1") + image_url: str = Field(description="URL to fetch the image") + match_sources: list[MatchSource] = Field( + default_factory=list, + description="Which search methods matched this result", + ) + ocr_snippet: str | None = Field( + default=None, + description="Highlighted text snippet if text search matched", + ) + + class Config: + json_schema_extra = { + "example": { + "id": 42, + "image_path": "/path/to/screenshot.jpg", + "timestamp": "251206143022", + "similarity": 0.89, + "image_url": "/api/v1/screenshots/42/image", + "match_sources": ["image", "text_fts"], + "ocr_snippet": "...searched **term** found here...", + } + } + + +# ============================================================================= +# Model Download Types +# ============================================================================= + + +class ModelEventType(str, Enum): + """Types of model-related events for SSE""" + + DOWNLOAD_STARTED = "download_started" + DOWNLOAD_PROGRESS = "download_progress" + DOWNLOAD_COMPLETE = "download_complete" + LOADING = "loading" + READY = "ready" + ERROR = "error" + + +class ModelType(str, Enum): + """Types of ML models used""" + + CLIP = "clip" + TEXT_EMBEDDING = "text_embedding" + OCR = "ocr" + + +class ModelEvent(BaseModel): + """SSE event for model download/loading progress""" + + event: ModelEventType + model: ModelType + progress: float | None = Field(default=None, ge=0, le=100, description="Download progress 0-100") + size_mb: int | None = Field(default=None, description="Total size in MB") + message: str | None = Field(default=None, description="Status message") + + +class AllModelsStatus(BaseModel): + """Status of all ML models""" + + clip: ModelStatus + text_embedding: ModelStatus | None = Field( + default=None, + description="Text embedding model status (BGE)", + ) + ocr: str = Field( + default="ready", + description="OCR status: 'ready', 'not_available', provider name", + ) + + +# ============================================================================= +# Enhanced Sync Types +# ============================================================================= + + +class EnhancedSyncStatus(BaseModel): + """Sync status with OCR tracking""" + + is_syncing: bool + total: int = Field(description="Total screenshots to process") + processed: int = Field(description="Screenshots fully processed") + errors: int = Field(description="Number of errors") + progress_percent: float = Field(description="Overall progress percentage") + + # Detailed breakdown + current_phase: str = Field( + default="", + description="Current phase: 'embedding', 'ocr', 'text_embedding'", + ) + embeddings_done: int = Field(default=0, description="CLIP embeddings completed") + ocr_done: int = Field(default=0, description="OCR extractions completed") + text_embeddings_done: int = Field(default=0, description="Text embeddings completed") + + class Config: + json_schema_extra = { + "example": { + "is_syncing": True, + "total": 100, + "processed": 45, + "errors": 2, + "progress_percent": 45.0, + "current_phase": "ocr", + "embeddings_done": 100, + "ocr_done": 45, + "text_embeddings_done": 40, + } + } + + +# ============================================================================= +# OCR Config Types +# ============================================================================= + + +class OCRConfig(BaseModel): + """OCR configuration settings""" + + enabled: bool = Field(default=True, description="Whether OCR is enabled") + provider: str = Field( + default="auto", + description="OCR provider: 'auto', 'apple_vision', 'tesseract'", + ) + + +class TextEmbeddingConfig(BaseModel): + """Text embedding configuration settings""" + + model: str = Field( + default="BAAI/bge-small-en-v1.5", + description="Sentence transformer model name", + ) + dimensions: int = Field(default=384, description="Embedding dimensions") + + +class ChunkingConfig(BaseModel): + """Text chunking configuration settings""" + + small_size: int = Field(default=512, description="Small chunk size in tokens") + small_overlap: int = Field(default=50, description="Small chunk overlap in tokens") + large_size: int = Field(default=2048, description="Large chunk size in tokens") + large_overlap: int = Field(default=200, description="Large chunk overlap in tokens") + + +# ============================================================================= +# Migration Types +# ============================================================================= + + +class MigrationStatus(BaseModel): + """Status of OCR migration for existing screenshots""" + + needs_migration: bool = Field(description="Whether there are screenshots needing OCR") + total_screenshots: int = Field(description="Total number of screenshots") + screenshots_with_ocr: int = Field(description="Screenshots with OCR completed") + screenshots_without_ocr: int = Field(description="Screenshots pending OCR") + progress_percent: float = Field(description="Migration progress percentage") + estimated_time_minutes: float | None = Field( + default=None, + description="Estimated time to complete in minutes", + ) + + class Config: + json_schema_extra = { + "example": { + "needs_migration": True, + "total_screenshots": 1000, + "screenshots_with_ocr": 350, + "screenshots_without_ocr": 650, + "progress_percent": 35.0, + "estimated_time_minutes": 26.0, + } + } + + +class EnhancedSetupStatus(BaseModel): + """Comprehensive setup status including models and migration""" + + # Version info + current_version: str + last_seen_version: str + needs_setup: bool = Field(description="Whether version-based setup is needed") + + # Platform info + platform: str = Field(description="Current platform (macos, windows, linux)") + needs_permission: bool = Field(description="Whether screen permission is needed") + + # Model status + models_ready: bool = Field(description="Whether all required models are ready") + clip_status: str = Field(description="CLIP status: 'not_downloaded', 'downloading', 'ready'") + text_embedding_status: str = Field(description="Text embedding status: 'not_downloaded', 'downloading', 'ready'") + ocr_status: str = Field(description="OCR status: 'ready', 'not_available'") + + # Migration info + migration_status: MigrationStatus | None = Field( + default=None, + description="OCR migration status if applicable", + ) diff --git a/api/tests/test_api.py b/api/tests/test_api.py index 5a2ad83..6ef1241 100644 --- a/api/tests/test_api.py +++ b/api/tests/test_api.py @@ -320,6 +320,7 @@ def test_search_success(self, mock_get_embedding, mock_db): "query": "blue shirt", "limit": 10, "safe_mode": False, + "search_mode": "image", # Use image mode to test CLIP-only search }, ) assert response.status_code == 200 @@ -512,3 +513,241 @@ def test_complete_setup(self, mock_config): assert data["success"] is True assert mock_config.last_seen_version == "0.1.2" mock_config.save.assert_called_once() + + +class TestEventsEndpoints: + """Test SSE events API endpoints""" + + @patch("api.routes.events.db") + def test_get_all_status(self, mock_db): + """Should return status of all models and sync""" + from fastapi import FastAPI + from fastapi.testclient import TestClient + + from api.routes.events import router + + mock_db.get_ocr_stats.return_value = { + "with_ocr": 50, + "without_ocr": 10, + } + + app = FastAPI() + app.include_router(router) + client = TestClient(app) + + response = client.get("/events/status") + assert response.status_code == 200 + data = response.json() + assert "clip" in data + assert "text_embedding" in data + assert "ocr" in data + assert "sync" in data + assert "ocr_stats" in data + + +class TestEnhancedSetupEndpoints: + """Test enhanced setup API endpoints""" + + @patch("api.routes.setup.config") + @patch("api.routes.setup.current_platform") + @patch("api.routes.setup.VERSION", "0.1.2") + def test_get_model_status(self, mock_platform, mock_config): + """Should return model status""" + from fastapi import FastAPI + from fastapi.testclient import TestClient + + from api.routes.setup import router + + app = FastAPI() + app.include_router(router) + client = TestClient(app) + + response = client.get("/setup/models") + assert response.status_code == 200 + data = response.json() + assert "clip" in data + assert "text_embedding" in data + assert "ocr" in data + assert "all_ready" in data + + @patch("core.database.db") + @patch("api.routes.setup.config") + @patch("api.routes.setup.current_platform") + @patch("api.routes.setup.VERSION", "0.1.2") + def test_get_migration_status(self, mock_platform, mock_config, mock_db): + """Should return OCR migration status""" + from fastapi import FastAPI + from fastapi.testclient import TestClient + + from api.routes.setup import router + + mock_db.get_ocr_stats.return_value = { + "total_screenshots": 100, + "with_ocr": 60, + "without_ocr": 40, + } + + app = FastAPI() + app.include_router(router) + client = TestClient(app) + + response = client.get("/setup/migration") + assert response.status_code == 200 + data = response.json() + assert data["needs_migration"] is True + assert data["total_screenshots"] == 100 + assert data["screenshots_with_ocr"] == 60 + assert data["screenshots_without_ocr"] == 40 + assert data["progress_percent"] == 60.0 + + @patch("core.database.db") + @patch("api.routes.setup.config") + @patch("api.routes.setup.current_platform") + @patch("api.routes.setup.VERSION", "0.1.2") + def test_get_enhanced_setup_status(self, mock_platform, mock_config, mock_db): + """Should return comprehensive setup status""" + from fastapi import FastAPI + from fastapi.testclient import TestClient + + from api.routes.setup import router + + mock_config.last_seen_version = "0.1.1" + mock_platform.name = "macos" + mock_platform.needs_screen_permission.return_value = True + mock_db.get_ocr_stats.return_value = { + "total_screenshots": 100, + "with_ocr": 100, + "without_ocr": 0, + } + + app = FastAPI() + app.include_router(router) + client = TestClient(app) + + response = client.get("/setup/enhanced-status") + assert response.status_code == 200 + data = response.json() + assert data["current_version"] == "0.1.2" + assert data["needs_setup"] is True + assert data["platform"] == "macos" + assert "clip_status" in data + assert "text_embedding_status" in data + assert "ocr_status" in data + + +class TestSearchModes: + """Test search with different modes""" + + @patch("api.routes.search.db") + @patch("api.routes.search.get_text_embedding") + def test_search_image_mode(self, mock_get_embedding, mock_db): + """Should perform image-only search""" + from fastapi import FastAPI + from fastapi.testclient import TestClient + + from api.routes.search import router + + mock_db.get_stats.return_value = {"synced": 10} + mock_get_embedding.return_value = [0.1] * 768 + mock_db.search_similar.return_value = [ + { + "id": 1, + "image_path": "/path/to/img.jpg", + "timestamp": "251206120000", + "similarity": 0.85, + } + ] + + app = FastAPI() + app.include_router(router) + client = TestClient(app) + + response = client.post( + "/search", + json={ + "query": "test query", + "limit": 10, + "safe_mode": False, + "search_mode": "image", + }, + ) + assert response.status_code == 200 + data = response.json() + assert data["total_results"] == 1 + + @patch("api.routes.search.db") + @patch("api.routes.search.get_text_embedding") + def test_search_text_fuzzy_mode(self, mock_get_embedding, mock_db): + """Should perform text fuzzy search""" + from fastapi import FastAPI + from fastapi.testclient import TestClient + + from api.routes.search import router + + mock_db.get_stats.return_value = {"synced": 10} + mock_db.search_text_fts.return_value = [ + { + "id": 1, + "image_path": "/path/to/img.jpg", + "timestamp": "251206120000", + "similarity": 0.9, + } + ] + + app = FastAPI() + app.include_router(router) + client = TestClient(app) + + response = client.post( + "/search", + json={ + "query": "test query", + "limit": 10, + "safe_mode": False, + "search_mode": "text_fuzzy", + }, + ) + assert response.status_code == 200 + data = response.json() + # Result depends on whether text_fts is implemented + assert "results" in data + + @patch("core.text_embeddings.text_embedding_service") + @patch("api.routes.search.db") + @patch("api.routes.search.get_text_embedding") + def test_search_auto_mode(self, mock_get_embedding, mock_db, mock_text_emb_service): + """Should perform hybrid search in auto mode""" + from fastapi import FastAPI + from fastapi.testclient import TestClient + + from api.routes.search import router + + mock_db.get_stats.return_value = {"synced": 10} + mock_get_embedding.return_value = [0.1] * 768 + mock_text_emb_service.get_query_embedding.return_value = [0.1] * 384 + mock_db.search_hybrid.return_value = [ + { + "id": 1, + "image_path": "/path/to/img.jpg", + "timestamp": "251206120000", + "similarity": 0.85, + "match_sources": ["image"], + } + ] + + app = FastAPI() + app.include_router(router) + client = TestClient(app) + + response = client.post( + "/search", + json={ + "query": "test query", + "limit": 10, + "safe_mode": False, + "search_mode": "auto", + }, + ) + assert response.status_code == 200 + data = response.json() + assert "results" in data diff --git a/core/chunking.py b/core/chunking.py new file mode 100644 index 0000000..06fa9e1 --- /dev/null +++ b/core/chunking.py @@ -0,0 +1,320 @@ +""" +LiveRecall Text Chunking + +Splits OCR text into chunks for semantic search. +Uses dual chunking strategy: small (512 tokens) and large (2048 tokens). + +Small chunks: Precise matching, good for short specific queries +Large chunks: Better context, good for conceptual queries + +Both chunk sizes are searched and combined using RRF (Reciprocal Rank Fusion). +""" + +from __future__ import annotations + +import re +from dataclasses import dataclass + + +@dataclass +class ChunkInfo: + """A single text chunk with position info""" + + text: str + start_char: int + end_char: int + index: int + + +@dataclass +class ChunkedText: + """Result of dual-size chunking""" + + small: list[ChunkInfo] + large: list[ChunkInfo] + + +# Default chunk settings +DEFAULT_SMALL_SIZE = 512 # tokens (~2000 chars) +DEFAULT_SMALL_OVERLAP = 50 # tokens (~200 chars) +DEFAULT_LARGE_SIZE = 2048 # tokens (~8000 chars) +DEFAULT_LARGE_OVERLAP = 200 # tokens (~800 chars) + +# Approximate chars per token (for rough estimation) +CHARS_PER_TOKEN = 4 + +# Minimum chunk size (skip tiny chunks) +MIN_CHUNK_CHARS = 50 + + +def estimate_tokens(text: str) -> int: + """Estimate number of tokens in text (rough approximation)""" + return len(text) // CHARS_PER_TOKEN + + +def create_chunks( + text: str, + chunk_size: int = DEFAULT_SMALL_SIZE, + overlap: int = DEFAULT_SMALL_OVERLAP, + min_chunk_chars: int = MIN_CHUNK_CHARS, +) -> list[ChunkInfo]: + """ + Create chunks from text with overlap. + + Uses paragraph and sentence boundaries when possible for cleaner splits. + + Args: + text: The text to chunk + chunk_size: Target chunk size in tokens + overlap: Overlap between chunks in tokens + min_chunk_chars: Minimum characters for a chunk (skip smaller) + + Returns: + List of ChunkInfo with text and position info + """ + if not text or not text.strip(): + return [] + + text = text.strip() + + # Convert token sizes to character sizes (rough) + chunk_chars = chunk_size * CHARS_PER_TOKEN + overlap_chars = overlap * CHARS_PER_TOKEN + + # If text is small enough, return as single chunk + if len(text) <= chunk_chars: + return [ + ChunkInfo( + text=text, + start_char=0, + end_char=len(text), + index=0, + ) + ] + + chunks: list[ChunkInfo] = [] + + # Split into paragraphs first (preserve structure) + paragraphs = re.split(r"\n\n+", text) + + current_chunk = "" + current_start = 0 + char_position = 0 + chunk_index = 0 + + for para in paragraphs: + para = para.strip() + if not para: + char_position += 2 # Account for newlines + continue + + # If adding this paragraph exceeds chunk size + if len(current_chunk) + len(para) + 2 > chunk_chars: + # Save current chunk if it has content + if current_chunk and len(current_chunk) >= min_chunk_chars: + chunks.append( + ChunkInfo( + text=current_chunk.strip(), + start_char=current_start, + end_char=current_start + len(current_chunk), + index=chunk_index, + ) + ) + chunk_index += 1 + + # Start new chunk with overlap from previous + if overlap_chars > 0 and len(current_chunk) > overlap_chars: + # Get last overlap_chars from current chunk + overlap_text = current_chunk[-overlap_chars:] + # Try to start at a word boundary + space_idx = overlap_text.find(" ") + if space_idx > 0: + overlap_text = overlap_text[space_idx + 1 :] + current_chunk = overlap_text + "\n\n" + current_start = char_position - len(overlap_text) + else: + current_chunk = "" + current_start = char_position + + # Handle oversized paragraph by splitting on sentences + if len(para) > chunk_chars: + para_chunks = _split_paragraph( + para, chunk_chars, overlap_chars, min_chunk_chars, char_position, chunk_index + ) + for pc in para_chunks: + chunks.append(pc) + chunk_index += 1 + + # Reset current chunk + current_chunk = "" + current_start = char_position + len(para) + else: + current_chunk = para + current_start = char_position + else: + # Add paragraph to current chunk + if current_chunk: + current_chunk += "\n\n" + para + else: + current_chunk = para + current_start = char_position + + char_position += len(para) + 2 + + # Don't forget the last chunk + if current_chunk and len(current_chunk) >= min_chunk_chars: + chunks.append( + ChunkInfo( + text=current_chunk.strip(), + start_char=current_start, + end_char=current_start + len(current_chunk), + index=chunk_index, + ) + ) + + return chunks + + +def _split_paragraph( + para: str, + chunk_chars: int, + overlap_chars: int, + min_chunk_chars: int, + base_position: int, + base_index: int, +) -> list[ChunkInfo]: + """Split a large paragraph by sentences""" + # Split on sentence boundaries + sentences = re.split(r"(?<=[.!?])\s+", para) + + chunks: list[ChunkInfo] = [] + current_chunk = "" + current_start = base_position + chunk_index = base_index + char_offset = 0 + + for sentence in sentences: + if not sentence.strip(): + continue + + if len(current_chunk) + len(sentence) + 1 > chunk_chars: + # Save current chunk + if current_chunk and len(current_chunk) >= min_chunk_chars: + chunks.append( + ChunkInfo( + text=current_chunk.strip(), + start_char=current_start, + end_char=current_start + len(current_chunk), + index=chunk_index, + ) + ) + chunk_index += 1 + + # Start new chunk with overlap + if overlap_chars > 0 and len(current_chunk) > overlap_chars: + overlap_text = current_chunk[-overlap_chars:] + space_idx = overlap_text.find(" ") + if space_idx > 0: + overlap_text = overlap_text[space_idx + 1 :] + current_chunk = overlap_text + " " + sentence + current_start = base_position + char_offset - len(overlap_text) + else: + current_chunk = sentence + current_start = base_position + char_offset + else: + if current_chunk: + current_chunk += " " + sentence + else: + current_chunk = sentence + current_start = base_position + char_offset + + char_offset += len(sentence) + 1 + + # Last chunk + if current_chunk and len(current_chunk) >= min_chunk_chars: + chunks.append( + ChunkInfo( + text=current_chunk.strip(), + start_char=current_start, + end_char=current_start + len(current_chunk), + index=chunk_index, + ) + ) + + return chunks + + +def chunk_ocr_text( + full_text: str, + small_size: int = DEFAULT_SMALL_SIZE, + small_overlap: int = DEFAULT_SMALL_OVERLAP, + large_size: int = DEFAULT_LARGE_SIZE, + large_overlap: int = DEFAULT_LARGE_OVERLAP, +) -> ChunkedText: + """ + Create dual-size chunks from OCR text. + + Args: + full_text: The full OCR text to chunk + small_size: Size for small chunks (tokens) + small_overlap: Overlap for small chunks (tokens) + large_size: Size for large chunks (tokens) + large_overlap: Overlap for large chunks (tokens) + + Returns: + ChunkedText with both small and large chunk lists + """ + small_chunks = create_chunks(full_text, small_size, small_overlap) + large_chunks = create_chunks(full_text, large_size, large_overlap) + + return ChunkedText(small=small_chunks, large=large_chunks) + + +def get_chunk_count(text: str, chunk_size: int = DEFAULT_SMALL_SIZE) -> int: + """Estimate number of chunks that will be created""" + if not text: + return 0 + + text_chars = len(text.strip()) + chunk_chars = chunk_size * CHARS_PER_TOKEN + + if text_chars <= chunk_chars: + return 1 + + # Rough estimate accounting for overlap + return max(1, (text_chars // chunk_chars) + 1) + + +if __name__ == "__main__": + # Test chunking + test_text = """ + This is the first paragraph of test text. It contains multiple sentences. + The sentences are meant to test the chunking functionality. + + This is the second paragraph. It's separate from the first one. + We want to make sure paragraph boundaries are respected. + + Here is a third paragraph with more content. The chunking algorithm + should handle this text and split it appropriately based on the + configured chunk size and overlap settings. + + Finally, this is the last paragraph. It wraps up our test text + and provides enough content for meaningful chunk testing. + """ + + print("Testing chunking module...") + print(f"Input text length: {len(test_text)} chars") + print(f"Estimated tokens: {estimate_tokens(test_text)}") + + # Test dual chunking + result = chunk_ocr_text(test_text) + + print(f"\nSmall chunks ({len(result.small)}):") + for chunk in result.small: + print(f" [{chunk.index}] chars {chunk.start_char}-{chunk.end_char}: {chunk.text[:50]}...") + + print(f"\nLarge chunks ({len(result.large)}):") + for chunk in result.large: + print(f" [{chunk.index}] chars {chunk.start_char}-{chunk.end_char}: {chunk.text[:50]}...") + + print("\nDone!") diff --git a/core/config.py b/core/config.py index cd54a5c..d205bc2 100644 --- a/core/config.py +++ b/core/config.py @@ -56,6 +56,69 @@ class CompressionSettings: quality: int = 85 # JPEG quality for compressed images +# ============================================================================= +# OCR SETTINGS +# ============================================================================= + + +@dataclass +class OCRSettings: + """OCR text extraction settings + + Provider options: + - "auto": Auto-select best for platform (recommended) + - "apple_vision": macOS native Vision framework (fast, zero memory) + - "tesseract": Cross-platform Tesseract OCR (lightweight, stable) + + Future provider options (better accuracy, more memory): + - "paddleocr": PP-OCRv4 (pip install paddleocr paddlepaddle) + - "doctr": docTR (pip install python-doctr[torch]) + - "easyocr": EasyOCR (pip install easyocr) - heavy, 1-2GB + + To switch providers: Change provider setting, then call ocr_service.recompute_all() + """ + + enabled: bool = True # OCR enabled by default + provider: str = "auto" # "auto", "apple_vision", "tesseract" + + +@dataclass +class TextEmbeddingSettings: + """Text embedding model settings for semantic search + + Model options (sentence-transformers): + - "BAAI/bge-small-en-v1.5": 384-dim, 130MB, MTEB 62.2 (default, good balance) + - "all-MiniLM-L6-v2": 384-dim, 80MB, MTEB 56.3 (lighter) + - "thenlper/gte-small": 384-dim, 70MB (lightest) + - "BAAI/bge-base-en-v1.5": 768-dim, 440MB, MTEB 63.5 (higher accuracy) + - "all-mpnet-base-v2": 768-dim, 420MB (higher accuracy) + + WARNING: Changing to a model with different dimensions requires: + 1. Update dimensions here + 2. Recreate vector tables (call text_embedding_service.recompute_all()) + """ + + model: str = "BAAI/bge-small-en-v1.5" + dimensions: int = 384 # Must match model output dimensions + + +@dataclass +class ChunkingSettings: + """Text chunking settings for semantic search + + Dual chunking strategy: + - Small chunks: Precise matching, good for short specific queries + - Large chunks: Better context, good for conceptual queries + + Both sizes are searched and combined using RRF (Reciprocal Rank Fusion). + """ + + small_size: int = 512 # tokens (~2000 chars) + small_overlap: int = 50 # tokens (~200 chars) + large_size: int = 2048 # tokens (~8000 chars) + large_overlap: int = 200 # tokens (~800 chars) + + @dataclass class CaptureSettings: """Screen capture settings""" @@ -106,6 +169,9 @@ class Config: capture: CaptureSettings = field(default_factory=CaptureSettings) compression: CompressionSettings = field(default_factory=CompressionSettings) incognito: IncognitoSettings = field(default_factory=IncognitoSettings) + ocr: OCRSettings = field(default_factory=OCRSettings) + text_embedding: TextEmbeddingSettings = field(default_factory=TextEmbeddingSettings) + chunking: ChunkingSettings = field(default_factory=ChunkingSettings) encryption_enabled: bool = True safe_mode_enabled: bool = True safe_mode_level: str = "mid" # low, mid, high @@ -184,6 +250,20 @@ def save(self): "active": self.incognito.active, "until": self.incognito.until, }, + "ocr": { + "enabled": self.ocr.enabled, + "provider": self.ocr.provider, + }, + "text_embedding": { + "model": self.text_embedding.model, + "dimensions": self.text_embedding.dimensions, + }, + "chunking": { + "small_size": self.chunking.small_size, + "small_overlap": self.chunking.small_overlap, + "large_size": self.chunking.large_size, + "large_overlap": self.chunking.large_overlap, + }, "encryption_enabled": self.encryption_enabled, "safe_mode_enabled": self.safe_mode_enabled, "safe_mode_level": self.safe_mode_level, @@ -225,6 +305,26 @@ def load(self): self.incognito.active = inc.get("active", self.incognito.active) self.incognito.until = inc.get("until", self.incognito.until) + # Load OCR settings + if "ocr" in data: + ocr = data["ocr"] + self.ocr.enabled = ocr.get("enabled", self.ocr.enabled) + self.ocr.provider = ocr.get("provider", self.ocr.provider) + + # Load text embedding settings + if "text_embedding" in data: + te = data["text_embedding"] + self.text_embedding.model = te.get("model", self.text_embedding.model) + self.text_embedding.dimensions = te.get("dimensions", self.text_embedding.dimensions) + + # Load chunking settings + if "chunking" in data: + chunk = data["chunking"] + self.chunking.small_size = chunk.get("small_size", self.chunking.small_size) + self.chunking.small_overlap = chunk.get("small_overlap", self.chunking.small_overlap) + self.chunking.large_size = chunk.get("large_size", self.chunking.large_size) + self.chunking.large_overlap = chunk.get("large_overlap", self.chunking.large_overlap) + # Load other settings self.encryption_enabled = data.get("encryption_enabled", self.encryption_enabled) self.safe_mode_enabled = data.get("safe_mode_enabled", self.safe_mode_enabled) diff --git a/core/database.py b/core/database.py index e90b407..38436fd 100644 --- a/core/database.py +++ b/core/database.py @@ -16,6 +16,9 @@ # CLIP ViT-L-14 produces 768-dimensional embeddings EMBEDDING_DIM = 768 +# BGE-small-en-v1.5 produces 384-dimensional text embeddings +TEXT_EMBEDDING_DIM = 384 + def serialize_embedding(embedding: list[float]) -> bytes: """Serialize embedding list to bytes for sqlite-vec""" @@ -88,6 +91,9 @@ def _initialize_tables(self): # Migration: add is_hidden column if it doesn't exist self._migrate_hidden_column(cur) + # Migration: add has_ocr column if it doesn't exist + self._migrate_ocr_column(cur) + # Index for faster queries cur.execute(""" CREATE INDEX IF NOT EXISTS idx_screenshots_timestamp @@ -109,7 +115,12 @@ def _initialize_tables(self): ON screenshots(is_hidden) """) - # Virtual table for vector search + cur.execute(""" + CREATE INDEX IF NOT EXISTS idx_screenshots_has_ocr + ON screenshots(has_ocr) + """) + + # Virtual table for vector search (CLIP image embeddings) cur.execute(f""" CREATE VIRTUAL TABLE IF NOT EXISTS screenshot_embeddings USING vec0( @@ -118,6 +129,9 @@ def _initialize_tables(self): ) """) + # OCR tables + self._initialize_ocr_tables(cur) + def _migrate_compression_columns(self, cur): """Add compression columns to existing databases""" # Check if columns exist @@ -141,6 +155,110 @@ def _migrate_hidden_column(self, cur): if "is_hidden" not in columns: cur.execute("ALTER TABLE screenshots ADD COLUMN is_hidden INTEGER DEFAULT 0") + def _migrate_ocr_column(self, cur): + """Add has_ocr column to existing databases""" + cur.execute("PRAGMA table_info(screenshots)") + columns = {row[1] for row in cur.fetchall()} + + if "has_ocr" not in columns: + cur.execute("ALTER TABLE screenshots ADD COLUMN has_ocr INTEGER DEFAULT 0") + + def _initialize_ocr_tables(self, cur): + """Create OCR-related tables if they don't exist""" + # Main OCR text table - stores full extracted text per screenshot + cur.execute(""" + CREATE TABLE IF NOT EXISTS screenshot_ocr ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + screenshot_id INTEGER NOT NULL UNIQUE, + full_text TEXT NOT NULL, + confidence REAL, + word_count INTEGER, + created_at TEXT DEFAULT CURRENT_TIMESTAMP, + FOREIGN KEY (screenshot_id) REFERENCES screenshots(id) ON DELETE CASCADE + ) + """) + + cur.execute(""" + CREATE INDEX IF NOT EXISTS idx_screenshot_ocr_screenshot_id + ON screenshot_ocr(screenshot_id) + """) + + # Text chunks table - stores dual-size chunks for semantic search + cur.execute(""" + CREATE TABLE IF NOT EXISTS ocr_text_chunks ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + ocr_id INTEGER NOT NULL, + chunk_size TEXT NOT NULL, + chunk_index INTEGER NOT NULL, + chunk_text TEXT NOT NULL, + start_char INTEGER, + end_char INTEGER, + FOREIGN KEY (ocr_id) REFERENCES screenshot_ocr(id) ON DELETE CASCADE + ) + """) + + cur.execute(""" + CREATE INDEX IF NOT EXISTS idx_ocr_chunks_ocr_id + ON ocr_text_chunks(ocr_id) + """) + + cur.execute(""" + CREATE INDEX IF NOT EXISTS idx_ocr_chunks_size + ON ocr_text_chunks(chunk_size) + """) + + # FTS5 virtual table for fuzzy text search with trigram tokenizer + # Note: tokenize='trigram' requires SQLite 3.34+ + try: + cur.execute(""" + CREATE VIRTUAL TABLE IF NOT EXISTS ocr_text_fts USING fts5( + full_text, + content='screenshot_ocr', + content_rowid='id', + tokenize='trigram' + ) + """) + except sqlite3.OperationalError: + # Fall back to default tokenizer if trigram not available + cur.execute(""" + CREATE VIRTUAL TABLE IF NOT EXISTS ocr_text_fts USING fts5( + full_text, + content='screenshot_ocr', + content_rowid='id' + ) + """) + + # Triggers to keep FTS index in sync with screenshot_ocr table + cur.execute(""" + CREATE TRIGGER IF NOT EXISTS ocr_fts_insert AFTER INSERT ON screenshot_ocr BEGIN + INSERT INTO ocr_text_fts(rowid, full_text) VALUES (new.id, new.full_text); + END + """) + + cur.execute(""" + CREATE TRIGGER IF NOT EXISTS ocr_fts_delete AFTER DELETE ON screenshot_ocr BEGIN + INSERT INTO ocr_text_fts(ocr_text_fts, rowid, full_text) + VALUES ('delete', old.id, old.full_text); + END + """) + + cur.execute(""" + CREATE TRIGGER IF NOT EXISTS ocr_fts_update AFTER UPDATE ON screenshot_ocr BEGIN + INSERT INTO ocr_text_fts(ocr_text_fts, rowid, full_text) + VALUES ('delete', old.id, old.full_text); + INSERT INTO ocr_text_fts(rowid, full_text) VALUES (new.id, new.full_text); + END + """) + + # Vector table for text chunk embeddings (BGE-small: 384 dimensions) + cur.execute(f""" + CREATE VIRTUAL TABLE IF NOT EXISTS ocr_text_embeddings + USING vec0( + chunk_id INTEGER PRIMARY KEY, + embedding float[{TEXT_EMBEDDING_DIM}] + ) + """) + # --- Screenshot CRUD --- def add_screenshot(self, image_path: str, timestamp: str | None = None, is_hidden: bool = False) -> int: @@ -460,6 +578,12 @@ def get_unsynced_count(self) -> int: cur.execute("SELECT COUNT(*) FROM screenshots WHERE has_embedding = 0") return cur.fetchone()[0] + def get_screenshot_count(self) -> int: + """Get total count of all screenshots""" + with self.cursor() as cur: + cur.execute("SELECT COUNT(*) FROM screenshots") + return cur.fetchone()[0] + def add_embedding(self, screenshot_id: int, embedding: list[float]) -> bool: """Add embedding for a screenshot""" if len(embedding) != EMBEDDING_DIM: @@ -618,6 +742,579 @@ def get_compression_stats(self) -> dict: "original_size_bytes": original_total, } + # --- OCR operations --- + + def add_ocr_text( + self, + screenshot_id: int, + full_text: str, + confidence: float | None = None, + word_count: int | None = None, + ) -> int: + """Add OCR extracted text for a screenshot. + + Args: + screenshot_id: ID of the screenshot + full_text: Full extracted text (can be empty string) + confidence: Average OCR confidence (0-1) + word_count: Number of words extracted + + Returns: + ID of the created screenshot_ocr record + """ + if word_count is None: + word_count = len(full_text.split()) if full_text else 0 + + with self.cursor() as cur: + # Use INSERT OR REPLACE to handle re-processing gracefully + cur.execute( + """ + INSERT OR REPLACE INTO screenshot_ocr (screenshot_id, full_text, confidence, word_count) + VALUES (?, ?, ?, ?) + """, + (screenshot_id, full_text, confidence, word_count), + ) + return cur.lastrowid + + def get_ocr_text(self, screenshot_id: int) -> dict | None: + """Get OCR text for a screenshot""" + with self.cursor() as cur: + cur.execute("SELECT * FROM screenshot_ocr WHERE screenshot_id = ?", (screenshot_id,)) + row = cur.fetchone() + return dict(row) if row else None + + def add_ocr_chunk( + self, + ocr_id: int, + chunk_size: str, + chunk_index: int, + chunk_text: str, + start_char: int | None = None, + end_char: int | None = None, + ) -> int: + """Add a text chunk for an OCR record. + + Args: + ocr_id: ID of the screenshot_ocr record + chunk_size: 'small' or 'large' + chunk_index: Index of this chunk in the sequence + chunk_text: The chunk text + start_char: Starting character position in full text + end_char: Ending character position in full text + + Returns: + ID of the created chunk record + """ + with self.cursor() as cur: + cur.execute( + """ + INSERT INTO ocr_text_chunks (ocr_id, chunk_size, chunk_index, chunk_text, start_char, end_char) + VALUES (?, ?, ?, ?, ?, ?) + """, + (ocr_id, chunk_size, chunk_index, chunk_text, start_char, end_char), + ) + return cur.lastrowid + + def add_text_embedding(self, chunk_id: int, embedding: list[float]) -> bool: + """Add embedding for a text chunk""" + if len(embedding) != TEXT_EMBEDDING_DIM: + raise ValueError(f"Text embedding must be {TEXT_EMBEDDING_DIM} dimensions, got {len(embedding)}") + + embedding_bytes = serialize_embedding(embedding) + + with self.cursor() as cur: + cur.execute( + "INSERT INTO ocr_text_embeddings (chunk_id, embedding) VALUES (?, ?)", + (chunk_id, embedding_bytes), + ) + return True + + def mark_ocr_complete(self, screenshot_id: int) -> bool: + """Mark a screenshot as having OCR processed""" + with self.cursor() as cur: + cur.execute("UPDATE screenshots SET has_ocr = 1 WHERE id = ?", (screenshot_id,)) + return cur.rowcount > 0 + + def get_screenshots_without_ocr(self, limit: int | None = None) -> list[dict]: + """Get screenshots that don't have OCR processed yet""" + with self.cursor() as cur: + if limit: + cur.execute( + "SELECT * FROM screenshots WHERE has_ocr = 0 ORDER BY id ASC LIMIT ?", + (limit,), + ) + else: + cur.execute("SELECT * FROM screenshots WHERE has_ocr = 0 ORDER BY id ASC") + return [dict(row) for row in cur.fetchall()] + + def get_ocr_pending_count(self) -> int: + """Get count of screenshots without OCR""" + with self.cursor() as cur: + cur.execute("SELECT COUNT(*) FROM screenshots WHERE has_ocr = 0") + return cur.fetchone()[0] + + def search_ocr_fts( + self, + query: str, + limit: int = 20, + visibility: str = "visible_only", + ) -> list[dict]: + """Search OCR text using FTS5 full-text search. + + Uses trigram matching for fuzzy search if available. + + Args: + query: Search query string + limit: Maximum number of results + visibility: One of "visible_only", "hidden_only", or "all" + + Returns: + List of matching screenshots with OCR info and snippets + """ + # Build visibility condition + if visibility == "visible_only": + vis_condition = "AND (s.is_hidden = 0 OR s.is_hidden IS NULL)" + elif visibility == "hidden_only": + vis_condition = "AND s.is_hidden = 1" + else: + vis_condition = "" + + with self.cursor() as cur: + cur.execute( + f""" + SELECT + s.*, + o.full_text, + o.confidence as ocr_confidence, + o.word_count, + snippet(ocr_text_fts, 0, '', '', '...', 32) as ocr_snippet, + bm25(ocr_text_fts) as relevance_score + FROM ocr_text_fts f + JOIN screenshot_ocr o ON f.rowid = o.id + JOIN screenshots s ON o.screenshot_id = s.id + WHERE ocr_text_fts MATCH ? + {vis_condition} + ORDER BY bm25(ocr_text_fts) + LIMIT ? + """, + (query, limit), + ) + + return [dict(row) for row in cur.fetchall()] + + def search_ocr_exact( + self, + query: str, + limit: int = 20, + visibility: str = "visible_only", + ) -> list[dict]: + """Search OCR text for exact phrase match. + + Args: + query: Exact phrase to search for + limit: Maximum number of results + visibility: One of "visible_only", "hidden_only", or "all" + + Returns: + List of matching screenshots with OCR info + """ + # Build visibility condition + if visibility == "visible_only": + vis_condition = "AND (s.is_hidden = 0 OR s.is_hidden IS NULL)" + elif visibility == "hidden_only": + vis_condition = "AND s.is_hidden = 1" + else: + vis_condition = "" + + # Quote query for exact phrase match in FTS5 + quoted_query = f'"{query}"' + + with self.cursor() as cur: + cur.execute( + f""" + SELECT + s.*, + o.full_text, + o.confidence as ocr_confidence, + o.word_count, + highlight(ocr_text_fts, 0, '', '') as ocr_highlighted + FROM ocr_text_fts f + JOIN screenshot_ocr o ON f.rowid = o.id + JOIN screenshots s ON o.screenshot_id = s.id + WHERE ocr_text_fts MATCH ? + {vis_condition} + ORDER BY s.timestamp DESC + LIMIT ? + """, + (quoted_query, limit), + ) + + return [dict(row) for row in cur.fetchall()] + + def search_text_embeddings( + self, + query_embedding: list[float], + chunk_size: str | None = None, + limit: int = 20, + visibility: str = "visible_only", + ) -> list[dict]: + """Search text chunks by semantic similarity. + + Args: + query_embedding: Query embedding vector (384-dim) + chunk_size: Filter by 'small' or 'large' chunks, or None for all + limit: Maximum number of results + visibility: One of "visible_only", "hidden_only", or "all" + + Returns: + List of matching screenshots with similarity scores + """ + if len(query_embedding) != TEXT_EMBEDDING_DIM: + raise ValueError(f"Query embedding must be {TEXT_EMBEDDING_DIM} dimensions") + + query_bytes = serialize_embedding(query_embedding) + + # Build conditions + chunk_condition = f"AND c.chunk_size = '{chunk_size}'" if chunk_size else "" + + if visibility == "visible_only": + vis_condition = "AND (s.is_hidden = 0 OR s.is_hidden IS NULL)" + elif visibility == "hidden_only": + vis_condition = "AND s.is_hidden = 1" + else: + vis_condition = "" + + with self.cursor() as cur: + cur.execute( + f""" + SELECT + s.*, + o.full_text, + o.confidence as ocr_confidence, + c.chunk_text, + c.chunk_size, + c.chunk_index, + e.distance as vec_distance + FROM ocr_text_embeddings e + JOIN ocr_text_chunks c ON c.id = e.chunk_id + JOIN screenshot_ocr o ON o.id = c.ocr_id + JOIN screenshots s ON s.id = o.screenshot_id + WHERE e.embedding MATCH ? + AND k = ? + {chunk_condition} + {vis_condition} + ORDER BY e.distance ASC + """, + (query_bytes, limit * 2), + ) + + results = [] + seen_screenshots = set() + + for row in cur.fetchall(): + result = dict(row) + screenshot_id = result["id"] + + # Deduplicate by screenshot (keep best match) + if screenshot_id in seen_screenshots: + continue + seen_screenshots.add(screenshot_id) + + # Convert L2 distance to similarity + distance = result.pop("vec_distance", 0) + result["text_similarity"] = max(0.0, min(1.0, 1.0 - (distance**2) / 2)) + + results.append(result) + if len(results) >= limit: + break + + return results + + def search_hybrid( + self, + query: str, + image_embedding: list[float] | None = None, + text_embedding: list[float] | None = None, + mode: str = "auto", + limit: int = 20, + visibility: str = "visible_only", + rrf_k: int = 60, + ) -> list[dict]: + """Hybrid search combining image and text search methods. + + Uses Reciprocal Rank Fusion (RRF) to combine results from: + - CLIP image semantic search + - FTS5 fuzzy text search + - BGE text embedding search (small + large chunks) + + RRF formula: score(d) = Σ (1 / (k + rank(d, q))) + Higher k = more emphasis on top results, lower k = more equal weighting + + Args: + query: The search query string + image_embedding: CLIP image embedding (768-dim) for image search + text_embedding: BGE text embedding (384-dim) for text semantic search + mode: Search mode - "auto", "image", "text_fuzzy", "text_semantic" + limit: Maximum number of results + visibility: One of "visible_only", "hidden_only", or "all" + rrf_k: RRF constant (default 60, standard value) + + Returns: + List of screenshots with combined RRF scores and match sources + """ + # Collect results from each search method + results_by_source: dict[str, list[tuple[int, float]]] = {} + + # Determine which methods to use based on mode + use_image = mode in ("auto", "image") and image_embedding is not None + use_fts = mode in ("auto", "text_fuzzy") + use_text_semantic = mode in ("auto", "text_semantic") and text_embedding is not None + + # 1. CLIP Image Search + if use_image: + try: + image_results = self.search_similar( + query_embedding=image_embedding, + limit=limit * 2, # Get more for RRF merge + visibility=visibility, + ) + results_by_source["image"] = [(r["id"], r.get("similarity", 0)) for r in image_results] + except Exception as e: + print(f"Image search error: {e}") + + # 2. FTS5 Fuzzy Text Search + if use_fts: + try: + fts_results = self.search_ocr_fts( + query=query, + limit=limit * 2, + visibility=visibility, + ) + results_by_source["text_fts"] = [(r["id"], r.get("fts_rank", 0)) for r in fts_results] + except Exception as e: + print(f"FTS search error: {e}") + + # 3. BGE Text Semantic Search (small chunks) + if use_text_semantic: + try: + small_results = self.search_text_embeddings( + query_embedding=text_embedding, + chunk_size="small", + limit=limit * 2, + visibility=visibility, + ) + results_by_source["text_semantic_small"] = [ + (r["id"], r.get("text_similarity", 0)) for r in small_results + ] + except Exception as e: + print(f"Text semantic (small) search error: {e}") + + # 4. BGE Text Semantic Search (large chunks) + if use_text_semantic: + try: + large_results = self.search_text_embeddings( + query_embedding=text_embedding, + chunk_size="large", + limit=limit * 2, + visibility=visibility, + ) + results_by_source["text_semantic_large"] = [ + (r["id"], r.get("text_similarity", 0)) for r in large_results + ] + except Exception as e: + print(f"Text semantic (large) search error: {e}") + + # Apply RRF to combine results + rrf_scores: dict[int, float] = {} + match_sources: dict[int, list[str]] = {} + + for source, ranked_results in results_by_source.items(): + for rank, (screenshot_id, _score) in enumerate(ranked_results, start=1): + # RRF contribution from this source + rrf_contribution = 1.0 / (rrf_k + rank) + rrf_scores[screenshot_id] = rrf_scores.get(screenshot_id, 0) + rrf_contribution + + # Track which sources matched this screenshot + if screenshot_id not in match_sources: + match_sources[screenshot_id] = [] + match_sources[screenshot_id].append(source) + + # Sort by RRF score + sorted_ids = sorted(rrf_scores.keys(), key=lambda x: rrf_scores[x], reverse=True)[:limit] + + # Fetch full screenshot data + results = [] + if sorted_ids: + placeholders = ",".join("?" * len(sorted_ids)) + + if visibility == "visible_only": + vis_condition = "AND (is_hidden = 0 OR is_hidden IS NULL)" + elif visibility == "hidden_only": + vis_condition = "AND is_hidden = 1" + else: + vis_condition = "" + + with self.cursor() as cur: + cur.execute( + f""" + SELECT s.*, o.full_text as ocr_text + FROM screenshots s + LEFT JOIN screenshot_ocr o ON o.screenshot_id = s.id + WHERE s.id IN ({placeholders}) + {vis_condition} + """, + sorted_ids, + ) + + # Build lookup for fetched data + fetched = {row["id"]: dict(row) for row in cur.fetchall()} + + # Combine with scores, maintaining RRF order + for screenshot_id in sorted_ids: + if screenshot_id in fetched: + result = fetched[screenshot_id] + result["similarity"] = rrf_scores[screenshot_id] + result["match_sources"] = match_sources.get(screenshot_id, []) + + # Create snippet if text search matched + if "text_fts" in result["match_sources"] or any( + s.startswith("text_semantic") for s in result["match_sources"] + ): + ocr_text = result.get("ocr_text", "") + if ocr_text: + result["ocr_snippet"] = self._create_snippet(ocr_text, query) + + results.append(result) + + return results + + def _create_snippet(self, text: str, query: str, context_chars: int = 50) -> str: + """Create a text snippet with query highlighted. + + Args: + text: Full text to search in + query: Query to highlight + context_chars: Characters of context around match + + Returns: + Snippet with **highlighted** query match + """ + if not text or not query: + return "" + + # Find best match position (case-insensitive) + text_lower = text.lower() + query_words = query.lower().split() + + # Find first occurrence of any query word + best_pos = len(text) + best_word = "" + for word in query_words: + pos = text_lower.find(word) + if pos != -1 and pos < best_pos: + best_pos = pos + best_word = word + + if best_pos == len(text): + # No match found, return start of text + return text[: context_chars * 2] + "..." if len(text) > context_chars * 2 else text + + # Calculate snippet boundaries + start = max(0, best_pos - context_chars) + end = min(len(text), best_pos + len(best_word) + context_chars) + + # Build snippet + snippet = "" + if start > 0: + snippet += "..." + snippet += text[start:best_pos] + snippet += f"**{text[best_pos:best_pos + len(best_word)]}**" + snippet += text[best_pos + len(best_word) : end] + if end < len(text): + snippet += "..." + + return snippet + + def get_ocr_stats(self) -> dict: + """Get OCR processing statistics""" + with self.cursor() as cur: + cur.execute("SELECT COUNT(*) FROM screenshots WHERE has_ocr = 1") + with_ocr = cur.fetchone()[0] + + cur.execute("SELECT COUNT(*) FROM screenshots WHERE has_ocr = 0") + without_ocr = cur.fetchone()[0] + + cur.execute("SELECT COUNT(*) FROM screenshot_ocr WHERE full_text != ''") + with_text = cur.fetchone()[0] + + cur.execute("SELECT AVG(confidence) FROM screenshot_ocr WHERE confidence IS NOT NULL") + avg_confidence = cur.fetchone()[0] + + cur.execute("SELECT COUNT(*) FROM ocr_text_chunks") + total_chunks = cur.fetchone()[0] + + return { + "total_screenshots": with_ocr + without_ocr, + "with_ocr": with_ocr, + "without_ocr": without_ocr, + "with_text": with_text, + "avg_confidence": avg_confidence, + "total_chunks": total_chunks, + } + + def delete_ocr_data(self, screenshot_id: int) -> bool: + """Delete OCR data for a screenshot (for reprocessing)""" + with self.cursor() as cur: + # Get OCR record ID + cur.execute("SELECT id FROM screenshot_ocr WHERE screenshot_id = ?", (screenshot_id,)) + row = cur.fetchone() + if not row: + return False + + ocr_id = row[0] + + # Get chunk IDs for this OCR record + cur.execute("SELECT id FROM ocr_text_chunks WHERE ocr_id = ?", (ocr_id,)) + chunk_ids = [r[0] for r in cur.fetchall()] + + # Delete text embeddings + if chunk_ids: + placeholders = ",".join("?" * len(chunk_ids)) + cur.execute(f"DELETE FROM ocr_text_embeddings WHERE chunk_id IN ({placeholders})", chunk_ids) + + # Delete chunks + cur.execute("DELETE FROM ocr_text_chunks WHERE ocr_id = ?", (ocr_id,)) + + # Delete OCR record (FTS will auto-sync via trigger) + cur.execute("DELETE FROM screenshot_ocr WHERE id = ?", (ocr_id,)) + + # Reset has_ocr flag + cur.execute("UPDATE screenshots SET has_ocr = 0 WHERE id = ?", (screenshot_id,)) + + return True + + def reset_all_ocr(self) -> int: + """Reset all OCR data for reprocessing with new provider. + + Returns: + Number of screenshots that will need reprocessing + """ + with self.cursor() as cur: + # Delete all text embeddings + cur.execute("DELETE FROM ocr_text_embeddings") + + # Delete all chunks + cur.execute("DELETE FROM ocr_text_chunks") + + # Delete all OCR records + cur.execute("DELETE FROM screenshot_ocr") + + # Reset all has_ocr flags + cur.execute("UPDATE screenshots SET has_ocr = 0") + count = cur.rowcount + + return count + # --- Stats --- def get_stats(self) -> dict: diff --git a/core/embeddings.py b/core/embeddings.py index 243a69f..9ce558e 100644 --- a/core/embeddings.py +++ b/core/embeddings.py @@ -131,10 +131,26 @@ def is_loaded() -> bool: return _model is not None +def is_downloaded() -> bool: + """Check if the CLIP model is downloaded in HuggingFace cache""" + try: + from huggingface_hub import try_to_load_from_cache + + # clip-ViT-L-14 maps to sentence-transformers/clip-ViT-L-14 + model_id = "sentence-transformers/clip-ViT-L-14" + + # Check for the sentence-transformers config file + result = try_to_load_from_cache(model_id, "config_sentence_transformers.json") + return result is not None + except Exception: + return False + + def get_model_status() -> dict: """Get detailed model status""" return { "loaded": _model is not None, + "downloaded": is_downloaded(), "device": _device, "last_used": _last_used, "idle_seconds": time.time() - _last_used if _last_used > 0 else 0, diff --git a/core/ocr.py b/core/ocr.py new file mode 100644 index 0000000..5a62e09 --- /dev/null +++ b/core/ocr.py @@ -0,0 +1,239 @@ +""" +LiveRecall OCR Service +Abstraction layer for OCR text extraction with pluggable providers + +============================================================================= +OCR PROVIDER OPTIONS +============================================================================= + +Current: Apple Vision (macOS) / Tesseract (Windows) + - Apple Vision: Native macOS, zero memory overhead, fast (~200ms), excellent on UI text + - Tesseract: Cross-platform, lightweight (~50MB), stable + +Upgrade options (better accuracy): + - PaddleOCR PP-OCRv4: pip install paddleocr paddlepaddle + Best balance of accuracy/speed, complex macOS install + - docTR: pip install python-doctr[torch] + Good accuracy, clean install, Apache 2.0 + - EasyOCR: pip install easyocr + Easy install but heavy (1-2GB memory) + +High-end (if hardware allows): + - GOT-OCR2: State-of-the-art, 8GB+ VRAM required + - Surya: Excellent accuracy but GPL license (problematic for MIT projects) + +To switch provider: + 1. Update config: config.ocr.provider = "paddleocr" + 2. Run: ocr_service.recompute_all_ocr() +============================================================================= +""" + +from __future__ import annotations + +import platform +from dataclasses import dataclass +from typing import TYPE_CHECKING, Protocol, runtime_checkable + +if TYPE_CHECKING: + from pathlib import Path + + +@dataclass +class OCRResult: + """Result from OCR text extraction""" + + text: str + confidence: float | None = None + word_count: int = 0 + language: str = "en" + + @classmethod + def empty(cls) -> OCRResult: + """Create an empty OCR result for images with no text""" + return cls(text="", confidence=None, word_count=0) + + +@runtime_checkable +class OCRProvider(Protocol): + """ + Abstract interface for OCR engines. + + Implement this protocol to add a new OCR provider. + See core/ocr_providers/ for example implementations. + """ + + name: str + + def extract_text(self, image_path: str | Path) -> OCRResult: + """Extract text from an image file""" + ... + + def is_available(self) -> bool: + """Check if this provider is available on the current system""" + ... + + def get_model_info(self) -> dict: + """Get information about the OCR model/engine""" + ... + + +class OCRService: + """ + OCR service with pluggable providers. + + Supports automatic provider selection based on platform and config. + Providers are registered and can be switched at runtime. + """ + + _providers: dict[str, type[OCRProvider]] = {} + _instance: OCRProvider | None = None + + def __init__(self): + self._current_provider: OCRProvider | None = None + + @classmethod + def register(cls, name: str, provider_class: type[OCRProvider]) -> None: + """Register an OCR provider""" + cls._providers[name] = provider_class + + @classmethod + def get_available_providers(cls) -> list[str]: + """Get list of registered provider names""" + return list(cls._providers.keys()) + + def get_provider(self, provider_name: str | None = None) -> OCRProvider: + """ + Get an OCR provider instance. + + Args: + provider_name: Specific provider to use. If None or "auto", + automatically selects based on platform. + """ + if provider_name is None or provider_name == "auto": + provider_name = self._get_default_provider_name() + + if provider_name not in self._providers: + available = ", ".join(self._providers.keys()) + raise ValueError(f"Unknown OCR provider: {provider_name}. Available: {available}") + + provider_class = self._providers[provider_name] + provider = provider_class() + + if not provider.is_available(): + raise RuntimeError(f"OCR provider '{provider_name}' is not available on this system") + + return provider + + def _get_default_provider_name(self) -> str: + """Get the default provider name based on platform""" + system = platform.system() + + if system == "Darwin": # macOS + if "apple_vision" in self._providers: + return "apple_vision" + elif system == "Windows": + if "tesseract" in self._providers: + return "tesseract" + + # Fallback to tesseract if available + if "tesseract" in self._providers: + return "tesseract" + + # Return first available provider + if self._providers: + return next(iter(self._providers.keys())) + + raise RuntimeError("No OCR providers registered") + + def extract_text(self, image_path: str | Path, provider_name: str | None = None) -> OCRResult: + """ + Extract text from an image. + + Args: + image_path: Path to the image file + provider_name: Specific provider to use (None for auto) + + Returns: + OCRResult with extracted text and metadata + """ + provider = self.get_provider(provider_name) + return provider.extract_text(image_path) + + def get_current_provider_info(self, provider_name: str | None = None) -> dict: + """Get information about the current/specified provider""" + provider = self.get_provider(provider_name) + return { + "name": provider.name, + "available": provider.is_available(), + **provider.get_model_info(), + } + + def is_available(self) -> bool: + """Check if any OCR provider is available""" + try: + self.get_provider() + return True + except (ValueError, RuntimeError): + return False + + def get_provider_name(self) -> str: + """Get the name of the current/default provider""" + try: + provider = self.get_provider() + return provider.name + except (ValueError, RuntimeError): + return "none" + + +# Global OCR service instance +ocr_service = OCRService() + + +def _register_providers(): + """Register available OCR providers""" + # Import and register Apple Vision provider (macOS only) + if platform.system() == "Darwin": + try: + from core.ocr_providers.apple_vision import AppleVisionOCR + + OCRService.register("apple_vision", AppleVisionOCR) + except ImportError: + pass # ocrmac not installed + + # Import and register Tesseract provider (cross-platform) + try: + from core.ocr_providers.tesseract import TesseractOCR + + OCRService.register("tesseract", TesseractOCR) + except ImportError: + pass # pytesseract not installed + + +# Register providers on module load +_register_providers() + + +# Convenience functions +def extract_text(image_path: str | Path, provider_name: str | None = None) -> OCRResult: + """Extract text from an image (convenience function)""" + return ocr_service.extract_text(image_path, provider_name) + + +def get_ocr_provider_info(provider_name: str | None = None) -> dict: + """Get OCR provider information (convenience function)""" + return ocr_service.get_current_provider_info(provider_name) + + +def get_available_providers() -> list[str]: + """Get list of available OCR providers""" + return OCRService.get_available_providers() + + +if __name__ == "__main__": + print("OCR Service Test") + print(f"Platform: {platform.system()}") + print(f"Available providers: {get_available_providers()}") + + if get_available_providers(): + info = get_ocr_provider_info() + print(f"Default provider info: {info}") diff --git a/core/ocr_providers/__init__.py b/core/ocr_providers/__init__.py new file mode 100644 index 0000000..05c4fe4 --- /dev/null +++ b/core/ocr_providers/__init__.py @@ -0,0 +1,20 @@ +""" +LiveRecall OCR Providers + +This package contains OCR provider implementations. +Each provider implements the OCRProvider protocol from core.ocr. + +Available providers: +- apple_vision: Native macOS Vision framework (macOS only) +- tesseract: Tesseract OCR engine (cross-platform) + +To add a new provider: +1. Create a new file in this directory (e.g., paddleocr.py) +2. Implement the OCRProvider protocol +3. Register it in core/ocr.py _register_providers() +""" + +from __future__ import annotations + +# Providers are imported conditionally in core/ocr.py based on availability +__all__ = [] diff --git a/core/ocr_providers/apple_vision.py b/core/ocr_providers/apple_vision.py new file mode 100644 index 0000000..9d5ed48 --- /dev/null +++ b/core/ocr_providers/apple_vision.py @@ -0,0 +1,131 @@ +""" +Apple Vision OCR Provider + +Uses macOS native Vision framework via the ocrmac library. +This is the recommended provider for macOS due to: +- Native Apple Silicon optimization (Neural Engine) +- Zero additional memory overhead (uses system APIs) +- Fast processing (~200ms per image) +- Excellent accuracy on UI text and screen content + +Requirements: +- macOS 10.15+ (Catalina or later) +- pip install ocrmac +""" + +from __future__ import annotations + +import platform +from pathlib import Path +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from core.ocr import OCRResult + + +class AppleVisionOCR: + """ + OCR provider using Apple's Vision framework. + + This provider is only available on macOS and uses the native + Vision framework for text recognition, which provides: + - Hardware acceleration on Apple Silicon + - No additional model downloads required + - Excellent accuracy for screen content + """ + + name = "apple_vision" + + def __init__(self): + self._ocr = None + + def _get_ocr(self): + """Lazy load the ocrmac OCR instance""" + if self._ocr is None: + try: + from ocrmac.ocrmac import OCR + + self._ocr = OCR + except ImportError as e: + raise ImportError( + "ocrmac is required for Apple Vision OCR. " "Install it with: pip install ocrmac" + ) from e + return self._ocr + + def extract_text(self, image_path: str | Path) -> OCRResult: + """ + Extract text from an image using Apple Vision. + + Args: + image_path: Path to the image file + + Returns: + OCRResult with extracted text and confidence + """ + from core.ocr import OCRResult + + image_path = Path(image_path) + if not image_path.exists(): + raise FileNotFoundError(f"Image not found: {image_path}") + + OCR = self._get_ocr() + + try: + # ocrmac returns list of (text, confidence, bbox) tuples + results = OCR(str(image_path)).recognize() + + if not results: + return OCRResult.empty() + + # Combine all text with newlines between blocks + texts = [] + confidences = [] + + for item in results: + if len(item) >= 2: + text, confidence = item[0], item[1] + if text and text.strip(): + texts.append(text.strip()) + if confidence is not None: + confidences.append(confidence) + + full_text = "\n".join(texts) + avg_confidence = sum(confidences) / len(confidences) if confidences else None + word_count = len(full_text.split()) if full_text else 0 + + return OCRResult( + text=full_text, + confidence=avg_confidence, + word_count=word_count, + language="en", # Vision framework auto-detects but we default to en + ) + + except Exception as e: + print(f"Apple Vision OCR error: {e}") + # Return empty result on error rather than raising + return OCRResult.empty() + + def is_available(self) -> bool: + """Check if Apple Vision OCR is available""" + if platform.system() != "Darwin": + return False + + try: + from ocrmac.ocrmac import OCR # noqa: F401 + + return True + except ImportError: + return False + + def get_model_info(self) -> dict: + """Get information about the Vision framework""" + import platform as plat + + return { + "engine": "Apple Vision Framework", + "platform": "macOS", + "macos_version": plat.mac_ver()[0] if plat.system() == "Darwin" else None, + "requires_download": False, + "memory_overhead": "minimal (uses system APIs)", + "supported_languages": ["en", "zh", "ja", "ko", "de", "fr", "it", "pt", "es"], + } diff --git a/core/ocr_providers/tesseract.py b/core/ocr_providers/tesseract.py new file mode 100644 index 0000000..b64d6a0 --- /dev/null +++ b/core/ocr_providers/tesseract.py @@ -0,0 +1,156 @@ +""" +Tesseract OCR Provider + +Uses Tesseract OCR engine via pytesseract library. +This is the recommended provider for Windows and as a cross-platform fallback. + +Advantages: +- Cross-platform (Windows, macOS, Linux) +- Lightweight (~50MB memory) +- Fast processing (~100ms per image) +- Well-tested and stable + +Requirements: +- Tesseract binary installed on system: + - Windows: choco install tesseract OR download from https://github.com/UB-Mannheim/tesseract/wiki + - macOS: brew install tesseract + - Linux: apt install tesseract-ocr +- pip install pytesseract +""" + +from __future__ import annotations + +import shutil +from pathlib import Path +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from core.ocr import OCRResult + + +class TesseractOCR: + """ + OCR provider using Tesseract OCR engine. + + This provider works cross-platform and is the default + for Windows systems. It requires the Tesseract binary + to be installed on the system. + """ + + name = "tesseract" + + def __init__(self): + self._pytesseract = None + + def _get_pytesseract(self): + """Lazy load pytesseract""" + if self._pytesseract is None: + try: + import pytesseract + + self._pytesseract = pytesseract + except ImportError as e: + raise ImportError( + "pytesseract is required for Tesseract OCR. " "Install it with: pip install pytesseract" + ) from e + return self._pytesseract + + def extract_text(self, image_path: str | Path) -> OCRResult: + """ + Extract text from an image using Tesseract. + + Args: + image_path: Path to the image file + + Returns: + OCRResult with extracted text and confidence + """ + from core.ocr import OCRResult + + image_path = Path(image_path) + if not image_path.exists(): + raise FileNotFoundError(f"Image not found: {image_path}") + + pytesseract = self._get_pytesseract() + + try: + from PIL import Image + + image = Image.open(image_path) + + # Get detailed OCR data including confidence scores + data = pytesseract.image_to_data(image, output_type=pytesseract.Output.DICT) + + # Filter and collect text with confidence + words = [] + confidences = [] + + for i, conf in enumerate(data["conf"]): + # Tesseract returns -1 for non-text elements + if int(conf) > 0: + text = data["text"][i] + if text and text.strip(): + words.append(text.strip()) + confidences.append(int(conf)) + + # Join words into full text + full_text = " ".join(words) + + # Calculate average confidence (Tesseract uses 0-100 scale) + avg_confidence = sum(confidences) / len(confidences) / 100.0 if confidences else None + + return OCRResult( + text=full_text, + confidence=avg_confidence, + word_count=len(words), + language="en", + ) + + except Exception as e: + print(f"Tesseract OCR error: {e}") + return OCRResult.empty() + + def is_available(self) -> bool: + """Check if Tesseract is available""" + # Check if pytesseract is installed + try: + import pytesseract # noqa: F401 + except ImportError: + return False + + # Check if tesseract binary is available + tesseract_cmd = shutil.which("tesseract") + return tesseract_cmd is not None + + def get_model_info(self) -> dict: + """Get information about the Tesseract installation""" + tesseract_path = shutil.which("tesseract") + version = None + + if tesseract_path: + try: + import subprocess + + result = subprocess.run([tesseract_path, "--version"], capture_output=True, text=True, timeout=5) + # First line contains version + version = result.stdout.split("\n")[0] if result.stdout else None + except Exception: + pass + + return { + "engine": "Tesseract OCR", + "binary_path": tesseract_path, + "version": version, + "requires_download": True, + "memory_overhead": "~50MB", + "supported_languages": self._get_installed_languages(), + } + + def _get_installed_languages(self) -> list[str]: + """Get list of installed Tesseract language packs""" + try: + pytesseract = self._get_pytesseract() + langs = pytesseract.get_languages() + return langs if langs else ["eng"] + except Exception: + return ["eng"] # Default assumption diff --git a/core/processor.py b/core/processor.py index a9d7f5e..d88ab43 100644 --- a/core/processor.py +++ b/core/processor.py @@ -1,25 +1,56 @@ """ LiveRecall Processor -Sync service for generating embeddings for unsynced screenshots +Sync service for generating embeddings for unsynced screenshots. + +Supports multiple processing phases: +1. CLIP image embeddings (visual semantic search) +2. OCR text extraction (exact/fuzzy text search) +3. BGE text embeddings (text semantic search) + +OCR and text embedding providers can be configured in config.py. +To change models, update config and call processor_service.recompute_ocr(). """ import threading from collections.abc import Callable from dataclasses import dataclass +from core.config import config from core.database import db from core.embeddings import get_image_embedding +class OCRProcessingError(Exception): + """Raised when OCR processing fails for expected reasons (corrupted image, etc.)""" + + pass + + @dataclass class SyncProgress: - """Progress information for sync operation""" + """Progress information for sync operation with detailed phase tracking + + Phases: + 1. embedding: Generate CLIP image embeddings + 2. ocr: Extract text via OCR + 3. text_embedding: Generate BGE text embeddings for chunks + """ total: int = 0 processed: int = 0 errors: int = 0 is_running: bool = False + # Detailed phase tracking + current_phase: str = "" # "embedding", "ocr", "text_embedding" + embeddings_done: int = 0 + ocr_done: int = 0 + text_embeddings_done: int = 0 + + # Error tracking for visibility + last_error: str = "" + error_type: str = "" # "ocr_failed", "db_error", "code_error" + @property def remaining(self) -> int: return self.total - self.processed - self.errors @@ -32,7 +63,22 @@ def percent(self) -> float: class ProcessorService: - """Service for syncing screenshots (generating embeddings)""" + """Service for syncing screenshots (embeddings + OCR + text embeddings) + + Processing pipeline: + 1. Generate CLIP image embeddings for unsynced screenshots + 2. Run OCR on screenshots without OCR data (if enabled) + 3. Generate BGE text embeddings for OCR text chunks + + Configuration: + - OCR provider: config.ocr.provider ("auto", "apple_vision", "tesseract") + - Text model: config.text_embedding.model (default: "BAAI/bge-small-en-v1.5") + - Chunk sizes: config.chunking.small_size, config.chunking.large_size + + To change OCR/embedding models: + 1. Update config settings + 2. Call processor_service.recompute_ocr() to reprocess all screenshots + """ def __init__(self): self._running = False @@ -41,6 +87,35 @@ def __init__(self): self._on_progress: Callable[[SyncProgress], None] | None = None self._cancel_requested = False + # Lazy-loaded services (imported on first use to avoid circular imports) + self._ocr_service = None + self._text_embedding_service = None + self._chunking_module = None + + def _get_ocr_service(self): + """Lazy load OCR service""" + if self._ocr_service is None: + from core.ocr import ocr_service + + self._ocr_service = ocr_service + return self._ocr_service + + def _get_text_embedding_service(self): + """Lazy load text embedding service""" + if self._text_embedding_service is None: + from core.text_embeddings import text_embedding_service + + self._text_embedding_service = text_embedding_service + return self._text_embedding_service + + def _get_chunking(self): + """Lazy load chunking module""" + if self._chunking_module is None: + from core import chunking + + self._chunking_module = chunking + return self._chunking_module + @property def is_running(self) -> bool: return self._running @@ -60,6 +135,49 @@ def start(self, batch_size: int = 10, on_progress: Callable[[SyncProgress], None self._thread = threading.Thread(target=self._process_loop, args=(batch_size,), daemon=True) self._thread.start() + def start_ocr_migration(self, batch_size: int = 10, on_progress: Callable[[SyncProgress], None] | None = None): + """Start OCR migration for screenshots that have CLIP but no OCR. + + This only processes existing screenshots that need OCR migration, + NOT new screenshots that haven't been synced yet. + Use start() for full sync including new screenshots. + """ + if self._running: + return + + # Only start if there are OCR-pending screenshots + ocr_pending = db.get_ocr_pending_count() if config.ocr.enabled else 0 + if ocr_pending == 0: + return + + self._running = True + self._cancel_requested = False + self._on_progress = on_progress + self._thread = threading.Thread(target=self._ocr_migration_loop, args=(batch_size,), daemon=True) + self._thread.start() + + def _ocr_migration_loop(self, batch_size: int): + """Background loop for OCR migration only (no CLIP processing)""" + ocr_pending = db.get_ocr_pending_count() if config.ocr.enabled else 0 + + if ocr_pending == 0: + self._running = False + self._progress = SyncProgress(total=0, processed=0, errors=0, is_running=False) + return + + self._progress = SyncProgress(total=ocr_pending, processed=0, errors=0, is_running=True) + self._progress.current_phase = "ocr" + + print(f"🔄 Auto-syncing OCR for {ocr_pending} existing screenshots...") + + # Only process OCR migration (skip CLIP phase) + self._process_pending_ocr(batch_size) + + # Mark as complete + self._running = False + self._progress.is_running = False + print(f"✅ OCR migration complete: {self._progress.processed} processed, {self._progress.errors} errors") + def stop(self): """Stop processing""" self._cancel_requested = True @@ -76,6 +194,7 @@ def sync_all(self, on_progress: Callable[[SyncProgress], None] | None = None): # Get unsynced count unsynced = db.get_unsynced_screenshots() self._progress = SyncProgress(total=len(unsynced), processed=0, errors=0, is_running=True) + self._progress.current_phase = "embedding" if self._on_progress: self._on_progress(self._progress) @@ -85,11 +204,14 @@ def sync_all(self, on_progress: Callable[[SyncProgress], None] | None = None): break try: - # Generate embedding + # Phase 1: Generate CLIP embedding embedding = get_image_embedding(screenshot["image_path"]) - - # Save to database db.add_embedding(screenshot["id"], embedding) + self._progress.embeddings_done += 1 + + # Phase 2: OCR (if enabled) + if config.ocr.enabled: + self._process_ocr_for_screenshot(screenshot["id"], screenshot["image_path"]) self._progress.processed += 1 except Exception as e: @@ -107,25 +229,25 @@ def sync_all(self, on_progress: Callable[[SyncProgress], None] | None = None): def _process_loop(self, batch_size: int): """Background processing - processes all unsynced then stops""" - # Get total unsynced count upfront + # Phase 1: Process screenshots without CLIP embeddings total_unsynced = db.get_unsynced_count() + ocr_pending = db.get_ocr_pending_count() if config.ocr.enabled else 0 - if total_unsynced == 0: + total = total_unsynced + ocr_pending + if total == 0: self._running = False self._progress = SyncProgress(total=0, processed=0, errors=0, is_running=False) return - self._progress = SyncProgress(total=total_unsynced, processed=0, errors=0, is_running=True) + self._progress = SyncProgress(total=total, processed=0, errors=0, is_running=True) + self._progress.current_phase = "embedding" - print(f"🔄 Syncing {total_unsynced} screenshots...") + print(f"🔄 Syncing {total_unsynced} screenshots + {ocr_pending} OCR pending...") - # Process in batches until done + # Process CLIP embeddings in batches while self._running and not self._cancel_requested: - # Get next batch unsynced = db.get_unsynced_screenshots(limit=batch_size) - if not unsynced: - # All done! break for screenshot in unsynced: @@ -133,26 +255,258 @@ def _process_loop(self, batch_size: int): break try: - # Generate embedding + # Generate CLIP embedding embedding = get_image_embedding(screenshot["image_path"]) - - # Save to database db.add_embedding(screenshot["id"], embedding) + self._progress.embeddings_done += 1 + + # Run OCR immediately after embedding (before compression) + if config.ocr.enabled: + self._process_ocr_for_screenshot(screenshot["id"], screenshot["image_path"]) self._progress.processed += 1 print(f" ✓ {self._progress.processed}/{self._progress.total}") + except OCRProcessingError as e: + # Expected OCR failure - skip and continue + print(f" ⚠ Skipped OCR for {screenshot['id']}: {e}") + self._progress.errors += 1 + self._progress.last_error = str(e) + self._progress.error_type = "ocr_failed" + # Still count as processed since embedding worked + self._progress.processed += 1 + try: + db.mark_ocr_complete(screenshot["id"]) + except Exception: + pass + except (TypeError, AttributeError, KeyError) as e: + # Likely a code bug - log clearly but continue with other screenshots + error_msg = f"{type(e).__name__}: {e}" + print(f" ❌ Code error for {screenshot['id']}: {error_msg}") + self._progress.errors += 1 + self._progress.last_error = error_msg + self._progress.error_type = "code_error" + # Don't mark as complete - can retry after fix + except (FileNotFoundError, OSError) as e: + # Image file issue - skip and continue + print(f" ⚠ Skipped {screenshot['id']}: Cannot read image - {e}") + self._progress.errors += 1 + self._progress.last_error = str(e) + self._progress.error_type = "file_error" except Exception as e: - print(f" ✗ Error: {screenshot['image_path']}: {e}") + # Other error - log and continue + error_msg = f"{type(e).__name__}: {e}" + print(f" ✗ Error: {error_msg}") self._progress.errors += 1 + self._progress.last_error = error_msg + self._progress.error_type = "unknown" if self._on_progress: self._on_progress(self._progress) + # Phase 2: Process any remaining OCR (migration for existing screenshots) + if config.ocr.enabled and not self._cancel_requested: + self._progress.current_phase = "ocr" + self._process_pending_ocr(batch_size) + # Mark as complete self._running = False self._progress.is_running = False print(f"✅ Sync complete: {self._progress.processed} processed, {self._progress.errors} errors") + def _process_ocr_for_screenshot(self, screenshot_id: int, image_path: str): + """Run OCR pipeline for a single screenshot + + Pipeline: + 1. Extract text via OCR provider + 2. Store OCR result + 3. Chunk text (small + large) + 4. Generate BGE embeddings for chunks + 5. Store chunks and embeddings + + Raises: + OCRProcessingError: For expected OCR failures (corrupted image, etc.) + TypeError/AttributeError: Re-raised for code bugs (should not be silenced) + Exception: Other unexpected errors are re-raised + """ + self._progress.current_phase = "ocr" + + ocr_service = self._get_ocr_service() + text_emb_service = self._get_text_embedding_service() + chunking = self._get_chunking() + + # Step 1: Extract text + try: + ocr_result = ocr_service.extract_text(image_path) + except (FileNotFoundError, OSError) as e: + # Expected failures - image missing or corrupted + raise OCRProcessingError(f"Cannot read image: {e}") from e + except Exception: + # Unexpected OCR error - could be a bug, re-raise + raise + + # Step 2: Store OCR result (even if empty, for tracking) + # This is a critical step - if it fails, it's likely a code bug + # Returns the ocr_id which we need for adding chunks + ocr_id = db.add_ocr_text( + screenshot_id=screenshot_id, + full_text=ocr_result.text, + confidence=ocr_result.confidence, + word_count=ocr_result.word_count, + ) + + self._progress.ocr_done += 1 + + # Step 3-5: Only if we have text + if ocr_result.text.strip(): + self._progress.current_phase = "text_embedding" + + # Chunk the text (dual chunking: small + large) + chunked = chunking.chunk_ocr_text( + ocr_result.text, + small_size=config.chunking.small_size, + small_overlap=config.chunking.small_overlap, + large_size=config.chunking.large_size, + large_overlap=config.chunking.large_overlap, + ) + + # Process small chunks + for chunk in chunked.small: + chunk_id = db.add_ocr_chunk( + ocr_id=ocr_id, + chunk_size="small", + chunk_index=chunk.index, + chunk_text=chunk.text, + start_char=chunk.start_char, + end_char=chunk.end_char, + ) + # Generate and store embedding + embedding = text_emb_service.get_text_embedding(chunk.text) + db.add_text_embedding(chunk_id, embedding) + + # Process large chunks + for chunk in chunked.large: + chunk_id = db.add_ocr_chunk( + ocr_id=ocr_id, + chunk_size="large", + chunk_index=chunk.index, + chunk_text=chunk.text, + start_char=chunk.start_char, + end_char=chunk.end_char, + ) + # Generate and store embedding + embedding = text_emb_service.get_text_embedding(chunk.text) + db.add_text_embedding(chunk_id, embedding) + + self._progress.text_embeddings_done += len(chunked.small) + len(chunked.large) + + # Mark OCR complete for this screenshot + db.mark_ocr_complete(screenshot_id) + + def _process_pending_ocr(self, batch_size: int): + """Process OCR for screenshots that have embeddings but no OCR (migration)""" + while self._running and not self._cancel_requested: + pending = db.get_screenshots_without_ocr(limit=batch_size) + if not pending: + break + + for screenshot in pending: + if self._cancel_requested: + break + + try: + self._process_ocr_for_screenshot(screenshot["id"], screenshot["image_path"]) + self._progress.processed += 1 + print(f" ✓ {self._progress.processed}/{self._progress.total}") + except OCRProcessingError as e: + # Expected failure (corrupted image, etc.) - skip and continue + print(f" ⚠ Skipped {screenshot['id']}: {e}") + self._progress.errors += 1 + self._progress.last_error = str(e) + self._progress.error_type = "ocr_failed" + # Mark as complete so we don't retry + try: + db.mark_ocr_complete(screenshot["id"]) + except Exception: + pass + except (TypeError, AttributeError, KeyError) as e: + # Likely a code bug - log clearly but continue with other screenshots + error_msg = f"{type(e).__name__}: {e}" + print(f" ❌ Code error for {screenshot['id']}: {error_msg}") + self._progress.errors += 1 + self._progress.last_error = error_msg + self._progress.error_type = "code_error" + # Don't mark as complete - can retry after fix + except Exception as e: + # Unexpected error - log but continue (could be transient) + error_msg = f"{type(e).__name__}: {e}" + print(f" ✗ Error: {error_msg}") + self._progress.errors += 1 + self._progress.last_error = error_msg + self._progress.error_type = "unknown" + + if self._on_progress: + self._on_progress(self._progress) + + def recompute_ocr(self, on_progress: Callable[[SyncProgress], None] | None = None): + """Recompute OCR for all screenshots (use after changing OCR/embedding model) + + This will: + 1. Clear all existing OCR data + 2. Re-run OCR on all screenshots + 3. Regenerate all text chunks and embeddings + """ + if self._running: + raise RuntimeError("Cannot recompute while sync is running") + + self._on_progress = on_progress + self._cancel_requested = False + + # Clear existing OCR data + print("🗑️ Clearing existing OCR data...") + db.reset_all_ocr() + + # Get total count + total = db.get_screenshot_count() + self._progress = SyncProgress(total=total, processed=0, errors=0, is_running=True) + self._progress.current_phase = "ocr" + + if self._on_progress: + self._on_progress(self._progress) + + print(f"🔄 Recomputing OCR for {total} screenshots...") + + # Process all screenshots + offset = 0 + batch_size = 10 + while not self._cancel_requested: + screenshots = db.get_screenshots_without_ocr(limit=batch_size) + if not screenshots: + break + + for screenshot in screenshots: + if self._cancel_requested: + break + + try: + self._process_ocr_for_screenshot(screenshot["id"], screenshot["image_path"]) + self._progress.processed += 1 + print(f" ✓ {self._progress.processed}/{self._progress.total}") + except Exception as e: + print(f" ✗ Error: {e}") + self._progress.errors += 1 + + if self._on_progress: + self._on_progress(self._progress) + + offset += batch_size + + self._progress.is_running = False + if self._on_progress: + self._on_progress(self._progress) + + print(f"✅ OCR recompute complete: {self._progress.processed} processed, {self._progress.errors} errors") + return self._progress + # Global processor service instance processor_service = ProcessorService() diff --git a/core/text_embeddings.py b/core/text_embeddings.py new file mode 100644 index 0000000..4d8d353 --- /dev/null +++ b/core/text_embeddings.py @@ -0,0 +1,388 @@ +""" +LiveRecall Text Embeddings +Specialized text embedding model for OCR semantic search + +Separate from CLIP to optimize for text-to-text similarity. +Uses lazy loading with auto-unload for memory management. + +============================================================================= +TEXT EMBEDDING MODEL OPTIONS +============================================================================= + +Current: BAAI/bge-small-en-v1.5 (384-dim, 130MB, MTEB 62.2) + - Great balance of accuracy and speed + - Optimized for semantic text similarity + +Lighter alternatives (if memory constrained): + - all-MiniLM-L6-v2: 384-dim, 80MB, MTEB 56.3 + - thenlper/gte-small: 384-dim, 70MB + +Higher accuracy alternatives: + - BAAI/bge-base-en-v1.5: 768-dim, 440MB, MTEB 63.5 + - all-mpnet-base-v2: 768-dim, 420MB + - nomic-embed-text-v1.5: 768-dim, 550MB + +To switch model: + 1. Update config: config.text_embeddings.model = "BAAI/bge-base-en-v1.5" + 2. Note: Changing dimensions requires recreating vector tables! + 3. Run: text_embedding_service.recompute_all() +============================================================================= +""" + +from __future__ import annotations + +import os +import threading +import time +import warnings + +# Suppress HuggingFace warnings +os.environ["TOKENIZERS_PARALLELISM"] = "false" +warnings.filterwarnings("ignore", message=".*use_fast.*") +warnings.filterwarnings("ignore", category=FutureWarning) + +import numpy as np +import torch + +# Lazy loading state +_model = None +_device: str | None = None +_last_used: float = 0 +_auto_unload_timer: threading.Timer | None = None +_lock = threading.Lock() + +# Configuration +AUTO_UNLOAD_SECONDS = 300 # 5 minutes of idle before unloading +DEFAULT_MODEL = "BAAI/bge-small-en-v1.5" +EMBEDDING_DIM = 384 # Dimension for bge-small + +# Model name (can be changed via config) +_current_model_name = DEFAULT_MODEL + + +def _get_device() -> str: + """Get the best available device""" + if torch.cuda.is_available(): + return "cuda" + elif hasattr(torch.backends, "mps") and torch.backends.mps.is_available(): + return "mps" # Apple Silicon + return "cpu" + + +def _load_model(model_name: str | None = None): + """Load the text embedding model (only called once)""" + global _model, _device, _last_used, _current_model_name + + if model_name is None: + model_name = _current_model_name + + with _lock: + if _model is not None: + _last_used = time.time() + return _model + + print(f"Loading text embedding model: {model_name}...") + + from sentence_transformers import SentenceTransformer + + _device = _get_device() + print(f"Using device: {_device}") + + try: + _model = SentenceTransformer(model_name, device=_device) + _current_model_name = model_name + except Exception as e: + print(f"Error loading on {_device}, falling back to CPU: {e}") + _device = "cpu" + _model = SentenceTransformer(model_name, device="cpu") + _current_model_name = model_name + + _last_used = time.time() + print(f"Text embedding model loaded successfully (dim={_model.get_sentence_embedding_dimension()})") + + # Start auto-unload timer + _schedule_auto_unload() + + return _model + + +def _schedule_auto_unload(): + """Schedule auto-unload after idle timeout""" + global _auto_unload_timer + + # Cancel existing timer + if _auto_unload_timer is not None: + _auto_unload_timer.cancel() + + if AUTO_UNLOAD_SECONDS > 0: + # Schedule new timer + _auto_unload_timer = threading.Timer(AUTO_UNLOAD_SECONDS, _check_and_unload) + _auto_unload_timer.daemon = True + _auto_unload_timer.start() + + +def _check_and_unload(): + """Check if model should be unloaded due to inactivity""" + global _last_used + + idle_time = time.time() - _last_used + if idle_time >= AUTO_UNLOAD_SECONDS: + print(f"Text embedding model idle for {idle_time:.0f}s, unloading...") + unload_model() + else: + # Reschedule check + _schedule_auto_unload() + + +def unload_model(): + """Explicitly unload the text embedding model to free memory""" + global _model, _device, _auto_unload_timer + + with _lock: + if _model is None: + return + + print("Unloading text embedding model...") + + # Cancel auto-unload timer + if _auto_unload_timer is not None: + _auto_unload_timer.cancel() + _auto_unload_timer = None + + # Delete model + del _model + _model = None + + # Clear GPU memory if applicable + if _device == "cuda": + torch.cuda.empty_cache() + + _device = None + print("Text embedding model unloaded") + + +def is_loaded() -> bool: + """Check if the model is currently loaded""" + return _model is not None + + +def is_downloaded() -> bool: + """Check if the text embedding model is downloaded in HuggingFace cache""" + try: + from huggingface_hub import try_to_load_from_cache + + # Check for the sentence-transformers config file + result = try_to_load_from_cache(_current_model_name, "config_sentence_transformers.json") + if result is not None: + return True + # Fallback: some models use config.json + result = try_to_load_from_cache(_current_model_name, "config.json") + return result is not None + except Exception: + return False + + +def get_model_status() -> dict: + """Get detailed model status""" + return { + "loaded": _model is not None, + "downloaded": is_downloaded(), + "model_name": _current_model_name, + "device": _device, + "last_used": _last_used, + "idle_seconds": time.time() - _last_used if _last_used > 0 else 0, + "auto_unload_seconds": AUTO_UNLOAD_SECONDS, + "embedding_dim": EMBEDDING_DIM, + } + + +def set_auto_unload_timeout(seconds: int): + """Set the auto-unload timeout (0 to disable)""" + global AUTO_UNLOAD_SECONDS + AUTO_UNLOAD_SECONDS = seconds + if seconds > 0 and _model is not None: + _schedule_auto_unload() + + +def _normalize(embedding: np.ndarray) -> list[float]: + """Normalize embedding to unit length for cosine similarity""" + arr = np.array(embedding) + norm = np.linalg.norm(arr) + if norm > 0: + arr = arr / norm + return arr.tolist() + + +def get_text_embedding(text: str) -> list[float]: + """ + Generate normalized embedding for a text string. + + Args: + text: The text to encode + + Returns: + Normalized embedding as list of floats (384-dim for bge-small) + """ + global _last_used + + model = _load_model() + _last_used = time.time() + + try: + # BGE models work best with instruction prefix for queries + # But for storing document chunks, we use text as-is + embedding = model.encode(text, convert_to_tensor=False) + return _normalize(embedding) + except Exception as e: + print(f"Error generating text embedding: {e}") + raise + + +def get_query_embedding(query: str) -> list[float]: + """ + Generate embedding for a search query. + + For BGE models, queries should be prefixed with "Represent this sentence:" + for optimal retrieval performance. + + Args: + query: The search query text + + Returns: + Normalized embedding as list of floats + """ + global _last_used + + model = _load_model() + _last_used = time.time() + + try: + # BGE instruction for query encoding + instruction = "Represent this sentence for searching relevant passages: " + embedding = model.encode(instruction + query, convert_to_tensor=False) + return _normalize(embedding) + except Exception as e: + print(f"Error generating query embedding: {e}") + raise + + +def get_batch_embeddings(texts: list[str], show_progress: bool = False) -> list[list[float]]: + """ + Generate embeddings for multiple texts efficiently. + + Args: + texts: List of texts to encode + show_progress: Whether to show progress bar + + Returns: + List of normalized embeddings + """ + global _last_used + + if not texts: + return [] + + model = _load_model() + _last_used = time.time() + + try: + embeddings = model.encode(texts, convert_to_tensor=False, batch_size=32, show_progress_bar=show_progress) + + # Normalize all embeddings + result = [] + for emb in embeddings: + result.append(_normalize(emb)) + + return result + except Exception as e: + print(f"Error generating batch embeddings: {e}") + raise + + +def get_embedding_dimension() -> int: + """Get the dimension of embeddings produced by the current model""" + if _model is not None: + return _model.get_sentence_embedding_dimension() + return EMBEDDING_DIM + + +def cosine_similarity(emb1: list[float], emb2: list[float]) -> float: + """Calculate cosine similarity between two embeddings""" + a = np.array(emb1) + b = np.array(emb2) + return float(np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))) + + +# ============================================================================= +# Service wrapper for consistent interface with other services +# ============================================================================= + + +class TextEmbeddingService: + """Wrapper class for text embedding functions to provide service-like interface. + + This wrapper provides the same functionality as the module functions + but in a class-based API for consistency with other services. + """ + + def get_text_embedding(self, text: str) -> list[float]: + """Generate embedding for document text""" + return get_text_embedding(text) + + def get_query_embedding(self, query: str) -> list[float]: + """Generate embedding for search query""" + return get_query_embedding(query) + + def get_batch_embeddings(self, texts: list[str], show_progress: bool = False) -> list[list[float]]: + """Generate embeddings for multiple texts""" + return get_batch_embeddings(texts, show_progress) + + def get_model_status(self) -> dict: + """Get model status""" + return get_model_status() + + def unload_model(self): + """Unload the model""" + unload_model() + + def is_loaded(self) -> bool: + """Check if model is loaded""" + return is_loaded() + + def is_downloaded(self) -> bool: + """Check if model is downloaded""" + return is_downloaded() + + +# Global service instance +text_embedding_service = TextEmbeddingService() + + +if __name__ == "__main__": + # Test text embeddings module + print("Testing text embeddings module...") + print(f"Status: {get_model_status()}") + + # Test text embedding (this will load the model) + text_emb = get_text_embedding("This is a test sentence for embedding") + print(f"Text embedding shape: {len(text_emb)}") + print(f"Status after load: {get_model_status()}") + + # Test query embedding + query_emb = get_query_embedding("search for test") + print(f"Query embedding shape: {len(query_emb)}") + + # Test batch embeddings + batch_emb = get_batch_embeddings(["Hello world", "How are you?", "Test batch"]) + print(f"Batch embeddings: {len(batch_emb)} embeddings") + + # Test similarity + sim = cosine_similarity(text_emb, query_emb) + print(f"Similarity between text and query: {sim:.4f}") + + # Test unload + print("Testing unload...") + unload_model() + print(f"Status after unload: {get_model_status()}") + + print("Done!") diff --git a/main.py b/main.py index 372807a..74f0a4c 100644 --- a/main.py +++ b/main.py @@ -56,6 +56,7 @@ def main(): host=args.host, port=args.port, reload=args.reload if not is_frozen() else False, + log_level="warning", # Suppress verbose access logs ) else: # Launch system tray (default) diff --git a/pyproject.toml b/pyproject.toml index e76afb3..8c21f55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,12 @@ dependencies = [ "torch==2.3.0", "transformers>=4.55.2", + # OCR (lazy loaded, platform-specific) + # Apple Vision via ocrmac (macOS only, uses native Vision framework) + "ocrmac>=1.0.0; sys_platform == 'darwin'", + # Tesseract OCR (cross-platform fallback) + "pytesseract>=0.3.10", + # API "fastapi>=0.115.0", "uvicorn>=0.32.0", diff --git a/scripts/cleanup_ocr.py b/scripts/cleanup_ocr.py new file mode 100644 index 0000000..b3fe94c --- /dev/null +++ b/scripts/cleanup_ocr.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +""" +Cleanup script to reset OCR data before restarting the app. +Run this after fixing bugs in the OCR processing pipeline. + +Usage: + uv run python scripts/cleanup_ocr.py +""" + +import sys +from pathlib import Path + +# Add project root to path +project_root = Path(__file__).parent.parent +sys.path.insert(0, str(project_root)) + +from core.database import db + + +def main(): + print("OCR Data Cleanup Script") + print("=" * 50) + + # Connect to database + db.connect() + + try: + # Get current stats + with db.cursor() as cur: + cur.execute("SELECT COUNT(*) FROM screenshots") + total_screenshots = cur.fetchone()[0] + + cur.execute("SELECT COUNT(*) FROM screenshots WHERE has_ocr = 1") + with_ocr = cur.fetchone()[0] + + cur.execute("SELECT COUNT(*) FROM screenshot_ocr") + ocr_records = cur.fetchone()[0] + + cur.execute("SELECT COUNT(*) FROM ocr_text_chunks") + chunk_records = cur.fetchone()[0] + + cur.execute("SELECT COUNT(*) FROM ocr_text_embeddings") + embedding_records = cur.fetchone()[0] + + print("\nCurrent database state:") + print(f" Total screenshots: {total_screenshots}") + print(f" Screenshots with has_ocr=1: {with_ocr}") + print(f" OCR records: {ocr_records}") + print(f" Chunk records: {chunk_records}") + print(f" Text embedding records: {embedding_records}") + + # Check for inconsistencies + with db.cursor() as cur: + # Screenshots marked as having OCR but no actual OCR record + cur.execute(""" + SELECT COUNT(*) FROM screenshots s + WHERE s.has_ocr = 1 + AND NOT EXISTS (SELECT 1 FROM screenshot_ocr o WHERE o.screenshot_id = s.id) + """) + orphan_has_ocr = cur.fetchone()[0] + + # OCR records without any chunks (could be intentional if text was empty) + cur.execute(""" + SELECT COUNT(*) FROM screenshot_ocr o + WHERE NOT EXISTS (SELECT 1 FROM ocr_text_chunks c WHERE c.ocr_id = o.id) + AND o.full_text != '' + """) + ocr_without_chunks = cur.fetchone()[0] + + # Chunks without embeddings + cur.execute(""" + SELECT COUNT(*) FROM ocr_text_chunks c + WHERE NOT EXISTS (SELECT 1 FROM ocr_text_embeddings e WHERE e.chunk_id = c.id) + """) + chunks_without_embeddings = cur.fetchone()[0] + + print("\nInconsistencies found:") + print(f" Screenshots with has_ocr=1 but no OCR record: {orphan_has_ocr}") + print(f" OCR records with text but no chunks: {ocr_without_chunks}") + print(f" Chunks without embeddings: {chunks_without_embeddings}") + + if orphan_has_ocr > 0 or ocr_without_chunks > 0 or chunks_without_embeddings > 0: + print("\n" + "=" * 50) + print("Found inconsistencies! Recommend full OCR reset.") + print("=" * 50) + + response = input("\nReset ALL OCR data and reprocess? (y/N): ") + if response.lower() == "y": + print("\nResetting all OCR data...") + count = db.reset_all_ocr() + print(f"Reset complete. {count} screenshots will be reprocessed on next sync.") + else: + print("\nSkipped reset. You can manually fix issues or run this script again.") + else: + print("\nNo inconsistencies found!") + response = input("\nDo you still want to reset ALL OCR data? (y/N): ") + if response.lower() == "y": + print("\nResetting all OCR data...") + count = db.reset_all_ocr() + print(f"Reset complete. {count} screenshots will be reprocessed on next sync.") + + finally: + db.disconnect() + + print("\nDone! You can now restart the app.") + + +if __name__ == "__main__": + main() diff --git a/tray/app.py b/tray/app.py index 483b0fe..22902ac 100644 --- a/tray/app.py +++ b/tray/app.py @@ -113,13 +113,35 @@ def _check_and_open_setup(self): # Wait a moment for backend to be ready time.sleep(1) - # Check setup status via API - status = api_client.get_json("/setup/status") + # Check enhanced setup status via API (includes model and migration status) + status = api_client.get_json("/setup/enhanced-status") - if status and status.get("needs_setup", False): + if not status: + return + + should_open_setup = False + reason = "" + + # Check for version change + if status.get("needs_setup", False): last_version = status.get("last_seen_version", "none") current_version = status.get("current_version", "unknown") - print(f"Version change detected: {last_version} -> {current_version}") + reason = f"Version change detected: {last_version} -> {current_version}" + should_open_setup = True + + # Check if CLIP model needs downloading (required for search) + elif status.get("clip_status") == "not_downloaded": + reason = "CLIP model needs downloading" + should_open_setup = True + + # Check if OCR migration is needed + elif status.get("migration_status") and status["migration_status"].get("needs_migration", False): + pending = status["migration_status"].get("screenshots_without_ocr", 0) + reason = f"OCR migration needed for {pending} screenshots" + should_open_setup = True + + if should_open_setup: + print(f"{reason}") print("Opening setup page...") webbrowser.open(f"{WEB_UI_URL}/setup") except Exception as e: diff --git a/uv.lock b/uv.lock index b3fba8f..e582814 100644 --- a/uv.lock +++ b/uv.lock @@ -589,11 +589,13 @@ dependencies = [ { name = "httpx" }, { name = "mss" }, { name = "numpy" }, + { name = "ocrmac", marker = "sys_platform == 'darwin'" }, { name = "opencv-python" }, { name = "opencv-python-headless" }, { name = "pillow" }, { name = "pydantic" }, { name = "pystray" }, + { name = "pytesseract" }, { name = "requests" }, { name = "scikit-image" }, { name = "sentence-transformers" }, @@ -633,12 +635,14 @@ requires-dist = [ { name = "httpx", marker = "extra == 'dev'", specifier = ">=0.27.0" }, { name = "mss", specifier = ">=9.0.0" }, { name = "numpy", specifier = "==1.26.0" }, + { name = "ocrmac", marker = "sys_platform == 'darwin'", specifier = ">=1.0.0" }, { name = "opencv-python", specifier = "==4.9.0.80" }, { name = "opencv-python-headless", specifier = "==4.9.0.80" }, { name = "pillow", specifier = "==10.3.0" }, { name = "pydantic", specifier = ">=2.0.0" }, { name = "pyinstaller", marker = "extra == 'build'", specifier = ">=6.0.0" }, { name = "pystray", specifier = ">=0.19.0" }, + { name = "pytesseract", specifier = ">=0.3.10" }, { name = "pytest", marker = "extra == 'dev'", specifier = ">=8.0.0" }, { name = "pytest-cov", marker = "extra == 'dev'", specifier = ">=4.0.0" }, { name = "requests", specifier = ">=2.32.4" }, @@ -1023,6 +1027,20 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/da/d3/8057f0587683ed2fcd4dbfbdfdfa807b9160b809976099d36b8f60d08f03/nvidia_nvtx_cu12-12.1.105-py3-none-manylinux1_x86_64.whl", hash = "sha256:dc21cf308ca5691e7c04d962e213f8a4aa9bbfa23d95412f452254c2caeb09e5", size = 99138, upload-time = "2023-04-19T15:48:43.556Z" }, ] +[[package]] +name = "ocrmac" +version = "1.0.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "click", marker = "sys_platform == 'darwin'" }, + { name = "pillow", marker = "sys_platform == 'darwin'" }, + { name = "pyobjc-framework-vision", marker = "sys_platform == 'darwin'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/5e/07/3e15ab404f75875c5e48c47163300eb90b7409044d8711fc3aaf52503f2e/ocrmac-1.0.1.tar.gz", hash = "sha256:507fe5e4cbd67b2d03f6729a52bbc11f9d0b58241134eb958a5daafd4b9d93d9", size = 1454317, upload-time = "2026-01-08T16:44:26.412Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/37/15/7cc16507a2aca927abe395f1c545f17ae76b1f8ed44f43ebe4e8670ee203/ocrmac-1.0.1-py3-none-any.whl", hash = "sha256:1cef25426f7ae6bbd57fe3dc5553b25461ae8ad0d2b428a9bbadbf5907349024", size = 9955, upload-time = "2026-01-08T16:44:25.555Z" }, +] + [[package]] name = "opencv-python" version = "4.9.0.80" @@ -1382,6 +1400,25 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/58/27/b457b7b37089cad692c8aada90119162dfb4c4a16f513b79a8b2b022b33b/pyobjc_framework_cocoa-12.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:6ba1dc1bfa4da42d04e93d2363491275fb2e2be5c20790e561c8a9e09b8cf2cc", size = 388970, upload-time = "2025-11-14T09:42:53.964Z" }, ] +[[package]] +name = "pyobjc-framework-coreml" +version = "12.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pyobjc-core", marker = "sys_platform == 'darwin'" }, + { name = "pyobjc-framework-cocoa", marker = "sys_platform == 'darwin'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/30/2d/baa9ea02cbb1c200683cb7273b69b4bee5070e86f2060b77e6a27c2a9d7e/pyobjc_framework_coreml-12.1.tar.gz", hash = "sha256:0d1a4216891a18775c9e0170d908714c18e4f53f9dc79fb0f5263b2aa81609ba", size = 40465, upload-time = "2025-11-14T10:14:02.265Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/47/f6/e8afa7143d541f6f0b9ac4b3820098a1b872bceba9210ae1bf4b5b4d445d/pyobjc_framework_coreml-12.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:df4e9b4f97063148cc481f72e2fbe3cc53b9464d722752aa658d7c0aec9f02fd", size = 11334, upload-time = "2025-11-14T09:45:48.42Z" }, + { url = "https://files.pythonhosted.org/packages/34/0f/f55369da4a33cfe1db38a3512aac4487602783d3a1d572d2c8c4ccce6abc/pyobjc_framework_coreml-12.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:16dafcfb123f022e62f47a590a7eccf7d0cb5957a77fd5f062b5ee751cb5a423", size = 11331, upload-time = "2025-11-14T09:45:50.445Z" }, + { url = "https://files.pythonhosted.org/packages/bb/39/4defef0deb25c5d7e3b7826d301e71ac5b54ef901b7dac4db1adc00f172d/pyobjc_framework_coreml-12.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:10dc8e8db53d7631ebc712cad146e3a9a9a443f4e1a037e844149a24c3c42669", size = 11356, upload-time = "2025-11-14T09:45:52.271Z" }, + { url = "https://files.pythonhosted.org/packages/ae/3f/3749964aa3583f8c30d9996f0d15541120b78d307bb3070f5e47154ef38d/pyobjc_framework_coreml-12.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:48fa3bb4a03fa23e0e36c93936dca2969598e4102f4b441e1663f535fc99cd31", size = 11371, upload-time = "2025-11-14T09:45:54.105Z" }, + { url = "https://files.pythonhosted.org/packages/9c/c8/cf20ea91ae33f05f3b92dec648c6f44a65f86d1a64c1d6375c95b85ccb7c/pyobjc_framework_coreml-12.1-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:71de5b37e6a017e3ed16645c5d6533138f24708da5b56c35c818ae49d0253ee1", size = 11600, upload-time = "2025-11-14T09:45:55.976Z" }, + { url = "https://files.pythonhosted.org/packages/bc/5c/510ae8e3663238d32e653ed6a09ac65611dd045a7241f12633c1ab48bb9b/pyobjc_framework_coreml-12.1-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:a04a96e512ecf6999aa9e1f60ad5635cb9d1cd839be470341d8d1541797baef6", size = 11418, upload-time = "2025-11-14T09:45:57.75Z" }, + { url = "https://files.pythonhosted.org/packages/d3/1a/b7367819381b07c440fa5797d2b0487e31f09aa72079a693ceab6875fa0a/pyobjc_framework_coreml-12.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:7762b3dd2de01565b7cf3049ce1e4c27341ba179d97016b0b7607448e1c39865", size = 11593, upload-time = "2025-11-14T09:45:59.623Z" }, +] + [[package]] name = "pyobjc-framework-quartz" version = "12.1" @@ -1401,6 +1438,27 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/4d/a6/708a55f3ff7a18c403b30a29a11dccfed0410485a7548c60a4b6d4cc0676/pyobjc_framework_quartz-12.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:0cc08fddb339b2760df60dea1057453557588908e42bdc62184b6396ce2d6e9a", size = 224580, upload-time = "2025-11-14T10:01:00.091Z" }, ] +[[package]] +name = "pyobjc-framework-vision" +version = "12.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pyobjc-core", marker = "sys_platform == 'darwin'" }, + { name = "pyobjc-framework-cocoa", marker = "sys_platform == 'darwin'" }, + { name = "pyobjc-framework-coreml", marker = "sys_platform == 'darwin'" }, + { name = "pyobjc-framework-quartz", marker = "sys_platform == 'darwin'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c2/5a/08bb3e278f870443d226c141af14205ff41c0274da1e053b72b11dfc9fb2/pyobjc_framework_vision-12.1.tar.gz", hash = "sha256:a30959100e85dcede3a786c544e621ad6eb65ff6abf85721f805822b8c5fe9b0", size = 59538, upload-time = "2025-11-14T10:23:21.979Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e3/48/b23e639a66e5d3d944710bb2eaeb7257c18b0834dffc7ea2ddadadf8620e/pyobjc_framework_vision-12.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a30c3fff926348baecc3ce1f6da8ed327d0cbd55ca1c376d018e31023b79c0ab", size = 21432, upload-time = "2025-11-14T10:06:39.709Z" }, + { url = "https://files.pythonhosted.org/packages/bd/37/e30cf4eef2b4c7e20ccadc1249117c77305fbc38b2e5904eb42e3753f63c/pyobjc_framework_vision-12.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:1edbf2fc18ce3b31108f845901a88f2236783ae6bf0bc68438d7ece572dc2a29", size = 21432, upload-time = "2025-11-14T10:06:42.373Z" }, + { url = "https://files.pythonhosted.org/packages/3a/5a/23502935b3fc877d7573e743fc3e6c28748f33a45c43851d503bde52cde7/pyobjc_framework_vision-12.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:6b3211d84f3a12aad0cde752cfd43a80d0218960ac9e6b46b141c730e7d655bd", size = 16625, upload-time = "2025-11-14T10:06:44.422Z" }, + { url = "https://files.pythonhosted.org/packages/f5/e4/e87361a31b82b22f8c0a59652d6e17625870dd002e8da75cb2343a84f2f9/pyobjc_framework_vision-12.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:7273e2508db4c2e88523b4b7ff38ac54808756e7ba01d78e6c08ea68f32577d2", size = 16640, upload-time = "2025-11-14T10:06:46.653Z" }, + { url = "https://files.pythonhosted.org/packages/b1/dd/def55d8a80b0817f486f2712fc6243482c3264d373dc5ff75037b3aeb7ea/pyobjc_framework_vision-12.1-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:04296f0848cc8cdead66c76df6063720885cbdf24fdfd1900749a6e2297313db", size = 16782, upload-time = "2025-11-14T10:06:48.816Z" }, + { url = "https://files.pythonhosted.org/packages/a7/a4/ee1ef14d6e1df6617e64dbaaa0ecf8ecb9e0af1425613fa633f6a94049c1/pyobjc_framework_vision-12.1-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:631add775ed1dafb221a6116137cdcd78432addc16200ca434571c2a039c0e03", size = 16614, upload-time = "2025-11-14T10:06:50.852Z" }, + { url = "https://files.pythonhosted.org/packages/af/53/187743d9244becd4499a77f8ee699ae286e2f6ade7c0c7ad2975ae60f187/pyobjc_framework_vision-12.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:fe41a1a70cc91068aee7b5293fa09dc66d1c666a8da79fdf948900988b439df6", size = 16771, upload-time = "2025-11-14T10:06:53.04Z" }, +] + [[package]] name = "pystray" version = "0.19.5" @@ -1415,6 +1473,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/5c/64/927a4b9024196a4799eba0180e0ca31568426f258a4a5c90f87a97f51d28/pystray-0.19.5-py2.py3-none-any.whl", hash = "sha256:a0c2229d02cf87207297c22d86ffc57c86c227517b038c0d3c59df79295ac617", size = 49068, upload-time = "2023-09-17T13:44:26.872Z" }, ] +[[package]] +name = "pytesseract" +version = "0.3.13" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "packaging" }, + { name = "pillow" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9f/a6/7d679b83c285974a7cb94d739b461fa7e7a9b17a3abfd7bf6cbc5c2394b0/pytesseract-0.3.13.tar.gz", hash = "sha256:4bf5f880c99406f52a3cfc2633e42d9dc67615e69d8a509d74867d3baddb5db9", size = 17689, upload-time = "2024-08-16T02:33:56.762Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7a/33/8312d7ce74670c9d39a532b2c246a853861120486be9443eebf048043637/pytesseract-0.3.13-py3-none-any.whl", hash = "sha256:7a99c6c2ac598360693d83a416e36e0b33a67638bb9d77fdcac094a3589d4b34", size = 14705, upload-time = "2024-08-16T02:36:10.09Z" }, +] + [[package]] name = "pytest" version = "9.0.1" diff --git a/web/src/app/page.tsx b/web/src/app/page.tsx index e22d687..a9aeba6 100644 --- a/web/src/app/page.tsx +++ b/web/src/app/page.tsx @@ -20,7 +20,7 @@ import { bulkHideScreenshots, bulkUnhideScreenshots, } from '@/lib/api'; -import type { Screenshot, SystemStatus, SyncStatus, DensityBucket, IncognitoStatus, VisibilityFilter } from '@/types'; +import type { Screenshot, SystemStatus, SyncStatus, DensityBucket, IncognitoStatus, VisibilityFilter, SearchMode } from '@/types'; import { useSelection } from '@/hooks/useSelection'; import { SelectionToolbar } from '@/components/SelectionToolbar'; import { ConfirmationDialog } from '@/components/ConfirmationDialog'; @@ -62,6 +62,7 @@ export default function Home() { const [datePreset, setDatePreset] = useState('all'); const [safeMode, setSafeMode] = useState(true); const [safeModeLevel, setSafeModeLevel] = useState('mid'); + const [searchMode, setSearchMode] = useState('auto'); const [hasTriggeredSync, setHasTriggeredSync] = useState(false); // Incognito state @@ -428,7 +429,7 @@ export default function Home() { setIsSearching(true); try { const startTime = performance.now(); - const data = await search(query, 50, safeMode, safeModeLevel, searchStartDate, searchEndDate, visibilityFilter); + const data = await search(query, 50, safeMode, safeModeLevel, searchStartDate, searchEndDate, visibilityFilter, searchMode); setSearchResults(data.results); setSearchTime(performance.now() - startTime); } catch (err) { @@ -440,7 +441,7 @@ export default function Home() { }, 300); return () => clearTimeout(timer); - }, [query, searchStartDate, searchEndDate, safeMode, safeModeLevel, visibilityFilter]); + }, [query, searchStartDate, searchEndDate, safeMode, safeModeLevel, visibilityFilter, searchMode]); useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { @@ -753,7 +754,7 @@ export default function Home() { }); } else if (activeView === 'search') { if (query.trim()) { - const data = await search(query, 50, safeMode, safeModeLevel, searchStartDate, searchEndDate, visibilityFilter); + const data = await search(query, 50, safeMode, safeModeLevel, searchStartDate, searchEndDate, visibilityFilter, searchMode); setSearchResults(data?.results || []); } else { const data = await getScreenshots(100, 0, undefined, undefined, visibilityFilter); @@ -1270,6 +1271,18 @@ export default function Home() { )} + {/* Search mode selector */} + {/* Results info */} diff --git a/web/src/app/setup/page.tsx b/web/src/app/setup/page.tsx index d51dcfc..f2dec16 100644 --- a/web/src/app/setup/page.tsx +++ b/web/src/app/setup/page.tsx @@ -1,68 +1,207 @@ 'use client'; -import { useState, useEffect } from 'react'; +import { useState, useEffect, useCallback } from 'react'; import Link from 'next/link'; +// ============================================================================= +// Types +// ============================================================================= + interface SetupStatus { current_version: string; last_seen_version: string; needs_setup: boolean; + needs_permission: boolean; + platform: string; +} + +interface EnhancedSetupStatus extends SetupStatus { + models_ready: boolean; + clip_status: 'not_downloaded' | 'downloading' | 'ready'; + text_embedding_status: 'not_downloaded' | 'downloading' | 'ready'; + ocr_status: 'ready' | 'not_available'; + migration_status: MigrationStatus | null; +} + +interface MigrationStatus { + needs_migration: boolean; + total_screenshots: number; + screenshots_with_ocr: number; + screenshots_without_ocr: number; + progress_percent: number; + estimated_time_minutes: number | null; +} + +interface SyncProgress { + is_syncing: boolean; + total: number; + processed: number; + current_phase: string; + embeddings_done: number; + ocr_done: number; + text_embeddings_done: number; +} + +interface EventStatus { + clip: { loaded: boolean; downloading: boolean }; + text_embedding: { loaded: boolean; downloading: boolean }; + ocr: { available: boolean }; + sync: SyncProgress; + ocr_stats: { pending: number; completed: number }; } -type SetupStep = 'welcome' | 'resetting' | 'granting' | 'complete'; +type SetupStep = 'loading' | 'models' | 'permission' | 'migration' | 'complete'; + +// ============================================================================= +// Component +// ============================================================================= export default function SetupPage() { - const [status, setStatus] = useState(null); - const [step, setStep] = useState('welcome'); + const [status, setStatus] = useState(null); + const [eventStatus, setEventStatus] = useState(null); + const [step, setStep] = useState('loading'); const [error, setError] = useState(null); - const [autoResetTriggered, setAutoResetTriggered] = useState(false); + const [syncTriggered, setSyncTriggered] = useState(false); + const [downloadTriggered, setDownloadTriggered] = useState(false); - useEffect(() => { - fetchStatus(); + // Fetch enhanced setup status + const fetchStatus = useCallback(async () => { + try { + const response = await fetch('/api/v1/setup/enhanced-status'); + const data: EnhancedSetupStatus = await response.json(); + setStatus(data); + return data; + } catch (err) { + console.error('Failed to fetch setup status:', err); + return null; + } }, []); - // Auto-trigger reset when page loads and setup is needed - useEffect(() => { - if (status?.needs_setup && !autoResetTriggered && step === 'welcome') { - setAutoResetTriggered(true); - handleResetPermissions(); + // Fetch real-time status from events endpoint + const fetchEventStatus = useCallback(async () => { + try { + const response = await fetch('/api/v1/events/status'); + const data: EventStatus = await response.json(); + setEventStatus(data); + return data; + } catch (err) { + console.error('Failed to fetch event status:', err); + return null; } - }, [status, autoResetTriggered, step]); + }, []); - const fetchStatus = async () => { - try { - const response = await fetch('/api/v1/setup/status'); - const data = await response.json(); - setStatus(data); + // Determine which step we should be on + const determineStep = useCallback((status: EnhancedSetupStatus, eventStatus: EventStatus | null): SetupStep => { + // Check if models are downloading or not ready + if (status.clip_status !== 'ready' || + (eventStatus?.clip?.downloading) || + (eventStatus?.text_embedding?.downloading)) { + return 'models'; + } + + // Check if permission is needed (macOS only, on update) + if (status.needs_permission && status.needs_setup && status.platform === 'macos') { + return 'permission'; + } - // If setup not needed, go straight to complete - if (!data.needs_setup) { - setStep('complete'); + // Check if OCR migration is needed + if (status.migration_status?.needs_migration || + (eventStatus?.ocr_stats?.pending && eventStatus.ocr_stats.pending > 0)) { + return 'migration'; + } + + return 'complete'; + }, []); + + // Initial load + useEffect(() => { + const init = async () => { + try { + const setupStatus = await fetchStatus(); + const evtStatus = await fetchEventStatus(); + + if (setupStatus) { + const nextStep = determineStep(setupStatus, evtStatus); + setStep(nextStep); + } else { + // API returned null - show error + setError('Could not connect to backend. Is it running?'); + setStep('models'); // Show something rather than stuck loading + } + } catch (err) { + console.error('Setup init error:', err); + setError('Failed to load setup status. Check if backend is running.'); + setStep('models'); // Show something rather than stuck loading + } + }; + init(); + }, [fetchStatus, fetchEventStatus, determineStep]); + + // Poll for updates during active steps + useEffect(() => { + if (step === 'loading' || step === 'complete') return; + + const interval = setInterval(async () => { + const setupStatus = await fetchStatus(); + const evtStatus = await fetchEventStatus(); + + if (setupStatus) { + const nextStep = determineStep(setupStatus, evtStatus); + + // Auto-advance steps when done + if (step === 'models' && nextStep !== 'models') { + setStep(nextStep); + } else if (step === 'migration' && nextStep === 'complete') { + setStep('complete'); + } + } + }, 2000); + + return () => clearInterval(interval); + }, [step, fetchStatus, fetchEventStatus, determineStep]); + + // Auto-trigger model download when on models step + useEffect(() => { + if (step === 'models' && !downloadTriggered && status) { + // Check if any model needs downloading + const needsClip = status.clip_status !== 'ready'; + const needsBge = status.text_embedding_status !== 'ready'; + + if (needsClip || needsBge) { + setDownloadTriggered(true); + // Trigger download endpoint - this will download models + fetch('/api/v1/setup/download-models', { method: 'POST' }) + .then(async (response) => { + // The endpoint returns an SSE stream, but we don't need to read it + // The polling will pick up the status changes + console.log('Model download triggered'); + }) + .catch(console.error); } - } catch (err) { - console.error('Failed to fetch setup status:', err); } - }; + }, [step, downloadTriggered, status]); + + // Trigger sync when on migration step + useEffect(() => { + if (step === 'migration' && !syncTriggered && !eventStatus?.sync?.is_syncing) { + setSyncTriggered(true); + // Trigger sync to process OCR for existing screenshots + fetch('/api/v1/sync/start', { method: 'POST' }).catch(console.error); + } + }, [step, syncTriggered, eventStatus?.sync?.is_syncing]); const handleResetPermissions = async () => { - setStep('resetting'); setError(null); - try { const response = await fetch('/api/v1/setup/reset-permissions', { method: 'POST', }); const data = await response.json(); - - if (data.success) { - setStep('granting'); - } else { + if (!data.success) { setError(data.message || 'Failed to reset permissions'); - setStep('welcome'); } } catch (err) { setError('Failed to connect to backend'); - setStep('welcome'); } }; @@ -78,6 +217,11 @@ export default function SetupPage() { const isFirstRun = status && !status.last_seen_version; const isUpdate = status && status.last_seen_version && status.last_seen_version !== status.current_version; + // Calculate migration progress + const migrationProgress = eventStatus?.ocr_stats + ? (eventStatus.ocr_stats.completed / (eventStatus.ocr_stats.completed + eventStatus.ocr_stats.pending)) * 100 + : status?.migration_status?.progress_percent ?? 0; + return (
@@ -86,7 +230,7 @@ export default function SetupPage() {

LiveRecall

{isFirstRun - ? "Welcome! Let's set up screen capture." + ? "Welcome! Let's get you set up." : isUpdate ? `Updated to v${status?.current_version}` : 'Setup'} @@ -95,83 +239,227 @@ export default function SetupPage() { {/* Step Content */}

- {step === 'welcome' && ( + + {/* Loading State */} + {step === 'loading' && ( +
+
+

Checking setup status...

+
+ )} + + {/* Models Step - Download Progress */} + {step === 'models' && ( <>

- Screen Capture Permission + Downloading Models

-

- LiveRecall needs screen capture permission to record your screen. - {isUpdate && ' After an update, macOS requires re-granting this permission.'} -

- Click the button below to reset permissions. You'll be prompted for your - admin password, then macOS will ask you to grant screen capture access. + LiveRecall uses AI models for image and text search. + This is a one-time download.

- {error && ( -
- {error} + {/* CLIP Model */} +
+
+ CLIP Vision Model + + {status?.clip_status === 'ready' ? 'Ready' : + eventStatus?.clip?.downloading ? 'Downloading...' : + status?.clip_status === 'downloading' ? 'Downloading...' : 'Pending'} +
- )} +
+
+
+

~1.7 GB - Required for image search

+
- - - )} + {/* Text Embedding Model */} +
+
+ Text Embedding Model + + {status?.text_embedding_status === 'ready' ? 'Ready' : + eventStatus?.text_embedding?.downloading ? 'Downloading...' : + status?.text_embedding_status === 'downloading' ? 'Downloading...' : 'Pending'} + +
+
+
+
+

~130 MB - For text search

+
- {step === 'resetting' && ( -
-
-

Resetting permissions...

-

- Enter your admin password when prompted -

-
+ {/* OCR Status */} +
+
+ OCR Engine + + {status?.ocr_status === 'ready' ? 'Ready' : 'Not Available'} + +
+
+
+
+

+ {status?.platform === 'macos' ? 'Apple Vision (built-in)' : 'Tesseract'} +

+
+ +
+ {(status?.clip_status !== 'ready' || status?.text_embedding_status !== 'ready') && ( + <> +
+

+ Downloading models automatically... +

+ + )} +
+ )} - {step === 'granting' && ( + {/* Permission Step */} + {step === 'permission' && ( <>

- Grant Permission + Screen Capture Permission

+

+ LiveRecall needs screen capture permission to record your screen. + {isUpdate && ' After an update, macOS requires re-granting this permission.'} +

-

Now grant screen capture permission:

    -
  1. A dialog will appear asking for Screen Recording permission
  2. -
  3. - Click "Open System Settings" or go to System Settings → Privacy & - Security → Screen Recording -
  4. +
  5. Click "Reset Permissions" below
  6. +
  7. Enter your admin password when prompted
  8. +
  9. Go to System Settings → Privacy & Security → Screen Recording
  10. Find "LiveRecall" and toggle it ON
  11. -
  12. You may need to restart LiveRecall
+ {error && ( +
+ {error} +
+ )} +
)} + {/* Migration Step - OCR Processing */} + {step === 'migration' && ( + <> +

+ Processing Existing Screenshots +

+

+ LiveRecall is extracting text from your existing screenshots to enable text search. + This runs in the background. +

+ + {/* Progress Bar */} +
+
+ OCR Processing + + {Math.round(migrationProgress || 0)}% + +
+
+
+
+
+ + {/* Stats */} +
+
+
+ {eventStatus?.ocr_stats?.completed ?? status?.migration_status?.screenshots_with_ocr ?? 0} +
+
Processed
+
+
+
+ {eventStatus?.ocr_stats?.pending ?? status?.migration_status?.screenshots_without_ocr ?? 0} +
+
Remaining
+
+
+ + {/* Current Phase */} + {eventStatus?.sync?.is_syncing && ( +
+
+ + {eventStatus.sync.current_phase === 'embedding' && 'Generating image embeddings...'} + {eventStatus.sync.current_phase === 'ocr' && 'Extracting text (OCR)...'} + {eventStatus.sync.current_phase === 'text_embedding' && 'Generating text embeddings...'} + {!eventStatus.sync.current_phase && 'Processing...'} + +
+ )} + + {status?.migration_status?.estimated_time_minutes && migrationProgress < 100 && ( +

+ Estimated time remaining: ~{Math.round(status.migration_status.estimated_time_minutes * (100 - migrationProgress) / 100)} minutes +

+ )} + + +

+ Processing will continue in the background +

+ + )} + + {/* Complete Step */} {step === 'complete' && (
@@ -201,15 +489,12 @@ export default function SetupPage() { )}
- {/* Skip option */} - {(step === 'welcome' || step === 'granting') && ( -
- + {/* Step indicators */} + {step !== 'loading' && step !== 'complete' && ( +
+
+
+
)}
diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts index ebdf429..5a91c0c 100644 --- a/web/src/lib/api.ts +++ b/web/src/lib/api.ts @@ -14,6 +14,7 @@ import type { VisibilityFilter, IncognitoStatus, BulkOperationResponse, + SearchMode, } from '@/types'; const API_BASE = '/api/v1'; @@ -77,7 +78,8 @@ export async function search( safeModeLevel?: string, startDate?: string, endDate?: string, - visibility: VisibilityFilter = 'visible_only' + visibility: VisibilityFilter = 'visible_only', + searchMode: SearchMode = 'auto' ): Promise { return fetchApi('/search', { method: 'POST', @@ -89,6 +91,7 @@ export async function search( start_date: startDate, end_date: endDate, visibility, + search_mode: searchMode, }), }); } @@ -104,6 +107,7 @@ export async function searchWithParams(params: SearchParams): Promise Date: Sun, 11 Jan 2026 21:39:20 +0530 Subject: [PATCH 2/9] fix: Thread safety, OCR viewer, and batch embedding optimizations - Fix database threading bug by adding Lock to cursor context manager - Fix SSE events race condition with subscriber list lock - Optimize OCR processing with batch text embeddings (5-10x faster) - Add GET /screenshots/{id}/ocr endpoint for retrieving OCR text - Add "View Text" button in web UI lightbox to display extracted text - Add tests for OCR endpoint (4 new test cases) - Update documentation with OCR architecture and search modes --- CLAUDE.md | 28 +++++++- README.md | 36 ++++++++-- api/routes/events.py | 32 ++++++--- api/routes/screenshots.py | 47 +++++++++++++ api/schemas.py | 19 ++++++ api/tests/test_api.py | 117 +++++++++++++++++++++++++++++++++ core/database.py | 33 +++++----- core/ocr_providers/__init__.py | 2 +- core/processor.py | 61 ++++++++--------- web/src/app/page.tsx | 117 +++++++++++++++++++++++++++++++++ web/src/lib/api.ts | 11 ++++ 11 files changed, 437 insertions(+), 66 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index d9a113e..3da634f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -35,13 +35,29 @@ uv run python scripts/build_release.py --quick # Skip web rebuild ### Key Components - **core/capture.py** - CaptureService: Screenshot capture using mss, SSIM-based change detection -- **core/database.py** - SQLite + sqlite-vec for vector similarity search +- **core/database.py** - SQLite + sqlite-vec for vector similarity search (thread-safe with Lock) - **core/embeddings.py** - CLIP model with lazy loading and 5-minute auto-unload -- **core/processor.py** - Background sync service for processing screenshots +- **core/text_embeddings.py** - Text embedding model for OCR semantic search +- **core/ocr.py** - OCR service with pluggable providers (Apple Vision / Tesseract) +- **core/chunking.py** - Dual-size text chunking (small 512 + large 2048 tokens) +- **core/processor.py** - Background sync service for processing screenshots (CLIP + OCR + text embeddings) - **tray/app.py** - TrayApp: System tray menu, spawns backend via subprocess - **tray/backend.py** - Manages FastAPI server as subprocess - **api/main.py** - FastAPI app that serves REST API + static Next.js build from web/out/ +### OCR & Text Search Architecture + +The sync pipeline processes screenshots through: +1. CLIP image embedding → `screenshot_embeddings` table (512-dim vectors) +2. OCR text extraction → `screenshot_ocr` table (full text + confidence) +3. Text chunking → `ocr_text_chunks` table (dual sizes for precision vs context) +4. Text embeddings → `ocr_text_embeddings` table (384-dim vectors) + +Search uses hybrid Reciprocal Rank Fusion combining: +- Image semantic search (CLIP) +- Text fuzzy search (FTS5 trigram) +- Text semantic search (small + large chunks) + ### API Routes Structure Routes in `api/routes/` with prefixes: `/recording`, `/sync`, `/search`, `/screenshots`, `/compression`, `/incognito`, `/setup` @@ -79,6 +95,14 @@ async def get_something(): macOS: `~/Library/Application Support/LiveRecall/` (SQLite database + screenshots folder) +### Database Tables +- `screenshots` - Screenshot metadata (id, path, timestamp, has_embedding, has_ocr) +- `screenshot_embeddings` - CLIP image vectors (512-dim, sqlite-vec) +- `screenshot_ocr` - OCR extracted text (full_text, confidence, word_count) +- `ocr_text_chunks` - Dual-size chunks (small 512 tokens, large 2048 tokens) +- `ocr_text_embeddings` - Text embedding vectors (384-dim, sqlite-vec) +- `ocr_text_fts` - FTS5 full-text search index (trigram tokenizer) + ## API Documentation When running: http://localhost:8742/docs (Swagger) or http://localhost:8742/redoc diff --git a/README.md b/README.md index a01a856..46d5936 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ ## Features - **Semantic Search** - Find screenshots by describing what you're looking for +- **OCR Text Extraction** - Automatically extracts text from screenshots for text-based search +- **Hybrid Search** - Combines image similarity and text matching for best results - **Smart Capture** - Only saves when screen content changes - **System Tray App** - Runs quietly in your menu bar - **Web Interface** - Beautiful timeline and search UI @@ -20,7 +22,9 @@ 3. Launch LiveRecall from Applications 4. Grant **Screen Recording** permission when prompted (System Settings > Privacy & Security > Screen Recording) -**Note:** On first launch, the CLIP model (~400MB) will be downloaded automatically. +**Note:** On first launch, required AI models will be downloaded automatically: +- Image embedding model (~400MB) for visual search +- Text embedding model (~130MB) for OCR text search ### Windows / Intel Mac @@ -121,8 +125,27 @@ LiveRecall/ 1. **Capture**: Screenshots are taken at regular intervals when screen content changes 2. **Storage**: Images saved to `~/Library/Application Support/LiveRecall/` (macOS) -3. **Sync**: CLIP model generates embeddings for semantic search (runs on-demand) -4. **Search**: Natural language queries matched against embeddings +3. **Sync**: Processing pipeline generates embeddings and extracts text (runs on-demand) +4. **Search**: Natural language queries matched against image and text content + +### Search Modes + +LiveRecall supports multiple search modes: + +- **Auto (Hybrid)** - Default. Combines all search methods using Reciprocal Rank Fusion for best results +- **Image** - Finds screenshots where the visual content matches your query (e.g., "cat on a keyboard") +- **Text Fuzzy** - Fast text matching with typo tolerance using trigram search +- **Text Semantic** - Finds screenshots containing text with similar meaning to your query + +### OCR Processing + +When sync runs, each screenshot goes through: +1. **Image embedding** - Visual features extracted for semantic image search +2. **OCR extraction** - Text extracted using platform-native OCR (Vision on macOS, Tesseract on Windows) +3. **Text chunking** - Extracted text split into searchable chunks +4. **Text embedding** - Semantic embeddings generated for text search + +You can view extracted text for any screenshot using the "View Text" button in the web UI. ## API Endpoints @@ -131,9 +154,10 @@ LiveRecall/ | `/api/v1/status` | GET | System status | | `/api/v1/recording/start` | POST | Start capture | | `/api/v1/recording/stop` | POST | Stop capture | -| `/api/v1/sync/start` | POST | Start embedding sync | -| `/api/v1/search` | POST | Semantic search | +| `/api/v1/sync/start` | POST | Start embedding/OCR sync | +| `/api/v1/search` | POST | Hybrid search (supports search_mode parameter) | | `/api/v1/screenshots` | GET | List screenshots | +| `/api/v1/screenshots/{id}/ocr` | GET | Get OCR text for a screenshot | Full API docs at http://localhost:8742/docs @@ -146,6 +170,8 @@ Settings available in the web UI or via API: - **Quality**: 50-100% - **Safe Mode**: Filter sensitive content from search - **Auto-compress**: Compress old screenshots +- **OCR Enabled**: Enable/disable text extraction (enabled by default) +- **Search Mode**: auto (hybrid), image, text_fuzzy, text_semantic ## Privacy & Security diff --git a/api/routes/events.py b/api/routes/events.py index ac894bd..d4159ea 100644 --- a/api/routes/events.py +++ b/api/routes/events.py @@ -9,7 +9,9 @@ """ import asyncio +import contextlib import json +import threading from collections.abc import AsyncGenerator from contextlib import asynccontextmanager @@ -21,28 +23,40 @@ router = APIRouter(prefix="/events", tags=["Events"]) # Global event queue for broadcasting events to all connected clients +# Protected by _subscribers_lock for thread-safe access _event_subscribers: list[asyncio.Queue] = [] +_subscribers_lock = threading.Lock() def broadcast_event(event_type: str, data: dict): - """Broadcast an event to all connected SSE clients""" + """Broadcast an event to all connected SSE clients. + + Thread-safe: Makes a copy of the subscriber list before iterating + to prevent race conditions with subscribe/unsubscribe operations. + """ event_data = {"type": event_type, **data} - for queue in _event_subscribers: - try: + # Copy list under lock to prevent modification during iteration + with _subscribers_lock: + subscribers = list(_event_subscribers) + for queue in subscribers: + with contextlib.suppress(asyncio.QueueFull): queue.put_nowait(event_data) - except asyncio.QueueFull: - pass # Skip if queue is full @asynccontextmanager async def subscribe_to_events(): - """Context manager for subscribing to events""" + """Context manager for subscribing to events. + + Thread-safe: Uses lock when modifying the subscriber list. + """ queue: asyncio.Queue = asyncio.Queue(maxsize=100) - _event_subscribers.append(queue) + with _subscribers_lock: + _event_subscribers.append(queue) try: yield queue finally: - _event_subscribers.remove(queue) + with _subscribers_lock: + _event_subscribers.remove(queue) async def event_generator() -> AsyncGenerator[str, None]: @@ -178,7 +192,7 @@ async def get_all_status(): pass # OCR status - ocr_status = {"available": False, "provider": None} + ocr_status: dict[str, bool | str | None] = {"available": False, "provider": None} try: from core.ocr import ocr_service diff --git a/api/routes/screenshots.py b/api/routes/screenshots.py index 89d07ce..02d2f31 100644 --- a/api/routes/screenshots.py +++ b/api/routes/screenshots.py @@ -18,6 +18,7 @@ Screenshot, ScreenshotDeleteResponse, ScreenshotList, + ScreenshotOCRResponse, SuccessResponse, VisibilityFilter, ) @@ -322,6 +323,52 @@ async def get_screenshot_offset( return {"offset": offset} +@router.get("/{screenshot_id}/ocr", response_model=ScreenshotOCRResponse) +async def get_screenshot_ocr(screenshot_id: int): + """ + Get the OCR-extracted text for a screenshot. + + Returns the text that was extracted from this screenshot using OCR, + along with confidence scores and word count. + + - has_ocr: Whether OCR has been processed for this screenshot + - text: The extracted text (empty string if no text found) + - confidence: OCR confidence score (0-1) + - word_count: Number of words in extracted text + """ + # First check if screenshot exists + screenshot = db.get_screenshot(screenshot_id) + if not screenshot: + raise HTTPException(status_code=404, detail="Screenshot not found") + + # Check if OCR has been processed + if not screenshot.get("has_ocr"): + return ScreenshotOCRResponse( + has_ocr=False, + text="", + confidence=None, + word_count=0, + ) + + # Get OCR data + ocr_data = db.get_ocr_text(screenshot_id) + if not ocr_data: + # OCR was marked complete but no data (shouldn't happen, but handle gracefully) + return ScreenshotOCRResponse( + has_ocr=True, + text="", + confidence=None, + word_count=0, + ) + + return ScreenshotOCRResponse( + has_ocr=True, + text=ocr_data.get("full_text", ""), + confidence=ocr_data.get("confidence"), + word_count=ocr_data.get("word_count", 0), + ) + + @router.delete("/{screenshot_id}", response_model=SuccessResponse) async def delete_screenshot(screenshot_id: int, delete_file: bool = True): """ diff --git a/api/schemas.py b/api/schemas.py index e028c8c..9199d50 100644 --- a/api/schemas.py +++ b/api/schemas.py @@ -295,6 +295,25 @@ class ScreenshotDeleteResponse(BaseModel): message: str +class ScreenshotOCRResponse(BaseModel): + """Response containing OCR text for a screenshot""" + + has_ocr: bool = Field(description="Whether OCR has been processed for this screenshot") + text: str = Field(default="", description="Extracted text from the screenshot") + confidence: float | None = Field(default=None, description="OCR confidence score (0-1)") + word_count: int = Field(default=0, description="Number of words extracted") + + class Config: + json_schema_extra = { + "example": { + "has_ocr": True, + "text": "Hello World\nThis is extracted text from the screenshot.", + "confidence": 0.95, + "word_count": 8, + } + } + + # ============================================================================= # Bulk Operations # ============================================================================= diff --git a/api/tests/test_api.py b/api/tests/test_api.py index 6ef1241..978cc46 100644 --- a/api/tests/test_api.py +++ b/api/tests/test_api.py @@ -751,3 +751,120 @@ def test_search_auto_mode(self, mock_get_embedding, mock_db, mock_text_emb_servi assert response.status_code == 200 data = response.json() assert "results" in data + + +class TestScreenshotOCREndpoint: + """Test screenshot OCR endpoint""" + + @patch("api.routes.screenshots.db") + def test_get_ocr_text_success(self, mock_db): + """Should return OCR text for a screenshot with OCR data""" + from fastapi import FastAPI + from fastapi.testclient import TestClient + + from api.routes.screenshots import router + + mock_db.get_screenshot.return_value = { + "id": 1, + "image_path": "/path/to/img.jpg", + "timestamp": "251206120000", + "has_embedding": 1, + "has_ocr": 1, + "is_hidden": 0, + } + mock_db.get_ocr_text.return_value = { + "full_text": "Hello world this is sample OCR text", + "confidence": 0.95, + "word_count": 7, + } + + app = FastAPI() + app.include_router(router) + client = TestClient(app) + + response = client.get("/screenshots/1/ocr") + assert response.status_code == 200 + data = response.json() + assert data["has_ocr"] is True + assert data["text"] == "Hello world this is sample OCR text" + assert data["confidence"] == 0.95 + assert data["word_count"] == 7 + + @patch("api.routes.screenshots.db") + def test_get_ocr_text_not_processed(self, mock_db): + """Should return has_ocr=False when OCR hasn't been processed""" + from fastapi import FastAPI + from fastapi.testclient import TestClient + + from api.routes.screenshots import router + + mock_db.get_screenshot.return_value = { + "id": 1, + "image_path": "/path/to/img.jpg", + "timestamp": "251206120000", + "has_embedding": 1, + "has_ocr": 0, + "is_hidden": 0, + } + + app = FastAPI() + app.include_router(router) + client = TestClient(app) + + response = client.get("/screenshots/1/ocr") + assert response.status_code == 200 + data = response.json() + assert data["has_ocr"] is False + assert data["text"] == "" + assert data["word_count"] == 0 + + @patch("api.routes.screenshots.db") + def test_get_ocr_text_screenshot_not_found(self, mock_db): + """Should return 404 for non-existent screenshot""" + from fastapi import FastAPI + from fastapi.testclient import TestClient + + from api.routes.screenshots import router + + mock_db.get_screenshot.return_value = None + + app = FastAPI() + app.include_router(router) + client = TestClient(app) + + response = client.get("/screenshots/999/ocr") + assert response.status_code == 404 + assert "not found" in response.json()["detail"].lower() + + @patch("api.routes.screenshots.db") + def test_get_ocr_text_empty_text(self, mock_db): + """Should handle screenshots with OCR done but no text extracted""" + from fastapi import FastAPI + from fastapi.testclient import TestClient + + from api.routes.screenshots import router + + mock_db.get_screenshot.return_value = { + "id": 1, + "image_path": "/path/to/img.jpg", + "timestamp": "251206120000", + "has_embedding": 1, + "has_ocr": 1, + "is_hidden": 0, + } + mock_db.get_ocr_text.return_value = { + "full_text": "", + "confidence": None, + "word_count": 0, + } + + app = FastAPI() + app.include_router(router) + client = TestClient(app) + + response = client.get("/screenshots/1/ocr") + assert response.status_code == 200 + data = response.json() + assert data["has_ocr"] is True + assert data["text"] == "" + assert data["word_count"] == 0 diff --git a/core/database.py b/core/database.py index 38436fd..5ff02d4 100644 --- a/core/database.py +++ b/core/database.py @@ -5,6 +5,7 @@ import sqlite3 import struct +import threading import time from contextlib import contextmanager from pathlib import Path @@ -36,6 +37,7 @@ class Database: def __init__(self, db_path: Path | None = None): self.db_path = db_path or get_database_path() self.conn: sqlite3.Connection | None = None + self._lock = threading.Lock() # Thread safety for concurrent access def connect(self): """Connect to database and initialize sqlite-vec""" @@ -58,18 +60,19 @@ def disconnect(self): @contextmanager def cursor(self): - """Context manager for cursor""" - if self.conn is None: - raise RuntimeError("Database not connected") - cur = self.conn.cursor() - try: - yield cur - self.conn.commit() - except Exception: - self.conn.rollback() - raise - finally: - cur.close() + """Context manager for cursor with thread-safe locking""" + with self._lock: # Ensure only one thread accesses DB at a time + if self.conn is None: + raise RuntimeError("Database not connected") + cur = self.conn.cursor() + try: + yield cur + self.conn.commit() + except Exception: + self.conn.rollback() + raise + finally: + cur.close() def _initialize_tables(self): """Create tables if they don't exist""" @@ -1071,7 +1074,7 @@ def search_hybrid( use_text_semantic = mode in ("auto", "text_semantic") and text_embedding is not None # 1. CLIP Image Search - if use_image: + if use_image and image_embedding is not None: try: image_results = self.search_similar( query_embedding=image_embedding, @@ -1095,7 +1098,7 @@ def search_hybrid( print(f"FTS search error: {e}") # 3. BGE Text Semantic Search (small chunks) - if use_text_semantic: + if use_text_semantic and text_embedding is not None: try: small_results = self.search_text_embeddings( query_embedding=text_embedding, @@ -1110,7 +1113,7 @@ def search_hybrid( print(f"Text semantic (small) search error: {e}") # 4. BGE Text Semantic Search (large chunks) - if use_text_semantic: + if use_text_semantic and text_embedding is not None: try: large_results = self.search_text_embeddings( query_embedding=text_embedding, diff --git a/core/ocr_providers/__init__.py b/core/ocr_providers/__init__.py index 05c4fe4..5b491de 100644 --- a/core/ocr_providers/__init__.py +++ b/core/ocr_providers/__init__.py @@ -17,4 +17,4 @@ from __future__ import annotations # Providers are imported conditionally in core/ocr.py based on availability -__all__ = [] +__all__: list[str] = [] diff --git a/core/processor.py b/core/processor.py index d88ab43..347fdcc 100644 --- a/core/processor.py +++ b/core/processor.py @@ -11,6 +11,7 @@ To change models, update config and call processor_service.recompute_ocr(). """ +import contextlib import threading from collections.abc import Callable from dataclasses import dataclass @@ -274,10 +275,8 @@ def _process_loop(self, batch_size: int): self._progress.error_type = "ocr_failed" # Still count as processed since embedding worked self._progress.processed += 1 - try: + with contextlib.suppress(Exception): db.mark_ocr_complete(screenshot["id"]) - except Exception: - pass except (TypeError, AttributeError, KeyError) as e: # Likely a code bug - log clearly but continue with other screenshots error_msg = f"{type(e).__name__}: {e}" @@ -320,7 +319,7 @@ def _process_ocr_for_screenshot(self, screenshot_id: int, image_path: str): 1. Extract text via OCR provider 2. Store OCR result 3. Chunk text (small + large) - 4. Generate BGE embeddings for chunks + 4. Generate BGE embeddings for chunks (batched for speed) 5. Store chunks and embeddings Raises: @@ -369,35 +368,31 @@ def _process_ocr_for_screenshot(self, screenshot_id: int, image_path: str): large_overlap=config.chunking.large_overlap, ) - # Process small chunks + # Collect all chunks for batch processing + all_chunks = [] for chunk in chunked.small: - chunk_id = db.add_ocr_chunk( - ocr_id=ocr_id, - chunk_size="small", - chunk_index=chunk.index, - chunk_text=chunk.text, - start_char=chunk.start_char, - end_char=chunk.end_char, - ) - # Generate and store embedding - embedding = text_emb_service.get_text_embedding(chunk.text) - db.add_text_embedding(chunk_id, embedding) - - # Process large chunks + all_chunks.append(("small", chunk)) for chunk in chunked.large: - chunk_id = db.add_ocr_chunk( - ocr_id=ocr_id, - chunk_size="large", - chunk_index=chunk.index, - chunk_text=chunk.text, - start_char=chunk.start_char, - end_char=chunk.end_char, - ) - # Generate and store embedding - embedding = text_emb_service.get_text_embedding(chunk.text) - db.add_text_embedding(chunk_id, embedding) - - self._progress.text_embeddings_done += len(chunked.small) + len(chunked.large) + all_chunks.append(("large", chunk)) + + if all_chunks: + # Batch generate embeddings (much faster than individual calls) + all_texts = [chunk.text for _, chunk in all_chunks] + all_embeddings = text_emb_service.get_batch_embeddings(all_texts) + + # Store chunks and embeddings + for (chunk_size, chunk), embedding in zip(all_chunks, all_embeddings, strict=False): + chunk_id = db.add_ocr_chunk( + ocr_id=ocr_id, + chunk_size=chunk_size, + chunk_index=chunk.index, + chunk_text=chunk.text, + start_char=chunk.start_char, + end_char=chunk.end_char, + ) + db.add_text_embedding(chunk_id, embedding) + + self._progress.text_embeddings_done += len(all_chunks) # Mark OCR complete for this screenshot db.mark_ocr_complete(screenshot_id) @@ -424,10 +419,8 @@ def _process_pending_ocr(self, batch_size: int): self._progress.last_error = str(e) self._progress.error_type = "ocr_failed" # Mark as complete so we don't retry - try: + with contextlib.suppress(Exception): db.mark_ocr_complete(screenshot["id"]) - except Exception: - pass except (TypeError, AttributeError, KeyError) as e: # Likely a code bug - log clearly but continue with other screenshots error_msg = f"{type(e).__name__}: {e}" diff --git a/web/src/app/page.tsx b/web/src/app/page.tsx index a9aeba6..ee6949f 100644 --- a/web/src/app/page.tsx +++ b/web/src/app/page.tsx @@ -19,6 +19,8 @@ import { bulkDeleteScreenshots, bulkHideScreenshots, bulkUnhideScreenshots, + getScreenshotOCR, + type ScreenshotOCR, } from '@/lib/api'; import type { Screenshot, SystemStatus, SyncStatus, DensityBucket, IncognitoStatus, VisibilityFilter, SearchMode } from '@/types'; import { useSelection } from '@/hooks/useSelection'; @@ -59,6 +61,9 @@ export default function Home() { const [searchStartDate, setSearchStartDate] = useState(); const [searchEndDate, setSearchEndDate] = useState(); const [selectedImage, setSelectedImage] = useState(null); + const [showOCRModal, setShowOCRModal] = useState(false); + const [ocrData, setOcrData] = useState(null); + const [isLoadingOCR, setIsLoadingOCR] = useState(false); const [datePreset, setDatePreset] = useState('all'); const [safeMode, setSafeMode] = useState(true); const [safeModeLevel, setSafeModeLevel] = useState('mid'); @@ -921,6 +926,29 @@ export default function Home() { } }, [visibilityFilter, loadWindowAtOffset]); + // View OCR text for a screenshot + const viewOCRText = useCallback(async (screenshot: Screenshot) => { + setIsLoadingOCR(true); + setOcrData(null); + setShowOCRModal(true); + try { + const data = await getScreenshotOCR(screenshot.id); + setOcrData(data); + } catch (err) { + console.error('Failed to fetch OCR text:', err); + setOcrData({ has_ocr: false, text: '', confidence: null, word_count: 0 }); + } finally { + setIsLoadingOCR(false); + } + }, []); + + // Copy OCR text to clipboard + const copyOCRText = useCallback(() => { + if (ocrData?.text) { + navigator.clipboard.writeText(ocrData.text); + } + }, [ocrData]); + // Calculate local index within the loaded window const localIndex = currentIndex - windowOffset; const currentSnapshot = (snapshots.length > 0 && localIndex >= 0 && localIndex < snapshots.length) @@ -1508,6 +1536,95 @@ export default function Home() { View in Grid + +
+
+ )} + + {/* OCR Text Modal */} + {showOCRModal && ( +
setShowOCRModal(false)} + > +
e.stopPropagation()} + > + {/* Header */} +
+

Extracted Text

+ +
+ + {/* Content */} +
+ {isLoadingOCR ? ( +
+
+ Loading... +
+ ) : ocrData?.has_ocr === false ? ( +
+ + + +

OCR not yet processed for this screenshot

+
+ ) : ocrData?.text ? ( +
+                  {ocrData.text}
+                
+ ) : ( +
+ + + +

No text found in this screenshot

+
+ )} +
+ + {/* Footer */} + {ocrData?.has_ocr && ( +
+
+ {ocrData.word_count} words + {ocrData.confidence !== null && ( + {(ocrData.confidence * 100).toFixed(0)}% confidence + )} +
+ {ocrData.text && ( + + )} +
+ )}
)} diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts index 5a91c0c..1fcb400 100644 --- a/web/src/lib/api.ts +++ b/web/src/lib/api.ts @@ -190,6 +190,17 @@ export async function getScreenshotOffset( return fetchApi(`/screenshots/${screenshotId}/offset?${params}`); } +export interface ScreenshotOCR { + has_ocr: boolean; + text: string; + confidence: number | null; + word_count: number; +} + +export async function getScreenshotOCR(screenshotId: number): Promise { + return fetchApi(`/screenshots/${screenshotId}/ocr`); +} + // Timeline export async function getDateRange(visibility: VisibilityFilter = 'visible_only'): Promise { return fetchApi(`/screenshots/date-range?visibility=${visibility}`); From 80c4c72b0a4a5c891d6d2a35a71d70392bb2e7fe Mon Sep 17 00:00:00 2001 From: Vedank Purohit Date: Sun, 11 Jan 2026 22:25:59 +0530 Subject: [PATCH 3/9] fix: Setup page model status detection and add OCR benchmark - Add `downloaded` field to events/status endpoint for reliable model status when models are downloaded but not loaded (lazy loading) - Add logging to exception handlers in setup routes for debugging - Update frontend to use `downloaded` field as fallback for status - Fix OCR status showing "Not Available" when available - Add benchmark script for OCR and embedding performance testing --- api/routes/events.py | 36 ++-- api/routes/setup.py | 12 +- scripts/benchmark_ocr.py | 425 +++++++++++++++++++++++++++++++++++++ web/src/app/setup/page.tsx | 25 ++- 4 files changed, 470 insertions(+), 28 deletions(-) create mode 100644 scripts/benchmark_ocr.py diff --git a/api/routes/events.py b/api/routes/events.py index d4159ea..f9c70a6 100644 --- a/api/routes/events.py +++ b/api/routes/events.py @@ -164,7 +164,12 @@ async def get_all_status(): This is a polling alternative to SSE for clients that don't support it. """ # CLIP model status - clip_status = {"loaded": False, "device": None, "downloading": False} + clip_status: dict[str, bool | str | None] = { + "loaded": False, + "device": None, + "downloading": False, + "downloaded": False, + } try: from core.embeddings import get_model_status as get_clip_status @@ -173,12 +178,18 @@ async def get_all_status(): "loaded": status["loaded"], "device": status["device"], "downloading": False, + "downloaded": status.get("downloaded", False), } - except Exception: - pass + except Exception as e: + print(f"Error getting CLIP status: {e}") # Text embedding model status - text_status = {"loaded": False, "device": None, "downloading": False} + text_status: dict[str, bool | str | None] = { + "loaded": False, + "device": None, + "downloading": False, + "downloaded": False, + } try: from core.text_embeddings import get_model_status as get_bge_status @@ -187,9 +198,10 @@ async def get_all_status(): "loaded": status["loaded"], "device": status["device"], "downloading": False, + "downloaded": status.get("downloaded", False), } - except Exception: - pass + except Exception as e: + print(f"Error getting text embedding status: {e}") # OCR status ocr_status: dict[str, bool | str | None] = {"available": False, "provider": None} @@ -200,8 +212,8 @@ async def get_all_status(): "available": ocr_service.is_available(), "provider": ocr_service.get_provider_name() if ocr_service.is_available() else None, } - except Exception: - pass + except Exception as e: + print(f"Error getting OCR status: {e}") # Sync status sync_status = { @@ -226,8 +238,8 @@ async def get_all_status(): "ocr_done": progress.ocr_done, "text_embeddings_done": progress.text_embeddings_done, } - except Exception: - pass + except Exception as e: + print(f"Error getting sync status: {e}") # OCR stats ocr_stats = {"pending": 0, "completed": 0} @@ -237,8 +249,8 @@ async def get_all_status(): "pending": stats["without_ocr"], "completed": stats["with_ocr"], } - except Exception: - pass + except Exception as e: + print(f"Error getting OCR stats: {e}") return { "clip": clip_status, diff --git a/api/routes/setup.py b/api/routes/setup.py index 5980769..6651ef6 100644 --- a/api/routes/setup.py +++ b/api/routes/setup.py @@ -156,8 +156,8 @@ async def get_model_status(): # Check downloaded status (model could be downloaded but not loaded) if status.get("loaded") or status.get("downloaded"): clip_status = "ready" - except Exception: - pass + except Exception as e: + print(f"Error checking CLIP model status: {e}") # Text embedding model status text_embedding_status = "not_downloaded" @@ -167,8 +167,8 @@ async def get_model_status(): status = get_bge_status() if status.get("loaded") or status.get("downloaded"): text_embedding_status = "ready" - except Exception: - pass + except Exception as e: + print(f"Error checking text embedding model status: {e}") # OCR status ocr_status = "not_available" @@ -177,8 +177,8 @@ async def get_model_status(): if ocr_service.is_available(): ocr_status = "ready" - except Exception: - pass + except Exception as e: + print(f"Error checking OCR status: {e}") return { "clip": clip_status, diff --git a/scripts/benchmark_ocr.py b/scripts/benchmark_ocr.py new file mode 100644 index 0000000..3c7ff65 --- /dev/null +++ b/scripts/benchmark_ocr.py @@ -0,0 +1,425 @@ +#!/usr/bin/env python3 +""" +Benchmark script for OCR and embedding performance. + +Tests: +1. CLIP image embedding +2. OCR text extraction +3. Text chunking +4. Text embedding generation (single + batch) + +Usage: + uv run python scripts/benchmark_ocr.py + uv run python scripts/benchmark_ocr.py --count 50 + uv run python scripts/benchmark_ocr.py --show-ocr +""" + +import argparse +import contextlib +import random +import statistics +import sys +import time +from pathlib import Path + +# Add project root to path +sys.path.insert(0, str(Path(__file__).parent.parent)) + + +def warmup_models(): + """Pre-load all models so benchmark isn't skewed by loading time""" + print("\n" + "=" * 60) + print("WARMING UP MODELS (loading into memory)") + print("=" * 60) + + # CLIP model + print(" Loading CLIP model...", end=" ", flush=True) + start = time.perf_counter() + # Create a tiny test image to trigger model load + import tempfile + + from PIL import Image + + from core.embeddings import get_image_embedding + + with tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) as f: + img = Image.new("RGB", (100, 100), color="white") + img.save(f.name) + with contextlib.suppress(Exception): + get_image_embedding(f.name) + Path(f.name).unlink() + print(f"done ({time.perf_counter() - start:.1f}s)") + + # OCR service + print(" Loading OCR service...", end=" ", flush=True) + start = time.perf_counter() + from core.ocr import ocr_service + + if ocr_service.is_available(): + print(f"done - {ocr_service.get_provider_name()} ({time.perf_counter() - start:.1f}s)") + else: + print("not available") + + # Text embedding model + print(" Loading text embedding model...", end=" ", flush=True) + start = time.perf_counter() + from core.text_embeddings import text_embedding_service + + text_embedding_service.get_text_embedding("warmup test") + print(f"done ({time.perf_counter() - start:.1f}s)") + + print(" All models loaded!\n") + + +def get_random_images(directory: str, count: int) -> list[Path]: + """Get random sample of images from directory""" + dir_path = Path(directory) + if not dir_path.exists(): + print(f"Error: Directory not found: {directory}") + sys.exit(1) + + images = list(dir_path.glob("*.jpg")) + list(dir_path.glob("*.jpeg")) + list(dir_path.glob("*.png")) + if not images: + print(f"Error: No images found in {directory}") + sys.exit(1) + + count = min(count, len(images)) + return random.sample(images, count) + + +def benchmark_clip(images: list[Path]) -> dict: + """Benchmark CLIP image embedding""" + from core.embeddings import get_image_embedding + + print("\n" + "=" * 60) + print("CLIP IMAGE EMBEDDING BENCHMARK") + print("=" * 60) + + times = [] + for i, img in enumerate(images): + start = time.perf_counter() + embedding = get_image_embedding(str(img)) + elapsed = time.perf_counter() - start + times.append(elapsed) + + if i < 3: # Show first few + print(f" [{i+1}] {img.name}: {elapsed*1000:.1f}ms (dim={len(embedding)})") + elif i == 3: + print(f" ... processing {len(images) - 3} more ...") + + return { + "name": "CLIP Embedding", + "count": len(times), + "total": sum(times), + "mean": statistics.mean(times), + "median": statistics.median(times), + "stdev": statistics.stdev(times) if len(times) > 1 else 0, + "min": min(times), + "max": max(times), + } + + +def benchmark_ocr(images: list[Path], show_output: bool = False) -> dict: + """Benchmark OCR text extraction""" + from core.ocr import ocr_service + + print("\n" + "=" * 60) + print("OCR TEXT EXTRACTION BENCHMARK") + print("=" * 60) + + if not ocr_service.is_available(): + print(" ERROR: OCR service not available") + return {"name": "OCR", "error": "not available"} + + print(f" Provider: {ocr_service.get_provider_name()}") + + times = [] + results = [] + for i, img in enumerate(images): + start = time.perf_counter() + result = ocr_service.extract_text(str(img)) + elapsed = time.perf_counter() - start + times.append(elapsed) + results.append(result) + + word_count = result.word_count + text_preview = ( + result.text[:50].replace("\n", " ") + "..." if len(result.text) > 50 else result.text.replace("\n", " ") + ) + + if i < 5 or show_output: # Show first few or all if requested + print(f" [{i+1}] {img.name}: {elapsed*1000:.1f}ms") + conf_str = f"{result.confidence:.2f}" if result.confidence is not None else "N/A" + print(f" Words: {word_count}, Confidence: {conf_str}") + if show_output: + print(f" Text: {text_preview}") + print() + elif i == 5: + print(f" ... processing {len(images) - 5} more ...") + + # Show OCR result structure + if results: + print("\n OCR Result Structure:") + print(" - text: str (full extracted text)") + print(" - confidence: float | None (0-1)") + print(" - word_count: int") + print(" - language: str (default 'en')") + + # Show a full example + if show_output and results[0].text: + print("\n Full OCR Output Example (first image with text):") + for r in results: + if r.text.strip(): + print("-" * 40) + print(r.text[:500]) + if len(r.text) > 500: + print(f"... ({len(r.text)} chars total)") + print("-" * 40) + break + + return { + "name": "OCR Extraction", + "count": len(times), + "total": sum(times), + "mean": statistics.mean(times), + "median": statistics.median(times), + "stdev": statistics.stdev(times) if len(times) > 1 else 0, + "min": min(times), + "max": max(times), + "avg_words": statistics.mean([r.word_count for r in results]), + "empty_count": sum(1 for r in results if not r.text.strip()), + } + + +def benchmark_chunking(ocr_texts: list[str]) -> dict: + """Benchmark text chunking""" + from core import chunking + + print("\n" + "=" * 60) + print("TEXT CHUNKING BENCHMARK") + print("=" * 60) + + times = [] + chunk_counts = [] + + for i, text in enumerate(ocr_texts): + if not text.strip(): + continue + + start = time.perf_counter() + result = chunking.chunk_ocr_text( + text, + small_size=512, + small_overlap=50, + large_size=2048, + large_overlap=200, + ) + elapsed = time.perf_counter() - start + times.append(elapsed) + + total_chunks = len(result.small) + len(result.large) + chunk_counts.append(total_chunks) + + if i < 3: + print(f" [{i+1}] {len(text)} chars: {elapsed*1000:.2f}ms") + print(f" Small chunks: {len(result.small)}, Large chunks: {len(result.large)}") + + if not times: + print(" No text to chunk (all OCR results were empty)") + return {"name": "Chunking", "error": "no text"} + + print("\n Chunk Structure (ChunkInfo):") + print(" - text: str (chunk content)") + print(" - start_char: int") + print(" - end_char: int") + print(" - index: int") + + return { + "name": "Text Chunking", + "count": len(times), + "total": sum(times), + "mean": statistics.mean(times), + "median": statistics.median(times), + "stdev": statistics.stdev(times) if len(times) > 1 else 0, + "min": min(times), + "max": max(times), + "avg_chunks": statistics.mean(chunk_counts), + } + + +def benchmark_text_embedding(texts: list[str]) -> dict: + """Benchmark text embedding generation""" + from core.text_embeddings import text_embedding_service + + print("\n" + "=" * 60) + print("TEXT EMBEDDING BENCHMARK") + print("=" * 60) + + # Filter to non-empty texts and take a sample + valid_texts = [t[:1000] for t in texts if t.strip()][:50] # Cap at 1000 chars, 50 texts + + if not valid_texts: + print(" No valid texts to embed") + return {"name": "Text Embedding", "error": "no text"} + + print( + f" Model: {text_embedding_service._current_model_name if hasattr(text_embedding_service, '_current_model_name') else 'BGE'}" + ) + + # Single embedding benchmark + print("\n Single embedding (one at a time):") + single_times = [] + for i, text in enumerate(valid_texts[:10]): # Just first 10 for single + start = time.perf_counter() + emb = text_embedding_service.get_text_embedding(text) + elapsed = time.perf_counter() - start + single_times.append(elapsed) + if i < 3: + print(f" [{i+1}] {len(text)} chars: {elapsed*1000:.1f}ms (dim={len(emb)})") + + # Batch embedding benchmark + print("\n Batch embedding (all at once):") + batch_sizes = [10, 25, 50] + batch_results = {} + + for batch_size in batch_sizes: + if batch_size > len(valid_texts): + continue + + batch = valid_texts[:batch_size] + start = time.perf_counter() + _ = text_embedding_service.get_batch_embeddings(batch) + elapsed = time.perf_counter() - start + + per_item = elapsed / batch_size + batch_results[batch_size] = { + "total": elapsed, + "per_item": per_item, + } + print(f" Batch of {batch_size}: {elapsed*1000:.1f}ms total, {per_item*1000:.1f}ms/item") + + return { + "name": "Text Embedding", + "single_mean": statistics.mean(single_times), + "single_count": len(single_times), + "batch_results": batch_results, + } + + +def print_summary(results: list[dict]): + """Print summary of all benchmarks""" + print("\n" + "=" * 60) + print("SUMMARY") + print("=" * 60) + + for r in results: + if "error" in r: + print(f"\n {r['name']}: ERROR - {r['error']}") + continue + + print(f"\n {r['name']}:") + if "mean" in r: + print(f" Mean: {r['mean']*1000:.1f}ms") + print(f" Median: {r['median']*1000:.1f}ms") + print(f" Min: {r['min']*1000:.1f}ms") + print(f" Max: {r['max']*1000:.1f}ms") + if r.get("stdev"): + print(f" StdDev: {r['stdev']*1000:.1f}ms") + if "avg_words" in r: + print(f" Avg words/image: {r['avg_words']:.1f}") + print(f" Empty OCR count: {r['empty_count']}") + if "avg_chunks" in r: + print(f" Avg chunks/text: {r['avg_chunks']:.1f}") + if "batch_results" in r: + print(f" Single embedding: {r['single_mean']*1000:.1f}ms") + for bs, br in r["batch_results"].items(): + print(f" Batch {bs}: {br['per_item']*1000:.1f}ms/item ({br['total']*1000:.0f}ms total)") + + # Estimate total processing time per image + print("\n" + "-" * 60) + print(" ESTIMATED TOTAL PER IMAGE:") + + clip_time = next((r["mean"] for r in results if r["name"] == "CLIP Embedding" and "mean" in r), 0) + ocr_time = next((r["mean"] for r in results if r["name"] == "OCR Extraction" and "mean" in r), 0) + chunk_time = next((r["mean"] for r in results if r["name"] == "Text Chunking" and "mean" in r), 0) + + # Get best batch embedding time + emb_result = next((r for r in results if r["name"] == "Text Embedding"), None) + emb_time = 0 + if emb_result and "batch_results" in emb_result: + # Use largest batch per-item time + largest = max(emb_result["batch_results"].keys()) + emb_time = emb_result["batch_results"][largest]["per_item"] + avg_chunks = next((r["avg_chunks"] for r in results if "avg_chunks" in r), 6) + emb_time = emb_time * avg_chunks # Multiply by avg chunks per image + + total = clip_time + ocr_time + chunk_time + emb_time + print(f" CLIP: {clip_time*1000:.0f}ms") + print(f" OCR: {ocr_time*1000:.0f}ms") + print(f" Chunking: {chunk_time*1000:.0f}ms") + print(f" Embedding: {emb_time*1000:.0f}ms (batch, ~{avg_chunks:.0f} chunks)") + print(" ─────────────────────") + print(f" TOTAL: {total*1000:.0f}ms/image") + print(f"\n For 20,000 images: ~{total*20000/60:.0f} minutes") + + +def main(): + parser = argparse.ArgumentParser(description="Benchmark OCR and embedding performance") + parser.add_argument( + "--dir", + default="/Users/vedank/Library/Application Support/LiveRecall/screenshots", + help="Directory containing screenshots", + ) + parser.add_argument("--count", type=int, default=100, help="Number of images to test") + parser.add_argument("--show-ocr", action="store_true", help="Show full OCR output for each image") + parser.add_argument("--skip-clip", action="store_true", help="Skip CLIP benchmark") + parser.add_argument("--skip-ocr", action="store_true", help="Skip OCR benchmark") + parser.add_argument("--skip-embedding", action="store_true", help="Skip embedding benchmark") + + args = parser.parse_args() + + print(f"Benchmarking with {args.count} random images from:") + print(f" {args.dir}") + + images = get_random_images(args.dir, args.count) + print(f" Found {len(images)} images") + + # Warmup - load all models first + warmup_models() + + results = [] + + # CLIP benchmark + if not args.skip_clip: + results.append(benchmark_clip(images[:20])) # CLIP is slow, just do 20 + + # OCR benchmark + ocr_texts = [] + if not args.skip_ocr: + ocr_result = benchmark_ocr(images, show_output=args.show_ocr) + results.append(ocr_result) + + # Get OCR texts for chunking benchmark + from core.ocr import ocr_service + + for img in images: + try: + r = ocr_service.extract_text(str(img)) + ocr_texts.append(r.text) + except Exception: + ocr_texts.append("") + + # Chunking benchmark + if ocr_texts: + results.append(benchmark_chunking(ocr_texts)) + + # Text embedding benchmark + if not args.skip_embedding and ocr_texts: + results.append(benchmark_text_embedding(ocr_texts)) + + # Summary + print_summary(results) + + +if __name__ == "__main__": + main() diff --git a/web/src/app/setup/page.tsx b/web/src/app/setup/page.tsx index f2dec16..ae8687c 100644 --- a/web/src/app/setup/page.tsx +++ b/web/src/app/setup/page.tsx @@ -43,8 +43,8 @@ interface SyncProgress { } interface EventStatus { - clip: { loaded: boolean; downloading: boolean }; - text_embedding: { loaded: boolean; downloading: boolean }; + clip: { loaded: boolean; downloading: boolean; downloaded: boolean }; + text_embedding: { loaded: boolean; downloading: boolean; downloaded: boolean }; ocr: { available: boolean }; sync: SyncProgress; ocr_stats: { pending: number; completed: number }; @@ -92,8 +92,13 @@ export default function SetupPage() { // Determine which step we should be on const determineStep = useCallback((status: EnhancedSetupStatus, eventStatus: EventStatus | null): SetupStep => { + // Check if models are ready (either from enhanced-status or events-status) + // The eventStatus.downloaded field provides a more reliable check when models are downloaded but not loaded + const clipReady = status.clip_status === 'ready' || eventStatus?.clip?.downloaded; + const textReady = status.text_embedding_status === 'ready' || eventStatus?.text_embedding?.downloaded; + // Check if models are downloading or not ready - if (status.clip_status !== 'ready' || + if (!clipReady || (eventStatus?.clip?.downloading) || (eventStatus?.text_embedding?.downloading)) { return 'models'; @@ -264,7 +269,7 @@ export default function SetupPage() {
CLIP Vision Model - {status?.clip_status === 'ready' ? 'Ready' : + {(status?.clip_status === 'ready' || eventStatus?.clip?.downloaded) ? 'Ready' : eventStatus?.clip?.downloading ? 'Downloading...' : status?.clip_status === 'downloading' ? 'Downloading...' : 'Pending'} @@ -272,7 +277,7 @@ export default function SetupPage() {
Text Embedding Model - {status?.text_embedding_status === 'ready' ? 'Ready' : + {(status?.text_embedding_status === 'ready' || eventStatus?.text_embedding?.downloaded) ? 'Ready' : eventStatus?.text_embedding?.downloading ? 'Downloading...' : status?.text_embedding_status === 'downloading' ? 'Downloading...' : 'Pending'} @@ -294,7 +299,7 @@ export default function SetupPage() {
OCR Engine - {status?.ocr_status === 'ready' ? 'Ready' : 'Not Available'} + {(status?.ocr_status === 'ready' || eventStatus?.ocr?.available) ? 'Ready' : 'Not Available'}
@@ -324,7 +329,7 @@ export default function SetupPage() {
- {(status?.clip_status !== 'ready' || status?.text_embedding_status !== 'ready') && ( + {!(status?.clip_status === 'ready' || eventStatus?.clip?.downloaded) && ( <>

From ca0b495e8546b84ba36d2436f9093839cb1d43e1 Mon Sep 17 00:00:00 2001 From: Vedank Purohit Date: Sun, 11 Jan 2026 22:32:28 +0530 Subject: [PATCH 4/9] fix: CI lint and test failures - Fix web test to expect search_mode parameter in search requests - Fix ruff SIM102: combine nested if statements in ocr.py - Fix ruff E402: add noqa comments for intentional late imports - Fix mypy arg-type: add None checks before embedding function calls --- api/routes/search.py | 4 ++++ core/ocr.py | 10 ++++------ core/text_embeddings.py | 4 ++-- scripts/cleanup_ocr.py | 2 +- web/src/__tests__/api.test.ts | 1 + web/tsconfig.tsbuildinfo | 2 +- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/api/routes/search.py b/api/routes/search.py index 5c92839..077568f 100644 --- a/api/routes/search.py +++ b/api/routes/search.py @@ -99,6 +99,8 @@ async def search_screenshots(request: SearchRequest): try: if search_mode == "image": # Pure image search (legacy behavior) + if image_embedding is None: + raise HTTPException(status_code=500, detail="Failed to generate image embedding") results = db.search_similar( image_embedding, limit=search_limit, @@ -123,6 +125,8 @@ async def search_screenshots(request: SearchRequest): elif search_mode == "text_semantic": # Pure BGE text semantic search + if text_embedding is None: + raise HTTPException(status_code=500, detail="Failed to generate text embedding") results = db.search_text_embeddings( query_embedding=text_embedding, limit=search_limit, diff --git a/core/ocr.py b/core/ocr.py index 5a62e09..8a2ba44 100644 --- a/core/ocr.py +++ b/core/ocr.py @@ -128,12 +128,10 @@ def _get_default_provider_name(self) -> str: """Get the default provider name based on platform""" system = platform.system() - if system == "Darwin": # macOS - if "apple_vision" in self._providers: - return "apple_vision" - elif system == "Windows": - if "tesseract" in self._providers: - return "tesseract" + if system == "Darwin" and "apple_vision" in self._providers: + return "apple_vision" + elif system == "Windows" and "tesseract" in self._providers: + return "tesseract" # Fallback to tesseract if available if "tesseract" in self._providers: diff --git a/core/text_embeddings.py b/core/text_embeddings.py index 4d8d353..a2b589c 100644 --- a/core/text_embeddings.py +++ b/core/text_embeddings.py @@ -41,8 +41,8 @@ warnings.filterwarnings("ignore", message=".*use_fast.*") warnings.filterwarnings("ignore", category=FutureWarning) -import numpy as np -import torch +import numpy as np # noqa: E402 +import torch # noqa: E402 # Lazy loading state _model = None diff --git a/scripts/cleanup_ocr.py b/scripts/cleanup_ocr.py index b3fe94c..a662c02 100644 --- a/scripts/cleanup_ocr.py +++ b/scripts/cleanup_ocr.py @@ -14,7 +14,7 @@ project_root = Path(__file__).parent.parent sys.path.insert(0, str(project_root)) -from core.database import db +from core.database import db # noqa: E402 def main(): diff --git a/web/src/__tests__/api.test.ts b/web/src/__tests__/api.test.ts index 24e19be..65a91e6 100644 --- a/web/src/__tests__/api.test.ts +++ b/web/src/__tests__/api.test.ts @@ -152,6 +152,7 @@ describe('API Client', () => { limit: 50, safe_mode: false, safe_mode_level: 'low', + search_mode: 'auto', start_date: '2024-01-01', end_date: '2024-12-31', visibility: 'visible_only', diff --git a/web/tsconfig.tsbuildinfo b/web/tsconfig.tsbuildinfo index df954dc..ac1a809 100644 --- a/web/tsconfig.tsbuildinfo +++ b/web/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"fileNames":["./node_modules/typescript/lib/lib.es5.d.ts","./node_modules/typescript/lib/lib.es2015.d.ts","./node_modules/typescript/lib/lib.es2016.d.ts","./node_modules/typescript/lib/lib.es2017.d.ts","./node_modules/typescript/lib/lib.es2018.d.ts","./node_modules/typescript/lib/lib.es2019.d.ts","./node_modules/typescript/lib/lib.es2020.d.ts","./node_modules/typescript/lib/lib.es2021.d.ts","./node_modules/typescript/lib/lib.es2022.d.ts","./node_modules/typescript/lib/lib.es2023.d.ts","./node_modules/typescript/lib/lib.es2024.d.ts","./node_modules/typescript/lib/lib.esnext.d.ts","./node_modules/typescript/lib/lib.dom.d.ts","./node_modules/typescript/lib/lib.dom.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.core.d.ts","./node_modules/typescript/lib/lib.es2015.collection.d.ts","./node_modules/typescript/lib/lib.es2015.generator.d.ts","./node_modules/typescript/lib/lib.es2015.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.promise.d.ts","./node_modules/typescript/lib/lib.es2015.proxy.d.ts","./node_modules/typescript/lib/lib.es2015.reflect.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2016.array.include.d.ts","./node_modules/typescript/lib/lib.es2016.intl.d.ts","./node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2017.date.d.ts","./node_modules/typescript/lib/lib.es2017.object.d.ts","./node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2017.string.d.ts","./node_modules/typescript/lib/lib.es2017.intl.d.ts","./node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","./node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","./node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","./node_modules/typescript/lib/lib.es2018.intl.d.ts","./node_modules/typescript/lib/lib.es2018.promise.d.ts","./node_modules/typescript/lib/lib.es2018.regexp.d.ts","./node_modules/typescript/lib/lib.es2019.array.d.ts","./node_modules/typescript/lib/lib.es2019.object.d.ts","./node_modules/typescript/lib/lib.es2019.string.d.ts","./node_modules/typescript/lib/lib.es2019.symbol.d.ts","./node_modules/typescript/lib/lib.es2019.intl.d.ts","./node_modules/typescript/lib/lib.es2020.bigint.d.ts","./node_modules/typescript/lib/lib.es2020.date.d.ts","./node_modules/typescript/lib/lib.es2020.promise.d.ts","./node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2020.string.d.ts","./node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2020.intl.d.ts","./node_modules/typescript/lib/lib.es2020.number.d.ts","./node_modules/typescript/lib/lib.es2021.promise.d.ts","./node_modules/typescript/lib/lib.es2021.string.d.ts","./node_modules/typescript/lib/lib.es2021.weakref.d.ts","./node_modules/typescript/lib/lib.es2021.intl.d.ts","./node_modules/typescript/lib/lib.es2022.array.d.ts","./node_modules/typescript/lib/lib.es2022.error.d.ts","./node_modules/typescript/lib/lib.es2022.intl.d.ts","./node_modules/typescript/lib/lib.es2022.object.d.ts","./node_modules/typescript/lib/lib.es2022.string.d.ts","./node_modules/typescript/lib/lib.es2022.regexp.d.ts","./node_modules/typescript/lib/lib.es2023.array.d.ts","./node_modules/typescript/lib/lib.es2023.collection.d.ts","./node_modules/typescript/lib/lib.es2023.intl.d.ts","./node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2024.collection.d.ts","./node_modules/typescript/lib/lib.es2024.object.d.ts","./node_modules/typescript/lib/lib.es2024.promise.d.ts","./node_modules/typescript/lib/lib.es2024.regexp.d.ts","./node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2024.string.d.ts","./node_modules/typescript/lib/lib.esnext.array.d.ts","./node_modules/typescript/lib/lib.esnext.collection.d.ts","./node_modules/typescript/lib/lib.esnext.intl.d.ts","./node_modules/typescript/lib/lib.esnext.disposable.d.ts","./node_modules/typescript/lib/lib.esnext.promise.d.ts","./node_modules/typescript/lib/lib.esnext.decorators.d.ts","./node_modules/typescript/lib/lib.esnext.iterator.d.ts","./node_modules/typescript/lib/lib.esnext.float16.d.ts","./node_modules/typescript/lib/lib.esnext.error.d.ts","./node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","./node_modules/typescript/lib/lib.decorators.d.ts","./node_modules/typescript/lib/lib.decorators.legacy.d.ts","./node_modules/next/dist/styled-jsx/types/css.d.ts","./node_modules/@types/react/global.d.ts","./node_modules/csstype/index.d.ts","./node_modules/@types/prop-types/index.d.ts","./node_modules/@types/react/index.d.ts","./node_modules/next/dist/styled-jsx/types/index.d.ts","./node_modules/next/dist/styled-jsx/types/macro.d.ts","./node_modules/next/dist/styled-jsx/types/style.d.ts","./node_modules/next/dist/styled-jsx/types/global.d.ts","./node_modules/next/dist/shared/lib/amp.d.ts","./node_modules/next/amp.d.ts","./node_modules/@types/node/compatibility/disposable.d.ts","./node_modules/@types/node/compatibility/indexable.d.ts","./node_modules/@types/node/compatibility/iterators.d.ts","./node_modules/@types/node/compatibility/index.d.ts","./node_modules/@types/node/globals.typedarray.d.ts","./node_modules/@types/node/buffer.buffer.d.ts","./node_modules/@types/node/globals.d.ts","./node_modules/@types/node/web-globals/abortcontroller.d.ts","./node_modules/@types/node/web-globals/domexception.d.ts","./node_modules/@types/node/web-globals/events.d.ts","./node_modules/undici-types/header.d.ts","./node_modules/undici-types/readable.d.ts","./node_modules/undici-types/file.d.ts","./node_modules/undici-types/fetch.d.ts","./node_modules/undici-types/formdata.d.ts","./node_modules/undici-types/connector.d.ts","./node_modules/undici-types/client.d.ts","./node_modules/undici-types/errors.d.ts","./node_modules/undici-types/dispatcher.d.ts","./node_modules/undici-types/global-dispatcher.d.ts","./node_modules/undici-types/global-origin.d.ts","./node_modules/undici-types/pool-stats.d.ts","./node_modules/undici-types/pool.d.ts","./node_modules/undici-types/handlers.d.ts","./node_modules/undici-types/balanced-pool.d.ts","./node_modules/undici-types/agent.d.ts","./node_modules/undici-types/mock-interceptor.d.ts","./node_modules/undici-types/mock-agent.d.ts","./node_modules/undici-types/mock-client.d.ts","./node_modules/undici-types/mock-pool.d.ts","./node_modules/undici-types/mock-errors.d.ts","./node_modules/undici-types/proxy-agent.d.ts","./node_modules/undici-types/env-http-proxy-agent.d.ts","./node_modules/undici-types/retry-handler.d.ts","./node_modules/undici-types/retry-agent.d.ts","./node_modules/undici-types/api.d.ts","./node_modules/undici-types/interceptors.d.ts","./node_modules/undici-types/util.d.ts","./node_modules/undici-types/cookies.d.ts","./node_modules/undici-types/patch.d.ts","./node_modules/undici-types/websocket.d.ts","./node_modules/undici-types/eventsource.d.ts","./node_modules/undici-types/filereader.d.ts","./node_modules/undici-types/diagnostics-channel.d.ts","./node_modules/undici-types/content-type.d.ts","./node_modules/undici-types/cache.d.ts","./node_modules/undici-types/index.d.ts","./node_modules/@types/node/web-globals/fetch.d.ts","./node_modules/@types/node/assert.d.ts","./node_modules/@types/node/assert/strict.d.ts","./node_modules/@types/node/async_hooks.d.ts","./node_modules/@types/node/buffer.d.ts","./node_modules/@types/node/child_process.d.ts","./node_modules/@types/node/cluster.d.ts","./node_modules/@types/node/console.d.ts","./node_modules/@types/node/constants.d.ts","./node_modules/@types/node/crypto.d.ts","./node_modules/@types/node/dgram.d.ts","./node_modules/@types/node/diagnostics_channel.d.ts","./node_modules/@types/node/dns.d.ts","./node_modules/@types/node/dns/promises.d.ts","./node_modules/@types/node/domain.d.ts","./node_modules/@types/node/events.d.ts","./node_modules/@types/node/fs.d.ts","./node_modules/@types/node/fs/promises.d.ts","./node_modules/@types/node/http.d.ts","./node_modules/@types/node/http2.d.ts","./node_modules/@types/node/https.d.ts","./node_modules/@types/node/inspector.generated.d.ts","./node_modules/@types/node/module.d.ts","./node_modules/@types/node/net.d.ts","./node_modules/@types/node/os.d.ts","./node_modules/@types/node/path.d.ts","./node_modules/@types/node/perf_hooks.d.ts","./node_modules/@types/node/process.d.ts","./node_modules/@types/node/punycode.d.ts","./node_modules/@types/node/querystring.d.ts","./node_modules/@types/node/readline.d.ts","./node_modules/@types/node/readline/promises.d.ts","./node_modules/@types/node/repl.d.ts","./node_modules/@types/node/sea.d.ts","./node_modules/@types/node/stream.d.ts","./node_modules/@types/node/stream/promises.d.ts","./node_modules/@types/node/stream/consumers.d.ts","./node_modules/@types/node/stream/web.d.ts","./node_modules/@types/node/string_decoder.d.ts","./node_modules/@types/node/test.d.ts","./node_modules/@types/node/timers.d.ts","./node_modules/@types/node/timers/promises.d.ts","./node_modules/@types/node/tls.d.ts","./node_modules/@types/node/trace_events.d.ts","./node_modules/@types/node/tty.d.ts","./node_modules/@types/node/url.d.ts","./node_modules/@types/node/util.d.ts","./node_modules/@types/node/v8.d.ts","./node_modules/@types/node/vm.d.ts","./node_modules/@types/node/wasi.d.ts","./node_modules/@types/node/worker_threads.d.ts","./node_modules/@types/node/zlib.d.ts","./node_modules/@types/node/index.d.ts","./node_modules/next/dist/server/get-page-files.d.ts","./node_modules/@types/react/canary.d.ts","./node_modules/@types/react/experimental.d.ts","./node_modules/@types/react-dom/index.d.ts","./node_modules/@types/react-dom/canary.d.ts","./node_modules/@types/react-dom/experimental.d.ts","./node_modules/next/dist/compiled/webpack/webpack.d.ts","./node_modules/next/dist/server/config.d.ts","./node_modules/next/dist/lib/load-custom-routes.d.ts","./node_modules/next/dist/shared/lib/image-config.d.ts","./node_modules/next/dist/build/webpack/plugins/subresource-integrity-plugin.d.ts","./node_modules/next/dist/server/body-streams.d.ts","./node_modules/next/dist/server/future/route-kind.d.ts","./node_modules/next/dist/server/future/route-definitions/route-definition.d.ts","./node_modules/next/dist/server/future/route-matches/route-match.d.ts","./node_modules/next/dist/client/components/app-router-headers.d.ts","./node_modules/next/dist/server/request-meta.d.ts","./node_modules/next/dist/server/lib/revalidate.d.ts","./node_modules/next/dist/server/config-shared.d.ts","./node_modules/next/dist/server/base-http/index.d.ts","./node_modules/next/dist/server/api-utils/index.d.ts","./node_modules/next/dist/server/node-environment.d.ts","./node_modules/next/dist/server/require-hook.d.ts","./node_modules/next/dist/server/node-polyfill-crypto.d.ts","./node_modules/next/dist/lib/page-types.d.ts","./node_modules/next/dist/build/analysis/get-page-static-info.d.ts","./node_modules/next/dist/build/webpack/loaders/get-module-build-info.d.ts","./node_modules/next/dist/build/webpack/plugins/middleware-plugin.d.ts","./node_modules/next/dist/server/render-result.d.ts","./node_modules/next/dist/server/future/helpers/i18n-provider.d.ts","./node_modules/next/dist/server/web/next-url.d.ts","./node_modules/next/dist/compiled/@edge-runtime/cookies/index.d.ts","./node_modules/next/dist/server/web/spec-extension/cookies.d.ts","./node_modules/next/dist/server/web/spec-extension/request.d.ts","./node_modules/next/dist/server/web/spec-extension/fetch-event.d.ts","./node_modules/next/dist/server/web/spec-extension/response.d.ts","./node_modules/next/dist/server/web/types.d.ts","./node_modules/next/dist/lib/setup-exception-listeners.d.ts","./node_modules/next/dist/lib/constants.d.ts","./node_modules/next/dist/build/index.d.ts","./node_modules/next/dist/build/webpack/plugins/pages-manifest-plugin.d.ts","./node_modules/next/dist/shared/lib/router/utils/route-regex.d.ts","./node_modules/next/dist/shared/lib/router/utils/route-matcher.d.ts","./node_modules/next/dist/shared/lib/router/utils/parse-url.d.ts","./node_modules/next/dist/server/base-http/node.d.ts","./node_modules/next/dist/server/font-utils.d.ts","./node_modules/next/dist/build/webpack/plugins/flight-manifest-plugin.d.ts","./node_modules/next/dist/server/future/route-modules/route-module.d.ts","./node_modules/next/dist/server/load-components.d.ts","./node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.d.ts","./node_modules/next/dist/build/webpack/plugins/next-font-manifest-plugin.d.ts","./node_modules/next/dist/server/future/route-definitions/locale-route-definition.d.ts","./node_modules/next/dist/server/future/route-definitions/pages-route-definition.d.ts","./node_modules/next/dist/shared/lib/mitt.d.ts","./node_modules/next/dist/client/with-router.d.ts","./node_modules/next/dist/client/router.d.ts","./node_modules/next/dist/client/route-loader.d.ts","./node_modules/next/dist/client/page-loader.d.ts","./node_modules/next/dist/shared/lib/bloom-filter.d.ts","./node_modules/next/dist/shared/lib/router/router.d.ts","./node_modules/next/dist/shared/lib/router-context.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/loadable-context.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/loadable.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/image-config-context.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/hooks-client-context.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/head-manager-context.shared-runtime.d.ts","./node_modules/next/dist/server/future/route-definitions/app-page-route-definition.d.ts","./node_modules/next/dist/shared/lib/modern-browserslist-target.d.ts","./node_modules/next/dist/shared/lib/constants.d.ts","./node_modules/next/dist/build/webpack/loaders/metadata/types.d.ts","./node_modules/next/dist/build/page-extensions-type.d.ts","./node_modules/next/dist/build/webpack/loaders/next-app-loader.d.ts","./node_modules/next/dist/server/lib/app-dir-module.d.ts","./node_modules/next/dist/server/response-cache/types.d.ts","./node_modules/next/dist/server/response-cache/index.d.ts","./node_modules/next/dist/server/lib/incremental-cache/index.d.ts","./node_modules/next/dist/client/components/hooks-server-context.d.ts","./node_modules/next/dist/server/app-render/dynamic-rendering.d.ts","./node_modules/next/dist/client/components/static-generation-async-storage.external.d.ts","./node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.d.ts","./node_modules/next/dist/server/async-storage/draft-mode-provider.d.ts","./node_modules/next/dist/server/web/spec-extension/adapters/headers.d.ts","./node_modules/next/dist/client/components/request-async-storage.external.d.ts","./node_modules/next/dist/server/app-render/create-error-handler.d.ts","./node_modules/next/dist/server/app-render/app-render.d.ts","./node_modules/next/dist/shared/lib/server-inserted-html.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/amp-context.shared-runtime.d.ts","./node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/entrypoints.d.ts","./node_modules/next/dist/server/future/route-modules/app-page/module.compiled.d.ts","./node_modules/@types/react/jsx-runtime.d.ts","./node_modules/next/dist/client/components/error-boundary.d.ts","./node_modules/next/dist/client/components/router-reducer/create-initial-router-state.d.ts","./node_modules/next/dist/client/components/app-router.d.ts","./node_modules/next/dist/client/components/layout-router.d.ts","./node_modules/next/dist/client/components/render-from-template-context.d.ts","./node_modules/next/dist/client/components/action-async-storage.external.d.ts","./node_modules/next/dist/client/components/client-page.d.ts","./node_modules/next/dist/client/components/search-params.d.ts","./node_modules/next/dist/client/components/not-found-boundary.d.ts","./node_modules/next/dist/server/app-render/rsc/preloads.d.ts","./node_modules/next/dist/server/app-render/rsc/postpone.d.ts","./node_modules/next/dist/server/app-render/rsc/taint.d.ts","./node_modules/next/dist/server/app-render/entry-base.d.ts","./node_modules/next/dist/build/templates/app-page.d.ts","./node_modules/next/dist/server/future/route-modules/app-page/module.d.ts","./node_modules/next/dist/server/app-render/types.d.ts","./node_modules/next/dist/client/components/router-reducer/fetch-server-response.d.ts","./node_modules/next/dist/client/components/router-reducer/router-reducer-types.d.ts","./node_modules/next/dist/shared/lib/app-router-context.shared-runtime.d.ts","./node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/entrypoints.d.ts","./node_modules/next/dist/server/future/route-modules/pages/module.compiled.d.ts","./node_modules/next/dist/build/templates/pages.d.ts","./node_modules/next/dist/server/future/route-modules/pages/module.d.ts","./node_modules/next/dist/server/render.d.ts","./node_modules/next/dist/server/future/route-definitions/pages-api-route-definition.d.ts","./node_modules/next/dist/server/future/route-matches/pages-api-route-match.d.ts","./node_modules/next/dist/server/future/route-matchers/route-matcher.d.ts","./node_modules/next/dist/server/future/route-matcher-providers/route-matcher-provider.d.ts","./node_modules/next/dist/server/future/route-matcher-managers/route-matcher-manager.d.ts","./node_modules/next/dist/server/future/normalizers/normalizer.d.ts","./node_modules/next/dist/server/future/normalizers/locale-route-normalizer.d.ts","./node_modules/next/dist/server/future/normalizers/request/pathname-normalizer.d.ts","./node_modules/next/dist/server/future/normalizers/request/suffix.d.ts","./node_modules/next/dist/server/future/normalizers/request/rsc.d.ts","./node_modules/next/dist/server/future/normalizers/request/prefix.d.ts","./node_modules/next/dist/server/future/normalizers/request/postponed.d.ts","./node_modules/next/dist/server/future/normalizers/request/prefetch-rsc.d.ts","./node_modules/next/dist/server/future/normalizers/request/next-data.d.ts","./node_modules/next/dist/server/base-server.d.ts","./node_modules/next/dist/server/image-optimizer.d.ts","./node_modules/next/dist/server/next-server.d.ts","./node_modules/next/dist/lib/coalesced-function.d.ts","./node_modules/next/dist/server/lib/router-utils/types.d.ts","./node_modules/next/dist/trace/types.d.ts","./node_modules/next/dist/trace/trace.d.ts","./node_modules/next/dist/trace/shared.d.ts","./node_modules/next/dist/trace/index.d.ts","./node_modules/next/dist/build/load-jsconfig.d.ts","./node_modules/next/dist/build/webpack-config.d.ts","./node_modules/next/dist/build/webpack/plugins/define-env-plugin.d.ts","./node_modules/next/dist/build/swc/index.d.ts","./node_modules/next/dist/server/dev/parse-version-info.d.ts","./node_modules/next/dist/server/dev/hot-reloader-types.d.ts","./node_modules/next/dist/telemetry/storage.d.ts","./node_modules/next/dist/server/lib/types.d.ts","./node_modules/next/dist/server/lib/render-server.d.ts","./node_modules/next/dist/server/lib/router-server.d.ts","./node_modules/next/dist/shared/lib/router/utils/path-match.d.ts","./node_modules/next/dist/server/lib/router-utils/filesystem.d.ts","./node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.d.ts","./node_modules/next/dist/server/lib/dev-bundler-service.d.ts","./node_modules/next/dist/server/dev/static-paths-worker.d.ts","./node_modules/next/dist/server/dev/next-dev-server.d.ts","./node_modules/next/dist/server/next.d.ts","./node_modules/next/dist/lib/metadata/types/alternative-urls-types.d.ts","./node_modules/next/dist/lib/metadata/types/extra-types.d.ts","./node_modules/next/dist/lib/metadata/types/metadata-types.d.ts","./node_modules/next/dist/lib/metadata/types/manifest-types.d.ts","./node_modules/next/dist/lib/metadata/types/opengraph-types.d.ts","./node_modules/next/dist/lib/metadata/types/twitter-types.d.ts","./node_modules/next/dist/lib/metadata/types/metadata-interface.d.ts","./node_modules/next/types/index.d.ts","./node_modules/next/dist/shared/lib/html-context.shared-runtime.d.ts","./node_modules/@next/env/dist/index.d.ts","./node_modules/next/dist/shared/lib/utils.d.ts","./node_modules/next/dist/pages/_app.d.ts","./node_modules/next/app.d.ts","./node_modules/next/dist/server/web/spec-extension/unstable-cache.d.ts","./node_modules/next/dist/server/web/spec-extension/revalidate.d.ts","./node_modules/next/dist/server/web/spec-extension/unstable-no-store.d.ts","./node_modules/next/cache.d.ts","./node_modules/next/dist/shared/lib/runtime-config.external.d.ts","./node_modules/next/config.d.ts","./node_modules/next/dist/pages/_document.d.ts","./node_modules/next/document.d.ts","./node_modules/next/dist/shared/lib/dynamic.d.ts","./node_modules/next/dynamic.d.ts","./node_modules/next/dist/pages/_error.d.ts","./node_modules/next/error.d.ts","./node_modules/next/dist/shared/lib/head.d.ts","./node_modules/next/head.d.ts","./node_modules/next/dist/client/components/draft-mode.d.ts","./node_modules/next/dist/client/components/headers.d.ts","./node_modules/next/headers.d.ts","./node_modules/next/dist/shared/lib/get-img-props.d.ts","./node_modules/next/dist/client/image-component.d.ts","./node_modules/next/dist/shared/lib/image-external.d.ts","./node_modules/next/image.d.ts","./node_modules/next/dist/client/link.d.ts","./node_modules/next/link.d.ts","./node_modules/next/dist/client/components/redirect-status-code.d.ts","./node_modules/next/dist/client/components/redirect.d.ts","./node_modules/next/dist/client/components/not-found.d.ts","./node_modules/next/dist/client/components/navigation.react-server.d.ts","./node_modules/next/dist/client/components/navigation.d.ts","./node_modules/next/navigation.d.ts","./node_modules/next/router.d.ts","./node_modules/next/dist/client/script.d.ts","./node_modules/next/script.d.ts","./node_modules/next/dist/server/web/spec-extension/user-agent.d.ts","./node_modules/next/dist/compiled/@edge-runtime/primitives/url.d.ts","./node_modules/next/dist/server/web/spec-extension/image-response.d.ts","./node_modules/next/dist/compiled/@vercel/og/satori/index.d.ts","./node_modules/next/dist/compiled/@vercel/og/emoji/index.d.ts","./node_modules/next/dist/compiled/@vercel/og/types.d.ts","./node_modules/next/server.d.ts","./node_modules/next/types/global.d.ts","./node_modules/next/types/compiled.d.ts","./node_modules/next/index.d.ts","./node_modules/next/image-types/global.d.ts","./next-env.d.ts","./src/types/index.ts","./src/lib/api.ts","./src/app/layout.tsx","./src/app/page.tsx","./src/app/settings/page.tsx","./src/components/datefilter.tsx","./src/components/header.tsx","./node_modules/lucide-react/dist/lucide-react.d.ts","./src/components/imagegrid.tsx","./src/components/searchbar.tsx","./src/components/statusbar.tsx","./src/components/timeline.tsx","./src/components/timelinescrubber.tsx","./.next/types/app/layout.ts","./.next/types/app/page.ts","./.next/types/app/settings/page.ts"],"fileIdsList":[[99,145,354,407],[99,145,354,408],[99,145,354,409],[99,145,402,403],[99,145],[99,142,145],[99,144,145],[145],[99,145,150,178],[99,145,146,151,156,164,175,186],[99,145,146,147,156,164],[94,95,96,99,145],[99,145,148,187],[99,145,149,150,157,165],[99,145,150,175,183],[99,145,151,153,156,164],[99,144,145,152],[99,145,153,154],[99,145,155,156],[99,144,145,156],[99,145,156,157,158,175,186],[99,145,156,157,158,171,175,178],[99,145,153,156,159,164,175,186],[99,145,156,157,159,160,164,175,183,186],[99,145,159,161,175,183,186],[97,98,99,100,101,102,103,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192],[99,145,156,162],[99,145,163,186,191],[99,145,153,156,164,175],[99,145,165],[99,145,166],[99,144,145,167],[99,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192],[99,145,169],[99,145,170],[99,145,156,171,172],[99,145,171,173,187,189],[99,145,156,175,176,178],[99,145,177,178],[99,145,175,176],[99,145,178],[99,145,179],[99,142,145,175,180],[99,145,156,181,182],[99,145,181,182],[99,145,150,164,175,183],[99,145,184],[99,145,164,185],[99,145,159,170,186],[99,145,150,187],[99,145,175,188],[99,145,163,189],[99,145,190],[99,140,145],[99,140,145,156,158,167,175,178,186,189,191],[99,145,175,192],[87,99,145,197,198,199],[87,99,145,197,198],[87,99,145],[87,91,99,145,196,355,398],[87,91,99,145,195,355,398],[84,85,86,99,145],[92,99,145],[99,145,359],[99,145,361,362,363],[99,145,365],[99,145,202,212,218,220,355],[99,145,202,209,211,214,232],[99,145,212],[99,145,212,333],[99,145,266,282,296,401],[99,145,304],[99,145,202,212,219,252,262,330,331,401],[99,145,219,401],[99,145,212,262,263,264,401],[99,145,212,219,252,401],[99,145,401],[99,145,202,219,220,401],[99,144,145,193],[87,99,145,283,284,285,301,302],[87,99,145,283],[99,145,274],[99,145,273,275,375],[87,99,145,283,284,299],[99,145,279,302,387],[99,145,385,386],[99,145,226,384],[99,144,145,193,226,273,274,275],[87,99,145,299,301,302],[99,145,299,301],[99,145,299,300,302],[99,145,170,193],[99,144,145,193,211,213,269,270,271],[87,99,145,203,378],[87,99,145,186,193],[87,99,145,219,250],[87,99,145,219],[99,145,248,253],[87,99,145,249,358],[87,91,99,145,159,193,195,196,355,396,397],[99,145,355],[99,145,201],[99,145,348,349,350,351,352,353],[99,145,350],[87,99,145,249,283,358],[87,99,145,283,356,358],[87,99,145,283,358],[99,145,159,193,213,358],[99,145,159,193,210,211,222,240,272,276,277,298,299],[99,145,272],[99,145,270,272,276,284,286,287,288,289,290,291,292,293,294,295,401],[99,145,271],[87,99,145,170,193,211,212,240,242,244,269,298,302,355,401],[99,145,159,193,213,214,226,227,273],[99,145,159,193,212,214],[99,145,159,175,193,210,213,214],[99,145,159,170,186,193,210,211,212,213,214,219,222,223,233,234,236,239,240,242,243,244,268,269,299,307,309,312,314,317,319,320,321],[99,145,159,175,193],[99,145,202,203,204,210,211,355,358,401],[99,145,159,175,186,193,207,332,334,335,401],[99,145,170,186,193,207,210,213,230,234,236,237,238,242,269,312,322,324,330,344,345],[99,145,212,216,269],[99,145,210,212],[99,145,223,313],[99,145,315],[99,145,313],[99,145,315,318],[99,145,315,316],[99,145,206,207],[99,145,206,245],[99,145,206],[99,145,208,223,311],[99,145,310],[99,145,207,208],[99,145,208,308],[99,145,207],[99,145,298],[99,145,159,193,210,222,241,260,266,278,281,297,299],[99,145,254,255,256,257,258,259,279,280,302,356],[99,145,306],[99,145,159,193,210,222,241,246,303,305,307,355,358],[99,145,159,186,193,203,210,212,268],[99,145,265],[99,145,159,193,338,343],[99,145,233,268,358],[99,145,326,330,344,347],[99,145,159,216,330,338,339,347],[99,145,202,212,233,243,341],[99,145,159,193,212,219,243,325,326,336,337,340,342],[99,145,194,240,241,355,358],[99,145,159,170,186,193,208,210,211,213,216,221,222,230,233,234,236,237,238,239,242,244,268,269,309,322,323,358],[99,145,159,193,210,212,216,324,346],[99,145,159,193,211,213],[87,99,145,159,170,193,201,203,210,211,214,222,239,240,242,244,306,355,358],[99,145,159,170,186,193,205,208,209,213],[99,145,206,267],[99,145,159,193,206,211,222],[99,145,159,193,212,223],[99,145,159,193],[99,145,226],[99,145,225],[99,145,227],[99,145,212,224,226,230],[99,145,212,224,226],[99,145,159,193,205,212,213,219,227,228,229],[87,99,145,299,300,301],[99,145,261],[87,99,145,203],[87,99,145,236],[87,99,145,194,239,244,355,358],[99,145,203,378,379],[87,99,145,253],[87,99,145,170,186,193,201,247,249,251,252,358],[99,145,213,219,236],[99,145,235],[87,99,145,157,159,170,193,201,253,262,355,356,357],[83,87,88,89,90,99,145,195,196,355,398],[99,145,150],[99,145,327,328,329],[99,145,327],[99,145,367],[99,145,369],[99,145,371],[99,145,373],[99,145,376],[99,145,380],[91,93,99,145,355,360,364,366,368,370,372,374,377,381,383,389,390,392,399,400,401],[99,145,382],[99,145,388],[99,145,249],[99,145,391],[99,144,145,227,228,229,230,393,394,395,398],[99,145,193],[87,91,99,145,159,161,170,193,195,196,197,199,201,214,347,354,358,398],[99,112,116,145,186],[99,112,145,175,186],[99,107,145],[99,109,112,145,183,186],[99,145,164,183],[99,107,145,193],[99,109,112,145,164,186],[99,104,105,108,111,145,156,175,186],[99,112,119,145],[99,104,110,145],[99,112,133,134,145],[99,108,112,145,178,186,193],[99,133,145,193],[99,106,107,145,193],[99,112,145],[99,106,107,108,109,110,111,112,113,114,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,134,135,136,137,138,139,145],[99,112,127,145],[99,112,119,120,145],[99,110,112,120,121,145],[99,111,145],[99,104,107,112,145],[99,112,116,120,121,145],[99,116,145],[99,110,112,115,145,186],[99,104,109,112,119,145],[99,145,175],[99,107,112,133,145,191,193],[99,145,402],[87,99,145,383,405,406],[87,99,145,383,405],[87,99,145,405,412],[87,99,145,412],[99,145,405],[87,99,145,405]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","impliedFormat":1},{"version":"2ab096661c711e4a81cc464fa1e6feb929a54f5340b46b0a07ac6bbf857471f0","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedFormat":1},{"version":"196cb558a13d4533a5163286f30b0509ce0210e4b316c56c38d4c0fd2fb38405","affectsGlobalScope":true,"impliedFormat":1},{"version":"73f78680d4c08509933daf80947902f6ff41b6230f94dd002ae372620adb0f60","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5239f5c01bcfa9cd32f37c496cf19c61d69d37e48be9de612b541aac915805b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"0990a7576222f248f0a3b888adcb7389f957928ce2afb1cd5128169086ff4d29","impliedFormat":1},{"version":"eb5b19b86227ace1d29ea4cf81387279d04bb34051e944bc53df69f58914b788","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"87d9d29dbc745f182683f63187bf3d53fd8673e5fca38ad5eaab69798ed29fbc","impliedFormat":1},{"version":"7a3aa194cfd5919c4da251ef04ea051077e22702638d4edcb9579e9101653519","affectsGlobalScope":true,"impliedFormat":1},{"version":"cc69795d9954ee4ad57545b10c7bf1a7260d990231b1685c147ea71a6faa265c","impliedFormat":1},{"version":"8bc6c94ff4f2af1f4023b7bb2379b08d3d7dd80c698c9f0b07431ea16101f05f","impliedFormat":1},{"version":"1b61d259de5350f8b1e5db06290d31eaebebc6baafd5f79d314b5af9256d7153","impliedFormat":1},{"version":"57194e1f007f3f2cbef26fa299d4c6b21f4623a2eddc63dfeef79e38e187a36e","impliedFormat":1},{"version":"0f6666b58e9276ac3a38fdc80993d19208442d6027ab885580d93aec76b4ef00","impliedFormat":1},{"version":"05fd364b8ef02fb1e174fbac8b825bdb1e5a36a016997c8e421f5fab0a6da0a0","impliedFormat":1},{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"98cffbf06d6bab333473c70a893770dbe990783904002c4f1a960447b4b53dca","affectsGlobalScope":true,"impliedFormat":1},{"version":"ba481bca06f37d3f2c137ce343c7d5937029b2468f8e26111f3c9d9963d6568d","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d9ef24f9a22a88e3e9b3b3d8c40ab1ddb0853f1bfbd5c843c37800138437b61","affectsGlobalScope":true,"impliedFormat":1},{"version":"1db0b7dca579049ca4193d034d835f6bfe73096c73663e5ef9a0b5779939f3d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"f26b11d8d8e4b8028f1c7d618b22274c892e4b0ef5b3678a8ccbad85419aef43","affectsGlobalScope":true,"impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"763fe0f42b3d79b440a9b6e51e9ba3f3f91352469c1e4b3b67bfa4ff6352f3f4","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"7f182617db458e98fc18dfb272d40aa2fff3a353c44a89b2c0ccb3937709bfb5","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"2cbe0621042e2a68c7cbce5dfed3906a1862a16a7d496010636cdbdb91341c0f","affectsGlobalScope":true,"impliedFormat":1},{"version":"e2677634fe27e87348825bb041651e22d50a613e2fdf6a4a3ade971d71bac37e","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"8c0bcd6c6b67b4b503c11e91a1fb91522ed585900eab2ab1f61bba7d7caa9d6f","impliedFormat":1},{"version":"8cd19276b6590b3ebbeeb030ac271871b9ed0afc3074ac88a94ed2449174b776","affectsGlobalScope":true,"impliedFormat":1},{"version":"696eb8d28f5949b87d894b26dc97318ef944c794a9a4e4f62360cd1d1958014b","impliedFormat":1},{"version":"3f8fa3061bd7402970b399300880d55257953ee6d3cd408722cb9ac20126460c","impliedFormat":1},{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"68bd56c92c2bd7d2339457eb84d63e7de3bd56a69b25f3576e1568d21a162398","affectsGlobalScope":true,"impliedFormat":1},{"version":"3e93b123f7c2944969d291b35fed2af79a6e9e27fdd5faa99748a51c07c02d28","impliedFormat":1},{"version":"9d19808c8c291a9010a6c788e8532a2da70f811adb431c97520803e0ec649991","impliedFormat":1},{"version":"87aad3dd9752067dc875cfaa466fc44246451c0c560b820796bdd528e29bef40","impliedFormat":1},{"version":"4aacb0dd020eeaef65426153686cc639a78ec2885dc72ad220be1d25f1a439df","impliedFormat":1},{"version":"f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45","impliedFormat":1},{"version":"8db0ae9cb14d9955b14c214f34dae1b9ef2baee2fe4ce794a4cd3ac2531e3255","affectsGlobalScope":true,"impliedFormat":1},{"version":"15fc6f7512c86810273af28f224251a5a879e4261b4d4c7e532abfbfc3983134","impliedFormat":1},{"version":"58adba1a8ab2d10b54dc1dced4e41f4e7c9772cbbac40939c0dc8ce2cdb1d442","impliedFormat":1},{"version":"2fd4c143eff88dabb57701e6a40e02a4dbc36d5eb1362e7964d32028056a782b","impliedFormat":1},{"version":"714435130b9015fae551788df2a88038471a5a11eb471f27c4ede86552842bc9","impliedFormat":1},{"version":"855cd5f7eb396f5f1ab1bc0f8580339bff77b68a770f84c6b254e319bbfd1ac7","impliedFormat":1},{"version":"5650cf3dace09e7c25d384e3e6b818b938f68f4e8de96f52d9c5a1b3db068e86","impliedFormat":1},{"version":"1354ca5c38bd3fd3836a68e0f7c9f91f172582ba30ab15bb8c075891b91502b7","affectsGlobalScope":true,"impliedFormat":1},{"version":"27fdb0da0daf3b337c5530c5f266efe046a6ceb606e395b346974e4360c36419","impliedFormat":1},{"version":"2d2fcaab481b31a5882065c7951255703ddbe1c0e507af56ea42d79ac3911201","impliedFormat":1},{"version":"afbe24ab0d74694372baa632ecb28bb375be53f3be53f9b07ecd7fc994907de5","impliedFormat":1},{"version":"ca867399f7db82df981d6915bcbb2d81131d7d1ef683bc782b59f71dda59bc85","affectsGlobalScope":true,"impliedFormat":1},{"version":"00877fef624f3171c2e44944fb63a55e2a9f9120d7c8b5eb4181c263c9a077cf","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","impliedFormat":1},{"version":"b4f70ec656a11d570e1a9edce07d118cd58d9760239e2ece99306ee9dfe61d02","impliedFormat":1},{"version":"3bc2f1e2c95c04048212c569ed38e338873f6a8593930cf5a7ef24ffb38fc3b6","impliedFormat":1},{"version":"6e70e9570e98aae2b825b533aa6292b6abd542e8d9f6e9475e88e1d7ba17c866","impliedFormat":1},{"version":"f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","impliedFormat":1},{"version":"9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","impliedFormat":1},{"version":"47ab634529c5955b6ad793474ae188fce3e6163e3a3fb5edd7e0e48f14435333","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"45650f47bfb376c8a8ed39d4bcda5902ab899a3150029684ee4c10676d9fbaee","impliedFormat":1},{"version":"0225ecb9ed86bdb7a2c7fd01f1556906902929377b44483dc4b83e03b3ef227d","affectsGlobalScope":true,"impliedFormat":1},{"version":"74cf591a0f63db318651e0e04cb55f8791385f86e987a67fd4d2eaab8191f730","impliedFormat":1},{"version":"5eab9b3dc9b34f185417342436ec3f106898da5f4801992d8ff38ab3aff346b5","impliedFormat":1},{"version":"12ed4559eba17cd977aa0db658d25c4047067444b51acfdcbf38470630642b23","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3ffabc95802521e1e4bcba4c88d8615176dc6e09111d920c7a213bdda6e1d65","impliedFormat":1},{"version":"f9ab232778f2842ffd6955f88b1049982fa2ecb764d129ee4893cbc290f41977","impliedFormat":1},{"version":"ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","impliedFormat":1},{"version":"a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9","impliedFormat":1},{"version":"c3b41e74b9a84b88b1dca61ec39eee25c0dbc8e7d519ba11bb070918cfacf656","affectsGlobalScope":true,"impliedFormat":1},{"version":"4737a9dc24d0e68b734e6cfbcea0c15a2cfafeb493485e27905f7856988c6b29","affectsGlobalScope":true,"impliedFormat":1},{"version":"36d8d3e7506b631c9582c251a2c0b8a28855af3f76719b12b534c6edf952748d","impliedFormat":1},{"version":"1ca69210cc42729e7ca97d3a9ad48f2e9cb0042bada4075b588ae5387debd318","impliedFormat":1},{"version":"f5ebe66baaf7c552cfa59d75f2bfba679f329204847db3cec385acda245e574e","impliedFormat":1},{"version":"ed59add13139f84da271cafd32e2171876b0a0af2f798d0c663e8eeb867732cf","affectsGlobalScope":true,"impliedFormat":1},{"version":"05db535df8bdc30d9116fe754a3473d1b6479afbc14ae8eb18b605c62677d518","impliedFormat":1},{"version":"b1810689b76fd473bd12cc9ee219f8e62f54a7d08019a235d07424afbf074d25","impliedFormat":1},{"version":"8caa5c86be1b793cd5f599e27ecb34252c41e011980f7d61ae4989a149ff6ccc","impliedFormat":1},{"version":"91b0f6d01993021ecbe01eb076db6a3cf1b66359c1d99104f43436010e81afb5","impliedFormat":1},{"version":"d1bd4e51810d159899aad1660ccb859da54e27e08b8c9862b40cd36c1d9ff00f","impliedFormat":1},{"version":"17ed71200119e86ccef2d96b73b02ce8854b76ad6bd21b5021d4269bec527b5f","impliedFormat":1},{"version":"1cfa8647d7d71cb03847d616bd79320abfc01ddea082a49569fda71ac5ece66b","impliedFormat":1},{"version":"bb7a61dd55dc4b9422d13da3a6bb9cc5e89be888ef23bbcf6558aa9726b89a1c","impliedFormat":1},{"version":"db6d2d9daad8a6d83f281af12ce4355a20b9a3e71b82b9f57cddcca0a8964a96","impliedFormat":1},{"version":"cfe4ef4710c3786b6e23dae7c086c70b4f4835a2e4d77b75d39f9046106e83d3","impliedFormat":1},{"version":"cbea99888785d49bb630dcbb1613c73727f2b5a2cf02e1abcaab7bcf8d6bf3c5","impliedFormat":1},{"version":"98817124fd6c4f60e0b935978c207309459fb71ab112cf514f26f333bf30830e","impliedFormat":1},{"version":"a86f82d646a739041d6702101afa82dcb935c416dd93cbca7fd754fd0282ce1f","impliedFormat":1},{"version":"2dad084c67e649f0f354739ec7df7c7df0779a28a4f55c97c6b6883ae850d1ce","impliedFormat":1},{"version":"fa5bbc7ab4130dd8cdc55ea294ec39f76f2bc507a0f75f4f873e38631a836ca7","impliedFormat":1},{"version":"df45ca1176e6ac211eae7ddf51336dc075c5314bc5c253651bae639defd5eec5","impliedFormat":1},{"version":"cf86de1054b843e484a3c9300d62fbc8c97e77f168bbffb131d560ca0474d4a8","impliedFormat":1},{"version":"196c960b12253fde69b204aa4fbf69470b26daf7a430855d7f94107a16495ab0","impliedFormat":1},{"version":"528637e771ee2e808390d46a591eaef375fa4b9c99b03749e22b1d2e868b1b7c","impliedFormat":1},{"version":"bf24f6d35f7318e246010ffe9924395893c4e96d34324cde77151a73f078b9ad","impliedFormat":1},{"version":"596ccf4070268c4f5a8c459d762d8a934fa9b9317c7bf7a953e921bc9d78ce3c","impliedFormat":1},{"version":"10595c7ff5094dd5b6a959ccb1c00e6a06441b4e10a87bc09c15f23755d34439","impliedFormat":1},{"version":"9620c1ff645afb4a9ab4044c85c26676f0a93e8c0e4b593aea03a89ccb47b6d0","impliedFormat":1},{"version":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","impliedFormat":1},{"version":"a9af0e608929aaf9ce96bd7a7b99c9360636c31d73670e4af09a09950df97841","impliedFormat":1},{"version":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","impliedFormat":1},{"version":"c86fe861cf1b4c46a0fb7d74dffe596cf679a2e5e8b1456881313170f092e3fa","impliedFormat":1},{"version":"08ed0b3f0166787f84a6606f80aa3b1388c7518d78912571b203817406e471da","impliedFormat":1},{"version":"47e5af2a841356a961f815e7c55d72554db0c11b4cba4d0caab91f8717846a94","impliedFormat":1},{"version":"9a1a0dc84fecc111e83281743f003e1ae9048e0f83c2ae2028d17bc58fd93cc7","impliedFormat":1},{"version":"f5f541902bf7ae0512a177295de9b6bcd6809ea38307a2c0a18bfca72212f368","impliedFormat":1},{"version":"e8da637cbd6ed1cf6c36e9424f6bcee4515ca2c677534d4006cbd9a05f930f0c","impliedFormat":1},{"version":"ca1b882a105a1972f82cc58e3be491e7d750a1eb074ffd13b198269f57ed9e1b","impliedFormat":1},{"version":"fc3e1c87b39e5ba1142f27ec089d1966da168c04a859a4f6aab64dceae162c2b","impliedFormat":1},{"version":"3867ca0e9757cc41e04248574f4f07b8f9e3c0c2a796a5eb091c65bfd2fc8bdb","impliedFormat":1},{"version":"61888522cec948102eba94d831c873200aa97d00d8989fdfd2a3e0ee75ec65a2","impliedFormat":1},{"version":"4e10622f89fea7b05dd9b52fb65e1e2b5cbd96d4cca3d9e1a60bb7f8a9cb86a1","impliedFormat":1},{"version":"74b2a5e5197bd0f2e0077a1ea7c07455bbea67b87b0869d9786d55104006784f","impliedFormat":1},{"version":"59bf32919de37809e101acffc120596a9e45fdbab1a99de5087f31fdc36e2f11","impliedFormat":1},{"version":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","impliedFormat":1},{"version":"5322a4f762d356093e8c2903a190ddbaa548420c891affa71093b85c5c2fbe94","impliedFormat":1},{"version":"c40c848daad198266370c1c72a7a8c3d18d2f50727c7859fcfefd3ff69a7f288","impliedFormat":1},{"version":"ac60bbee0d4235643cc52b57768b22de8c257c12bd8c2039860540cab1fa1d82","impliedFormat":1},{"version":"973b59a17aaa817eb205baf6c132b83475a5c0a44e8294a472af7793b1817e89","impliedFormat":1},{"version":"ada39cbb2748ab2873b7835c90c8d4620723aedf323550e8489f08220e477c7f","impliedFormat":1},{"version":"6e5f5cee603d67ee1ba6120815497909b73399842254fc1e77a0d5cdc51d8c9c","impliedFormat":1},{"version":"8dba67056cbb27628e9b9a1cba8e57036d359dceded0725c72a3abe4b6c79cd4","impliedFormat":1},{"version":"70f3814c457f54a7efe2d9ce9d2686de9250bb42eb7f4c539bd2280a42e52d33","impliedFormat":1},{"version":"5cbd32af037805215112472e35773bad9d4e03f0e72b1129a0d0c12d9cd63cc7","impliedFormat":1},{"version":"ef61792acbfa8c27c9bd113f02731e66229f7d3a169e3c1993b508134f1a58e0","impliedFormat":1},{"version":"afcb759e8e3ad6549d5798820697002bc07bdd039899fad0bf522e7e8a9f5866","impliedFormat":1},{"version":"f6404e7837b96da3ea4d38c4f1a3812c96c9dcdf264e93d5bdb199f983a3ef4b","impliedFormat":1},{"version":"c5426dbfc1cf90532f66965a7aa8c1136a78d4d0f96d8180ecbfc11d7722f1a5","impliedFormat":1},{"version":"65a15fc47900787c0bd18b603afb98d33ede930bed1798fc984d5ebb78b26cf9","impliedFormat":1},{"version":"9d202701f6e0744adb6314d03d2eb8fc994798fc83d91b691b75b07626a69801","impliedFormat":1},{"version":"de9d2df7663e64e3a91bf495f315a7577e23ba088f2949d5ce9ec96f44fba37d","impliedFormat":1},{"version":"c7af78a2ea7cb1cd009cfb5bdb48cd0b03dad3b54f6da7aab615c2e9e9d570c5","impliedFormat":1},{"version":"1ee45496b5f8bdee6f7abc233355898e5bf9bd51255db65f5ff7ede617ca0027","impliedFormat":1},{"version":"566e5fb812082f8cf929c6727d40924843246cf19ee4e8b9437a6315c4792b03","affectsGlobalScope":true,"impliedFormat":1},{"version":"db01d18853469bcb5601b9fc9826931cc84cc1a1944b33cad76fd6f1e3d8c544","affectsGlobalScope":true,"impliedFormat":1},{"version":"dba114fb6a32b355a9cfc26ca2276834d72fe0e94cd2c3494005547025015369","impliedFormat":1},{"version":"903e299a28282fa7b714586e28409ed73c3b63f5365519776bf78e8cf173db36","affectsGlobalScope":true,"impliedFormat":1},{"version":"fa6c12a7c0f6b84d512f200690bfc74819e99efae69e4c95c4cd30f6884c526e","impliedFormat":1},{"version":"f1c32f9ce9c497da4dc215c3bc84b722ea02497d35f9134db3bb40a8d918b92b","impliedFormat":1},{"version":"b73c319af2cc3ef8f6421308a250f328836531ea3761823b4cabbd133047aefa","affectsGlobalScope":true,"impliedFormat":1},{"version":"e433b0337b8106909e7953015e8fa3f2d30797cea27141d1c5b135365bb975a6","impliedFormat":1},{"version":"dd3900b24a6a8745efeb7ad27629c0f8a626470ac229c1d73f1fe29d67e44dca","impliedFormat":1},{"version":"ddff7fc6edbdc5163a09e22bf8df7bef75f75369ebd7ecea95ba55c4386e2441","impliedFormat":1},{"version":"106c6025f1d99fd468fd8bf6e5bda724e11e5905a4076c5d29790b6c3745e50c","impliedFormat":1},{"version":"ec29be0737d39268696edcec4f5e97ce26f449fa9b7afc2f0f99a86def34a418","impliedFormat":1},{"version":"68a06fb972b2c7e671bf090dc5a5328d22ba07d771376c3d9acd9e7ed786a9db","impliedFormat":1},{"version":"ec6cba1c02c675e4dd173251b156792e8d3b0c816af6d6ad93f1a55d674591aa","impliedFormat":1},{"version":"b620391fe8060cf9bedc176a4d01366e6574d7a71e0ac0ab344a4e76576fcbb8","impliedFormat":1},{"version":"d729408dfde75b451530bcae944cf89ee8277e2a9df04d1f62f2abfd8b03c1e1","impliedFormat":1},{"version":"e15d3c84d5077bb4a3adee4c791022967b764dc41cb8fa3cfa44d4379b2c95f5","impliedFormat":1},{"version":"78244a2a8ab1080e0dd8fc3633c204c9a4be61611d19912f4b157f7ef7367049","impliedFormat":1},{"version":"e1fc1a1045db5aa09366be2b330e4ce391550041fc3e925f60998ca0b647aa97","impliedFormat":1},{"version":"d3f5861c48322adc023d3277e592635402ac008c5beae2e447b335fbf0da56c2","impliedFormat":1},{"version":"43ba4f2fa8c698f5c304d21a3ef596741e8e85a810b7c1f9b692653791d8d97a","impliedFormat":1},{"version":"31fb49ef3aa3d76f0beb644984e01eab0ea222372ea9b49bb6533be5722d756c","impliedFormat":1},{"version":"44c431d059195791915a2aee58f5cef4b333b9996bd256ae55f82ffcf3aa6de4","impliedFormat":1},{"version":"3556cfbab7b43da96d15a442ddbb970e1f2fc97876d055b6555d86d7ac57dae5","impliedFormat":1},{"version":"437751e0352c6e924ddf30e90849f1d9eb00ca78c94d58d6a37202ec84eb8393","impliedFormat":1},{"version":"48e8af7fdb2677a44522fd185d8c87deff4d36ee701ea003c6c780b1407a1397","impliedFormat":1},{"version":"24e1319bd695b0971f0eec3d4e011b7aa996f77b9d854d2703657cf355cac2a7","impliedFormat":1},{"version":"f9812cfc220ecf7557183379531fa409acd249b9e5b9a145d0d52b76c20862de","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b068371563d0396a065ed64b049cffeb4eed89ad433ae7730fc31fb1e00ebf3","impliedFormat":1},{"version":"2e4f37ffe8862b14d8e24ae8763daaa8340c0df0b859d9a9733def0eee7562d9","impliedFormat":1},{"version":"13283350547389802aa35d9f2188effaeac805499169a06ef5cd77ce2a0bd63f","impliedFormat":1},{"version":"680793958f6a70a44c8d9ae7d46b7a385361c69ac29dcab3ed761edce1c14ab8","impliedFormat":1},{"version":"6ac6715916fa75a1f7ebdfeacac09513b4d904b667d827b7535e84ff59679aff","impliedFormat":1},{"version":"42c169fb8c2d42f4f668c624a9a11e719d5d07dacbebb63cbcf7ef365b0a75b3","impliedFormat":1},{"version":"913ddbba170240070bd5921b8f33ea780021bdf42fbdfcd4fcb2691b1884ddde","impliedFormat":1},{"version":"74c105214ddd747037d2a75da6588ec8aa1882f914e1f8a312c528f86feca2b9","impliedFormat":1},{"version":"5fe23bd829e6be57d41929ac374ee9551ccc3c44cee893167b7b5b77be708014","impliedFormat":1},{"version":"4d85f80132e24d9a5b5c5e0734e4ecd6878d8c657cc990ecc70845ef384ca96f","impliedFormat":1},{"version":"438c7513b1df91dcef49b13cd7a1c4720f91a36e88c1df731661608b7c055f10","impliedFormat":1},{"version":"ad444a874f011d3a797f1a41579dbfcc6b246623f49c20009f60e211dbd5315e","impliedFormat":1},{"version":"efaa078e392f9abda3ee8ade3f3762ab77f9c50b184e6883063a911742a4c96a","impliedFormat":1},{"version":"54a8bb487e1dc04591a280e7a673cdfb272c83f61e28d8a64cf1ac2e63c35c51","impliedFormat":1},{"version":"021a9498000497497fd693dd315325484c58a71b5929e2bbb91f419b04b24cea","impliedFormat":1},{"version":"9385cdc09850950bc9b59cca445a3ceb6fcca32b54e7b626e746912e489e535e","impliedFormat":1},{"version":"2894c56cad581928bb37607810af011764a2f511f575d28c9f4af0f2ef02d1ab","impliedFormat":1},{"version":"0a72186f94215d020cb386f7dca81d7495ab6c17066eb07d0f44a5bf33c1b21a","impliedFormat":1},{"version":"84124384abae2f6f66b7fbfc03862d0c2c0b71b826f7dbf42c8085d31f1d3f95","impliedFormat":1},{"version":"63a8e96f65a22604eae82737e409d1536e69a467bb738bec505f4f97cce9d878","impliedFormat":1},{"version":"3fd78152a7031315478f159c6a5872c712ece6f01212c78ea82aef21cb0726e2","impliedFormat":1},{"version":"3a6ed8e1d630cfa1f7edf0dc46a6e20ca6c714dbe754409699008571dfe473a6","impliedFormat":1},{"version":"512fc15cca3a35b8dbbf6e23fe9d07e6f87ad03c895acffd3087ce09f352aad0","impliedFormat":1},{"version":"9a0946d15a005832e432ea0cd4da71b57797efb25b755cc07f32274296d62355","impliedFormat":1},{"version":"a52ff6c0a149e9f370372fc3c715d7f2beee1f3bab7980e271a7ab7d313ec677","impliedFormat":1},{"version":"fd933f824347f9edd919618a76cdb6a0c0085c538115d9a287fa0c7f59957ab3","impliedFormat":1},{"version":"6ac6715916fa75a1f7ebdfeacac09513b4d904b667d827b7535e84ff59679aff","impliedFormat":1},{"version":"6a1aa3e55bdc50503956c5cd09ae4cd72e3072692d742816f65c66ca14f4dfdd","impliedFormat":1},{"version":"ab75cfd9c4f93ffd601f7ca1753d6a9d953bbedfbd7a5b3f0436ac8a1de60dfa","impliedFormat":1},{"version":"59c68235df3905989afa0399381c1198313aaaf1ed387f57937eb616625dff15","impliedFormat":1},{"version":"b73cbf0a72c8800cf8f96a9acfe94f3ad32ca71342a8908b8ae484d61113f647","impliedFormat":1},{"version":"bae6dd176832f6423966647382c0d7ba9e63f8c167522f09a982f086cd4e8b23","impliedFormat":1},{"version":"1364f64d2fb03bbb514edc42224abd576c064f89be6a990136774ecdd881a1da","impliedFormat":1},{"version":"c9958eb32126a3843deedda8c22fb97024aa5d6dd588b90af2d7f2bfac540f23","impliedFormat":1},{"version":"950fb67a59be4c2dbe69a5786292e60a5cb0e8612e0e223537784c731af55db1","impliedFormat":1},{"version":"e927c2c13c4eaf0a7f17e6022eee8519eb29ef42c4c13a31e81a611ab8c95577","impliedFormat":1},{"version":"07ca44e8d8288e69afdec7a31fa408ce6ab90d4f3d620006701d5544646da6aa","impliedFormat":1},{"version":"70246ad95ad8a22bdfe806cb5d383a26c0c6e58e7207ab9c431f1cb175aca657","impliedFormat":1},{"version":"f00f3aa5d64ff46e600648b55a79dcd1333458f7a10da2ed594d9f0a44b76d0b","impliedFormat":1},{"version":"772d8d5eb158b6c92412c03228bd9902ccb1457d7a705b8129814a5d1a6308fc","impliedFormat":1},{"version":"4e4475fba4ed93a72f167b061cd94a2e171b82695c56de9899275e880e06ba41","impliedFormat":1},{"version":"97c5f5d580ab2e4decd0a3135204050f9b97cd7908c5a8fbc041eadede79b2fa","impliedFormat":1},{"version":"49b2375c586882c3ac7f57eba86680ff9742a8d8cb2fe25fe54d1b9673690d41","impliedFormat":1},{"version":"802e797bcab5663b2c9f63f51bdf67eff7c41bc64c0fd65e6da3e7941359e2f7","impliedFormat":1},{"version":"0ccace0fe001af57d74279b66fa35cff2bb6aefc57c5c080be7281474161447b","impliedFormat":1},{"version":"3ecfccf916fea7c6c34394413b55eb70e817a73e39b4417d6573e523784e3f8e","impliedFormat":1},{"version":"c05bc82af01e673afc99bdffd4ebafde22ab027d63e45be9e1f1db3bc39e2fc0","impliedFormat":1},{"version":"6459054aabb306821a043e02b89d54da508e3a6966601a41e71c166e4ea1474f","impliedFormat":1},{"version":"f416c9c3eee9d47ff49132c34f96b9180e50485d435d5748f0e8b72521d28d2e","impliedFormat":1},{"version":"05c97cddbaf99978f83d96de2d8af86aded9332592f08ce4a284d72d0952c391","impliedFormat":1},{"version":"14e5cdec6f8ae82dfd0694e64903a0a54abdfe37e1d966de3d4128362acbf35f","impliedFormat":1},{"version":"bbc183d2d69f4b59fd4dd8799ffdf4eb91173d1c4ad71cce91a3811c021bf80c","impliedFormat":1},{"version":"7b6ff760c8a240b40dab6e4419b989f06a5b782f4710d2967e67c695ef3e93c4","impliedFormat":1},{"version":"8dbc4134a4b3623fc476be5f36de35c40f2768e2e3d9ed437e0d5f1c4cd850f6","impliedFormat":1},{"version":"4e06330a84dec7287f7ebdd64978f41a9f70a668d3b5edc69d5d4a50b9b376bb","impliedFormat":1},{"version":"65bfa72967fbe9fc33353e1ac03f0480aa2e2ea346d61ff3ea997dfd850f641a","impliedFormat":1},{"version":"8f88c6be9803fe5aaa80b00b27f230c824d4b8a33856b865bea5793cb52bb797","impliedFormat":1},{"version":"f974e4a06953682a2c15d5bd5114c0284d5abf8bc0fe4da25cb9159427b70072","impliedFormat":1},{"version":"872caaa31423f4345983d643e4649fb30f548e9883a334d6d1c5fff68ede22d4","impliedFormat":1},{"version":"94404c4a878fe291e7578a2a80264c6f18e9f1933fbb57e48f0eb368672e389c","impliedFormat":1},{"version":"5c1b7f03aa88be854bc15810bfd5bd5a1943c5a7620e1c53eddd2a013996343e","impliedFormat":1},{"version":"09dfc64fcd6a2785867f2368419859a6cc5a8d4e73cbe2538f205b1642eb0f51","impliedFormat":1},{"version":"bcf6f0a323653e72199105a9316d91463ad4744c546d1271310818b8cef7c608","impliedFormat":1},{"version":"01aa917531e116485beca44a14970834687b857757159769c16b228eb1e49c5f","impliedFormat":1},{"version":"351475f9c874c62f9b45b1f0dc7e2704e80dfd5f1af83a3a9f841f9dfe5b2912","impliedFormat":1},{"version":"ac457ad39e531b7649e7b40ee5847606eac64e236efd76c5d12db95bf4eacd17","impliedFormat":1},{"version":"187a6fdbdecb972510b7555f3caacb44b58415da8d5825d03a583c4b73fde4cf","impliedFormat":1},{"version":"d4c3250105a612202289b3a266bb7e323db144f6b9414f9dea85c531c098b811","impliedFormat":1},{"version":"95b444b8c311f2084f0fb51c616163f950fb2e35f4eaa07878f313a2d36c98a4","impliedFormat":1},{"version":"741067675daa6d4334a2dc80a4452ca3850e89d5852e330db7cb2b5f867173b1","impliedFormat":1},{"version":"f8acecec1114f11690956e007d920044799aefeb3cece9e7f4b1f8a1d542b2c9","impliedFormat":1},{"version":"131b1475d2045f20fb9f43b7aa6b7cb51f25250b5e4c6a1d4aa3cf4dd1a68793","impliedFormat":1},{"version":"3a17f09634c50cce884721f54fd9e7b98e03ac505889c560876291fcf8a09e90","impliedFormat":1},{"version":"32531dfbb0cdc4525296648f53b2b5c39b64282791e2a8c765712e49e6461046","impliedFormat":1},{"version":"0ce1b2237c1c3df49748d61568160d780d7b26693bd9feb3acb0744a152cd86d","impliedFormat":1},{"version":"e489985388e2c71d3542612685b4a7db326922b57ac880f299da7026a4e8a117","impliedFormat":1},{"version":"e1437c5f191edb7a494f7bbbc033b97d72d42e054d521402ee194ac5b6b7bf49","impliedFormat":1},{"version":"04d3aad777b6af5bd000bfc409907a159fe77e190b9d368da4ba649cdc28d39e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fd1b9d883b9446f1e1da1e1033a6a98995c25fbf3c10818a78960e2f2917d10c","impliedFormat":1},{"version":"19252079538942a69be1645e153f7dbbc1ef56b4f983c633bf31fe26aeac32cd","impliedFormat":1},{"version":"bc11f3ac00ac060462597add171220aed628c393f2782ac75dd29ff1e0db871c","impliedFormat":1},{"version":"616775f16134fa9d01fc677ad3f76e68c051a056c22ab552c64cc281a9686790","impliedFormat":1},{"version":"65c24a8baa2cca1de069a0ba9fba82a173690f52d7e2d0f1f7542d59d5eb4db0","impliedFormat":1},{"version":"313c85c332bb6892d5f7c624dc39107ca7a6b2f1b3212db86dbbefbe7f8ddd5a","impliedFormat":1},{"version":"3b0b1d352b8d2e47f1c4df4fb0678702aee071155b12ef0185fce9eb4fa4af1e","impliedFormat":1},{"version":"77e71242e71ebf8528c5802993697878f0533db8f2299b4d36aa015bae08a79c","impliedFormat":1},{"version":"a344403e7a7384e0e7093942533d309194ad0a53eca2a3100c0b0ab4d3932773","impliedFormat":1},{"version":"b7fff2d004c5879cae335db8f954eb1d61242d9f2d28515e67902032723caeab","impliedFormat":1},{"version":"5f3dc10ae646f375776b4e028d2bed039a93eebbba105694d8b910feebbe8b9c","impliedFormat":1},{"version":"bb18bf4a61a17b4a6199eb3938ecfa4a59eb7c40843ad4a82b975ab6f7e3d925","impliedFormat":1},{"version":"4545c1a1ceca170d5d83452dd7c4994644c35cf676a671412601689d9a62da35","impliedFormat":1},{"version":"e9b6fc05f536dfddcdc65dbcf04e09391b1c968ab967382e48924f5cb90d88e1","impliedFormat":1},{"version":"a2d648d333cf67b9aeac5d81a1a379d563a8ffa91ddd61c6179f68de724260ff","impliedFormat":1},{"version":"2b664c3cc544d0e35276e1fb2d4989f7d4b4027ffc64da34ec83a6ccf2e5c528","impliedFormat":1},{"version":"a3f41ed1b4f2fc3049394b945a68ae4fdefd49fa1739c32f149d32c0545d67f5","impliedFormat":1},{"version":"3cd8f0464e0939b47bfccbb9bb474a6d87d57210e304029cd8eb59c63a81935d","impliedFormat":1},{"version":"47699512e6d8bebf7be488182427189f999affe3addc1c87c882d36b7f2d0b0e","impliedFormat":1},{"version":"3026abd48e5e312f2328629ede6e0f770d21c3cd32cee705c450e589d015ee09","impliedFormat":1},{"version":"8b140b398a6afbd17cc97c38aea5274b2f7f39b1ae5b62952cfe65bf493e3e75","impliedFormat":1},{"version":"7663d2c19ce5ef8288c790edba3d45af54e58c84f1b37b1249f6d49d962f3d91","impliedFormat":1},{"version":"30112425b2cf042fca1c79c19e35f88f44bfb2e97454527528cd639dd1a460ca","impliedFormat":1},{"version":"00bd6ebe607246b45296aa2b805bd6a58c859acecda154bfa91f5334d7c175c6","impliedFormat":1},{"version":"ad036a85efcd9e5b4f7dd5c1a7362c8478f9a3b6c3554654ca24a29aa850a9c5","impliedFormat":1},{"version":"fedebeae32c5cdd1a85b4e0504a01996e4a8adf3dfa72876920d3dd6e42978e7","impliedFormat":1},{"version":"504f37ba38bfea8394ec4f397c9a2ade7c78055e41ef5a600073b515c4fd0fc9","impliedFormat":1},{"version":"cdf21eee8007e339b1b9945abf4a7b44930b1d695cc528459e68a3adc39a622e","impliedFormat":1},{"version":"db036c56f79186da50af66511d37d9fe77fa6793381927292d17f81f787bb195","impliedFormat":1},{"version":"87ac2fb61e629e777f4d161dff534c2023ee15afd9cb3b1589b9b1f014e75c58","impliedFormat":1},{"version":"13c8b4348db91e2f7d694adc17e7438e6776bc506d5c8f5de9ad9989707fa3fe","impliedFormat":1},{"version":"3c1051617aa50b38e9efaabce25e10a5dd9b1f42e372ef0e8a674076a68742ed","impliedFormat":1},{"version":"07a3e20cdcb0f1182f452c0410606711fbea922ca76929a41aacb01104bc0d27","impliedFormat":1},{"version":"1de80059b8078ea5749941c9f863aa970b4735bdbb003be4925c853a8b6b4450","impliedFormat":1},{"version":"1d079c37fa53e3c21ed3fa214a27507bda9991f2a41458705b19ed8c2b61173d","impliedFormat":1},{"version":"4cd4b6b1279e9d744a3825cbd7757bbefe7f0708f3f1069179ad535f19e8ed2c","impliedFormat":1},{"version":"5835a6e0d7cd2738e56b671af0e561e7c1b4fb77751383672f4b009f4e161d70","impliedFormat":1},{"version":"c0eeaaa67c85c3bb6c52b629ebbfd3b2292dc67e8c0ffda2fc6cd2f78dc471e6","impliedFormat":1},{"version":"4b7f74b772140395e7af67c4841be1ab867c11b3b82a51b1aeb692822b76c872","impliedFormat":1},{"version":"27be6622e2922a1b412eb057faa854831b95db9db5035c3f6d4b677b902ab3b7","impliedFormat":1},{"version":"b95a6f019095dd1d48fd04965b50dfd63e5743a6e75478343c46d2582a5132bf","impliedFormat":99},{"version":"c2008605e78208cfa9cd70bd29856b72dda7ad89df5dc895920f8e10bcb9cd0a","impliedFormat":99},{"version":"b97cb5616d2ab82a98ec9ada7b9e9cabb1f5da880ec50ea2b8dc5baa4cbf3c16","impliedFormat":99},{"version":"d23df9ff06ae8bf1dcb7cc933e97ae7da418ac77749fecee758bb43a8d69f840","affectsGlobalScope":true,"impliedFormat":1},{"version":"040c71dde2c406f869ad2f41e8d4ce579cc60c8dbe5aa0dd8962ac943b846572","affectsGlobalScope":true,"impliedFormat":1},{"version":"3586f5ea3cc27083a17bd5c9059ede9421d587286d5a47f4341a4c2d00e4fa91","impliedFormat":1},{"version":"a6df929821e62f4719551f7955b9f42c0cd53c1370aec2dd322e24196a7dfe33","impliedFormat":1},{"version":"b789bf89eb19c777ed1e956dbad0925ca795701552d22e68fd130a032008b9f9","impliedFormat":1},"9269d492817e359123ac64c8205e5d05dab63d71a3a7a229e68b5d9a0e8150bf","ccc60f5f89d80d3c2e3c1ae2e09153b269c217ae05667b81bb1e06a6459ff4a8","18e3f256291b3bb35cb22762a2fead80683933344bad585d8efe36515a636e18","16a1968855e8e8e4c2f354b03fe6f533c7d007c5e218bb5dbda84d8db19301f9","527f232a6ce4ad97b50fdf238de918037cef1159c6cf5cdea163a94163933ecf","547472bb37a24992be0f97a940d796617234a0447d0924eb71abc5707ddc086a","516b409c6ded059b7938fa19dbbf1e982c82966a305c9331df43cb8760e3df25","d3aa2960fd78d972068b0bba251699f8cc24ae4af4b0d4d95479a5d73ec0424e",{"version":"b51fb3ae19c62cea8c1aad18a569b939b1203cf0f0beede96a95c9ef00dc821d","impliedFormat":1},"eecbc2ac9b2bfdd7120cce72d6487a164becc5a9ed3b8a49a83de3f5a211cd5e","e6a95bf8c6f0c19fa0bb12803fbedbd2d127ac9fe19e8ab49c854e9dd9a5c163","0523c75c01ecdd8a05c1b432afe9dee5739c29010f21fdcb1a09d7f5bb2143a9","4e0faf1198561c98b3cd6a2c65e2d5dbd1668ded6c3a530cc03d0432b7e2e642","7aa47dbe20f7722a1e16d765dcd13dec7cedaea1a9a551c035bb77466c61680c","eb4c413c8b2eb7128e0e9c3fc1fd94be4ac0262896411b555dbccbd10d5fb590","fc546ab93cd4e76ff44f1b7119fe9d39b0b61dbe5535d27a9ac4ef66c8a97991","3912036b6a602c60eeb3079cd9030c8686b2a650c16b24b39c7add2ad988acd0"],"root":[[404,411],[413,420]],"options":{"allowJs":true,"esModuleInterop":true,"jsx":1,"module":99,"skipLibCheck":true,"strict":true},"referencedMap":[[418,1],[419,2],[420,3],[404,4],[357,5],[142,6],[143,6],[144,7],[99,8],[145,9],[146,10],[147,11],[94,5],[97,12],[95,5],[96,5],[148,13],[149,14],[150,15],[151,16],[152,17],[153,18],[154,18],[155,19],[156,20],[157,21],[158,22],[100,5],[98,5],[159,23],[160,24],[161,25],[193,26],[162,27],[163,28],[164,29],[165,30],[166,31],[167,32],[168,33],[169,34],[170,35],[171,36],[172,36],[173,37],[174,5],[175,38],[177,39],[176,40],[178,41],[179,42],[180,43],[181,44],[182,45],[183,46],[184,47],[185,48],[186,49],[187,50],[188,51],[189,52],[190,53],[101,5],[102,5],[103,5],[141,54],[191,55],[192,56],[86,5],[198,57],[199,58],[197,59],[195,60],[196,61],[84,5],[87,62],[283,59],[85,5],[412,59],[93,63],[360,64],[364,65],[366,66],[219,67],[233,68],[331,69],[264,5],[334,70],[297,71],[305,72],[332,73],[220,74],[263,5],[265,75],[333,76],[240,77],[221,78],[244,77],[234,77],[204,77],[289,79],[209,5],[286,80],[290,81],[375,82],[284,81],[376,83],[270,5],[287,84],[388,85],[387,86],[292,81],[386,5],[384,5],[385,87],[288,59],[276,88],[285,89],[300,90],[301,91],[291,92],[272,93],[379,94],[382,95],[251,96],[250,97],[249,98],[391,59],[248,99],[225,5],[394,5],[397,5],[396,59],[398,100],[200,5],[325,5],[232,101],[202,102],[348,5],[349,5],[351,5],[354,103],[350,5],[352,104],[353,104],[218,5],[231,5],[359,105],[367,106],[371,107],[214,108],[278,109],[277,5],[271,110],[296,111],[294,112],[293,5],[295,5],[299,113],[274,114],[213,115],[238,116],[322,117],[205,118],[212,119],[201,69],[336,120],[346,121],[335,5],[345,122],[239,5],[223,123],[314,124],[313,5],[321,125],[315,126],[319,127],[320,128],[318,126],[317,128],[316,126],[260,129],[245,129],[308,130],[246,130],[207,131],[206,5],[312,132],[311,133],[310,134],[309,135],[208,136],[282,137],[298,138],[281,139],[304,140],[306,141],[303,139],[241,136],[194,5],[323,142],[266,143],[344,144],[269,145],[339,146],[211,5],[340,147],[342,148],[343,149],[326,5],[338,118],[242,150],[324,151],[347,152],[215,5],[217,5],[222,153],[307,154],[210,155],[216,5],[268,156],[267,157],[224,158],[275,159],[273,160],[226,161],[228,162],[395,5],[227,163],[229,164],[362,5],[361,5],[363,5],[393,5],[230,165],[280,59],[92,5],[302,166],[252,5],[262,167],[369,59],[378,168],[259,59],[373,81],[258,169],[356,170],[257,168],[203,5],[380,171],[255,59],[256,59],[247,5],[261,5],[254,172],[253,173],[243,174],[237,92],[341,5],[236,175],[235,5],[365,5],[279,59],[358,176],[83,5],[91,177],[88,59],[89,5],[90,5],[337,178],[330,179],[329,5],[328,180],[327,5],[368,181],[370,182],[372,183],[374,184],[377,185],[403,186],[381,186],[402,187],[383,188],[389,189],[390,190],[392,191],[399,192],[401,5],[400,193],[355,194],[81,5],[82,5],[13,5],[14,5],[16,5],[15,5],[2,5],[17,5],[18,5],[19,5],[20,5],[21,5],[22,5],[23,5],[24,5],[3,5],[25,5],[26,5],[4,5],[27,5],[31,5],[28,5],[29,5],[30,5],[32,5],[33,5],[34,5],[5,5],[35,5],[36,5],[37,5],[38,5],[6,5],[42,5],[39,5],[40,5],[41,5],[43,5],[7,5],[44,5],[49,5],[50,5],[45,5],[46,5],[47,5],[48,5],[8,5],[54,5],[51,5],[52,5],[53,5],[55,5],[9,5],[56,5],[57,5],[58,5],[60,5],[59,5],[61,5],[62,5],[10,5],[63,5],[64,5],[65,5],[11,5],[66,5],[67,5],[68,5],[69,5],[70,5],[1,5],[71,5],[72,5],[12,5],[76,5],[74,5],[79,5],[78,5],[73,5],[77,5],[75,5],[80,5],[119,195],[129,196],[118,195],[139,197],[110,198],[109,199],[138,193],[132,200],[137,201],[112,202],[126,203],[111,204],[135,205],[107,206],[106,193],[136,207],[108,208],[113,209],[114,5],[117,209],[104,5],[140,210],[130,211],[121,212],[122,213],[124,214],[120,215],[123,216],[133,193],[115,217],[116,218],[125,219],[105,220],[128,211],[127,209],[131,5],[134,221],[407,222],[408,223],[409,223],[410,59],[411,224],[413,225],[414,226],[415,227],[416,225],[417,228],[406,227],[405,5]],"affectedFilesPendingEmit":[418,419,420,407,408,409,410,411,413,414,415,416,417,406,405],"version":"5.9.3"} +{"fileNames":["./node_modules/typescript/lib/lib.es5.d.ts","./node_modules/typescript/lib/lib.es2015.d.ts","./node_modules/typescript/lib/lib.es2016.d.ts","./node_modules/typescript/lib/lib.es2017.d.ts","./node_modules/typescript/lib/lib.es2018.d.ts","./node_modules/typescript/lib/lib.es2019.d.ts","./node_modules/typescript/lib/lib.es2020.d.ts","./node_modules/typescript/lib/lib.es2021.d.ts","./node_modules/typescript/lib/lib.es2022.d.ts","./node_modules/typescript/lib/lib.es2023.d.ts","./node_modules/typescript/lib/lib.es2024.d.ts","./node_modules/typescript/lib/lib.esnext.d.ts","./node_modules/typescript/lib/lib.dom.d.ts","./node_modules/typescript/lib/lib.dom.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.core.d.ts","./node_modules/typescript/lib/lib.es2015.collection.d.ts","./node_modules/typescript/lib/lib.es2015.generator.d.ts","./node_modules/typescript/lib/lib.es2015.iterable.d.ts","./node_modules/typescript/lib/lib.es2015.promise.d.ts","./node_modules/typescript/lib/lib.es2015.proxy.d.ts","./node_modules/typescript/lib/lib.es2015.reflect.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.d.ts","./node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2016.array.include.d.ts","./node_modules/typescript/lib/lib.es2016.intl.d.ts","./node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2017.date.d.ts","./node_modules/typescript/lib/lib.es2017.object.d.ts","./node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2017.string.d.ts","./node_modules/typescript/lib/lib.es2017.intl.d.ts","./node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","./node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","./node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","./node_modules/typescript/lib/lib.es2018.intl.d.ts","./node_modules/typescript/lib/lib.es2018.promise.d.ts","./node_modules/typescript/lib/lib.es2018.regexp.d.ts","./node_modules/typescript/lib/lib.es2019.array.d.ts","./node_modules/typescript/lib/lib.es2019.object.d.ts","./node_modules/typescript/lib/lib.es2019.string.d.ts","./node_modules/typescript/lib/lib.es2019.symbol.d.ts","./node_modules/typescript/lib/lib.es2019.intl.d.ts","./node_modules/typescript/lib/lib.es2020.bigint.d.ts","./node_modules/typescript/lib/lib.es2020.date.d.ts","./node_modules/typescript/lib/lib.es2020.promise.d.ts","./node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2020.string.d.ts","./node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","./node_modules/typescript/lib/lib.es2020.intl.d.ts","./node_modules/typescript/lib/lib.es2020.number.d.ts","./node_modules/typescript/lib/lib.es2021.promise.d.ts","./node_modules/typescript/lib/lib.es2021.string.d.ts","./node_modules/typescript/lib/lib.es2021.weakref.d.ts","./node_modules/typescript/lib/lib.es2021.intl.d.ts","./node_modules/typescript/lib/lib.es2022.array.d.ts","./node_modules/typescript/lib/lib.es2022.error.d.ts","./node_modules/typescript/lib/lib.es2022.intl.d.ts","./node_modules/typescript/lib/lib.es2022.object.d.ts","./node_modules/typescript/lib/lib.es2022.string.d.ts","./node_modules/typescript/lib/lib.es2022.regexp.d.ts","./node_modules/typescript/lib/lib.es2023.array.d.ts","./node_modules/typescript/lib/lib.es2023.collection.d.ts","./node_modules/typescript/lib/lib.es2023.intl.d.ts","./node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","./node_modules/typescript/lib/lib.es2024.collection.d.ts","./node_modules/typescript/lib/lib.es2024.object.d.ts","./node_modules/typescript/lib/lib.es2024.promise.d.ts","./node_modules/typescript/lib/lib.es2024.regexp.d.ts","./node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","./node_modules/typescript/lib/lib.es2024.string.d.ts","./node_modules/typescript/lib/lib.esnext.array.d.ts","./node_modules/typescript/lib/lib.esnext.collection.d.ts","./node_modules/typescript/lib/lib.esnext.intl.d.ts","./node_modules/typescript/lib/lib.esnext.disposable.d.ts","./node_modules/typescript/lib/lib.esnext.promise.d.ts","./node_modules/typescript/lib/lib.esnext.decorators.d.ts","./node_modules/typescript/lib/lib.esnext.iterator.d.ts","./node_modules/typescript/lib/lib.esnext.float16.d.ts","./node_modules/typescript/lib/lib.esnext.error.d.ts","./node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","./node_modules/typescript/lib/lib.decorators.d.ts","./node_modules/typescript/lib/lib.decorators.legacy.d.ts","./node_modules/next/dist/styled-jsx/types/css.d.ts","./node_modules/@types/react/global.d.ts","./node_modules/csstype/index.d.ts","./node_modules/@types/prop-types/index.d.ts","./node_modules/@types/react/index.d.ts","./node_modules/next/dist/styled-jsx/types/index.d.ts","./node_modules/next/dist/styled-jsx/types/macro.d.ts","./node_modules/next/dist/styled-jsx/types/style.d.ts","./node_modules/next/dist/styled-jsx/types/global.d.ts","./node_modules/next/dist/shared/lib/amp.d.ts","./node_modules/next/amp.d.ts","./node_modules/@types/node/compatibility/disposable.d.ts","./node_modules/@types/node/compatibility/indexable.d.ts","./node_modules/@types/node/compatibility/iterators.d.ts","./node_modules/@types/node/compatibility/index.d.ts","./node_modules/@types/node/globals.typedarray.d.ts","./node_modules/@types/node/buffer.buffer.d.ts","./node_modules/@types/node/globals.d.ts","./node_modules/@types/node/web-globals/abortcontroller.d.ts","./node_modules/@types/node/web-globals/domexception.d.ts","./node_modules/@types/node/web-globals/events.d.ts","./node_modules/undici-types/header.d.ts","./node_modules/undici-types/readable.d.ts","./node_modules/undici-types/file.d.ts","./node_modules/undici-types/fetch.d.ts","./node_modules/undici-types/formdata.d.ts","./node_modules/undici-types/connector.d.ts","./node_modules/undici-types/client.d.ts","./node_modules/undici-types/errors.d.ts","./node_modules/undici-types/dispatcher.d.ts","./node_modules/undici-types/global-dispatcher.d.ts","./node_modules/undici-types/global-origin.d.ts","./node_modules/undici-types/pool-stats.d.ts","./node_modules/undici-types/pool.d.ts","./node_modules/undici-types/handlers.d.ts","./node_modules/undici-types/balanced-pool.d.ts","./node_modules/undici-types/agent.d.ts","./node_modules/undici-types/mock-interceptor.d.ts","./node_modules/undici-types/mock-agent.d.ts","./node_modules/undici-types/mock-client.d.ts","./node_modules/undici-types/mock-pool.d.ts","./node_modules/undici-types/mock-errors.d.ts","./node_modules/undici-types/proxy-agent.d.ts","./node_modules/undici-types/env-http-proxy-agent.d.ts","./node_modules/undici-types/retry-handler.d.ts","./node_modules/undici-types/retry-agent.d.ts","./node_modules/undici-types/api.d.ts","./node_modules/undici-types/interceptors.d.ts","./node_modules/undici-types/util.d.ts","./node_modules/undici-types/cookies.d.ts","./node_modules/undici-types/patch.d.ts","./node_modules/undici-types/websocket.d.ts","./node_modules/undici-types/eventsource.d.ts","./node_modules/undici-types/filereader.d.ts","./node_modules/undici-types/diagnostics-channel.d.ts","./node_modules/undici-types/content-type.d.ts","./node_modules/undici-types/cache.d.ts","./node_modules/undici-types/index.d.ts","./node_modules/@types/node/web-globals/fetch.d.ts","./node_modules/@types/node/assert.d.ts","./node_modules/@types/node/assert/strict.d.ts","./node_modules/@types/node/async_hooks.d.ts","./node_modules/@types/node/buffer.d.ts","./node_modules/@types/node/child_process.d.ts","./node_modules/@types/node/cluster.d.ts","./node_modules/@types/node/console.d.ts","./node_modules/@types/node/constants.d.ts","./node_modules/@types/node/crypto.d.ts","./node_modules/@types/node/dgram.d.ts","./node_modules/@types/node/diagnostics_channel.d.ts","./node_modules/@types/node/dns.d.ts","./node_modules/@types/node/dns/promises.d.ts","./node_modules/@types/node/domain.d.ts","./node_modules/@types/node/events.d.ts","./node_modules/@types/node/fs.d.ts","./node_modules/@types/node/fs/promises.d.ts","./node_modules/@types/node/http.d.ts","./node_modules/@types/node/http2.d.ts","./node_modules/@types/node/https.d.ts","./node_modules/@types/node/inspector.generated.d.ts","./node_modules/@types/node/module.d.ts","./node_modules/@types/node/net.d.ts","./node_modules/@types/node/os.d.ts","./node_modules/@types/node/path.d.ts","./node_modules/@types/node/perf_hooks.d.ts","./node_modules/@types/node/process.d.ts","./node_modules/@types/node/punycode.d.ts","./node_modules/@types/node/querystring.d.ts","./node_modules/@types/node/readline.d.ts","./node_modules/@types/node/readline/promises.d.ts","./node_modules/@types/node/repl.d.ts","./node_modules/@types/node/sea.d.ts","./node_modules/@types/node/stream.d.ts","./node_modules/@types/node/stream/promises.d.ts","./node_modules/@types/node/stream/consumers.d.ts","./node_modules/@types/node/stream/web.d.ts","./node_modules/@types/node/string_decoder.d.ts","./node_modules/@types/node/test.d.ts","./node_modules/@types/node/timers.d.ts","./node_modules/@types/node/timers/promises.d.ts","./node_modules/@types/node/tls.d.ts","./node_modules/@types/node/trace_events.d.ts","./node_modules/@types/node/tty.d.ts","./node_modules/@types/node/url.d.ts","./node_modules/@types/node/util.d.ts","./node_modules/@types/node/v8.d.ts","./node_modules/@types/node/vm.d.ts","./node_modules/@types/node/wasi.d.ts","./node_modules/@types/node/worker_threads.d.ts","./node_modules/@types/node/zlib.d.ts","./node_modules/@types/node/index.d.ts","./node_modules/next/dist/server/get-page-files.d.ts","./node_modules/@types/react/canary.d.ts","./node_modules/@types/react/experimental.d.ts","./node_modules/@types/react-dom/index.d.ts","./node_modules/@types/react-dom/canary.d.ts","./node_modules/@types/react-dom/experimental.d.ts","./node_modules/next/dist/compiled/webpack/webpack.d.ts","./node_modules/next/dist/server/config.d.ts","./node_modules/next/dist/lib/load-custom-routes.d.ts","./node_modules/next/dist/shared/lib/image-config.d.ts","./node_modules/next/dist/build/webpack/plugins/subresource-integrity-plugin.d.ts","./node_modules/next/dist/server/body-streams.d.ts","./node_modules/next/dist/server/future/route-kind.d.ts","./node_modules/next/dist/server/future/route-definitions/route-definition.d.ts","./node_modules/next/dist/server/future/route-matches/route-match.d.ts","./node_modules/next/dist/client/components/app-router-headers.d.ts","./node_modules/next/dist/server/request-meta.d.ts","./node_modules/next/dist/server/lib/revalidate.d.ts","./node_modules/next/dist/server/config-shared.d.ts","./node_modules/next/dist/server/base-http/index.d.ts","./node_modules/next/dist/server/api-utils/index.d.ts","./node_modules/next/dist/server/node-environment.d.ts","./node_modules/next/dist/server/require-hook.d.ts","./node_modules/next/dist/server/node-polyfill-crypto.d.ts","./node_modules/next/dist/lib/page-types.d.ts","./node_modules/next/dist/build/analysis/get-page-static-info.d.ts","./node_modules/next/dist/build/webpack/loaders/get-module-build-info.d.ts","./node_modules/next/dist/build/webpack/plugins/middleware-plugin.d.ts","./node_modules/next/dist/server/render-result.d.ts","./node_modules/next/dist/server/future/helpers/i18n-provider.d.ts","./node_modules/next/dist/server/web/next-url.d.ts","./node_modules/next/dist/compiled/@edge-runtime/cookies/index.d.ts","./node_modules/next/dist/server/web/spec-extension/cookies.d.ts","./node_modules/next/dist/server/web/spec-extension/request.d.ts","./node_modules/next/dist/server/web/spec-extension/fetch-event.d.ts","./node_modules/next/dist/server/web/spec-extension/response.d.ts","./node_modules/next/dist/server/web/types.d.ts","./node_modules/next/dist/lib/setup-exception-listeners.d.ts","./node_modules/next/dist/lib/constants.d.ts","./node_modules/next/dist/build/index.d.ts","./node_modules/next/dist/build/webpack/plugins/pages-manifest-plugin.d.ts","./node_modules/next/dist/shared/lib/router/utils/route-regex.d.ts","./node_modules/next/dist/shared/lib/router/utils/route-matcher.d.ts","./node_modules/next/dist/shared/lib/router/utils/parse-url.d.ts","./node_modules/next/dist/server/base-http/node.d.ts","./node_modules/next/dist/server/font-utils.d.ts","./node_modules/next/dist/build/webpack/plugins/flight-manifest-plugin.d.ts","./node_modules/next/dist/server/future/route-modules/route-module.d.ts","./node_modules/next/dist/server/load-components.d.ts","./node_modules/next/dist/shared/lib/router/utils/middleware-route-matcher.d.ts","./node_modules/next/dist/build/webpack/plugins/next-font-manifest-plugin.d.ts","./node_modules/next/dist/server/future/route-definitions/locale-route-definition.d.ts","./node_modules/next/dist/server/future/route-definitions/pages-route-definition.d.ts","./node_modules/next/dist/shared/lib/mitt.d.ts","./node_modules/next/dist/client/with-router.d.ts","./node_modules/next/dist/client/router.d.ts","./node_modules/next/dist/client/route-loader.d.ts","./node_modules/next/dist/client/page-loader.d.ts","./node_modules/next/dist/shared/lib/bloom-filter.d.ts","./node_modules/next/dist/shared/lib/router/router.d.ts","./node_modules/next/dist/shared/lib/router-context.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/loadable-context.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/loadable.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/image-config-context.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/hooks-client-context.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/head-manager-context.shared-runtime.d.ts","./node_modules/next/dist/server/future/route-definitions/app-page-route-definition.d.ts","./node_modules/next/dist/shared/lib/modern-browserslist-target.d.ts","./node_modules/next/dist/shared/lib/constants.d.ts","./node_modules/next/dist/build/webpack/loaders/metadata/types.d.ts","./node_modules/next/dist/build/page-extensions-type.d.ts","./node_modules/next/dist/build/webpack/loaders/next-app-loader.d.ts","./node_modules/next/dist/server/lib/app-dir-module.d.ts","./node_modules/next/dist/server/response-cache/types.d.ts","./node_modules/next/dist/server/response-cache/index.d.ts","./node_modules/next/dist/server/lib/incremental-cache/index.d.ts","./node_modules/next/dist/client/components/hooks-server-context.d.ts","./node_modules/next/dist/server/app-render/dynamic-rendering.d.ts","./node_modules/next/dist/client/components/static-generation-async-storage.external.d.ts","./node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.d.ts","./node_modules/next/dist/server/async-storage/draft-mode-provider.d.ts","./node_modules/next/dist/server/web/spec-extension/adapters/headers.d.ts","./node_modules/next/dist/client/components/request-async-storage.external.d.ts","./node_modules/next/dist/server/app-render/create-error-handler.d.ts","./node_modules/next/dist/server/app-render/app-render.d.ts","./node_modules/next/dist/shared/lib/server-inserted-html.shared-runtime.d.ts","./node_modules/next/dist/shared/lib/amp-context.shared-runtime.d.ts","./node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/entrypoints.d.ts","./node_modules/next/dist/server/future/route-modules/app-page/module.compiled.d.ts","./node_modules/@types/react/jsx-runtime.d.ts","./node_modules/next/dist/client/components/error-boundary.d.ts","./node_modules/next/dist/client/components/router-reducer/create-initial-router-state.d.ts","./node_modules/next/dist/client/components/app-router.d.ts","./node_modules/next/dist/client/components/layout-router.d.ts","./node_modules/next/dist/client/components/render-from-template-context.d.ts","./node_modules/next/dist/client/components/action-async-storage.external.d.ts","./node_modules/next/dist/client/components/client-page.d.ts","./node_modules/next/dist/client/components/search-params.d.ts","./node_modules/next/dist/client/components/not-found-boundary.d.ts","./node_modules/next/dist/server/app-render/rsc/preloads.d.ts","./node_modules/next/dist/server/app-render/rsc/postpone.d.ts","./node_modules/next/dist/server/app-render/rsc/taint.d.ts","./node_modules/next/dist/server/app-render/entry-base.d.ts","./node_modules/next/dist/build/templates/app-page.d.ts","./node_modules/next/dist/server/future/route-modules/app-page/module.d.ts","./node_modules/next/dist/server/app-render/types.d.ts","./node_modules/next/dist/client/components/router-reducer/fetch-server-response.d.ts","./node_modules/next/dist/client/components/router-reducer/router-reducer-types.d.ts","./node_modules/next/dist/shared/lib/app-router-context.shared-runtime.d.ts","./node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/entrypoints.d.ts","./node_modules/next/dist/server/future/route-modules/pages/module.compiled.d.ts","./node_modules/next/dist/build/templates/pages.d.ts","./node_modules/next/dist/server/future/route-modules/pages/module.d.ts","./node_modules/next/dist/server/render.d.ts","./node_modules/next/dist/server/future/route-definitions/pages-api-route-definition.d.ts","./node_modules/next/dist/server/future/route-matches/pages-api-route-match.d.ts","./node_modules/next/dist/server/future/route-matchers/route-matcher.d.ts","./node_modules/next/dist/server/future/route-matcher-providers/route-matcher-provider.d.ts","./node_modules/next/dist/server/future/route-matcher-managers/route-matcher-manager.d.ts","./node_modules/next/dist/server/future/normalizers/normalizer.d.ts","./node_modules/next/dist/server/future/normalizers/locale-route-normalizer.d.ts","./node_modules/next/dist/server/future/normalizers/request/pathname-normalizer.d.ts","./node_modules/next/dist/server/future/normalizers/request/suffix.d.ts","./node_modules/next/dist/server/future/normalizers/request/rsc.d.ts","./node_modules/next/dist/server/future/normalizers/request/prefix.d.ts","./node_modules/next/dist/server/future/normalizers/request/postponed.d.ts","./node_modules/next/dist/server/future/normalizers/request/prefetch-rsc.d.ts","./node_modules/next/dist/server/future/normalizers/request/next-data.d.ts","./node_modules/next/dist/server/base-server.d.ts","./node_modules/next/dist/server/image-optimizer.d.ts","./node_modules/next/dist/server/next-server.d.ts","./node_modules/next/dist/lib/coalesced-function.d.ts","./node_modules/next/dist/server/lib/router-utils/types.d.ts","./node_modules/next/dist/trace/types.d.ts","./node_modules/next/dist/trace/trace.d.ts","./node_modules/next/dist/trace/shared.d.ts","./node_modules/next/dist/trace/index.d.ts","./node_modules/next/dist/build/load-jsconfig.d.ts","./node_modules/next/dist/build/webpack-config.d.ts","./node_modules/next/dist/build/webpack/plugins/define-env-plugin.d.ts","./node_modules/next/dist/build/swc/index.d.ts","./node_modules/next/dist/server/dev/parse-version-info.d.ts","./node_modules/next/dist/server/dev/hot-reloader-types.d.ts","./node_modules/next/dist/telemetry/storage.d.ts","./node_modules/next/dist/server/lib/types.d.ts","./node_modules/next/dist/server/lib/render-server.d.ts","./node_modules/next/dist/server/lib/router-server.d.ts","./node_modules/next/dist/shared/lib/router/utils/path-match.d.ts","./node_modules/next/dist/server/lib/router-utils/filesystem.d.ts","./node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.d.ts","./node_modules/next/dist/server/lib/dev-bundler-service.d.ts","./node_modules/next/dist/server/dev/static-paths-worker.d.ts","./node_modules/next/dist/server/dev/next-dev-server.d.ts","./node_modules/next/dist/server/next.d.ts","./node_modules/next/dist/lib/metadata/types/alternative-urls-types.d.ts","./node_modules/next/dist/lib/metadata/types/extra-types.d.ts","./node_modules/next/dist/lib/metadata/types/metadata-types.d.ts","./node_modules/next/dist/lib/metadata/types/manifest-types.d.ts","./node_modules/next/dist/lib/metadata/types/opengraph-types.d.ts","./node_modules/next/dist/lib/metadata/types/twitter-types.d.ts","./node_modules/next/dist/lib/metadata/types/metadata-interface.d.ts","./node_modules/next/types/index.d.ts","./node_modules/next/dist/shared/lib/html-context.shared-runtime.d.ts","./node_modules/@next/env/dist/index.d.ts","./node_modules/next/dist/shared/lib/utils.d.ts","./node_modules/next/dist/pages/_app.d.ts","./node_modules/next/app.d.ts","./node_modules/next/dist/server/web/spec-extension/unstable-cache.d.ts","./node_modules/next/dist/server/web/spec-extension/revalidate.d.ts","./node_modules/next/dist/server/web/spec-extension/unstable-no-store.d.ts","./node_modules/next/cache.d.ts","./node_modules/next/dist/shared/lib/runtime-config.external.d.ts","./node_modules/next/config.d.ts","./node_modules/next/dist/pages/_document.d.ts","./node_modules/next/document.d.ts","./node_modules/next/dist/shared/lib/dynamic.d.ts","./node_modules/next/dynamic.d.ts","./node_modules/next/dist/pages/_error.d.ts","./node_modules/next/error.d.ts","./node_modules/next/dist/shared/lib/head.d.ts","./node_modules/next/head.d.ts","./node_modules/next/dist/client/components/draft-mode.d.ts","./node_modules/next/dist/client/components/headers.d.ts","./node_modules/next/headers.d.ts","./node_modules/next/dist/shared/lib/get-img-props.d.ts","./node_modules/next/dist/client/image-component.d.ts","./node_modules/next/dist/shared/lib/image-external.d.ts","./node_modules/next/image.d.ts","./node_modules/next/dist/client/link.d.ts","./node_modules/next/link.d.ts","./node_modules/next/dist/client/components/redirect-status-code.d.ts","./node_modules/next/dist/client/components/redirect.d.ts","./node_modules/next/dist/client/components/not-found.d.ts","./node_modules/next/dist/client/components/navigation.react-server.d.ts","./node_modules/next/dist/client/components/navigation.d.ts","./node_modules/next/navigation.d.ts","./node_modules/next/router.d.ts","./node_modules/next/dist/client/script.d.ts","./node_modules/next/script.d.ts","./node_modules/next/dist/server/web/spec-extension/user-agent.d.ts","./node_modules/next/dist/compiled/@edge-runtime/primitives/url.d.ts","./node_modules/next/dist/server/web/spec-extension/image-response.d.ts","./node_modules/next/dist/compiled/@vercel/og/satori/index.d.ts","./node_modules/next/dist/compiled/@vercel/og/emoji/index.d.ts","./node_modules/next/dist/compiled/@vercel/og/types.d.ts","./node_modules/next/server.d.ts","./node_modules/next/types/global.d.ts","./node_modules/next/types/compiled.d.ts","./node_modules/next/index.d.ts","./node_modules/next/image-types/global.d.ts","./next-env.d.ts","./src/types/index.ts","./src/lib/api.ts","./src/__tests__/api.test.ts","./node_modules/@types/aria-query/index.d.ts","./node_modules/@testing-library/dom/types/matches.d.ts","./node_modules/@testing-library/dom/types/wait-for.d.ts","./node_modules/@testing-library/dom/types/query-helpers.d.ts","./node_modules/@testing-library/dom/types/queries.d.ts","./node_modules/@testing-library/dom/types/get-queries-for-element.d.ts","./node_modules/pretty-format/build/types.d.ts","./node_modules/pretty-format/build/index.d.ts","./node_modules/@testing-library/dom/types/screen.d.ts","./node_modules/@testing-library/dom/types/wait-for-element-to-be-removed.d.ts","./node_modules/@testing-library/dom/types/get-node-text.d.ts","./node_modules/@testing-library/dom/types/events.d.ts","./node_modules/@testing-library/dom/types/pretty-dom.d.ts","./node_modules/@testing-library/dom/types/role-helpers.d.ts","./node_modules/@testing-library/dom/types/config.d.ts","./node_modules/@testing-library/dom/types/suggestions.d.ts","./node_modules/@testing-library/dom/types/index.d.ts","./node_modules/@types/react-dom/test-utils/index.d.ts","./node_modules/@testing-library/react/types/index.d.ts","./src/hooks/useselection.ts","./src/__tests__/useselection.test.ts","./src/app/layout.tsx","./node_modules/lucide-react/dist/lucide-react.d.ts","./src/components/selectiontoolbar.tsx","./src/components/confirmationdialog.tsx","./src/components/incognitoindicator.tsx","./src/app/page.tsx","./src/app/settings/page.tsx","./src/app/setup/page.tsx","./src/components/datefilter.tsx","./src/components/header.tsx","./src/components/imagegrid.tsx","./src/components/searchbar.tsx","./src/components/statusbar.tsx","./src/components/timeline.tsx","./src/components/timelinescrubber.tsx","./.next/types/app/layout.ts","./.next/types/app/page.ts","./.next/types/app/settings/page.ts","./.next/types/app/setup/page.ts","./node_modules/@babel/types/lib/index.d.ts","./node_modules/@types/babel__generator/index.d.ts","./node_modules/@babel/parser/typings/babel-parser.d.ts","./node_modules/@types/babel__template/index.d.ts","./node_modules/@types/babel__traverse/index.d.ts","./node_modules/@types/babel__core/index.d.ts","./node_modules/@types/graceful-fs/index.d.ts","./node_modules/@types/istanbul-lib-coverage/index.d.ts","./node_modules/@types/istanbul-lib-report/index.d.ts","./node_modules/@types/istanbul-reports/index.d.ts","./node_modules/@jest/expect-utils/build/index.d.ts","./node_modules/chalk/index.d.ts","./node_modules/@sinclair/typebox/typebox.d.ts","./node_modules/@jest/schemas/build/index.d.ts","./node_modules/jest-diff/node_modules/pretty-format/build/index.d.ts","./node_modules/jest-diff/build/index.d.ts","./node_modules/jest-matcher-utils/build/index.d.ts","./node_modules/expect/build/index.d.ts","./node_modules/@types/jest/node_modules/pretty-format/build/index.d.ts","./node_modules/@types/jest/index.d.ts","./node_modules/parse5/dist/common/html.d.ts","./node_modules/parse5/dist/common/token.d.ts","./node_modules/parse5/dist/common/error-codes.d.ts","./node_modules/parse5/dist/tokenizer/preprocessor.d.ts","./node_modules/entities/dist/esm/generated/decode-data-html.d.ts","./node_modules/entities/dist/esm/generated/decode-data-xml.d.ts","./node_modules/entities/dist/esm/decode-codepoint.d.ts","./node_modules/entities/dist/esm/decode.d.ts","./node_modules/parse5/dist/tokenizer/index.d.ts","./node_modules/parse5/dist/tree-adapters/interface.d.ts","./node_modules/parse5/dist/parser/open-element-stack.d.ts","./node_modules/parse5/dist/parser/formatting-element-list.d.ts","./node_modules/parse5/dist/parser/index.d.ts","./node_modules/parse5/dist/tree-adapters/default.d.ts","./node_modules/parse5/dist/serializer/index.d.ts","./node_modules/parse5/dist/common/foreign-content.d.ts","./node_modules/parse5/dist/index.d.ts","./node_modules/@types/tough-cookie/index.d.ts","./node_modules/@types/jsdom/base.d.ts","./node_modules/@types/jsdom/index.d.ts","./node_modules/@types/json5/index.d.ts","./node_modules/@types/stack-utils/index.d.ts","./node_modules/@types/yargs-parser/index.d.ts","./node_modules/@types/yargs/index.d.ts"],"fileIdsList":[[99,145,354,429],[99,145,354,434],[99,145,354,435],[99,145,354,436],[99,145,402,403],[99,145,448],[99,145],[99,145,460],[99,145,412],[99,145,409,410,411,412,413,416,417,418,419,420,421,422,423],[99,145,408],[99,145,415],[99,145,409,410,411],[99,145,409,410],[99,145,412,413,415],[99,145,410],[99,145,424,425],[99,145,448,449,450,451,452],[99,145,448,450],[99,145,157,193],[99,145,455],[99,145,456],[99,145,462,465],[99,145,461],[99,145,156,189,193,484,485,487],[99,145,486],[99,142,145],[99,144,145],[145],[99,145,150,178],[99,145,146,151,156,164,175,186],[99,145,146,147,156,164],[94,95,96,99,145],[99,145,148,187],[99,145,149,150,157,165],[99,145,150,175,183],[99,145,151,153,156,164],[99,144,145,152],[99,145,153,154],[99,145,155,156],[99,144,145,156],[99,145,156,157,158,175,186],[99,145,156,157,158,171,175,178],[99,145,153,156,159,164,175,186],[99,145,156,157,159,160,164,175,183,186],[99,145,159,161,175,183,186],[97,98,99,100,101,102,103,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192],[99,145,156,162],[99,145,163,186,191],[99,145,153,156,164,175],[99,145,165],[99,145,166],[99,144,145,167],[99,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192],[99,145,169],[99,145,170],[99,145,156,171,172],[99,145,171,173,187,189],[99,145,156,175,176,178],[99,145,177,178],[99,145,175,176],[99,145,178],[99,145,179],[99,142,145,175,180],[99,145,156,181,182],[99,145,181,182],[99,145,150,164,175,183],[99,145,184],[99,145,164,185],[99,145,159,170,186],[99,145,150,187],[99,145,175,188],[99,145,163,189],[99,145,190],[99,140,145],[99,140,145,156,158,167,175,178,186,189,191],[99,145,175,192],[87,99,145,197,198,199],[87,99,145,197,198],[87,99,145],[87,99,145,425],[87,91,99,145,196,355,398],[87,91,99,145,195,355,398],[84,85,86,99,145],[99,145,490],[99,145,472,473,474],[99,145,458,464],[99,145,462],[99,145,459,463],[92,99,145],[99,145,359],[99,145,361,362,363],[99,145,365],[99,145,202,212,218,220,355],[99,145,202,209,211,214,232],[99,145,212],[99,145,212,333],[99,145,266,282,296,401],[99,145,304],[99,145,202,212,219,252,262,330,331,401],[99,145,219,401],[99,145,212,262,263,264,401],[99,145,212,219,252,401],[99,145,401],[99,145,202,219,220,401],[99,144,145,193],[87,99,145,283,284,285,301,302],[87,99,145,283],[99,145,274],[99,145,273,275,375],[87,99,145,283,284,299],[99,145,279,302,387],[99,145,385,386],[99,145,226,384],[99,144,145,193,226,273,274,275],[87,99,145,299,301,302],[99,145,299,301],[99,145,299,300,302],[99,145,170,193],[99,144,145,193,211,213,269,270,271],[87,99,145,203,378],[87,99,145,186,193],[87,99,145,219,250],[87,99,145,219],[99,145,248,253],[87,99,145,249,358],[87,91,99,145,159,193,195,196,355,396,397],[99,145,355],[99,145,201],[99,145,348,349,350,351,352,353],[99,145,350],[87,99,145,249,283,358],[87,99,145,283,356,358],[87,99,145,283,358],[99,145,159,193,213,358],[99,145,159,193,210,211,222,240,272,276,277,298,299],[99,145,272],[99,145,270,272,276,284,286,287,288,289,290,291,292,293,294,295,401],[99,145,271],[87,99,145,170,193,211,212,240,242,244,269,298,302,355,401],[99,145,159,193,213,214,226,227,273],[99,145,159,193,212,214],[99,145,159,175,193,210,213,214],[99,145,159,170,186,193,210,211,212,213,214,219,222,223,233,234,236,239,240,242,243,244,268,269,299,307,309,312,314,317,319,320,321],[99,145,159,175,193],[99,145,202,203,204,210,211,355,358,401],[99,145,159,175,186,193,207,332,334,335,401],[99,145,170,186,193,207,210,213,230,234,236,237,238,242,269,312,322,324,330,344,345],[99,145,212,216,269],[99,145,210,212],[99,145,223,313],[99,145,315],[99,145,313],[99,145,315,318],[99,145,315,316],[99,145,206,207],[99,145,206,245],[99,145,206],[99,145,208,223,311],[99,145,310],[99,145,207,208],[99,145,208,308],[99,145,207],[99,145,298],[99,145,159,193,210,222,241,260,266,278,281,297,299],[99,145,254,255,256,257,258,259,279,280,302,356],[99,145,306],[99,145,159,193,210,222,241,246,303,305,307,355,358],[99,145,159,186,193,203,210,212,268],[99,145,265],[99,145,159,193,338,343],[99,145,233,268,358],[99,145,326,330,344,347],[99,145,159,216,330,338,339,347],[99,145,202,212,233,243,341],[99,145,159,193,212,219,243,325,326,336,337,340,342],[99,145,194,240,241,355,358],[99,145,159,170,186,193,208,210,211,213,216,221,222,230,233,234,236,237,238,239,242,244,268,269,309,322,323,358],[99,145,159,193,210,212,216,324,346],[99,145,159,193,211,213],[87,99,145,159,170,193,201,203,210,211,214,222,239,240,242,244,306,355,358],[99,145,159,170,186,193,205,208,209,213],[99,145,206,267],[99,145,159,193,206,211,222],[99,145,159,193,212,223],[99,145,159,193],[99,145,226],[99,145,225],[99,145,227],[99,145,212,224,226,230],[99,145,212,224,226],[99,145,159,193,205,212,213,219,227,228,229],[87,99,145,299,300,301],[99,145,261],[87,99,145,203],[87,99,145,236],[87,99,145,194,239,244,355,358],[99,145,203,378,379],[87,99,145,253],[87,99,145,170,186,193,201,247,249,251,252,358],[99,145,213,219,236],[99,145,235],[87,99,145,157,159,170,193,201,253,262,355,356,357],[83,87,88,89,90,99,145,195,196,355,398],[99,145,150],[99,145,327,328,329],[99,145,327],[99,145,367],[99,145,369],[99,145,371],[99,145,373],[99,145,376],[99,145,380],[91,93,99,145,355,360,364,366,368,370,372,374,377,381,383,389,390,392,399,400,401],[99,145,382],[99,145,388],[99,145,249],[99,145,391],[99,144,145,227,228,229,230,393,394,395,398],[99,145,193],[87,91,99,145,159,161,170,193,195,196,197,199,201,214,347,354,358,398],[99,145,469],[99,145,468,469],[99,145,468],[99,145,468,469,470,476,477,480,481,482,483],[99,145,469,477],[99,145,468,469,470,476,477,478,479],[99,145,468,477],[99,145,477,481],[99,145,469,470,471,475],[99,145,470],[99,145,468,469,477],[99,145,414],[99,112,116,145,186],[99,112,145,175,186],[99,107,145],[99,109,112,145,183,186],[99,145,164,183],[99,107,145,193],[99,109,112,145,164,186],[99,104,105,108,111,145,156,175,186],[99,112,119,145],[99,104,110,145],[99,112,133,134,145],[99,108,112,145,178,186,193],[99,133,145,193],[99,106,107,145,193],[99,112,145],[99,106,107,108,109,110,111,112,113,114,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,134,135,136,137,138,139,145],[99,112,127,145],[99,112,119,120,145],[99,110,112,120,121,145],[99,111,145],[99,104,107,112,145],[99,112,116,120,121,145],[99,116,145],[99,110,112,115,145,186],[99,104,109,112,119,145],[99,145,175],[99,107,112,133,145,191,193],[99,145,406],[99,145,426,427],[99,145,402],[87,99,145,383,405,406,427,431,432,433],[87,99,145,383,405,406],[87,99,145,383],[87,99,145,430],[87,99,145,383,405],[87,99,145,405,430],[99,145,430],[99,145,405],[87,99,145,405]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","impliedFormat":1},{"version":"2ab096661c711e4a81cc464fa1e6feb929a54f5340b46b0a07ac6bbf857471f0","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedFormat":1},{"version":"196cb558a13d4533a5163286f30b0509ce0210e4b316c56c38d4c0fd2fb38405","affectsGlobalScope":true,"impliedFormat":1},{"version":"73f78680d4c08509933daf80947902f6ff41b6230f94dd002ae372620adb0f60","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5239f5c01bcfa9cd32f37c496cf19c61d69d37e48be9de612b541aac915805b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"0990a7576222f248f0a3b888adcb7389f957928ce2afb1cd5128169086ff4d29","impliedFormat":1},{"version":"eb5b19b86227ace1d29ea4cf81387279d04bb34051e944bc53df69f58914b788","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"87d9d29dbc745f182683f63187bf3d53fd8673e5fca38ad5eaab69798ed29fbc","impliedFormat":1},{"version":"7a3aa194cfd5919c4da251ef04ea051077e22702638d4edcb9579e9101653519","affectsGlobalScope":true,"impliedFormat":1},{"version":"cc69795d9954ee4ad57545b10c7bf1a7260d990231b1685c147ea71a6faa265c","impliedFormat":1},{"version":"8bc6c94ff4f2af1f4023b7bb2379b08d3d7dd80c698c9f0b07431ea16101f05f","impliedFormat":1},{"version":"1b61d259de5350f8b1e5db06290d31eaebebc6baafd5f79d314b5af9256d7153","impliedFormat":1},{"version":"57194e1f007f3f2cbef26fa299d4c6b21f4623a2eddc63dfeef79e38e187a36e","impliedFormat":1},{"version":"0f6666b58e9276ac3a38fdc80993d19208442d6027ab885580d93aec76b4ef00","impliedFormat":1},{"version":"05fd364b8ef02fb1e174fbac8b825bdb1e5a36a016997c8e421f5fab0a6da0a0","impliedFormat":1},{"version":"70521b6ab0dcba37539e5303104f29b721bfb2940b2776da4cc818c07e1fefc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true,"impliedFormat":1},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"98cffbf06d6bab333473c70a893770dbe990783904002c4f1a960447b4b53dca","affectsGlobalScope":true,"impliedFormat":1},{"version":"ba481bca06f37d3f2c137ce343c7d5937029b2468f8e26111f3c9d9963d6568d","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d9ef24f9a22a88e3e9b3b3d8c40ab1ddb0853f1bfbd5c843c37800138437b61","affectsGlobalScope":true,"impliedFormat":1},{"version":"1db0b7dca579049ca4193d034d835f6bfe73096c73663e5ef9a0b5779939f3d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"f26b11d8d8e4b8028f1c7d618b22274c892e4b0ef5b3678a8ccbad85419aef43","affectsGlobalScope":true,"impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"763fe0f42b3d79b440a9b6e51e9ba3f3f91352469c1e4b3b67bfa4ff6352f3f4","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"7f182617db458e98fc18dfb272d40aa2fff3a353c44a89b2c0ccb3937709bfb5","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"2cbe0621042e2a68c7cbce5dfed3906a1862a16a7d496010636cdbdb91341c0f","affectsGlobalScope":true,"impliedFormat":1},{"version":"e2677634fe27e87348825bb041651e22d50a613e2fdf6a4a3ade971d71bac37e","impliedFormat":1},{"version":"7394959e5a741b185456e1ef5d64599c36c60a323207450991e7a42e08911419","impliedFormat":1},{"version":"8c0bcd6c6b67b4b503c11e91a1fb91522ed585900eab2ab1f61bba7d7caa9d6f","impliedFormat":1},{"version":"8cd19276b6590b3ebbeeb030ac271871b9ed0afc3074ac88a94ed2449174b776","affectsGlobalScope":true,"impliedFormat":1},{"version":"696eb8d28f5949b87d894b26dc97318ef944c794a9a4e4f62360cd1d1958014b","impliedFormat":1},{"version":"3f8fa3061bd7402970b399300880d55257953ee6d3cd408722cb9ac20126460c","impliedFormat":1},{"version":"35ec8b6760fd7138bbf5809b84551e31028fb2ba7b6dc91d95d098bf212ca8b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"68bd56c92c2bd7d2339457eb84d63e7de3bd56a69b25f3576e1568d21a162398","affectsGlobalScope":true,"impliedFormat":1},{"version":"3e93b123f7c2944969d291b35fed2af79a6e9e27fdd5faa99748a51c07c02d28","impliedFormat":1},{"version":"9d19808c8c291a9010a6c788e8532a2da70f811adb431c97520803e0ec649991","impliedFormat":1},{"version":"87aad3dd9752067dc875cfaa466fc44246451c0c560b820796bdd528e29bef40","impliedFormat":1},{"version":"4aacb0dd020eeaef65426153686cc639a78ec2885dc72ad220be1d25f1a439df","impliedFormat":1},{"version":"f0bd7e6d931657b59605c44112eaf8b980ba7f957a5051ed21cb93d978cf2f45","impliedFormat":1},{"version":"8db0ae9cb14d9955b14c214f34dae1b9ef2baee2fe4ce794a4cd3ac2531e3255","affectsGlobalScope":true,"impliedFormat":1},{"version":"15fc6f7512c86810273af28f224251a5a879e4261b4d4c7e532abfbfc3983134","impliedFormat":1},{"version":"58adba1a8ab2d10b54dc1dced4e41f4e7c9772cbbac40939c0dc8ce2cdb1d442","impliedFormat":1},{"version":"2fd4c143eff88dabb57701e6a40e02a4dbc36d5eb1362e7964d32028056a782b","impliedFormat":1},{"version":"714435130b9015fae551788df2a88038471a5a11eb471f27c4ede86552842bc9","impliedFormat":1},{"version":"855cd5f7eb396f5f1ab1bc0f8580339bff77b68a770f84c6b254e319bbfd1ac7","impliedFormat":1},{"version":"5650cf3dace09e7c25d384e3e6b818b938f68f4e8de96f52d9c5a1b3db068e86","impliedFormat":1},{"version":"1354ca5c38bd3fd3836a68e0f7c9f91f172582ba30ab15bb8c075891b91502b7","affectsGlobalScope":true,"impliedFormat":1},{"version":"27fdb0da0daf3b337c5530c5f266efe046a6ceb606e395b346974e4360c36419","impliedFormat":1},{"version":"2d2fcaab481b31a5882065c7951255703ddbe1c0e507af56ea42d79ac3911201","impliedFormat":1},{"version":"afbe24ab0d74694372baa632ecb28bb375be53f3be53f9b07ecd7fc994907de5","impliedFormat":1},{"version":"ca867399f7db82df981d6915bcbb2d81131d7d1ef683bc782b59f71dda59bc85","affectsGlobalScope":true,"impliedFormat":1},{"version":"00877fef624f3171c2e44944fb63a55e2a9f9120d7c8b5eb4181c263c9a077cf","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e043a1bc8fbf2a255bccf9bf27e0f1caf916c3b0518ea34aa72357c0afd42ec","impliedFormat":1},{"version":"b4f70ec656a11d570e1a9edce07d118cd58d9760239e2ece99306ee9dfe61d02","impliedFormat":1},{"version":"3bc2f1e2c95c04048212c569ed38e338873f6a8593930cf5a7ef24ffb38fc3b6","impliedFormat":1},{"version":"6e70e9570e98aae2b825b533aa6292b6abd542e8d9f6e9475e88e1d7ba17c866","impliedFormat":1},{"version":"f9d9d753d430ed050dc1bf2667a1bab711ccbb1c1507183d794cc195a5b085cc","impliedFormat":1},{"version":"9eece5e586312581ccd106d4853e861aaaa1a39f8e3ea672b8c3847eedd12f6e","impliedFormat":1},{"version":"47ab634529c5955b6ad793474ae188fce3e6163e3a3fb5edd7e0e48f14435333","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"45650f47bfb376c8a8ed39d4bcda5902ab899a3150029684ee4c10676d9fbaee","impliedFormat":1},{"version":"0225ecb9ed86bdb7a2c7fd01f1556906902929377b44483dc4b83e03b3ef227d","affectsGlobalScope":true,"impliedFormat":1},{"version":"74cf591a0f63db318651e0e04cb55f8791385f86e987a67fd4d2eaab8191f730","impliedFormat":1},{"version":"5eab9b3dc9b34f185417342436ec3f106898da5f4801992d8ff38ab3aff346b5","impliedFormat":1},{"version":"12ed4559eba17cd977aa0db658d25c4047067444b51acfdcbf38470630642b23","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3ffabc95802521e1e4bcba4c88d8615176dc6e09111d920c7a213bdda6e1d65","impliedFormat":1},{"version":"f9ab232778f2842ffd6955f88b1049982fa2ecb764d129ee4893cbc290f41977","impliedFormat":1},{"version":"ae56f65caf3be91108707bd8dfbccc2a57a91feb5daabf7165a06a945545ed26","impliedFormat":1},{"version":"a136d5de521da20f31631a0a96bf712370779d1c05b7015d7019a9b2a0446ca9","impliedFormat":1},{"version":"c3b41e74b9a84b88b1dca61ec39eee25c0dbc8e7d519ba11bb070918cfacf656","affectsGlobalScope":true,"impliedFormat":1},{"version":"4737a9dc24d0e68b734e6cfbcea0c15a2cfafeb493485e27905f7856988c6b29","affectsGlobalScope":true,"impliedFormat":1},{"version":"36d8d3e7506b631c9582c251a2c0b8a28855af3f76719b12b534c6edf952748d","impliedFormat":1},{"version":"1ca69210cc42729e7ca97d3a9ad48f2e9cb0042bada4075b588ae5387debd318","impliedFormat":1},{"version":"f5ebe66baaf7c552cfa59d75f2bfba679f329204847db3cec385acda245e574e","impliedFormat":1},{"version":"ed59add13139f84da271cafd32e2171876b0a0af2f798d0c663e8eeb867732cf","affectsGlobalScope":true,"impliedFormat":1},{"version":"05db535df8bdc30d9116fe754a3473d1b6479afbc14ae8eb18b605c62677d518","impliedFormat":1},{"version":"b1810689b76fd473bd12cc9ee219f8e62f54a7d08019a235d07424afbf074d25","impliedFormat":1},{"version":"8caa5c86be1b793cd5f599e27ecb34252c41e011980f7d61ae4989a149ff6ccc","impliedFormat":1},{"version":"91b0f6d01993021ecbe01eb076db6a3cf1b66359c1d99104f43436010e81afb5","impliedFormat":1},{"version":"d1bd4e51810d159899aad1660ccb859da54e27e08b8c9862b40cd36c1d9ff00f","impliedFormat":1},{"version":"17ed71200119e86ccef2d96b73b02ce8854b76ad6bd21b5021d4269bec527b5f","impliedFormat":1},{"version":"1cfa8647d7d71cb03847d616bd79320abfc01ddea082a49569fda71ac5ece66b","impliedFormat":1},{"version":"bb7a61dd55dc4b9422d13da3a6bb9cc5e89be888ef23bbcf6558aa9726b89a1c","impliedFormat":1},{"version":"db6d2d9daad8a6d83f281af12ce4355a20b9a3e71b82b9f57cddcca0a8964a96","impliedFormat":1},{"version":"cfe4ef4710c3786b6e23dae7c086c70b4f4835a2e4d77b75d39f9046106e83d3","impliedFormat":1},{"version":"cbea99888785d49bb630dcbb1613c73727f2b5a2cf02e1abcaab7bcf8d6bf3c5","impliedFormat":1},{"version":"98817124fd6c4f60e0b935978c207309459fb71ab112cf514f26f333bf30830e","impliedFormat":1},{"version":"a86f82d646a739041d6702101afa82dcb935c416dd93cbca7fd754fd0282ce1f","impliedFormat":1},{"version":"2dad084c67e649f0f354739ec7df7c7df0779a28a4f55c97c6b6883ae850d1ce","impliedFormat":1},{"version":"fa5bbc7ab4130dd8cdc55ea294ec39f76f2bc507a0f75f4f873e38631a836ca7","impliedFormat":1},{"version":"df45ca1176e6ac211eae7ddf51336dc075c5314bc5c253651bae639defd5eec5","impliedFormat":1},{"version":"cf86de1054b843e484a3c9300d62fbc8c97e77f168bbffb131d560ca0474d4a8","impliedFormat":1},{"version":"196c960b12253fde69b204aa4fbf69470b26daf7a430855d7f94107a16495ab0","impliedFormat":1},{"version":"528637e771ee2e808390d46a591eaef375fa4b9c99b03749e22b1d2e868b1b7c","impliedFormat":1},{"version":"bf24f6d35f7318e246010ffe9924395893c4e96d34324cde77151a73f078b9ad","impliedFormat":1},{"version":"596ccf4070268c4f5a8c459d762d8a934fa9b9317c7bf7a953e921bc9d78ce3c","impliedFormat":1},{"version":"10595c7ff5094dd5b6a959ccb1c00e6a06441b4e10a87bc09c15f23755d34439","impliedFormat":1},{"version":"9620c1ff645afb4a9ab4044c85c26676f0a93e8c0e4b593aea03a89ccb47b6d0","impliedFormat":1},{"version":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","impliedFormat":1},{"version":"a9af0e608929aaf9ce96bd7a7b99c9360636c31d73670e4af09a09950df97841","impliedFormat":1},{"version":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","impliedFormat":1},{"version":"c86fe861cf1b4c46a0fb7d74dffe596cf679a2e5e8b1456881313170f092e3fa","impliedFormat":1},{"version":"08ed0b3f0166787f84a6606f80aa3b1388c7518d78912571b203817406e471da","impliedFormat":1},{"version":"47e5af2a841356a961f815e7c55d72554db0c11b4cba4d0caab91f8717846a94","impliedFormat":1},{"version":"9a1a0dc84fecc111e83281743f003e1ae9048e0f83c2ae2028d17bc58fd93cc7","impliedFormat":1},{"version":"f5f541902bf7ae0512a177295de9b6bcd6809ea38307a2c0a18bfca72212f368","impliedFormat":1},{"version":"e8da637cbd6ed1cf6c36e9424f6bcee4515ca2c677534d4006cbd9a05f930f0c","impliedFormat":1},{"version":"ca1b882a105a1972f82cc58e3be491e7d750a1eb074ffd13b198269f57ed9e1b","impliedFormat":1},{"version":"fc3e1c87b39e5ba1142f27ec089d1966da168c04a859a4f6aab64dceae162c2b","impliedFormat":1},{"version":"3867ca0e9757cc41e04248574f4f07b8f9e3c0c2a796a5eb091c65bfd2fc8bdb","impliedFormat":1},{"version":"61888522cec948102eba94d831c873200aa97d00d8989fdfd2a3e0ee75ec65a2","impliedFormat":1},{"version":"4e10622f89fea7b05dd9b52fb65e1e2b5cbd96d4cca3d9e1a60bb7f8a9cb86a1","impliedFormat":1},{"version":"74b2a5e5197bd0f2e0077a1ea7c07455bbea67b87b0869d9786d55104006784f","impliedFormat":1},{"version":"59bf32919de37809e101acffc120596a9e45fdbab1a99de5087f31fdc36e2f11","impliedFormat":1},{"version":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","impliedFormat":1},{"version":"5322a4f762d356093e8c2903a190ddbaa548420c891affa71093b85c5c2fbe94","impliedFormat":1},{"version":"c40c848daad198266370c1c72a7a8c3d18d2f50727c7859fcfefd3ff69a7f288","impliedFormat":1},{"version":"ac60bbee0d4235643cc52b57768b22de8c257c12bd8c2039860540cab1fa1d82","impliedFormat":1},{"version":"973b59a17aaa817eb205baf6c132b83475a5c0a44e8294a472af7793b1817e89","impliedFormat":1},{"version":"ada39cbb2748ab2873b7835c90c8d4620723aedf323550e8489f08220e477c7f","impliedFormat":1},{"version":"6e5f5cee603d67ee1ba6120815497909b73399842254fc1e77a0d5cdc51d8c9c","impliedFormat":1},{"version":"8dba67056cbb27628e9b9a1cba8e57036d359dceded0725c72a3abe4b6c79cd4","impliedFormat":1},{"version":"70f3814c457f54a7efe2d9ce9d2686de9250bb42eb7f4c539bd2280a42e52d33","impliedFormat":1},{"version":"5cbd32af037805215112472e35773bad9d4e03f0e72b1129a0d0c12d9cd63cc7","impliedFormat":1},{"version":"ef61792acbfa8c27c9bd113f02731e66229f7d3a169e3c1993b508134f1a58e0","impliedFormat":1},{"version":"afcb759e8e3ad6549d5798820697002bc07bdd039899fad0bf522e7e8a9f5866","impliedFormat":1},{"version":"f6404e7837b96da3ea4d38c4f1a3812c96c9dcdf264e93d5bdb199f983a3ef4b","impliedFormat":1},{"version":"c5426dbfc1cf90532f66965a7aa8c1136a78d4d0f96d8180ecbfc11d7722f1a5","impliedFormat":1},{"version":"65a15fc47900787c0bd18b603afb98d33ede930bed1798fc984d5ebb78b26cf9","impliedFormat":1},{"version":"9d202701f6e0744adb6314d03d2eb8fc994798fc83d91b691b75b07626a69801","impliedFormat":1},{"version":"de9d2df7663e64e3a91bf495f315a7577e23ba088f2949d5ce9ec96f44fba37d","impliedFormat":1},{"version":"c7af78a2ea7cb1cd009cfb5bdb48cd0b03dad3b54f6da7aab615c2e9e9d570c5","impliedFormat":1},{"version":"1ee45496b5f8bdee6f7abc233355898e5bf9bd51255db65f5ff7ede617ca0027","impliedFormat":1},{"version":"566e5fb812082f8cf929c6727d40924843246cf19ee4e8b9437a6315c4792b03","affectsGlobalScope":true,"impliedFormat":1},{"version":"db01d18853469bcb5601b9fc9826931cc84cc1a1944b33cad76fd6f1e3d8c544","affectsGlobalScope":true,"impliedFormat":1},{"version":"dba114fb6a32b355a9cfc26ca2276834d72fe0e94cd2c3494005547025015369","impliedFormat":1},{"version":"903e299a28282fa7b714586e28409ed73c3b63f5365519776bf78e8cf173db36","affectsGlobalScope":true,"impliedFormat":1},{"version":"fa6c12a7c0f6b84d512f200690bfc74819e99efae69e4c95c4cd30f6884c526e","impliedFormat":1},{"version":"f1c32f9ce9c497da4dc215c3bc84b722ea02497d35f9134db3bb40a8d918b92b","impliedFormat":1},{"version":"b73c319af2cc3ef8f6421308a250f328836531ea3761823b4cabbd133047aefa","affectsGlobalScope":true,"impliedFormat":1},{"version":"e433b0337b8106909e7953015e8fa3f2d30797cea27141d1c5b135365bb975a6","impliedFormat":1},{"version":"dd3900b24a6a8745efeb7ad27629c0f8a626470ac229c1d73f1fe29d67e44dca","impliedFormat":1},{"version":"ddff7fc6edbdc5163a09e22bf8df7bef75f75369ebd7ecea95ba55c4386e2441","impliedFormat":1},{"version":"106c6025f1d99fd468fd8bf6e5bda724e11e5905a4076c5d29790b6c3745e50c","impliedFormat":1},{"version":"ec29be0737d39268696edcec4f5e97ce26f449fa9b7afc2f0f99a86def34a418","impliedFormat":1},{"version":"68a06fb972b2c7e671bf090dc5a5328d22ba07d771376c3d9acd9e7ed786a9db","impliedFormat":1},{"version":"ec6cba1c02c675e4dd173251b156792e8d3b0c816af6d6ad93f1a55d674591aa","impliedFormat":1},{"version":"b620391fe8060cf9bedc176a4d01366e6574d7a71e0ac0ab344a4e76576fcbb8","impliedFormat":1},{"version":"d729408dfde75b451530bcae944cf89ee8277e2a9df04d1f62f2abfd8b03c1e1","impliedFormat":1},{"version":"e15d3c84d5077bb4a3adee4c791022967b764dc41cb8fa3cfa44d4379b2c95f5","impliedFormat":1},{"version":"78244a2a8ab1080e0dd8fc3633c204c9a4be61611d19912f4b157f7ef7367049","impliedFormat":1},{"version":"e1fc1a1045db5aa09366be2b330e4ce391550041fc3e925f60998ca0b647aa97","impliedFormat":1},{"version":"d3f5861c48322adc023d3277e592635402ac008c5beae2e447b335fbf0da56c2","impliedFormat":1},{"version":"43ba4f2fa8c698f5c304d21a3ef596741e8e85a810b7c1f9b692653791d8d97a","impliedFormat":1},{"version":"31fb49ef3aa3d76f0beb644984e01eab0ea222372ea9b49bb6533be5722d756c","impliedFormat":1},{"version":"44c431d059195791915a2aee58f5cef4b333b9996bd256ae55f82ffcf3aa6de4","impliedFormat":1},{"version":"3556cfbab7b43da96d15a442ddbb970e1f2fc97876d055b6555d86d7ac57dae5","impliedFormat":1},{"version":"437751e0352c6e924ddf30e90849f1d9eb00ca78c94d58d6a37202ec84eb8393","impliedFormat":1},{"version":"48e8af7fdb2677a44522fd185d8c87deff4d36ee701ea003c6c780b1407a1397","impliedFormat":1},{"version":"24e1319bd695b0971f0eec3d4e011b7aa996f77b9d854d2703657cf355cac2a7","impliedFormat":1},{"version":"f9812cfc220ecf7557183379531fa409acd249b9e5b9a145d0d52b76c20862de","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b068371563d0396a065ed64b049cffeb4eed89ad433ae7730fc31fb1e00ebf3","impliedFormat":1},{"version":"2e4f37ffe8862b14d8e24ae8763daaa8340c0df0b859d9a9733def0eee7562d9","impliedFormat":1},{"version":"13283350547389802aa35d9f2188effaeac805499169a06ef5cd77ce2a0bd63f","impliedFormat":1},{"version":"680793958f6a70a44c8d9ae7d46b7a385361c69ac29dcab3ed761edce1c14ab8","impliedFormat":1},{"version":"6ac6715916fa75a1f7ebdfeacac09513b4d904b667d827b7535e84ff59679aff","impliedFormat":1},{"version":"42c169fb8c2d42f4f668c624a9a11e719d5d07dacbebb63cbcf7ef365b0a75b3","impliedFormat":1},{"version":"913ddbba170240070bd5921b8f33ea780021bdf42fbdfcd4fcb2691b1884ddde","impliedFormat":1},{"version":"74c105214ddd747037d2a75da6588ec8aa1882f914e1f8a312c528f86feca2b9","impliedFormat":1},{"version":"5fe23bd829e6be57d41929ac374ee9551ccc3c44cee893167b7b5b77be708014","impliedFormat":1},{"version":"4d85f80132e24d9a5b5c5e0734e4ecd6878d8c657cc990ecc70845ef384ca96f","impliedFormat":1},{"version":"438c7513b1df91dcef49b13cd7a1c4720f91a36e88c1df731661608b7c055f10","impliedFormat":1},{"version":"ad444a874f011d3a797f1a41579dbfcc6b246623f49c20009f60e211dbd5315e","impliedFormat":1},{"version":"efaa078e392f9abda3ee8ade3f3762ab77f9c50b184e6883063a911742a4c96a","impliedFormat":1},{"version":"54a8bb487e1dc04591a280e7a673cdfb272c83f61e28d8a64cf1ac2e63c35c51","impliedFormat":1},{"version":"021a9498000497497fd693dd315325484c58a71b5929e2bbb91f419b04b24cea","impliedFormat":1},{"version":"9385cdc09850950bc9b59cca445a3ceb6fcca32b54e7b626e746912e489e535e","impliedFormat":1},{"version":"2894c56cad581928bb37607810af011764a2f511f575d28c9f4af0f2ef02d1ab","impliedFormat":1},{"version":"0a72186f94215d020cb386f7dca81d7495ab6c17066eb07d0f44a5bf33c1b21a","impliedFormat":1},{"version":"84124384abae2f6f66b7fbfc03862d0c2c0b71b826f7dbf42c8085d31f1d3f95","impliedFormat":1},{"version":"63a8e96f65a22604eae82737e409d1536e69a467bb738bec505f4f97cce9d878","impliedFormat":1},{"version":"3fd78152a7031315478f159c6a5872c712ece6f01212c78ea82aef21cb0726e2","impliedFormat":1},{"version":"3a6ed8e1d630cfa1f7edf0dc46a6e20ca6c714dbe754409699008571dfe473a6","impliedFormat":1},{"version":"512fc15cca3a35b8dbbf6e23fe9d07e6f87ad03c895acffd3087ce09f352aad0","impliedFormat":1},{"version":"9a0946d15a005832e432ea0cd4da71b57797efb25b755cc07f32274296d62355","impliedFormat":1},{"version":"a52ff6c0a149e9f370372fc3c715d7f2beee1f3bab7980e271a7ab7d313ec677","impliedFormat":1},{"version":"fd933f824347f9edd919618a76cdb6a0c0085c538115d9a287fa0c7f59957ab3","impliedFormat":1},{"version":"6ac6715916fa75a1f7ebdfeacac09513b4d904b667d827b7535e84ff59679aff","impliedFormat":1},{"version":"6a1aa3e55bdc50503956c5cd09ae4cd72e3072692d742816f65c66ca14f4dfdd","impliedFormat":1},{"version":"ab75cfd9c4f93ffd601f7ca1753d6a9d953bbedfbd7a5b3f0436ac8a1de60dfa","impliedFormat":1},{"version":"59c68235df3905989afa0399381c1198313aaaf1ed387f57937eb616625dff15","impliedFormat":1},{"version":"b73cbf0a72c8800cf8f96a9acfe94f3ad32ca71342a8908b8ae484d61113f647","impliedFormat":1},{"version":"bae6dd176832f6423966647382c0d7ba9e63f8c167522f09a982f086cd4e8b23","impliedFormat":1},{"version":"1364f64d2fb03bbb514edc42224abd576c064f89be6a990136774ecdd881a1da","impliedFormat":1},{"version":"c9958eb32126a3843deedda8c22fb97024aa5d6dd588b90af2d7f2bfac540f23","impliedFormat":1},{"version":"950fb67a59be4c2dbe69a5786292e60a5cb0e8612e0e223537784c731af55db1","impliedFormat":1},{"version":"e927c2c13c4eaf0a7f17e6022eee8519eb29ef42c4c13a31e81a611ab8c95577","impliedFormat":1},{"version":"07ca44e8d8288e69afdec7a31fa408ce6ab90d4f3d620006701d5544646da6aa","impliedFormat":1},{"version":"70246ad95ad8a22bdfe806cb5d383a26c0c6e58e7207ab9c431f1cb175aca657","impliedFormat":1},{"version":"f00f3aa5d64ff46e600648b55a79dcd1333458f7a10da2ed594d9f0a44b76d0b","impliedFormat":1},{"version":"772d8d5eb158b6c92412c03228bd9902ccb1457d7a705b8129814a5d1a6308fc","impliedFormat":1},{"version":"4e4475fba4ed93a72f167b061cd94a2e171b82695c56de9899275e880e06ba41","impliedFormat":1},{"version":"97c5f5d580ab2e4decd0a3135204050f9b97cd7908c5a8fbc041eadede79b2fa","impliedFormat":1},{"version":"49b2375c586882c3ac7f57eba86680ff9742a8d8cb2fe25fe54d1b9673690d41","impliedFormat":1},{"version":"802e797bcab5663b2c9f63f51bdf67eff7c41bc64c0fd65e6da3e7941359e2f7","impliedFormat":1},{"version":"0ccace0fe001af57d74279b66fa35cff2bb6aefc57c5c080be7281474161447b","impliedFormat":1},{"version":"3ecfccf916fea7c6c34394413b55eb70e817a73e39b4417d6573e523784e3f8e","impliedFormat":1},{"version":"c05bc82af01e673afc99bdffd4ebafde22ab027d63e45be9e1f1db3bc39e2fc0","impliedFormat":1},{"version":"6459054aabb306821a043e02b89d54da508e3a6966601a41e71c166e4ea1474f","impliedFormat":1},{"version":"f416c9c3eee9d47ff49132c34f96b9180e50485d435d5748f0e8b72521d28d2e","impliedFormat":1},{"version":"05c97cddbaf99978f83d96de2d8af86aded9332592f08ce4a284d72d0952c391","impliedFormat":1},{"version":"14e5cdec6f8ae82dfd0694e64903a0a54abdfe37e1d966de3d4128362acbf35f","impliedFormat":1},{"version":"bbc183d2d69f4b59fd4dd8799ffdf4eb91173d1c4ad71cce91a3811c021bf80c","impliedFormat":1},{"version":"7b6ff760c8a240b40dab6e4419b989f06a5b782f4710d2967e67c695ef3e93c4","impliedFormat":1},{"version":"8dbc4134a4b3623fc476be5f36de35c40f2768e2e3d9ed437e0d5f1c4cd850f6","impliedFormat":1},{"version":"4e06330a84dec7287f7ebdd64978f41a9f70a668d3b5edc69d5d4a50b9b376bb","impliedFormat":1},{"version":"65bfa72967fbe9fc33353e1ac03f0480aa2e2ea346d61ff3ea997dfd850f641a","impliedFormat":1},{"version":"8f88c6be9803fe5aaa80b00b27f230c824d4b8a33856b865bea5793cb52bb797","impliedFormat":1},{"version":"f974e4a06953682a2c15d5bd5114c0284d5abf8bc0fe4da25cb9159427b70072","impliedFormat":1},{"version":"872caaa31423f4345983d643e4649fb30f548e9883a334d6d1c5fff68ede22d4","impliedFormat":1},{"version":"94404c4a878fe291e7578a2a80264c6f18e9f1933fbb57e48f0eb368672e389c","impliedFormat":1},{"version":"5c1b7f03aa88be854bc15810bfd5bd5a1943c5a7620e1c53eddd2a013996343e","impliedFormat":1},{"version":"09dfc64fcd6a2785867f2368419859a6cc5a8d4e73cbe2538f205b1642eb0f51","impliedFormat":1},{"version":"bcf6f0a323653e72199105a9316d91463ad4744c546d1271310818b8cef7c608","impliedFormat":1},{"version":"01aa917531e116485beca44a14970834687b857757159769c16b228eb1e49c5f","impliedFormat":1},{"version":"351475f9c874c62f9b45b1f0dc7e2704e80dfd5f1af83a3a9f841f9dfe5b2912","impliedFormat":1},{"version":"ac457ad39e531b7649e7b40ee5847606eac64e236efd76c5d12db95bf4eacd17","impliedFormat":1},{"version":"187a6fdbdecb972510b7555f3caacb44b58415da8d5825d03a583c4b73fde4cf","impliedFormat":1},{"version":"d4c3250105a612202289b3a266bb7e323db144f6b9414f9dea85c531c098b811","impliedFormat":1},{"version":"95b444b8c311f2084f0fb51c616163f950fb2e35f4eaa07878f313a2d36c98a4","impliedFormat":1},{"version":"741067675daa6d4334a2dc80a4452ca3850e89d5852e330db7cb2b5f867173b1","impliedFormat":1},{"version":"f8acecec1114f11690956e007d920044799aefeb3cece9e7f4b1f8a1d542b2c9","impliedFormat":1},{"version":"131b1475d2045f20fb9f43b7aa6b7cb51f25250b5e4c6a1d4aa3cf4dd1a68793","impliedFormat":1},{"version":"3a17f09634c50cce884721f54fd9e7b98e03ac505889c560876291fcf8a09e90","impliedFormat":1},{"version":"32531dfbb0cdc4525296648f53b2b5c39b64282791e2a8c765712e49e6461046","impliedFormat":1},{"version":"0ce1b2237c1c3df49748d61568160d780d7b26693bd9feb3acb0744a152cd86d","impliedFormat":1},{"version":"e489985388e2c71d3542612685b4a7db326922b57ac880f299da7026a4e8a117","impliedFormat":1},{"version":"e1437c5f191edb7a494f7bbbc033b97d72d42e054d521402ee194ac5b6b7bf49","impliedFormat":1},{"version":"04d3aad777b6af5bd000bfc409907a159fe77e190b9d368da4ba649cdc28d39e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fd1b9d883b9446f1e1da1e1033a6a98995c25fbf3c10818a78960e2f2917d10c","impliedFormat":1},{"version":"19252079538942a69be1645e153f7dbbc1ef56b4f983c633bf31fe26aeac32cd","impliedFormat":1},{"version":"bc11f3ac00ac060462597add171220aed628c393f2782ac75dd29ff1e0db871c","impliedFormat":1},{"version":"616775f16134fa9d01fc677ad3f76e68c051a056c22ab552c64cc281a9686790","impliedFormat":1},{"version":"65c24a8baa2cca1de069a0ba9fba82a173690f52d7e2d0f1f7542d59d5eb4db0","impliedFormat":1},{"version":"313c85c332bb6892d5f7c624dc39107ca7a6b2f1b3212db86dbbefbe7f8ddd5a","impliedFormat":1},{"version":"3b0b1d352b8d2e47f1c4df4fb0678702aee071155b12ef0185fce9eb4fa4af1e","impliedFormat":1},{"version":"77e71242e71ebf8528c5802993697878f0533db8f2299b4d36aa015bae08a79c","impliedFormat":1},{"version":"a344403e7a7384e0e7093942533d309194ad0a53eca2a3100c0b0ab4d3932773","impliedFormat":1},{"version":"b7fff2d004c5879cae335db8f954eb1d61242d9f2d28515e67902032723caeab","impliedFormat":1},{"version":"5f3dc10ae646f375776b4e028d2bed039a93eebbba105694d8b910feebbe8b9c","impliedFormat":1},{"version":"bb18bf4a61a17b4a6199eb3938ecfa4a59eb7c40843ad4a82b975ab6f7e3d925","impliedFormat":1},{"version":"4545c1a1ceca170d5d83452dd7c4994644c35cf676a671412601689d9a62da35","impliedFormat":1},{"version":"e9b6fc05f536dfddcdc65dbcf04e09391b1c968ab967382e48924f5cb90d88e1","impliedFormat":1},{"version":"a2d648d333cf67b9aeac5d81a1a379d563a8ffa91ddd61c6179f68de724260ff","impliedFormat":1},{"version":"2b664c3cc544d0e35276e1fb2d4989f7d4b4027ffc64da34ec83a6ccf2e5c528","impliedFormat":1},{"version":"a3f41ed1b4f2fc3049394b945a68ae4fdefd49fa1739c32f149d32c0545d67f5","impliedFormat":1},{"version":"3cd8f0464e0939b47bfccbb9bb474a6d87d57210e304029cd8eb59c63a81935d","impliedFormat":1},{"version":"47699512e6d8bebf7be488182427189f999affe3addc1c87c882d36b7f2d0b0e","impliedFormat":1},{"version":"3026abd48e5e312f2328629ede6e0f770d21c3cd32cee705c450e589d015ee09","impliedFormat":1},{"version":"8b140b398a6afbd17cc97c38aea5274b2f7f39b1ae5b62952cfe65bf493e3e75","impliedFormat":1},{"version":"7663d2c19ce5ef8288c790edba3d45af54e58c84f1b37b1249f6d49d962f3d91","impliedFormat":1},{"version":"30112425b2cf042fca1c79c19e35f88f44bfb2e97454527528cd639dd1a460ca","impliedFormat":1},{"version":"00bd6ebe607246b45296aa2b805bd6a58c859acecda154bfa91f5334d7c175c6","impliedFormat":1},{"version":"ad036a85efcd9e5b4f7dd5c1a7362c8478f9a3b6c3554654ca24a29aa850a9c5","impliedFormat":1},{"version":"fedebeae32c5cdd1a85b4e0504a01996e4a8adf3dfa72876920d3dd6e42978e7","impliedFormat":1},{"version":"504f37ba38bfea8394ec4f397c9a2ade7c78055e41ef5a600073b515c4fd0fc9","impliedFormat":1},{"version":"cdf21eee8007e339b1b9945abf4a7b44930b1d695cc528459e68a3adc39a622e","impliedFormat":1},{"version":"db036c56f79186da50af66511d37d9fe77fa6793381927292d17f81f787bb195","impliedFormat":1},{"version":"87ac2fb61e629e777f4d161dff534c2023ee15afd9cb3b1589b9b1f014e75c58","impliedFormat":1},{"version":"13c8b4348db91e2f7d694adc17e7438e6776bc506d5c8f5de9ad9989707fa3fe","impliedFormat":1},{"version":"3c1051617aa50b38e9efaabce25e10a5dd9b1f42e372ef0e8a674076a68742ed","impliedFormat":1},{"version":"07a3e20cdcb0f1182f452c0410606711fbea922ca76929a41aacb01104bc0d27","impliedFormat":1},{"version":"1de80059b8078ea5749941c9f863aa970b4735bdbb003be4925c853a8b6b4450","impliedFormat":1},{"version":"1d079c37fa53e3c21ed3fa214a27507bda9991f2a41458705b19ed8c2b61173d","impliedFormat":1},{"version":"4cd4b6b1279e9d744a3825cbd7757bbefe7f0708f3f1069179ad535f19e8ed2c","impliedFormat":1},{"version":"5835a6e0d7cd2738e56b671af0e561e7c1b4fb77751383672f4b009f4e161d70","impliedFormat":1},{"version":"c0eeaaa67c85c3bb6c52b629ebbfd3b2292dc67e8c0ffda2fc6cd2f78dc471e6","impliedFormat":1},{"version":"4b7f74b772140395e7af67c4841be1ab867c11b3b82a51b1aeb692822b76c872","impliedFormat":1},{"version":"27be6622e2922a1b412eb057faa854831b95db9db5035c3f6d4b677b902ab3b7","impliedFormat":1},{"version":"b95a6f019095dd1d48fd04965b50dfd63e5743a6e75478343c46d2582a5132bf","impliedFormat":99},{"version":"c2008605e78208cfa9cd70bd29856b72dda7ad89df5dc895920f8e10bcb9cd0a","impliedFormat":99},{"version":"b97cb5616d2ab82a98ec9ada7b9e9cabb1f5da880ec50ea2b8dc5baa4cbf3c16","impliedFormat":99},{"version":"d23df9ff06ae8bf1dcb7cc933e97ae7da418ac77749fecee758bb43a8d69f840","affectsGlobalScope":true,"impliedFormat":1},{"version":"040c71dde2c406f869ad2f41e8d4ce579cc60c8dbe5aa0dd8962ac943b846572","affectsGlobalScope":true,"impliedFormat":1},{"version":"3586f5ea3cc27083a17bd5c9059ede9421d587286d5a47f4341a4c2d00e4fa91","impliedFormat":1},{"version":"a6df929821e62f4719551f7955b9f42c0cd53c1370aec2dd322e24196a7dfe33","impliedFormat":1},{"version":"b789bf89eb19c777ed1e956dbad0925ca795701552d22e68fd130a032008b9f9","impliedFormat":1},"9269d492817e359123ac64c8205e5d05dab63d71a3a7a229e68b5d9a0e8150bf",{"version":"503ff358f8989a2b3cf20464e2d4ea049beccf96ddcb292e50cc6828f0f96c38","signature":"4f5c299ecff2517776fe445e347332269d4eff25a18e4fb0f85a6939cf0023ad"},{"version":"520fe8dc6ab1af90bb3f2b17d5ca8c91090804f0787c51738d121146950c141d","signature":"0b19d2d2c2170d95753796bbd34bb3cbf37ac2376e7efb00946812181fd18954"},{"version":"4f971ce06978f6ff33644e8231938dcc6536796dcc6c1008ea14bedff3c53992","signature":"a0c837dfee7f4136bf57841c3bea692757ee7839e0acc3d20b864ba665ee7dc3"},{"version":"ae77d81a5541a8abb938a0efedf9ac4bea36fb3a24cc28cfa11c598863aba571","impliedFormat":1},{"version":"3cfb7c0c642b19fb75132154040bb7cd840f0002f9955b14154e69611b9b3f81","impliedFormat":1},{"version":"8387ec1601cf6b8948672537cf8d430431ba0d87b1f9537b4597c1ab8d3ade5b","impliedFormat":1},{"version":"d16f1c460b1ca9158e030fdf3641e1de11135e0c7169d3e8cf17cc4cc35d5e64","impliedFormat":1},{"version":"a934063af84f8117b8ce51851c1af2b76efe960aa4c7b48d0343a1b15c01aedf","impliedFormat":1},{"version":"e3c5ad476eb2fca8505aee5bdfdf9bf11760df5d0f9545db23f12a5c4d72a718","impliedFormat":1},{"version":"462bccdf75fcafc1ae8c30400c9425e1a4681db5d605d1a0edb4f990a54d8094","impliedFormat":1},{"version":"5923d8facbac6ecf7c84739a5c701a57af94a6f6648d6229a6c768cf28f0f8cb","impliedFormat":1},{"version":"d0570ce419fb38287e7b39c910b468becb5b2278cf33b1000a3d3e82a46ecae2","impliedFormat":1},{"version":"3aca7f4260dad9dcc0a0333654cb3cde6664d34a553ec06c953bce11151764d7","impliedFormat":1},{"version":"a0a6f0095f25f08a7129bc4d7cb8438039ec422dc341218d274e1e5131115988","impliedFormat":1},{"version":"1d2699a343a347a830be26eb17ab340d7875c6f549c8d7477efb1773060cc7e5","impliedFormat":1},{"version":"45785e608b3d380c79e21957a6d1467e1206ac0281644e43e8ed6498808ace72","impliedFormat":1},{"version":"bece27602416508ba946868ad34d09997911016dbd6893fb884633017f74e2c5","impliedFormat":1},{"version":"2a90177ebaef25de89351de964c2c601ab54d6e3a157cba60d9cd3eaf5a5ee1a","impliedFormat":1},{"version":"82200e963d3c767976a5a9f41ecf8c65eca14a6b33dcbe00214fcbe959698c46","impliedFormat":1},{"version":"b4966c503c08bbd9e834037a8ab60e5f53c5fd1092e8873c4a1c344806acdab2","impliedFormat":1},{"version":"b598deb1da203a2b58c76cf8d91cfc2ca172d785dacd8466c0a11e400ff6ab2d","impliedFormat":1},{"version":"f3ded47c50efa3fbc7105c933490fa0cf48df063248a5b27bca5849d5d126f9b","impliedFormat":1},{"version":"3a85a56527d57bc2cac46a8a4566ac0d868b30e024e264245f01ed9fb7c589a2","signature":"70e9b1beaaeef46e4c81fb4f28bf6df151255886bbf6ae41493da494e93a4dce"},{"version":"9efdc2ef25d732885489206b766276ac51fe2ac4e9d73f5dcc2cb60812103b2b","signature":"523d8ac9a5553450690b57ff8c8b8ab1c5c3b4b162eb27bd321a835822ee2879"},"16a1968855e8e8e4c2f354b03fe6f533c7d007c5e218bb5dbda84d8db19301f9",{"version":"b51fb3ae19c62cea8c1aad18a569b939b1203cf0f0beede96a95c9ef00dc821d","impliedFormat":1},{"version":"920ec58be5e9da260ad1003a45ee82fd4ce26ce69f264817c89d08bc163d6f05","signature":"e09811419a1031b58b0a7bacd6341fe2aecba4143f1432fcf0f40dc2770f5a8a"},{"version":"babd7d7e8cd43139a4bd3d8feb37807f4910401b24c1edf389ae2710e0e2978f","signature":"397c6e753274576c931257a7baa73216ac5ef57baa629bd14012e7c97cc3aef1"},{"version":"85f84856992b86d12cd5235412a2172893d0bad2f526395a3b0f5a6e29f5b2bc","signature":"f5c9ab8a864a67df6a43a37aae537e36a9ab0cfc6a12ecb7ea3eb8b9175fd8a8"},{"version":"53856f1b20bdb5a874684e8101b2413b66e007a580d9063fb8c2785ecc392b0a","signature":"3eb972ae325aa293fdb6077cdf956f209ee6ea34b4e874ff7ec8686b3079972f"},{"version":"f1a36fe996cb826817d89d8da31356606bdc9d219dad2b5b8f3789d0156cb066","signature":"3a8523bfa20e149df671c3166d3c2e0c8e5b9f015b121a6855deedf209096b5e"},{"version":"87f25744b0b6e985d7f87af992f0f29e3d1978c1e963f131603878263159e78e","signature":"6512b35d71042c20407af981ecc7d081377ca7ec5764bef9603f8c6ce28b1a36"},"516b409c6ded059b7938fa19dbbf1e982c82966a305c9331df43cb8760e3df25","d3aa2960fd78d972068b0bba251699f8cc24ae4af4b0d4d95479a5d73ec0424e","eecbc2ac9b2bfdd7120cce72d6487a164becc5a9ed3b8a49a83de3f5a211cd5e","e6a95bf8c6f0c19fa0bb12803fbedbd2d127ac9fe19e8ab49c854e9dd9a5c163","0523c75c01ecdd8a05c1b432afe9dee5739c29010f21fdcb1a09d7f5bb2143a9",{"version":"250e80d476d7acdfc32f58acc58b334ff0246583947242d8059f5ad78c88de5f","signature":"a4d80af3069a60d8964e10f9936ca6e5fc2faf63f82cd6c84893cae1828b6c29"},"7aa47dbe20f7722a1e16d765dcd13dec7cedaea1a9a551c035bb77466c61680c","eb4c413c8b2eb7128e0e9c3fc1fd94be4ac0262896411b555dbccbd10d5fb590","fc546ab93cd4e76ff44f1b7119fe9d39b0b61dbe5535d27a9ac4ef66c8a97991","3912036b6a602c60eeb3079cd9030c8686b2a650c16b24b39c7add2ad988acd0",{"version":"60cb3319e71dc09ec055a0975b6329f996960751186241049ab0e9f5dad775d7","signature":"2cc743b624d6891f9275f11f76fedfe235af04641c806e7dc65e55740db4dd29"},{"version":"c2c2a861a338244d7dd700d0c52a78916b4bb75b98fc8ca5e7c501899fc03796","impliedFormat":1},{"version":"b6d03c9cfe2cf0ba4c673c209fcd7c46c815b2619fd2aad59fc4229aaef2ed43","impliedFormat":1},{"version":"adb467429462e3891de5bb4a82a4189b92005d61c7f9367c089baf03997c104e","impliedFormat":1},{"version":"670a76db379b27c8ff42f1ba927828a22862e2ab0b0908e38b671f0e912cc5ed","impliedFormat":1},{"version":"13b77ab19ef7aadd86a1e54f2f08ea23a6d74e102909e3c00d31f231ed040f62","impliedFormat":1},{"version":"069bebfee29864e3955378107e243508b163e77ab10de6a5ee03ae06939f0bb9","impliedFormat":1},{"version":"afe73051ff6a03a9565cbd8ebb0e956ee3df5e913ad5c1ded64218aabfa3dcb5","impliedFormat":1},{"version":"035a5df183489c2e22f3cf59fc1ed2b043d27f357eecc0eb8d8e840059d44245","impliedFormat":1},{"version":"a4809f4d92317535e6b22b01019437030077a76fec1d93b9881c9ed4738fcc54","impliedFormat":1},{"version":"5f53fa0bd22096d2a78533f94e02c899143b8f0f9891a46965294ee8b91a9434","impliedFormat":1},{"version":"cdcc132f207d097d7d3aa75615ab9a2e71d6a478162dde8b67f88ea19f3e54de","impliedFormat":1},{"version":"0d14fa22c41fdc7277e6f71473b20ebc07f40f00e38875142335d5b63cdfc9d2","impliedFormat":1},{"version":"c085e9aa62d1ae1375794c1fb927a445fa105fed891a7e24edbb1c3300f7384a","impliedFormat":1},{"version":"f315e1e65a1f80992f0509e84e4ae2df15ecd9ef73df975f7c98813b71e4c8da","impliedFormat":1},{"version":"5b9586e9b0b6322e5bfbd2c29bd3b8e21ab9d871f82346cb71020e3d84bae73e","impliedFormat":1},{"version":"3e70a7e67c2cb16f8cd49097360c0309fe9d1e3210ff9222e9dac1f8df9d4fb6","impliedFormat":1},{"version":"ab68d2a3e3e8767c3fba8f80de099a1cfc18c0de79e42cb02ae66e22dfe14a66","impliedFormat":1},{"version":"d96cc6598148bf1a98fb2e8dcf01c63a4b3558bdaec6ef35e087fd0562eb40ec","impliedFormat":1},{"version":"5b9586e9b0b6322e5bfbd2c29bd3b8e21ab9d871f82346cb71020e3d84bae73e","impliedFormat":1},{"version":"f8db4fea512ab759b2223b90ecbbe7dae919c02f8ce95ec03f7fb1cf757cfbeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"19990350fca066265b2c190c9b6cde1229f35002ea2d4df8c9e397e9942f6c89","impliedFormat":99},{"version":"8fb8fdda477cd7382477ffda92c2bb7d9f7ef583b1aa531eb6b2dc2f0a206c10","impliedFormat":99},{"version":"66995b0c991b5c5d42eff1d950733f85482c7419f7296ab8952e03718169e379","impliedFormat":99},{"version":"9863f888da357e35e013ca3465b794a490a198226bd8232c2f81fb44e16ff323","impliedFormat":99},{"version":"84bc2d80326a83ee4a6e7cba2fd480b86502660770c0e24da96535af597c9f1e","impliedFormat":99},{"version":"ea27768379b866ee3f5da2419650acdb01125479f7af73580a4bceb25b79e372","impliedFormat":99},{"version":"598931eeb4362542cae5845f95c5f0e45ac668925a40ce201e244d7fe808e965","impliedFormat":99},{"version":"da9ef88cde9f715756da642ad80c4cd87a987f465d325462d6bc2a0b11d202c8","impliedFormat":99},{"version":"b4c6184d78303b0816e779a48bef779b15aea4a66028eb819aac0abee8407dea","impliedFormat":99},{"version":"db085d2171d48938a99e851dafe0e486dce9859e5dfa73c21de5ed3d4d6fb0c5","impliedFormat":99},{"version":"62a3ad1ddd1f5974b3bf105680b3e09420f2230711d6520a521fab2be1a32838","impliedFormat":99},{"version":"a77be6fc44c876bc10c897107f84eaba10790913ebdcad40fcda7e47469b2160","impliedFormat":99},{"version":"06cf55b6da5cef54eaaf51cdc3d4e5ebf16adfdd9ebd20cec7fe719be9ced017","impliedFormat":99},{"version":"91f5dbcdb25d145a56cffe957ec665256827892d779ef108eb2f3864faff523b","impliedFormat":99},{"version":"052ba354bab8fb943e0bc05a0769f7b81d7c3b3c6cd0f5cfa53c7b2da2a525c5","impliedFormat":99},{"version":"927955a3de5857e0a1c575ced5a4245e74e6821d720ed213141347dd1870197f","impliedFormat":99},{"version":"fec804d54cd97dd77e956232fc37dc13f53e160d4bbeeb5489e86eeaa91f7ebd","impliedFormat":99},{"version":"03c258e060b7da220973f84b89615e4e9850e9b5d30b3a8e4840b3e3268ae8eb","impliedFormat":1},{"version":"fd0589ca571ad090b531d8c095e26caa53d4825c64d3ff2b2b1ab95d72294175","impliedFormat":1},{"version":"669843ecafb89ae1e944df06360e8966219e4c1c34c0d28aa2503272cdd444a7","affectsGlobalScope":true,"impliedFormat":1},{"version":"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","impliedFormat":1},{"version":"ab82804a14454734010dcdcd43f564ff7b0389bee4c5692eec76ff5b30d4cf66","impliedFormat":1},{"version":"bae8d023ef6b23df7da26f51cea44321f95817c190342a36882e93b80d07a960","impliedFormat":1},{"version":"26a770cec4bd2e7dbba95c6e536390fffe83c6268b78974a93727903b515c4e7","impliedFormat":1}],"root":[[404,407],[427,429],[431,447]],"options":{"allowJs":true,"esModuleInterop":true,"jsx":1,"module":99,"skipLibCheck":true,"strict":true},"referencedMap":[[444,1],[445,2],[446,3],[447,4],[404,5],[450,6],[448,7],[458,7],[461,8],[357,7],[460,7],[422,7],[419,7],[418,7],[413,9],[424,10],[409,11],[420,12],[412,13],[411,14],[421,7],[416,15],[423,7],[417,16],[410,7],[426,17],[408,7],[453,18],[449,6],[451,19],[452,6],[454,20],[455,7],[456,21],[457,22],[467,23],[466,24],[486,25],[487,26],[488,7],[142,27],[143,27],[144,28],[99,29],[145,30],[146,31],[147,32],[94,7],[97,33],[95,7],[96,7],[148,34],[149,35],[150,36],[151,37],[152,38],[153,39],[154,39],[155,40],[156,41],[157,42],[158,43],[100,7],[98,7],[159,44],[160,45],[161,46],[193,47],[162,48],[163,49],[164,50],[165,51],[166,52],[167,53],[168,54],[169,55],[170,56],[171,57],[172,57],[173,58],[174,7],[175,59],[177,60],[176,61],[178,62],[179,63],[180,64],[181,65],[182,66],[183,67],[184,68],[185,69],[186,70],[187,71],[188,72],[189,73],[190,74],[101,7],[102,7],[103,7],[141,75],[191,76],[192,77],[86,7],[198,78],[199,79],[197,80],[425,81],[195,82],[196,83],[84,7],[87,84],[283,80],[489,7],[485,7],[490,7],[491,85],[459,7],[85,7],[474,7],[475,86],[472,7],[473,7],[465,87],[463,88],[462,24],[464,89],[430,80],[93,90],[360,91],[364,92],[366,93],[219,94],[233,95],[331,96],[264,7],[334,97],[297,98],[305,99],[332,100],[220,101],[263,7],[265,102],[333,103],[240,104],[221,105],[244,104],[234,104],[204,104],[289,106],[209,7],[286,107],[290,108],[375,109],[284,108],[376,110],[270,7],[287,111],[388,112],[387,113],[292,108],[386,7],[384,7],[385,114],[288,80],[276,115],[285,116],[300,117],[301,118],[291,119],[272,120],[379,121],[382,122],[251,123],[250,124],[249,125],[391,80],[248,126],[225,7],[394,7],[397,7],[396,80],[398,127],[200,7],[325,7],[232,128],[202,129],[348,7],[349,7],[351,7],[354,130],[350,7],[352,131],[353,131],[218,7],[231,7],[359,132],[367,133],[371,134],[214,135],[278,136],[277,7],[271,137],[296,138],[294,139],[293,7],[295,7],[299,140],[274,141],[213,142],[238,143],[322,144],[205,145],[212,146],[201,96],[336,147],[346,148],[335,7],[345,149],[239,7],[223,150],[314,151],[313,7],[321,152],[315,153],[319,154],[320,155],[318,153],[317,155],[316,153],[260,156],[245,156],[308,157],[246,157],[207,158],[206,7],[312,159],[311,160],[310,161],[309,162],[208,163],[282,164],[298,165],[281,166],[304,167],[306,168],[303,166],[241,163],[194,7],[323,169],[266,170],[344,171],[269,172],[339,173],[211,7],[340,174],[342,175],[343,176],[326,7],[338,145],[242,177],[324,178],[347,179],[215,7],[217,7],[222,180],[307,181],[210,182],[216,7],[268,183],[267,184],[224,185],[275,186],[273,187],[226,188],[228,189],[395,7],[227,190],[229,191],[362,7],[361,7],[363,7],[393,7],[230,192],[280,80],[92,7],[302,193],[252,7],[262,194],[369,80],[378,195],[259,80],[373,108],[258,196],[356,197],[257,195],[203,7],[380,198],[255,80],[256,80],[247,7],[261,7],[254,199],[253,200],[243,201],[237,119],[341,7],[236,202],[235,7],[365,7],[279,80],[358,203],[83,7],[91,204],[88,80],[89,7],[90,7],[337,205],[330,206],[329,7],[328,207],[327,7],[368,208],[370,209],[372,210],[374,211],[377,212],[403,213],[381,213],[402,214],[383,215],[389,216],[390,217],[392,218],[399,219],[401,7],[400,220],[355,221],[470,222],[483,223],[468,7],[469,224],[484,225],[479,226],[480,227],[478,228],[482,229],[476,230],[471,231],[481,232],[477,223],[415,233],[414,7],[81,7],[82,7],[13,7],[14,7],[16,7],[15,7],[2,7],[17,7],[18,7],[19,7],[20,7],[21,7],[22,7],[23,7],[24,7],[3,7],[25,7],[26,7],[4,7],[27,7],[31,7],[28,7],[29,7],[30,7],[32,7],[33,7],[34,7],[5,7],[35,7],[36,7],[37,7],[38,7],[6,7],[42,7],[39,7],[40,7],[41,7],[43,7],[7,7],[44,7],[49,7],[50,7],[45,7],[46,7],[47,7],[48,7],[8,7],[54,7],[51,7],[52,7],[53,7],[55,7],[9,7],[56,7],[57,7],[58,7],[60,7],[59,7],[61,7],[62,7],[10,7],[63,7],[64,7],[65,7],[11,7],[66,7],[67,7],[68,7],[69,7],[70,7],[1,7],[71,7],[72,7],[12,7],[76,7],[74,7],[79,7],[78,7],[73,7],[77,7],[75,7],[80,7],[119,234],[129,235],[118,234],[139,236],[110,237],[109,238],[138,220],[132,239],[137,240],[112,241],[126,242],[111,243],[135,244],[107,245],[106,220],[136,246],[108,247],[113,248],[114,7],[117,248],[104,7],[140,249],[130,250],[121,251],[122,252],[124,253],[120,254],[123,255],[133,220],[115,256],[116,257],[125,258],[105,259],[128,250],[127,248],[131,7],[134,260],[407,261],[428,262],[429,263],[434,264],[435,265],[436,266],[432,267],[437,80],[438,268],[439,269],[433,269],[440,267],[431,270],[441,271],[442,269],[443,272],[427,80],[406,271],[405,7]],"affectedFilesPendingEmit":[444,445,446,447,407,428,429,434,435,436,432,437,438,439,433,440,431,441,442,443,427,406,405],"version":"5.9.3"} From 9ba25299962e4b8c3ac3a83f361df05f9ff43326 Mon Sep 17 00:00:00 2001 From: Vedank Purohit Date: Sun, 11 Jan 2026 22:34:09 +0530 Subject: [PATCH 5/9] lint fix --- core/database.py | 2 +- core/ocr_providers/apple_vision.py | 4 +--- core/ocr_providers/tesseract.py | 2 +- scripts/benchmark_ocr.py | 36 +++++++++++++++--------------- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/core/database.py b/core/database.py index 5ff02d4..3cf2208 100644 --- a/core/database.py +++ b/core/database.py @@ -1231,7 +1231,7 @@ def _create_snippet(self, text: str, query: str, context_chars: int = 50) -> str if start > 0: snippet += "..." snippet += text[start:best_pos] - snippet += f"**{text[best_pos:best_pos + len(best_word)]}**" + snippet += f"**{text[best_pos : best_pos + len(best_word)]}**" snippet += text[best_pos + len(best_word) : end] if end < len(text): snippet += "..." diff --git a/core/ocr_providers/apple_vision.py b/core/ocr_providers/apple_vision.py index 9d5ed48..e149948 100644 --- a/core/ocr_providers/apple_vision.py +++ b/core/ocr_providers/apple_vision.py @@ -47,9 +47,7 @@ def _get_ocr(self): self._ocr = OCR except ImportError as e: - raise ImportError( - "ocrmac is required for Apple Vision OCR. " "Install it with: pip install ocrmac" - ) from e + raise ImportError("ocrmac is required for Apple Vision OCR. Install it with: pip install ocrmac") from e return self._ocr def extract_text(self, image_path: str | Path) -> OCRResult: diff --git a/core/ocr_providers/tesseract.py b/core/ocr_providers/tesseract.py index b64d6a0..61a304d 100644 --- a/core/ocr_providers/tesseract.py +++ b/core/ocr_providers/tesseract.py @@ -51,7 +51,7 @@ def _get_pytesseract(self): self._pytesseract = pytesseract except ImportError as e: raise ImportError( - "pytesseract is required for Tesseract OCR. " "Install it with: pip install pytesseract" + "pytesseract is required for Tesseract OCR. Install it with: pip install pytesseract" ) from e return self._pytesseract diff --git a/scripts/benchmark_ocr.py b/scripts/benchmark_ocr.py index 3c7ff65..799a374 100644 --- a/scripts/benchmark_ocr.py +++ b/scripts/benchmark_ocr.py @@ -103,7 +103,7 @@ def benchmark_clip(images: list[Path]) -> dict: times.append(elapsed) if i < 3: # Show first few - print(f" [{i+1}] {img.name}: {elapsed*1000:.1f}ms (dim={len(embedding)})") + print(f" [{i + 1}] {img.name}: {elapsed * 1000:.1f}ms (dim={len(embedding)})") elif i == 3: print(f" ... processing {len(images) - 3} more ...") @@ -148,7 +148,7 @@ def benchmark_ocr(images: list[Path], show_output: bool = False) -> dict: ) if i < 5 or show_output: # Show first few or all if requested - print(f" [{i+1}] {img.name}: {elapsed*1000:.1f}ms") + print(f" [{i + 1}] {img.name}: {elapsed * 1000:.1f}ms") conf_str = f"{result.confidence:.2f}" if result.confidence is not None else "N/A" print(f" Words: {word_count}, Confidence: {conf_str}") if show_output: @@ -221,7 +221,7 @@ def benchmark_chunking(ocr_texts: list[str]) -> dict: chunk_counts.append(total_chunks) if i < 3: - print(f" [{i+1}] {len(text)} chars: {elapsed*1000:.2f}ms") + print(f" [{i + 1}] {len(text)} chars: {elapsed * 1000:.2f}ms") print(f" Small chunks: {len(result.small)}, Large chunks: {len(result.large)}") if not times: @@ -275,7 +275,7 @@ def benchmark_text_embedding(texts: list[str]) -> dict: elapsed = time.perf_counter() - start single_times.append(elapsed) if i < 3: - print(f" [{i+1}] {len(text)} chars: {elapsed*1000:.1f}ms (dim={len(emb)})") + print(f" [{i + 1}] {len(text)} chars: {elapsed * 1000:.1f}ms (dim={len(emb)})") # Batch embedding benchmark print("\n Batch embedding (all at once):") @@ -296,7 +296,7 @@ def benchmark_text_embedding(texts: list[str]) -> dict: "total": elapsed, "per_item": per_item, } - print(f" Batch of {batch_size}: {elapsed*1000:.1f}ms total, {per_item*1000:.1f}ms/item") + print(f" Batch of {batch_size}: {elapsed * 1000:.1f}ms total, {per_item * 1000:.1f}ms/item") return { "name": "Text Embedding", @@ -319,21 +319,21 @@ def print_summary(results: list[dict]): print(f"\n {r['name']}:") if "mean" in r: - print(f" Mean: {r['mean']*1000:.1f}ms") - print(f" Median: {r['median']*1000:.1f}ms") - print(f" Min: {r['min']*1000:.1f}ms") - print(f" Max: {r['max']*1000:.1f}ms") + print(f" Mean: {r['mean'] * 1000:.1f}ms") + print(f" Median: {r['median'] * 1000:.1f}ms") + print(f" Min: {r['min'] * 1000:.1f}ms") + print(f" Max: {r['max'] * 1000:.1f}ms") if r.get("stdev"): - print(f" StdDev: {r['stdev']*1000:.1f}ms") + print(f" StdDev: {r['stdev'] * 1000:.1f}ms") if "avg_words" in r: print(f" Avg words/image: {r['avg_words']:.1f}") print(f" Empty OCR count: {r['empty_count']}") if "avg_chunks" in r: print(f" Avg chunks/text: {r['avg_chunks']:.1f}") if "batch_results" in r: - print(f" Single embedding: {r['single_mean']*1000:.1f}ms") + print(f" Single embedding: {r['single_mean'] * 1000:.1f}ms") for bs, br in r["batch_results"].items(): - print(f" Batch {bs}: {br['per_item']*1000:.1f}ms/item ({br['total']*1000:.0f}ms total)") + print(f" Batch {bs}: {br['per_item'] * 1000:.1f}ms/item ({br['total'] * 1000:.0f}ms total)") # Estimate total processing time per image print("\n" + "-" * 60) @@ -354,13 +354,13 @@ def print_summary(results: list[dict]): emb_time = emb_time * avg_chunks # Multiply by avg chunks per image total = clip_time + ocr_time + chunk_time + emb_time - print(f" CLIP: {clip_time*1000:.0f}ms") - print(f" OCR: {ocr_time*1000:.0f}ms") - print(f" Chunking: {chunk_time*1000:.0f}ms") - print(f" Embedding: {emb_time*1000:.0f}ms (batch, ~{avg_chunks:.0f} chunks)") + print(f" CLIP: {clip_time * 1000:.0f}ms") + print(f" OCR: {ocr_time * 1000:.0f}ms") + print(f" Chunking: {chunk_time * 1000:.0f}ms") + print(f" Embedding: {emb_time * 1000:.0f}ms (batch, ~{avg_chunks:.0f} chunks)") print(" ─────────────────────") - print(f" TOTAL: {total*1000:.0f}ms/image") - print(f"\n For 20,000 images: ~{total*20000/60:.0f} minutes") + print(f" TOTAL: {total * 1000:.0f}ms/image") + print(f"\n For 20,000 images: ~{total * 20000 / 60:.0f} minutes") def main(): From 9cea0f3f957f2b5cdb523b64509566f71546ce9c Mon Sep 17 00:00:00 2001 From: Vedank Purohit Date: Sun, 11 Jan 2026 23:05:47 +0530 Subject: [PATCH 6/9] fix: Address CodeRabbit review suggestions - Replace bare except/print with proper logging in API routes - Add thread error handling in sync recompute background task - Fix zero vector handling in cosine_similarity - Add provider caching to OCRService - Remove unused offset variable in processor - Fix division by zero in setup page progress calculation - Add SearchMode enum validation in search endpoint - Fix benchmark script hardcoded path and undefined variable --- api/main.py | 12 ++++++++---- api/routes/events.py | 15 +++++++++------ api/routes/search.py | 2 +- api/routes/setup.py | 10 +++++++--- api/routes/sync.py | 17 ++++++++++++----- api/schemas.py | 22 +++++++++++----------- core/database.py | 31 ++++++++++++++++++++++++------- core/embeddings.py | 4 ++++ core/ocr.py | 8 +++++++- core/processor.py | 3 --- core/text_embeddings.py | 6 +++++- scripts/benchmark_ocr.py | 29 +++++++++++++++++++++++++---- scripts/cleanup_ocr.py | 2 +- web/src/app/setup/page.tsx | 8 +++++--- 14 files changed, 119 insertions(+), 50 deletions(-) diff --git a/api/main.py b/api/main.py index 49e3552..6b53715 100644 --- a/api/main.py +++ b/api/main.py @@ -54,10 +54,14 @@ async def lifespan(app: FastAPI): from core.processor import processor_service if config.ocr.enabled: - ocr_pending = db.get_ocr_pending_count() - if ocr_pending > 0: - print(f"🔄 Starting OCR migration for {ocr_pending} existing screenshots...") - processor_service.start_ocr_migration() + try: + ocr_pending = db.get_ocr_pending_count() + if ocr_pending > 0: + print(f"🔄 Starting OCR migration for {ocr_pending} existing screenshots...") + processor_service.start_ocr_migration() + except Exception as e: + # Don't crash the API if OCR migration fails - log and continue + logging.getLogger(__name__).exception("Failed to start OCR migration: %s", e) yield diff --git a/api/routes/events.py b/api/routes/events.py index f9c70a6..f945a1a 100644 --- a/api/routes/events.py +++ b/api/routes/events.py @@ -11,6 +11,7 @@ import asyncio import contextlib import json +import logging import threading from collections.abc import AsyncGenerator from contextlib import asynccontextmanager @@ -20,6 +21,8 @@ from core.database import db +logger = logging.getLogger(__name__) + router = APIRouter(prefix="/events", tags=["Events"]) # Global event queue for broadcasting events to all connected clients @@ -78,8 +81,8 @@ async def event_generator() -> AsyncGenerator[str, None]: "device": clip_status["device"], }, ) - except Exception: - pass + except Exception as e: + logger.warning("Error getting CLIP model status: %s", e) try: from core.text_embeddings import get_model_status as get_bge_status @@ -93,8 +96,8 @@ async def event_generator() -> AsyncGenerator[str, None]: "device": bge_status["device"], }, ) - except Exception: - pass + except Exception as e: + logger.warning("Error getting text embedding model status: %s", e) # Send initial sync status try: @@ -114,8 +117,8 @@ async def event_generator() -> AsyncGenerator[str, None]: "text_embeddings_done": progress.text_embeddings_done, }, ) - except Exception: - pass + except Exception as e: + logger.warning("Error getting sync progress: %s", e) # Listen for new events while True: diff --git a/api/routes/search.py b/api/routes/search.py index 077568f..37d1cae 100644 --- a/api/routes/search.py +++ b/api/routes/search.py @@ -57,7 +57,7 @@ async def search_screenshots(request: SearchRequest): detail="No synced screenshots. Run sync first to generate embeddings.", ) - search_mode = request.search_mode.lower() + search_mode = request.search_mode.value # Generate embeddings based on search mode image_embedding = None diff --git a/api/routes/setup.py b/api/routes/setup.py index 6651ef6..3405e15 100644 --- a/api/routes/setup.py +++ b/api/routes/setup.py @@ -3,6 +3,8 @@ Handle first-run and version-change setup flow for screen recording permissions """ +import logging + from fastapi import APIRouter, HTTPException from pydantic import BaseModel @@ -11,6 +13,8 @@ from core.platform import current_platform from core.updater import VERSION +logger = logging.getLogger(__name__) + router = APIRouter(prefix="/setup", tags=["Setup"]) @@ -157,7 +161,7 @@ async def get_model_status(): if status.get("loaded") or status.get("downloaded"): clip_status = "ready" except Exception as e: - print(f"Error checking CLIP model status: {e}") + logger.warning("Error checking CLIP model status: %s", e) # Text embedding model status text_embedding_status = "not_downloaded" @@ -168,7 +172,7 @@ async def get_model_status(): if status.get("loaded") or status.get("downloaded"): text_embedding_status = "ready" except Exception as e: - print(f"Error checking text embedding model status: {e}") + logger.warning("Error checking text embedding model status: %s", e) # OCR status ocr_status = "not_available" @@ -178,7 +182,7 @@ async def get_model_status(): if ocr_service.is_available(): ocr_status = "ready" except Exception as e: - print(f"Error checking OCR status: {e}") + logger.warning("Error checking OCR status: %s", e) return { "clip": clip_status, diff --git a/api/routes/sync.py b/api/routes/sync.py index 28abd60..c00aa24 100644 --- a/api/routes/sync.py +++ b/api/routes/sync.py @@ -8,6 +8,8 @@ 3. BGE text embeddings (for text semantic search) """ +import logging + from fastapi import APIRouter, BackgroundTasks, HTTPException from api.schemas import ( @@ -31,6 +33,8 @@ ) from core.processor import SyncProgress, processor_service +logger = logging.getLogger(__name__) + router = APIRouter(prefix="/sync", tags=["Sync"]) @@ -281,7 +285,10 @@ async def recompute_ocr(): import threading def run_recompute(): - processor_service.recompute_ocr() + try: + processor_service.recompute_ocr() + except Exception as e: + logger.exception("Error during OCR recompute: %s", e) thread = threading.Thread(target=run_recompute, daemon=True) thread.start() @@ -317,8 +324,8 @@ async def get_all_models_status(): idle_seconds=text_status["idle_seconds"], auto_unload_seconds=text_status["auto_unload_seconds"], ) - except Exception: - pass + except Exception as e: + logger.warning("Error getting text embedding model status: %s", e) # OCR status ocr_status = "not_available" @@ -327,8 +334,8 @@ async def get_all_models_status(): if ocr_service.is_available(): ocr_status = ocr_service.get_provider_name() - except Exception: - pass + except Exception as e: + logger.warning("Error getting OCR status: %s", e) return AllModelsStatus( clip=clip, diff --git a/api/schemas.py b/api/schemas.py index 9199d50..b8635c8 100644 --- a/api/schemas.py +++ b/api/schemas.py @@ -165,13 +165,22 @@ class SyncStartResponse(BaseModel): # ============================================================================= +class SearchMode(str, Enum): + """Available search modes""" + + AUTO = "auto" # Hybrid - combines all methods (default) + IMAGE = "image" # CLIP image semantic search only + TEXT_FUZZY = "text_fuzzy" # FTS5 trigram text search only + TEXT_SEMANTIC = "text_semantic" # BGE text embedding search only + + class SearchRequest(BaseModel): """Search request with mode selection""" query: str = Field(..., min_length=1, max_length=500) limit: int = Field(default=20, ge=1, le=100) - search_mode: str = Field( - default="auto", + search_mode: SearchMode = Field( + default=SearchMode.AUTO, description="Search mode: 'auto' (hybrid), 'image', 'text_fuzzy', 'text_semantic'", ) safe_mode: bool = Field(default=False) # Off by default for personal recall app @@ -540,15 +549,6 @@ class OCRStats(BaseModel): # ============================================================================= -class SearchMode(str, Enum): - """Available search modes""" - - AUTO = "auto" # Hybrid - combines all methods (default) - IMAGE = "image" # CLIP image semantic search only - TEXT_FUZZY = "text_fuzzy" # FTS5 trigram text search only - TEXT_SEMANTIC = "text_semantic" # BGE text embedding search only - - class MatchSource(str, Enum): """Source that contributed to a search match""" diff --git a/core/database.py b/core/database.py index 3cf2208..2d3e50b 100644 --- a/core/database.py +++ b/core/database.py @@ -769,15 +769,24 @@ def add_ocr_text( word_count = len(full_text.split()) if full_text else 0 with self.cursor() as cur: - # Use INSERT OR REPLACE to handle re-processing gracefully + # Use ON CONFLICT DO UPDATE to preserve the id (avoid orphaning chunks) cur.execute( """ - INSERT OR REPLACE INTO screenshot_ocr (screenshot_id, full_text, confidence, word_count) + INSERT INTO screenshot_ocr (screenshot_id, full_text, confidence, word_count) VALUES (?, ?, ?, ?) + ON CONFLICT(screenshot_id) DO UPDATE SET + full_text = excluded.full_text, + confidence = excluded.confidence, + word_count = excluded.word_count """, (screenshot_id, full_text, confidence, word_count), ) - return cur.lastrowid + # Get the id (either new or existing) + cur.execute( + "SELECT id FROM screenshot_ocr WHERE screenshot_id = ?", + (screenshot_id,), + ) + return cur.fetchone()[0] def get_ocr_text(self, screenshot_id: int) -> dict | None: """Get OCR text for a screenshot""" @@ -826,8 +835,9 @@ def add_text_embedding(self, chunk_id: int, embedding: list[float]) -> bool: embedding_bytes = serialize_embedding(embedding) with self.cursor() as cur: + # Use INSERT OR REPLACE for idempotent reprocessing cur.execute( - "INSERT INTO ocr_text_embeddings (chunk_id, embedding) VALUES (?, ?)", + "INSERT OR REPLACE INTO ocr_text_embeddings (chunk_id, embedding) VALUES (?, ?)", (chunk_id, embedding_bytes), ) return True @@ -977,8 +987,15 @@ def search_text_embeddings( query_bytes = serialize_embedding(query_embedding) - # Build conditions - chunk_condition = f"AND c.chunk_size = '{chunk_size}'" if chunk_size else "" + # Build conditions with parameterized queries to prevent SQL injection + params: list = [query_bytes, limit * 2] + chunk_condition = "" + if chunk_size: + # Validate chunk_size to prevent SQL injection + if chunk_size not in ("small", "large"): + raise ValueError(f"chunk_size must be 'small' or 'large', got '{chunk_size}'") + chunk_condition = "AND c.chunk_size = ?" + params.append(chunk_size) if visibility == "visible_only": vis_condition = "AND (s.is_hidden = 0 OR s.is_hidden IS NULL)" @@ -1008,7 +1025,7 @@ def search_text_embeddings( {vis_condition} ORDER BY e.distance ASC """, - (query_bytes, limit * 2), + params, ) results = [] diff --git a/core/embeddings.py b/core/embeddings.py index 9ce558e..c5301a2 100644 --- a/core/embeddings.py +++ b/core/embeddings.py @@ -141,6 +141,10 @@ def is_downloaded() -> bool: # Check for the sentence-transformers config file result = try_to_load_from_cache(model_id, "config_sentence_transformers.json") + if result is not None: + return True + # Fallback: some caches/models may use config.json + result = try_to_load_from_cache(model_id, "config.json") return result is not None except Exception: return False diff --git a/core/ocr.py b/core/ocr.py index 8a2ba44..bd6b3a1 100644 --- a/core/ocr.py +++ b/core/ocr.py @@ -86,10 +86,10 @@ class OCRService: """ _providers: dict[str, type[OCRProvider]] = {} - _instance: OCRProvider | None = None def __init__(self): self._current_provider: OCRProvider | None = None + self._provider_cache: dict[str, OCRProvider] = {} @classmethod def register(cls, name: str, provider_class: type[OCRProvider]) -> None: @@ -116,12 +116,18 @@ def get_provider(self, provider_name: str | None = None) -> OCRProvider: available = ", ".join(self._providers.keys()) raise ValueError(f"Unknown OCR provider: {provider_name}. Available: {available}") + # Check cache first + if provider_name in self._provider_cache: + return self._provider_cache[provider_name] + provider_class = self._providers[provider_name] provider = provider_class() if not provider.is_available(): raise RuntimeError(f"OCR provider '{provider_name}' is not available on this system") + # Cache for reuse + self._provider_cache[provider_name] = provider return provider def _get_default_provider_name(self) -> str: diff --git a/core/processor.py b/core/processor.py index 347fdcc..9fef8bd 100644 --- a/core/processor.py +++ b/core/processor.py @@ -469,7 +469,6 @@ def recompute_ocr(self, on_progress: Callable[[SyncProgress], None] | None = Non print(f"🔄 Recomputing OCR for {total} screenshots...") # Process all screenshots - offset = 0 batch_size = 10 while not self._cancel_requested: screenshots = db.get_screenshots_without_ocr(limit=batch_size) @@ -491,8 +490,6 @@ def recompute_ocr(self, on_progress: Callable[[SyncProgress], None] | None = Non if self._on_progress: self._on_progress(self._progress) - offset += batch_size - self._progress.is_running = False if self._on_progress: self._on_progress(self._progress) diff --git a/core/text_embeddings.py b/core/text_embeddings.py index a2b589c..eec706d 100644 --- a/core/text_embeddings.py +++ b/core/text_embeddings.py @@ -310,7 +310,11 @@ def cosine_similarity(emb1: list[float], emb2: list[float]) -> float: """Calculate cosine similarity between two embeddings""" a = np.array(emb1) b = np.array(emb2) - return float(np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))) + norm_a = np.linalg.norm(a) + norm_b = np.linalg.norm(b) + if norm_a == 0 or norm_b == 0: + return 0.0 + return float(np.dot(a, b) / (norm_a * norm_b)) # ============================================================================= diff --git a/scripts/benchmark_ocr.py b/scripts/benchmark_ocr.py index 799a374..2650db9 100644 --- a/scripts/benchmark_ocr.py +++ b/scripts/benchmark_ocr.py @@ -16,6 +16,8 @@ import argparse import contextlib +import os +import platform import random import statistics import sys @@ -346,29 +348,44 @@ def print_summary(results: list[dict]): # Get best batch embedding time emb_result = next((r for r in results if r["name"] == "Text Embedding"), None) emb_time = 0 + avg_chunks = next((r["avg_chunks"] for r in results if "avg_chunks" in r), 6) if emb_result and "batch_results" in emb_result: # Use largest batch per-item time largest = max(emb_result["batch_results"].keys()) emb_time = emb_result["batch_results"][largest]["per_item"] - avg_chunks = next((r["avg_chunks"] for r in results if "avg_chunks" in r), 6) emb_time = emb_time * avg_chunks # Multiply by avg chunks per image total = clip_time + ocr_time + chunk_time + emb_time print(f" CLIP: {clip_time * 1000:.0f}ms") print(f" OCR: {ocr_time * 1000:.0f}ms") print(f" Chunking: {chunk_time * 1000:.0f}ms") - print(f" Embedding: {emb_time * 1000:.0f}ms (batch, ~{avg_chunks:.0f} chunks)") + if emb_time > 0: + print(f" Embedding: {emb_time * 1000:.0f}ms (batch, ~{avg_chunks:.0f} chunks)") + else: + print(" Embedding: skipped") print(" ─────────────────────") print(f" TOTAL: {total * 1000:.0f}ms/image") print(f"\n For 20,000 images: ~{total * 20000 / 60:.0f} minutes") +def get_default_screenshots_dir() -> str: + """Get platform-appropriate default screenshots directory""" + system = platform.system() + if system == "Darwin": + return str(Path.home() / "Library/Application Support/LiveRecall/screenshots") + elif system == "Windows": + appdata = os.environ.get("APPDATA", str(Path.home() / "AppData/Roaming")) + return str(Path(appdata) / "LiveRecall/screenshots") + else: + return str(Path.home() / ".local/share/LiveRecall/screenshots") + + def main(): parser = argparse.ArgumentParser(description="Benchmark OCR and embedding performance") parser.add_argument( "--dir", - default="/Users/vedank/Library/Application Support/LiveRecall/screenshots", - help="Directory containing screenshots", + default=None, + help="Directory containing screenshots (default: platform-specific LiveRecall data dir)", ) parser.add_argument("--count", type=int, default=100, help="Number of images to test") parser.add_argument("--show-ocr", action="store_true", help="Show full OCR output for each image") @@ -378,6 +395,10 @@ def main(): args = parser.parse_args() + # Use platform-appropriate default if not specified + if args.dir is None: + args.dir = get_default_screenshots_dir() + print(f"Benchmarking with {args.count} random images from:") print(f" {args.dir}") diff --git a/scripts/cleanup_ocr.py b/scripts/cleanup_ocr.py index a662c02..cd8fbed 100644 --- a/scripts/cleanup_ocr.py +++ b/scripts/cleanup_ocr.py @@ -17,7 +17,7 @@ from core.database import db # noqa: E402 -def main(): +def main() -> None: print("OCR Data Cleanup Script") print("=" * 50) diff --git a/web/src/app/setup/page.tsx b/web/src/app/setup/page.tsx index ae8687c..f18628f 100644 --- a/web/src/app/setup/page.tsx +++ b/web/src/app/setup/page.tsx @@ -98,7 +98,7 @@ export default function SetupPage() { const textReady = status.text_embedding_status === 'ready' || eventStatus?.text_embedding?.downloaded; // Check if models are downloading or not ready - if (!clipReady || + if (!clipReady || !textReady || (eventStatus?.clip?.downloading) || (eventStatus?.text_embedding?.downloading)) { return 'models'; @@ -222,9 +222,11 @@ export default function SetupPage() { const isFirstRun = status && !status.last_seen_version; const isUpdate = status && status.last_seen_version && status.last_seen_version !== status.current_version; - // Calculate migration progress + // Calculate migration progress (guard against division by zero) const migrationProgress = eventStatus?.ocr_stats - ? (eventStatus.ocr_stats.completed / (eventStatus.ocr_stats.completed + eventStatus.ocr_stats.pending)) * 100 + ? (eventStatus.ocr_stats.completed + eventStatus.ocr_stats.pending > 0 + ? (eventStatus.ocr_stats.completed / (eventStatus.ocr_stats.completed + eventStatus.ocr_stats.pending)) * 100 + : 100) : status?.migration_status?.progress_percent ?? 0; return ( From 02e07f9885b840d78622bf0323465d2875e7f429 Mon Sep 17 00:00:00 2001 From: Vedank Purohit Date: Sun, 11 Jan 2026 23:12:06 +0530 Subject: [PATCH 7/9] refactor: Use module-level singleton for Apple Vision OCR Follow codebase conventions by caching the OCR class at module level instead of instance level. Adds proper type hints for _get_ocr_class(). --- core/ocr_providers/apple_vision.py | 34 +++++++++++++++++------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/core/ocr_providers/apple_vision.py b/core/ocr_providers/apple_vision.py index e149948..008b8bc 100644 --- a/core/ocr_providers/apple_vision.py +++ b/core/ocr_providers/apple_vision.py @@ -20,8 +20,26 @@ from typing import TYPE_CHECKING if TYPE_CHECKING: + from ocrmac.ocrmac import OCR as OCRType + from core.ocr import OCRResult +# Module-level singleton for OCR class (following codebase conventions) +_ocr_class: type[OCRType] | None = None + + +def _get_ocr_class() -> type[OCRType]: + """Get the OCR class, loading it if necessary (module-level singleton)""" + global _ocr_class + if _ocr_class is None: + try: + from ocrmac.ocrmac import OCR + + _ocr_class = OCR + except ImportError as e: + raise ImportError("ocrmac is required for Apple Vision OCR. Install it with: pip install ocrmac") from e + return _ocr_class + class AppleVisionOCR: """ @@ -36,20 +54,6 @@ class AppleVisionOCR: name = "apple_vision" - def __init__(self): - self._ocr = None - - def _get_ocr(self): - """Lazy load the ocrmac OCR instance""" - if self._ocr is None: - try: - from ocrmac.ocrmac import OCR - - self._ocr = OCR - except ImportError as e: - raise ImportError("ocrmac is required for Apple Vision OCR. Install it with: pip install ocrmac") from e - return self._ocr - def extract_text(self, image_path: str | Path) -> OCRResult: """ Extract text from an image using Apple Vision. @@ -66,7 +70,7 @@ def extract_text(self, image_path: str | Path) -> OCRResult: if not image_path.exists(): raise FileNotFoundError(f"Image not found: {image_path}") - OCR = self._get_ocr() + OCR = _get_ocr_class() try: # ocrmac returns list of (text, confidence, bbox) tuples From 5d05f2de6f7c11ea926ec4e8974061ab23caa6b5 Mon Sep 17 00:00:00 2001 From: Vedank Purohit Date: Sun, 11 Jan 2026 23:14:23 +0530 Subject: [PATCH 8/9] fix: Correct FTS result key name (relevance_score not fts_rank) The database returns BM25 score as 'relevance_score' but code was looking for 'fts_rank', causing text_fuzzy search similarity to always default to fallback values. --- api/routes/search.py | 2 +- core/database.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/routes/search.py b/api/routes/search.py index 37d1cae..53b26e2 100644 --- a/api/routes/search.py +++ b/api/routes/search.py @@ -120,7 +120,7 @@ async def search_screenshots(request: SearchRequest): ) # Normalize response format for r in results: - r["similarity"] = r.get("fts_rank", 0.5) # FTS rank as similarity + r["similarity"] = r.get("relevance_score", 0.5) # BM25 score as similarity r["match_sources"] = ["text_fts"] elif search_mode == "text_semantic": diff --git a/core/database.py b/core/database.py index 2d3e50b..8a62800 100644 --- a/core/database.py +++ b/core/database.py @@ -1110,7 +1110,7 @@ def search_hybrid( limit=limit * 2, visibility=visibility, ) - results_by_source["text_fts"] = [(r["id"], r.get("fts_rank", 0)) for r in fts_results] + results_by_source["text_fts"] = [(r["id"], r.get("relevance_score", 0)) for r in fts_results] except Exception as e: print(f"FTS search error: {e}") From 7290dd9ba612b0f77d71387c4c5a61c28c6124c3 Mon Sep 17 00:00:00 2001 From: Vedank Purohit Date: Sun, 11 Jan 2026 23:19:35 +0530 Subject: [PATCH 9/9] fix: Type safety and thread-safety improvements - Use SearchMode enum members instead of string comparisons in search.py - Add thread-safe double-checked locking to OCRService._provider_cache - Add thread-safe double-checked locking to _get_ocr_class() singleton - Remove unnecessary parentheses in setup page conditional --- api/routes/search.py | 13 ++++++------- core/ocr.py | 24 ++++++++++++++++-------- core/ocr_providers/apple_vision.py | 23 ++++++++++++++++------- web/src/app/setup/page.tsx | 4 ++-- 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/api/routes/search.py b/api/routes/search.py index 53b26e2..cf154b3 100644 --- a/api/routes/search.py +++ b/api/routes/search.py @@ -15,6 +15,7 @@ from fastapi import APIRouter, HTTPException from api.schemas import ( + SearchMode, SearchRequest, SearchResponse, SearchResult, @@ -57,15 +58,13 @@ async def search_screenshots(request: SearchRequest): detail="No synced screenshots. Run sync first to generate embeddings.", ) - search_mode = request.search_mode.value - # Generate embeddings based on search mode image_embedding = None text_embedding = None try: # CLIP image embedding (for image and auto modes) - if search_mode in ("auto", "image"): + if request.search_mode in (SearchMode.AUTO, SearchMode.IMAGE): if request.safe_mode: image_embedding = get_safe_search_embedding( text=request.query, @@ -81,7 +80,7 @@ async def search_screenshots(request: SearchRequest): image_embedding = get_text_embedding(request.query) # BGE text embedding (for text_semantic and auto modes) - if search_mode in ("auto", "text_semantic"): + if request.search_mode in (SearchMode.AUTO, SearchMode.TEXT_SEMANTIC): # Lazy import to avoid loading text model if not needed from core.text_embeddings import text_embedding_service @@ -97,7 +96,7 @@ async def search_screenshots(request: SearchRequest): search_limit = request.limit * 3 if (request.start_date or request.end_date) else request.limit try: - if search_mode == "image": + if request.search_mode == SearchMode.IMAGE: # Pure image search (legacy behavior) if image_embedding is None: raise HTTPException(status_code=500, detail="Failed to generate image embedding") @@ -111,7 +110,7 @@ async def search_screenshots(request: SearchRequest): for r in results: r["match_sources"] = ["image"] - elif search_mode == "text_fuzzy": + elif request.search_mode == SearchMode.TEXT_FUZZY: # Pure FTS5 text search results = db.search_ocr_fts( query=request.query, @@ -123,7 +122,7 @@ async def search_screenshots(request: SearchRequest): r["similarity"] = r.get("relevance_score", 0.5) # BM25 score as similarity r["match_sources"] = ["text_fts"] - elif search_mode == "text_semantic": + elif request.search_mode == SearchMode.TEXT_SEMANTIC: # Pure BGE text semantic search if text_embedding is None: raise HTTPException(status_code=500, detail="Failed to generate text embedding") diff --git a/core/ocr.py b/core/ocr.py index bd6b3a1..ff39751 100644 --- a/core/ocr.py +++ b/core/ocr.py @@ -31,6 +31,7 @@ from __future__ import annotations import platform +import threading from dataclasses import dataclass from typing import TYPE_CHECKING, Protocol, runtime_checkable @@ -90,6 +91,7 @@ class OCRService: def __init__(self): self._current_provider: OCRProvider | None = None self._provider_cache: dict[str, OCRProvider] = {} + self._lock = threading.Lock() @classmethod def register(cls, name: str, provider_class: type[OCRProvider]) -> None: @@ -116,19 +118,25 @@ def get_provider(self, provider_name: str | None = None) -> OCRProvider: available = ", ".join(self._providers.keys()) raise ValueError(f"Unknown OCR provider: {provider_name}. Available: {available}") - # Check cache first + # Check cache first (fast path without lock) if provider_name in self._provider_cache: return self._provider_cache[provider_name] - provider_class = self._providers[provider_name] - provider = provider_class() + # Double-checked locking for thread-safe initialization + with self._lock: + # Re-check inside lock in case another thread initialized + if provider_name in self._provider_cache: + return self._provider_cache[provider_name] - if not provider.is_available(): - raise RuntimeError(f"OCR provider '{provider_name}' is not available on this system") + provider_class = self._providers[provider_name] + provider = provider_class() - # Cache for reuse - self._provider_cache[provider_name] = provider - return provider + if not provider.is_available(): + raise RuntimeError(f"OCR provider '{provider_name}' is not available on this system") + + # Cache for reuse + self._provider_cache[provider_name] = provider + return provider def _get_default_provider_name(self) -> str: """Get the default provider name based on platform""" diff --git a/core/ocr_providers/apple_vision.py b/core/ocr_providers/apple_vision.py index 008b8bc..c586e09 100644 --- a/core/ocr_providers/apple_vision.py +++ b/core/ocr_providers/apple_vision.py @@ -16,6 +16,7 @@ from __future__ import annotations import platform +import threading from pathlib import Path from typing import TYPE_CHECKING @@ -26,18 +27,26 @@ # Module-level singleton for OCR class (following codebase conventions) _ocr_class: type[OCRType] | None = None +_ocr_class_lock = threading.Lock() def _get_ocr_class() -> type[OCRType]: """Get the OCR class, loading it if necessary (module-level singleton)""" global _ocr_class - if _ocr_class is None: - try: - from ocrmac.ocrmac import OCR - - _ocr_class = OCR - except ImportError as e: - raise ImportError("ocrmac is required for Apple Vision OCR. Install it with: pip install ocrmac") from e + # Fast path: check without lock + if _ocr_class is not None: + return _ocr_class + + # Double-checked locking for thread-safe initialization + with _ocr_class_lock: + # Re-check inside lock + if _ocr_class is None: + try: + from ocrmac.ocrmac import OCR + + _ocr_class = OCR + except ImportError as e: + raise ImportError("ocrmac is required for Apple Vision OCR. Install it with: pip install ocrmac") from e return _ocr_class diff --git a/web/src/app/setup/page.tsx b/web/src/app/setup/page.tsx index f18628f..db04d6e 100644 --- a/web/src/app/setup/page.tsx +++ b/web/src/app/setup/page.tsx @@ -99,8 +99,8 @@ export default function SetupPage() { // Check if models are downloading or not ready if (!clipReady || !textReady || - (eventStatus?.clip?.downloading) || - (eventStatus?.text_embedding?.downloading)) { + eventStatus?.clip?.downloading || + eventStatus?.text_embedding?.downloading) { return 'models'; }