
    D_i&                         S r SSKJr  SSSSSS.r SS
\\   S\S	-  S\\\4   4S jjrS\S\S\4S jrS\S\4S jr	 SS\S\S	-  S\S\S	-  SS	4
S jjr
g	)zHandle chained inputs.    )TextIOz36;1z33;1z38;5;200z32;1z31;1)blueyellowpinkgreenredNitemsexcluded_colorsreturnc           
         [        [        R                  5       5      nUb  U Vs/ s H  o3U;  d  M
  UPM     nnU(       d  Sn[        U5      e[	        U 5       VVs0 s H  u  pVXbU[        U5      -     _M     snn$ s  snf s  snnf )a  Get mapping for items to a support color.

Args:
    items: The items to map to colors.
    excluded_colors: The colors to exclude.

Returns:
    The mapping of items to colors.

Raises:
    ValueError: If no colors are available after applying exclusions.
z.No colors available after applying exclusions.)list_TEXT_COLOR_MAPPINGkeys
ValueError	enumeratelen)r	   r
   colorscmsgiitems          T/home/james-whalen/.local/lib/python3.13/site-packages/langchain_core/utils/input.pyget_color_mappingr      s     %**,-F"#@V'?!V@>o9B59IJ9IgaDS[))9IJJ	 A Ks   	A=A=Btextcolorc                 &    [         U   nSU SU  S3$ )zsGet colored text.

Args:
    text: The text to color.
    color: The color to use.

Returns:
    The colored text.
z[zm[1;3m[0m)r   )r   r   	color_strs      r   get_colored_textr   &   s#     $E*IYKz$y99    c                     SU  S3$ )zSGet bolded text.

Args:
    text: The text to bold.

Returns:
    The bolded text.
z[1mr    )r   s    r   get_bolded_textr#   4   s     TF'""r    endfilec                 p    U(       a  [        X5      OU n[        XBUS9  U(       a  UR                  5         gg)a7  Print text with highlighting and no end characters.

If a color is provided, the text will be printed in that color.
If a file is provided, the text will be written to that file.

Args:
    text: The text to print.
    color: The color to use.
    end: The end character to use.
    file: The file to write to.
)r$   r%   N)r   printflush)r   r   r$   r%   text_to_prints        r   
print_textr*   @   s.     6;$T1M	-t,

 r    )N)N N)__doc__typingr   r   r   strdictr   r   r#   r*   r"   r    r   <module>r0      s        6:K9K'+d{K	#s(^K0:3 :s :s :	## 	## 	# OS
Dj.1>Dtm	r    