from pathlib import Path, PurePosixPath


def normalized_asset_path(name):
    parts = [part for part in PurePosixPath(name).parts if part not in {"", ".", ".."}]
    return Path("assets").joinpath(*parts)


def extract_entries(entries, destination):
    destination = Path(destination)
    destination.mkdir(parents=True, exist_ok=True)
    for name, content in entries:
        target = destination / name
        target.parent.mkdir(parents=True, exist_ok=True)
        target.write_bytes(content)
