from __future__ import annotations


class DocsEntityExtractor:
    def extract(self, frontmatter: dict) -> list[str]:
        values = frontmatter.get("entities") or []
        if not isinstance(values, list):
            return []
        result: list[str] = []
        for value in values:
            item = str(value or "").strip()
            if item and item not in result:
                result.append(item)
        return result
