from __future__ import annotations

SQLITE_MAX_VARIABLES = 999

def _chunked_placeholders(ids: list, chunk_size: int = SQLITE_MAX_VARIABLES) -> list[tuple[str, list]]:
    chunks = []
    for i in range(0, len(ids), chunk_size):
        chunk = ids[i:i + chunk_size]
        placeholders = ",".join("?" * len(chunk))
        chunks.append((placeholders, chunk))
    return chunks

def content_hash(text: str) -> str:
    import hashlib
    return hashlib.sha256(text.encode()).hexdigest()

def short_id(text: str, length: int = 12) -> str:
    import hashlib
    return hashlib.sha256(text.encode()).hexdigest()[:length]
