
    AHji                    V   d dl mZ d dlmZ d dlmZ d dl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mZ d dlmZmZmZ 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$ 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.  G d de,      Z/ G d de.      Z0 G d de,d      Z1y)    )annotations)	dataclass)ClassVarN)Style)Text)events)ComposeResultRenderResult)AwaitComplete)BindingBindingType)	Container
HorizontalVertical)ContentContentText)	NoMatches)Mount)Offset)Message)reactive)Bar)
VisualType)Widget)Staticc                      e Zd ZU dZdZdhZ	  ed      Z	  ed      Z	  ed      Z	de
d<   	  G d d	e      Zedd
       ZddZddZy)	Underlinez$The animated underline beneath tabs.z
    Underline {
        width: 1fr;
        height: 1;
        & > .underline--bar {
            color: $block-cursor-background;
            background: $foreground 10%;
        }
        &:ansi {
            text-style: dim;
        }
    }
    underline--barr   Tzreactive[bool]show_highlightc                  2     e Zd ZU dZded<   	 d fdZ xZS )Underline.Clickedz+Inform ancestors the underline was clicked.r   offsetc                0    || _         t        | 	          y N)r"   super__init__)selfr"   	__class__s     M/root/tools/cai/cai_env/lib/python3.12/site-packages/textual/widgets/_tabs.pyr&   zUnderline.Clicked.__init__@   s     DKG    )r"   r   returnNone)__name__
__module____qualname____doc____annotations__r&   __classcell__r(   s   @r)   Clickedr!   :   s    9I	 	r*   r4   c                N    | j                   r| j                  | j                  fS dS )z$Highlighted range for underline bar.)r   r   )r   highlight_starthighlight_endr'   s    r)   _highlight_rangezUnderline._highlight_rangeD   s2    
 "" !!4#5#56	
 	
r*   c                    | j                  d      }t        | j                  t        j                  |j
                        t        j                  |j                              S )zRender the bar.r   )highlight_rangehighlight_stylebackground_style)get_component_rich_styler   r9   r   
from_colorcolorbgcolor)r'   	bar_styles     r)   renderzUnderline.renderM   sO    112BC	 11!,,Y__="--i.?.?@
 	
r*   c                x    |j                          | j                  | j                  |j                               y)z:Catch clicks, so that the underline can activate the tabs.N)stoppost_messager4   screen_offsetr'   events     r)   	_on_clickzUnderline._on_clickV   s(    

$,,u':':;<r*   N)r+   ztuple[int, int])r+   r
   )rI   zevents.Click)r-   r.   r/   r0   DEFAULT_CSSCOMPONENT_CLASSESr   r6   r7   r   r1   r   r4   propertyr9   rC   rJ    r*   r)   r   r      sq    .K ** qkO"QKM-%-d^NN3A'  
 

=r*   r   c                  "    e Zd ZdZdZe G d de             Z G d de      Z G d de      Z	 G d	 d
e      Z
 G d de      Zdddd	 	 	 	 	 	 	 	 	 d fdZedd       Zej                  dd       Zdd fdZedd       Zd ZddZ xZS )Tabz5A Widget to manage a single tab within a Tabs widget.a  
    Tab {
        width: auto;
        height: 1;
        padding: 0 1;
        text-align: center;
        color: $foreground 50%;

        &:hover {
            color: $foreground;
        }
        &:disabled {
            color: $foreground 25%;
        }

        &.-active {
            color: $foreground;
        }
        &.-hidden {
            display: none;
        }
    }
    c                  0    e Zd ZU dZded<   	 edd       Zy)Tab.TabMessagezpTab-related messages.

        These are mostly intended for internal use when interacting with `Tabs`.
        rP   tabc                    | j                   S )zThe tab that is the object of this message.

            This is an alias for the attribute `tab` and is used by the
            [`on`][textual.on] decorator.
            )rS   r8   s    r)   controlzTab.TabMessage.control   s     88Or*   N)r+   rP   )r-   r.   r/   r0   r1   rM   rU   rN   r*   r)   
