
    CjK                      % S r SSKJr  SSKJrJrJr  SSKJr  SSK	J
r
  SSKJr  SSKJr  SSKJr  SS	KJrJrJrJrJrJrJrJrJrJrJrJrJr  SS
Kr SSK!J"r"J#r#J$r$J%r%J&r&  SSK!J'r(  SSK)J*r*  SSK+J,r,  SSK-J.r.  SSK/J0r0  SSK1J2r2  SSK3J4r4  \(       a  SSK5J'r'  SSK6J7r7J8r8J9r9J:r:  SSK;J<r<J=r=J>r>J?r?  SSK@JArAJBrB  SSKCJDrD  SSKEJFrF  SSKGJHrH  SSKIJJrJ  SSKKJLrL  SSKMJNrN  SSKOJPrP  SSKQJRrR  SSKSJTrT  SSKUJVrV  SS KWJXrXJYrY  SS!KZJ[r[  SS"K\J]r]  SS#K^J_r_J`r`  SS$KaJbrb  SS%KcJdrd  SS&KeJfrfJgrg  SS'KhJiriJjrj  SS(KkJlrlJmrm  SS)KnJoroJprpJqrqJrrrJsrsJtrtJuruJvrv  SS*KwJxrxJyry  SS+KzJ{r{  SS,K|J}r}  SS-K~JrJr  SS.KJr  SS/KJr  SS0KJr  SS1KJr  SS2KJr  SS3KJr  SS4KJr  SSKJ.r  SS5KJrJrJr  \(       a,  SS6K5JrJr  SS7KeJr  SS8KJr  SS9KJr  SS:KJrJrJrJrJrJrJr  S;S<S=S>.rS?\S@'   \9GRJ                  \9GRL                  \9GRN                  4r\9GRR                  \9GRT                  \9GRV                  \9GRX                  4r\ GR\                  GR^                   " SA SB5      5       r " SC SD5      r " SE SF\5      r " SG SH\5      r " SI SJ\5      r " SK SL\5      r " SM SN5      r " SO SP\5      r\ GR\                  GR^                   " SQ SR\l5      5       rg
)SzK
This module contains the `Widget` class, the base class for all widgets.

    )annotations)create_taskgatherwait)Counter)asynccontextmanager)Fraction)	monotonic)TracebackType)TYPE_CHECKINGAsyncGeneratorCallableClassVar
Collection	GeneratorIterableMapping
NamedTupleSequenceTypeVarcastoverloadN)ConsoleConsoleOptionsConsoleRenderableJustifyMethodRenderableType)RenderResult)Measurement)Segment)Style)Text)Self)
StylesBase)	constantserrorseventsmessages)DEFAULT_EASING
AnimatableBoundAnimatorEasingFunction)DockArrangeResultarrange)NoActiveAppError)get_caller_file_and_linedispatch_key)DEFAULT_SCROLL_EASING)Extrema)StylesCache)AnimationLevel)
SkipAction)AwaitRemove)BoxModel)	FIFOCacheLRUCache)Color)compose)ContentContentType)match)parse_selectors)	NoMatches	WrongType)ScalarScalarOffset)DOMNodeNoScreen)NULL_REGION	NULL_SIZENULL_SPACINGOffsetRegionSizeSpacingclamp)LayoutWidgetPlacement)VerticalLayout)Message)CallbackTypePrune)SeverityLevel)Reactive)Blank)RLock)	Selection)Strip)
NULL_STYLE)Visual
VisualType	visualize)AppComposeResult)	QueryType)
LineFilter)MessagePump)	ScrollBarScrollBarCorner
ScrollDown
ScrollLeftScrollRightScrollToScrollUpleftrightfull)startendjustifyzdict[str, JustifyMethod]_JUSTIFY_MAPc                  @    \ rS rSrSrS	S jrS
S jrSS jrSS jrSr	g)
AwaitMount   zAn *optional* awaitable returned by [mount][textual.widget.Widget.mount] and [mount_all][textual.widget.Widget.mount_all].

Example:
    ```python
    await self.mount(Static("foo"))
    ```
c                :    Xl         X l        [        5       U l        g N)_parent_widgetsr0   _caller)selfparentwidgetss      `/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/textual/widget.py__init__AwaitMount.__init__   s    /1    c              #  n   #    SU R                   4v   SU R                  4v   SU R                  S 4v   g 7f)Nr|   r}   caller)rx   ry   rz   r{   s    r~   __rich_repr__AwaitMount.__rich_repr__   s4     $$&&d**s   35c                $   #    U I Sh  vN   g N7f)z%Allows awaiting via a call operation.N r   s    r~   __call__AwaitMount.__call__   s     

   c                >   ^  SU 4S jjnU" 5       R                  5       $ )Nc                   >#    TR                   (       a  TR                    V s/ s H%  n [        U R                  R                  5       SS9PM'     nn U(       ag  [        U5      I S h  vN   TR                  R                  SS9   TR                  R                  R                  TR                  R                  5        g g g s  sn f  N_! [         a     g f = f7f)Nzawait mount)nameTlayout)
ry   r   _mounted_eventr   rx   refreshapp_update_mouse_overscreenrG   )widgetawsr{   s     r~   await_mount)AwaitMount.__await__.<locals>.await_mount   s     }} #'--"/   5 5 : : <=Q"/   s)OOLL(((5((;;DLL<O<OP	  
 $ $ s@    C,CC&C'C9C >	C
CCCCreturnNone)	__await__)r{   r   s   ` r~   r   AwaitMount.__await__   s    	 }&&((r   )rz   rx   ry   N)r|   Widgetr}   zSequence[Widget]r   r   r   zrich.repr.Resultr   )r   zGenerator[None, None, None])
__name__
__module____qualname____firstlineno____doc__r   r   r   r   __static_attributes__r   r   r~   rt   rt      s    2
+
)r   rt   c                  ^    \ rS rSrSr        SS jr      S	S jr      S
S jrSrg)_Styled   zApply a style to a renderable.

Args:
    renderable: Any renderable.
    style: A style to apply across the entire renderable.
