+
     h7  c                   s  a  R< tR0 t ^ RIt^ RIHtHtHt ^ RIHt ^ RIH	t	H
t
HtHtHtHtHtHt ^RIHt ^RIHtHtHtHt ^RIHt ^RIHt ^R	IHt ^R
IHtH t  ^RI!H"t" ^RI#H$t$  ! R R]4      t% ! R R]]4      t&]'R8X  EdH   ^ RI(t(^ RI)t)^ RI*H+t+ ^ RIH,t,HtH-t- ^RI.H/t/ ^RIHt ^RI0H&t& ^RI1H2t2 ^RI3H4t4 ^RI5H6t6 ^RI7H8t8 ]! 4       t]6! RRRR7      t5]8! RR R!4      t7]7Ps                  R"R#R$4       R%]2! R&4      R']7R(R)R*R+R,/R-]5]4! R.4      .	t:]+! ]:4      t;. R=Ot<]&! ]R/7      ;_uu_ 4       t=/ t>] ^ k ]?! ^d4       EF  t@]<]@]A! ]<4      ,          ,          tB]< EF_  tC]C]B8X  d   K  ])P                  ! R04       ](P                  ! ^ ^
4      ^8  d   ]P                  ]G! ];4      4       ^](PP                  ! 4       R1,          ^,           ,          ]>]B]C3&   ]A! ]>4      ]A! ]<4      ^,
          8  d-   ]>P                  ]I! ]>P                  4       4      ^ ,          4       ]8! R2R37      t7]7P                  R44       ]7P                  R54       ]7P                  R64       ]>P                  4        F/  w  w  tMtNtO]7Ps                  ]M]N]$! ]OR7 ]OR88  d   R9MR:R;7      4       K1  	  ]=P                  ]/P                  ! ]74      4       EKb  	  EK  	  RRR4       R# R#   + '       g   i     R# ; i)>i    N)EventRLockThread)TracebackType)IOAnyCallableListOptionalTextIOTypecast)get_console)ConsoleConsoleRenderableRenderableType
RenderHook)Control)	FileProxy)JupyterMixin)
LiveRenderVerticalOverflowMethod)Screen)Textc                   sf   a a ] tR t^t oRtV3R lV 3R lltV3R lR ltV3R lR ltRtVt	V ;t
# )	_RefreshThreadz3A thread that calls refresh() at regular intervals.c                s(   < V ^8  d   QhRRRS[ RR/# )   liveLiverefresh_per_secondreturnN)floatformat__classdict__   ":/usr/lib/python3.14/site-packages/pip/_vendor/rich/live.py__annotate___RefreshThread.__annotate__   s"     & &V & &4 &    c                s^   < Wn         W n        \        4       V n        \        SV `  R R7       R# )T)ZdaemonN)r   r   r    doneZsuper__init__)selfr   r   	__class__s   &&&r#   r(   Z_RefreshThread.__init__   s'    	"4G	%r&   c                   < V ^8  d   QhRR/# r   r   N r   r"   r#   r$   r%      s      d r&   c                s:    V P                   P                  4        R # N)r'   Zsetr)      &r#   stopZ_RefreshThread.stop   s    		r&   c                r+   r,   r-   r   r"   r#   r$   r%      s     ( (T (r&   c                sX   V P                   P                  ^V P                  ,          4      '       gd   V P                  P                  ;_uu_ 4        V P                   P                  4       '       g   V P                  P                  4        RRR4       K  R#   + '       g   i     K  ; i)i   N)r'   waitr   r   _lockZis_setrefreshr/   r0   r#   runZ_RefreshThread.run   sd    ))..T%<%<!<==yy''))II%%' ! > s   ;BB)	)r'   r   r   )__name__
__module____qualname____firstlineno____doc__r(   r1   r5   __static_attributes____classdictcell__Z__classcell__)r*   r!   s   @@r#   r   r      s+     =& & ( ( (r&   r   c                   sZ  a  ] tR t^#t o RtR+RRRRRRR^R	RR
RRRRRRR/	V 3R lR lllt]V 3R lR l4       tV 3R lR ltR,V 3R lR llt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR  lt]V 3R! lR" l4       tR#R/V 3R$ lR% lltV 3R& lR' ltV 3R( lR) ltR*tV tR# )-r   a  Renders an auto-updating live display of any given renderable.

