HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/rich/__pycache__/console.cpython-311.pyc
�

�;f��
���UddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
mZddlmZddl
mZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZmZmZdd
lmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,ddl-m.Z.ej/dkrddlm0Z0m1Z1m2Z2n
ddl3m0Z0m1Z1m2Z2ddl4m5Z5m6Z6ddl7m7Z7ddl8m9Z9m:Z:ddl;m<Z<ddl=m>Z>m?Z?ddl@mAZAmBZBddlCmDZDmEZEddlFmGZGddlHmIZIddlJmKZKmLZLddlMmNZOddlPmQZQmRZRddlSmTZTmUZUddlVmWZWmXZXdd lYmZZZdd!l[m\Z\dd"l]m^Z^dd#l_m`Z`dd$lambZbdd%lcmdZdmeZedd&lfmgZgdd'lhmiZimjZjmkZkdd(llmmZmmnZndd)lompZpmqZqerdd*lrmsZsdd+ltmuZudd,lvmwZwd-Zxd.Zyejz��d/kZ{e!e+e|d0fgd0fZ}e0d1Z~e0d2ZGd3�d4��Z�e���Z�	ej�����Z�n
#e�$rdZ�YnwxYw	ej�����Z�n
#e�$rdZ�YnwxYw	ej�����Z�n
#e�$rd5Z�YnwxYwe�e�e�fZ�e�e�fZ�eDj�eDj�eDj�d6�Z�Gd7�d8e&��Z�e
Gd9�d:����Z�e2Gd;�d<e1����Z�e2Gd=�d>e1����Z�e+e�e�e|fZ�	e#e+e�ebfZ�eK��Z�Gd?�d@e���Z�GdA�dB��Z�GdC�dD��Z�GdE�dF��Z�GdG�dH��Z�GdI�dJ��Z�GdK�dL��Z�GdM�dN��Z�d�dPe�dQe!dRe!dRe�fffdS�Z�dQe�fdT�Z�eDj�eDj�eDj�eDj{dU�Z�dV�e�����D��Z�e
GdW�dXej�����Z�GdY�dZe��Z�da�e'd[e�d\<d�d]�Z�dQe�fd^�Z�Gd_�d`��Z�dae|dQe|fdb�Z�e�dckr�e�dO�d��Z�e���dedfdgdOdhddidjdkdldm�dndo���e���dpdqe�e�����e���dgdOdrgds�dtdu�dv�dhdwgdx�dydu�dzgd{�d|du�d}�d~�d���dSdS)��N)�ABC�abstractmethod)�	dataclass�field)�datetime)�wraps)�getpass)�escape)�isclass)�islice)�ceil)�	monotonic)�	FrameType�
ModuleType�
TracebackType)�IO�
TYPE_CHECKING�Any�Callable�Dict�Iterable�List�Mapping�
NamedTuple�Optional�TextIO�Tuple�Type�Union�cast)�	NULL_FILE)��)�Literal�Protocol�runtime_checkable�)�errors�themes)�_emoji_replace)�CONSOLE_HTML_FORMAT�CONSOLE_SVG_FORMAT)�
get_fileno)�FormatTimeCallable�	LogRender)�Align�AlignMethod)�ColorSystem�	blend_rgb)�Control)�EmojiVariant)�NullHighlighter�ReprHighlighter��render)�Measurement�measure_renderables)�Pager�SystemPager)�Pretty�
is_expandable)�	rich_cast)�Region)�render_scope)�Screen)�Segment)�Style�	StyleType��Styled)�DEFAULT_TERMINAL_THEME�SVG_EXPORT_THEME�
TerminalTheme)�Text�TextType)�Theme�
ThemeStack)�WindowsConsoleFeatures)�Live��Status�s�d�WindowsrL)�default�left�center�right�full)�fold�crop�ellipsis�ignorec��eZdZdS)�NoChangeN)�__name__�
__module__�__qualname__���?/opt/alt/python311/lib/python3.11/site-packages/rich/console.pyraraVs�������Drfra�)�kitty�256color�16colorc�*�eZdZUdZeed<	eed<dS)�ConsoleDimensionszSize of the terminal.�width�heightN)rbrcrd�__doc__�int�__annotations__rerfrgrmrmts-����������J�J�J�.��K�K�K�-�-rfrmc��eZdZUdZeed<	eed<	eed<	eed<	eed<	eed<	eed<	d	Z	e
eed
<	d	Ze
e
ed<	dZe
eed
<	d	Ze
eed<	d	Ze
eed<	d	Ze
eed<edefd���Zdd�Zeeeeeeeeed�	deeefdeeefdeeefd
ee
eefdee
e
efd
ee
eefdee
eefdee
eefdee
eefddfd�Zdeddfd�Zdeddfd�Zdd�Zdededdfd�Zd	S)�ConsoleOptionsz$Options for __rich_console__ method.�size�legacy_windows�	min_width�	max_width�is_terminal�encoding�
max_heightN�justify�overflowF�no_wrap�	highlight�markupro�returnc�8�|j�d��S)z+Check if renderables should use ascii only.�utf)rz�
startswith��selfs rg�
ascii_onlyzConsoleOptions.ascii_only�s���=�+�+�E�2�2�2�2rfc��t�t��}|j���|_|S)zdReturn a copy of the options.

        Returns:
            ConsoleOptions: a copy of self.
        )rt�__new__�__dict__�copy�r��optionss  rgr�zConsoleOptions.copy�s2��#1�"8�"8��"H�"H���=�-�-�/�/����rf)	rnrwrxr|r}r~rr�rornc	��|���}
t|t��std|��x|
_|
_t|t��s||
_t|t��s||
_t|t��s||
_t|t��s||
_t|t��s||
_t|t��s||
_	t|t��s||
_
t|	t��s"|	�|	|
_|	�dntd|	��|
_|
S)zUpdate values, return a copy.rN)
r��
isinstancera�maxrwrxr|r}r~rr�r{ro)r�rnrwrxr|r}r~rr�ror�s           rg�updatezConsoleOptions.update�s,���)�)�+�+���%��*�*�	B�47��5�M�M�A�G��� 1��)�X�.�.�	*� )�G���)�X�.�.�	*� )�G���'�8�,�,�	&�%�G�O��(�H�-�-�	(�'�G���'�8�,�,�	&�%�G�O��)�X�.�.�	*� )�G���&�(�+�+�	$�#�G�N��&�(�+�+�	H��!�%+��"�%+�^�T�T��Q����G�N��rfc�f�|���}td|��x|_|_|S)z�Update just the width, return a copy.

        Args:
            width (int): New width (sets both min_width and max_width)

        Returns:
            ~ConsoleOptions: New console options instance.
        r)r�r�rwrx)r�rnr�s   rg�update_widthzConsoleOptions.update_width�s.���)�)�+�+��03�A�u�
�
�=���G�-��rfc�J�|���}|x|_|_|S)z�Update the height, and return a copy.

        Args:
            height (int): New height

        Returns:
            ~ConsoleOptions: New Console options instance.
        )r�r{ro)r�ror�s   rg�
update_heightzConsoleOptions.update_height�s%���)�)�+�+��.4�4���W�^��rfc�<�|���}d|_|S)z�Return a copy of the options with height set to ``None``.

        Returns:
            ~ConsoleOptions: New console options instance.
        N)r�ror�s  rg�reset_heightzConsoleOptions.reset_height�s���)�)�+�+������rfc��|���}td|��x|_|_|x|_|_|S)aUpdate the width and height, and return a copy.

        Args:
            width (int): New width (sets both min_width and max_width).
            height (int): New height.

        Returns:
            ~ConsoleOptions: New console options instance.
        r)r�r�rwrxror{)r�rnror�s    rg�update_dimensionsz ConsoleOptions.update_dimensions�s=���)�)�+�+��03�A�u�
�
�=���G�-�.4�4����+��rf)r�rt)rbrcrdrprmrr�boolrq�strr|r�
JustifyMethodr}�OverflowMethodr~rr�ro�propertyr�r��	NO_CHANGErrar�r�r�r�r�rerfrgrtrt}s��������.�.�
���������2��N�N�N�&��N�N�N�&�����<��M�M�M���O�O�O�2�'+�G�X�m�
$�+�+�+�0�)-�H�h�~�&�-�-�-�1�#�G�X�d�^�#�#�#�$� $�I�x��~�$�$�$�,�!�F�H�T�N�!�!�!�/� �F�H�S�M� � � �
�3�D�3�3�3��X�3�����'0�*3�*3�<E�>G�3<�5>�2;�1:�#�#�#��S�(�]�#�#���h��'�	#�
��h��'�#��x�
�.��8�9�
#����0�(�:�;�#��x��~�x�/�0�#���$���1�2�#��h�t�n�h�.�/�#��h�s�m�X�-�.�#�
�#�#�#�#�J�#��*:������C��,<���������
�s�
�C�
�<L�
�
�
�
�
�
rfrtc�0�eZdZdZdeddeffd�ZdS)�RichCastz5An object that may be 'cast' to a console renderable.r��ConsoleRenderablec��dS�Nrer�s rg�__rich__zRichCast.__rich__�	��	�rfN)rbrcrdrprr�r�rerfrgr�r�sC������?�?��	�"�J��3�	4������rfr�c�&�eZdZdZ						d
d�Zd	S)r�z-An object that supports the console protocol.�console�Consoler�rtr��RenderResultc��dSr�re�r�r�r�s   rg�__rich_console__z"ConsoleRenderable.__rich_console__r�rfN)r�r�r�rtr�r�)rbrcrdrpr�rerfrgr�r�
sF������7�7�� ��+;��	������rfr�c��eZdZdZdS)�CaptureErrorz(An error in the Capture context manager.N)rbrcrdrprerfrgr�r�!s������2�2�2�2rfr�c�D�eZdZdZddeddfd�Zddd	d
deefd�ZdS)
�NewLinez$A renderable to generate new line(s)r'�countr�Nc��||_dSr�)r��r�r�s  rg�__init__zNewLine.__init__(s
����
�
�
rfr�r�r�rtc#�<K�td|jz��V�dS)N�
)rDr�r�s   rgr�zNewLine.__rich_console__+s)�����d�T�Z�'�(�(�(�(�(�(�(rf�r')	rbrcrdrprqr�rrDr�rerfrgr�r�%sr������.�.���c��$�����)� �)�+;�)�	�'�	�)�)�)�)�)�)rfr�c�V�eZdZdZdeeedededdfd�Zdd	d
ede	fd�Z
dS)�ScreenUpdatez)Render a list of lines at a given offset.�lines�x�yr�Nc�0�||_||_||_dSr�)�_linesr�r�)r�r�r�r�s    rgr�zScreenUpdate.__init__4s������������rfr�r�r�c#�K�|j}tj}t|j|j��D]\}}|||��V�|Ed{V���dSr�)r�r4�move_to�	enumerater�r�)r�r�r�r�r��offset�lines       rgr�zScreenUpdate.__rich_console__9sl����
�F���/��%�d�k�4�6�:�:�	�	�L�F�D��'�!�V�$�$�$�$�$��O�O�O�O�O�O�O�O�	�	rf)rbrcrdrprrDrqr�rtr�r�rerfrgr�r�1s������3�3��d�4��=�1��c��c��d�����
� ��+9��	������rfr�c�v�eZdZdZd
d�Zdd�Zdeeed	eed
ee	ddfd�Z
defd�ZdS)�Capturez�Context manager to capture the result of printing to the console.
    See :meth:`~rich.console.Console.capture` for how to use.

    Args:
        console (Console): A console instance to capture output.
    r�r�r�Nc�"�||_d|_dSr�)�_console�_result)r�r�s  rgr�zCapture.__init__Ks����
�&*����rfc�8�|j���|Sr�)r��
begin_capturer�s rg�	__enter__zCapture.__enter__O����
�#�#�%�%�%��rf�exc_type�exc_val�exc_tbc�B�|j���|_dSr�)r��end_capturer��r�r�r�r�s    rg�__exit__zCapture.__exit__Ss���}�0�0�2�2����rfc�<�|j�td���|jS)zGet the result of the capture.Nz<Capture result is not available until context manager exits.)r�r�r�s rg�getzCapture.get[s)���<���N���
��|�rf)r�r�r�N)r�r�)
rbrcrdrpr�r�rr�
BaseExceptionrr�r�r�rerfrgr�r�Cs���������+�+�+�+�����3��4�
�.�/�3��-�(�3���'�	3�

�3�3�3�3��S������rfr�c	�|�eZdZdZddddededdfd	�Zdd
�Zdee	e
dee
d
eeddfd�ZdS)�ThemeContextzbA context manager to use a temporary theme. See :meth:`~rich.console.Console.use_theme` for usage.Tr�r��theme�inheritr�Nc�0�||_||_||_dSr�)r�r�r�)r�r�r�r�s    rgr�zThemeContext.__init__gs�������
�����rfc�D�|j�|j��|Sr�)r��
push_themer�r�s rgr�zThemeContext.__enter__ls�������
�+�+�+��rfr�r�r�c�8�|j���dSr�)r��	pop_themer�s    rgr�zThemeContext.__exit__ps��	
���� � � � � rf�T)r�r�)
rbrcrdrprNr�r�r�rrr�rr�rerfrgr�r�ds�������l�l���	��%��$��RV�����
����!��4�
�.�/�!��-�(�!���'�	!�

�!�!�!�!�!�!rfr�c��eZdZdZ			ddddeededed	df
d
�Zdd�Zdee	e
d
ee
deed	dfd�ZdS)�PagerContextzZA context manager that 'pages' content. See :meth:`~rich.console.Console.pager` for usage.NFr�r��pager�styles�linksr�c�^�||_|�t��n||_||_||_dSr�)r�r=r�r�r�)r�r�r�r�r�s     rgr�zPagerContext.__init__|s0�� ��
�&+�m�[�]�]�]���
������
�
�
rfc�8�|j���|Sr�)r��
_enter_bufferr�s rgr�zPagerContext.__enter__�r�rfr�r�r�c��|��|jj5|jjdd�}|jjdd�=|}|jst	j|��}n|jst	j|��}|j�|��}ddd��n#1swxYwY|j	�
|��|j���dSr�)r��_lock�_bufferr�rD�strip_stylesr��strip_links�_render_bufferr��show�_exit_buffer)r�r�r�r��buffer�segments�contents       rgr�zPagerContext.__exit__�s������$�
A�
A�(,�
�(=�a�a�a�(@���M�)�!�!�!�,�.4���{�=�&�3�H�=�=�H�H���=�&�2�8�<�<�H��-�6�6�x�@�@��
A�
A�
A�
A�
A�
A�
A�
A�
A�
A�
A����
A�
A�
A�
A�
�J�O�O�G�$�$�$��
�"�"�$�$�$�$�$s�A7B�B�B�NFF)r�r�)
rbrcrdrprr<r�r�r�rr�rr�rerfrgr�r�ys�������d�d�
"&���
�
��
����
��	
�
�
�
�
�
�
�
�����%��4�
�.�/�%��-�(�%���'�	%�

�%�%�%�%�%�%rfr�c	��eZdZdZ	ddddededdfd	�Zdd
�dedeeddfd�Z	dd
�Z
deeedeedee
ddfd�ZdS)�
ScreenContextziA context manager that enables an alternative screen. See :meth:`~rich.console.Console.screen` for usage.�r�r��hide_cursor�styler�Nc�Z�||_||_t|���|_d|_dS)N�r�F)r�r�rC�screen�_changed)r�r�r�r�s    rgr�zScreenContext.__init__�s0�����&����5�)�)�)�����
�
�
rfr��renderablesc���|r.t|��dkr	t|�n|d|j_|�||j_|j�|jd���dS)a+Update the screen.

        Args:
            renderable (RenderableType, optional): Optional renderable to replace current renderable,
                or None for no change. Defaults to None.
            style: (Style, optional): Replacement style, or None for no change. Defaults to None.
        r'rNr�)�end)�len�Groupr��
renderabler�r��print)r�r�r�s   rgr�zScreenContext.update�sn���	�'*�;�'7�'7�!�';�';��{�#�#��Q��
�K�"��� %�D�K������4�;�B��/�/�/�/�/rfc��|j�d��|_|jr!|jr|j�d��|S)NTF)r��set_alt_screenr�r��show_cursorr�s rgr�zScreenContext.__enter__�sH����3�3�D�9�9��
��=�	,�T�-�	,��L�$�$�U�+�+�+��rfr�r�r�c��|jr=|j�d��|jr|j�d��dSdSdS)NFT)r�r�rr�rr�s    rgr�zScreenContext.__exit__�s_���=�	/��L�'�'��.�.�.���
/���(�(��.�.�.�.�.�	/�	/�
/�
/rf�r�)r�r�)rbrcrdrpr�rFr��RenderableTyperr�r�rr�rr�rerfrgr�r��s�������s�s�IK��� ��/3��<E��	
�����JN�0�0�0�*�0�3;�I�3F�0�	
�0�0�0�0�$����	/��4�
�.�/�	/��-�(�	/���'�		/�

�	/�	/�	/�	/�	/�	/rfr�c�|�eZdZdZdd�dddeddfd	�Zededfd
���Z						dd�Z	ddd
dde
fd�ZdS)ra$Takes a group of renderables and returns a renderable object that renders the group.

    Args:
        renderables (Iterable[RenderableType]): An iterable of renderable objects.
        fit (bool, optional): Fit dimension of group to contents, or fill available space. Defaults to True.
    T)�fitr�rr
r�Nc�0�||_||_d|_dSr�)�_renderablesr
�_render)r�r
r�s   rgr�zGroup.__init__�s��'������7;����rfc�P�|j�t|j��|_|jSr�)r�listrr�s rgr�zGroup.renderables�s$���<���� 1�2�2�D�L��|�rfr�r�r�rtr:c�p�|jrt|||j��St|j|j��Sr�)r
r;r�r:rxr�s   rg�__rich_measure__zGroup.__rich_measure__�s:���8�	E�&�w���9I�J�J�J��w�0�'�2C�D�D�Drfc#�$K�|jEd{V��dSr�)r�r�s   rgr�zGroup.__rich_console__�s)�����#�#�#�#�#�#�#�#�#�#rf)r�r�r�rtr�r:)rbrcrdrpr�r�r�rr�rr�r�rerfrgrr�s���������DH�<�<�<�%5�<�D�<�D�<�<�<�<�
��T�"2�3�����X��
E� �E�+;�E�	�E�E�E�E�$� �$�+;�$�	�$�$�$�$�$�$rfrTr
r�.c�z��dtdttfdtdtff�fd�}|S)z�A decorator that turns an iterable of renderables in to a group.

    Args:
        fit (bool, optional): Fit dimension of group to contents, or fill available space. Defaults to True.
    �method.r�c�l���t���dtdtdtf��fd���}|S)zGConvert a method that returns an iterable of renderables in to a Group.�args�kwargsr�c�,���|i|��}t|d�i�S)Nr
)r)rrr�r
rs   ��rg�_replacez*group.<locals>.decorator.<locals>._replace�s*��� �&�$�1�&�1�1�K��+�/�3�/�/�/rf)rrr)rrr
s` �rg�	decoratorzgroup.<locals>.decorator�sU����

�v���	0�C�	0�3�	0�5�	0�	0�	0�	0�	0�	0�
��	0��rf)rrrr)r
rs` rg�groupr�sQ���
���h�~�6�6�7�
�	�#�u�*�	�
�
�
�
�
�
��rfc���	tn#t$rYdSwxYwt��}|jj}dt	|j��vstjd��s|dkrdS|dkrdSdS)z-Check if we're running in a Jupyter notebook.Fzgoogle.colab�DATABRICKS_RUNTIME_VERSION�ZMQInteractiveShellT�TerminalInteractiveShell)�get_ipython�	NameError�	__class__rbr��os�getenv)�ipython�shells  rg�_is_jupyterr*s�������������u�u������m�m�G���&�E��#�g�/�0�0�0�0�
�9�1�2�2�	1��)�)�)��t�	�,�	,�	,��u��us�
�
�)�standard�256�	truecolor�windowsc��i|]\}}||��	Srere)�.0�name�systems   rg�
<dictcomp>r3!s��O�O�O���v���O�O�Orfc�Z�eZdZUdZeed<ee���Ze	e
ed<dZeed<dS)�ConsoleThreadLocalsz(Thread local values for Console context.�theme_stack)�default_factoryr�r�buffer_indexN)
rbrcrdrprOrrrrr�rrDr8rqrerfrgr5r5$sU�������2�2�����!�E�$�7�7�7�F�D��M�7�7�7��L�#�����rfr5c�J�eZdZdZedeedeefd���ZdS)�
RenderHookz(Provides hooks in to the render process.r�r�c��dS)aLCalled with a list of objects to render.

        This method can return a new list of renderables, or modify and return the same list.

        Args:
            renderables (List[ConsoleRenderable]): A number of renderable objects.

        Returns:
            List[ConsoleRenderable]: A replacement list of renderables.
        Nre)r�r�s  rg�process_renderableszRenderHook.process_renderables0s���rfN)rbrcrdrprrr�r<rerfrgr:r:-sT������2�2���� 1�2��	