c                (    Xl         X l        X0l        g rw   )
renderablestyle
link_style)r{   r   r   r   s       r~   r   _Styled.__init__   s     %
$r   c                  ^^^ UR                  U R                  5      nUR                  U R                  U5      n[        mU(       a  UR
                  mUU4S jU 5       nU R                  mT(       a  UU4S jU 5       nU$ )Nc              3  J   >#    U  H  u  pnT" UT" U5      S 5      v   M     g 7frw   r   ).0text_stylecontrol_Segmentapplys       r~   	<genexpr>+_Styled.__rich_console__.<locals>.<genexpr>   s-      -<)D' uV}d33-<s    #c              3     >#    U  H;  u  pnUc  M  T" UUR                   c  UOSUR                  ;   a  UT-   OUU5      v   M=     g 7f)Nz@click)_metameta)r   r   r   r   r   r   s       r~   r   r      s]       -<(D !;;. 4<

4Jej0PU  -<s
   
A5A)	get_styler   renderr   r    __add__r   )r{   consoleoptionsr   result_segmentsr   r   r   s        @@@r~   __rich_console___Styled.__rich_console__   st     !!$**-!..'BMME-<O __
 -<O r   c                D    [         R                  " XU R                  5      $ rw   )r   getr   )r{   r   r   s      r~   __rich_measure___Styled.__rich_measure__   s     wAAr   )r   r   r   N)r   z'ConsoleRenderable'r   r!   r   Style | Noner   r   )r   	'Console'r   'ConsoleOptions'r   z'RichRenderResult')r   r   r   r   r   r   )	r   r   r   r   r   r   r   r   r   r   r   r~   r   r      sj    %-%6;%IU%	% +;	<B B+;B	Br   r   c                  0    \ rS rSr% SrS\S'    S\S'   Srg)	_RenderCache   z$Stores results of a previous render.rM   sizelist[Strip]linesr   Nr   r   r   r   r   __annotations__r   r   r   r~   r   r      s    .
J!!r   r   c                      \ rS rSrSrSrg)WidgetError   zBase widget error.r   Nr   r   r   r   r   r   r   r   r~   r   r      s    r   r   c                      \ rS rSrSrSrg)
MountError   z=Error raised when there was a problem with the mount request.r   Nr   r   r   r~   r   r      s    Gr   r   c                  <    \ rS rSr% SrS\S'    S\S'    S\S'   Srg)	PseudoClasses   zfUsed for render/render_line based widgets that use caching. This structure can be used as a
cache-key.boolenabledfocushoverr   Nr   r   r   r~   r   r      s!     MKKr   r   c                  :    \ rS rSrSrSS jrS	S jrS
SS jjrSrg)_BorderTitle   z Descriptor to set border titles.c                    SU 3U l         g )N__internal_name)r{   ownerr   s      r~   __set_name___BorderTitle.__set_name__   s     !$jr   c                @   [        U[        5      (       a  [        R                  " U5      nUc  [	        XR
                  S5        OIUR                  U5      R                  S5      nUR                  5       S   n[	        XR
                  U5        UR                  5         g)z-Setting a title accepts a str, Text, or None.N   r   )

isinstancer"   r>   from_rich_textsetattrr   
render_strexpand_tabssplitr   )r{   objtitle	new_titles       r~   __set___BorderTitle.__set__   sy    eT""**51E=C,,d3 u-99!<I!)!,IC,,i8r   Nc                N    [        XR                  S5      nUc  gUR                  $ )z<Getting a title will return None or a str as console markup.N)getattrr   markup)r{   r   objtyper   s       r~   __get___BorderTitle.__get__  s&    $S*=*=tD=||r   r   )r   r   r   strr   r   )r   r   r   zText | ContentType | Noner   r   rw   )r   r   r   ztype[Widget] | Noner   
str | None)	r   r   r   r   r   r   r   r   r   r   r   r~   r   r      s    *) r   r   c                      \ rS rSrSrSrg)BadWidgetNamei  zHRaised when widget class names do not satisfy the required restrictions.r   Nr   r   r   r~   r  r    s    Rr   r  c                    ^  \ rS rSr% SrSr\" 5       rS\S'    Sr	S\S'    Sr
S\S	'    S
rS\S'    SrS\S'    SrS\S'    SrS\S'    SrS\S'    SrS\S'    \" S5      rS\S'    \" S5      rS\S'    \" S5      rS\S'    \" S5      rS\S'    \" \SS9rS\S'    \" S5      rS\S'    \" S5      rS\S '    \" \" S!S!5      SS"9r \" SSS9rS\S#'    \" SSS9rS\S$'    \" S%SSS&9rS'\S('    \" S%SSS&9rS'\S)'    \" S%SS9r  \" S%SS9r! \" SSS"9r"S\S*'    \" SSS"9r#S\S+'    \$" 5       r% \$" 5       r& S!r'S,\S-'   0 S.S/ _S0S1 _S2S3 _S4S5 _SS6 _S7S8 _S9S: _S;S< _S=S> _S?S@ _SASB _SCSD _SESF _SGSH _SISJ _SKSL _SMSN _SO SP SQ.Er(SR\SS'   S
S
S
SSST.             GShU 4SU jjjr)\*GSiSV j5       r+\*GSjSW j5       r,\*GSjSX j5       r-\*GSiSY j5       r.\*GSiSZ j5       r/\*GSiS[ j5       r0\*GSiS\ j5       r1\*GSkS] j5       r2\2Rf                  GSlS^ j5       r2\*GSmS_ j5       r4\*GSiS` j5       r5\*GSiSa j5       r6\*GSiSb j5       r7\*GSiSc j5       r8\*GSnSd j5       r9\*GSoSe j5       r:\;S
Sf.       GSpSg jj5       r<GSiSh jr=GSqSi jr>GSrSj jr?GSrSk jr@GSsSl jrA    GStSm jrBGSrSn jrCGSuGSvSo jjrDGSrSp jrEGSrSq jrFGSiSr jrG\*GSwSs j5       rH\HRf                  GSxSt j5       rHGSySu jrIGSiSv jrJGSiSw jrKGSsSx jrL\*GSiSy j5       rM\*GSiSz j5       rN\*GSiS{ j5       rO\*GSiS| j5       rP\*GSiS} j5       rQ\*GSiS~ j5       rR\*GSiS j5       rS\*GSiS j5       rTGSzS jrU        GS{S jrVGSrS jrWGSnS jrXGS|S jrYGS|S jrZ\[" SS S9r\\](       a  \^GS}S j5       r_\^      GS~S j5       r_ GS     GSS jjr_\](       a  \^GS}S j5       r`\^      GS~S j5       r` GS     GSS jjr`GSS jraSS
S.       GSS jjrbSS.     GSS jjrcGSS jrd\^GSS j5       re\^GSS j5       reGSS jreGSGSS jjrfGSrS jrgGSS jrhGSS jriS
S
S.       GSS jjrjGSrS jrkS
S
S.       GSS jjrlS
S
S.       GSS jjrm\](       a,  \^S
S.       GSS jj5       rn\^S
S.       GSS jj5       rnS
S
S.       GSS jjrnGSS jroGSrS jrpGSrS jrqGSS jrr  GS             GSS jjrsGSS jrtGSS jru      GSS jrvGSS jrwGSS jrxGSS jryGSS jrzGSS jr{GSS jr|\*GSS j5       r}\*GSS j5       r~\*GSiS j5       r\*GSiS j5       r\*GSiS j5       r\*GSiS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       rGSrS jr\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSkS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSiS j5       r\*GSiS j5       r\*GSS j5       r\*GSkS j5       r\*GSkS j5       r\*GSS j5       r\*GSiS j5       r\*GSiS j5       r\*GSiS j5       r          GSS jrSS
S
S%\S
SS.                   GSS jjrGSuGSS jjr\*GSS j5       r\*GSiS j5       r\*GSiS j5       r\*GSiS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSS j5       r\*GSnS j5       rGSS jrGSS jr  GSSS
S
S
SS
SSS.                     GSS jjjr\*GSiS j5       rGSS jrGSS jr  GSSS
S
S
SS
SSSS.	                       GSS jjjr  GSSS
S
S
SS
SSS.                     GSS jjjrSS
S
S
SS
SSSSS.
                     GSS jjrSS
S
S
SS
SSSSS.
                     GSS jjrSS
S
S
SS
SSS.                 GSS jjrSS
S
S
SS
SS.               GSS jjrSS
S
S
SS
SSS.                 GSS jjrSS
S
S
SS
SS.               GSS jjrSS
S
S
SS
SSS.                 GSS jjrSS
S
S
SS
SS.               GSGS  jjrSS
S
S
SS
SSS.                 GSGS jjrSS
S
S
SS
SS.               GSGS jjrSS
S
S
SS
SS.               GSGS jjrSS
S
S
SS
SS.               GSGS jjrSS
S
S
SS
SS.               GSGS jjrSS
S
S
SS
SS.               GSGS jjrSS
S
S
SSSSS
SSGS.                         GSGS jjrS
SS
S
S
SSSSS
SSSSGS	.                               GSGS
 jjr GSuS
S
SS
SS
SSGS.                   GSGS jjjr GSuS
S
S
SSS
SSGS.                     GSGS jjjrGSGS jrGSGS jr    GS         GSU 4GS jjjrGSGS jrGSGS jrGSGS jrGSGS jr\*GSGS j5       rGSGS jr      GSGS jrGSGS jrGSGS jr GSu         GSGS jjrGSGS jr\*GSGS j5       rGSGS jrGSGS jrGSrGS  jrGSGS! jrGSGS" jrGSGS# jrGSrGS$ jrGSGS% jrGSrGS& jrSSSGS'.         GSGS( jjrGSGS) jr GS   GSGS* jjr\GSGS+ j5       rGSGS, jrGSGS- jr GS     GSGS. jjrGSU 4GS/ jjrGSGS0 jrGSrGS1 jrGSGS2 jrGSrGS3 jrGSuGSGS4 jjrGSzGS5 jrGSuGSGS6 jjrGSrGS7 jrGSrGS8 jrGSGSGS9 jjrGSrGS: jrGSU 4GS; jjrGSGS< jrGSrU 4GS= jjrGSGS> jrGSGS? jrGSGS@ jrGSGSA jrGSGSB jrGSGSC jGr GSrGSD jGrGSGSE jGrGSGSF jGrGSGSG jGrGSGSH jGrGSGSI jGrGSGSJ jGrGSGSK jGrGSGSL jGr	GSGSM jGr
GSGSN jGrGSGSO jGrGSGSP jGrGSGSQ jGrGSGSR jGrGSGSS jGrGSGST jGrGSGSU jGrGSGSV jGrGSGSW jGrGSrGSX jGrGSrGSY jGrGSrGSZ jGrGSrGS[ jGrGSrGS\ jGrGSrGS] jGrGSrGS^ jGrGSrGS_ jGrGSrGS` jGrGSrGSa jGrGSrGSb jGrSGScS
SGSd.           GSGSe jjGr    GS         GSGSf jjGr!GSgGr"U =Gr#$ (  r   i  z
A Widget is the base class for Textual widgets.

See also [static][textual.widgets._static.Static] for starting point for your own widgets.
a  
    Widget{
        scrollbar-background: $scrollbar-background;
        scrollbar-background-hover: $scrollbar-background-hover;
        scrollbar-background-active: $scrollbar-background-active;
        scrollbar-color: $scrollbar;
        scrollbar-color-active: $scrollbar-active;
        scrollbar-color-hover: $scrollbar-hover;
        scrollbar-corner-color: $scrollbar-corner-color;
        scrollbar-size-vertical: 2;
        scrollbar-size-horizontal: 1;
        link-background: $link-background;
        link-color: $link-color;
        link-style: $link-style;
        link-background-hover: $link-background-hover;
        link-color-hover: $link-color-hover;
        link-style-hover: $link-style-hover;
        background: transparent;
    }
    zClassVar[set[str]]COMPONENT_CLASSES zClassVar[str]BORDER_TITLEBORDER_SUBTITLENzClassVar[bool | None]ALLOW_MAXIMIZETzClassVar[bool]ALLOW_SELECTFOCUS_ON_CLICKFBLANKr   	can_focuscan_focus_childrenzReactive[bool]expandshrink
auto_linksdisabled)repaintzReactive[Style]hover_stylezReactive[str]highlight_link_idloadingr   r   	has_focusmouse_hoverg        )r  r   zReactive[float]scroll_xscroll_yshow_vertical_scrollbarshow_horizontal_scrollbarzClassVar[int]_sort_orderr   c                    U R                   $ rw   )r  r   s    r~   <lambda>Widget.<lambda>  s
     2 2r   r   c                    U R                   $ rw   r  r  s    r~   r  r    s
     0 0r   blurc                $    U R                   (       + $ rw   r!  r  s    r~   r  r    s    6#3#33r   z	can-focusc                "    U R                  5       $ rw   )allow_focusr  s    r~   r  r    s    F$6$6$8r   c                    U R                   $ rw   is_disabledr  s    r~   r  r    s
    6#5#5r   r   c                $    U R                   (       + $ rw   r'  r  s    r~   r  r    s    f&8&8"8r   darkc                B    U R                   R                  R                  $ rw   r   current_themer*  r  s    r~   r  r    s    vzz77<<r   lightc                L    U R                   R                  R                  (       + $ rw   r,  r  s    r~   r  r    s    FJJ$<$<$A$A Ar   zfocus-withinc                    U R                   $ rw   )has_focus_withinr  s    r~   r  r    s
    v'>'>r   inlinec                .    U R                   R                  $ rw   )r   	is_inliner  s    r~   r  r    s    !5!5r   ansic                .    U R                   R                  $ rw   )r   native_ansi_colorr  s    r~   r  r    s    vzz;;r   nocolorc                .    U R                   R                  $ rw   )r   no_colorr  s    r~   r  r    s    &**"5"5r   zfirst-of-typec                    U R                   $ rw   )first_of_typer  s    r~   r  r    s
    (<(<r   zlast-of-typec                    U R                   $ rw   )last_of_typer  s    r~   r  r    s
    v':':r   zfirst-childc                    U R                   $ rw   )first_childr  s    r~   r  r    s
    f&8&8r   z
last-childc                    U R                   $ rw   )
last_childr  s    r~   r  r    s
    V%6%6r   oddc                    U R                   $ rw   is_oddr  s    r~   r  r    s    fmmr   c                    U R                   $ rw   )is_evenr  s    r~   r  r    s    v~~r   c                    U R                   $ rw   )is_emptyr  s    r~   r  r    s    r   )evenemptyz-ClassVar[dict[str, Callable[[Widget], bool]]]_PSEUDO_CLASSES)r   idclassesr  r   c               H  > XPl         [        nXpl        Xpl        SU l        SU l        SU l        SU l        SU l        SU l	        [        5       U l        SU l        [        =R                  S-  sl        [        R                  U l        SU l        SU l        SU l        SU l        SU l        SU l        0 U l         SU l         SU l         [3        U/ 5      U l        [7        5       U l        [7        5       U l        [=        S5      U l        SU l         SU l!        [E        S5      U l#        [I        5       U l%        0 U l&        0 U l'        SU l(         SU l)         [7        5       U l*         [V        T	U ]  UUUc  U RZ                  OUS	9  X;   a  []        S
5      eU H'  n[_        U[        5      (       a  M  [a        SU< 35      e   [c        U5      U l2        U Rg                  [        Rh                  U5        U Rj                  (       a  U Rj                  U l6        U Rn                  (       a  U Rn                  U l8        [s        5       U l:         SU l;         SU l<          SU l=         SU l>         SU l?         SU l@         SU lA         SU lB         [        5       U lD         [        5       U lF        g)a
  Initialize a Widget.

Args:
    *children: Child widgets.
    name: The name of the widget.
    id: The ID of the widget in the DOM.
    classes: The CSS classes for the widget.
    disabled: Whether the widget is disabled or not.
    markup: Enable content markup?
Fr   N      Nr   r   )r   rN  rO  z A widget can't be its own parentz;Widget positional arguments must be Widget subclasses; not )rR  F)G_render_markuprI   _size_container_size_layout_required_layout_updates_repaint_required_scroll_required_recompose_required_refresh_styles_requiredrR   _default_layout_animater   r  
sort_orderhighlight_style_vertical_scrollbar_horizontal_scrollbar_scrollbar_corner_border_title_border_subtitle_layout_cache_visual_style_visual_style_cache_keyr   _render_cacheset_dirty_regions_repaint_regionsr;   _box_model_cache_content_width_cache_content_height_cacher:   _arrangement_cacher5   _styles_cache_rich_style_cache_visual_style_cache_tooltipabsolute_offset_scrollbar_changessuperr   DEFAULT_CLASSESr   r   	TypeErrorlist_pending_childrenset_reactiver  r  border_titler  border_subtitlerY   lock	_anchored_anchor_released_cover_widget_first_of_type_last_of_type_first_child_last_child_oddr
   _last_scroll_timer4   _extrema)
r{   r   rN  rO  r  r   children
_null_sizechild	__class__s
            r~   r   Widget.__init__  s   & %

) % !& %#( (-%-/.2a ,,-159 7;"9=-10402N15%,.$$)*b9+.5-0U<DRL 9B!9B" aL 	 )]MOGI +/".2I:=%+,3OD(( 	 	
 @AAEeV,,QRWQZ[  
 "&h&//84 $ 1 1D#'#7#7D G		  %,&++G,0L0;=/:<.9;-8:&1	3!*"	Gr   c                    U R                   $ )z Check if this widget is mounted.)_is_mountedr   s    r~   
is_mountedWidget.is_mounted  s     r   c                t    U R                   nUb(  [        UR                  5      nUR                  U 5        U$ / $ )zdGet the widget's siblings (self is removed from the return list).

Returns:
    A list of siblings.
)r|   r{  _nodesremove)r{   r|   siblingss      r~   r  Widget.siblings$  s7     FMM*HOOD!OIr   c                    U R                    Vs/ s H*  oR                  (       d  M  UR                  (       d  M(  UPM,     nnU$ s  snf )zHA list of siblings which will be shown.

Returns:
    List of siblings.
)r  visibledisplay)r{   r   r  s      r~   visible_siblingsWidget.visible_siblings3  s<     "&
!.v..FV^^F 	 
 
s   AAAc                l    U R                  5       (       a  gU R                  =(       a    U R                  $ )ztCheck if vertical scroll is permitted.

May be overridden if you want different logic regarding allowing scrolling.
F)_check_disabledis_scrollabler  r   s    r~   allow_vertical_scrollWidget.allow_vertical_scroll?  s-     !!!!Bd&B&BBr   c                l    U R                  5       (       a  gU R                  =(       a    U R                  $ )zvCheck if horizontal scroll is permitted.

May be overridden if you want different logic regarding allowing scrolling.
F)r  r  r  r   s    r~   allow_horizontal_scrollWidget.allow_horizontal_scrollI  s-     !!!!Dd&D&DDr   c                f    U R                   =(       a    U R                  =(       d    U R                  $ )zhCheck if both axis may be scrolled.

Returns:
    True if horizontal and vertical scrolling is enabled.
)r  r  r  r   s    r~   _allow_scrollWidget._allow_scrollS  s+     !! 
((FD,F,F	
r   c                L    U R                   c  U R                  $ U R                   $ )zCheck if the widget may be maximized.

Returns:
    `True` if the widget may be maximized, or `False` if it should not be maximized.
)r  r  r   s    r~   allow_maximizeWidget.allow_maximize^  s$     "&!4!4!<t~~U$BUBUUr   c                    U R                   R                  R                  U R                  U R                  R                  5      $ )z:Widget offset from origin.

Returns:
    Relative offset.
)stylesoffsetresolver   r   r   s    r~   r  Widget.offsetg  s/     {{!!))$))T[[5E5EFFr   c                N    [         R                  " U5      U R                  l        g rw   )rE   from_offsetr  r  )r{   r  s     r~   r  r  p  s    )55f=r   c                    Sn[        U R                  5       H%  nXR                  R                  -  nU(       a  M$    U$    U$ )zTotal opacity of widget.      ?)reversedancestors_with_selfr  opacity)r{   r  nodes      r~   r  Widget.opacityt  sD     T556D{{***G7	 7 r   c                    U R                   $ )ziIs this widget anchored?

See [anchor()][textual.widget.Widget.anchor] for an explanation of anchoring.

)r  r   s    r~   is_anchoredWidget.is_anchored~  s     ~~r   c                    U R                   R                  (       d  gU R                   R                  " U R                  R                  6  H  u  pXL d  M    g   g)zIs the mouse currently over this widget?

Note this will be `True` if the mouse pointer is within the widget's region, even if
the mouse pointer is not directly over the widget (there could be another widget between
the mouse pointer and self).

FT)r   	is_activeget_widgets_atr   mouse_position)r{   r   r   s      r~   is_mouse_overWidget.is_mouse_over  sG     {{$$33TXX5L5LMIF~ N r   c                T     U R                   R                  U L $ ! [         a     gf = f)zIs this widget maximized?F)r   	maximizedrG   r   s    r~   is_maximizedWidget.is_maximized  s.    	;;((D00 		s    
''c                r    U R                   R                  nU(       d  gU R                   H	  nXL d  M	    g   g)z&Is this widget, or a parent maximized?FT)r   r  r  )r{   r  r  s      r~   is_in_maximized_viewWidget.is_in_maximized_view  s7     KK))	,,D  - r   c                8    U R                   b  U R                   $ U $ )z(The widget the compositor should render.)r  r   s    r~   _render_widgetWidget._render_widget  s      &*%7%7%Ct!!MMr   c                N    U R                   R                  R                  U S5      $ )zLText selection information, or `None` if no text is selected in this widget.N)r   
selectionsr   r   s    r~   text_selectionWidget.text_selection  s!     {{%%))$55r   defaultc                   UR                   n[        UR                   5      nU H#  nXe;   d  M
  [        U[        5      (       d   eUs  $    Ub  U$ [	        S5      e)ac  Get a common ancestors to both widgets.

Raises:
    ValueError: If there is no common ancestor and `default` is not provided (will not occur if both widgets are attached to the same DOM).

Args:
    widget1: A Widget.
    widget2: A second widgets.
    default: A widget to return if no common ancestor is found.

Returns:
    A common ancestor widgets.
zNo common ancestor found)	ancestorsrk  r   r   
ValueError)clswidget1widget2r  
ancestors1
ancestors2r  s          r~   get_common_ancestorWidget.get_common_ancestor  s`    " &&
**+
D!!$////  N344r   c                    U R                   $ )a  Automatically focus the widget on click?

Implement this if you want to change the default click to focus behavior.
The default will return the classvar `FOCUS_ON_CLICK`.

Returns:
    `True` if Textual should set focus automatically on a click, or `False` if it shouldn't.
)r	  r   s    r~   focus_on_clickWidget.focus_on_click  s     """r   c                6    U R                   R                  5       $ )z~Get the line filters enabled for this widget.

Returns:
    A sequence of [LineFilter][textual.filters.LineFilter] instances.
)r   get_line_filtersr   s    r~   r  Widget.get_line_filters  s     xx((**r   c                    [        U S5      (       aK  SSKJn  [        X5      (       d4  U R                  R                  SU R                  R                   S35        ggg)zCalled in debug mode to do preflight checks.

This is used by Textual to log some common errors, but you could implement this
in custom widgets to perform additional checks.

CSSr   )Screen'zD.CSS' will be ignored (use 'DEFAULT_CSS' class variable for widgets)N)hasattrtextual.screenr  r   logwarningr  r   )r{   r  s     r~   preflight_checksWidget.preflight_checks  sS     4-d++  //00tu ,  r   c                    SU l         g)zsCalled prior to rendering.

If you implement this in a subclass, be sure to call the base class method via super.

N)rh  r   s    r~   
pre_renderWidget.pre_render  s     "r   c                    U R                  5         Xl        Xl        UR                  5         UR	                  U R
                  5        U R
                  R                  R                  U5        U R                  SS9  g)zSet a widget used to replace the visuals of this widget (used for loading indicator).

Args:
    widget: A newly constructed, but unmounted widget.
Tr   N)	_uncoverr  rx   _start_messages_post_registerr   
stylesheetr   r   )r{   r   s     r~   _coverWidget._cover  s\     	# dhh'!!&)D!r   c                    U$ )au  A hook to allow for the manipulation of widget placements before rendering.

You could use this as a way to modify the positions / margins of widgets if your requirement is
not supported in TCSS. In practice, this method is rarely needed!

Args:
    placements: A list of [`WidgetPlacement`][textual.layout.WidgetPlacement] objects.

Returns:
    A new list of placements.
r   )r{   
placementss     r~   process_layoutWidget.process_layout	  s
     r   c                    U R                   b1  U R                   R                  5         SU l         U R                  SS9  gg)zORemove any widget, previously set via [`_cover`][textual.widget.Widget._cover].NTr   )r  r  r   r   s    r~   r  Widget._uncover  s;    )%%'!%DLLL% *r   c                @    Xl         U(       a  U R                  SSS9  gg)zAnchor a scrollable widget.

An anchored widget will stay scrolled the bottom when new content is added, until
the user moves the scroll position.

Args:
    anchor: Anchor the widget if `True`, clear the anchor if `False`.

TF)	immediateanimateN)r  
scroll_end)r{   anchors     r~   r  Widget.anchor   s!      OOdEO: r   c                4    U R                   U l        SU l        g)zRelease the [anchor][textual.widget.Widget].

If a widget is anchored, releasing the anchor will allow the user to scroll as normal.

TN)r  scroll_target_yr  r   s    r~   release_anchorWidget.release_anchor.  s      $}} $r   c                    U R                   (       a5  U R                  (       a#  U R                  U R                  :  a  SU l        gggg)zLCheck if the scroll position is near enough to the bottom to restore anchor.FN)r  r  r  max_scroll_yr   s    r~   _check_anchorWidget._check_anchor7  s=     NN%%!2!22$)D! 3 & r   c                @    U R                   =(       d    U R                  $ )zCheck if the widget is disabled either explicitly by setting `disabled`,
or implicitly by setting `loading`.

Returns:
    True if the widget should be disabled.
)r  r  r   s    r~   r  Widget._check_disabled@  s     }},,r   c                    U R                   $ )z1Tooltip for the widget, or `None` for no tooltip.)ru  r   s    r~   tooltipWidget.tooltipI  s     }}r   c                h    Xl          U R                  R                  U 5        g ! [         a     g f = frw   )ru  r   _update_tooltiprG   r{   r  s     r~   r  r  N  s0    	KK''- 		s   $ 
11c                    Xl         U $ )zChainable method to set a tooltip.

Example:
    ```python
    def compose(self) -> ComposeResult:
        yield Label("Hello").with_tooltip("A greeting")
    ```

Args:
    tooltip: New tooltip, or `None` to clear the tooltip.

Returns:
    Self.
)r  r  s     r~   with_tooltipWidget.with_tooltipV  s     r   c                    U R                   $ )a
  Check if the widget is permitted to focus.

The base class returns [`can_focus`][textual.widget.Widget.can_focus].
This method may be overridden if additional logic is required.

Returns:
    `True` if the widget may be focused, or `False` if it may not be focused.
)r  r   s    r~   r%  Widget.allow_focush  s     ~~r   c                    U R                   $ )a<  Check if a widget's children may be focused.

The base class returns [`can_focus_children`][textual.widget.Widget.can_focus_children].
This method may be overridden if additional logic is required.

Returns:
    `True` if the widget's children may be focused, or `False` if the widget's children may not be focused.
)r  r   s    r~   allow_focus_childrenWidget.allow_focus_childrens  s     &&&r   c                >    SnU R                   R                  U5        g)a  Add a node to children.

This is used by the compose process when it adds children.
There is no need to use it directly, but you may want to override it in a subclass
if you want children to be attached to a different node.

Args:
    widget: A Widget to add.
TN)r|  append)r{   r   _rich_traceback_omits      r~   compose_add_childWidget.compose_add_child~  s      $%%f-r   c                    U n[        U[        5      (       a5  UR                  (       a  gUR                  n[        U[        5      (       a  M5  g)zYIs the widget disabled either because `disabled=True` or an ancestor has `disabled=True`.TF)r   r   r  rx   r{   r  s     r~   r(  Widget.is_disabled  s=     $(v&&}}<<D v&& r   c                     U R                   R                  nUnUb  X L a  gUR                  nUb  M  g! [         a     gf = f)zAre any descendants focused?FT)r   focusedrG   rx   )r{   r$  r  s      r~   r1  Widget.has_focus_within  sU    	kk))G |<<D    		s   4 
A Ac                ^   U R                   nUc  gUR                  R                  U R                  S   :X  a  U R                  S   $ [	        U 5      nUR                  R
                   HB  n[        X25      (       d  M  UR                  R                  X0L 4U l        U R                  S   s  $    g)z5Is this the first widget of its type in its siblings?Tr   rQ  F)r|   r  _updatesr  type	displayedr   r{   r|   widget_typer  s       r~   r<  Widget.first_of_type  s     >==!!T%8%8%;;&&q))4jMM++D$,,'-}}'='=t|&L#**1-- , r   c                ^   U R                   nUc  gUR                  R                  U R                  S   :X  a  U R                  S   $ [	        U 5      nUR                  R
                   HB  n[        X25      (       d  M  UR                  R                  X0L 4U l        U R                  S   s  $    g)z4Is this the last widget of its type in its siblings?Tr   rQ  F)r|   r  r'  r  r(  displayed_reverser   r*  s       r~   r>  Widget.last_of_type  s     >==!!T%7%7%::%%a((4jMM33D$,,&,mm&<&<dl%K"))!,, 4 r   c                $   U R                   nUc  gUR                  R                  U R                  S   :X  a  U R                  S   $ UR                  R                   H0  nUR                  R                  X L 4U l        U R                  S   s  $    g)z)Is this the first widget in its siblings?Tr   rQ  F)r|   r  r'  r  r)  r{   r|   r  s      r~   r@  Widget.first_child  s     >==!!T%6%6q%99$$Q''MM++D!'!7!7 FD$$Q'' , r   c                $   U R                   nUc  gUR                  R                  U R                  S   :X  a  U R                  S   $ UR                  R                   H0  nUR                  R                  X L 4U l        U R                  S   s  $    g)z(Is this the last widget in its siblings?Tr   rQ  F)r|   r  r'  r  r.  r1  s      r~   rB  Widget.last_child  s     >==!!T%5%5a%88##A&&MM33D & 6 6ED##A&& 4 r   c                D   U R                   nUc  gUR                  R                  U R                  S   :X  a  U R                  S   $  UR                  R                  R                  U 5      S-  S:H  nUR                  R                  U4U l        U$ ! [         a     gf = f)zAIs this widget at an oddly numbered position within its siblings?Tr   rQ     F)r|   r  r'  r  displayed_and_visibleindexr  )r{   r|   rF  s      r~   rF  Widget.is_odd  s     >==!!TYYq\199Q<	]]88>>tDqHAMF//8DIM 		s   A	B 
BBc                $    U R                   (       + $ )zBIs this widget at an evenly numbered position within its siblings?rE  r   s    r~   rH  Widget.is_even  s     ;;r   c                V    U R                   R                  S   R                  U 5        U $ )z&Use as context manager when composing.rR  )r   _compose_stacksr  r   s    r~   	__enter__Widget.__enter__  s$      $++D1r   c                    U R                   R                  S   nUR                  5       nU(       a  US   R                  U5        gU R                   R                  S   R                  U5        g)zExit compose context manager.rR  N)r   r=  popr  	_composedr  )r{   exc_typeexc_valexc_tbcompose_stackcomposeds         r~   __exit__Widget.__exit__  sY     004 $$&"//9HHr"))(3r   c                     SU l         SU l        g)zClear cached results of `get_content_width` and `get_content_height`.

Call if the widget's renderable changes size after the widget has been created.

!!! note

    This is not required if you are extending [`Static`][textual.widgets.Static].

rT  N)ro  rp  r   s    r~   clear_cached_dimensionsWidget.clear_cached_dimensions  s     %.!%."r   c                :    U R                   R                  5       nU$ )zGet a widget to display a loading indicator.

The default implementation will defer to App.get_loading_widget.

Returns:
    A widget in place of this widget to indicate a loading.
)r   get_loading_widget)r{   loading_widgets     r~   rN  Widget.get_loading_widget  s     779r   c                    U(       a3  U R                  5       nUR                  S5        U R                  U5        OU R                  5         U R                  R                  5         g)a#  Set or reset the loading state of this widget.

A widget in a loading state will display a `LoadingIndicator` or a custom widget
set through overriding the `get_loading_widget` method.

Args:
    loading: `True` to put the widget into a loading state, or `False` to reset the loading state.
z-textual-loading-indicatorN)rN  	add_classr  r  r   update_pointer_shape)r{   r  loading_indicators      r~   set_loadingWidget.set_loading  sK      $ 7 7 9''(DEKK)*MMO((*r   c                    U R                   (       d  U R                  U R                  U5        gU R                  U5        g)z.Called when the 'loading' reactive is changed.N)r  
call_laterrU  )r{   r  s     r~   _watch_loadingWidget._watch_loading0  s+    OOD,,g6W%r   
ExpectType)boundc                    g rw   r   r{   rN  s     r~   get_child_by_idWidget.get_child_by_id;  s    69r   c                    g rw   r   r{   rN  expect_types      r~   r_  r`  >       r   c                    U R                  5       R                  R                  U5      nUc  [        SU< 35      eUc  U$ [	        X25      (       d   [        SU< SUR                  < SU 35      eU$ )ak  Return the first child (immediate descendent) of this node with the given ID.

Args:
    id: The ID of the child.
    expect_type: Require the object be of the supplied type, or None for any type.

Returns:
    The first child of this node with the ID.

Raises:
    NoMatches: if no children could be found for this ID
    WrongType: if the wrong type was found.
zNo child found with id=zChild with id=" is the wrong type; expected type , found )_get_dom_baser  
_get_by_idrB   r   rC   r   )r{   rN  rc  r  s       r~   r_  r`  C  s      ""$++66r:=5bV<==L%-- &HI]I]H``hinhop  r   c                    g rw   r   r^  s     r~   get_widget_by_idWidget.get_widget_by_id`  s    7:r   c                    g rw   r   rb  s      r~   rk  rl  c  rd  r   c                    U R                  SU 35      nUb0  [        X25      (       d   [        SU< SUR                  < SU 35      eU$ )a  Return the first descendant widget with the given ID.

Performs a depth-first search rooted at this widget.

Args:
    id: The ID to search for in the subtree.
    expect_type: Require the object be of the supplied type, or None for any type.

Returns:
    The first descendant encountered with this ID.

Raises:
    NoMatches: if no children could be found for this ID.
    WrongType: if the wrong type was found.
#zDescendant with id=rf  rg  )	query_oner   rC   r   )r{   rN  rc  r   s       r~   rk  rl  h  s]    & !B4)":f+J+J%bV+MkNbNbMeemntmuv  r   c                    U R                    H'  n[        U5      UL d  M  [        X!5      (       d   eUs  $    [        SU SU R                    35      e)a;  Get the first immediate child of a given type.

Only returns exact matches, and so will not match subclasses of the given type.

Args:
    expect_type: The type of the child to search for.

Raises:
    NoMatches: If no matching child is found.

Returns:
    The first immediate child widget with the expected type.
zNo immediate child of type z; )r  r(  r   rB   )r{   rc  r  s      r~   get_child_by_typeWidget.get_child_by_type  sS     [[EE{k)!%5555	 !
 5k]"T[[MRSSr   )partialr  c               
   X0R                   ;  a  Uc  U R                  " U6 nO U R                  " U6 nUR                  nUR                  nUS:  aj  UR
                  b]  U[        R                  " [        R                  " UR
                  5      UR                  R                  U5      -   R                  5      -  nUR                  nXW4U R                   U'   U R                   U   u  pWU(       a  U$ U$ ! [         a    Us $ f = f)aL  Get a *Rich* style for a component.

Args:
    names: Names of components.
    partial: Return a partial style (not combined with parent).
    default: A Style to return if any component style doesn't exist.

Raises:
    KeyError: If a component style doesn't exist, and no `default` is provided.

Returns:
    A Rich style object.
rQ  )rs  get_component_stylesKeyError
rich_styletext_opacitybgcolorr!   
from_colorr<   from_rich_colorcolormultiply_alpha
rich_colorpartial_rich_style)r{   rt  r  namescomponent_stylesr   ry  partial_styles           r~   get_component_rich_styleWidget.get_component_rich_style  s   " ...#'#<#<e#D #'+'@'@%'H$ %//E+88LaEMM$=))--emm<*00??MN j	  -??M-2,BD""5)#55e< '}2U2#   #"N#s   C3 3DDrt  c          
     R  ^ ^^ T R                   TT4nT R                  R                  US5      =nGc  [        SSSS5      n[        SSSS5      n[	        5       nSnSUUU 4S jjn	U	" 5        GHf  n
U
R
                  nXR                  -  nU" S5      (       a  XZR                  R                  U
R                  5      -   nT(       aT  U
R                  R                  U
R                  5      nUR                  USUR                  -
  5      R                  U5      nO:UU
R                  R                  U
R                  5      R                  U5      -  nOUnU" S5      (       a%  U
R                  R                  U
R                  5      nXzR                  -  nU" S	5      (       d  GM7  U
R                   (       d  GMK  UR#                  UR                  5      nGMi     [%        UUUR&                  UR(                  UR*                  UR,                  UR.                  S
9nUT R                  U'   U$ )zGet the visual style for the widget, including any component styles.

Args:
    component_classes: Optional component styles.
    partial: Return a partial style (not combined with parent).

Returns:
    A Visual style instance.

Nr      r  c               3     >#    T(       a  Tn O*[        TR                  5       H  n U R                  v   M     T H  nW R                  U5      v   M     g7f)zFIterate over the styles from the DOM and additional components styles.N)r  r  r  rv  )r  r   component_classesrt  r{   s     r~   iter_styles,Widget.get_visual_style.<locals>.iter_styles  sI     D ()A)A B"kk) !C-D33D99 .s   AA
backgroundrQ  r}  
auto_color)bolddimitalic	underlinestrike)r   zIterable[StylesBase])_pseudo_classes_cache_keyrt  r   r<   r!   has_ruler  r  tintbackground_tintblendar~  r}  ry  
text_styler  get_contrast_textVisualStyler  r  r  r  r  )r{   rt  r  	cache_keyvisual_styler  r}  r   r  r  r  r  text_backgroundr  s   ```           r~   get_visual_styleWidget.get_visual_style  s    335FP	 4488DIILRq!Q*J#sC+EGEG: : &-!??>>)L))&03D3D3I3I..4 'O *0*;*;*@*@AWAW*X%/%5%5+Q1B1B-B&(.1 # #"--2263I3IJ(.12
 '1OG$$"LL778K8KLE***L))f.?.?.?+==eggFE- (0 'ZZII||//||L 3?D$$Y/r   c                   [        U[        5      (       a  U$ UR                  S5      (       aT  USS nU R                   H0  n[        U[        5      (       d    [        $  UR                  USS9s  $    [        SU S35      e [        R                  " U5      $ ! [         a     Mg  f = f! [         a	    [        s $ f = f)zA get_style method for use in Content.

Args:
    style: A style prefixed with a dot.

Returns:
    A visual style if one is fund, otherwise `None`.
.rQ  NTr  z'No matching component class found for 'r  )
r   r  
startswithr  r   r  rw  r\   parse	Exception)r{   r   
style_namer  s       r~   
_get_styleWidget._get_style  s     e[))LC  qrJ00!$// 00T0JJ	 1 !HqQRR	$$U++     		s$   BB* 
B'&B'*B=<B=c                    g rw   r   r{   text_contents     r~   r   Widget.render_str"  s    8;r   c                    g rw   r   r  s     r~   r   r  %  s    <?r   c                \    [        U[        5      (       a  U$ [        R                  " U5      $ )zConvert str into a [Content][textual.content.Content] instance.

If you pass in an existing Content instance it will be returned unaltered.

Args:
    text_content: Content or str.

Returns:
    Content object.
)r   r>   from_markupr  s     r~   r   r  (  s(     lG,,""<00r   c                    XR                   R                  U4nU R                  R                  U5      nUb  U$ [	        X R                   XR
                  R                  US9=oPR                  U'   U$ )a  Arrange child widgets.

This method is best left alone, unless you have a deep understanding of what it does.

Args:
    size: Size of container.
    optimal: Whether fr units should expand the widget (`False`) or avoid expanding the widget (`True`).

Returns:
    Widget locations.
)optimal)r  r'  rq  r   r.   r   r   )r{   r   r  r  cached_resultarrangements         r~   r.   Widget.arrange7  sq     ;;//9	//33I>$  ;B++t[[%5%5w<
 	
--i8 r   c                8    U R                   R                  5         g)z9Clear arrangement cache, forcing a new arrange operation.N)rq  clearr   s    r~   _clear_arrangement_cacheWidget._clear_arrangement_cacheN  s    %%'r   c              #     #    U R                   b  U R                   v   U R                  b  U R                  v   U R                  b  U R                  v   gg7f)zGGet widgets not part of the DOM.

Returns:
    An iterable of Widgets.
N)rc  rb  rd  r   s    r~   _get_virtual_domWidget._get_virtual_domR  sT      %%1,,,##/***!!-((( .s   AAc                |   [        U[        5      (       a  X4$ [        U[        5      (       a  U R                  U[        5      nUR
                  c  [        SU< S35      e [        SUR
                  5      UR
                  R                  R                  U5      4$ ! [         a    [        U< SU < 35      Sef = f)a  Attempt to locate the point where the caller wants to mount something.

Args:
    spot: The spot to find.

Returns:
    The parent and the location in its child list.

Raises:
    MountError: If there was an error finding where to mount a widget.

The rules of this method are:

- Given an ``int``, parent is ``self`` and location is the integer value.
- Given a ``Widget``, parent is the widget's parent and location is
  where the widget is found in the parent's ``children``. If it
  can't be found a ``MountError`` will be raised.
- Given a string, it is used to perform a ``query_one`` and then the
  result is used as if a ``Widget`` had been given.
Nz$Unable to find relative location of z because it has no parentr    is not a child of )r   intr   query_exactly_oner   r|   r   r   r  r8  r  )r{   spots     r~   _find_mount_pointWidget._find_mount_point_  s    . dC  :
 dC  ))$7D ;;6th>WX 	O$++.0B0B0H0H0NNN 	Ox':4(CD$N	Os   ":B B;beforeafterc                 ^^ U R                   (       d  U R                  (       a  [        U / 5      $ U R                  (       d  [	        SU < S35      eU Vs/ s H  oDR
                  =nc  M  UPM     nn[        [        U5      5      [        U5      :w  a>  [        U5      nUR                  5        H  u  pXUS:  d  M  [	        SU< SU< S35      e   Tb  Tb  [	        S5      eSn	Sn
Tb  U R                  T5      u  pOTb  U R                  T5      u  pOU nU R                  R                  " U/UQ7XS	.6nSUU4S
 jjnU R                  XR                  5        [        X5      nU R                  U5        U$ s  snf )a  Mount widgets below this widget (making this widget a container).

Args:
    *widgets: The widget(s) to mount.
    before: Optional location to mount before. An `int` is the index
        of the child to mount before, a `str` is a `query_one` query to
        find the widget to mount before.
    after: Optional location to mount after. An `int` is the index
        of the child to mount after, a `str` is a `query_one` query to
        find the widget to mount after.

Returns:
    An awaitable object that waits for widgets to be mounted.

Raises:
    MountError: If there is a problem with the mount request.

Note:
    Only one of ``before`` or ``after`` can be provided. If both are
    provided a ``MountError`` will be raised.
zCan't mount widget(s) before z is mountedNrQ  zTried to insert z widgets with the same ID z. Widget IDs must be unique.z:Only one of `before` or `after` can be handled -- not bothr  c                   > Tc  Tb>  U  H7  nUR                   (       d  UR                  (       d  M'  UR                  5         M9     gU  H&  nUR                   (       d  M  UR                  5         M(     g)zUpdate order related CSSN)_has_order_style_has_odd_or_evenupdate_node_styles)r  r  r  r  s     r~   update_styles#Widget.mount.<locals>.update_styles  s^    !U%6 &E--1G1G1G002 & &E---002 &r   )r  zlist[DOMNode]r   r   )_closing_pruningrt   is_attachedr   rN  lenrk  r   itemsr  r   	_registerrX  displayed_children	call_next)r{   r  r  r}   r   	widget_idids_to_mountcountercountinsert_beforeinsert_afterr|   mountedr  r   s    ``            r~   mountWidget.mount  s   6 ==DMMdB''<THKPQQ %,
$+&YY0F	IG 	 
 s< !S%66l+G$+MMO 	19$*5)3Mi] [5 5  %4 %"3L  %)#'$($:$:6$B!FM#'#9#9%#@ FLF(($$

%2
	3 	3 	'>'>? /{#e
s   E:,E:c                2    SU l         U R                  5         g)z"Request refresh of styles on idle.TN)r]  
check_idler   s    r~   _refresh_stylesWidget._refresh_styles  s    (,%r   c               x    U R                   R                  (       a  [        U / 5      $ U R                  " XUS.6nU$ )a  Mount widgets from an iterable.

Args:
    widgets: An iterable of widgets.
    before: Optional location to mount before. An `int` is the index
        of the child to mount before, a `str` is a `query_one` query to
        find the widget to mount before.
    after: Optional location to mount after. An `int` is the index
        of the child to mount after, a `str` is a `query_one` query to
        find the widget to mount after.

Returns:
    An awaitable object that waits for widgets to be mounted.

Raises:
    MountError: If there is a problem with the mount request.

Note:
    Only one of `before` or `after` can be provided. If both are
    provided a `MountError` will be raised.
r  )r   _exitrt   r  )r{   r}   r  r  r   s        r~   	mount_allWidget.mount_all  s2    8 88>>dB''jj'Fr   c               4    U R                  [        X5      X#S9$ )a0  Mount widgets from the result of a compose method.

Example:
```python
    def on_key(self, event:events.Key) -> None:

        def add_key(key:str) -> ComposeResult:
            '''Compose key information widgets'''
            with containers.HorizontalGroup():
                yield Label("You pressed:")
                yield Label(key)

        self.mount_compose(add_key(event.key))

```

Args:
    compose_result: The result of a compose method.
    before: Optional location to mount before. An `int` is the index
        of the child to mount before, a `str` is a `query_one` query to
        find the widget to mount before.
    after: Optional location to mount after. An `int` is the index
        of the child to mount after, a `str` is a `query_one` query to
        find the widget to mount after.

Returns:
    An awaitable object that waits for widgets to be mounted.

Raises:
    MountError: If there is a problem with the mount request.

Note:
    Only one of `before` or `after` can be provided. If both are
    provided a `MountError` will be raised.
r  )r  r=   )r{   compose_resultr  r  s       r~   mount_composeWidget.mount_compose
  s    T ~~gd;F~XXr   )r  c                   g rw   r   )r{   r  r  r  s       r~   
move_childWidget.move_child8       r   )r  c                   g rw   r   )r{   r  r  r  s       r~   r  r  A  r  r   c                 ^  Uc  Uc  [        S5      eUb  Ub  [        S5      eSU 4S jjnU" US5      nU" [        SUc  UOU5      S5      nXL a  gT R                  R                  U5        Ub6  T R                  R	                  T R                  R                  U5      U5        O8T R                  R	                  T R                  R                  U5      S-   U5        T R                  S	S
9  g)a  Move a child widget within its parent's list of children.

Args:
    child: The child widget to move.
    before: Child widget or location index to move before.
    after: Child widget or location index to move after.

Raises:
    WidgetError: If there is a problem with the child or target.

Note:
    Only one of `before` or `after` can be provided. If neither
    or both are provided a `WidgetError` will be raised.
Nz'One of `before` or `after` is required.z/Only one of `before` or `after` can be handled.int | Widgetc                  > [        U [        5      (       a   TR                  U    n U $  TR                  R                  U 5      nU $ ! [         a    [	        SU  SU S35      Sef = f! [         a    [	        U < ST< 35      Sef = f)z+Ensure a given child reference is a Widget.zAn index of z for the child to z is out of boundsNr  )r   r  r  
IndexErrorr   r8  r  )r  calledr   r{   s      r~   
_to_widget%Widget.move_child.<locals>._to_widgetg  s    %%%  KK.E L	Y))%0A L "  %&ug-?xGXY   " Y%	1DTH&MNTXXYs   A A( A%(Bmovezmove towardsrQ  Tr   )r  r  r  r   r   r   )r   r   r  _remove_insertr8  r   )r{   r  r  r  r  targets   `     r~   r  r  J  s    0 >emGHHE$5OPP	& 5&)5=eDn
 ? 	E"KK 1 1& 95AKK 1 1& 9A =uE 	D!r   c              #  $   #    S Sh  vN   g N7f)a  Called by Textual to create child widgets.

This method is called when a widget is mounted or by setting `recompose=True` when
calling [`refresh()`][textual.widget.Widget.refresh].

Note that you don't typically need to explicitly call this method.

Example:
    ```python
    def compose(self) -> ComposeResult:
        yield Header()
        yield Label("Press the button below:")
        yield Button()
        yield Footer()
    ```
r   Nr   r   s    r~   r=   Widget.compose  s     " r   c                r   #    U R                   (       a   SU l         U R                  5       I Sh  vN   gg N7f)z!Check if a recompose is required.FN)r\  	recomposer   s    r~   _check_recomposeWidget._check_recompose  s.     ##',D$..""" $"s   ,757c                  #    U R                   (       a  U R                  (       a  gU R                  5        ISh  vN   U R                  S5      R	                  S5      R                  5       I Sh  vN   U R                   (       a$  [        U 5      nU R                  U5      I Sh  vN   SSS5      ISh  vN   g N NL N N! , ISh  vN  (       d  f       g= f7f)zbRecompose the widget.