Args:
    renderable (RenderableType, optional): The renderable to live display. Defaults to displaying nothing.
    console (Console, optional): Optional Console instance. Defaults to an internal Console instance writing to stdout.
    screen (bool, optional): Enable alternate screen mode. Defaults to False.
    auto_refresh (bool, optional): Enable auto refresh. If disabled, you will need to call `refresh()` or `update()` with refresh flag. Defaults to True
    refresh_per_second (float, optional): Number of times per second to refresh the live display. Defaults to 4.
    transient (bool, optional): Clear the renderable on exit (has no effect when screen=True). Defaults to False.
    redirect_stdout (bool, optional): Enable redirection of stdout, so ``print`` may be used. Defaults to True.
    redirect_stderr (bool, optional): Enable redirection of stderr. Defaults to True.
    vertical_overflow (VerticalOverflowMethod, optional): How to handle renderable when it is too tall for the console. Defaults to "ellipsis".
    get_renderable (Callable[[], RenderableType], optional): Optional callable to get renderable. Defaults to None.
NconsolescreenFauto_refreshTr   	transientredirect_stdoutredirect_stderrvertical_overflowZellipsisget_renderablec                s   < V ^8  d   QhRS[ S[,          RS[ S[,          RS[RS[RS[RS[RS[RS[R	S[R
S[ S[. S[3,          ,          RR/# )r   
renderabler=   r>   r?   r   r@   rA   rB   rC   rD   r   N)r   r   r   boolr   r   r   r   r"   r#   r$   Live.__annotate__3   s     &
 &
^,&
 '"	&

 &
 &
 "&
 &
 &
 &
 2&
 !"n*<!=>&
 
&
r&   c       	        sd   Wn         Ve   TM	\        4       V n        W0n        RV n        Wpn        Wn        R V n        R V n        \        4       V n
        R V n        W@n        RV n        V'       d   RMTV n        R V n        WPn        Wn        Wn        \'        V P)                  4       V	R7      V n        R # )NFT)rC   )_renderabler   r=   _screen_alt_screen_redirect_stdout_redirect_stderr_restore_stdout_restore_stderrr   r3   
ipy_widgetr?   _startedr@   _refresh_threadr   rC   _get_renderabler   rD   _live_render)r)   rE   r=   r>   r?   r   r@   rA   rB   rC   rD   s   &&$$$$$$$$$r#   r(   ZLive.__init__3   s     &")"5w;=  / /2626W
)-(#!'Y9="4!2-&!5F
r&   c                    < V ^8  d   QhRS[ /# r   r   rF   r   r"   r#   r$   rG   \   s      D r&   c                s    V P                   # )z'Check if live display has been started.)rP   r/   r0   r#   
is_startedZLive.is_started[   s     }}r&   c                rT   rU   r   r   r"   r#   r$   rG   `   s          r&   c                sn    V P                   e   V P                  4       MV P                  pT;'       g    R# )N )rR   rH   r)   rE      & r#   rD   ZLive.get_renderable`   s<     ##/   "!! 	
 Rr&   c                s$   < V ^8  d   QhRS[ RR/# )r   r4   r   NrV   r   r"   r#   r$   rG   h   s     - -T -d -r&   c                s   V P                   ;_uu_ 4        V P                  '       d    RRR4       R# V P                  P                  V 4       RV n        V P                  '       d!   V P                  P                  R4      V n        V P                  P                  R4       V P                  4        V P                  P                  V 4       V'       d    V P                  4        V P                  '       d5   \        W P                  4      V n        V P                   P#                  4        RRR4       R#   \         d    T P                  4        h i ; i  + '       g   i     R# ; i)zdStart live rendering display.

Args:
    refresh (bool, optional): Also refresh. Defaults to False.
NTF)r3   rP   r=   Zset_liverI   set_alt_screenrJ   show_cursor_enable_redirect_ioZpush_render_hookr4   Z	Exceptionr1   r?   r   r   rQ   start)r)   r4   s   &&r#   r_   Z
Live.starth   s     ZZZ}}} Z LL!!$' DM|||#'<<#>#>t#D LL$$U+$$&LL))$/LLN    '5d<S<S'T$$$**,- Z ! 
 IIK ZZs5   E3E'A-ED6&E84E6EEE'	c                r+   r,   r-   r   r"   r#   r$   rG      s     0 0d 0r&   c           
     s   V P                   ;_uu_ 4        V P                  '       g    RRR4       R# V P                  P                  4        RV n        V P                  '       d0   V P
                  e"   V P
                  P                  4        RV n        RV n        V P                  ;_uu_ 4         V P                  '       g-   V P                  P                  '       g   V P                  4        V P                  4        V P                  P                  4        V P                  '       g7   V P                  P                  '       d   V P                  P                  4        V P                  P                  R4       V P                  '       d   V P                  P!                  R4       V P"                  '       dF   V P                  '       g4   V P                  P%                  V P&                  P)                  4       4       V P*                  e-   V P"                  '       d   V P*                  P-                  4        RRR4       RRR4       R#   T P                  4        T P                  P                  4        T P                  '       g7   T P                  P                  '       d   T P                  P                  4        T P                  P                  R4       T P                  '       d   T P                  P!                  R4       T P"                  '       dF   T P                  '       g4   T P                  P%                  T P&                  P)                  4       4       T P*                  e/   T P"                  '       d   T P*                  P-                  4        i i i ; i  + '       g   i     ELm; i  + '       g   i     R# ; i)zStop live rendering display.NFZvisibleT)r3   rP   r=   Z
clear_liver?   rQ   r1   rC   rJ   
is_jupyterr4   _disable_redirect_ioZpop_render_hookis_terminalZliner]   r\   r@   controlrS   Zrestore_cursorrO   Zcloser/   r0   r#   r1   Z	Live.stop   sk   ZZZ=== Z LL##%!DM   T%9%9%E$$))+'+$%.D"0+++DLL4K4K4K--/LL002+++0H0H0H))+LL,,T2'''33E:~~~d.>.>.>,,T->->-M-M-OP2t~~~--/!  Z  --/LL002+++0H0H0H))+LL,,T2'''33E:~~~d.>.>.>,,T->->-M-M-OP2t~~~--/ 8F2  ZZs   N32N3&A
N30N	2-I I0AN	AN	,N	<N	AN	!N	;N3AN&AN-,NN,AN?NN	N0*	N33O	c                r+   )r   r   r   r-   r   r"   r#   r$   rG      s      6 r&   c                sB    V P                  V P                  R JR7       V # )N)r4   )r_   rH   r/   r0   r#   	__enter__ZLive.__enter__   s     

4++47
8r&   c                sp   < V ^8  d   QhRS[ S[S[,          ,          RS[ S[,          RS[ S[,          RR/# )r   exc_typeexc_valexc_tbr   N)r   r
   ZBaseExceptionr   r   r"   r#   r$   rG      sG      4./ -( '	
 
r&   c                s&    V P                  4        R # r.   )r1   )r)   re   rf   rg   s   &&&&r#   __exit__ZLive.__exit__   s     			r&   c                r+   r,   r-   r   r"   r#   r$   rG      s     Q QT Qr&   c                s   V P                   P                  '       g   V P                   P                  '       Ed   V P                  '       dq   \	        \
        P                  \        4      '       gM   \
        P                  V n        \        R\        V P                   \
        P                  4      4      \
        n        V P                  '       du   \	        \
        P                  \        4      '       gO   \
        P                  V n        \        R\        V P                   \
        P                  4      4      \
        n        R# R# R# R# )z&Enable redirecting of stdout / stderr.r	   N)r=   rb   r`   rK   
isinstancesysstdoutr   rM   r   rL   stderrrN   r/   r0   r#   r^   ZLive._enable_redirect_io   s    <<###t||'>'>'>$$$Z

I-N-N'*zz$!(IdllCJJ,OP
$$$Z

I-N-N'*zz$!(IdllCJJ,OP
 .O$	 (?r&   c                r+   r,   r-   r   r"   r#   r$   rG      s     ( (d (r&   c                s    V P                   '       d'   \        RV P                   4      \        n        RV n         V P                  '       d)   \        RV P                  4      \        n        RV n        R# R# )z'Disable redirecting of stdout / stderr.r	   N)rM   r   rj   rk   rN   rl   r/   r0   r#   ra   ZLive._disable_redirect_io   sW    h(<(<=CJ#'D h(<(<=CJ#'D   r&   c                rT   rU   rX   r   r"   r#   r$   rG      s     F FN Fr&   c                s`    V P                  4       pV P                  '       d   \        V4      # T# )z_Get the renderable that is being displayed

Returns:
    RenderableType: Displayed renderable.
)rD   rJ   r   rZ   r[   r#   rE   ZLive.renderable   s-     ((*
%)%5%5%5vj!E:Er&   r4   c                s*   < V ^8  d   QhRS[ RS[RR/# )r   rE   r4   r   N)r   rF   r   r"   r#   r$   rG      s"       T d r&   c               s   \        V\        4      '       d   V P                  P                  V4      pV P                  ;_uu_ 4        Wn        V'       d   V P                  4        RRR4       R#   + '       g   i     R# ; i)zUpdate the renderable that is being displayed

Args:
    renderable (RenderableType): New renderable to use.
    refresh (bool, optional): Refresh the display. Defaults to False.
N)ri   strr=   Z
render_strr3   rH   r4   )r)   rE   r4   s   &&$r#   updateZLive.update   sL     j#&&00<JZZZ) ZZZs   A//B 	c                r+   r,   r-   r   r"   r#   r$   rG      s     2 2 2r&   c           	     s   V P                   ;_uu_ 4        V P                  P                  V P                  4       V P                  P
                  '       d    ^ RIHp ^ RIH	p V P                  f   V! 4       V n
        V! V P                  4       V P                  ;_uu_ 4        V P                  P                  RR7       V P                  P                  V P                  P                  4       RRR4       MV P                  P                   '       d^   V P                  P"                  '       gB   V P                  ;_uu_ 4        V P                  P                  \%        4       4       RRR4       MdV P&                  '       gS   V P(                  '       gA   V P                  ;_uu_ 4        V P                  P                  \%        4       4       RRR4       RRR4       R#   + '       g   i     L; i  \         d    ^ RIpTP                  R4        L?i ; i  + '       g   i     LS; i  + '       g   i     Lf; i  + '       g   i     R# ; i)z&Update the display of the Live Render.)display)OutputNT)r2   z(install "ipywidgets" for Jupyter support)r3   rS   Zset_renderablerE   r=   r`   ZIPython.displayro   Z
ipywidgetsrp   rO   Zclear_outputZprintZImportErrorwarningsZwarnrb   Zis_dumb_terminalr   rP   r@   )r)   ro   rp   rq   s   &   r#   r4   ZLive.refresh   sh   ZZZ,,T__=||&&&I71 .*0(044$4?**4+<+<+G+GH ) )))$,,2O2O2O\\\LL&&wy1 "\ MMM$...\\\LL&&wy1 "1 Z ) # N#MM"LMN "\
 "\1 ZZs   AH?G3$A H?$AG 	0$H?H?1H?$H	)H?H?H?*$H,	H? G0+H?3 HH?HH?H)$H?,H<7H??I	c                sF   < V ^8  d   QhRS[ S[,          RS[ S[,          /# )r   renderablesr   )r   r   r   r"   r#   r$   rG      s)       12		 r&   c                s   V P                   V P                  n         V P                  P                  '       dr   V P                  ;_uu_ 4        V P
                  '       d   \        P                  ! 4       MV P                  P                  4       pV.VOV P                  NpRRR4       V# V P                  '       g#   V P                  '       g   . VOV P                  NpV#   + '       g   i     T# ; i)z;Process renderables to restore cursor and display progress.N)rC   rS   r=   Zis_interactiver3   rJ   r   ZhomeZposition_cursorrP   r@   )r)   rr   Zresets   && r#   process_renderablesZLive.process_renderables   s     /3.D.D+<<&&& ''' LLN**::< 
  %F{FD4E4EF  	 dnnn;K;):):;K  s   ACC0	)rJ   rR   rS   r3   rL   rK   rQ   rH   rN   rM   rI   rP   r?   r=   rO   r   r@   rC   r.   )F)r6   r7   r8   r9   r:   r(   ZpropertyrW   rD   r_   r1   rd   rh   r^   ra   rE   rn   r4   rs   r;   r<   )r!      @r#   r   r   #   s    &
 &*	&

 &
 "&
 %&&
  &
 !%&
 !%&
 5?&
 BF&
 &
P     - -<0 0>  Q Q( ( F FE  2 2: r&   r   Z__main__)cycle)Dictr   Tuple)Align)r   )r   )Panel)Rule)Syntax)Tablea~  def loop_last(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
    """Iterate and generate a tuple with a flag for last value."""
    iter_values = iter(values)
    try:
        previous_value = next(iter_values)
    except StopIteration:
        return
    for value in iter_values:
        yield False, previous_value
        previous_value = value
    yield True, previous_valueZpythonT)Zline_numbersZfooZbarZbazZ1Z2Z3zYou can make the terminal shorter and taller to see the live table hideText may be printed while the progress bars are rendering.z(In fact, [i]any[/i] renderable will workzSuch as [magenta]tables[/]...zPretty printed structures...ZtypeZexampletextzPretty printedz	Syntax...zGive it a try!)r=   g?i@  zExchange Rates)ZtitlezSource CurrencyzDestination CurrencyzExchange Ratez.4fg      ?ZredZgreen)Zstylec                s    V ^8  d   Qh/ ^ \         9   d,   \        \        \        \        3,          \        3,          ;R&   # )r   exchange_rate_dict)__conditional_annotations__rv   rw   rm   r   )r    s   "r#   r$   r$      s,    