��	 �����^���rfr:rP�_windows_console_featuresc�L�t�tSddlm}|��atS)Nr'��get_windows_console_features)r=�_windowsr@r?s rgr@r@Cs5�� �,�(�(�6�6�6�6�6�6� <� <� >� >��$�$rfc�8�tot��jS)zDetect legacy Windows.)�WINDOWSr@�vtrerfrg�detect_legacy_windowsrEMs���<�7�9�9�<�<�<rfc<�
�eZdZUdZejZeeefe	d<dddddddddddddddddddddde
��dddddd	�d
eeddee
d
ee
dee
de
deede
deeede
deedeedeedee
dede
de
de
deede
de
de
d eeefd!ed"d#ee
d$e
d%eegefd&eegefdeeeeff8d'�Zd(efd)�Zed(eefd*���Zejd+eed(dfd,���Zed(eefd-���Zed(efd.���Z e jd/ed(dfd0���Z ed(e!fd1���Z"d(ee#fd2�Z$d�d3�Z%d�d4�Z&d�d7�Z'd�d8�Z(d9e)d(dfd:�Z*d�d;�Z+d�d<�Z,d=e-d>e-d?e-d(dfd@�Z.d�dA�Z/d(efdB�Z0ddC�dedDe
d(dfdE�Z1d�dF�Z2ddC�dedDe
d(e3fdG�Z4ed(eefdH���Z5ed(efdI���Z6ed(e
fdJ���Z7ed(e
fdK���Z8ed(e9fdL���Z:ed(e;fdM���Z<e<jdNe=eefd(dfdO���Z<ed(efdP���Z>e>jded(dfdQ���Z>ed(efdR���Z?e?jded(dfdS���Z?d�dT�Z@d(eAfdU�ZB	d�dVeeCdWe
dXe
d(eDfdY�ZEd�d[ed(dfd\�ZFd�d]e
d(dfd^�ZGd_d`dadbdc�ddeHdeedfedgedhed(difdj�ZId�dke
d(e
fdl�ZJd�dme
d(e
fdn�ZKed(e
fdo���ZLdped(e
fdq�ZM	d�dre
deed(dsfdt�ZNddu�dveHdwee9d(eOfdx�ZP	d�dveHdwee9d(eQefdy�ZR	d�ddddz�dveHdwee9deeSd{e
d|e
d(eeefd}�ZTd~ddddddd�d�edeeeSfd�eeUd�eeVdee
dee
dee
d!eeWd(d�fd��ZXdd��d�eeeSfd�eeeSefd(eSfd��ZYddddd��d�eQe-d�ed�ed�eeUdee
dee
dee
d(eeZfd��Z[	d�d�d�d�d��dpe\d�edeeeSfd�e]d(df
d��Z^d�e_d(dfd��Z`d�d�ddd��d�e-d�ed�edeeeeSfdee
d(dfd��Zad�d�ddddddddddddd��d�e-d�ed�edeeeeSfd�eeUd�eeVd�ee
dee
dee
dee
deedeed�e
dee
d�e
d(df d��Zb	d�dd�dddddddd��	d�eed�e-d�edeefde
d�e
d�e
d�e
d�e
d�eee-ge-fd�e
d(dfd��Zcddd��dveHd�eeddwee9d(dfd��Ze	d�d�eeed�ed�ed(dfd��Zfd�d�dddd�d�d��deed�edeed�e
d�e
d�eQeeegfd�ed(dfd��Zheiejjkfd�ed�egeelfd(e=eeemee-fffd����Znd�d�dddddddZd��	d�e-d�ed�edeeeeSfd�eeUdee
dee
dee
d�e
d�ed(dfdÄZod�dĄZpd�eQed(efdƄZq	d�dddddǜd�e\de
de
d�e
d�eerd(efd˄Zsddd̜d�e
dWe
d(efd΄Ztddd̜d�ed�e
dWe
d(dfdЄZudddddќdeevd�e
d�eed�e
d(ef
dԄZwddexddќd�edeevd�e
d�ed�e
d(dfdՄZyd�ddezd�dd؜dpedeevd�e
d�ed�ed�eed(efdۄZ{d�ddezd�dd؜d�edpedeevd�e
d�ed�ed�eed(dfd܄Z|dS)�r�arA high level console interface.

    Args:
        color_system (str, optional): The color system supported by your terminal,
            either ``"standard"``, ``"256"`` or ``"truecolor"``. Leave as ``"auto"`` to autodetect.
        force_terminal (Optional[bool], optional): Enable/disable terminal control codes, or None to auto-detect terminal. Defaults to None.
        force_jupyter (Optional[bool], optional): Enable/disable Jupyter rendering, or None to auto-detect Jupyter. Defaults to None.
        force_interactive (Optional[bool], optional): Enable/disable interactive mode, or None to auto detect. Defaults to None.
        soft_wrap (Optional[bool], optional): Set soft wrap default on print method. Defaults to False.
        theme (Theme, optional): An optional style theme object, or ``None`` for default theme.
        stderr (bool, optional): Use stderr rather than stdout if ``file`` is not specified. Defaults to False.
        file (IO, optional): A file object where the console should write to. Defaults to stdout.
        quiet (bool, Optional): Boolean to suppress all output. Defaults to False.
        width (int, optional): The width of the terminal. Leave as default to auto-detect width.
        height (int, optional): The height of the terminal. Leave as default to auto-detect height.
        style (StyleType, optional): Style to apply to all output, or None for no style. Defaults to None.
        no_color (Optional[bool], optional): Enabled no color mode, or None to auto detect. Defaults to None.
        tab_size (int, optional): Number of spaces used to replace a tab character. Defaults to 8.
        record (bool, optional): Boolean to enable recording of terminal output,
            required to call :meth:`export_html`, :meth:`export_svg`, and :meth:`export_text`. Defaults to False.
        markup (bool, optional): Boolean to enable :ref:`console_markup`. Defaults to True.
        emoji (bool, optional): Enable emoji code. Defaults to True.
        emoji_variant (str, optional): Optional emoji variant, either "text" or "emoji". Defaults to None.
        highlight (bool, optional): Enable automatic highlighting. Defaults to True.
        log_time (bool, optional): Boolean to enable logging of time by :meth:`log` methods. Defaults to True.
        log_path (bool, optional): Boolean to enable the logging of the caller by :meth:`log`. Defaults to True.
        log_time_format (Union[str, TimeFormatterCallable], optional): If ``log_time`` is enabled, either string for strftime or callable that formats the time. Defaults to "[%X] ".
        highlighter (HighlighterType, optional): Default highlighter.
        legacy_windows (bool, optional): Enable legacy Windows mode, or ``None`` to auto detect. Defaults to ``None``.
        safe_box (bool, optional): Restrict box options that don't render on legacy Windows.
        get_datetime (Callable[[], datetime], optional): Callable that gets the current time as a datetime.datetime object (used by Console.log),
            or None for datetime.now.
        get_time (Callable[[], time], optional): Callable that gets the current time in seconds, default uses time.monotonic.
    �_environ�autoNFr#Tz[%X])�color_system�force_terminal�
force_jupyter�force_interactive�	soft_wrapr��stderr�file�quietrnror��no_color�tab_size�recordr��emoji�
emoji_variantr�log_time�log_path�log_time_format�highlighterrv�safe_box�get_datetime�get_timerGrI)rHr+r,r-r.rJrKrLrMr�rNrOrPrnror�rQrRrSr�rTrUrrVrWrXrY�HighlighterTypervrZr[r\c��|�||_|�t��n||_|jr�|
�G|j�d��}|�$|���rt|��}
nt}
|�G|j�d��}|�$|���rt|��}nt}||_||_	||_
||_||_||_
|�t��o|jn||_|
�G|j�d��}|�+|���rt|��|jz
}
|�?|j�d��} | �#| ���rt| ��}||_|
|_||_|d|_|�||_||_|	|_||_|�d|_n2|dkr|���|_nt2||_t5j��|_t;|||���|_|pt>|_ ||_!|ptDj#|_$|ptJ|_&||_'|
�|
nd|jv|_(|�|j)o|j*n||_+t5j��|_,t[t]|�t^j0n|�����|_1g|_2g|_3d|_4d	|_5dS)
N�JUPYTER_COLUMNS�
JUPYTER_LINES�COLUMNS�LINESrH)�	show_time�	show_path�time_format�NO_COLOR)r6F)6rGr*�
is_jupyterr��isdigitrq�JUPYTER_DEFAULT_COLUMNS�JUPYTER_DEFAULT_LINESrRrS�_markup�_emoji�_emoji_variant�
_highlightrErvrM�_width�_height�_force_terminal�_filerPrN�
_color_system�_detect_color_system�
COLOR_SYSTEMS�	threading�RLockr�r/�_log_render�_null_highlighterrYrZr�nowr[rr\r�rQry�is_dumb_terminal�is_interactive�_record_buffer_lockr5rOr)�DEFAULT�_thread_locals�_record_buffer�
_render_hooks�_live�_is_alt_screen)!r�rIrJrKrLrMr�rNrOrPrnror�rQrRrSr�rTrUrrVrWrXrYrvrZr[r\rG�jupyter_columns�
jupyter_lines�columnsr�s!                                 rgr�zConsole.__init__xs��F��$�D�M�+8�+@�+�-�-�-�m����?�	3��}�"&�-�"3�"3�4E�"F�"F��"�.�?�3J�3J�3L�3L�.���0�0�E�E�3�E��~� $�
� 1� 1�/� B� B�
� �,��1F�1F�1H�1H�,� ��/�/�F�F�2�F� ��
����������6C���#����%�#�
$�
$�
<�T�_�)<���	
���=��m�'�'�	�2�2�G��"�w���'8�'8�"��G���t�':�:���>��M�%�%�g�.�.�E�� �U�]�]�_�_� ��U����"����������1�#����%�#1�D� ���
���
������!%�D���
�V�
#�
#�!%�!:�!:�!<�!<�D���!.�|�!<�D���_�&�&��
�$���'�
�
�
���
-8�,L�;L��� ��
�(�8�H�L��� �-�I��
���
� �,�H�H�*��
�2M�	
�
�
!�(��
�
;�d�&;�";��"�	
��$-�?�#4�#4�� �1�"�U�]�6�>�>��N�N�
�
�
���.0���/1���'+��
�#����rfr�c�(�d|j�d|j�d�S)Nz<console width=� �>)rnrsr�s rg�__repr__zConsole.__repr__�s ��E���E�E�d�.@�E�E�E�Erfc��|jp|jrtjntj}t	|d|��}|�t
}|S)z Get the file object to write to.�rich_proxied_file)rrrN�sys�stdout�getattrr!)r�rOs  rgrOzConsole.file�s@���z�H�D�K�G�c�j�j�S�Z���t�0�$�7�7���<��D��rf�new_filec��||_dS)zSet a new file object.N)rr)r�r�s  rgrOzConsole.files����
�
�
rfc��|jjS�zGet a thread local buffer.)rr�r�s rgr�zConsole._buffers���"�)�)rfc��|jjSr��rr8r�s rg�
_buffer_indexzConsole._buffer_index
s���"�/�/rf�valuec��||j_dSr�r�)r�r�s  rgr�zConsole._buffer_indexs��+0���(�(�(rfc��|jjS)z!Get the thread local theme stack.)rr6r�s rg�_theme_stackzConsole._theme_stacks���"�.�.rfc�r�|jrtjS|jr|jrdSt
r@|jrtjSt��}|jrtjntj	S|j
�dd������
��}|dvrtjS|j
�dd������
��}|�d��\}}}t�|tj��}|S)z"Detect color system from env vars.N�	COLORTERMr�)r-�24bit�TERM�-)rgr2�	TRUECOLORryr{rCrvr@r-�	EIGHT_BITrGr��strip�lower�
rpartition�_TERM_COLORS�STANDARD)r��windows_console_features�
color_term�term�
_term_name�_hyphen�colorsrIs        rgrtzConsole._detect_color_systems"���?�	)��(�(���	�4�#8�	��4��	 ��"�
+�"�*�*�'C�'E�'E�$�,�5�+��%�%� �*�
���*�*�;��;�;�A�A�C�C�I�I�K�K�J��3�3�3�"�,�,��=�$�$�V�R�0�0�6�6�8�8�>�>�@�@�D�*.�/�/�#�*>�*>�'�J���'�+�+�F�K�4H�I�I�L��rfc�&�|xjdz
c_dS)z4Enter in to a buffer context, and buffer all output.r'N)r�r�s rgr�zConsole._enter_buffer0s�����a�����rfc�N�|xjdzc_|���dS)z5Leave buffer context, and render content if required.r'N)r��
_check_bufferr�s rgr�zConsole._exit_buffer4s.�����a�����������rf�liverQc��|j5|j�tjd���||_ddd��dS#1swxYwYdS)z�Set Live instance. Used by Live context manager.

        Args:
            live (Live): Live instance using this Console.

        Raises:
            errors.LiveError: If this Console has a Live context currently active.
        Nz+Only one live display may be active at once)r�r�r(�	LiveError)r�r�s  rg�set_livezConsole.set_live9s����Z�	�	��z�%��&�'T�U�U�U��D�J�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�#8�<�<c�T�|j5d|_ddd��dS#1swxYwYdS)zClear the Live instance.N)r�r�r�s rg�
clear_livezConsole.clear_liveGsu��
�Z�	�	��D�J�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s��!�!�hookc�z�|j5|j�|��ddd��dS#1swxYwYdS)zpAdd a new render hook to the stack.

        Args:
            hook (RenderHook): Render hook instance.
        N)r�r��append)r�r�s  rg�push_render_hookzConsole.push_render_hookLs����Z�	,�	,���%�%�d�+�+�+�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�	,�	,s�0�4�4c�x�|j5|j���ddd��dS#1swxYwYdS)z'Pop the last renderhook from the stack.N)r�r��popr�s rg�pop_render_hookzConsole.pop_render_hookUs���
�Z�	%�	%���"�"�$�$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�	%�	%s�/�3�3c�.�|���|S)z,Own context manager to enter buffer context.�r�r�s rgr�zConsole.__enter__Zs���������rfr��	exc_value�	tracebackc�.�|���dS)zExit buffer context.N)r�)r�r�r�r�s    rgr�zConsole.__exit___s���������rfc�.�|���dS)z`Begin capturing console output. Call :meth:`end_capture` to exit capture mode and return output.Nr�r�s rgr�zConsole.begin_capturecs���������rfc�v�|�|j��}|jdd�=|���|S)zhEnd capture mode and return captured string.

        Returns:
            str: Console output.
        N)r�r�r�)r��
render_results  rgr�zConsole.end_capturegs>���+�+�D�L�9�9�
��L����O��������rf�r�r�c�>�|j�||���dS)a�Push a new theme on to the top of the stack, replacing the styles from the previous theme.
        Generally speaking, you should call :meth:`~rich.console.Console.use_theme` to get a context manager, rather
        than calling this method directly.

        Args:
            theme (Theme): A theme instance.
            inherit (bool, optional): Inherit existing styles. Defaults to True.
        r�N)r�r��r�r�r�s   rgr�zConsole.push_themers&��	
��$�$�U�G�$�<�<�<�<�<rfc�8�|j���dS)z9Remove theme from top of stack, restoring previous theme.N)r�r�r�s rgr�zConsole.pop_theme}s����#�#�%�%�%�%�%rfc�$�t|||��S)aUse a different theme for the duration of the context manager.

        Args:
            theme (Theme): Theme instance to user.
            inherit (bool, optional): Inherit existing console styles. Defaults to True.

        Returns:
            ThemeContext: [description]
        )r�r�s   rg�	use_themezConsole.use_theme�s���D�%��1�1�1rfc�8�|j�t|jSdS)zpGet color system string.

        Returns:
            Optional[str]: "standard", "256" or "truecolor".
        N)rs�_COLOR_SYSTEMS_NAMESr�s rgrIzConsole.color_system�s ����)�'��(:�;�;��4rfc�V�t|jdd��pd���S)zGet the encoding of the console file, e.g. ``"utf-8"``.

        Returns:
            str: A standard encoding string.
        rz�utf-8)r�rOr�r�s rgrzzConsole.encoding�s)����	�:�w�7�7�B�7�I�I�K�K�Krfc�f�|j�|jSttjd��r&tjj�d��rdS|jrdS|j�d��}|�	d|_dSt|j
dd��}	|�dn	|��S#t$rYdSwxYw)z�Check if the console is writing to a terminal.

        Returns:
            bool: True if the console writing to a device capable of
            understanding terminal codes, otherwise False.
        Nrc�idlelibF�FORCE_COLORT�isatty)rq�hasattrr��stdinrcr�rgrGr�r�rO�
ValueError)r��force_colorr�s   rgryzConsole.is_terminal�s�����+��'�'��3�9�l�+�+�	��	�0D�0O�0O��1
�1
�	��5��?�	��5��m�'�'�
�6�6���"�#'�D� ��4�/6�t�y�(�D�/Q�/Q��	�"�N�5�5�����8���	�	�	��5�5�		���s�
B"�"
B0�/B0c�v�|j�dd��}|���dv}|jo|S)zxDetect dumb terminal.

        Returns:
            bool: True if writing to a dumb terminal, otherwise False.

        r�r�)�dumb�unknown)rGr�r�ry)r��_term�is_dumbs   rgr{zConsole.is_dumb_terminal�s<���
�!�!�&�"�-�-���+�+�-�-�#6�6����+�G�+rfc	�t�t|jj|j|jd|j|j|j���S)zGet default console options.r')r{rurvrwrxrzry)rtrurorvrnrzryr�s rgr�zConsole.options�sA����y�'����.���j��]��(�
�
�
�	
rfc��|j�)|j�"t|j|jz
|j��S|jrtdd��Sd}d}t
r5	t
j��\}}n]#tttf$rYnDwxYwtD]8}	t
j|��\}}n#tttf$rY�5wxYw|j�
d��}|�#|���rt|��}|j�
d��}|�#|���rt|��}|pd}|pd}t|j�
||jz
n|j|j�|n|j��S)zGet the size of the console.

        Returns:
            ConsoleDimensions: A named tuple containing the dimensions.
        N�P�rarb)rorprmrvr{rCr&�get_terminal_size�AttributeErrorr��OSError�_STD_STREAMSrGr�rhrq)r�rnro�file_descriptorr�r�s      rgruzConsole.size�s����;�"�t�|�'?�$�T�[�4�3F�%F���U�U�U�� �	-�$�R��,�,�,�#�� $���	�
� "� 4� 6� 6�
��v�v��"�J��8�
�
�
���
����$0�
�
���$&�$8��$I�$I�M�E�6��E��'�
�G�<�����D�����
�-�#�#�I�.�.����7�?�?�#4�#4����L�L�E��
�!�!�'�*�*������������Z�Z�F�������2�� �+/�;�+>�E�D�'�'�'�D�K��l�*�F�F���
�
�	
s$�A+�+B�B�B+�+C�C�new_sizec�,�|\}}||_||_dS)zvSet a new size for the terminal.

        Args:
            new_size (Tuple[int, int]): New width and height.
        N)rorp)r�r�rnros    rgruzConsole.sizes��!�
��v��������rfc��|jjS)zsGet the width of the console.

        Returns:
            int: The width (in characters) of the console.
        )rurnr�s rgrnz
Console.widths���y��rfc��||_dS)zFSet width.

        Args:
            width (int): New width.
        N)ro)r�rns  rgrnz
Console.width"s������rfc��|jjS)zpGet the height of the console.

        Returns:
            int: The height (in lines) of the console.
        )ruror�s rgrozConsole.height+s���y��rfc��||_dS)zISet height.

        Args:
            height (int): new height.
        N)rp)r�ros  rgrozConsole.height4s������rfc�R�|�tj����dS)z3Play a 'bell' sound (if supported by the terminal).N)�controlr4�bellr�s rgr�zConsole.bell=s �����W�\�^�^�$�$�$�$�$rfc�$�t|��}|S)a�A context manager to *capture* the result of print() or log() in a string,
        rather than writing it to the console.

        Example:
            >>> from rich.console import Console
            >>> console = Console()
            >>> with console.capture() as capture:
            ...     console.print("[bold magenta]Hello World[/]")
            >>> print(capture.get())

        Returns:
            Capture: Context manager with disables writing to the terminal.
        )r�)r��captures  rgr�zConsole.captureAs���$�-�-���rfr�r�r�c�(�t||||���S)aA context manager to display anything printed within a "pager". The pager application
        is defined by the system and will typically support at least pressing a key to scroll.

        Args:
            pager (Pager, optional): A pager object, or None to use :class:`~rich.pager.SystemPager`. Defaults to None.
            styles (bool, optional): Show styles in pager. Defaults to False.
            links (bool, optional): Show links in pager. Defaults to False.

        Example:
            >>> from rich.console import Console
            >>> from rich.__main__ import make_test_card
            >>> console = Console()
            >>> with console.pager():
                    console.print(make_test_card())

        Returns:
            PagerContext: A context manager.
        )r�r�r�)r�)r�r�r�r�s    rgr�z
Console.pagerRs��*�D��f�E�J�J�J�Jrfr'r�c�j�|dks
Jd���|�t|����dS)zqWrite new line(s).

        Args:
            count (int, optional): Number of new lines. Defaults to 1.
        rzcount must be >= 0N)rr�r�s  rgr�zConsole.lineis6����z�z�z�/�z�z�z��
�
�7�5�>�>�"�"�"�"�"rf�homec���|r:|�tj��tj����dS|�tj����dS)z�Clear the screen.

        Args:
            home (bool, optional): Also move the cursor to 'home' position. Defaults to True.
        N)r�r4�clearr�)r�r�s  rgr�z
Console.clearssP���	*��L�L�����'�,�.�.�9�9�9�9�9��L�L�����)�)�)�)�)rf�dotszstatus.spinnerg�?g)@)�spinner�
spinner_style�speed�refresh_per_second�statusr�r�r�r�rSc�4�ddlm}|||||||���}|S)atDisplay a status and spinner.

        Args:
            status (RenderableType): A status renderable (str or Text typically).
            spinner (str, optional): Name of spinner animation (see python -m rich.spinner). Defaults to "dots".
            spinner_style (StyleType, optional): Style of spinner. Defaults to "status.spinner".
            speed (float, optional): Speed factor for spinner animation. Defaults to 1.0.
            refresh_per_second (float, optional): Number of refreshes per second. Defaults to 12.5.

        Returns:
            Status: A Status object that may be used as a context manager.
        r'rR)r�r�r�r�r�)r�rS)r�r�r�r�r�r�rS�status_renderables        rgr�zConsole.status~sG��*	#�"�"�"�"�"�"�F����'��1�

�
�
��!� rfr�c�f�|jr)|�tj|����dSdS)zqShow or hide the cursor.

        Args:
            show (bool, optional): Set visibility of the cursor.
        TF)ryr�r4r)r�r�s  rgrzConsole.show_cursor�s6����	��L�L��,�T�2�2�3�3�3��4��urf�enablec��d}|jr7|js0|�tj|����d}||_|S)a�Enables alternative screen mode.

        Note, if you enable this mode, you should ensure that is disabled before
        the application exits. See :meth:`~rich.Console.screen` for a context manager
        that handles this for you.

        Args:
            enable (bool, optional): Enable (True) or disable (False) alternate screen. Defaults to True.

        Returns:
            bool: True if the control codes were written.

        FT)ryrvr�r4�
alt_screenr�)r�r��changeds   rgrzConsole.set_alt_screen�sM������	)�D�$7�	)��L�L��+�F�3�3�4�4�4��G�"(�D���rfc��|jS)z�Check if the alt screen was enabled.

        Returns:
            bool: True if the alt screen was enabled, otherwise False.
        )r�r�s rg�
is_alt_screenzConsole.is_alt_screen�s
���"�"rf�titlec�f�|jr)|�tj|����dSdS)aSet the title of the console terminal window.

        Warning: There is no means within Rich of "resetting" the window title to its
        previous value, meaning the title you set will persist even after your application
        exits.

        ``fish`` shell resets the window title before and after each command by default,
        negating this issue. Windows Terminal and command prompt will also reset the title for you.
        Most other shells and terminals, however, do not do this.

        Some terminals may require configuration changes before you can set the title.
        Some terminals may not support setting the title at all.

        Other software (including the terminal itself, the shell, custom prompts, plugins, etc.)
        may also set the terminal window title. This could result in whatever value you write
        using this method being overwritten.

        Args:
            title (str): The new title of the terminal window.

        Returns:
            bool: True if the control code to change the terminal title was
                written, otherwise False. Note that a return value of True
                does not guarantee that the window title has actually changed,
                since the feature may be unsupported/disabled in some terminals.
        TF)ryr�r4r)r�rs  rg�set_window_titlezConsole.set_window_title�s5��6��	��L�L���u�-�-�.�.�.��4��urfr�r�c�*�t|||pd���S)auContext manager to enable and disable 'alternative screen' mode.

        Args:
            hide_cursor (bool, optional): Also hide the cursor. Defaults to False.
            style (Style, optional): Optional style for screen. Defaults to None.

        Returns:
            ~ScreenContext: Context which enables alternate screen on enter, and disables it on exit.
        r�)r�r�)r�)r�r�r�s   rgr�zConsole.screen�s���T�{�%�+�2�N�N�N�Nrf�r�rr�c�@�tj||p|j|��}|S)a�Measure a renderable. Returns a :class:`~rich.measure.Measurement` object which contains
        information regarding the number of characters required to print the renderable.

        Args:
            renderable (RenderableType): Any renderable or string.
            options (Optional[ConsoleOptions], optional): Options to use when measuring, or None
                to use default options. Defaults to None.

        Returns:
            Measurement: A measurement of the renderable.
        )r:r�r�)r�rr��measurements    rg�measurezConsole.measure�s$��"�o�d�G�,C�t�|�Z�P�P���rfc#�K�|p|j}|jdkrdSt|��}t|d��r&t	|��s|�||��}nft
|t��r9|�||j	|j
���}|�||��}ntjd|�d����	t|��}n&#t$rtjd|�d����wxYwt}|���}|D]3}t
||��r|V��|�||��Ed{V���4dS)	akRender an object in to an iterable of `Segment` instances.

        This method contains the logic for rendering objects with the console protocol.
        You are unlikely to need to use it directly, unless you are extending the library.

        Args:
            renderable (RenderableType): An object supporting the console protocol, or
                an object that may be converted to a string.
            options (ConsoleOptions, optional): An options object, or None to use self.options. Defaults to None.

        Returns:
            Iterable[Segment]: An iterable of segments that may be rendered.
        r'Nr�)rr�zUnable to render zC; A str, Segment or object with __rich_console__ method is requiredzobject z is not renderable)r�rxr@r�rr�r�r��
render_strrr�r(�NotRenderableError�iter�	TypeErrorrDr�r9)	r�rr��_options�render_iterable�text_renderable�iter_render�_Segment�
render_outputs	         rgr9zConsole.renders�����"�*�d�l�����!�!��F��z�*�*�
��:�1�2�2�	�7�:�;N�;N�	�(�9�9�$��I�I�O�O�
�
�C�
(�
(�		�"�o�o��h�&8���.���O�.�>�>�t�X�N�N�O�O��+�T�J�T�T�T���
�
	���/�/�K�K���	�	�	��+�?�/�?�?�?���
�	�������(�(�*�*��(�	@�	@�M��-��2�2�
@�#�#�#�#�#��;�;�}�h�?�?�?�?�?�?�?�?�?�?�		@�	@s�C�#C8)r��pad�	new_linesrrc�X�|j5|p|j}|�||��}|rtj||��}|j}|�t
d|��}tttj	||j
|||���d|����}	|j�x|jt|	��z
}
|
dkr[|r'td|j
z|��td��gntd|j
z|��gg}|	�||
z��|	cddd��S#1swxYwYdS)aGRender objects in to a list of lines.

        The output of render_lines is useful when further formatting of rendered console text
        is required, such as the Panel class which draws a border around any renderable object.

        Args:
            renderable (RenderableType): Any object renderable in the console.
            options (Optional[ConsoleOptions], optional): Console options, or None to use self.options. Default to ``None``.
            style (Style, optional): Optional style to apply to renderables. Defaults to ``None``.
            pad (bool, optional): Pad lines shorter than render width. Defaults to ``True``.
            new_lines (bool, optional): Include "
" characters at end of lines.

        Returns:
            List[List[Segment]]: A list of lines, where a line is a list of Segment objects.
        Nr)�include_new_linesrr�r�r�)
r�r�r9rD�apply_styleror�rr�split_and_crop_linesrxr�extend)r�rr�r�rr�render_options�	_rendered�
render_heightr��extra_lines�pad_lines            rg�render_lineszConsole.render_lines:s���0�Z�!	�!	�$�4���N����J��?�?�I��
B�#�/�	�5�A�A�	�*�1�M��(� #�A�}� 5� 5�
����0�!�&�0�*3��#�����!�
�
���E��$�0�,�3�c�%�j�j�@����?�?�%�N���~�'?�!?��G�G��QU���W�W�%�c�N�,D�&D�e�L�L�M� �H�
�L�L��K�!7�8�8�8��C!	�!	�!	�!	�!	�!	�!	�!	�!	�!	�!	�!	����!	�!	�!	�!	�!	�!	s�D
D�D#�&D#r�)r�r|r}rTr�rrY�textr|r}rLc�x�|p
|duo|j}	|p
|duo|j}
|p
|duo|j}|
r't|||	|j���}||_||_n+t|	rt||j���n||||���}|r	|p|j	nd}
|
�/|
t|����}|�|��|S|S)a�Convert a string to a Text instance. This is called automatically if
        you print or log a string.

        Args:
            text (str): Text to render.
            style (Union[str, Style], optional): Style to apply to rendered text.
            justify (str, optional): Justify method: "default", "left", "center", "full", or "right". Defaults to ``None``.
            overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to ``None``.
            emoji (Optional[bool], optional): Enable emoji, or ``None`` to use Console default.
            markup (Optional[bool], optional): Enable markup, or ``None`` to use Console default.
            highlight (Optional[bool], optional): Enable highlighting, or ``None`` to use Console default.
            highlighter (HighlighterType, optional): Optional highlighter to apply.
        Returns:
            ConsoleRenderable: Renderable object.

        N)r�rTrU)�default_variant)r|r}r�)rlrkrn�
render_markuprmr|r}rLr*rYr��copy_styles)r�r$r�r|r}rTr�rrY�
emoji_enabled�markup_enabled�highlight_enabled�	rich_text�_highlighter�highlight_texts               rgr
zConsole.render_strus��8�@�%�4�-�"?�D�K�
��D�F�d�N�$C�t�|��%�P�)�t�*;�*O�����	�%���#�"�1�	���I�!(�I��!)�I���� ���t�T�5H�I�I�I�I���!��
���I�=N�W��7�t�'7��SW���#�)�\�#�i�.�.�9�9�N��&�&�y�1�1�1�!�!��rf)rWr1rWc�h�t|t��r|S	|j�|��}|�tj|��}|jr|���n|S#tj$r<}|�|�	|��cYd}~Stj
d|�d|����d�d}~wwxYw)a Get a Style instance by its theme name or parse a definition.

        Args:
            name (str): The name of a style or a style definition.

        Returns:
            Style: A Style object.

        Raises:
            MissingStyle: If no style could be parsed from name.

        NzFailed to get style z; )r�rEr�r��parse�linkr�r(�StyleSyntaxError�	get_style�MissingStyle)r�r1rWr��errors     rgr3zConsole.get_style�s����d�E�"�"�	��K�
	��%�)�)�$�/�/�E��}���D�)�)��#(�:�8�5�:�:�<�<�<�5�8���&�	�	�	��"��~�~�g�.�.�.�.�.�.�.�.��%�8�t�8�8��8�8����
�����	���s$�AA&�&B1�5B,�B1�B,�,B1�r|rTr�r�objects�seprc	���������g}|j�g��j}	���dvrdtddf��fd�}
|
�t}|s	|�|jr|j}d
�����fd�}|D]�}
t|
��}
t
|
t��r#|	|�|
|||������It
|
t��r|	|
���jt
|
t��r|���|
����t|
��r%|���t|
|�������|	|t|
��������|��|j
�(|�|j
����fd	�|D��}|S)aCombine a number of renderables and text into one renderable.

        Args:
            objects (Iterable[Any]): Anything that Rich can render.
            sep (str): String to write between print data.
            end (str): String to write at end of print data.
            justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``.
            emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default.
            markup (Optional[bool], optional): Enable markup, or ``None`` to use console default.
            highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default.

        Returns:
            List[ConsoleRenderable]: A list of things to render.
        )rXrYrZrr�Nc	�`���t|tt�������dSr�)r0r r1)r�_appendr|s ��rg�align_appendz2Console._collect_renderables.<locals>.align_append�s-������j�$�{�G�*D�*D�E�E�F�F�F�F�Frfc����rFt������}�|����������dSdS)N)r|r)rL�joinr�)�sep_textr�rr|r8r$s �����rg�
check_textz0Console._collect_renderables.<locals>.check_text�sV����
���W�#�>�>�>����x�}�}�T�*�*�+�+�+��
�
������
�
rf)rTr�rY)rYc�0��g|]}t|�����SrerG�r0rr�s  �rg�
<listcomp>z0Console._collect_renderables.<locals>.<listcomp>s#���S�S�S��6�*�e�4�4�S�S�Srf�r�N)r�rryrnrYr@r�r�r
rLr�r?r>r�r3)r�r7r8rr|rTr�rr��append_textr<r-r@rr;r�r�r$s  ```         @@@@rg�_collect_renderableszConsole._collect_renderables�s,���������202���$�����k�����1�1�1�
G��
G�D�
G�
G�
G�
G�
G�
G�
G�"�F�(9���	,��*�t��*��+�L�	�	�	�	�	�	�	�	�	�	�"�	;�	;�J�"�:�.�.�J��*�c�*�*�
;����O�O�"�%��L�$�������
�J��-�-�	
;���J�'�'�'�'��J�(9�:�:�
;��
������z�"�"�"�"��z�*�*�
;��
������v�j�l�C�C�C�D�D�D�D���L�L��Z���9�9�:�:�:�:��
�����:�!��N�N�4�:�.�.�E�S�S�S�S�{�S�S�S�K��rfu─z	rule.linerY)�
charactersr��alignrGrHc�Z�ddlm}|||||���}|�|��dS)u�Draw a line with optional centered title.

        Args:
            title (str, optional): Text to render over the rule. Defaults to "".
            characters (str, optional): Character(s) to form the line. Defaults to "─".
            style (str, optional): Style of line. Defaults to "rule.line".
            align (str, optional): How to align the title, one of "left", "center", or "right". Defaults to "center".
        r')�Rule)rrGr�rHN)�rulerJr)r�rrGr�rHrJrKs       rgrKzConsole.rulesF�� 	�������t�%�J�e�5�Q�Q�Q���
�
�4�����rfr�c��|jsA|5|j�d�|D����ddd��dS#1swxYwYdSdS)z�Insert non-printing control codes.

        Args:
            control_codes (str): Control codes, such as those that may move the cursor.
        c3�$K�|]}|jV��dSr�)�segment)r0�_controls  rg�	<genexpr>z"Console.control.<locals>.<genexpr>6s%����#M�#M��H�$4�#M�#M�#M�#M�#M�#MrfN)r{r�r)r�r�s  rgr�zConsole.control.s����$�	N��
N�
N���#�#�#M�#M�W�#M�#M�#M�M�M�M�
N�
N�
N�
N�
N�
N�
N�
N�
N�
N�
N�
N����
N�
N�
N�
N�
N�
N�	N�	Ns�%<�A�Ar�r�)r8rr�rc��|�d�|D����}|�|||ddddd|��	�	dS)a�Output to the terminal. This is a low-level way of writing to the terminal which unlike
        :meth:`~rich.console.Console.print` won't pretty print, wrap text, or apply markup, but will
        optionally apply highlighting and a basic style.

        Args:
            sep (str, optional): String to write between print data. Defaults to " ".
            end (str, optional): String to write at end of print data. Defaults to "\\n".
            style (Union[str, Style], optional): A style to apply to output. Defaults to None.
            highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use
                console default. Defaults to ``None``.
        c3�4K�|]}t|��V��dSr�)r�)r0�_objects  rgrPzConsole.out.<locals>.<genexpr>Ks(����"G�"G�G�3�w�<�<�"G�"G�"G�"G�"G�"GrfFTr_)r�rrTr�r~r}r]rN)r>r)r�r8rr�rr7�
raw_outputs       rg�outzConsole.out8sd��&�(�(�"G�"G�w�"G�"G�"G�G�G�
��
�
����������	�
	
�
	
�
	
�
	
�
	
rf)r8rr�r|r}r~rTr�rrnror]rM�new_line_startr~r]rVc
���|st��f}|
�|j}
|
r
|�d}|�d}d}|jdd�}|5|�|||||||	���}|D]}|�|��}�|j�|||
�t|
|j��nt||||	���}g}|j
}|j}|�|D]}||||�����n@|D]=}|tj
|||��|�|�������>|ritd�d�|D���������d	kr'|�d
tj����|r7|jj
}tj||jd���D]
}||���n|j�
|��ddd��dS#1swxYwYdS)a[Print to the console.

        Args:
            objects (positional args): Objects to log to the terminal.
            sep (str, optional): String to write between print data. Defaults to " ".
            end (str, optional): String to write at end of print data. Defaults to "\\n".
            style (Union[str, Style], optional): A style to apply to output. Defaults to None.
            justify (str, optional): Justify method: "default", "left", "right", "center", or "full". Defaults to ``None``.
            overflow (str, optional): Overflow method: "ignore", "crop", "fold", or "ellipsis". Defaults to None.
            no_wrap (Optional[bool], optional): Disable word wrapping. Defaults to None.
            emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to ``None``.
            markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to ``None``.
            highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to ``None``.
            width (Optional[int], optional): Width of output, or ``None`` to auto-detect. Defaults to ``None``.
            crop (Optional[bool], optional): Crop output to width of terminal. Defaults to True.
            soft_wrap (bool, optional): Enable soft wrap mode which disables word wrapping and cropping of text or ``None`` for
                Console default. Defaults to ``None``.
            new_line_start (bool, False): Insert a new line at the start if the output contains more than one line. Defaults to ``False``.
        NTr_Fr6)r|r}rnror~r�rr�c3�$K�|]}|jV��dSr��r$�r0rNs  rgrPz Console.print.<locals>.<genexpr>�s$����I�I����I�I�I�I�I�Irfr'r�r)r�rMr�rFr<r�r��minrnr�rr9rDrr3rr>�
splitlines�insertr�r�r)r�r8rr�r|r}r~rTr�rrnror]rMrVr7�render_hooksr�r�r�new_segmentsrr9r�
buffer_extendr�s                          rgrz
Console.printXs���J�	#��y�y�l�G�����I��	�������#���D��)�!�!�!�,��
�0	2�0	2��3�3�������#�4���K�%�
D�
D��"�6�6�{�C�C���!�\�0�0��!�05�0A�c�%���,�,�,�y����#�1���N�+-�L�!�(�F��[�F��}�"-�?�?�J��F�6�6�*�n�=�=�>�>�>�>�?�#.���J��F��+�"�F�:�~�>�>����u�@U�@U�������
�
;�����I�I�L�I�I�I�I�I�T�T�V�V�W�W����!�'�'��7�<�>�>�:�:�:��
2� $�� 3�
�#�8� �$�*�%����(�(�D�"�M�$�'�'�'�'�(�
��#�#�L�1�1�1�a0	2�0	2�0	2�0	2�0	2�0	2�0	2�0	2�0	2�0	2�0	2�0	2����0	2�0	2�0	2�0	2�0	2�0	2s�FG$�$G(�+G(rh)	�data�indentr�	skip_keys�ensure_ascii�check_circular�	allow_nanrW�	sort_keys�jsonrbrcrdrerfrgrhc	��ddlm}|�|�||||||||	|
��	�	}n<t|t��std|�d����|||||||||	|
��	�	}|�|d���dS)	a�Pretty prints JSON. Output will be valid JSON.

        Args:
            json (Optional[str]): A string containing JSON.
            data (Any): If json is not supplied, then encode this data.
            indent (Union[None, int, str], optional): Number of spaces to indent. Defaults to 2.
            highlight (bool, optional): Enable highlighting of output: Defaults to True.
            skip_keys (bool, optional): Skip keys not of a basic type. Defaults to False.
            ensure_ascii (bool, optional): Escape all non-ascii characters. Defaults to False.
            check_circular (bool, optional): Check for circular references. Defaults to True.
            allow_nan (bool, optional): Allow NaN and Infinity values. Defaults to True.
            default (Callable, optional): A callable that converts values that can not be encoded
                in to something that can be JSON encoded. Defaults to None.
            sort_keys (bool, optional): Sort dictionary keys. Defaults to False.
        r)�JSONN)rcrrdrerfrgrWrhz/json must be str. Did you mean print_json(data=z) ?T)rM)�	rich.jsonrk�	from_datar�r�rr)
r�rirbrcrrdrerfrgrWrhrk�json_renderables
             rg�
print_jsonzConsole.print_json�s���:	#�"�"�"�"�"��<�"�n�n���#�#�)�-�#��#�-�
�
�O�O��d�C�(�(�
��Q�d�Q�Q�Q����#�d���#�#�)�-�#��#�
�
�
�O�	
�
�
�?�d�
�3�3�3�3�3rf)�regionr�rpc�@�|jstjd���|p|j}|�,dx}}|�|j|jp|j��}n|\}}}}|�||��}|�||���}	|�|	||��dS)a�Update the screen at a given offset.

        Args:
            renderable (RenderableType): A Rich renderable.
            region (Region, optional): Region of screen to update, or None for entire screen. Defaults to None.
            x (int, optional): x offset. Defaults to 0.
            y (int, optional): y offset. Defaults to 0.

        Raises:
            errors.NoAltScreen: If the Console isn't in alt screen mode.

        �0Alt screen must be enabled to call update_screenNrr)	rr(�NoAltScreenr�r�rxror#�update_screen_lines)
r�rrpr�rr�r�rnror�s
          rg�
update_screenzConsole.update_screen�s���&�!�	Y��$�%W�X�X�X� �0�D�L���>��I�A��+�=�=��(�.�*?�*N�4�;���N�N�#)��A�q�%��+�=�=�e�V�L�L�N��!�!�*�n�!�E�E��� � ���1�-�-�-�-�-rfrr�r�r�c���|jstjd���t|||��}|�|��}|j�|��|���dS)a�Update lines of the screen at a given offset.

        Args:
            lines (List[List[Segment]]): Rendered lines (as produced by :meth:`~rich.Console.render_lines`).
            x (int, optional): x offset (column no). Defaults to 0.
            y (int, optional): y offset (column no). Defaults to 0.

        Raises:
            errors.NoAltScreen: If the Console isn't in alt screen mode.
        rrN)rr(rsr�r9r�rr�)r�r�r�r��
screen_updater�s      rgrtzConsole.update_screen_linessr���!�	Y��$�%W�X�X�X�$�U�A�q�1�1�
��;�;�}�-�-������H�%�%�%��������rfrUr"re�rnr!r��	word_wrap�show_locals�suppress�
max_framesr!ryrzr{r|c	�`�ddlm}||||||||���}	|�|	��dS)a
Prints a rich render of the last exception and traceback.

        Args:
            width (Optional[int], optional): Number of characters used to render code. Defaults to 100.
            extra_lines (int, optional): Additional lines of code to render. Defaults to 3.
            theme (str, optional): Override pygments theme used in traceback
            word_wrap (bool, optional): Enable word wrapping of long lines. Defaults to False.
            show_locals (bool, optional): Enable display of local variables. Defaults to False.
            suppress (Iterable[Union[str, ModuleType]]): Optional sequence of modules or paths to exclude from traceback.
            max_frames (int): Maximum number of frames to show in a traceback, 0 for no maximum. Defaults to 100.
        r')�	TracebackrxN)r�r~r)