TabMessagerR   w   s#    	
 9		 
	r*   rV   c                      e Zd ZdZy)Tab.ClickedzA tab was clicked.Nr-   r.   r/   r0   rN   r*   r)   r4   rX           r*   r4   c                      e Zd ZdZy)Tab.DisabledzA tab was disabled.NrY   rN   r*   r)   Disabledr\      s    !r*   r]   c                      e Zd ZdZy)Tab.EnabledzA tab was enabled.NrY   rN   r*   r)   Enabledr_      rZ   r*   r`   c                      e Zd ZdZy)Tab.RelabelledzA tab was relabelled.NrY   rN   r*   r)   
Relabelledrb      s    #r*   rc   NFidclassesdisabledc               b    t         |   |||       |  t        j                  |      | _        y)zInitialise a Tab.

        Args:
            label: The label to use in the tab.
            id: Optional ID for the widget.
            classes: Space separated list of class names.
            disabled: Whether the tab is disabled or not.
        rd   N)r%   r&   r   	from_textlabel)r'   rj   re   rf   rg   r(   s        r)   r&   zTab.__init__   s.      	B(C&&u-
r*   c                    | j                   S )zThe label for the tab.)_labelr8   s    r)   rj   z	Tab.label   s     {{r*   c                n    t        j                  |      | _        | j                  | j                         y r$   )r   ri   rl   update)r'   rj   s     r)   rj   z	Tab.label   s$    ''.DKK r*   c                b    | j                  | j                  |              t        |   |      S r$   )rF   rc   r%   rn   )r'   contentr(   s     r)   rn   z
Tab.update   s)    $//$/0w~g&&r*   c                .    | j                   j                  S )zUndecorated text of the label.)rj   plainr8   s    r)   
label_textzTab.label_text   s     zzr*   c                D    | j                  | j                  |              y)z,Inform the message that the tab was clicked.N)rF   r4   r8   s    r)   rJ   zTab._on_click   s    $,,t,-r*   c                t    | j                  |r| j                  |              y| j                  |              y)z9Notify the parent `Tabs` that a tab was enabled/disabled.N)rF   r]   r`   )r'   rg   s     r)   _watch_disabledzTab._watch_disabled   s)    $---Rt||D?QRr*   )
rj   r   re   
str | Nonerf   rw   rg   boolr+   r,   )r+   r   )rj   r   r+   r,   ) )rp   r   r+   r,   )r+   str)rg   rx   r+   r,   )r-   r.   r/   r0   rK   r   r   rV   r4   r]   r`   rc   r&   rM   rj   setterrn   rs   rJ   rv   r2   r3   s   @r)   rP   rP   \   s    ?K0 W  $!* !": "!* !$Z $ ".. 	.
 . . 
.*   \\! !'    .Sr*   rP   c                      e Zd ZU dZdZ edddd       edd	d
d      gZded<   	  G d de      Z	 G d de
      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de
      Z edd      Zded <   	 d!d!d!d!dd"	 	 	 	 	 	 	 	 	 	 	 dB fd#ZdCd$ZedDd%       ZedDd&       ZedEd'       ZedFd(       Zd!d!d)	 	 	 	 	 	 	 dGd*ZdHd+ZdId,ZdJd-ZedFd.       ZdKd/Z dLd0Z!dMd1Z"	 dN	 	 	 dOd2Z#dPd3Z$dQd4Z%dRd5Z&dSd6Z'd7 Z(dSd8Z)dSd9Z*dTd:Z+dUd;Z,dVd<Z-dWd=Z.dXd>Z/dXd?Z0dXd@Z1dXdAZ2 xZ3S )YTabszA row of tabs.a  
    Tabs {
        width: 100%;
        height: 2;
        &:focus {
            .underline--bar {
                background: $foreground 30%;
            }
            & .-active {
                text-style: $block-cursor-text-style;
                color: $block-cursor-foreground;
                background: $block-cursor-background;
            }
        }

        & > #tabs-scroll {
            overflow: hidden;
        }

        #tabs-list {
            width: auto;
        }
        #tabs-list-bar, #tabs-list {
            width: auto;
            height: auto;
            min-width: 100%;
            overflow: hidden hidden;
        }
        &:ansi {
            #tabs-list {
                text-style: dim;
            }
            & #tabs-list > .-active {
                text-style: not dim;
            }
            &:focus {
                #tabs-list > .-active {
                    text-style: bold not dim;
                }
            }
            & .underline--bar {
                color: ansi_bright_blue;
                background: ansi_default;
            }
            & .-active {
                color: transparent;
                background: transparent;
            }
        }
    }
    leftprevious_tabzPrevious tabF)showrightnext_tabzNext tabzClassVar[list[BindingType]]BINDINGSc                      e Zd ZdZy)Tabs.TabErrorz9Exception raised when there is an error relating to tabs.NrY   rN   r*   r)   TabErrorr   	  s    Gr*   r   c                  F     e Zd ZdZdhZ	 d fdZedd       ZddZ xZ	S )	Tabs.TabMessagezBParent class for all messages that have to do with a specific tab.rS   c                B    || _         	 || _        	 t        |           y)zInitialize event.

            Args:
                tabs: The Tabs widget.
                tab: The tab that is the object of this message.
            N)tabsrS   r%   r&   )r'   r   rS   r(   s      r)   r&   zTabs.TabMessage.__init__  s$     #DI5DH=Gr*   c                    | j                   S )zThe tabs widget containing the tab that is the object of this message.

            This is an alias for the attribute `tabs` and is used by the
            [`on`][textual.on] decorator.
            r   r8   s    r)   rU   zTabs.TabMessage.control       99r*   c              #  D   K   | j                    | j                   y wr$   )r   rS   r8   s    r)   __rich_repr__zTabs.TabMessage.__rich_repr__(  s     ))O((Ns    )r   r}   rS   rP   r+   r,   r+   r}   r+   zrich.repr.Result)
r-   r.   r/   r0   ALLOW_SELECTOR_MATCHr&   rM   rU   r   r2   r3   s   @r)   rV   r     s/    P %wc	 
	 
		r*   rV   c                      e Zd ZdZy)Tabs.TabActivatedz!Sent when a new tab is activated.NrY   rN   r*   r)   TabActivatedr   ,  s    /r*   r   c                      e Zd ZdZy)Tabs.TabDisabledzSent when a tab is disabled.NrY   rN   r*   r)   TabDisabledr   /  s    *r*   r   c                      e Zd ZdZy)Tabs.TabEnabledzSent when a tab is enabled.NrY   rN   r*   r)   
TabEnabledr   2  s    )r*   r   c                      e Zd ZdZy)Tabs.TabHiddenzSent when a tab is hidden.NrY   rN   r*   r)   	TabHiddenr   5  s    (r*   r   c                      e Zd ZdZy)Tabs.TabShownzSent when a tab is shown.NrY   rN   r*   r)   TabShownr   8  s    'r*   r   c                  >     e Zd ZdZd fdZedd       ZddZ xZS )Tabs.ClearedzSent when there are no active tabs.

        This can occur when Tabs are cleared, if all tabs are hidden, or if the
        currently active tab is unset.
        c                2    || _         	 t        | 	          y)z\Initialize the event.

            Args:
                tabs: The tabs widget.
            N)r   r%   r&   )r'   r   r(   s     r)   r&   zTabs.Cleared.__init__B  s     #DI4Gr*   c                    | j                   S )zThe tabs widget which was cleared.

            This is an alias for [`Cleared.tabs`][textual.widgets.Tabs.Cleared] which
            is used by the [`on`][textual.on] decorator.
            r   r8   s    r)   rU   zTabs.Cleared.controlL  r   r*   c              #  (   K   | j                    y wr$   r   r8   s    r)   r   zTabs.Cleared.__rich_repr__U  s     ))Os   )r   r}   r+   r,   r   r   )	r-   r.   r/   r0   r&   rM   rU   r   r2   r3   s   @r)   Clearedr   ;  s&    		 
	 
		r*   r   ry   )initzreactive[str]activeN)r   namere   rf   rg   c          	        d| _         |D cg c]H  }t        |t        t        t        f      rt        |d| j                         n| j                  |      J }}t        	| %  ||||       || _
        || _        yc c}w )a  Construct a Tabs widget.

        Args:
            *tabs: Positional argument should be explicit Tab objects, or a str or Text.
            active: ID of the tab which should be active on start.
            name: Optional name for the tabs widget.
            id: Optional ID for the widget.
            classes: Optional initial classes for the widget.
            disabled: Whether the widget is disabled or not.
        r   tab-re   )r   re   rf   rg   N)_tabs_counter
isinstancerz   r   r   rP   _new_tab_id_auto_tab_idr%   r&   _tabs_first_active)
r'   r   r   re   rf   rg   r   rS   add_tabsr(   s
            r)   r&   zTabs.__init__[  s    &  
  cC$#78 Cd4#3#3"456&&s+,
 
 		 	 	
 
#
s   AA>c                F    |j                   d| j                   |_         |S )z$Set an automatic ID if not supplied.r   )re   r   r'   rS   s     r)   r   zTabs._auto_tab_id  s%    66>D,,-.CF
r*   c                D    | xj                   dz  c_         | j                   S )z"Get the next tab id in a sequence.   )r   r8   s    r)   r   zTabs._new_tab_id  s!     	a!!!r*   c                6    t        | j                  d            S )zTotal number of tabs.#tabs-list > Tab)lenqueryr8   s    r)   	tab_countzTabs.tab_count  s     4::0122r*   c                    | j                  d      j                  t              D cg c]*  }|j                  r|| j                  u r|j
                  r|, c}S c c}w )zList of all tabs that could be active.

        This list is comprised of all tabs that are shown and enabled,
        plus the active tab in case it is disabled.
        r   )r   resultsrP   rg   
active_tabdisplayr   s     r)   _potentially_active_tabszTabs._potentially_active_tabs  sQ     zz"45==cB
\\SDOO%; 
 	
 
s   /Ac                    | j                   }| j                  y	 |j                  | j                        }||= 	 ||   S # t        $ r Y yw xY w# t        $ r 	 ||dz
     cY S # t        $ r Y Y yw xY ww xY w)z5Next tab to make active if the active tab is removed.Nr   )r   r   index
ValueError
IndexError)r'   r   active_indexs      r)   _next_activezTabs._next_active  s     ,,??"	::doo6L 	%%	  		
  	L1,-- 	s>   ? A 	A
A	A3A"A3"	A/+A3.A//A3beforeafterc                   |r|r j                  d      t        |t              r	  j                  d| t              }n/t        |t              r |j                  vr j                  d      t        |t              r	  j                  d| t              }n/t        |t              r |j                  vr j                  d       j                  dk(  }t        |t        t        t        f      rt	        |d	 j                   
      n j                  |       j                  d      j                  ||      |r<j                  d        j                         d fd}t         |             S |s|rd fd}t         |             S t                      S # t
        $ r  j                  d| d      w xY w# t
        $ r  j                  d| d      w xY w)a  Add a new tab to the end of the tab list.

        Args:
            tab: A new tab object, or a label (str or Text).
            before: Optional tab or tab ID to add the tab before.
            after: Optional tab or tab ID to add the tab after.

        Returns:
            An optionally awaitable object that waits for the tab to be mounted and
                internal state to be fully updated to reflect the new tab.

        Raises:
            Tabs.TabError: If there is a problem with the addition request.

        Note:
            Only one of `before` or `after` can be provided. If both are
            provided a `Tabs.TabError` will be raised.
        z/Unable to add a tab both before and after a tab#tabs-list > #zThere is no tab with ID 'z' to mount beforezHRequest to add a tab before a tab that isn't part of this tab collectionz' to mount afterzGRequest to add a tab after a tab that isn't part of this tab collectionr   r   r   z
#tabs-listr   -activec                    K    d{    j                   xs d_        j                  d       j                          y7 =w)z2Wait for things to be mounted before highlighting.Nry   Fanimate)re   r   _highlight_activerF   )activated_messagemount_awaitr'   
tab_widgets   r)   refresh_activez$Tabs.add_tab.<locals>.refresh_active  sE     !!!(mm1r&&u&5!!"34 "s   A	A>A	c                 J   K     d {    j                  d       y 7 w)NFr   )r   )r   r'   s   r)   r   z$Tabs.add_tab.<locals>.refresh_active  s&     !!!&&u&5 "s   #!#r+   r,   )r   r   rz   	query_onerP   r   	ancestorsr   r   r   r   r   mount	add_classr   r   )	r'   rS   r   r   
from_emptyr   r   r   r   s	   `     @@@r)   add_tabzTabs.add_tab  s   4 e-- QRRfc".(A3G
 $V5E5E)E--Z  eS!Yw'?E s#EOO(C--Y  ^^q(
 #Wd34 $t//012""3' 	 nn\288vU 9 
   + $ 1 1$
 C5 5 !!122u6 !!122[]++e  mm/x7HI   Ymm&?wFV$WXXYs   F/ G /GG0c                    | j                  t              }d|_        d|_        | j	                  | j                  |              d| _        t        | j                  d      j                               S )zuClear all the tabs.

        Returns:
            An awaitable object that waits for the tabs to be removed.
        r   ry   r   )
