
    AHj3e                    p   d 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
 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  e
dd      ZerddlmZ ddlmZ ddlm Z  ddl!m"Z" ejF                  jH                   G d de             Z%ejF                  jH                   G d de%dd             Z&e G d de%d             Z' G d de%d      Z( G d  d!e%d      Z) G d" d#e%      Z* G d$ d%e%d      Z+ G d& d'e%dd      Z, G d( d)e%dd      Z- G d* d+e%dd      Z. G d, d-e%d      Z/ G d. d/e%d      Z0 G d0 d1e%d      Z1ejF                  jH                   G d2 d3e%d             Z2ejF                  jH                   G d4 d5e%d             Z3 G d6 d7e%      Z4ejF                  jH                   G d8 d9e4             Z5djd:Z6ejF                  jH                   G d; de4d             Z7ejF                  jH                   G d< d=e7dd             Z8ejF                  jH                   G d> d?e7dd             Z9ejF                  jH                   G d@ dAe7dd             Z:ejF                  jH                   G dB dCe7dd             Z;ejF                  jH                   G dD dEe7dd             Z<ejF                  jH                   G dF dGe7dd             Z=ejF                  jH                   G dH dIe7dd             Z> G dJ dKe7d      Z?ejF                  jH                   G dL dMe%dd             Z G dN dOe%dd      Z@ G dP dQe%dd      ZA G dR dSe%d      ZB G dT dUe%d      ZC G dV dWe%d      ZD G dX dYe%d      ZEe G dZ d[e%dd             ZFe G d\ d]e%dd             ZGejF                  jH                   G d^ d_e%d             ZH G d` dae%d      ZI G db dce%d      ZJejF                  jH                   G dd dee%d             ZKe G df dge%d             ZLe G dh die%d             ZMy)ka:  

Builtin events sent by Textual.

Events may be marked as "Bubbles" and "Verbose".
See the [events guide](/guide/events/#bubbling) for an explanation of bubbling.
Verbose events are excluded from the textual console, unless you explicitly request them with the `-v` switch as follows:

```
textual console -v
```
    )annotations)	dataclass)Path)TYPE_CHECKINGTypeTypeVarN)Style)Self)CallbackType)OffsetSize)_get_key_aliases)MessageMouseEventT
MouseEvent)bound)DOMNode)Timer)TimerCallback)Widgetc                      e Zd ZdZy)EventzThe base class for all events.N__name__
__module____qualname____doc__     F/root/tools/cai/cai_env/lib/python3.12/site-packages/textual/events.pyr   r   &   s    (r   r   c                  ,     e Zd ZdZd fdZddZ xZS )CallbackzSent by Textual to invoke a callback
    (see [call_next][textual.message_pump.MessagePump.call_next] and
    [call_later][textual.message_pump.MessagePump.call_later]).
    c                0    || _         t        | 	          y N)callbacksuper__init__)selfr%   	__class__s     r    r'   zCallback.__init__2   s     r   c              #  ,   K   d| j                   f y w)Nr%   )r%   r(   s    r    __rich_repr__zCallback.__rich_repr__6   s     $--''   )r%   r   returnNoner.   zrich.repr.Resultr   r   r   r   r'   r,   __classcell__r)   s   @r    r"   r"   +   s    
(r   r"   FT)bubbleverbosec                  &    e Zd ZU dZded<   ded<   y)CursorPositionz?Internal event used to retrieve the terminal's cursor position.intxyN)r   r   r   r   __annotations__r   r   r    r7   r7   :   s    I
F
Fr   r7   )r4   c                      e Zd ZdZy)Loadz
    Sent when the App is running but *before* the terminal is in application mode.

    Use this event to run any setup that doesn't require any visuals such as loading
    configuration and binding keys.

    - [ ] Bubbles
    - [ ] Verbose
    Nr   r   r   r    r=   r=   B       r   r=   c                      e Zd ZdZy)IdlezSent when there are no more items in the message queue.

    This is a pseudo-event in that it is created by the Textual system and doesn't go
    through the usual message queue.

    - [ ] Bubbles
    - [ ] Verbose
    Nr   r   r   r    r@   r@   N       r   r@   c                  .     e Zd ZdgZd fdZddZ xZS )Actionactionc                0    t         |           || _        y r$   )r&   r'   rD   )r(   rD   r)   s     r    r'   zAction.__init__\   s    r   c              #  ,   K   d| j                   f y w)NrD   )rD   r+   s    r    r,   zAction.__rich_repr__`   s     ##r-   )rD   strr.   r/   r0   )r   r   r   	__slots__r'   r,   r2   r3   s   @r    rC   rC   Y   s    
