# Path: src/cattr/_compat.py
# def copy_with(type, args):
#     """Replace a generic type's arguments."""
#     return type.copy_with(args)
# 
# def get_args(cl):
#     return cl.__args__
# 
# def is_annotated(_):
#     return False
# 
# def is_generic(obj):
#     return isinstance(obj, _GenericAlias)


from typing import Any, Mapping
from ._compat import copy_with, get_args, is_annotated, is_generic



def deep_copy_with(t, mapping: Mapping[str, Any]):
    args = get_args(t)
    rest = ()
    if is_annotated(t) and args:
        # If we're dealing with `Annotated`, we only map the first type parameter

# Path: src/cattr/_compat.py
# def copy_with(type, args):
#     """Replace a generic type's arguments."""
#     return type.copy_with(args)
# 
# def get_args(cl):
#     return cl.__args__
# 
# def is_annotated(_):
#     return False
# 
# def is_generic(obj):
#     return isinstance(obj, _GenericAlias)


# Path: src/cattr/_generics.py
from typing import Any, Mapping
from ._compat import copy_with, get_args, is_annotated, is_generic




def deep_copy_with(t, mapping: Mapping[str, Any]):
    args = get_args(t)
    rest = ()
    if is_annotated(t) and args:
        # If we're dealing with `Annotated`, we only map the first type parameter

        rest = tuple(args[1:])