Recomposing will remove children and call `self.compose` again to remount.
N*z.-textual-system)r  r  batchquery_childrenexcluder  r=   r  )r{   compose_nodess     r~   r  Widget.recompose  s     
 4==::<<%%c*223EFMMOOO 'nn]333	  <<O 4	  <<<sh   8CB;C2C0B=14C%B?&C*C5C6C=C?CCC	C
CCc           	         U R                  5        H-  u  p#pEU R                  R                  R                  UUSUUS9  M/     UR                  (       a  UR                  U R                  5        gg)zFCalled when the instance is registered.

Args:
    app: App instance.
T)	read_fromis_default_csstie_breakerscopeN)_get_default_cssr   r  
add_sourcedebugr  r  )r{   r   r	  cssr  r  s         r~   r  Widget._post_register  si     372G2G2I.IKHH**##' +  3J 99MM$//0 r   c           	     	   UUUUUUU R                   U R                  R                  4nU R                  R	                  U5      =n(       a  U$ U R                  n	U	R
                  S:H  n
U	R                  nU	R                  nU	R                  nU(       d*  Ub'  UR                  (       a  [        R                  " S5      nU=(       a    UR                  nU	R                  =(       a    U	R                  R                  nXR                  -
  nU R                  XX45      =nU l        Uu  nnnnUc#  [#        UR                  UR                  -
  5      nOU(       a  [#        U R%                  UUR                  -
  U5      5      nU	R&                  S:X  a  U	R(                  S:X  d  U R*                  (       a  UU	R,                  -  nUUR                  :  a&  U R.                  (       a  [#        UR                  5      nO4UR1                  XR                  -
  X#5      nU
(       a  UUR                  -  nUb  [3        UU[#        S5      5      nUbi  UR                  S:X  aM  U	R4                  R6                  (       d2  U R8                  b%  U R8                  R                  R:                  (       d  [=        UU5      n[3        [#        S5      U5      nU(       a,  [=        [#        UR                  UR                  -
  5      U5      nU	R                  c#  [#        UR                  UR                  -
  5      nOU(       a  [#        U R?                  UUR                  -
  U[A        U5      5      5      nU	RB                  S:X  a  U	R(                  S:X  d  U RD                  (       a  UU	RF                  -  nUUR                  :  a&  U RH                  (       a  [#        UR                  5      nO@U	R                  nUR1                  XR                  -
  X$5      nU
(       a  UUR                  -  nUb  [3        UU[#        S5      5      nUbi  UR                  S:X  aM  U	RJ                  R6                  (       d2  U R8                  b%  U R8                  R                  RL                  (       d  [=        UU5      n[3        [#        S5      U5      n[O        UUR                  -   UUR                  -   U5      nUU R                  U'   U$ )a  Process the box model for this widget.

Args:
    container: The size of the container widget (with a layout).
    viewport: The viewport size.
    width_fraction: A fraction used for 1 `fr` unit on the width dimension.
    height_fraction: A fraction used for 1 `fr` unit on the height dimension.
    constrain_width: Restrict the width to the container width.

Returns:
    The size and margin for this widget.

border-boxautostabler   )(rY  r  
_cache_keyrn  r   
box_sizingguttermarginwidthis_fractionrD   r  is_autoheighttotals_resolve_extremar  r	   get_content_width
overflow_xscrollbar_gutterr  scrollbar_size_vertical_has_relative_children_widthr  max	max_widthis_cellsrx   is_auto_widthminget_content_heightr  
overflow_yr  scrollbar_size_horizontal_has_relative_children_height
max_heightis_auto_heightr9   )r{   	containerviewportwidth_fractionheight_fractionconstrain_widthgreedyr  cached_box_modelr  is_border_boxr  r  styles_widthr(  r/  content_containerextrema	min_widthr&  
min_heightr.  content_widthcontent_heightstyles_heightmodels                             r~   _get_box_modelWidget._get_box_model  s   ,   KK""	
	  $4488CCC##))\9||,2|7O7O!<</L$=)=)=@6==+@+@ &5"&"7"7#
 	
$- 8?4	9j*$%6%<%<v||%KLM$&&'86=='H(SM !!V+0G0G80S--!?!?? 1 7 7755 ():)@)@ A )00MM)8M - y(1+FM OOq $$--(##11  y9MHQK76<<)G H-XM== %&7&>&>&NON%''%5&N !!V+0G0G80S//&"B"BB!2!9!9966!)*;*B*B!C"MMM*22MM)8N &--/! Xa[IN!!%%..(##22 <NXa[.9FLL(.6==*H&
 ,1i(r   c                   U R                   (       a  U R                  R                  XU5      nU$ UR                  nU R                  S   U:X  a  U R                  S   $ U R                  5       nUR                  U R                  UR                  5      nU R                  (       a  [        UR                  U5      nU R                  (       a  [        X1R                  5      nXC4U l        U$ )zCalled by textual to get the width of the content area. May be overridden in a subclass.

Args:
    container: Size of the container (immediate parent) widget.
    viewport: Size of the viewport.

Returns:
    The optimal width of the content.
r   rQ  )is_containerr   r   r  ro  _renderget_optimal_widthr  r  r%  r  r)  )r{   r0  r1  r  r  visuals         r~   r   Widget.get_content_widthY  s     KK11$8LELOO	$$Q'94,,Q//((iooF;;	/E;;/E%.$6!r   c                F   U(       d  gU R                   (       a/  U R                  c   eU R                  R                  U UUU5      nU$ UnU R                  S   U:X  a  U R                  S   $ U R	                  5       nUR                  U R                  U5      nXT4U l        U$ )a  Called by Textual to get the height of the content area. May be overridden in a subclass.

Args:
    container: Size of the container (immediate parent) widget.
    viewport: Size of the viewport.
    width: Width of renderable.

Returns:
    The height of the content.
r   rQ  )rD  r   r*  rp  rE  
get_heightr  )r{   r0  r1  r  r  r  rG  s          r~   r*  Widget.get_content_heightx  s     ;;***[[33	F   I))!,	911!44\\^F&&t{{E:F*3)<D&r   c                    U R                   (       a.  U R                  R                  (       d  UR                  U l        g g g rw   )r  r   mouse_capturedlink_idr  )r{   previous_hover_styler  s      r~   watch_hover_styleWidget.watch_hover_style  s,    
 ??488#:#:%0%8%8D" $;?r   c                    U R                   (       a  X R                  l        [        U5      [        U5      :w  a  U R	                  5         g g rw   )r  horizontal_scrollbarpositionround_refresh_scrollr{   	old_value	new_values      r~   watch_scroll_xWidget.watch_scroll_x  s:    ))1:%%.uY//  " 0r   c                    U R                   (       a  X R                  l        U R                  (       a!  U R                  (       a  U R                  5         [        U5      [        U5      :w  a  U R                  5         g g rw   )r  vertical_scrollbarrT  r  r  r	  rU  rV  rW  s      r~   watch_scroll_yWidget.watch_scroll_y  sU    ''/8##,>>d33 uY//  " 0r   c                0    [        USU R                  5      $ rT  )rO   max_scroll_xr{   values     r~   validate_scroll_xWidget.validate_scroll_x      UAt0011r   c                B    [        [        USU R                  5      5      $ rT  )rU  rO   ra  rb  s     r~   validate_scroll_target_xWidget.validate_scroll_target_x      U5!T%6%6788r   c                0    [        USU R                  5      $ rT  )rO   r  rb  s     r~   validate_scroll_yWidget.validate_scroll_y  rf  r   c                B    [        [        USU R                  5      5      $ rT  )rU  rO   r  rb  s     r~   validate_scroll_target_yWidget.validate_scroll_target_y  rj  r   c                    [        SU R                  R                  U R                  R                  U R                  -
  -
  5      $ )z The maximum value of `scroll_x`.r   )r%  virtual_sizer  container_sizer#  r   s    r~   ra  Widget.max_scroll_x  sC     ##""((4+G+GGI
 	
r   c                    [        SU R                  R                  U R                  R                  U R                  -
  -
  5      $ )z The maximum value of `scroll_y`.r   )r%  rr  r  rs  r,  r   s    r~   r  Widget.max_scroll_y  sC     $$""))D,J,JJL
 	
r   c                x    U R                   R                  U R                  :H  =(       d    U R                  (       + $ )z/Is the vertical scroll position at the maximum?)scroll_offsetyr  r   r   s    r~   is_vertical_scroll_endWidget.is_vertical_scroll_end  ,     !!##t'8'88I		MIr   c                x    U R                   R                  U R                  :H  =(       d    U R                  (       + $ )z1Is the horizontal scroll position at the maximum?)rx  xra  r   r   s    r~   is_horizontal_scroll_endWidget.is_horizontal_scroll_end  r|  r   c                f    [        U R                  =(       a    U R                  R                  5      $ z,Is the user dragging the vertical scrollbar?)r   rb  grabbedr   s    r~   is_vertical_scrollbar_grabbed$Widget.is_vertical_scrollbar_grabbed  s&     D,,Q1I1I1Q1QRRr   c                f    [        U R                  =(       a    U R                  R                  5      $ r  )r   rc  r  r   s    r~   is_horizontal_scrollbar_grabbed&Widget.is_horizontal_scrollbar_grabbed  s&     D..U43M3M3U3UVVr   c                    SSK Jn  U R                  b  U R                  $ U" 5       U l        U R                  R	                  X R                  5        U R                  $ )zThe scrollbar corner.

Note:
    This will *create* a scrollbar corner if one doesn't exist.

Returns:
    ScrollBarCorner Widget.
r   )rf   )textual.scrollbarrf   rd  r   _start_widget)r{   rf   s     r~   scrollbar_cornerWidget.scrollbar_corner  sN     	6!!-)))!0!2t%;%;<%%%r   c                    SSK Jn  U R                  b  U R                  $ U" SSU R                  S9=U l        nSU R                  l        U R
                  R                  X5        U$ )zThe vertical scrollbar (create if necessary).

Note:
    This will *create* a scrollbar if one doesn't exist.

Returns:
    ScrollBar Widget.
r   re   Tverticalr  r   	thicknessF)r  re   rb  r#  r  r   r  r{   re   
scroll_bars      r~   r]  Widget.vertical_scrollbar  sh     	0##/+++09
d6R6R1
 	
 : ,1  (t0r   c                    SSK Jn  U R                  b  U R                  $ U" SSU R                  S9=U l        nSU R                  l        U R
                  R                  X5        U$ )zzThe horizontal scrollbar.

Note:
    This will *create* a scrollbar if one doesn't exist.

Returns:
    ScrollBar Widget.
r   r  F
horizontalr  )r  re   rc  r,  r  r   r  r  s      r~   rS  Widget.horizontal_scrollbar  sh     	0%%1---2;9W9W3
 	
"Z .3""*t0r   c                   U R                   (       a  U R                  (       d  gU R                  nUR                  nUR                  nU R
                  u  pESnUS:X  a  SnO(US:X  a  SnOUS:X  a  U R                  R                  U:  nSnUS:X  a  SnO(US:X  a  SnOUS:X  a  U R                  R                  U:  nUnUn	US:X  a  US:X  a  Xg4U R                  ;   dr  US:X  a3  U(       a,  U(       d%  U R                  R                  XAR                  -
  :  nUS:X  a3  U(       a,  U(       d%  U R                  R                  XQR                  -
  :  nU R                  U:w  d  U R                  U:w  a  U R                  R                  X45        OU R                  R                  5         X`l        Xpl        U R                   c  U(       a  X`R"                  l        U R&                  c  U(       a  XpR(                  l        gg)zRefresh scrollbar visibility.NFhiddenscrollTr  )r  rs  r  r!  r+  rW  rr  r  r  rw  r#  r,  r  r  addr  rc  rS  r  rb  r]  )
r{   r  r!  r+  r  r  show_horizontalshow_vertical_show_horizontal_show_verticals
             r~   _refresh_scrollbarsWidget._refresh_scrollbars  s   !!)<)<&&
&&
,,!#O8#"O6!"//55=O!!M8# M6! --44v=M*& & f$ 0D4K4KK V#o"&"3"3"9"9:::# V# $ 1 1 8 8===!
 **o=++}<##'')9(JK##))+)8&'4$%%1_0?%%-##/=.;##+ 4Ar   c                V    U R                   (       d  gU R                  U R                  4$ )zA tuple of booleans that indicate if scrollbars are enabled.

Returns:
    A tuple of (<vertical scrollbar enabled>, <horizontal scrollbar enabled>)
)FF)r  r  r  r   s    r~   scrollbars_enabledWidget.scrollbars_enabled[  s'     !!,,d.L.LMMr   c                2    U R                   U R                  4$ )z?The number of cells occupied by scrollbars for width and height)r#  r,  r   s    r~   scrollbars_spaceWidget.scrollbars_spaceg  s     ,,d.L.LMMr   c                    U R                   nUR                  S:X  a  UR                  S:X  a  UR                  $ U R                  (       a  UR                  $ S$ )zkGet the width used by the *vertical* scrollbar.

Returns:
    Number of columns in the vertical scrollbar.
r  r  r   )r  r"  r+  r#  r  r{   r  s     r~   r#  Widget.scrollbar_size_verticall  sN     ""h.63D3D3N111151M1Mv--TSTTr   c                X    U R                   nU R                  (       a  UR                  $ S$ )zmGet the height used by the *horizontal* scrollbar.

Returns:
    Number of rows in the horizontal scrollbar.
r   )r  r  r,  r  s     r~   r,   Widget.scrollbar_size_horizontalx  s'     373Q3Qv//XWXXr   c                F    [        SU R                  U R                  S5      $ )zNSpacing required to fit scrollbar(s).

Returns:
    Scrollbar gutter spacing.
r   )rN   r#  r,  r   s    r~   r"  Widget.scrollbar_gutter  s&     t++T-K-KQ
 	
r   c                H    U R                   R                  U R                  -   $ )zaSpacing for padding / border / scrollbars.

Returns:
    Additional spacing around content area.
)r  r  r"  r   s    r~   r  Widget.gutter  s     {{!!D$9$999r   c                .    U R                   R                  $ z?The size of the content area.

Returns:
    Content area size.
)content_regionr   r   s    r~   r   Widget.size  s     ""'''r   c                .    U R                   R                  $ )zKThe size of the scrollable content.

Returns:
    Scrollable content size.
)scrollable_content_regionr   r   s    r~   scrollable_sizeWidget.scrollable_size  s     --222r   c                    U R                   $ )zQThe size of the widget (including padding and border).

Returns:
    Outer size.
)rV  r   s    r~   
outer_sizeWidget.outer_size  s     zzr   c                    U R                   $ )zIThe size of the container (parent widget).

Returns:
    Container size.
)rW  r   s    r~   rs  Widget.container_size  s     ###r   c                d    U R                   R                  U R                  R                  5      nU$ )zGets an absolute region containing the content (minus padding and border).

Returns:
    Screen region that contains a widget's content.
)regionr  r  r  r{   r  s     r~   r  Widget.content_region  s(     ++DKK,>,>?r   c                    U R                   R                  U R                  R                  5      R                  U R                  5      nU$ )zGets an absolute region containing the scrollable content (minus padding, border, and scrollbars).

Returns:
    Screen region that contains a widget's content.
)r  r  r  r  r"  r  s     r~   r   Widget.scrollable_content_region  s>     ++DKK,>,>?FF!!
 r   c                H    U R                   R                  u  p[        X5      $ )zfAn offset from the Widget origin where the content begins.

Returns:
    Offset from widget's origin.
)r  top_leftrK   r{   r~  ry  s      r~   content_offsetWidget.content_offset  s     {{##a|r   c                t    U R                   R                  U R                  R                  5      R                  $ r  )r  r  r  r  r   r   s    r~   content_sizeWidget.content_size  s)     {{!!$++"4"45:::r   c                     U R                   R                  U 5      R                  u  pp4X!4$ ! [        [        R
                  4 a     gf = f)z<A tuple of integers used to sort widgets in selection order.)r   r   )r   find_widgetr  rG   r&   NoWidget)r{   r~  ry  _width_heights        r~   _selection_orderWidget._selection_order  sL    	$(KK$;$;D$A$H$H!A& t &//* 		s   (- A
	A
c                     U R                   R                  U 5      R                  $ ! [        [        R
                  4 a	    [        s $ f = f)zsThe region occupied by this widget, relative to the Screen.

Returns:
    Region within screen occupied by widget.
)r   r  r  rG   r&   r  rH   r   s    r~   r  Widget.region  s@    	;;**40777&//* 		   $'  A
	A
c                     U R                   R                  U 5      R                  $ ! [        [        R
                  4 a	    [        s $ f = f)zcSpace allocated to docks in the parent.

Returns:
    Space to be subtracted from scrollable area.
)r   r  dock_gutterrG   r&   r  rJ   r   s    r~   r  Widget.dock_gutter  s@    	 ;;**40<<<&//* 	 	 r  c                    U R                   c  U R                  R                  $ [        U R                   [        5      (       d   eU R                   R                  $ )zYThe viewport region (parent window).

Returns:
    The region that contains this widget.
)r|   r   r  r   r   r   s    r~   container_viewportWidget.container_viewport	  sE     ;;99###$++v....{{!!!r   c                     U R                   R                  U 5      R                  $ ! [         a    [	        5       s $ [
        R                   a    [	        5       s $ f = f)zThe widget region relative to its container (which may not be visible,
depending on scroll offset).


Returns:
    The virtual region.
)r   r  virtual_regionrG   rL   r&   r  r   s    r~   r  Widget.virtual_region	  sK    	;;**40??? 	8O 	8O	s   $' AAAc                P    U R                   R                  U R                  5      nU$ )z[The region within the scrollable area that is currently visible.

Returns:
    New region.
)r  	at_offsetrx  )r{   window_regions     r~   r  Widget.window_region 	  s$     --d.@.@Ar   c                `    U R                   R                  U R                  R                  5      $ )zThe widget region relative to its container (*including margin*), which may not be visible,
depending on the scroll offset.

Returns:
    The virtual region of the Widget, inclusive of its margin.
)r  growr  r  r   s    r~   virtual_region_with_margin!Widget.virtual_region_with_margin*	  s%     ""''(:(:;;r   c                    U n[        U[        5      (       aW  UR                  (       dF  UR                  (       a  gUR                  n[        U[        5      (       a  UR                  (       d  MF  g)z0Is this widget or any of its ancestors disabled?TF)r   r   is_dom_rootr  rx   r!  s     r~   _self_or_ancestors_disabled"Widget._self_or_ancestors_disabled4	  sP     #v&&t/?/?}}<<D v&&t/?/?/? r   c                    U R                   (       + =(       a;    U R                  5       =(       a$    U R                  =(       a    U R                  (       + $ )z%Can this widget currently be focused?)r  r%  r  r  r   s    r~   	focusableWidget.focusable?	  sC      5  "55 444		
r   c                f    U R                   u  p  nU R                  R                  u  n  p5X$-
  X-
  4$ )z.Key function to sort widgets into focus order.)r  r  r  )r{   r~  ry  r   toprl   s         r~   _focus_sort_keyWidget._focus_sort_keyI	  s9     ((
a++,,Qw  r   c                f    [        [        U R                  5      [        U R                  5      5      $ )zVGet the current scroll offset.

Returns:
    Offset a container has been scrolled by.
)rK   rU  r  r  r   s    r~   rx  Widget.scroll_offsetP	  s#     eDMM*E$--,@AAr   c                    U R                    H9  n[        U[        5      (       d  M  UR                  (       d  M-  UR                  s  $    [        5       $ )z1The scroll offset the nearest container ancestor.)r  r   r   r  rx  rK   r!  s     r~   container_scroll_offsetWidget.container_scroll_offsetY	  s?     NND$''D,>,>,>))) # xr   c                .    U R                   R                  $ )z>Get the current console.

Returns:
    A Rich console object.
)r   r   r   s    r~   _consoleWidget._consolea	  s     xxr   c                R   U R                   (       d  gU R                   H  nUR                  R                  S:X  a  M  UR                  nUR                  S:X  a  M=  UR
                  nUc  MN  UR                  (       d&  UR                  (       d  Mr  UR                  (       d  M    g   g)z3Do any children (or progeny) have a relative width?Fr  noneT)	rD  r  r  r  r  r  is_relative_widthr  r$  )r{   r  r  r  s       r~   r$  #Widget._has_relative_children_widthj	  s       ]]E||""i/\\F~~'LLE}''%"D"D"D # r   c                   U R                   (       d  gU R                   Hi  nUR                  nUR                  S:X  a  M!  UR                  nUc  M2  UR
                  (       d&  UR                  (       d  MV  UR                  (       d  Mi    g   g)z4Do any children (or progeny) have a relative height?Fr  T)rD  r  r  r  r  is_relative_heightr  r-  )r{   r  r  r  s       r~   r-  $Widget._has_relative_children_height~	  sl       ]]E\\F~~']]F~((5#F#F#F # r   c                |     U R                   R                  U 5        g! [        [        R                  4 a     gf = f)z:Check if the node was displayed in the last screen update.FT)r   r  rG   r&   r  r   s    r~   is_on_screenWidget.is_on_screen	  s;    	KK##D)  &//* 		s    ;;c                .   SnSnSnSnU R                   n	XR                  R                  -  nU	R                  S:X  a  U	R                  R                  u  pOS=pU	R
                  b  U	R
                  R                  XU5      U
-
  nU	R                  b  U	R                  R                  XU5      U
-
  nU	R                  b  U	R                  R                  XU5      U-
  nU	R                  b  U	R                  R                  XU5      U-
  n[        XVXx5      nU$ )zResolve minimum and maximum values for width and height.

Args:
    container: Size of outer widget.
    viewport: Viewport size.
    width_fraction: Size of 1fr width.
    height_fraction: Size of 1fr height.

Returns:
    Extrema object.
Nr  r   )r  r  r  r  r  r;  r  r&  r<  r.  r4   )r{   r0  r1  r2  r3  r;  r&  r<  r.  r  gutter_widthgutter_heightr:  s                r~   r  Widget._resolve_extrema	  s2   & &*	%)	&*
&*
]])))	,*0--*>*>'L-+,,L'  ((nM 
 '  ((nM  (!!)))O  
 (!!)))O  
 )
Gr   .rn   final_valuedurationspeeddelayeasingon_completelevelc                   U R                   c*  U R                  R                  R                  U 5      U l         U R                   c   eU R                  UUUUUUUUU	S9	  g)a  Animate an attribute.

Args:
    attribute: Name of the attribute to animate.
    value: The value to animate to.
    final_value: The final value of the animation. Defaults to `value` if not set.
    duration: The duration (in seconds) of the animation.
    speed: The speed of the animation.
    delay: A delay (in seconds) before the animation starts.
    easing: An easing method.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
Nr	  )r_  r   animatorbind)
r{   	attributerc  r
  r  r  r  r  r  r  s
             r~   r  Widget.animate	  sf    4 ==  HH--2248DM}}(((## 	 
	
r   c                l   #    U R                   R                  R                  XU5      I Sh  vN   g N7f)zStop an animation on an attribute.

Args:
    attribute: Name of the attribute whose animation should be stopped.
    complete: Should the animation be set to its final value?

Note:
    If there is no animation scheduled or running, this is a no-op.
N)r   r  stop_animation)r{   r  completes      r~   r  Widget.stop_animation	  s'      hh..tIIIs   *424c                T    U R                   R                  =(       d    U R                  $ )z\Get the layout object if set in styles, or a default layout.

Returns:
    A layout object.
)r  r   r^  r   s    r~   r   Widget.layout
  s     {{!!9T%9%99r   c                j    U R                   R                  SL=(       d    [        U R                  5      $ )z4Is this widget a container (contains other widgets)?Nr  r   r   r  r   s    r~   rD  Widget.is_container
  '     {{!!-Bdkk1BBr   c                j    U R                   R                  SL=(       d    [        U R                  5      $ )zCan this widget be scrolled?Nr  r   s    r~   r  Widget.is_scrollable
  r  r   c                    [        5       nU R                   Hd  n[        U[        5      (       d    gUR                  UR
                  :w  d  UR                  UR                  :w  a    gXR                  -
  S:  d  Md    g   g)z#Is this widget currently scrolling?T皙?F)	r
   r  r   r   r  scroll_target_xr  r  r  )r{   current_timer  s      r~   is_scrollingWidget.is_scrolling
  sp     !{NNDdF++  !5!55==D$8$88444s: # r   c                @    U R                   R                  =(       d    S$ )zAGet the name of this widgets layer.

Returns:
    Name of layer.
r  )r  layerr   s    r~   r)  Widget.layer,
  s     {{  -I-r   c                    SnU R                    HS  n[        U[        5      (       d    U$ UR                  R	                  S5      (       d  M=  UR                  R
                  nMU     U$ )z;Layers of from parent.

Returns:
    Tuple of layer names.
r  layers)r  r   r   r  r  r,  )r{   r,  r  s      r~   r,  Widget.layers5
  s]     #/,,DdF++  {{##H--++	 -
 r   c                   U R                   nU R                  u  p#X1R                  -   nUUR                  (       a%  UR	                  UR
                  R                  5      OUR
                  -   nUR                  [        R                  " UR                  UR                  R                  (       a  UR                  OS5      -   nU$ )z*Style of links.

Returns:
    Rich style.
N)r  background_colorslink_backgroundauto_link_colorr  
link_colorr  r   r!   r{  r  )r{   r  r   r  r0  r2  r   s          r~   r   Widget.link_styleD
  s     ..$'='==$%% --f.?.?.A.AB""


 !!E$4$4!!*0*@*@*B*BO&&%
 
 r   c                P   U R                   nU R                  u  p#X1R                  -   nUUR                  (       a%  UR	                  UR
                  R                  5      OUR
                  -   nUR                  [        R                  " UR                  UR                  5      -   nU$ )zFStyle of links underneath the mouse cursor.

Returns:
    Rich Style.
)r  r/  link_background_hoverauto_link_color_hoverr  link_color_hoverr  link_style_hoverr!   r{  r  )r{   r  r   r  hover_backgroundhover_colorr   s          r~   r8  Widget.link_style_hoverY
  s     ..%(D(DD&++ ..v/F/F/H/HI((

 ''%*:*:""''+
 
 r   c                    U nU R                    H/  n[        U[        5      (       d  M  UR                  (       d  M-  Us  $    U$ )zeThe widget's container used when selecting text..

Returns:
    A widget which contains this widget.
)r  r   r   r  )r{   r0  r   s      r~   select_containerWidget.select_containern
  s<     !	nnF&&))f.B.B.B % r   c                   U(       a|  U R                   nU Vs/ s H  o3R                  U5      PM     nnU R                  R                  U5        U R                  R                  U5        U R
                  R                  " U6   gU R                  R                  5         U R                  R                  5         U R
                  R                  5         U R
                  R                  U R                  R                  5        U R                  nU R                  R                  UR                  5        U(       a&  U R                  R                  UR                  5        ggs  snf )zSet the Widget as 'dirty' (requiring re-paint).

Regions should be specified as positional args. If no regions are added, then
the entire widget will be considered dirty.

Args:
    *regions: Regions which require a repaint.
N)r  	translaterl  updaterm  rr  	set_dirtyr  r   r  r  r  )r{   regionsr  r  widget_regionsr  s         r~   
_set_dirtyWidget._set_dirty{
  s
    !00NMTUW6..~>WNU&&~6!!((8((.9%%'!!'')$$&(()9)9:J##J$5$56%%))**;*;<  Vs   E c                n    U R                   R                  5       nU R                   R                  5         U$ )zlGet a copy of the regions which need a repaint, and clear internal cache.

Returns:
    Regions to repaint.
)rm  copyr  )r{   rC  s     r~   _exchange_repaint_regions Widget._exchange_repaint_regions
  s/     '',,.##%r   basicr  r  r  r  forcer  r  r  c          
       ^ ^ U
(       a  T R                  5         USL=(       a    T R                  =(       d    UnUSL=(       a    T R                  =(       d    UnS=pT R                  R                  nUR                  T S5        UR                  T S5        S	UU 4S jjnU(       a  Uc  Uc  SnUc  [        nU(       aW  Uc   eUT l        UT R                  :w  a;  T R                  R                  5         T R                  ST R                  UUUUU	S9  SnU(       aW  Uc   eUT l        UT R                  :w  a;  T R                  R                  5         T R                  ST R                  UUUUU	S9  SnOU(       a.  Uc   eT R                  nU=T l        T l        UT R                  :g  nU(       a.  Uc   eT R                  nU=T l        T l        UT R                  :g  n[        5       T l        Tb  T R                  T5        U=(       d    U$ )
a(  Scroll to a given (absolute) coordinate, optionally animating.

Args:
    x: X coordinate (column) to scroll to, or `None` for no change.
    y: Y coordinate (row) to scroll to, or `None` for no change.
    animate: Animate to new scroll position.
    speed: Speed of scroll if `animate` is `True`. Or `None` to use duration.
    duration: Duration of animation, if `animate` is `True` and speed is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    release_anchor: If `True` call `release_anchor`.

Returns:
    `True` if the scroll position changed, otherwise `False`.
NFr  r  c                    > TR                   R                  5         [        5       Tl        T b  TR	                  T 5        gg)z*set last scroll time, and invoke callback.N)r   _realtime_animation_completer
   r  r  r  r{   s   r~   _animate_on_complete/Widget._scroll_to.<locals>._animate_on_complete
  s4    HH113%.[D"&{+ 'r   2   )r  r  r  r  r  Tr   )r  r  r  r   r  force_stop_animationr3   r$  r  _realtime_animation_beginr  r  r  r
   r  call_after_refresh)r{   r~  ry  r  r  r  r  rM  r  r  r  maybe_scroll_xmaybe_scroll_y
scrolled_x
scrolled_yr  rR  r  r  s   `       `          r~   
_scroll_toWidget._scroll_to
  s    @ !$RD,H,H,QE$PD,F,F,O%"''
88$$%%dJ7%%dJ7	, 	, EM~.}$}'($%HH668LL",,#!)%$8# !  "&J}$}'($%HH668LL",,#!)%$8# !  "&J }$}==788$t}%6
}$}==788$t}%6
%.[D"&''4'Z'r   c                    U R                   $ )z|Check if this widget permits text selection.

Returns:
    `True` if the widget supports text selection, otherwise `False`.
)r  r   s    r~   allow_selectWidget.allow_select  s        r   c                    g)zThis method id called prior to a layout operation.

Implement this method if you want to make updates that should impact
the layout.

Args:
    layout: The [Layout][textual.layout.Layout] instance that will be used to arrange this widget's children.

Nr   )r{   r   s     r~   
pre_layoutWidget.pre_layout      r   c                    Ub)  U R                  [        R                  [        U5      5        Ub*  U R                  [        R                  [        U5      5        gg)a'  Set the scroll position without any validation.

This is a low-level method for when you want to see the scroll position in the next frame.
For a more fully featured method, see [`scroll_to`][textual.widget.Widget.scroll_to].

Args:
    x: Desired `X` coordinate.
    y: Desired `Y` coordinate.
N)r}  r   r  rU  r  r  s      r~   
set_scrollWidget.set_scroll  sC     =foouQx8=foouQx8 r   )	r  r  r  r  rM  r  r  r  r  c       	        4   U(       a  U R                  5         U R                  R                  nUb  UR                  U S5        Ub  UR                  U S5        U
(       a  U R	                  UUUUUUUUU	S9	  gU R                  U R                  UUUUUUUUU	S9
  g)a  Scroll to a given (absolute) coordinate, optionally animating.

Args:
    x: X coordinate (column) to scroll to, or `None` for no change.
    y: Y coordinate (row) to scroll to, or `None` for no change.
    animate: Animate to new scroll position.
    speed: Speed of scroll if `animate` is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.
    release_anchor: If `True` call `release_anchor`.

Note:
    The call to scroll is made after the next refresh.
Nr  r  r  r  r  r  rM  r  r  )r  r   r  rU  r\  rW  )r{   r~  ry  r  r  r  r  rM  r  r  r  r  r  s                r~   	scroll_toWidget.scroll_to+  s    D !88$$=))$
;=))$
;OO!'  
 ##!' $ r   r  r  r  r  rM  r  r  r  c               |    U R                  Uc  SOU R                  U-   Uc  SOU R                  U-   UUUUUUU	U
S9
  g)a  Scroll relative to current position.

Args:
    x: X distance (columns) to scroll, or ``None`` for no change.
    y: Y distance (rows) to scroll, or ``None`` for no change.
    animate: Animate to new scroll position.
    speed: Speed of scroll if `animate` is `True`. Or `None` to use `duration`.
    duration: Duration of animation, if animate is `True` and speed is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.
Nrl  )rj  r  r  )r{   r~  ry  r  r  r  r  rM  r  r  r  s              r~   scroll_relativeWidget.scroll_relativen  sQ    : 	IDDMMA$5IDDMMA$5# 	 	
r   )
r  r  r  r  rM  r  r  r  x_axisy_axisc       
        h    Uc  Uc  SnU R                  U	(       a  SOSU
(       a  SOSUUUUUUUUS9
  g)a  Scroll to home position.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if animate is `True`; or `None` to use duration.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.
    x_axis: Allow scrolling on X axis?
    y_axis: Allow scrolling on Y axis?
Nr  r   rl  )rj  )r{   r  r  r  r  rM  r  r  r  rp  rq  s              r~   scroll_homeWidget.scroll_home  sJ    : =X-HATAT# 	 	
r   c       
           ^ ^^^^^^^^	^
^ Tc  Tc  SmSUU 4S jjmSUUUUUUU UU	U
4
S jjnT R                   (       a  T R                  (       a  ST l        U(       a  U" 5         gT R                  U5        g)a  Scroll to the end of the container.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if `animate` is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.
    x_axis: Allow scrolling on X axis?
    y_axis: Allow scrolling on Y axis?

Nr  c                 8   >#    T b  TR                  T 5        gg7f)z>It's possible new content was added before we reached the end.N)r  rQ  s   r~   scroll_end_on_complete1Widget.scroll_end.<locals>.scroll_end_on_complete  s     &{+ 's   c                 n   >
 TR                  T(       a  SOST	(       a  TR                  OST TTTTTTSS9
  g)z Scroll to the end of the widget.r   NFrL  )r\  r  )
r  r  r  rM  r  rw  r{   r  rp  rq  s
   r~   _lazily_scroll_end-Widget.scroll_end.<locals>._lazily_scroll_end  s@    OO%+!!!2$  r   Fr   )r  r  rW  )r{   r  r  r  r  rM  r  r  r  rp  rq  rz  rw  s   ```````` `` @r~   r   Widget.scroll_end  s_    > =X-H	, 	,	 	 	 >>d33$)D! ##$67r   c               L    U R                  U R                  S-
  UUUUUUUUS9	  g)ar  Scroll one cell left.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if `animate` is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.
rQ  	r~  r  r  r  r  rM  r  r  r  Nrj  r$  	r{   r  r  r  r  rM  r  r  r  s	            r~   scroll_leftWidget.scroll_left  ;    2 	""Q&# 	 
	
r   ri  c               p    U R                  U R                  U R                  R                  -
  UUUUUUUS9$ )a  Scroll left one position, taking scroll sensitivity into account.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if `animate` is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).

Returns:
    `True` if any scrolling was done.

Note:
    How much is scrolled is controlled by
    [App.scroll_sensitivity_x][textual.app.App.scroll_sensitivity_x].
r~  r  r  r  r  rM  r  r  r\  r$  r   scroll_sensitivity_xr{   r  r  r  r  rM  r  r  s           r~   _scroll_left_for_pointerWidget._scroll_left_for_pointer-  G    : ""TXX%B%BB#  	
 		
r   c               L    U R                  U R                  S-   UUUUUUUUS9	  g)aq  Scroll one cell right.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if animate is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.
rQ  r~  Nr  r  s	            r~   scroll_rightWidget.scroll_rightU  r  r   c               p    U R                  U R                  U R                  R                  -   UUUUUUUS9$ )a  Scroll right one position, taking scroll sensitivity into account.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if animate is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).

Returns:
    `True` if any scrolling was done.

Note:
    How much is scrolled is controlled by
    [App.scroll_sensitivity_x][textual.app.App.scroll_sensitivity_x].
r  r  r  s           r~   _scroll_right_for_pointer Widget._scroll_right_for_pointerz  r  r   c               L    U R                  U R                  S-   UUUUUUUUS9	  g)ar  Scroll one line down.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if `animate` is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.
rQ  	ry  r  r  r  r  rM  r  r  r  Nrj  r  r  s	            r~   scroll_downWidget.scroll_down  r  r   c               r    U R                  U R                  U R                  R                  -   UUUUUUUSS9	$ )a  Scroll down one position, taking scroll sensitivity into account.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if `animate` is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).

Returns:
    `True` if any scrolling was done.

Note:
    How much is scrolled is controlled by
    [App.scroll_sensitivity_y][textual.app.App.scroll_sensitivity_y].
F)	ry  r  r  r  r  rM  r  r  r  r\  r  r   scroll_sensitivity_yr  s           r~   _scroll_down_for_pointerWidget._scroll_down_for_pointer  sJ    : ""TXX%B%BB#   

 
	
r   c               L    U R                  U R                  S-
  UUUUUUUUS9	  g)an  Scroll one line up.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if `animate` is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and speed is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.
rQ  r  Nr  r  s	            r~   	scroll_upWidget.scroll_up  r  r   c               p    U R                  U R                  U R                  R                  -
  UUUUUUUS9$ )a  Scroll up one position, taking scroll sensitivity into account.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if `animate` is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and speed is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).

Returns:
    `True` if any scrolling was done.

Note:
    How much is scrolled is controlled by
    [App.scroll_sensitivity_y][textual.app.App.scroll_sensitivity_y].
ry  r  r  r  r  rM  r  r  r  r  s           r~   _scroll_up_for_pointerWidget._scroll_up_for_pointer  r  r   c               r    U R                  U R                  U R                  R                  -
  UUUUUUUS9  g)a  Scroll one page up.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if animate is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
r  Nrj  r  r  r  r  s           r~   scroll_page_upWidget.scroll_page_up=  B    , 	mmd<<CCC# 	 		
r   c               r    U R                  U R                  U R                  R                  -   UUUUUUUS9  g)a  Scroll one page down.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if animate is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
r  Nr  r  s           r~   scroll_page_downWidget.scroll_page_down^  r  r   c                   Uc  Uc  SnU R                  U R                  U R                  R                  -
  UUUUUUUS9  g)a  Scroll one page left.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if animate is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
N333333?r  rj  r  r  r  r  s           r~   scroll_page_leftWidget.scroll_page_left  Q    , =X-Hmmd<<BBB# 	 		
r   c                   Uc  Uc  SnU R                  U R                  U R                  R                  -   UUUUUUUS9  g)a  Scroll one page right.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if animate is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
Nr  r  r  r  s           r~   scroll_page_rightWidget.scroll_page_right  r  r   )r  r  r  r  centerr  origin_visiblerM  r  r  r  c                  UR                   nSnUR                  (       d  U
b  U R                  U
5        g[        UR                  [
        5      (       Gam  XLGah  U(       d   U$ UR                  nUR                  R                  S:w  a  [        SS5      nO.UR                  UUR                  UUUUUUUU	U
UUS9nU(       a  SnUR                  U* 5      R                  UR                  R                  R                  5      R                  UR                  R                  R                  R                  5      R                  UR                   R                   5      R#                  UR                  R                  5      R%                  UR                   5      nUn[        UR                  [
        5      (       a  XLa  GMh  U$ )a  Scroll scrolling to bring a widget into view.

Args:
    widget: A descendant widget.
    animate: `True` to animate, or `False` to jump.
    speed: Speed of scroll if `animate` is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    top: Scroll widget to top of container.
    origin_visible: Ensure that the top left of the widget is within the window.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.

Returns:
    `True` if any scrolling has occurred in any descendant, otherwise `False`.
Fr  r   )spacingr  r  r  r  r  r  r  rM  r  r  r  T)r  r   rW  r   r|   r   r  dockrK   scroll_to_regionr  r@  r  r  borderr  r  r  intersection)r{   r   r  r  r  r  r  r  r  rM  r  r  r  r  scrolledr0  rx  s                    r~   scroll_to_widgetWidget.scroll_to_widget  s   H 22{{&''4//F4FN K I}}!!V+ &q! ) : :"..#%!!#1 +' !; ! !#H $$m^4Yy//66??@Yy//66>>GGHYyCCJJKi&&--.iBBC  FQ //F4FR r   )r  r  r  r  r  r  r  r  rM  r  r  rp  rq  r  c                 ^  T R                   R                  T R                  5      nUb  UR                  U5      nUU;   a,  U(       d%  U(       d  Ub  T R	                  U5        [        5       $ S	U 4S jjnU(       a  UR                  u  nnUR                  u  nnU" [        [        UU-
  S-   5      [        UU-
  S-   5      5      5      nU	(       a;  UR                  UR                  U5      ;  a  U" [        R                  " UUSS95      nOU" [        R                  " UXS95      nT R                  (       d  U
(       d  [        SUR                  5      nT R                  (       d  U
(       d  [        UR                  S5      nU(       a^  U(       a  UR                  OSnU(       a  UR                  OSnUc  Uc  SnT R!                  U=(       d    SU=(       d    SUUUUU
UUUS9
  U$ Ub  T R	                  U5        U$ )
ac  Scrolls a given region into view, if required.

This method will scroll the least distance required to move `region` fully within
the scrollable area.

Args:
    region: A region that should be visible.
    spacing: Optional spacing around the region.
    animate: `True` to animate, or `False` to jump.
    speed: Speed of scroll if `animate` is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    top: Scroll `region` to top of container.
    origin_visible: Ensure that the top left of the widget is within the window.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    x_axis: Allow scrolling on X axis?
    y_axis: Allow scrolling on Y axis?
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.

Returns:
    The distance that was scrolled.
Nc                   > TR                   u  p[        [        XR                  -   STR                  5      U-
  [        X R
                  -   STR                  5      U-
  5      n U $ )z0Clamp the delta to avoid scrolling out of range.r   )rx  rK   rO   r~  ra  ry  r  )deltar  r  r{   s      r~   clamp_delta,Widget.scroll_to_region.<locals>.clamp_deltaQ  s^    !%!3!3Hh(!T->->?(Jh(!T->->?(JE Lr   g      ?T)r  r   g?rl  )r  rK   r   rK   )r  r  rx  r  rW  rK   r  r  r  r@  rL   get_scroll_to_visibler  ry  r  r~  rn  )r{   r  r  r  r  r  r  r  r  r  rM  r  r  rp  rq  r  windowr  region_center_xregion_center_ywindow_center_xwindow_center_yr  delta_xdelta_ys   `                        r~   r  Widget.scroll_to_region  s   X //99$:L:LM]]7+FVSF&''48O	 /5}},O_/5}},O_/9C?@/9C?@E 6==8H8H8O#O#00TJ  ,,VVEE ++E1egg&E))%577A&E!'eggQG!'eggQG}!1  44!'# !   &''4r   )r  r  r  r  rM  r  r  r  c               
   U R                   n
[        U
[        5      (       ab  U R                  (       a#  U R                  R                  U UUUUUUUUU	S9
  gU
R                  U R                  R
                  U UUUUUUUUU	S9  gg)a  Scroll the container to make this widget visible.

Args:
    animate: Animate scroll.
    speed: Speed of scroll if animate is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    top: Scroll to top of container.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.
)	r  r  r  r  r  rM  r  r  r  N)r|   r   r   rV  r   r  rW  )r{   r  r  r  r  r  rM  r  r  r  r|   s              r~   scroll_visibleWidget.scroll_visible  s    6 ff%%zz,,#%! +' -  ))KK00#%! +' * # &r   )r  r  r  rM  r  r  r  r  c               6    U R                  UUUUUUSUUU	U
S9  g)az  Scroll this widget to the center of self.

The center of the widget will be scrolled to the center of the container.

Args:
    widget: The widget to scroll to the center of self.
    animate: Whether to animate the scroll.
    speed: Speed of scroll if animate is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    origin_visible: Ensure that the top left corner of the widget remains visible after the scroll.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.
T)r   r  r  r  r  rM  r  r  r  r  r  N)r  )r{   r   r  r  r  r  rM  r  r  r  r  s              r~   scroll_to_centerWidget.scroll_to_center  s9    @ 	)# 	 	
r   c                N   XL a  gXR                   R                  R                  ;  a  gUR                  nUn[	        UR
                  [        5      (       aO  X0LaK  X#R
                  R                  ;  a  gUR
                  n[	        UR
                  [        5      (       a  X0La  MK  g)al  Check if a given widget is *fully* within the current view (scrollable area).

Note: This doesn't necessarily equate to a widget being visible.
There are other reasons why a widget may not be visible.

Args:
    widget: A widget that is a descendant of self.

Returns:
    `True` if the entire widget is in view, `False` if it is partially visible or not in view.
TF)r   _compositorvisible_widgetsr  r   r|   r   r  r{   r   r  r  s       r~   can_view_entireWidget.can_view_entire  s     >00@@@f--$2B[[BBB;;D f--$2B r   c                   XL a  gXR                   R                  R                  ;  d  UR                  (       d  gUR                  nUn[        UR                  [        5      (       a`  X0La\  UR                  UR                  R                  5      (       d  gUR                  n[        UR                  [        5      (       a  X0La  M\  g)a  Check if a given widget at least partially visible within the current view (scrollable area).

Args:
    widget: A widget that is a descendant of self.

Returns:
    `True` if any part of the widget is visible, `False` if it is outside of the viewable area.
TF)
r   r  r  r  r  r   r|   r   overlapsr  r  s       r~   can_view_partialWidget.can_view_partial  s     >00@@@f--$2B??4;;#H#HII;;D f--$2B r   c                X  > U R                   nUS   R                  5       (       d&  UR                  S5      (       d  [        SU< S35      e[        TU ]  UUS9  U R                  S   n[        U[        5      (       a-  Uc  UR                  OUU l	        Uc  UR                  OUU l
        g g )Nr   r   zWidget subclass z) should be capitalized or start with '_'.)inherit_cssinherit_bindings)r   isupperr  r  rx  __init_subclass____mro__
issubclassr   r  r  )r  r  r  r  r  r   baser  s          r~   r  Widget.__init_subclass__%  s     ||Aw  )=)="4(*ST  	!#- 	" 	
 {{1~dF##.7.?DNNYCM &- ''' " $r   c              #     #     SU R                   S 4v   U R                  (       a  SU R                  4v   U R                  (       a   SSR                  U R                  5      4v   g g ! [         a     g f = f7f)NrN  r   rO   )rN  r   rO  joinAttributeErrorr   s    r~   r   Widget.__rich_repr__?  sf     	%%yydii''||$,,!777  		s)   A8A"A( &A8(
A52A84A55A8c                   U R                   u  p#U R                  nUR                  nUR                  n[	        U=(       a    U5      n[	        U=(       a    U5      nUR
                  S:X  a  SnUR                  nU(       a"  U(       a  UR                  U* U* 5      u  n    nU$ U(       a  UR                  U* 5      u  pU$ U(       a  UR                  U* 5      u  pU$ )zAdjusts the Widget region to accommodate scrollbars.

Args:
    region: A region for the widget.

Returns:
    The widget region minus scrollbars.
r  T)	r  r  r,  r#  r   r"  r   split_verticalsplit_horizontal)r{   r  r  r  r  r,  r#  r   s           r~   _get_scrollable_regionWidget._get_scrollable_regionI  s     >B=T=T:$*$D$D!"("@"@"&#?(?#
 %)%C*C%
! ""h.&*#&,&D&D#$)@$ll((**OFAq! 	 %--/F.FGIF  '//1J0JKIFr   c              #    #    U R                   u  p#U R                  nU R                  n[        U=(       a    U5      n[        U=(       a    U5      nU(       a  U(       a  UR	                  UR
                  U-
  UR                  U-
  5      u  nnnn	U	(       a  U R                  U	4v   U(       a=  U R                  n
U R                  R                  U
l
        UR                  U
l        X4v   U(       a>  U R                  n
U R                  R
                  U
l
        UR
                  U
l        X4v   ggU(       af  UR                  UR
                  U-
  5      u  pkU(       a>  U R                  n
U R                  R                  U
l
        UR                  U
l        X4v   ggU(       af  UR                  UR                  U-
  5      u  pkU(       a>  U R                  n
U R                  R
                  U
l
        UR
                  U
l        X4v   ggg7f)zArrange the 'chrome' widgets (typically scrollbars) for a layout element.

Args:
    region: The containing region.

Returns:
    Tuples of scrollbar Widget and region.
N)r  r,  r#  r   r   r  r  r  r]  rr  window_virtual_sizewindow_sizerS  r  r  )r{   r  r  r  r,  r#  r  vertical_scrollbar_regionhorizontal_scrollbar_regionscrollbar_corner_gap	scrollbarscrollbar_regions               r~   _arrange_scrollbarsWidget._arrange_scrollbarso  s     >B=T=T:$($B$B!"&">">"&#?(?#
 %)%C*C%
! %)@ 66 99)+$
 $++-AAA( 33	040A0A0H0H	-(5(<(<	%::* 55	040A0A0G0G	-(5(;(;	%<<	 + %.4.C.C66/+M   33	040A0A0H0H	-(5(<(<	%11	  
 '.4.E.E 99/+M   55	040A0A0G0G	-(5(;(;	%11	  	 's   H
Hc                    U nSn[        U[        5      (       a7  UR                  (       a  SnO#UR                  n[        U[        5      (       a  M7  [	        U(       + U R
                  U R                  S9nU$ )zGet an object describing whether each pseudo class is present on this object or not.

Returns:
    A PseudoClasses object describing the pseudo classes that are present.
FT)r   r   r   )r   r   r  rx   r   r  r  )r{   r  r  pseudo_classess       r~   get_pseudo_class_stateWidget.get_pseudo_class_state  sk     $(v&&}}<<D	 v&& ' L""..

 r   c                H    U R                   U R                  U R                  4$ )z8A cache key that changes when the pseudo-classes change.)r  r  r(  r   s    r~   r   Widget._pseudo_classes_cache_key  s'     NN
 	
r   c                    SnU R                   R                  S5      (       a9  [        [        U R                   R                  5      n[
        R                  X"5      nU$ )z?Get the justify method that may be passed to a Rich renderable.N
text_align)r  r  r   r   r  rr   r   )r{   text_justifyr  s      r~   _get_justify_methodWidget._get_justify_method  sH    -1;;--(,]DKK<R<R(SJ'++JCLr   c                p   U R                  5       n[        U[        5      (       a  [        R                  " XS9n[        U[        5      (       a)  Ub&  UR
                  U:w  a  UR                  5       nX1l        [        [        [        U5      UU R                  (       a  U R                  5      nU$ S5      nU$ )zApplies style attributes to the default renderable.

This method is called by Textual itself.
It is unlikely you will need to call or implement this method.

Returns:
    A new renderable.
)rq   N)r  r   r   r"   r  rq   rH  r   r   r   r  r   )r{   r   
base_styler  s       r~   post_renderWidget.post_render  s     //1j#&&))*KJ z4(((""l2#*J!-"J/#DOO

  59

 r   c                $    U R                  5         g)z+Update from CSS if has focus state changes.N)r  )r{   
_has_focuss     r~   watch_has_focusWidget.watch_has_focus  s    !r   c                   SSK Jn  U(       ak  U R                  (       aZ  U R                  R                  bC  U R
                  R                  [        R                  " U R                  R                  5      5         U R                  nU(       a@  UR                  b3  XR                  R                  ;   a  UR                  R                  5         U R                  5         g! U[        [        4 a     N$f = f)zJUpdate the styles of the widget and its children when disabled is toggled.r   )ScreenStackErrorN)textual.appr  r  r   
mouse_over_message_queue
put_nowaitr'   Leaver   r$  r  r"  r/   rG   r  )r{   r  r  r   s       r~   watch_disabledWidget.watch_disabled  s    0((TXX-@-@-L**6<<8K8K+LM		[[FNN.NN>>>##% 	! !"2H= 		s   :AC C21C2c                   U R                   R                  5         U R                  U:w  d   U R                  U:w  d  U R                  U:w  a}  U R                  U:w  a  U R                  5         Xl        U(       a  X l        O U R                  [        R                  U5        X0l        U R                  (       a  U R                  U5        gg)a  Called when the widget's size is updated.

Args:
    size: Screen size.
    virtual_size: Virtual (scrollable) size.
    container_size: Container size (size of parent).
    layout: Perform layout if required.

Returns:
    True if a resize event should be sent, otherwise False.
TF)
rg  r  rV  rr  rW  rE  r}  r   r  _scroll_update)r{   r   rr  rs  r   s        r~   _size_updatedWidget._size_updated  s     	  "JJ$  L0##~5zzT!!J$0!!!&"5"5|D#1 !!##L1r   c                   U R                  5         U R                  u  p#U R                  (       am  U R                  R                  (       aR  UR
                  U R                  l        X0R                  -
  U R                  l	        U R                  R                  5         U R                  (       am  U R                  R                  (       aR  UR                  U R                  l        X R                  -
  U R                  l	        U R                  R                  5         U R                  U R                  5      U l        U R!                  U R"                  5      U l        g)zTUpdate scrollbars visibility and dimensions.

Args:
    virtual_size: Virtual size.
N)r  rs  r  r  r#  r  r]  r  r,  r  r   r  r  rS  rd  r  rl  r  )r{   rr  r  r  s       r~   r  Widget._scroll_update1  s     	  "++''DKK,O,O:F:M:MD##7777 ##/ ##++-))dkk.S.S<H<N<ND%%949<X<X4XD%%1%%--/..t}}=..t}}=r   c                   U R                   b%  U R                  U R                  R                  :w  Ga  U R                  R                  U l        [	        SSSS5      n[	        SSSS5      n[        5       nSn[        U R                  5       H  nUR                  nUR                  nXFR                  -  nU" S5      (       a_  XR                  R                  UR                  5      -   nUUR                  R                  UR                  5      R                  U5      -  nOUnU" S5      (       a  UR                  nX6R                  -  nU" S5      (       d  M  UR                   (       d  M  UR#                  UR$                  5      nM     ['        UUUR(                  UR*                  UR,                  UR.                  UR0                  UR2                  S9U l         U R                   $ )zThe widget's current style.r   r  r  r  r}  r  )r  r  r  reverser  r  )rh  ri  r  r  r<   r!   r  r  r  r  r  r  r  r~  r}  r  r  r  r  r  r  r  r  r  r  r  )	r{   r  r}  r   r  r  r  r  r  s	            r~   r  Widget.visual_styleH  s    &++t{{/E/EE+/;;+A+AD(q!Q*J#sC+EGEG !9!9:!??>>)L))&03D3D3I3I..4 'O ))..v/E/EF$nW-.J '1OG$$"LLE***L))f.?.?.?+==eggFE# ;& "-ZZII||//||	"D !!!r   c                    U R                  5       n[        U[        [        45      (       a  [	        U5      nOgUR                  U5      S4$ )a  Get the text under the selection.

        !!! note
            Implement this method if are building custom widget. If you just want to get the currently
            selected text, then see [`Screen.get_selected_text`](textual.screen.Screen.get_selected_text)


        Args:
            selection: Selection information.

        Returns:
            Tuple of extracted text and ending (typically "
" or " "), or `None` if no text could be extracted.
        N
)rE  r   r"   r>   r   extract)r{   	selectionrG  r   s       r~   get_selectionWidget.get_selectionu  sB     ftWo..v;D  &,,r   c                $    U R                  5         g)zmCalled when the selection is updated.

Args:
    selection: Selection information or `None` if no selection.
N)r   )r{   r"  s     r~   selection_updatedWidget.selection_updated  s     	r   c                    U R                   u  pU R                  5       n[        R                  " XXU R                  5      n[        U R                   U5      U l        U R                  R                  5         g)zRender all lines.N)	r   rE  r]   	to_stripsr  r   rj  rl  r  )r{   r  r  rG  stripss        r~   _render_contentWidget._render_content  sW    		!!$t?P?PQ)$))V<!!#r   c                   U R                   (       a?  [        R                  " U R                  R                  U R
                  R                  5      $ U R                  (       a  U R                  5          U R                  R                  U   nU$ ! [         aC    [        R                  " U R                  R                  U R
                  R                  5      n U$ f = f)z]Render a line of content.

Args:
    y: Y Coordinate of line.

Returns:
    A rendered line.
)r
  r[   blankr   r  r  rx  rl  r+  rj  r   r  )r{   ry  lines      r~   render_lineWidget.render_line  s     ::;;tyy0A0A0L0LMM  "	N%%++A.D   	N;;tyy0A0A0L0LMD	Ns   3B A	CCc                    U R                   (       aE  [        R                  " UR                  U R                  R
                  5      /UR                  -  nU$ U R                  R                  X5      nU$ )zRender the widget into lines.

Args:
    crop: Region within visible area to render.

Returns:
    A list of list of segments.
)	r
  r[   r.  r  r  rx  r  rr  render_widget)r{   cropr*  s      r~   render_linesWidget.render_lines  s`     ::DJJ(9(9(D(DEF
  ''55dAFr   c                    [        X5      nX0R                  R                  -   nU R                  R                  " U6 u  pVXPLa
  [        5       $ U R                  R                  " U6 $ )zGet the Rich style in a widget at a given relative offset.

Args:
    x: X coordinate relative to the widget.
    y: Y coordinate relative to the widget.

Returns:
    A rich Style object.
)rK   r  r  r   get_widget_atr!   get_style_at)r{   r~  ry  r  screen_offsetr   r   s          r~   r9  Widget.get_style_at  sW     !3!33KK--}=	7N{{''77r   c                &    SU R                   l        g)zSuppress a click event.

This will prevent a [Click][textual.events.Click] event being sent,
if called after a mouse down event and before the click itself.

N)r   _mouse_down_widgetr   s    r~   suppress_clickWidget.suppress_click  s     '+#r   c                F    UR                  5         U R                  U5        g rw   )_set_forwardedpost_messager{   events     r~   _forward_eventWidget._forward_event  s    % r   c                2    SU l         U R                  5         g)zRefreshes the scroll position.TN)r[  r  r   s    r~   rV  Widget._refresh_scroll  s     $r   )r  r   r  c                  U(       a-  U R                   (       d  SU l         U =R                  S-  sl        U(       a$  SU l        U R                  U R                  5        U $ U R
                  (       d  SU l        U R                  5         U $ U R                  R                  5         U(       a@  U R                  " U6   U R                  5         U R                  R                  5         SU l        U R                  5         U $ )a  Initiate a refresh of the widget.

This method sets an internal flag to perform a refresh, which will be done on the
next idle event. Only one refresh will be done even if this method is called multiple times.

By default this method will cause the content of the widget to refresh, but not change its size. You can also
set `layout=True` to perform a layout.

!!! warning

    It is rarely necessary to call this method explicitly. Updating styles or reactive attributes will
    do this automatically.

Args:
    *regions: Additional screen regions to mark as dirty.
    repaint: Repaint the widget (will call render() again).
    layout: Also layout widgets in the view.
    recompose: Re-compose the widget (will remove and re-mount children).

Returns:
    The `Widget` instance.
TrQ  )rX  rY  r\  r  r  r  rZ  r  rg  r  rE  rK  rs  )r{   r  r   r  rC  s        r~   r   Widget.refresh  s    < $//$(D!  A% '+D$NN4001K%)D"OOK  "OOW%((*""((*%)D"r   c                L    U R                   R                  X R                  S9nU$ )zRemove the Widget from the DOM (effectively deleting it).

Returns:
    An awaitable object that waits for the widget to be removed.
)r|   )r   _prunerx   )r{   await_removes     r~   r  Widget.remove  s"     xxtLLAr   c                L   [        U5      (       a!  [        U[        5      (       a  UR                  n[	        U[
        5      (       a:  [        U5      nU R                   Vs/ s H  n[        X#5      (       d  M  UPM     nnOUnU R                  R                  " USU 06nU$ s  snf )zRemove the immediate children of this Widget from the DOM.

Args:
    selector: A CSS selector or iterable of widgets to remove.

Returns:
    An awaitable object that waits for the direct children to be removed.
r|   )callabler  r   r   r   r   rA   r  r@   r   rL  )r{   selectorparsed_selectorsr  children_to_removerM  s         r~   remove_childrenWidget.remove_children#  s     H*Xv">">((H h$$.x8#'=="#0%E:J4R=  " "*xx(:H4H"s    B!8B!c                 #    U R                    ISh  vN   U R                  R                  5          S7v   SSS5        SSS5      ISh  vN   g N=! , (       d  f       N!= f N! , ISh  vN  (       d  f       g= f7f)ai  Async context manager that combines widget locking and update batching.

Use this async context manager whenever you want to acquire the widget lock and
batch app updates at the same time.

Example:
    ```py
    async with container.batch():
        await container.remove_children(Button)
        await container.mount(Label("All buttons are gone."))
    ```
N)r  r   batch_updater   s    r~   r  Widget.batch>  sC      999&&( ) 99(( 999sZ   B AB A&AA& B A$B 
A!	A&$B &A=,A/-A=9B c                   U R                   (       ak  U R                  R                  (       a8  U R                  R                  S   S:w  a  U R                  R	                  U 5      $ [        U R                  S   5      $ U R                  $ )a@  Get [content](/guide/content) for the widget.

Implement this method in a subclass for custom widgets.

This method should return [markup](/guide/content#markup), a [Content][textual.content.Content] object, or a [Rich](https://github.com/Textualize/rich) renderable.

Example:
    ```python
    from textual.app import RenderResult
    from textual.widget import Widget

    class CustomWidget(Widget):
        def render(self) -> RenderResult:
            return "Welcome to [bold red]Textual[/]!"
    ```

Returns:
    A string or object to render as the widget's content.
r   r  rQ  )rD  r  r   keylinerender_keylinerX   r/  css_identifier_styledr   s    r~   r   Widget.renderP  sg    * {{!!dkk&9&9!&<&F{{11$77T33A677)))r   c                    SnU R                   R                  US5      nUb  [        U[        5      (       d   eU$ [	        X R                  5       U R                  S9nX0R                   U'   U$ )zKGet renderable, promoting str to text as required.

Returns:
    A Visual.
z_render.visualN)r   )rg  r   r   r]   r_   r   rU  )r{   r  cached_visualrG  s       r~   rE  Widget._renderl  sk     %	**..y$?$mV4444  4t7J7JK(.9%r   c                X   #    U R                   R                  XU5      I Sh  vN   g N7f)zPerform a given action, with this widget as the default namespace.

Args:
    action: Action encoded as a string.
    namespaces: Mapping of namespaces.
N)r   
run_action)r{   action
namespacess      r~   rb  Widget.run_action{  s!      hh!!&
;;;s    *(*c                J  > Sn[        US5      (       d  [        [        U5      < S35      e[        R                  (       aD  U R
                  (       d3  UR                  (       d"   U R                  R                  U SU< S35        [        TU ]-  U5      $ ! [         a     Nf = f)zPost a message to this widget.

Args:
    message: Message to post.

Returns:
    True if the message was posted, False if this widget was closed / closing.
T_preventz^ is missing expected attributes; did you forget to call super().__init__() in the constructor?zIS NOT RUNNING, z	 not sent)r  RuntimeErrorr(  r%   DEBUG
is_runningno_dispatchr  r  r/   rx  rB  )r{   messager  r  s      r~   rB  Widget.post_message  s      $ w
++=#  $B  C  ??4??7;N;N  )9'I'NO w#G,, $ s   %!B 
B"!B"c                >   #    U R                  SS9I Sh  vN   g N7f)z'Close message loop when asked to prune.F)r   N)_close_messagesrC  s     r~   on_pruneWidget.on_prune  s     """...s   c                J  #    U R                   n/ U R                  QU R                  5       QnU H  nUR                  [	        5       5        M     [        U Vs/ s H  o3R                  c  M  UR                  PM     sn6 I Sh  vN   U R                  [        R                  " 5       5      I Sh  vN   [        U[        5      (       d   eUR                  R                  U 5        U R                  R                  R!                  U 5        U R#                  5         U R$                  R'                  5         U R                  R)                  5         [+        [,        / 5      U l        U R0                  R'                  5         U R2                  R'                  5         gs  snf  GN N7f)zClean up DOM tree.N)rx   r  r  rB  rU   r   _task_dispatch_messager'   Unmountr   rF   r  r  r   	_registrydiscard_detachrq  r  _clearr   rI   rj  _component_styles_query_one_cache)r{   r|   r  r  s       r~   _message_loop_exitWidget._message_loop_exit  s/    =T]]=T%:%:%<=Deg&  hQhd**ztzzhQRRR$$V^^%5666&'****d#""4(%%'))R8$$&##% RR6s7   AF#F,F<F#F+F#/F!0C/F#!F#c                ,   #    U R                  5         g7f)zQCalled when there are no more events on the queue.

Args:
    event: Idle event.
N)_check_refreshrC  s     r~   _on_idleWidget._on_idle  s      	s   c                   U R                   Gb  U R                  (       Gd   U R                  nU R                  (       a"  SU l        U R	                  U R
                  5        U R                  (       ai  SU l        U R                  (       dQ  U R                  R                  S   S:w  a  U R                  5         UR                  [        R                  " 5       5        U R                  (       a=  SU l        U R                  (       a%  UR                  [        R                   " U 5      5        U R                  (       a  SU l        U R"                   H\  n[%        U[&        5      (       d    OFUR)                  5         U=R*                  S-  sl        UR                  R,                  (       a  M\    O   UR                  [        R.                  " U 5      5        gggg! [0         a     gf = f)z!Check if a refresh was requested.NFr   r  rQ  )rx   r  r   r]  rX  r  r[  rX  r  rZ  rE  rB  r(   UpdateScrollrZ  r  Updater  r   r   r  rY  auto_dimensionsrP   rG   )r{   r   ancestors      r~   r  Widget._check_refresh  sc   <<#DMMM? 0049D1OOD$;$;<((,1D)00;;..q1V; !OO-++H,A,A,CD))-2D*||++HOOD,AB((,1D)$(NN)(F;;! 99; 00A50'>>>! %3 ''(=> )+ -:#  s   G 
G#"G#c                t   ^ ^ SUU 4S jjnT R                  5         T R                  R                  UT 5        T $ )zGive focus to this widget.

Args:
    scroll_visible: Scroll parent to make this widget visible.

Returns:
    The `Widget` instance.
c                \   >  U R                   R                  TTS9  g! [         a     gf = f)zCallback to set the focus.)r  N)r   	set_focusrG   )r   r  r{   s    r~   r  Widget.focus.<locals>.set_focus  s1    ''^'L s    
++r   r   r   r   )r   r   rX  )r{   r  r  s   `` r~   r   Widget.focus  s1    	 	 	It,r   c                `     U R                   R                  U 5        U $ ! [         a     U $ f = f)zBlur (un-focus) the widget.

Focus will be moved to the next available widget in the focus chain.

Returns:
    The `Widget` instance.
)r   _reset_focusrG   r   s    r~   r"  Widget.blur  s9    	KK$$T*   		s    
--c                V    U R                   R                  U(       a  U 5        gS5        g)zCapture (or release) the mouse.

When captured, mouse events will go to this widget even when the pointer is not directly over the widget.

Args:
    capture: True to capture or False to release.
N)r   capture_mouse)r{   captures     r~   r  Widget.capture_mouse  s     	wt9D9r   c                n    U R                   R                  U L a  U R                   R                  S5        gg)zVRelease the mouse.

Mouse events will only be sent when the mouse is over the widget.
N)r   rM  r  r   s    r~   release_mouseWidget.release_mouse  s-    
 88""d*HH""4( +r   c                :    U R                   R                  U 5        g)zSelect the entire widget.N)r   _select_all_in_widgetr   s    r~   text_select_allWidget.text_select_all  s    ))$/r   c                8    U R                   R                  XUS9  g)a\  Capture text from print statements (or writes to stdout / stderr).

If printing is captured, the widget will be sent an [`events.Print`][textual.events.Print] message.

Call [`end_capture_print`][textual.widget.Widget.end_capture_print] to disable print capture.

Args:
    stdout: Whether to capture stdout.
    stderr: Whether to capture stderr.
)stdoutstderrN)r   begin_capture_print)r{   r  r  s      r~   r  Widget.begin_capture_print  s     	$$T$Hr   c                :    U R                   R                  U 5        g)z`End print capture (set with [`begin_capture_print`][textual.widget.Widget.begin_capture_print]).N)r   end_capture_printr   s    r~   r  Widget.end_capture_print)  s    ""4(r   c                   > [         TU ]  U5      (       a  U R                  [        U5      5      (       a  g[	        U[
        5      (       a  g[	        U[        5      (       a  U R                  (       + $ S$ )zCheck if a given message is enabled (allowed to be sent).

Args:
    message: A message object

Returns:
    `True` if the message will be sent, or `False` if it is disabled.
FT)rx  check_message_enabled_is_preventedr(  r   _MOUSE_EVENTS_ALLOW_IF_DISABLED"_MOUSE_EVENTS_DISALLOW_IF_DISABLEDr  )r{   rl  r  s     r~   r  Widget.check_message_enabled-  ss     w,W559K9KM:
 :
  g>??
 '#EFF 000	
 	
r   c                R   #    U R                   R                  XU S9I S h  vN $  N7f)N)default_namespace)r   _broker_event)r{   
event_namerD  s      r~   broker_eventWidget.broker_eventH  s&     XX++JQU+VVVVs   '%'c                   > U R                   R                  5         U R                  R                  5         S U l        [        TU ]  5         g rw   )rs  r  rt  rh  rx  notify_style_update)r{   r  s    r~   r  Widget.notify_style_updateK  s:    $$&  &&(!#%r   c                D   #    U R                  SU5      I S h  vN   g  N7f)Nz
mouse.downr  rC  s     r~   _on_mouse_downWidget._on_mouse_downQ  s     e444     c                D   #    U R                  SU5      I S h  vN   g  N7f)Nzmouse.upr  rC  s     r~   _on_mouse_upWidget._on_mouse_upT  s     
E222r  c                  #    UR                   U L a  U R                  (       a  U R                  R                  (       as  U R                  R                  (       aX  UR
                  S:X  a  U R                  5         O7UR
                  S:X  a'  U R                  b  U R                  R                  5         U R                  SU5      I S h  vN   g  N7f)Nr6     click)
r   r_  r   r   r  chainr  r|   r=  r  rC  s     r~   	_on_clickWidget._on_clickW  s     <<4  T[[%=%=$((BWBW;;!#((*[[A%$++*A))99;///s   CCCCc                B   #    U R                  U5      I S h  vN   g  N7frw   )
handle_keyrC  s     r~   _on_keyWidget._on_keya  s     ooe$$$s   c                4   #    [        X5      I S h  vN $  N7frw   r1   rC  s     r~   r  Widget.handle_keyd  s     !$....s   c                d   #    SnUR                  5         U R                  5       I S h  vN   g  N7fNT)prevent_default_compose)r{   rD  r  s      r~   _on_composeWidget._on_composeg  s&     #mmos   &0.0c                n  #     / U R                   Q[        U 5      QnU R                   R                  5         U R                  U5        U R	                  U5      I S h  vN   g  N! [
         a  n[        U < SU 35      UeS nAf[         a%  nU R                  R                  U5         S nAg S nAff = f7f)Nz. compose() method returned an invalid result; )	r|  r=   r  _extend_composemount_composed_widgetsrz  r  r   _handle_exception)r{   r}   errors      r~   r  Widget._composel  s     	7?..??G""((*   )--g666  	(HP  	.HH&&u--	.sE   B53A$ %B5A"B5$
B2.B  B2B-(B5-B22B5c                R   #    U(       a  U R                  U5      I Sh  vN   gg N7f)a  Called by Textual to mount widgets after compose.

There is generally no need to implement this method in your application.
See [Lazy][textual.lazy.Lazy] for a class which uses this method to implement
*lazy* mounting.

Args:
    widgets: A list of child widgets.
N)r  r{   r}   s     r~   r  Widget.mount_composed_widgetsz  s$      ..))) )s   '%'c                    g)zLHook to extend composed widgets.

Args:
    widgets: Widgets to be mounted.
Nr   r  s     r~   r  Widget._extend_compose  rd  r   c                    U R                   R                  S:X  a  SU l        U R                   R                  S:X  a  SU l        g g )Nr  T)r  r+  r  r!  r  rC  s     r~   	_on_mountWidget._on_mount  s;    ;;!!X-+/D(;;!!X--1D* .r   c                P    UR                   U L a  SU l        [        5       U l        g g NF)r  r  r!   r  rC  s     r~   	_on_leaveWidget._on_leave  s%    ::$D$wD r   c                2    UR                   U L a  SU l        g g r  )r  r  rC  s     r~   	_on_enterWidget._on_enter  s    ::#D r   c                    SU l         U R                  5         U R                  b0  U R                  R                  [        R
                  " U 5      5        g g r  )r  r   r|   rB  r'   DescendantFocusrC  s     r~   	_on_focusWidget._on_focus  s>    ;;"KK$$V%;%;D%AB #r   c                    SU l         U R                  5         U R                  b0  U R                  R                  [        R
                  " U 5      5        g g r  )r  r   r|   rB  r'   DescendantBlurrC  s     r~   _on_blurWidget._on_blur  s>    ;;"KK$$V%:%:4%@A #r   c                &   UR                   (       d  UR                  (       a8  U R                  (       a&  U R                  SS9(       a  UR	                  5         g g g U R
                  (       a&  U R                  SS9(       a  UR	                  5         g g g NFr  )ctrlshiftr  r  stopr  r  rC  s     r~   _on_mouse_scroll_downWidget._on_mouse_scroll_down  sm    ::++11%1@JJL A , ))000?JJL @ *r   c                &   UR                   (       d  UR                  (       a8  U R                  (       a&  U R                  SS9(       a  UR	                  5         g g g U R
                  (       a&  U R                  SS9(       a  UR	                  5         g g g r  )r  r  r  r  r  r  r  rC  s     r~   _on_mouse_scroll_upWidget._on_mouse_scroll_up  sl    ::++000?JJL @ , ))..u.=JJL > *r   c                t    U R                   (       a'  U R                  5       (       a  UR                  5         g g g rw   )r  r  r  rC  s     r~   _on_mouse_scroll_rightWidget._on_mouse_scroll_right  s-    ''--//

 0 (r   c                t    U R                   (       a'  U R                  5       (       a  UR                  5         g g g rw   )r  r  r  rC  s     r~   _on_mouse_scroll_leftWidget._on_mouse_scroll_left  s-    '',,..

 / (r   c                    U R                   (       aA  U R                  UR                  UR                  UR                  SS9  UR                  5         g g )Nr#  )r  r  )r  rj  r~  ry  r  r  r{   rl  s     r~   _on_scroll_toWidget._on_scroll_to  s:    NN799giiSVNWLLN r   c                h    U R                   (       a!  U R                  5         UR                  5         g g rw   )r  r  r  rC  s     r~   _on_scroll_upWidget._on_scroll_up  s%    %%!JJL &r   c                h    U R                   (       a!  U R                  5         UR                  5         g g rw   )r  r  r  rC  s     r~   _on_scroll_downWidget._on_scroll_down  s%    %%!!#JJL &r   c                h    U R                   (       a!  U R                  5         UR                  5         g g rw   )r  r  r  rC  s     r~   _on_scroll_leftWidget._on_scroll_left  s%    ''!!#JJL (r   c                h    U R                   (       a!  U R                  5         UR                  5         g g rw   )r  r  r  rC  s     r~   _on_scroll_rightWidget._on_scroll_right  s%    ''""$JJL (r   c                    U R                   (       a  U R                  R                  U5        U R                  (       a  U R                  R                  U5        g g rw   )r  rS  rB  r  r]  rC  s     r~   _on_showWidget._on_show  sA    ))%%2259''##007 (r   c                    U R                   (       a  U R                  R                  U5        U R                  (       a  U R                  R                  U5        U R
                  (       a  U R                  5         g g rw   )r  rS  rB  r  r]  r  r"  rC  s     r~   _on_hideWidget._on_hide  sQ    ))%%2259''##007>>IIK r   c                8    U R                  UR                  SS9  g )NTr  )r  r  r  s     r~   _on_scroll_to_regionWidget._on_scroll_to_region  s    gnnd;r   c                Z    U R                  5         U R                  R                  U 5        g rw   )r  workerscancel_noder   s    r~   _on_unmountWidget._on_unmount  s      &r   c                r    U R                   (       d
  [        5       eU R                  U R                  S:H  S9  g )Nr   rp  )r  r7   rs  r  r   s    r~   action_scroll_homeWidget.action_scroll_home  s-    !!, 23r   c                    U R                   (       d
  [        5       eU R                  U R                  U R                  :H  S9  g )Nr  )r  r7   r   r  rz  r   s    r~   action_scroll_endWidget.action_scroll_end  s0    !!,t}}0K0KKLr   c                Z    U R                   (       d
  [        5       eU R                  5         g rw   )r  r7   r  r   s    r~   action_scroll_leftWidget.action_scroll_left  s    ++,r   c                Z    U R                   (       d
  [        5       eU R                  5         g rw   )r  r7   r  r   s    r~   action_scroll_rightWidget.action_scroll_right  s    ++,r   c                Z    U R                   (       d
  [        5       eU R                  5         g rw   )r  r7   r  r   s    r~   action_scroll_upWidget.action_scroll_up	  s    )),r   c                Z    U R                   (       d
  [        5       eU R                  5         g rw   )r  r7   r  r   s    r~   action_scroll_downWidget.action_scroll_down  s    )),r   c                Z    U R                   (       d
  [        5       eU R                  5         g rw   )r  r7   r  r   s    r~   action_page_downWidget.action_page_down  s    )),r   c                Z    U R                   (       d
  [        5       eU R                  5         g rw   )r  r7   r  r   s    r~   action_page_upWidget.action_page_up  s    )),r   c                Z    U R                   (       d
  [        5       eU R                  5         g rw   )r  r7   r  r   s    r~   action_page_leftWidget.action_page_left  s    ++,r   c                Z    U R                   (       d
  [        5       eU R                  5         g rw   )r  r7   r  r   s    r~   action_page_rightWidget.action_page_right"  s    ++, r   informationr   severitytimeoutr   c               z    Uc  U R                   R                  UUUUS9$ U R                   R                  UUUUUS9$ )a  Create a notification.

!!! tip

    This method is thread-safe.

Args:
    message: The message for the notification.
    title: The title for the notification.
    severity: The severity of the notification.
    timeout: The timeout (in seconds) for the notification, or `None` for default.
    markup: Render the message as content markup?

See [`App.notify`][textual.app.App.notify] for the full
documentation for this method.
r   r:  r   r9  )r   notify)r{   rl  r   r:  r;  r   s         r~   r>  Widget.notify'  sZ    2 ?88??!	 #   88??! #  r   c                (    U R                  UUUUS9  g )Nr=  )r>  )r{   rl  r   r:  r   s        r~   action_notifyWidget.action_notifyP  s!     		 	 	
r   )<r  r  r_  rq  rf  re  rn  rW  rp  ro  r  r^  rl  r  r  r  rc  r  r  r  rg  rX  rY  r  r|  r\  r]  rj  rU  rm  rZ  rs  r[  rw  rd  rV  rr  ru  rb  rh  rt  ri  rv  r  r~  r  r  ra  r  r  r  r$  r  r  r  r  r  r`  r  rr  )r  r   r   r   rN  r   rO  r   r  r   r   r   r   r   )r   r   )r   list[Widget])r   rK   )r  tuple[int, int]r   r   )r   float)r   r   )r   Selection | None)r  r   r  r   r  zWidget | Noner   r   )r   zSequence[LineFilter]r   r  )r  list[WidgetPlacement]r   rG  )T)r  r   r   r   )r   VisualType | None)r  rH  )r  zVisual | RenderableType | Noner   r#   )r   r#   )rC  ztype[BaseException] | NonerD  zBaseException | NonerE  zTracebackType | Noner   r   )r  r   r   r   )rN  r   r   r   )rN  r   rc  type[ExpectType]r   r[  rw   )rN  r   rc  ztype[ExpectType] | Noner   zExpectType | Widget)rc  rI  r   r[  )r  r   rt  r   r  r   r   r!   )r  r   rt  r   r   r  )r   zVisualStyle | strr   r  )r  r   r   r>   )r  r>   r   r>   )r  zstr | Contentr   r>   )F)r   rM   r  r   r   r-   )r   Iterable[Widget])r  zint | str | 'Widget'r   ztuple['Widget', int])r}   r   r  int | str | Widget | Noner  rK  r   rt   )r}   rJ  r  rK  r  rK  r   rt   )r  ra   r  rK  r  rK  r   rt   )r  r  r  r  r  r   r   r   )r  r  r  r  r  r   r   r   )r  r  r  int | Widget | Noner  rL  r   r   )r   ra   )r   r`   r   r   )FT)r0  rM   r1  rM   r2  r	   r3  r	   r4  r   r5  r   r   r9   )r0  rM   r1  rM   r   r  )r0  rM   r1  rM   r  r  r   r  )rO  r!   r  r!   r   r   )rX  rE  rY  rE  r   r   )rc  rE  r   rE  )r   r  )r   rf   )r   re   )r   ztuple[bool, bool])r   rD  )r   rN   )r   rM   )r   rL   )r   r   )
r0  rM   r1  rM   r2  r	   r3  r	   r   r4   )r  r   rc  zfloat | Animatabler
  objectr  float | Noner  rN  r  rE  r  zEasingFunction | strr  CallbackType | Noner  r6   r   r   )r  r   r  r   r   r   )r   rP   )r   r   )r   ztuple[str, ...])r   r!   )rC  rL   r   r   )r   zCollection[Region])NN)r~  rN  ry  rN  r  r   r  rN  r  rN  r  EasingFunction | str | NonerM  r   r  rO  r  r6   r  r   r   r   )r   rP   r   r   )r~  rN  ry  rN  r   r   )r~  rN  ry  rN  r  r   r  rN  r  rN  r  rP  rM  r   r  rO  r  r6   r  r   r  r   r   r   )r~  rN  ry  rN  r  r   r  rN  r  rN  r  rP  rM  r   r  rO  r  r6   r  r   r   r   )r  r   r  rN  r  rN  r  rP  rM  r   r  rO  r  r6   r  r   rp  r   rq  r   r   r   )r  r   r  rN  r  rN  r  rP  rM  r   r  rO  r  r6   r  r   r   r   )r  r   r  rN  r  rN  r  rP  rM  r   r  rO  r  r6   r   r   )r  r   r  rN  r  rN  r  rP  rM  r   r  rO  r  r6   r   r   )r   r   r  r   r  rN  r  rN  r  rP  r  r   r  r   r  r   rM  r   r  rO  r  r6   r  r   r   r   ) r  rL   r  zSpacing | Noner  r   r  rN  r  rN  r  rP  r  r   r  r   r  r   rM  r   r  rO  r  r6   rp  r   rq  r   r  r   r   rK   )r  r   r  rN  r  rN  r  r   r  rP  rM  r   r  rO  r  r6   r  r   r   r   )r   r   r  r   r  rN  r  rN  r  rP  rM  r   r  r   r  rO  r  r6   r  r   r   r   )r   r   r   r   )NNTT)