I$r   rC   c                  r     e Zd ZdZg dZ	 	 d	 	 	 	 	 	 	 	 	 d fdZe	 	 	 	 	 	 d	d       Zd
dZddZ	 xZ
S )Resizea  Sent when the app or widget has been resized.

    - [ ] Bubbles
    - [ ] Verbose

    Args:
        size: The new size of the Widget.
        virtual_size: The virtual size (scrollable size) of the Widget.
        container_size: The size of the Widget's container widget.
    )sizevirtual_sizecontainer_sizec                j    || _         	 || _        	 ||n|| _        	 || _        	 t        |           y r$   )rK   rL   rM   
pixel_sizer&   r'   )r(   rK   rL   rM   rO   r)   s        r    r'   zResize.__init__r   sA     	)(?&4&<d.8$Qr   c                F    t        | }|t        | nd}t        ||||      S )zConstruct from basic dimensions.

        Args:
            cells: tuple of (<width>, <height>) in cells.
            pixels: tuple of (<width>, <height>) in pixels if known, or `None` if not known.

        N)r   rJ   )clscellspixelsrK   rO   s        r    from_dimensionszResize.from_dimensions   s.     U|&,&8T6]d
dD$
33r   c                "    t        |t              S r$   )
isinstancerJ   )r(   messages     r    can_replacezResize.can_replace   s    '6**r   c              #     K   d| j                   f d| j                  | j                   f d| j                  | j                   f d| j                  d f y w)NrK   rL   rM   rO   )rK   rL   rM   rO   r+   s    r    r,   zResize.__rich_repr__   sT     diid//:: 3 3TYY>>DOOT11s   AA)NN)
rK   r   rL   r   rM   Size | NonerO   rZ   r.   r/   )rR   ztuple[int, int]rS   ztuple[int, int] | Noner.   rJ   )rW   z	'Message'r.   boolr0   )r   r   r   r   rH   r'   classmethodrT   rX   r,   r2   r3   s   @r    rJ   rJ   d   s    	 ;I '+"&  $	
   