r   r   r6   r7   rF   r   r   r   r   remove)r'   	underlines     r)   clearz
Tabs.clear  s^     NN9-	$%	!"#	$,,t,-TZZ(:;BBDEEr*   c                    |s
t               S t        |t              r|n	  j                  d| t              j                  d      r j                  ndd fd}t         |             S # t        $ r t               cY S w xY w)zRemove a tab.

        Args:
            tab_or_id: The Tab to remove or its id.

        Returns:
            An optionally awaitable object that waits for the tab to be removed.
        r   r   Nc                    K   j                          d{    j                  d      sd_        y  j                  xs d_        yj	                  d       y7 Hw)zIPerform the remove after refresh so the underline bar gets new positions.Nr   ry   Fr   )r   r   r   re   r   )r   
remove_tabr'   s   r)   	do_removez"Tabs.remove_tab.<locals>.do_remove-  sY     ##%%%::01 %&kk/R&&u&5 &s   A"A A	A"r   )r   r   rP   r   r   	has_classr   )r'   	tab_or_idr   r   r   s   `  @@r)   r   zTabs.remove_tab  s      ?"i%"J'!^^nYK,H#N
 	*((HH	6 Y[))%  '$&'s   A5 5B
Bc                N    |r"| j                  d|       st        d|      |S )z5Check id assigned to active attribute is a valid tab.r   zNo Tab with id )r   r   )r'   r   s     r)   validate_activezTabs.validate_active9  s.    $**~fX%>?vj9::r*   c                N    	 | j                  dt              S # t        $ r Y yw xY w)z>The currently active tab, or None if there are no active tabs.#tabs-list Tab.-activeN)r   rP   r   r8   s    r)   r   zTabs.active_tab?  s+    	>>":C@@ 		s    	$$c                    | j                   | j                   | _        | j                  s;	 | j                  d      j                  t              }|j                  xs d| _        yy# t
        $ r Y yw xY w)zMake the first tab active.Nr   ry   )r   r   r   firstrP   r   re   )r'   _rS   s      r)   	_on_mountzTabs._on_mountG  sk    ),,DK{{jj!34::3? &&,BDK   s   $A& &	A21A2c              #    K   t        d      5  t        d      5  t        d      5  | j                  E d {    d d d        t	                d d d        d d d        y 7 )# 1 sw Y   (xY w# 1 sw Y    xY w# 1 sw Y   y xY ww)Nztabs-scrollr   ztabs-list-barz	tabs-list)r   r   r   r   r   r8   s    r)   composezTabs.composeS  s|     -( 	"_- ";/ *#zz))*k!"	" 	" ** *" "	" 	"sY   B	A=A1A%A#
A%A1A=	B	#A%%A.*A11A:	6A==BB	c                   | j                  d      j                  d       |rr	 | j                  d| t              }|j                  d       | j                  |dk7         | j                          | j                  | j                  | |             y| j                  t              }d|_        d|_        | j                  | j                  |              y# t        $ r Y yw xY w)z"Handle a change to the active tab.#tabs-list > Tab.-activer   r   Nry   r   r   )r   remove_classr   rP   r   r   r   _scroll_active_tabrF   r   r   r6   r7   r   )r'   previously_activer   r   r   s        r)   watch_activezTabs.watch_activeZ  s    

-.;;IF!^^nVH,EsK
   +""+<+B"C##%d//jABy1I()I%&'I#dll401  s   C 	C%$C%c                D     j                  t              	  j                  d      }d_        d
 fd|r0 j                  j                  dk7  r j                  d fd       y	 j                  d       y	# t        $ r d_        d_        d_	        Y y	w xY w)ztMove the underline bar to under the active tab.

        Args:
            animate: Should the bar animate?
        r   Tc                :   	 j                  d      }|j                  j                  |j                  j                        }|j
                  \  }}| r+j                  d|dd       j                  d|dd       y|_        |_        y# t        $ r Y yw xY w)zMove the tab underline.

                Args:
                    animate: animate the underline to its new position.
                r   r6   g333333?basic)durationlevelr7   N)
r   virtual_regionshrinkstylesguttercolumn_spanr   r6   r7   r   )r   r   
tab_regionstartendr'   r   s        r)   move_underlinez.Tabs._highlight_active.<locals>.move_underline  s    6!%0J!KJ ",!:!:!A!A"))00"J ",!7!7JE3!))-!%(")	 *  "))+%(")	 *  5:	125	/- ! s   B 	BBnoneg{Gz?c                 (    j                   d      S )NT)call_after_refresh)r  r'   s   r)   <lambda>z(Tabs._highlight_active.<locals>.<lambda>  s    D33NDI r*   Fr   Nr   rx   r+   r,   )
r   r   r   appanimation_level	set_timerr	  r   r6   r7   )r'   r   _active_tabr  r   s   `  @@r)   r   zTabs._highlight_activen  s     NN9-	/	?..)CDK (,I$6@ 48833v=I
 ''>[  	(',I$()I%&'I#	(s   A> >BBc                   K   | j                          |j                          | j                  |j                         yw)z Activate a tab that was clicked.N)focusrE   _activate_tabrS   rH   s     r)   _on_tab_clickedzTabs._on_tab_clicked  s*     



599%s   =?c                    | j                  d      j                  d       |j                  d       |j                  xs d| _        y)zRActivate a tab.

        Args:
            tab: The Tab that was clicked.
        r   r   ry   N)r   r   r   re   r   r   s     r)   r  zTabs._activate_tab  s7     	

