
    fXf6                        d dl mZmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
mZmZmZmZmZmZmZmZ ddlmZ ddlmZ dd	lmZmZmZmZ dd
lmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z%m&Z& ddl'm(Z( ddl)m*Z* e
rd dl+m,Z,  G d de          Z-ede#f         Z.ede-f         Z/ G d de0          Z1 G d de1          Z2 G d d          Z3 G d de          Z4 G d de4          Z5 G d d e4          Z6e& G d! d                      Z7e8d"k    rWd d#l9mZ  e            Z e7            Z:e:;                     e7d$d%&           e7dd'(           e7d)d*+                     e:d'         <                     e7d,-           e7d.d/0                     e:d.         <                     e7d1d/0           e7d2-                     e:d2         ;                     e7d3-           e7d4-           e7d5-                     e:d,         ;                     e7e:j=        d6-           e7d7-                     e:d1         >                    d8           e?                    e:           d9S d9S ):    )ABCabstractmethod)islice)
itemgetter)RLock)	TYPE_CHECKINGDictIterableList
NamedTupleOptionalSequenceTupleUnion   )ratio_resolve)Align)ConsoleConsoleOptionsRenderableTypeRenderResult)ReprHighlighter)Panel)Pretty)Region)Result	rich_repr)Segment)	StyleTypeTreec                   @    e Zd ZU dZeed<   eee                  ed<   dS )LayoutRenderzAn individual layout render.regionrenderN)__name__
__module____qualname____doc__r   __annotations__r   r        P/var/www/html/Qu*py/bism/lib/python3.11/site-packages/pip/_vendor/rich/layout.pyr#   r#       s6         &&NNNgr,   r#   Layoutc                       e Zd ZdZdS )LayoutErrorzLayout related error.Nr&   r'   r(   r)   r+   r,   r-   r0   r0   +   s        r,   r0   c                       e Zd ZdZdS )
NoSplitterz"Requested splitter does not exist.Nr1   r+   r,   r-   r3   r3   /   s        ,,,,r,   r3   c                   P    e Zd ZdZ e            ZddddeddfdZd	ed
e	de
fdZdS )_Placeholderz4An internal renderable used as a Layout placeholder. layoutr.   stylereturnNc                 "    || _         || _        d S N)r7   r8   )selfr7   r8   s      r-   __init__z_Placeholder.__init__8   s    


r,   consoleoptionsc              #   *  K   |j         }|j        p|j        j        }| j        }|j        r|j        d| d| dnd| d| d}t          t          j        t          |          d          | j	        | 
                    |          d|          V  d S )	Nz (z x )(middle)verticalblue)r8   titleborder_styleheight)	max_widthrH   sizer7   namer   r   centerr   r8   highlighter)r<   r>   r?   widthrH   r7   rF   s          r-   __rich_console__z_Placeholder.__rich_console__<   s       !67<#6 {)v{3333&3333(U((v((( 	
 L(;;;*""5))
 
 
 	
 	
 	
 	
 	
r,   )r6   )r&   r'   r(   r)   r   rM   r   r=   r   r   r   rO   r+   r,   r-   r5   r5   3   s        >>!/##K x 	 4    

)7
	
 
 
 
 
 
r,   r5   c            
           e Zd ZU dZdZeed<   edefd            Zede	d         de
deede
f                  fd	            Zd
S )SplitterzBase class for a splitter.r6   rK   r9   c                     dS )z(Get the icon (emoji) used in layout.treeNr+   r<   s    r-   get_tree_iconzSplitter.get_tree_iconU         r,   childrenr.   r$   c                     dS )zDivide a region amongst several child layouts.

        Args:
            children (Sequence(Layout)): A number of child layouts.
            region (Region): A rectangular region to divide.
        Nr+   )r<   rV   r$   s      r-   dividezSplitter.divideY   rU   r,   N)r&   r'   r(   r)   rK   strr*   r   rT   r   r   r
   r   rX   r+   r,   r-   rQ   rQ   P   s         $$D#NNN7s 7 7 7 ^7  *4:	%&()	*   ^  r,   rQ   c            	       ^    e Zd ZdZdZdefdZded         dede	e