r  bool | Noner  rQ  r  r   r  r   r   r   r   )r  rL   r   rL   )r  rL   r   zIterable[tuple[Widget, Region]])r   r   )r   ztuple[int, ...])r   zJustifyMethod | None)r   r   r  r!   r   r   )r
  r   r   r   )r  r   r   r   )
r   rM   rr  rM   rs  rM   r   r   r   r   )rr  rM   r   r   )r   r  )r"  rZ   r   ztuple[str, str] | None)r"  rF  r   r   )ry  r  r   r[   )r4  rL   r   r   )r~  r  ry  r  r   r!   )rD  events.Eventr   r   )
rC  rL   r  r   r   r   r  r   r   r#   )r   r8   )r  )rQ  z(str | type[QueryType] | Iterable[Widget]r   r8   )r   zAsyncGenerator[None, None])r   r   )r   r]   )rc  r   rd  zMapping[str, DOMNode] | Noner   r   )rl  rS   r   r   )rD  zmessages.Pruner   r   )rD  zevents.Idler   r   )r  r   r   r#   )r  r   r   r   )TT)r  r   r  r   r   r   )r  r   rD  rR  r   r   )rD  zevents.MouseDownr   r   )rD  zevents.MouseUpr   r   )rD  zevents.Clickr   r   )rD  
events.Keyr   r   )rD  rS  r   r   )rD  zevents.Composer   r   )r}   rC  r   r   )rD  zevents.Mountr   r   )rD  zevents.Leaver   r   )rD  zevents.Enterr   r   )rD  zevents.Focusr   r   )rD  zevents.Blurr   r   )rD  zevents.MouseScrollDownr   r   )rD  zevents.MouseScrollUpr   r   )rD  zevents.MouseScrollRightr   r   )rD  zevents.MouseScrollLeftr   r   )rl  rj   r   r   )rD  rk   r   r   )rD  rg   r   r   )rD  rh   r   r   )rD  ri   r   r   )rD  zevents.Showr   r   )rD  zevents.Hider   r   )rl  zmessages.ScrollToRegionr   r   )rl  r   r   r   r:  rV   r;  rN  r   r   r   r   )r  r8  T)
rl  r   r   r   r:  r   r   r   r   r   ($  r   r   r   r   r   DEFAULT_CSSrk  r  r   r  r  r  r  r	  r
  r  r  rW   r  r  r  r  r!   r  r  r  rM   rr  r  r  r  r  r$  r  r  r  r   r~  r  r  rM  r   propertyr  r  r  r  r  r  r  r  setterr  r  r  r  r  r  r  classmethodr  r  r  r  r  r  r  r  r  r  r	  r  r  r  r%  r  r  r(  r1  r<  r>  r@  rB  rF  rH  r>  rH  rK  rN  rU  rY  r   r[  r   r   r_  rk  rr  r  r  r  r   r.   r  r  r  r  r  r  r  r  r=   r  r  r  rA  r   r*  rP  rZ  r^  rd  rh  rl  ro  ra  r  rz  r  r  r  r  r]  rS  r  r  r  r#  r,  r"  r  r   r  r  rs  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rx  r  r  r$  r-  r  r  r)   r  r  r   rD  r  r&  r)  r,  r   r8  r=  rE  rI  r\  r_  rb  rf  rj  rn  rs  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  r#  r&  r+  r0  r5  r9  r>  rE  rV  r   r  rT  r   r  r   rE  rb  rB  rp  r|  r  r  r   r"  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r	  r  r  r  r  r  r  r!  r$  r'  r*  r-  r0  r3  r6  r>  rA  r   __classcell__)r  s   @r~   r   r     sb   K( -0E)1%"$L-$3%'O]'6,0N)0 $(L.' T%)NN) ]!E>!cIt###.%e_FN,9%d^FN+8!)$J/4'Hn.w#+E5#AKAL'/|}37&uoG^-]DAJt4LO ( >I~>1"*5%"@K@3 (eE JHoJ, (eE JHoJ,sE2O-sE2O-.6uT.J^J$08t0L~L&>L>"nOA "#K"F2F0F 	3F 	8	F
 	5F 	8F 	<F 	AF 	>F 	5F 	;F 	5F 	<F 	:F 	8F  	6!F" 	+#F$ ./'FOB 2  "HH H 	H
 H H H 
H HB       	 	 C C E E 
 
 V V G G ]]> >           N N
 6 6 KO55'-5;H5	5 54	#+ ""/	 &; ;%*-   ^^ $		'.                