+,99)Di fflr*   c                    |j                          |j                  dz   }| j                          | j                  t              D ]0  }||j
                  v s|j                  r| j                  |        y y)zThe underline was clicked.

        Activate the tab above to make a larger clickable area.

        Args:
            event: The Underline.Clicked event.
        )r   N)rE   r"   r  r   rP   regionrg   r  )r'   rI   r"   rS   s       r)   _on_underline_clickedzTabs._on_underline_clicked  s^     	

'

::c? 	C#CLL""3'	r*   c                    | j                   r.	 | j                  d      j                  | j                   d       yy# t        $ r Y yw xY w)z Scroll the active tab into view.z#tabs-scrollT)forceN)r   r   scroll_to_centerr   r8   s    r)   r   zTabs._scroll_active_tab  sM    ??~.??OO4 @  
  s   ,< 	AAc                H    | j                  d       | j                          y)z&Make the active tab visible on resize.Fr   N)r   r   r8   s    r)   
_on_resizezTabs._on_resize  s    u-!r*   c                &    | j                  d       y)zMake the next tab active.r   N	_move_tabr8   s    r)   action_next_tabzTabs.action_next_tab      rr*   c                &    | j                  d       y)zMake the previous tab active.r  Nr  r8   s    r)   action_previous_tabzTabs.action_previous_tab  r"  r*   c                    | j                   }| j                  }|sy|s ||dk(  rdnd   j                  xs d| _        yt	        |      }|j                  |      |z   |z  }||   j                  xs d| _        y)a(  Activate the next enabled tab in the given direction.

        Tab selection wraps around. If no tab is currently active, the "next"
        tab is set to be the first and the "previous" tab is the last one.

        Args:
            direction: +1 for the next tab, -1 for the previous.
        Nr   r   r  ry   )r   r   re   r   r   r   )r'   	directionr   r   r   new_tab_indexs         r)   r   zTabs._move_tab  s{     __