def                  fdZd	S )
RowSplitterz!Split a layout region in to rows.rowr9   c                     dS )Nu   [layout.tree.row]⬌r+   rS   s    r-   rT   zRowSplitter.get_tree_iconj   s    %%r,   rV   r.   r$   c              #      K   |\  }}}}t          ||          }d}t          }	t          ||          D ]\  }
}|
 |	||z   |||          fV  ||z  } d S Nr   r   r   zip)r<   rV   r$   xyrN   rH   render_widthsoffset_Regionchildchild_widths               r-   rX   zRowSplitter.dividem   s       %1eV%eX66"%h">"> 	" 	"E;VQVDDDDDDk!FF	" 	"r,   Nr&   r'   r(   r)   rK   rY   rT   r   r   r
   r   rX   r+   r,   r-   r[   r[   e   sz        ++D&s & & & &	" *	"4:	"	%&()	*	" 	" 	" 	" 	" 	"r,   r[   c            	       ^    e Zd ZdZdZdefdZded         dede	e
def                  fdZd	S )
ColumnSplitterz$Split a layout region in to columns.columnr9   c                     dS )Nu   [layout.tree.column]⬍r+   rS   s    r-   rT   zColumnSplitter.get_tree_icon~   s    ((r,   rV   r.   r$   c              #      K   |\  }}}}t          ||          }d}t          }	t          ||          D ]\  }
}|
 |	|||z   ||          fV  ||z  } d S r_   r`   )r<   rV   r$   rb   rc   rN   rH   render_heightsre   rf   rg   child_heights               r-   rX   zColumnSplitter.divide   s       %1eV&vx88#&x#@#@ 	# 	#E<AJ|DDDDDDl"FF	# 	#r,   Nri   r+   r,   r-   rk   rk   y   sz        ..D)s ) ) ) )	# *	#4:	#	%&()	*	# 	# 	# 	# 	# 	#r,   rk   c                   (   e Zd ZdZeedZ	 d+dddddddee         dee	         d	ee
         d
e
de
deddfdZdefdZedefd            Zeded          fd            Zedefd            Zde	ded          fdZde	dd fdZed,d            Zddded ef         deee	f         ddfdZded ef         ddfdZded ef         ddfdZded ef         ddfdZd-dZdeddfd Zd!d"d#e	ddfd$Z d%e
d&e
de!fd'Z"d!e#d(e$defd)Z%d!e#d(e$de&fd*Z'dS ).r.   aB  A renderable to divide a fixed height in to rows or columns.

    Args:
        renderable (RenderableType, optional): Renderable content, or None for placeholder. Defaults to None.
        name (str, optional): Optional identifier for Layout. Defaults to None.
        size (int, optional): Optional fixed size of layout. Defaults to None.
        minimum_size (int, optional): Minimum size of layout. Defaults to 1.
        ratio (int, optional): Optional ratio for flexible layout. Defaults to 1.
        visible (bool, optional): Visibility of layout. Defaults to True.
    )r\   rl   Nr   T)rK   rJ   minimum_sizeratiovisible
renderablerK   rJ   rr   rs   rt   r9   c                    |pt          |           | _        || _        || _        || _        || _        || _         | j        d                     | _        g | _	        i | _
        t                      | _        d S )Nrl   )r5   _renderablerJ   rr   rs   rK   rt   	splitterssplitter	_children_render_mapr   _lock)r<   ru   rK   rJ   rr   rs   rt   s          r-   r=   zLayout.__init__   sq     &;d););	(
	":$.":"<"<')&(WW


r,   c              #   j   K   d| j         d fV  d| j        d fV  d| j        dfV  d| j        dfV  d S )NrK   rJ   rr   r   rs   )rK   rJ   rr   rs   rS   s    r-   __rich_repr__zLayout.__rich_repr__   sa      di%%%%di%%%%d/2222tz1$$$$$$r,   c                 "    | j         r| n| j        S )zLayout renderable.)rz   rw   rS   s    r-   ru   zLayout.renderable   s     ~;tt4+;;r,   c                 $    d | j         D             S )zGets (visible) layout children.c                      g | ]}|j         	|S r+   )rt   ).0rg   s     r-   
<listcomp>z#Layout.children.<locals>.<listcomp>   s    CCC%U]CCCCr,   rz   rS   s    r-   rV   zLayout.children   s     DC4>CCCCr,   c                     | j         S )zGet a map of the last render.)r{   rS   s    r-   mapz
Layout.map   s     r,   c                 j    | j         |k    r| S | j        D ]}|                    |          }||c S dS )zGet a named layout, or None if it doesn't exist.

        Args:
            name (str): Name of layout.

        Returns:
            Optional[Layout]: Layout instance or None if no layout was found.
        N)rK   rz   get)r<   rK   rg   named_layouts       r-   r   z
Layout.get   sR     9K ( ($yy+'''' ,tr,   c                 X    |                      |          }|t          d|          |S )NzNo layout with name )r   KeyError)r<   rK   r7   s      r-   __getitem__zLayout.__getitem__   s2    $>:$::;;;r,   r!   c                     ddl m ddlm ddlm} dddffd| } | |          d	|j        j         d
          }dfd ||            |S )z/Get a tree renderable to show layout structure.r   )Styled)Tabler    r7   r.   r9   c                     | j                                         }                    d          }| j        rt	          |           n t	          |           d          }|                    ||           |}|S )N)r   r   r   r   )paddingdim)ry   rT   gridrt   r   add_row)r7   icontabletext_summaryr   r   s        r-   summaryzLayout.tree.<locals>.summary   sv    ?0022DJJ|J44E #).SvffVF^^U6S6S  MM$%%%HOr,   layout.tree.T)guide_style	highlighttreer!   Nc                     |j         D ]9} |                      |          d|j        j                   |           :d S )Nr   )r   )rz   addry   rK   )r   r7   rg   recurser   s      r-   r   zLayout.tree.<locals>.recurse   sn    )  HH$H5>3F$H$H        r,   )r   r!   r7   r.   r9   N)pip._vendor.rich.styledr   pip._vendor.rich.tabler   pip._vendor.rich.treer!   ry   rK   )r<   r!   r7   r   r   r   r   r   s       @@@@r-   r   zLayout.tree   s     	322222000000......	H 	 	 	 	 	 	 	 	 tGFOO=v';==
 
 
	 	 	 	 	 	 	 	dr,   rl   )ry   layoutsry   c                    d |D             }	 t          |t                    r|n | j        |                     | _        n # t          $ r t          d|          w xY w|| j        dd<   dS )zSplit the layout in to multiple sub-layouts.

        Args:
            *layouts (Layout): Positional arguments should be (sub) Layout instances.
            splitter (Union[Splitter, str]): Splitter instance or name of splitter.
        c                 Z    g | ](}t          |t                    r|nt          |          )S r+   
isinstancer.   r   r7   s     r-   r   z Layout.split.<locals>.<listcomp>  sA     
 
 
 !00DFFfVnn
 
 
r,   zNo splitter called N)r   rQ   rx   ry   r   r3   rz   )r<   ry   r   _layoutss       r-   splitzLayout.split  s    
 
!
 
 
	A h110-T^H-// MM
  	A 	A 	A?8??@@@	A$qqqs   1A   Ac                 R    d |D             }| j                             |           dS )zAdd a new layout(s) to existing split.

        Args:
            *layouts (Union[Layout, RenderableType]): Positional arguments should be renderables or (sub) Layout instances.

        c              3   b   K   | ]*}t          |t                    r|nt          |          V  +d S r;   r   r   s     r-   	<genexpr>z#Layout.add_split.<locals>.<genexpr>&  sO       
 
 !00DFFfVnn
 
 
 
 
 
r,   N)rz   extend)r<   r   r   s      r-   	add_splitzLayout.add_split  s>    
 
!
 
 
 	h'''''r,   c                       | j         |ddi dS )zSplit the layout in to a row (layouts side by side).

        Args:
            *layouts (Layout): Positional arguments should be (sub) Layout instances.
        ry   r\   Nr   r<   r   s     r-   	split_rowzLayout.split_row,  s!     	
G,e,,,,,r,   c                       | j         |ddi dS )zSplit the layout in to a column (layouts stacked on top of each other).

        Args:
            *layouts (Layout): Positional arguments should be (sub) Layout instances.
        ry   rl   Nr   r   s     r-   split_columnzLayout.split_column4  s!     	
G/h/////r,   c                     | j         dd= dS )zReset splits to initial state.Nr   rS   s    r-   unsplitzLayout.unsplit<  s    N111r,   c                 T    | j         5  || _        ddd           dS # 1 swxY w Y   dS )zjUpdate renderable.

        Args:
            renderable (RenderableType): New renderable object.
        N)r|   rw   )r<   ru   s     r-   updatezLayout.update@  sx     Z 	* 	*)D	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   !!r>   r   layout_namec                 @   | j         5  | |         }| j        |         \  }}|\  }}}}	|                    ||j                            ||	                    }
t          ||
          | j        |<   |                    |
||           ddd           dS # 1 swxY w Y   dS )zRefresh a sub-layout.

        Args:
            console (Console): Console instance where Layout is to be rendered.
            layout_name (str): Name of layout.
        N)r|   r{   render_linesr?   update_dimensionsr#   update_screen_lines)r<   r>   r   r7   r$   _linesrb   rc   rN   rH   liness              r-   refresh_screenzLayout.refresh_screenI  s     Z 	5 	5+&F!-f5NFF$*!Q5&((99%HH E (4FE'B'BDV$''q!444	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5s   A>BBBrN   rH   c                 V   | t          dd||          fg}|j        }|j        }g }|j        }|rR | |                       |d         \  }}	|j        }
|
r)|j                            |
|	          D ]} ||           |Rd t          |t          d                    D             }|S )z,Create a dict that maps layout on to Region.r   c                     i | ]\  }}||	S r+   r+   r   r7   r$   s      r-   
<dictcomp>z+Layout._make_region_map.<locals>.<dictcomp>i  s.     
 
 
 F
 
 
r,   r   )key)r   appendpoprV   ry   rX   sortedr   )r<   rN   rH   stackpushr   layout_regionsappend_layout_regionr7   r$   rV   child_and_region
region_maps                r-   _make_region_mapzLayout._make_region_mapZ  s    /3VAq%5P5P.Q-R|i68-4 	+  '''+B/NFFH +(.(>(>x(P(P + +$D)****  	+
 
"(Z]]"K"K"K
 
 

 r,   r?   c                 8   |j         }|j        p|j        }|                     ||          }d |                                D             }i }|j        }|j        }	|D ]=\  }
} ||
j         |	|j        |j                            }t          ||          ||
<   >|S )zRender the sub_layouts.

        Args:
            console (Console): Console instance.
            options (ConsoleOptions): Console options.

        Returns:
            RenderMap: A dict that maps Layout on to a tuple of Region, lines
        c                 *    g | ]\  }}|j         ||fS r+   )rV   r   s      r-   r   z!Layout.render.<locals>.<listcomp>|  s9     
 
 
?
V
 
 
r,   )	rI   rH   r   itemsr   r   ru   rN   r#   )r<   r>   r?   render_widthrender_heightr   r   
render_mapr   r   r7   r$   r   s                r-   r%   zLayout.rendero  s     (8'.**<GG

 
","2"2"4"4
 
 

 68
+#5, 	= 	=NFF L!#4#4V\6=#Q#Q E ".fe!<!<Jvr,   c           
   #   "  K   | j         5  |j        p|j        }|j        p|j        }|                     ||                    ||                    }|| _        d t          |          D             }t          }|	                                D ]E\  }}	|\  }
}}}t           |||||z             |	          D ]\  }}|                    |           Ft          j                    }|D ]}|E d {V  |V  	 d d d            d S # 1 swxY w Y   d S )Nc                     g | ]}g S r+   r+   )r   _s     r-   r   z+Layout.__rich_console__.<locals>.<listcomp>  s    0K0K0K0K0K0Kr,   )r|   rI   rN   rH   r%   r   r{   ranger   valuesra   r   r   line)r<   r>   r?   rN   rH   r   layout_lines_islicer$   r   _xrc   _layout_widthlayout_heightr\   r   new_line
layout_rows                     r-   rO   zLayout.__rich_console__  s      Z 	 	%6E^5w~FWg.G.Gv.V.VWWJ)D0K0KU6]]0K0K0KLG#-#4#4#6#6 % %6<3A}m!$GL!Q->??" " % %IC JJt$$$$%
 |~~H*  
%%%%%%%%	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   C,DDDr;   )r9   r!   )r9   N)(r&   r'   r(   r)   r[   rk   rx   r   r   rY   intboolr=   r   r~   propertyru   r   rV   	RenderMapr   r   r   r   r   rQ   r   r   r   r   r   r   r   	RegionMapr   r   r   r%   r   rO   r+   r,   r-   r.   r.      sm       	 	 $~>>I 04 #"  ^, sm	
 sm    
   *%v % % % % <N < < < X< D$x. D D D XD  Y       X   2    $      % % % X%T *2% % %.01% #&% 
	% % % %2(%.(@"A (d ( ( ( (-%.(@"A -d - - - -0U8^+C%D 0 0 0 0 0   * *D * * * *5i 5c 5d 5 5 5 5"c 3 9    *g  9    :)7	     r,   __main__)r   header   )rK   rJ   main)rs   rK   
   footer)rJ   rK   side)rK   body   )rK   rs   contents2toprC   bottomleft1left2fooN)@abcr   r   	itertoolsr   operatorr   	threadingr   typingr   r	   r
   r   r   r   r   r   r   _ratior   alignr   r>   r   r   r   r   rM   r   panelr   prettyr   r$   r   reprr   r   segmentr   r8   r   r   r!   r#   r   r   	Exceptionr0   r3   r5   rQ   r[   rk   r.   r&   pip._vendor.rich.consoler7   r   r   r   r   printr+   r,   r-   <module>r	     s   # # # # # # # #                  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 " ! ! ! ! !       J J J J J J J J J J J J ( ( ( ( ( (                   # # # # # # # #             +******         :       6!"	<'(	         )      - - - - - - - -
 
 
 
 
 
 
 
:    s   *" " " " "( " " "(# # # # #X # # #( R R R R R R R Rj z000000giiGVXXF
H1%%%QV$$$BX&&&   6NVV000&&fA2N2N2NOOO
6NVV!<<<ff$>O>O>OPPP
4LEFF11166x3H3H3H   6Nv{ A A A66wCWCWCWXXX
9U###MM&1 r,   