" 4#4-C4	4 4+2r   rJ   c                      e Zd ZdZy)ComposezSent to a widget to request it to compose and mount children.

    This event is used internally by Textual.
    You won't typically need to explicitly handle it,

    - [ ] Bubbles
    - [X] Verbose
    Nr   r   r   r    r^   r^      rA   r   r^   c                      e Zd ZdZy)MountzcSent when a widget is *mounted* and may receive messages.

    - [ ] Bubbles
    - [ ] Verbose
    Nr   r   r   r    r`   r`          r   r`   c                      e Zd ZdZy)UnmountzmSent when a widget is unmounted and may no longer receive messages.

    - [ ] Bubbles
    - [ ] Verbose
    Nr   r   r   r    rc   rc      ra   r   rc   c                      e Zd ZdZy)ShowzPSent when a widget is first displayed.

    - [ ] Bubbles
    - [ ] Verbose
    Nr   r   r   r    re   re      ra   r   re   c                      e Zd ZdZy)Hidea  Sent when a widget has been hidden.

    - [ ] Bubbles
    - [ ] Verbose

    Sent when any of the following conditions apply:

    - The widget is removed from the DOM.
    - The widget is no longer displayed because it has been scrolled or clipped from the terminal or its container.
    - The widget has its `display` attribute set to `False`.
    - The widget's `display` style is set to `"none"`.
    Nr   r   r   r    rg   rg      s    r   rg   c                      e Zd ZdZy)ReadyzySent to the `App` when the DOM is ready and the first frame has been displayed.

    - [ ] Bubbles
    - [ ] Verbose
    Nr   r   r   r    ri   ri      ra   r   ri   c                  ,     e Zd ZdZd fdZddZ xZS )MouseCapturea   Sent when the mouse has been captured.

    - [ ] Bubbles
    - [ ] Verbose

    When a mouse has been captured, all further mouse events will be sent to the capturing widget.

    Args:
        mouse_position: The position of the mouse when captured.
    c                0    t         |           || _        y r$   r&   r'   mouse_positionr(   rn   r)   s     r    r'   zMouseCapture.__init__       ,6r   c              #  ,   K   d | j                   f y wr$   rn   r+   s    r    r,   zMouseCapture.__rich_repr__        D''''r-   rn   r   r.   r/   r0   r1   r3   s   @r    rk   rk      s    	7
(r   rk   c                  ,     e Zd ZdZd fdZddZ xZS )MouseReleasezMouse has been released.

    - [ ] Bubbles
    - [ ] Verbose

    Args:
        mouse_position: The position of the mouse when released.
    c                0    t         |           || _        y r$   rm   ro   s     r    r'   zMouseRelease.__init__   rp   r   c              #  ,   K   d | j                   f y wr$   rr   r+   s    r    r,   zMouseRelease.__rich_repr__   rs   r-   rt   r0   r1   r3   s   @r    rv   rv      s    7
(r   rv   c                      e Zd ZdZy)
InputEventzBase class for input events.Nr   r   r   r    rz   rz      s    &r   rz   c                  j     e Zd ZdZg dZd fdZd	dZed
d       Zedd       Z	edd       Z
 xZS )KeyzSent when the user hits a key on the keyboard.

    - [X] Bubbles
    - [ ] Verbose

    Args:
        key: The key that was pressed.
        character: A printable character or `None` if it is not printable.
    )key	characteraliasesc                    t         |           || _        	 |t        |      dk(  r|nd n|| _        	 t        |      | _        y )N   )r&   r'   r}   lenr~   r   r   )r(   r}   r~   r)   s      r    r'   zKey.__init__  sJ    '090ACHMSty 	 	H"23"7@r   c              #     K   d| j                   f d| j                  f d| j                  f d| j                  f d| j                  | j                   gf y w)Nr}   r~   nameis_printabler   )r}   r~   r   r   r   r+   s    r    r,   zKey.__rich_repr__  sZ     TXXo4>>))diid////z11s   AA c                H    t        | j                        j                         S )z6Name of a key suitable for use as a Python identifier.)_key_to_identifierr}   lowerr+   s    r    r   zKey.name$  s     "$((+1133r   c                R    | j                   D cg c]  }t        |       c}S c c}w )z9The corresponding name for every alias in `aliases` list.)r   r   )r(   r}   s     r    name_aliaseszKey.name_aliases)  s"     48<<@C"3'@@@s   $c                R    | j                   dS | j                   j                         S )zCheck if the key is printable (produces a unicode character).

        Returns:
            `True` if the key is printable.
        F)r~   isprintabler+   s    r    r   zKey.is_printable.  s%     .uPDNN4N4N4PPr   )r}   rG   r~   
str | Noner.   r/   r0   )r.   rG   )r.   z	list[str])r.   r[   )r   r   r   r   rH   r'   r,   propertyr   r   r   r2   r3   s   @r    r|   r|     sZ     0I	A2 4 4 A A Q Qr   r|   c                    | j                  d      d   }t        |      dk(  r3|j                         r#d| v r| j                  d      d    d| } nd| } | j	                  dd      j                         S )zIConvert the key string to a name suitable for use as a Python identifier.+r   r   z+upper_upper__)splitr   isupper
rpartitionreplacer   )r}   key_no_modifierss     r    r   r   8  s    yy~b)
!&6&>&>&@#:^^C(+,G4D3EFC+,-C;;sC &&((r   c                      e Zd ZdZg dZ	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d fdZedd       Zedd       Zedd       Z	edd       Z
edd       Zedd	       Zedd
       Zedd       Zedd       Zedd       Ze	 	 	 	 	 	 	 	 dd       ZddZedd       Zed d       Zed d       Zed d       Zed!d       Zej2                  d"d       Zd#dZd$dZd%dZ xZS )&r   a  Sent in response to a mouse event.

    - [X] Bubbles
    - [ ] Verbose

    Args:
        widget: The widget under the mouse.
        x: The relative x coordinate.
        y: The relative y coordinate.
        delta_x: Change in x since the last message.
        delta_y: Change in y since the last message.
        button: Indexed of the pressed button.
        shift: True if the shift key is pressed.
        meta: True if the meta key is pressed.
        ctrl: True if the ctrl key is pressed.
        screen_x: The absolute x coordinate.
        screen_y: The absolute y coordinate.
        style: The Rich Style under the mouse cursor.
    )widget_x_y_delta_x_delta_ybuttonshiftmetactrl	_screen_x	_screen_y_stylec                   t         |           || _        	 || _        	 || _        	 || _        	 || _        	 || _        	 || _        	 || _	        	 |	| _
        	 |
|n|
| _        	 ||n|| _        	 |xs
 t               | _        y r$   )r&   r'   r   r   r   r   r   r   r   r   r   r   r   r	   r   )r(   r   r9   r:   delta_xdelta_yr   r   r   r   screen_xscreen_ystyler)   s                r    r'   zMouseEvent.__init__h  s     	%+@((11,
1	0	0&.H(&.H(&uwr   c                ,    t        | j                        S )z6The relative X coordinate of the cell under the mouse.)r8   r   r+   s    r    r9   zMouseEvent.x       477|r   c                ,    t        | j                        S )z6The relative Y coordinate of the cell under the mouse.)r8   r   r+   s    r    r:   zMouseEvent.y  r   r   c                    | j                   S )z!Change in `x` since last message.)r   r+   s    r    r   zMouseEvent.delta_x       }}r   c                    | j                   S )z%Change in `y` since the last message.)r   r+   s    r    r   zMouseEvent.delta_y  r   r   c                ,    t        | j                        S )z8X coordinate of the cell relative to top left of screen.)r8   r   r+   s    r    r   zMouseEvent.screen_x       4>>""r   c                ,    t        | j                        S )z8Y coordinate of the cell relative to top left of screen.)r8   r   r+   s    r    r   zMouseEvent.screen_y  r   r   c                    | j                   S )z)The relative X coordinate of the pointer.)r   r+   s    r    	pointer_xzMouseEvent.pointer_x       wwr   c                    | j                   S )z)The relative Y coordinate of the pointer.)r   r+   s    r    	pointer_yzMouseEvent.pointer_y  r   r   c                    | j                   S )z7The X coordinate of the pointer relative to the screen.)r   r+   s    r    pointer_screen_xzMouseEvent.pointer_screen_x       ~~r   c                    | j                   S )z7The Y coordinate of the pointer relative to the screen.)r   r+   s    r    pointer_screen_yzMouseEvent.pointer_screen_y  r   r   c                    | ||j                   |j                  |j                  |j                  |j                  |j
                  |j                  |j                  |j                  |j                  |j                        }|S r$   )r   r   r   r   r   r   r   r   r   r   r   )rQ   r   event	new_events       r    
from_eventzMouseEvent.from_event  sf     HHHHNNNNLLKKJJJJOOOOLL
	 r   c              #  R  K   | j                    d| j                  f d| j                  f d| j                  f d| j                  f d| j
                  df d| j                  df | j                  | j                  k7  rd| j                  f | j                  | j                  k7  rd	| j                  f d
| j                  df d| j                  df d| j                  df d| j                  df | j                  rd| j                  f y y w)Nr9   r:   r   r   r   r   r   r   r   r   r   Fr   r   r   )r   r9   r:   r   r   r   r   r   r   r   r   r   r   r   r   r   r+   s    r    r,   zMouseEvent.__rich_repr__  s	    kk466k466k4>>))4>>))q((q((==DFF"dnn,,==DFF"dnn,,Q&&tzz5((dii&&dii&&::4::%% s   D%D'c                    | j                   S r$   r   r+   s    r    controlzMouseEvent.control  s    {{r   c                B    t        | j                  | j                        S )z[The mouse coordinate as an offset.

        Returns:
            Mouse coordinate.
        )r   r9   r:   r+   s    r    offsetzMouseEvent.offset  s     dffdff%%r   c                B    t        | j                  | j                        S )z(Mouse coordinate relative to the screen.)r   r   r   r+   s    r    screen_offsetzMouseEvent.screen_offset  s     dmmT]]33r   c                B    t        | j                  | j                        S )z1Mouse coordinate delta (change since last event).)r   r   r   r+   s    r    deltazMouseEvent.delta  s     dllDLL11r   c                2    | j                   xs
 t               S )z"The (Rich) Style under the cursor.)r   r	   r+   s    r    r   zMouseEvent.style   s     {{%eg%r   c                    || _         y r$   )r   )r(   r   s     r    r   zMouseEvent.style  s	    r   c                V    | j                   |j                  vry| j                  |      S )a  Get offset within a widget's content area, or None if offset is not in content (i.e. padding or border).

        Args:
            widget: Widget receiving the event.

        Returns:
            An offset where the origin is at the top left of the content area.
        N)r   content_regionget_content_offset_capturer(   r   s     r    get_content_offsetzMouseEvent.get_content_offset	  s,     V%:%::..v66r   c                H    | j                   |j                  j                  z
  S )a%  Get offset from a widget's content area.

        This method works even if the offset is outside the widget content region.

        Args:
            widget: Widget receiving the event.

        Returns:
            An offset where the origin is at the top left of the content area.
        )r   guttertop_leftr   s     r    r   z%MouseEvent.get_content_offset_capture  s     {{V]]3333r   c                8   | j                  | j                  | j                  |z   | j                  |z   | j                  | j
                  | j                  | j                  | j                  | j                  | j                  | j                  | j                        S )N)r9   r:   r   r   r   r   r   r   r   r   r   )r)   r   r   r   r   r   r   r   r   r   r   r   r   r(   r9   r:   s      r    _apply_offsetzMouseEvent._apply_offset#  st    ~~KKggkggkMMMM;;**^^^^**  
 	
r   )NNN)r   Widget | Noner9   floatr:   r   r   r8   r   r8   r   r8   r   r[   r   r[   r   r[   r   float | Noner   r   r   Style | Noner.   r/   )r.   r8   )r.   r   )rQ   zType[MouseEventT]r   r   r   r   r.   r   r0   )r.   r   )r.   r   )r.   r	   )r   r	   r.   r/   )r   r   r.   zOffset | None)r   r   r.   r   )r9   r8   r:   r8   r.   r   )r   r   r   r   rH   r'   r   r9   r:   r   r   r   r   r   r   r   r   r\   r   r,   r   r   r   r   r   setterr   r   r   r2   r3   s   @r    r   r   C  s,   (I4 "&!%"&'&' &' 	&'
 &' &' &' &' &' &' &' &' &' 
&'P         # # # #         (.7A	 &&&   & & 4 4 2 2 & & \\ 74
r   c                      e Zd ZdZy)	MouseMovezKSent when the mouse cursor moves.

    - [X] Bubbles
    - [X] Verbose
    Nr   r   r   r    r   r   4      r   r   c                      e Zd ZdZy)	MouseDownzNSent when a mouse button is pressed.

    - [X] Bubbles
    - [X] Verbose
    Nr   r   r   r    r   r   =  r   r   r   c                      e Zd ZdZy)MouseUpzOSent when a mouse button is released.

    - [X] Bubbles
    - [X] Verbose
    Nr   r   r   r    r   r   F  r   r   r   c                      e Zd ZdZy)MouseScrollDownzWSent when the mouse wheel is scrolled *down*.

    - [X] Bubbles
    - [X] Verbose
    Nr   r   r   r    r   r   O  r   r   r   c                      e Zd ZdZy)MouseScrollUpzUSent when the mouse wheel is scrolled *up*.

    - [X] Bubbles
    - [X] Verbose
    Nr   r   r   r    r   r   X  r   r   r   c                      e Zd ZdZy)MouseScrollRightzXSent when the mouse wheel is scrolled *right*.

    - [X] Bubbles
    - [X] Verbose
    Nr   r   r   r    r   r   a  r   r   r   c                      e Zd ZdZy)MouseScrollLeftzWSent when the mouse wheel is scrolled *left*.

    - [X] Bubbles
    - [X] Verbose
    Nr   r   r   r    r   r   j  r   r   r   c                       e Zd ZdZ	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d fdZe	 d	 	 	 	 	 	 	 	 	 d	d       Zd
dZd fdZ xZ	S )ClickzSent when a widget is clicked.

    - [X] Bubbles
    - [ ] Verbose

    Args:
        chain: The number of clicks in the chain. 2 is a double click, 3 is a triple click, etc.
    c                H    t         |   |||||||||	|
||       || _        y r$   )r&   r'   chain)r(   r   r9   r:   r   r   r   r   r   r   r   r   r   r   r)   s                 r    r'   zClick.__init__}  s?      		
 
r   c                    | ||j                   |j                  |j                  |j                  |j                  |j
                  |j                  |j                  |j                  |j                  |j                  |      }|S )N)r   )r9   r:   r   r   r   r   r   r   r   r   r   )rQ   r   r   r   r   s        r    r   zClick.from_event  si     GGGGMMMMLLKKJJJJNNNNLL
	 r   c                N   | j                  | j                  | j                  |z   | j                  |z   | j                  | j
                  | j                  | j                  | j                  | j                  | j                  | j                  | j                  | j                        S )N)r9   r:   r   r   r   r   r   r   r   r   r   r   )r)   r   r9   r:   r   r   r   r   r   r   r   r   r   r   r   s      r    r   zClick._apply_offset  s{    ~~KKffqjffqjLLLL;;**]]]]****  
 	
r   c              #  ^   K   t         |          E d {    d| j                  f y 7 w)Nr   )r&   r,   r   r(   r)   s    r    r,   zClick.__rich_repr__  s,     7(***tzz!! 	+   -+-)NNNr   )r   r   r9   r8   r:   r8   r   r8   r   r8   r   r8   r   r[   r   r[   r   r[   r   
int | Noner   r   r   r   r   r8   r.   r/   )r   )
rQ   z
Type[Self]r   r   r   r   r   r8   r.   r
   )r9   r8   r:   r8   r.   r
   r0   )
r   r   r   r   r'   r\   r   r   r,   r2   r3   s   @r    r   r   s  s    (  $#"  	
           
@ 
 	  	
 
 .
"" "r   r   c                  L     e Zd ZdZg dZ	 	 d	 	 	 	 	 	 	 	 	 d fdZddZ xZS )r   zFSent in response to a timer.

    - [ ] Bubbles
    - [X] Verbose
    )timertimecountr%   c                Z    t         |           || _        || _        || _        || _        y r$   )r&   r'   r   r   r   r%   )r(   r   r   r   r%   r)   s        r    r'   zTimer.__init__  s,     	
	
 r   c              #  \   K   | j                   j                   d| j                  f y w)Nr   )r   r   r   r+   s    r    r,   zTimer.__rich_repr__  s#     jjootzz!!s   *,)r   N)
r   z'TimerClass'r   r   r   r8   r%   zTimerCallback | Noner.   r/   r0   )r   r   r   r   rH   r'   r,   r2   r3   s   @r    r   r     sQ     7I )-!! ! 	!
 '! 
!"r   r   c                  <     e Zd ZdZdgZd fdZedd       Z xZS )Entera  Sent when the mouse is moved over a widget.

    Note that this event bubbles, so a widget may receive this event when the mouse
    moves over a child widget. Check the `node` attribute for the widget directly under
    the mouse.

    - [X] Bubbles
    - [X] Verbose
    nodec                2    || _         	 t        | 	          y r$   r   r&   r'   r(   r   r)   s     r    r'   zEnter.__init__  s    	0r   c                    | j                   S )z%Alias for the `node` under the mouse.r   r+   s    r    r   zEnter.control       yyr   r   r   r.   r/   r.   r   	r   r   r   r   rH   r'   r   r   r2   r3   s   @r    r   r     s*     I
  r   r   c                  <     e Zd ZdZdgZd fdZedd       Z xZS )LeaveaV  Sent when the mouse is moved away from a widget, or if a widget is
    programmatically disabled while hovered.

    Note that this widget bubbles, so a widget may receive Leave events for any child widgets.
    Check the `node` parameter for the original widget that was previously under the mouse.


    - [X] Bubbles
    - [X] Verbose
    r   c                2    || _         	 t        | 	          y r$   r  r  s     r    r'   zLeave.__init__  s    	Dr   c                    | j                   S )z9Alias for the `node` that was previously under the mouse.r  r+   s    r    r   zLeave.control  r  r   r  r  r	  r3   s   @r    r  r    s*    	 I
  r   r  c                  2     e Zd ZdZdd fdZd fdZ xZS )Focusa  Sent when a widget is focussed.

    - [ ] Bubbles
    - [ ] Verbose

    Args:
        from_app_focus: True if this focus event has been sent because the app itself has
            regained focus (via an AppFocus event). False if the focus came from within
            the Textual app (e.g. via the user pressing tab or a programmatic setting
            of the focused widget).
    c                0    || _         t        | 	          y r$   )from_app_focusr&   r'   )r(   r  r)   s     r    r'   zFocus.__init__%  s    ,r   c              #  ^   K   t         |          E d {    d| j                  f y 7 w)Nr  )r&   r,   r  r   s    r    r,   zFocus.__rich_repr__)  s.     7(*** 3 333 	+r   F)r  r[   r.   r/   r0   r1   r3   s   @r    r  r    s    
4 4r   r  c                      e Zd ZdZy)BlurzVSent when a widget is blurred (un-focussed).

    - [ ] Bubbles
    - [ ] Verbose
    Nr   r   r   r    r  r  .  ra   r   r  c                      e Zd ZdZy)AppFocuszSent when the app has focus.

    - [ ] Bubbles
    - [ ] Verbose

    Note:
        Only available when running within a terminal that supports
        `FocusIn`, or when running via textual-web.
    Nr   r   r   r    r  r  6  r>   r   r  c                      e Zd ZdZy)AppBlurzSent when the app loses focus.

    - [ ] Bubbles
    - [ ] Verbose

    Note:
        Only available when running within a terminal that supports
        `FocusOut`, or when running via textual-web.
    Nr   r   r   r    r  r  B  r>   r   r  c                  0    e Zd ZU dZded<   	 edd       Zy)DescendantFocuszOSent when a child widget is focussed.

    - [X] Bubbles
    - [X] Verbose
    r   r   c                    | j                   S )z0The widget that was focused (alias of `widget`).r   r+   s    r    r   zDescendantFocus.controlY       {{r   Nr.   r   r   r   r   r   r;   r   r   r   r   r    r  r  N  #     N& r   r  c                  0    e Zd ZU dZded<   	 edd       Zy)DescendantBlurzNSent when a child widget is blurred.

    - [X] Bubbles
    - [X] Verbose
    r   r   c                    | j                   S )z0The widget that was blurred (alias of `widget`).r   r+   s    r    r   zDescendantBlur.controlj  r  r   Nr  r  r   r   r    r"  r"  _  r   r   r"  c                  ,     e Zd ZdZd fdZddZ xZS )Pasteaw  Event containing text that was pasted into the Textual application.
    This event will only appear when running in a terminal emulator that supports
    bracketed paste mode. Textual will enable bracketed pastes when an app starts,
    and disable it when the app shuts down.

    - [X] Bubbles
    - [ ] Verbose


    Args:
        text: The text that has been pasted.
    c                0    t         |           || _        y r$   )r&   r'   text)r(   r'  r)   s     r    r'   zPaste.__init__  s    	'r   c              #  ,   K   d| j                   f y w)Nr'  )r'  r+   s    r    r,   zPaste.__rich_repr__  s     diir-   )r'  rG   r.   r/   r0   r1   r3   s   @r    r%  r%  p  s    (
 r   r%  c                      e Zd ZdZy)ScreenResumezSSent to screen that has been made active.

    - [ ] Bubbles
    - [ ] Verbose
    Nr   r   r   r    r*  r*    ra   r   r*  c                      e Zd ZdZy)ScreenSuspendzUSent to screen when it is no longer active.

    - [ ] Bubbles
    - [ ] Verbose
    Nr   r   r   r    r,  r,    ra   r   r,  c                  .     e Zd ZdZdd fdZddZ xZS )Printak  Sent to a widget that is capturing [`print`][print].

    - [ ] Bubbles
    - [ ] Verbose

    Args:
        text: Text that was printed.
        stderr: `True` if the print was to stderr, or `False` for stdout.

    Note:
        Python's [`print`][print] output can be captured with
        [`App.begin_capture_print`][textual.app.App.begin_capture_print].
    c                @    t         |           || _        	 || _        y r$   )r&   r'   r'  stderr)r(   r'  r0  r)   s      r    r'   zPrint.__init__  s"    	(Gr   c              #  D   K   | j                    | j                   y wr$   )r'  r0  r+   s    r    r,   zPrint.__rich_repr__  s     iikks    r  )r'  rG   r0  r[   r.   r/   r0   r1   r3   s   @r    r.  r.    s    Hr   r.  c                  <    e Zd ZU dZded<   	 dZded<   	 dZded<   y)	DeliveryCompletez+Sent to App when a file has been delivered.rG   r}   NzPath | Nonepathr   r   )r   r   r   r   r;   r4  r   r   r   r    r3  r3    s/    5	H
 D+ D*Er   r3  c                  8    e Zd ZU dZded<   	 ded<   	 dZded<   y)	DeliveryFailedz'Sent to App when a file delivery fails.rG   r}   BaseException	exceptionNr   r   )r   r   r   r   r;   r   r   r   r    r6  r6    s#    1	H8<D*Er   r6  )r}   rG   r.   rG   )Nr   
__future__r   dataclassesr   pathlibr   typingr   r   r   	rich.reprrich
rich.styler	   typing_extensionsr
   textual._typesr   textual.geometryr   r   textual.keysr   textual.messager   r   textual.domr   textual.timerr   
TimerClassr   textual.widgetr   reprautor   r"   r7   r=   r@   rC   rJ   r^   r`   rc   re   rg   ri   rk   rv   rz   r|   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r"  r%  r*  r,  r.  r3  r6  r   r   r    <module>rK     ss   # !  / /   " ' ) ) #m<8#1+% )G ) ) (uUD ( ( U5  	5 	5 $U $52U5 52peE4 E% eE5 5 5 E%  (5 ( (* (5 ( (&' ' 0Q* 0Q 0Qf) m
D m
 m
` 
4   
4   jt   jt   JtT   z$   jt  U"Jt U"p "E% " "6E$ 0E$ 24E% 4,5 	uU 		eE 	 eD$    U4     E$    .5 E%  E%  6 FuU F F$ 
FU5 
F 
Fr   