
    soj              	       N    d Z ddlZdZdZddededed	efd
Zddededed	efdZdS )zDrop-in replacement for the (small) subset of ``telegram.helpers`` used by
the original codebase - just ``mention_markdown``, used 95 times across the
codebase to build clickable user mentions.    Nz_*`[z_*[]()~`>#+-=|{}.!   textversionentity_typereturnc                     |dk    rt           }n+|dk    r|dv rd}n|dv rd}nt          }nt          d          t          j        dt          j        |           d	d
|           S )z
    Mirrors telegram.helpers.escape_markdown. Escapes markdown special
    characters so arbitrary user-supplied text can be safely embedded in a
    MarkdownV2 (or legacy Markdown) formatted message.
    r      )precodez\`)	text_linktext_mentioncustom_emojiz\)z'Markdown version must be either 1 or 2!z([z])z\\\1)_V1_SPECIAL_CHARS_V2_SPECIAL_CHARS
ValueErrorresubescape)r   r   r   chars_to_escapes       /app/src/tg_compat/helpers.pyescape_markdownr      s     !||+	A/))#OOIII#OO/OOBCCC65ry11555wEEE    user_idnamec                 6    t          ||          }d| d|  dS )z
    Mirrors telegram.helpers.mention_markdown. Builds a MarkdownV2 (or legacy
    Markdown) inline mention of a user by id, e.g. [name](tg://user?id=123).
    )r   [z](tg://user?id=))r   )r   r   r   escaped_names       r   mention_markdownr       s/    
 #4999L6|66G6666r   )r   N)r   )__doc__r   r   r   strintr   r    r   r   <module>r$      s   . . 
			 ) F F# F Fc FS F F F F*7 7c 7 7s 73 7 7 7 7 7 7r   