l
 	>=DsCx%!78=m
 r&   )ZSGDZMYRZEURZUSDZAUDZJPYZCNHZHKDZCADZINRZDKKZGBPZRUBZNZDZMXNZIDRZTWDZTHBZVND)Sr   rj   Z	threadingr    r   r   Ztypesr   Ztypingr   r   r   r   r   r	   r
   r   rY   r   r=   r   r   r   r   rc   r   Z
file_proxyr   Zjupyterr   Zlive_renderr   r   r>   r   r}   r   r   r   r6   ZrandomZtimeZ	itertoolsru   rv   rw   Zalignrx   r   Zpanelry   Zrulerz   Zsyntaxr{   Ztabler|   Zadd_rowZprogress_renderablesZexamplesZ	exchangesZ
live_tabler~   ZrangeZindexZlenZselect_exchangeZexchangeZsleepZrandintZlogZnextZpopZlistZkeysZ
add_columnZitemsZsourceZdestZexchange_ratern   Zcenterr$   )r   rt   r#   <module>r      s   

 * *  H H H  K K  ! ! ;  (V (&i< iX z(( "iG
	" 	F  %&E	MM#sC 	E89'&	F$45 )*HI* 
g		*;==3ZE'I(>?O%.

3>>!R(1,KKX/BE]]_s*a/C"OX#>? )*S^a-??&**40B0G0G0I+J1+MN$45  !23  !78  15G5M5M5O1NVTMMM,S1+83+>%G 6P !!%,,u"567 &   
	O N 
		s   /FKK 	