,,INq;>>D"DKI	J/);yH=),,2r*   c                z    |j                          | j                  | j                  | |j                               y)zRe-post the disabled message.N)rE   rF   r   rS   rH   s     r)   _on_tab_disabledzTabs._on_tab_disabled  s*    

$**4;<r*   c                z    |j                          | j                  | j                  | |j                               y)zRe-post the enabled message.N)rE   rF   r   rS   rH   s     r)   _on_tab_enabledzTabs._on_tab_enabled  s(    

$//$		:;r*   c                D    |j                          | j                          y)z,Redraw the highlight when tab is relabelled.N)rE   r   rH   s     r)   _on_tab_relabelledzTabs._on_tab_relabelled  s    

 r*   c                    	 | j                  d| t              }d|_        |S # t        $ r | j                  d|d      dw xY w)a   Disable the indicated tab.

        Args:
            tab_id: The ID of the [`Tab`][textual.widgets.Tab] to disable.

        Returns:
            The [`Tab`][textual.widgets.Tab] that was targeted.

        Raises:
            TabError: If there are any issues with the request.
        #tabs-list > Tab#There is no tab with ID z to disable.NTr   rP   r   r   rg   )r'   tab_idtab_to_disables      r)   disablezTabs.disable  s`    	!^^.?x,H#NN #'  	--*6*LA		   $  Ac                    	 | j                  d| t              }d|_        |S # t        $ r | j                  d|d      dw xY w)a  Enable the indicated tab.

        Args:
            tab_id: The ID of the [`Tab`][textual.widgets.Tab] to enable.

        Returns:
            The [`Tab`][textual.widgets.Tab] that was targeted.

        Raises:
            TabError: If there are any issues with the request.
        r/  r0  z to enable.NFr1  )r'   r2  tab_to_enables      r)   enablezTabs.enable  s`    	 NN->vh+GMM "'  	--*6*K@	r5  c                   	 | j                  d| t              }|j	                  d      r%| j
                  }|r|j                  xs dnd| _        |j                  d       | j                  | j                  | |      j                  |              | j                  | j                         |S # t        $ r | j                  d|d      w xY w)a  Hide the indicated tab.

        Args:
            tab_id: The ID of the [`Tab`][textual.widgets.Tab] to hide.

        Returns:
            The [`Tab`][textual.widgets.Tab] that was targeted.

        Raises:
            TabError: If there are any issues with the request.
        r/  r0  z	 to hide.r   ry   -hidden)r   rP   r   r   r   r   re   r   r   rF   r   