4,4 &4 %	4
 
4/	+"& X6J	9 
9			(8		 
	
 ?C$;	6 	: 
:			(8		 
	
 ?C$;	4T, ,1$(3(3$((3;G(3	(3V 8=B"%B04B	BH: ; ;? ?1 .()/Oh -1+/	RR *R )	R
 
Rh -1+/! *	
 ) 
J -1+/*Y%*Y *	*Y
 )*Y 
*YX 	 		 !		
 	 	 
	 
  		  		
 	 	 
	 '+%)C"C" $	C"
 #C" 
C"J&#410 !&OO O !	O
 "O O O 
Ob>B9$)98=9	9##2929 
 
 
 
 J J J J S S W W & &"  (  *;<z 	N 	N N N 	U 	U Y Y 
 
 : : ( ( 3 3   $ $   	 	   ; ;   	 	 	  	  	" 	"     < <   
 
 ! ! B B        &  $  77 7 !	7
 "7 
7| "!%"'5+/ &'
'
 "'

 '
 '
 '
 '
 %'
 )'
 '
 
'
R
J 
J : : C C C C    . .    (  ( 
 
=2 h(
 "!%.2+/ '#h(h( h(
 h( h( h( ,h( h( )h( h( h( 
h(T ! !	9" A
 "!%.2+/ '#AA A
 A A A ,A A )A A A A 
AJ (

 "!%.2+/ '(
(
 (

 (
 (
 (
 ,(
 (
 )(
 (
 (
 
(
Z "!%.2+/ '*
 *
 	*

 *
 ,*
 *
 )*
 *
 *
 *
 *
 
*
^ "!%.2+/ 'B8 B8 	B8
 B8 ,B8 B8 )B8 B8 B8 B8 B8 
B8N "!%.2+/ '#
 #
 	#

 #
 ,#
 #
 )#
 #
 #
 
#
P "!%.2+/ '&
 &
 	&

 &
 ,&
 &
 )&
 &
 
&
V "!%.2+/ '#
 #
 	#

 #
 ,#
 #
 )#
 #
 #
 
#
P "!%.2+/ '&
 &
 	&

 &
 ,&
 &
 )&
 &
 
&
V "!%.2+/ '#
 #
 	#

 #
 ,#
 #
 )#
 #
 #
 
#
P "!%.2+/ ''
 '
 	'

 '
 ,'
 '
 )'
 '
 
'
X "!%.2+/ '#
 #
 	#

 #
 ,#
 #
 )#
 #
 #
 
#
P "!%.2+/ '&
 &
 	&

 &
 ,&
 &
 )&
 &
 
&
V "!%.2+/ '
 
 	

 
 ,
 
 )
 
 

H "!%.2+/ '
 
 	

 
 ,
 
 )
 
 

H "!%.2+/ '!
 !
 	!

 !
 ,!
 !
 )!
 !
 
!
L "!%.2+/ '!
 !
 	!

 !
 ,!
 !
 )!
 !
 
!
N "!%.2#+/ 'UU 	U
 U U ,U U U U U )U U U 
Uv #'"!%.2#+/ '#kk  	k
 k k k ,k k k k k )k k k  !k" #k$ 
%k^ 9 #!%.2+/ '99 	9
 9 9 ,9 9 )9 9 9 
9 9| ,

 #!%.2#+/ ',
,
 ,

 ,
 ,
 ,,
 ,
 ,
 ),
 ,
 ,
 
,
 ,
\64 "&*. !% ( 	
  
 4$L=2~* 
 
(6;	B""* TX!!(,!>B!LP!	!F>. *" *"X-*$*"8$+! 44 4 	4
 4 
4l DG@	6  "*8  GK	<	<'C	<		<- -0/&. ?D *: :)0I I)
 
6W& &530%/
7*2'
$CB!!






8<'4
M




 

 
! "/ $'' 	'
  ' ' ' 
' 'X %

 
 	

 
 

 
 
r   r   )r   
__future__r   asyncior   r   r   collectionsr   
contextlibr   	fractionsr	   timer
   typesr   typingr   r   r   r   r   r   r   r   r   r   r   r   r   	rich.reprrichrich.consoler   r   r   r   r   r   RichRenderResultrich.measurer   rich.segmentr    
rich.styler!   	rich.textr"   typing_extensionsr#   textual.css.stylesr$   r  textualr%   r&   r'   r(   textual._animatorr)   r*   r+   r,   textual._arranger-   r.   textual._contextr/   textual._debugr0   textual._dispatch_keyr2   textual._easingr3   textual._extremar4   textual._styles_cacher5   textual._typesr6   textual.actionsr7   textual.await_remover8   textual.box_modelr9   textual.cacher:   r;   textual.colorr<   textual.composer=   textual.contentr>   r?   textual.css.matchr@   textual.css.parserA   textual.css.queryrB   rC   textual.css.scalarrD   rE   textual.domrF   rG   textual.geometryrH   rI   rJ   rK   rL   rM   rN   rO   textual.layoutrP   rQ   textual.layouts.verticalrR   textual.messagerS   textual.messagesrT   rU   textual.notificationsrV   textual.reactiverW   textual.renderables.blankrX   textual.rlockrY   textual.selectionrZ   textual.stripr[   textual.styler\   r  textual.visualr]   r^   r_   r`   ra   rb   textual.filterrc   textual.message_pumprd   r  re   rf   rg   rh   ri   rj   rk   rr   r   
MouseEventEnterr  r  MouseScrollDownMouseScrollUpMouseScrollRightMouseScrollLeftr  reprr  rt   r   r   r  r   r   r   r   r  r   r   r   r~   <module>r     s
  
 # - -  *          : $     " )( 7 7 W W 7 - 3 . 1 $ - ) & , & -  # 0 # - 2 3 )	 	 	 3 3 # 0 / % +  '  $ . 8 8.+)0   *&  '-&7&7v||%T "



	#  &) &) &)R0B 0Bf": ") H H	J 	 :SI S AI
W AI
 AI
r   