r�rnr!r�ryrzr{r|r~r�s
          rg�print_exceptionzConsole.print_exception.s[��,	)�(�(�(�(�(��I��#���#��!�
�
�
�	�	
�
�
�9�����rfr��currentframec���|dz
}|��}|�1|r|�|j}|dz}|r|�|�J�|jj|j|jfStj��|}|j|j|j	jfS)aEGet caller frame information.

        Args:
            offset (int): the caller offset within the current frame stack.
            currentframe (Callable[[], Optional[FrameType]], optional): the callable to use to
                retrieve the current frame. Defaults to ``inspect.currentframe``.

        Returns:
            Tuple[str, int, Dict[str, Any]]: A tuple containing the filename, the line number and
                the dictionary of local variables associated with the caller frame.

        Raises:
            RuntimeError: If the stack offset is invalid.
        r')
�f_back�f_code�co_filename�f_lineno�f_locals�inspect�stack�filename�lineno�frame)r�r�r��
frame_infos    rg�_caller_frame_infozConsole._caller_frame_infoQs���(	�!�����������
�U�.�����!����
�U�.��$�$�$��<�+�U�^�U�^�K�K�!�����0�J��&�
�(9�:�;K�;T�T�Trf)	r8rr�r|rTr�r�
log_locals�
_stack_offsetr�r�c	
���|
st��f}
|jdd�}|5|�|
||||||���}���fd�|D��}|�|	��\}
}}|
�d��rdnt
j�|
��}|
�t
j	��d}|rBd�|�
��D��}|�t|d�����|�
|||���|||�	��g}|D]}|�|��}�g}|j}|j}|j}|D]}||||�����|jj}t)j||jd
���D]
}||���	ddd��dS#1swxYwYdS)aXLog rich content to the terminal.

        Args:
            objects (positional args): Objects to log to the terminal.
            sep (str, optional): String to write between print data. Defaults to " ".
            end (str, optional): String to write at end of print data. Defaults to "\\n".
            style (Union[str, Style], optional): A style to apply to output. Defaults to None.
            justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``.
            emoji (Optional[bool], optional): Enable emoji code, or ``None`` to use console default. Defaults to None.
            markup (Optional[bool], optional): Enable markup, or ``None`` to use console default. Defaults to None.
            highlight (Optional[bool], optional): Enable automatic highlighting, or ``None`` to use console default. Defaults to None.
            log_locals (bool, optional): Boolean to enable logging of locals where ``log()``
                was called. Defaults to False.
            _stack_offset (int, optional): Offset of caller from end of call stack. Defaults to 1.
        Nr6c�0��g|]}t|�����SrerGrBs  �rgrCzConsole.log.<locals>.<listcomp>�s#���W�W�W�Z�v�j�%�8�8�W�W�Wrf�<���c�D�i|]\}}|�d���||��S)�__)r�)r0�keyr�s   rgr3zConsole.log.<locals>.<dictcomp>�s@�����"��U��>�>�$�/�/������rfz	[i]locals)r)rV�path�line_no�	link_pathFr[)r�r�rFr�r�r&r��abspathr�r8�itemsr�rBrxr[r<rr9r�r�rDrrn)r�r8rr�r|rTr�rr�r�r7r_r�r�r��localsr�r��
locals_mapr�r`rr9rrrar�s   `                       rg�logzConsole.logts����8�	#��y�y�l�G��)�!�!�!�,��
�.	$�.	$��3�3�������#�4���K�� �W�W�W�W�;�W�W�W��(,�(?�(?�
�(N�(N�%�H�g�v� (� 3� 3�C� 8� 8�W���b�g�o�o�h�>W�>W�I��&�&�r�v�.�.�r�2�D��
P���&,�l�l�n�n����
�
�"�"�<�
�+�#N�#N�#N�O�O�O�� � ���!�.�.�0�0��#�'�
!���	�K�%�
D�
D��"�6�6�{�C�C���*,�L�!�(�F��[�F�!�\�N�)�
;�
;�
���v�v�j�.�9�9�:�:�:�:� �L�/�M��4��d�j�e����
$�
$���
�d�#�#�#�#�
$�W.	$�.	$�.	$�.	$�.	$�.	$�.	$�.	$�.	$�.	$�.	$�.	$����.	$�.	$�.	$�.	$�.	$�.	$s�FG�G
�
G
c	�N�|jr|jdd�=dS|j5|jrF|j5|j�|jdd���ddd��n#1swxYwY|jdk�r�|jrCddl	m
}||j|�|jdd�����|jdd�=�nNt�r�d}|j
rt|j��}|�	|t v}|rfddlm}ddlm}|jdd�}|jr(|jr!t/t1j|����}||||j�����n�|�|jdd���}|jj}d}		t7|��|	kr||��n�g}
|
j}d}|�d	��D]k}
|t7|
��z|	kr6|
r4|d
�|
����|
���d}||
��|t7|
��z
}�l|
r2|d
�|
����|
���n�#t@$r}|j!�d�|_!�d}~wwxYw|�|jdd���}	|j�|��n"#t@$r}|j!�d�|_!�d}~wwxYw|j�"��|jdd�=ddd��dS#1swxYwYdS)aQCheck if the buffer may be rendered. Render it if it can (e.g. Console.quiet is False)
        Rendering is supported on Windows, Unix and Jupyter environments. For
        legacy Windows consoles, the win32 API is called directly.
        This method will also record what it renders if recording is enabled via Console.record.
        Nrr')�displayF)�LegacyWindowsTerm)�legacy_windows_renderi Tr�zG
*** You may need to add PYTHONIOENCODING=utf-8 to your environment ***)#rPr�r�rSr}r�rr�rg�jupyterr�r�rCrvr-rO�_STD_STREAMS_OUTPUT�rich._win32_consoler��rich._windows_rendererr�rQrsrrD�remove_color�writerr�r]r>r��UnicodeEncodeError�reason�flush)r�r��use_legacy_windows_render�filenor�r�r�r$r��	MAX_WRITE�batch�batch_appendrur�r5s               rgr�zConsole._check_buffer�s]���:�	���Q�Q�Q���F�
�Z�D	(�D	(��{�
@��-�@�@��'�.�.�t�|�A�A�A��?�?�?�@�@�@�@�@�@�@�@�@�@�@����@�@�@�@��!�Q�&�&��?�>(�0�0�0�0�0�0��G�D�L�$�*=�*=�d�l�1�1�1�o�*N�*N�O�O�O���Q�Q�Q����5"�49�1��.�"�%/��	�%:�%:�F�%�1�$*�.A�$A�!:�5�%&�M�M�M�M�M�M�T�T�T�T�T�T�%)�\�!�!�!�_�F�#�}�L��1C�L�)-�g�.B�6�.J�.J�)K�)K��1�1�&�:K�:K�D�I�:V�:V�W�W�W�W�$(�#6�#6�t�|�A�A�A��#G�#G�D�%)�I�O�E�(6�I�&�#&�t�9�9�	�#9�#9�$)�E�$�K�K�K�K�79�E�38�<�L�+,�D�04����0E�0E�%:�%:��+/�#�d�)�)�+;�i�+G�+G�E�+G�,1�E�"�'�'�%�.�.�,A�,A�,A�,1�K�K�M�M�M�34�D�(4��T�(:�(:�(:�(,��D�	�	�(9���',�%6�(-��b�g�g�e�n�n�(=�(=�(=�(-���
�
�
���#5�&�&�&�27�,�0I�0I�0I��� %�����&���� $�2�2�4�<����?�C�C��"� �I�O�O�D�1�1�1�1��1�"�"�"�.3�l�,E�,E�,E�E�L�!�����"�����I�O�O�%�%�%���Q�Q�Q��ID	(�D	(�D	(�D	(�D	(�D	(�D	(�D	(�D	(�D	(�D	(�D	(����D	(�D	(�D	(�D	(�D	(�D	(s~�L�(A�L�A"	�"L�%A"	�&D!L�CI(�'L�(
J�2J�J�%L�-K�L�
K'�K"�"K'�'&L�L�!Lr�c� �g}|j}|j}|j}|j}|jr|rtj|��}|D]9\}}}	|r"||�|||������*|r|	s||���:d�|��}
|
S)z)Render buffered output, and clear buffer.)rIrvr�)	r�rsrvryrQrDr�r9r>)r�r��outputr�rIrv�not_terminalr$r�r��rendereds           rgr�zConsole._render_buffers���������)���,���+�+���=�	2�\�	2��)�&�1�1�F�$*�
	�
	� �D�%���	
����L�L��%1�'5�!�������#�
�w�
���t������7�7�6�?�?���rf)r�rT�password�stream�promptr�r�c��|r|�|||d���|rtd|���}n%|r|���}nt��}|S)a5Displays a prompt and waits for input from the user. The prompt may contain color / style.

        It works in the same way as Python's builtin :func:`input` function and provides elaborate line editing and history features if Python's builtin :mod:`readline` module is previously loaded.

        Args:
            prompt (Union[str, Text]): Text to render in the prompt.
            markup (bool, optional): Enable console markup (requires a str prompt). Defaults to True.
            emoji (bool, optional): Enable emoji (requires a str prompt). Defaults to True.
            password: (bool, optional): Hide typed text. Defaults to False.
            stream: (TextIO, optional): Optional file to read input from (rather than stdin). Defaults to None.

        Returns:
            str: Text read from stdin.
        r�)r�rTr)r�)rr	�readline�input)r�r�r�rTr�r��results       rgr�z
Console.input,sj��.�	C��J�J�v�f�E�r�J�B�B�B��	!��R��/�/�/�F�F��
!����*�*��������
rf�r�r�r�c��|js
Jd���|j5|r%d�d�|jD����}n$d�d�|jD����}|r
|jdd�=ddd��n#1swxYwY|S)a�Generate text from console contents (requires record=True argument in constructor).

        Args:
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
            styles (bool, optional): If ``True``, ansi escape codes will be included. ``False`` for plain text.
                Defaults to ``False``.

        Returns:
            str: String containing console contents.

        �ITo export console contents set record=True in the constructor or instancer�c3�PK�|]!\}}}|r|�|��n|V��"dSr�r8)r0r$r��_s    rgrPz&Console.export_text.<locals>.<genexpr>`sR������&��e�Q�,1�:�U�\�\�$�'�'�'�d������rfc3�2K�|]}|j�	|jV��dSr�)r�r$rZs  rgrPz&Console.export_text.<locals>.<genexpr>es@�������"�?���L������rfN)rSr}r>r�)r�r�r�r$s    rg�export_textzConsole.export_textNs��
�K�	W�	W�V�	W�	W�	W��
%�
	+�
	+��

��w�w���*.�*=��������
�w�w���#'�#6�������
�
+��'����*�
	+�
	+�
	+�
	+�
	+�
	+�
	+�
	+�
	+�
	+�
	+����
	+�
	+�
	+�
	+��s�AA=�=B�Br�c��|�||���}t|dd���5}|�|��ddd��dS#1swxYwYdS)a�Generate text from console and save to a given location (requires record=True argument in constructor).

        Args:
            path (str): Path to write text files.
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
            styles (bool, optional): If ``True``, ansi style codes will be included. ``False`` for plain text.
                Defaults to ``False``.

        r��wtr��rzN)r��openr�)r�r�r�r�r$�
write_files      rg�	save_textzConsole.save_textns������e�F��;�;��
�$��w�
/�
/�
/�	#�:����T�"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�	#�	#s�A
�
A�A�r�r��code_format�
inline_stylesr�r�c	�>�|js
Jd���g}|j}|pt}d}|�tn|}	|j5|r�tjtj|j����D]Y\}
}}t|
��}
|r7|�
|��}
|jrd|j�d|
�d�}
|
r	d|
�d|
�d�n|
}
||
���Zn�i}tjtj|j����D]\}
}}t|
��}
|r]|�
|��}
|�|
t|��d	z��}|jrd
|�d|j�d|
�d�}
n	d|�d|
�d�}
||
����g}|j}|���D]\}}|r|d
|�d|�d����d�|��}|	�d�|��||jj|jj���}|r
|jdd�=ddd��n#1swxYwY|S)aIGenerate HTML from console contents (requires record=True argument in constructor).

        Args:
            theme (TerminalTheme, optional): TerminalTheme object containing console colors.
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
            code_format (str, optional): Format string to render HTML. In addition to '{foreground}',
                '{background}', and '{code}', should contain '{stylesheet}' if inline_styles is ``False``.
            inline_styles (bool, optional): If ``True`` styles will be inlined in to spans, which makes files
                larger but easier to cut and paste markup. If ``False``, styles will be embedded in a style tag.
                Defaults to False.

        Returns:
            str: String containing console contents as HTML.
        r�r�Nz	<a href="z">z</a>z
<span style="z</span>r'z<a class="rz" href="z<span class="rz.rz {�}r�)�code�
stylesheet�
foreground�
background)rSr�rIr+r}rD�filter_control�simplifyr�r
�get_html_styler1�
setdefaultrr�r>�format�foreground_color�hex�background_color)r�r�r�r�r��	fragmentsr��_themer��render_code_formatr$r�r�rKr��style_number�stylesheet_rules�stylesheet_append�
style_rule�
rendered_codes                    rg�export_htmlzConsole.export_html|s!��.
�K�	W�	W�V�	W�	W�	W� "�	��!���0�0���
�4?�4G�0�0�[��
�
%�(	+�(	+��
9�&-�&<��$�T�%8�9�9�'�'�	!�	!�N�D�%��"�$�<�<�D��W�$�3�3�F�;�;�� �:�H�#G�u�z�#G�#G�T�#G�#G�#G�D�HL�V�D�t�D�D�t�D�D�D�D�RV���F�4�L�L�L�L�	!�*,��&-�&<��$�T�%8�9�9�'�'�!�!�N�D�%��"�$�<�<�D��R�$�3�3�F�;�;��'-�'8�'8��s�6�{�{�Q��'O�'O�� �:�R�#_��#_�#_�u�z�#_�#_�UY�#_�#_�#_�D�D�#Q�L�#Q�#Q�D�#Q�#Q�#Q�D��F�4�L�L�L�L�.0� �$4�$;�!�06�����P�P�,�J��!�P�)�)�*N�|�*N�*N�
�*N�*N�*N�O�O�O��!�Y�Y�'7�8�8�
�.�5�5��W�W�Y�'�'�%�!�2�6�!�2�6�	6���M��
+��'����*�Q(	+�(	+�(	+�(	+�(	+�(	+�(	+�(	+�(	+�(	+�(	+����(	+�(	+�(	+�(	+�R�s�GH�H�Hc��|�||||���}t|dd���5}|�|��ddd��dS#1swxYwYdS)a@Generate HTML from console contents and write to a file (requires record=True argument in constructor).

        Args:
            path (str): Path to write html file.
            theme (TerminalTheme, optional): TerminalTheme object containing console colors.
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
            code_format (str, optional): Format string to render HTML. In addition to '{foreground}',
                '{background}', and '{code}', should contain '{stylesheet}' if inline_styles is ``False``.
            inline_styles (bool, optional): If ``True`` styles will be inlined in to spans, which makes files
                larger but easier to cut and paste markup. If ``False``, styles will be embedded in a style tag.
                Defaults to False.

        r�r�r�r�N)r�r�r�)r�r�r�r�r�r��htmlr�s        rg�	save_htmlzConsole.save_html�s���,�����#�'�	 �
�
���$��w�
/�
/�
/�	#�:����T�"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�	#�	#s�A�A�A�Richg��Q���?�rr�r�r��font_aspect_ratio�	unique_idr�r�c�	��2�3�4�5�6�7�ddlm}i�6dtdtf�2�6fd�}|pt�2|j�7d}	|	|z�3|	dz�4d}
d}d}d}
d	}d
}d
}d
}||z}||z}|
|z}|
|z}g}g}i}d}dtdtfd�}	d3dtdttdtdtfd��5|j5ttj|j����}|r|j�
��d
d
d
��n#1swxYwY��ldttjd�d�|D�����dd��|�dd��z����z�d}t%tj|�7�����D�]�\}}d}|D�]t\}} }!| p
t��} || ��}"|"|vr
|||"<|dz
}d||"��}#| jr5d}$| j��2jjn| j��2��j}%nE| j}&|&d
uo|&j}$| j��2jjn| j��2��j}%||��}'|$r4|��5d|%|�3z|�4zdz�3|'z�4dzd�����|dt;|��zkrS|��5d||����d |#��|�3z|�4z|	z�3t;|��zd!��d"|�d#��$����|||��z
}��v����4fd%�t=|��D��}(d&��3�4�5��7fd'�t%|(��D����})d&��fd(�|���D����}*d�|��}+d�|��},tA�7�3z|z��}-|dz�4z|z}.�5d�2jjd)d*|
|
|-|.d
�+�	�	}/�2jj}0|r*|/�5d||����d,�|0d-|-d.z|
|	zd/z�0��z
}/|/d1z
}/|�!��3|	�4�3�7zdz
|dz�4zdz
|-|z|.|z|
|z|
|z|*|/|+|,|)�2��}1|1S)4a
        Generate an SVG from the console contents (requires record=True in Console constructor).

        Args:
            title (str, optional): The title of the tab in the output image
            theme (TerminalTheme, optional): The ``TerminalTheme`` object to use to style the terminal
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``
            code_format (str, optional): Format string used to generate the SVG. Rich will inject a number of variables
                into the string in order to form the final SVG output. The default template used and the variables
                injected by Rich can be found by inspecting the ``console.CONSOLE_SVG_FORMAT`` variable.
            font_aspect_ratio (float, optional): The width to height ratio of the font used in the ``code_format``
                string. Defaults to 0.61, which is the width to height ratio of Fira Code (the default font).
                If you aren't specifying a different font inside ``code_format``, you probably don't need this.
            unique_id (str, optional): unique id that is used as the prefix for various elements (CSS styles, node
                ids). If not set, this defaults to a computed value based on the recorded content.
        r)�cell_lenr�r�c���|�vr�|Sg}|j�|jjr�jn|j����}|j�|jjr�jn|j����}|jr||}}|jrt||d��}|�	d|j
����|jr|�	d��|jr|�	d��|j
r|�	d��|jr|�	d��d�|��}|�|<|S)	z%Convert a Style to CSS rules for SVG.Ng�������?zfill: zfont-weight: boldzfont-style: italic;ztext-decoration: underline;ztext-decoration: line-through;�;)�color�
is_defaultr��
get_truecolor�bgcolorr��reverse�dimr3r�r��bold�italic�	underline�striker>)r��	css_rulesr�r��cssr��style_caches     ��rg�
get_svg_stylez)Console.export_svg.<locals>.get_svg_style	sy�����#�#�"�5�)�)��I��K�'�5�;�+A�'��'�'��[�.�.�v�6�6�
��M�)�U�]�-E�)��'�'��]�0�0��8�8�
�
�}�
0�!(�%�w���y�
7�!�%��#�6�6�����1�e�i�1�1�2�2�2��z�
6�� � �!4�5�5�5��|�
8�� � �!6�7�7�7���
@�� � �!>�?�?�?��|�
C�� � �!A�B�B�B��(�(�9�%�%�C�!$�K����Jrf�g��Q���?r'�(r#r$c�H�t|���dd��S)z.HTML escape text and replace spaces with nbsp.r�z&#160;)r
�replacerYs rg�escape_textz'Console.export_svg.<locals>.escape_textA	s���$�<�<�'�'��X�6�6�6rfNr1r��attribsc	����dtdtfd��d��fd�|���D����}|rd|�d|�d|�d|�d�	nd|�d|�d	�S)
z.Make a tag from name, content, and attributes.r�r�c�j�t|t��rt|d��St|��S)N�g)r��floatr�r�)r�s rg�	stringifyz7Console.export_svg.<locals>.make_tag.<locals>.stringifyJ	s0���e�e�-�-�.�!�%��-�-�-��5�z�z�!rfr�c3��K�|]?\}}|�d���dd���d�|���d�V��@dS)r�r�z="�"N)�lstripr�)r0�k�vrs   �rgrPz7Console.export_svg.<locals>.make_tag.<locals>.<genexpr>O	sn�����#�#��A�q��8�8�C�=�=�(�(��c�2�2�E�E�i�i��l�l�E�E�E�#�#�#�#�#�#rfr�r�z</z/>)�objectr�r>r�)r1r�r�tag_attribsrs    @rg�make_tagz$Console.export_svg.<locals>.make_tagE	s����

"��
"�C�
"�
"�
"�
"�
�(�(�#�#�#�#�#�M�M�O�O�#�#�#���K��0�;�D�;�;�;�;�;��;�;�D�;�;�;�;�/��/�/��/�/�/�
rfz	terminal-r�c3�4K�|]}t|��V��dSr�)�reprrZs  rgrPz%Console.export_svg.<locals>.<genexpr>a	s(����C�C�w�T�'�]�]�C�C�C�C�C�Crfr�r_)�length�rT�rect��?��?�
crispEdges)�fillr�r�rnro�shape_renderingr�r�zurl(#�-line-�))�_classr�r��
textLength�	clip_pathc� ��g|]
}|�zdz��S)rre)r0r��line_heights  �rgrCz&Console.export_svg.<locals>.<listcomp>�	s#���L�L�L���+�-��3�L�L�Lrfr�c3�^�K�|]'\}}d��d|�d�dd|��z�dz����d�V��(dS)	z<clipPath id="rz">
    rrr)r�r�rnroz
            </clipPath>Nre)r0r�r��
char_widthrrr�rns   �����rgrPz%Console.export_svg.<locals>.<genexpr>�	s������
�
� ���
�y�
�
��
�
�
�X�f��V�:��+=�k�TX�FX�Y�Y�Y�
�
�
�
�
�
�
�
�
rfc3�6�K�|]\}}d��d|�d|�d�V��dS)�.z-rz { z }Nre)r0r��rule_nor�s   �rgrPz%Console.export_svg.<locals>.<genexpr>�	sT�����
�
�7C�s�G�2�	�2�2�W�2�2�#�2�2�2�
�
�
�
�
�
rfzrgba(255,255,255,0.35)�1)r�stroke�stroke_widthr�r�rnro�rxz-title�middlerh�)rr�text_anchorr�r�z�
            <g transform="translate(26,22)">
            <circle cx="0" cy="0" r="7" fill="#ff5f57"/>
            <circle cx="22" cy="0" r="7" fill="#febc2e"/>
            <circle cx="44" cy="0" r="7" fill="#28c840"/>
            </g>
        )r�r!�char_heightr�terminal_width�terminal_heightrnro�
terminal_x�
terminal_yr��chrome�backgrounds�matrixr�r�)"�
rich.cellsr�rEr�rJrnrrr}rrDr�r�r��zlib�adler32r>�encoder�rr�r�r�r�r�r�r�r�r�r�ranger�r
r�)8r�rr�r�r�r�r�r�r�r,�
margin_top�margin_right�
margin_bottom�margin_left�padding_top�
padding_right�padding_bottom�padding_left�
padding_width�padding_height�margin_width�
margin_height�text_backgrounds�
text_group�classes�style_norr�r�r�r�r$r�rO�rules�
class_name�has_backgroundr�r��text_length�line_offsetsr�r�r2r3r-r.r1�title_color�svgr�r!rrr�rns8      `                                           @@@@@@rg�
export_svgzConsole.export_svg�s����������6	(�'�'�'�'�'�(*��	��	�3�	�	�	�	�	�	�	�B�*�*���
���� �#4�4�
�!�D�(���
����
������
�����$�}�4�
�$�~�5��"�\�1��"�]�2�
�&(�� "�
�"$����	7�c�	7�c�	7�	7�	7�	7�
15�	�	��	� (��
�	�AG�	�
�	�	�	�	�(�
%�	,�	,��G�2�4�3F�G�G�H�H�H��
,��#�)�)�+�+�+�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,�
��#�c����W�W�C�C�(�C�C�C�C�C�K�K�� ����l�l�7�H�5�5�	6���'�'��I�
�� ��!=�h�u�!U�!U�!U�V�V�4	$�4	$�G�A�t��A�)-�2
$�2
$�%��e�X��(�����%�
�e�,�,����'�'�%-�G�E�N���M�H�1����1�1�
��=��%)�N�!�;�.��/�3�3�"�[�6�6�v�>�>�B��J�$�m�G�%,�D�%8�%S��AS�=S�N�!�=�0��/�3�3�"�]�8�8��@�@�D��'�h�t�n�n��!��$�+�+� ��"�!+��*�n��+�o��3�",�{�":�#.��#5�,8����
�
�
��3��T���?�*�*��%�%� ��"�'�K��-�-�&/�#>�#>�*�#>�#>��*�n��+�o��;�'1�C��I�I�'=�&C�i�&C�&C�q�&C�&C�&C����
�
�
��X�X�d�^�^�#���e2
$�hM�L�L�L�5��8�8�L�L�L���	�	�
�
�
�
�
�
�
�
�$-�\�#:�#:�	
�
�
�
�
�����
�
�
�
�GN�}�}���
�
�
�
�
���g�g�.�/�/������$�$���e�j�0�=�@�A�A���q�5�K�/�.�@������(�,�+���� �"��

�

�

���-�1���		��h�h����E�"�"�#�+�+�+� �$� �A�%��{�*�Q�.����
�F�	��	��� � ��!�#�#�%��-��1���U�k�1�A�5� �<�/�"�]�2�"�\�1�!�K�/���#���!�
�
��"�
s�3AD�D�Dc��|�||||||���}t|dd���5}	|	�|��ddd��dS#1swxYwYdS)a7Generate an SVG file from the console contents (requires record=True in Console constructor).

        Args:
            path (str): The path to write the SVG to.
            title (str, optional): The title of the tab in the output image
            theme (TerminalTheme, optional): The ``TerminalTheme`` object to use to style the terminal
            clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``
            code_format (str, optional): Format string used to generate the SVG. Rich will inject a number of variables
                into the string in order to form the final SVG output. The default template used and the variables
                injected by Rich can be found by inspecting the ``console.CONSOLE_SVG_FORMAT`` variable.
            font_aspect_ratio (float, optional): The width to height ratio of the font used in the ``code_format``
                string. Defaults to 0.61, which is the width to height ratio of Fira Code (the default font).
                If you aren't specifying a different font inside ``code_format``, you probably don't need this.
            unique_id (str, optional): unique id that is used as the prefix for various elements (CSS styles, node
                ids). If not set, this defaults to a computed value based on the recorded content.
        r�r�r�r�N)rPr�r�)
r�r�rr�r�r�r�r�rOr�s
          rg�save_svgzConsole.save_svg�	s���6�o�o����#�/��
�
�
���$��w�
/�
/�
/�	"�:����S�!�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�	"�	"s�A�A�ArD)r�rQr�N)r�r�r�r�r�)TNr�r
)rr)}rbrcrdrpr&�environrGrr�rrr7rr$r�rNrrqrFr5rr.rrrr�r�r�rO�setterrrDr�r�rOr�r2rtr�r�r�r�r:r�r�r�rr�r�r�r�r�r�r�rIrzryr{rtr�rmrurrnror�r�r�r<r�r�r�r�rr�rrrrr�r:rrr9rEr#r�r�r]r
r3r�rFrMr1rKr4r�rUrrorArurtrr�staticmethodr�r�rrr�r�r�r�rr�r�r�rKr�r+r�r,rPrRrerfrgr�r�Rs��������!�!�F#%�*�H�g�c�3�h��,�,�,�
�)-�(,�,0��!%��"&��#� $�%)�#'�����04����:@�3B�?�3D�3D�)-��9=�26�04�Az$�z$�z$���E�F�
�z$�!���
z$� ��~�z$�$�D�>�z$��z$����z$��z$��r�#�w��z$��z$���}�z$���
�z$� �	�"�!z$�"�4�.�#z$�$�%z$�&�'z$�(�)z$�*�+z$�, ��-�-z$�.�/z$�0�1z$�2�3z$�4�s�$6�6�7�5z$�6�/�0�7z$�8!���9z$�:�;z$�<�x��H��5�6�=z$�>�8�B��I�.�/�?z$�@�7�3��8�,�-�Az$�z$�z$�z$�xF�#�F�F�F�F���b��g�����X��
�[��R��W�������[���*��g��*�*�*��X�*��0�s�0�0�0��X�0���1�3�1�4�1�1�1���1��/�j�/�/�/��X�/� �h�{�&;� � � � �0 � � � �����
��������
,�Z�,�D�,�,�,�,�%�%�%�%�
����
����������������	�S�	�	�	�	�;?�	=�	=�	=��	=�4�	=�4�	=�	=�	=�	=�&�&�&�&�:>�
2�
2�
2�u�
2�$�
2�,�
2�
2�
2�
2��
�h�s�m�
�
�
��X�
��L�#�L�L�L��X�L��!�T�!�!�!��X�!�F�	,�$�	,�	,�	,��X�	,��

��

�

�

��X�

��+
�'�+
�+
�+
��X�+
�Z
�[��U�3��8�_�������[����s�����X���\��3��4�����\��� �� � � ��X� ��]��S��T�����]��%�%�%�%�������$RW�K�K��e�_�K�59�K�JN�K�	�K�K�K�K�.#�#�#�#�d�#�#�#�#�	*�	*�$�	*�$�	*�	*�	*�	*��#3��$(�!�!�!��!��	!�
!�!��
!�"�!�
�!�!�!�!�B	�	��	��	�	�	�	���T��T�����*�#�t�#�#�#��X�#��c��d�����BFJ�O�O��O�/7�	�/B�O�	�O�O�O�O�RV����(��6>�~�6N��	�����$OS�1@�1@�(�1@�3;�N�3K�1@�	�'�	�1@�1@�1@�1@�l-1�9�
"&���9�9�9�"�9��.�)�9�
���9��
9��9�
�d�7�m�	�9�9�9�9�~$&�+/�-1� $�!%�$(�15�9�9�9��9��S�%�Z� �	9�
�-�(�9��>�*�
9���~�9����9��D�>�9��o�.�9�
�9�9�9�9�xRV�����#�u�*�%��3;�E�%��*�<M�3N��	�����H,0� $�!%�$(�I�I�I��#��I��I��	I��-�(�
I���~�I����I��D�>�I�
��	 �I�I�I�I�Z�� �#.�%�
������	�
�S�%�Z� ���
�
�����*N��N�D�N�N�N�N���-1�$(�

�
�
��
��
��	
�
��c�5�j�)�*�
��D�>�

�
�
�
�
�
�F��-1�+/�-1�"&� $�!%�$(�#� $��$(�$�!a2�a2�a2��a2��a2��	a2�
��c�5�j�)�*�a2��-�(�
a2��>�*�a2��$��a2���~�a2����a2��D�>�a2���}�a2���
�a2��a2��D�>�a2� �!a2�"
�#a2�a2�a2�a2�J#�;4��()���"�#��26��;4�;4�;4��s�m�;4��	;4�
�d�C��n�%�;4��
;4��;4��;4��;4��;4��(�C�5�#�:�.�/�;4��;4�
�;4�;4�;4�;4�B$(�,0� .� .� .�"� .��� �	 .�
�.�)� .�
�
 .� .� .� .�F@A����$�w�-�(��-0��9<��	
�����. #��#��!�57��!�!�!���}�!��	!�
��}�!��
!��!��5��j��1�2�!��!�
�!�!�!�!�F�;B�:N� U� U�� U��r�8�I�#6�6�7� U�
�s�C��c�3�h��'�	(� U� U� U��\� U�J��-1�+/� $�!%�$(� ��O$�O$�O$��O$��O$��	O$�
��c�5�j�)�*�O$��-�(�
O$���~�O$����O$��D�>�O$��O$��O$�
�O$�O$�O$�O$�bM(�M(�M(�M(�^�X�g�%6��3�����4� ����#'� � � �� ��	 �
� ��
 ��� � �

� � � � �D,0�����D����#�����@59��#�#�#�c�#�T�#�$�#�SW�#�#�#�#�"*.��%)�#�
I�I�I��
�&�I��	I�
�c�]�I��
I�

�I�I�I�I�^*.��.�#�#�#�#��#��
�&�	#�
�#��
#��#�
�#�#�#�#�D�)-��-�#'�#'�y�y�y��y��
�&�	y�
�y��
y�!�y��C�=�y�

�y�y�y�y�~�)-��-�#'�#'�$"�$"�$"��$"��	$"�
�
�&�$"��
$"��$"�!�$"��C�=�$"�
�$"�$"�$"�$"�$"�$"rfr��
svg_main_codec�h�ttj|�������S)z�Returns a unique hash for the given SVG main code.

    Args:
        svg_main_code (str): The content we're going to inject in the SVG envelope.

    Returns:
        str: a hash of the given content
    )r�r5r6r7)rVs rg�	_svg_hashrX
s(���t�|�M�0�0�2�2�3�3�4�4�4rf�__main__)rSzJSONRPC [i]request[/i]�g�������?Fz2.0�subtract�*�)�minuend�
subtrahendr")�jsonrpcr�params�idz
Hello, World!z{'a': 1}z&Which one is correct team name in NBA?)zNew York BullszLos Angeles KingszGolden State Warriors�
Huston Rocketrc)�questionr��answer)�answered�q1z	5 + 7 = ?)�
���
rjz
12 - 8 = ?)r'rhr"�rl)rfrg�q2)�sport�maths)r1�empty�quizr�)r�rP)�r�r&�platformr�rvr5�abcrr�dataclassesrrr�	functoolsrr	r�r
r�	itertoolsr�mathr
�timer�typesrrr�typingrrrrrrrrrrrrrrr �rich._null_filer!�version_infor$r%r&�typing_extensionsr�r(r)r*�_export_formatr+r,�_filenor-rxr.r/rHr0r1r�r2r3r�r4rTr5rYr6r7r�r9r'rr:r;r�r<r=�prettyr>r?�protocolr@rprA�scoperBr�rCrNrDr�rErF�styledrH�terminal_themerIrJrKr$rLrMr�rNrOrArPr�rQr�rSrirjr2rCr�r]r�r�rar��	__stdin__r��
_STDIN_FILENO�	Exception�
__stdout__�_STDOUT_FILENO�
__stderr__�_STDERR_FILENOr�r�r�r�r�rmrtr�r�rr�ryr�r�r�r�r�r�r�rr�rr*r�rur�r��localr5r:r=rrr@rEr�rXrbr�r�rrrerfrg�<module>r�s%�������	�	�	�	�����
�
�
�
���������#�#�#�#�#�#�#�#�(�(�(�(�(�(�(�(�������������������������������������������������6�6�6�6�6�6�6�6�6�6�����������������������������������$&�%�%�%�%�%���v���;�;�;�;�;�;�;�;�;�;�;�������������������*�*�*�*�*�*�C�C�C�C�C�C�C�C�������6�6�6�6�6�6�6�6�%�%�%�%�%�%�%�%�)�)�)�)�)�)�)�)�������������9�9�9�9�9�9�9�9�+�+�+�+�+�+�5�5�5�5�5�5�5�5�%�%�%�%�%�%�%�%�)�)�)�)�)�)�)�)�������������������������������#�#�#�#�#�#�#�#�������S�S�S�S�S�S�S�S�S�S� � � � � � � � �$�$�$�$�$�$�$�$���0�0�0�0�0�0�����������������
�(�/�
�
�y�
(���E�#�v�+�.�/��7�8���D�E�
��=�>��	�	�	�	�	�	�	�	�
�H�J�J�	���M�(�(�*�*�M�M�������M�M�M�������^�*�*�,�,�N�N�������N�N�N�������^�*�*�,�,�N�N�������N�N�N������~�~�>��%�~�6���
"��%��#����.�.�.�.�.�
�.�.�.��B�B�B�B�B�B�B���B�J������x�������������������(�(�C�7�8��:���n�g�5�6�7��#�O�%�%��3�3�3�3�3�9�3�3�3�	)�	)�	)�	)�	)�	)�	)�	)���������$��������B!�!�!�!�!�!�!�!�*$%�$%�$%�$%�$%�$%�$%�$%�N,/�,/�,/�,/�,/�,/�,/�,/�^$�$�$�$�$�$�$�$�B��t��x��X�c�5�j�-A�(A�B�����,�T�����*�$�� ��&��"�	��
�P�O��9L�9L�9N�9N�O�O�O��������)�/���������������&AE��8�$<�=�D�D�D�%�%�%�%�=�t�=�=�=�=�
s"�s"�s"�s"�s"�s"�s"�s"�l=	5�S�	5�S�	5�	5�	5�	5��z����g�T�"�"�"�G��K�K� �	���
��� �"$�B�7�7��		
�	
�
�
�
��K�K���T�T�'�]�]�;�;�;��M�M���!%�$L�$�$�$�#2�	�	���!&�$/�#3�#3�#3�"$���%1�#/�<�<�"#�������	
�	
�!�!�!�!�!�)�s6�>G�G"�!G"�&H�H
�	H
�H(�(H2�1H2