set_senderr	  r   )r'   r2  tab_to_hider   s       r)   hidez	Tabs.hide1  s    	P..+<VH)EsKK   +((H/7(+++RDKi($..{;FFtLM 6 67  	P--":6*I NOO	Ps   B/ /Cc                p   	 | j                  d| t              }|j	                  d       | j                  | j                  | |      j                  |              | j                  s| j                  |       | j                  | j                         |S # t        $ r | j                  d|d      w xY w)a  Show the indicated tab.

        Args:
            tab_id: The ID of the [`Tab`][textual.widgets.Tab] to show.

        Returns:
            The [`Tab`][textual.widgets.Tab] that was targeted.

        Raises:
            TabError: If there are any issues with the request.
        r/  r0  z	 to show.r:  )r   rP   r   r   r   rF   r   r;  r   r  r	  r   )r'   r2  tab_to_shows      r)   r   z	Tabs.showK  s    	P..+<VH)EsKK 	  +$--k:EEdKL{{{+ 6 67  	P--":6*I NOO	Ps   B B5)r   Tab | ContentTextr   rw   r   rw   re   rw   rf   rw   rg   rx   )rS   rP   r+   rP   )r+   int)r+   z	list[Tab])r+   z
Tab | None)rS   r@  r   Tab | str | Noner   rB  r+   r   )r+   r   )r   rB  r+   r   )r   rz   r+   rz   )r   r   r+   r,   )r+   r	   )r   rz   r   rz   r+   r,   )Tr  )rI   rX   r+   r,   )rS   rP   r+   r,   )rI   r!   r+   r,   r   )r&  rA  r+   r,   )rI   r\   r+   r,   )rI   r_   r+   r,   )rI   rb   r+   r,   )r2  rz   r+   rP   )4r-   r.   r/   r0   rK   r   r   r1   	Exceptionr   r   rV   r   r   r   r   r   r   r   r   r&   r   rM   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r   r  r!  r$  r   r)  r+  r-  r4  r8  r=  r   r2   r3   s   @r)   r}   r}      s4   2Kj 	UCZe<-H) H9 HW @0z 0+j +*Z *)J )(: (' : %Re4FM4G
 ""$$ $$ $$ 	$$
 $$ $$ $$L " "
 3 3 

 

  . $("&R,R, !	R,
  R, 
R,hF#*J  
'"2, 9?9? 
9?v&# "
3(=
<
!
..4r*   r}   T)	can_focus)2
__future__r   dataclassesr   typingr   	rich.reprrich
rich.styler   	rich.textr   textualr   textual.appr	   r
   textual.await_completer   textual.bindingr   r   textual.containersr   r   r   textual.contentr   r   textual.css.queryr   textual.eventsr   textual.geometryr   textual.messager   textual.reactiver   textual.renderables.barr   textual.visualr   textual.widgetr   textual.widgetsr   r   rP   r}   rN   r*   r)   <module>r[     su    " !      3 0 0 > > 0 '   # # % ' % ! ">= >=BhS& hSV[
6T [
r*   