# suma_browser/category_blacklist.py
from __future__ import annotations
from typing import Optional
from shared.config import config

def _norm(s: str) -> str:
    return (s or "").strip().lower().strip("/")

def is_category_blocked(top_slug: str, sub_slug: Optional[str] = None) -> bool:
    if sub_slug:
        return is_category_blocked(top_slug) or _norm(f"{top_slug}/{sub_slug}") in config()["blacklist"]["category"]
    return _norm(top_slug) in config()["blacklist"]["category"]
