+
    j,i@K                        ^ RI Ht ^ RIHt ^ RIHtHt ^ RIHt ^ RI	H
t
 ^RIHtHt ^RIHtHtHtHt ^RIHtHt ^R	IHtHtHt R
.tRt ! R R
]4      tR# )    )annotations)Point)FilterOrBool	to_filter)KeyBindingsBase)
MouseEvent)	ContainerScrollOffsets)AnyDimension	Dimensionsum_layout_dimensionsto_dimension)MouseHandlerMouseHandlers)CharScreenWritePositionScrollablePanei'  c            
          ] tR t^tRtRRR]RRRRRR3
R R lltR R	 ltR
 R ltR R lt	R R lt
R R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR  R! ltR" R# ltR$tR# )%r   a  
Container widget that exposes a larger virtual screen to its content and
displays it in a vertical scrollbale region.

Typically this is wrapped in a large `HSplit` container. Make sure in that
case to not specify a `height` dimension of the `HSplit`, so that it will
scale according to the content.

.. note::

    If you want to display a completion menu for widgets in this
    `ScrollablePane`, then it's still a good practice to use a
    `FloatContainer` with a `CompletionsMenu` in a `Float` at the top-level
    of the layout hierarchy, rather then nesting a `FloatContainer` in this
    `ScrollablePane`. (Otherwise, it's possible that the completion menu
    is clipped.)

:param content: The content container.
:param scrolloffset: Try to keep the cursor within this distance from the
    top/bottom (left/right offset is not used).
:param keep_cursor_visible: When `True`, automatically scroll the pane so
    that the cursor (of the focused window) is always visible.
:param keep_focused_window_visible: When `True`, automatically scroll the
    pane so that the focused window is visible, or as much visible as
    possible if it doesn't completely fit the screen.
:param max_available_height: Always constraint the height to this amount
    for performance reasons.
:param width: When given, use this width instead of looking at the children.
:param height: When given, use this height instead of looking at the children.
:param show_scrollbar: When `True` display a scrollbar on the right.
NT^vc               H    V ^8  d   QhRRRRRRRRRR	R
RRRRRRRRRRRRR/# )   contentr	   scroll_offsetszScrollOffsets | Nonekeep_cursor_visibler   keep_focused_window_visiblemax_available_heightintwidthr   heightshow_scrollbardisplay_arrowsup_arrow_symbolstrdown_arrow_symbolreturnNone )formats   "G/usr/lib/python3/dist-packages/prompt_toolkit/layout/scrollable_pane.py__annotate__ScrollablePane.__annotate__4   s     ! !! -! *	!
 &2! "! ! ! %! %! ! ! 
!    c                	   Wn         T;'       g    \        ^^R7      V n        \        V4      V n        \        V4      V n        WPn        W`n        Wpn        \        V4      V n	        \        V	4      V n
        Wn        Wn        ^ V n        R# )   )topbottomN)r   r
   r   r   r   r   r   r    r!   r"   r#   r$   r&   vertical_scroll)selfr   r   r   r   r   r    r!   r"   r#   r$   r&   s   &&&&&&&&&&&&r+   __init__ScrollablePane.__init__4   sz     ,NN!A0N#,-@#A +45P+Q($8!
'7'7.!2 r.   c                   V ^8  d   QhRR/# )r   r'   r%   r)   )r*   s   "r+   r,   r-   P   s     3 3# 3r.   c                	$    R V P                   : R2# )zScrollablePane()r   r4   s   &r+   __repr__ScrollablePane.__repr__P   s      022r.   c                   V ^8  d   QhRR/# )r   r'   r(   r)   )r*   s   "r+   r,   r-   S   s      t r.   c                	:    V P                   P                  4        R # N)r   resetr;   s   &r+   rA   ScrollablePane.resetS   s    r.   c                    V ^8  d   QhRRRR/# )r   max_available_widthr   r'   r   r)   )r*   s   "r+   r,   r-   V   s      3 9 r.   c                	    V P                   e   \        V P                   4      # V P                  P                  V4      pV P	                  4       '       d"   \        \        P                  ! ^4      V.4      # V# r@   )r    r   r   preferred_widthr"   r   r   exact)r4   rD   content_widths   && r+   rF   ScrollablePane.preferred_widthV   sb    ::!

++ 445HI   ()//!*<m)LMMr.   c               $    V ^8  d   QhRRRRRR/# )r   r    r   r   r'   r   r)   )r*   s   "r+   r,   r-   d   s!     ? ?c ? ? ?r.   c                	    V P                   e   \        V P                   4      # V P                  4       '       d
   V^,          pV P                  P	                  WP
                  4      p\        ^ VP                  R7      # )N)min	preferred)r!   r   r"   r   preferred_heightr   r   rM   )r4   r    r   	dimensions   &&& r+   rN   ScrollablePane.preferred_heightd   sd    ;;",,   QJELL11%9R9RS	 Q)*=*=>>r.   c               4    V ^8  d   QhRRRRRRRRR	R
RRRR/# )r   screenr   mouse_handlersr   write_positionr   parent_styler%   erase_bgboolz_indexz
int | Noner'   r(   r)   )r*   s   "r+   r,   r-   s   sY     u uu &u &	u
 u u u 
ur.   c                f   V P                  4       pV'       d   VP                  ^,
          pMVP                  pT P                  P                  WP                  4      P
                  p	\        WP                  4      p	\        WP                  4      p	\        \        RVR7      R7      p
VP                  V
n        \        ^ ^ WR7      p\        4       pV P                  P                  V
VVVVV4       V
P                  4        ^ RIHp V! 4       P$                  P&                  p V
P(                  V,          pV P+                  VP                  V	VV
P,                  P/                  V4      4       V P3                  WW84       V P5                  W,W84       VP6                  pVP8                  p\        VP                  VV,           4      Vn        \        VP                  VVP                  ,           4      Vn        V P;                  WV4       V
P                  '       d   RVn        V
P,                  P=                  4        F  w  pp^ VP>                  u;8:  d   VP                  8  g   K+  M K/  V P@                  VPB                  u;8:  d%   VP                  V P@                  ,           8  g   Ko  M Ks  \E        VP>                  V,           VPB                  V,           V P@                  ,
          R7      VP,                  V&   K  	  V
PF                  P=                  4        Fc  w  ppV PI                  \E        VP>                  V,           VPB                  V,           V P@                  ,
          R7      V4      VPF                  V&   Ke  	  V'       d   V PK                  VV	V4       R# R#   \0         d     ELAi ; i)	zx
Render scrollable pane content.

This works by rendering on an off-screen canvas, and copying over the
visible region.
 )charstyle)default_char)xposyposr    r!   )get_appTxyN)&r"   r    r   rN   r   rM   maxr!   rL   r   r   show_cursorr   r   write_to_screendraw_all_floatsprompt_toolkit.applicationr`   layoutcurrent_window"visible_windows_to_write_positions_make_window_visiblecursor_positionsgetKeyError_copy_over_screen_copy_over_mouse_handlersr_   r^   _copy_over_write_positionsitemsrb   r3   rc   r   menu_positions_clip_point_to_visible_area_draw_scrollbar)r4   rR   rS   rT   rU   rV   rX   r"   virtual_widthvirtual_heighttemp_screentemp_write_positiontemp_mouse_handlersr`   focused_windowvisible_win_write_posr_   r^   windowpoints   &&&&&&&             r+   rf   ScrollablePane.write_to_screens   s"    ,,.*0014M*00M 6644

) 	
 ^-B-BC^-F-FG $C|*LM"("4"4+-
 ,o$$	
 	##% 	7 ))88	$/$R$R%! %%%%%,,00@	 	vNR 	&&	

 """"6<<)=>FMM4.2G2G+GH 	''^L"""!%F )99??AMFEUWW3~3333((77? ''$*>*>>? ? 38ggn$9M9M(M3''/ B )77==?MFE,0,L,L$%''D.4;O;O*OP-F!!&) @    i  		s   $N! !N0/N0c               $    V ^8  d   QhRRRRRR/# )r   r   r   rT   r   r'   r)   )r*   s   "r+   r,   r-      s$      ,9	r.   c                b   VP                   VP                  8  d   VP                  VP                  R7      pVP                  VP                  8  d   VP                  VP                  R7      pVP                   VP                  VP
                  ,           8  d5   VP                  VP                  VP
                  ,           ^,
          R7      pVP                  VP                  VP                  ,           8  d5   VP                  VP                  VP                  ,           ^,
          R7      pV# )zF
Ensure that the cursor and menu positions always are always reported
)rb   )rc   )rb   r^   _replacerc   r_   r    r!   )r4   r   rT   s   &&&r+   ru   *ScrollablePane._clip_point_to_visible_area   s     77^(((NN^%8%8N9E77^(((NN^%8%8N9E77n))N,@,@@@NN^%8%8>;O;O%ORS%SNTE77n))N,A,AAANN^%8%8>;P;P%PST%TNUEr.   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r   rR   r   ry   rT   r   rw   r   r'   r(   r)   )r*   s   "r+   r,   r-      sC     N NN N &	N
 N 
Nr.   c                   VP                   pVP                  p\        VP                  4       F  pVP                  WpP
                  ,           ,          pVP                  Wu,           ,          p	VP                  WpP
                  ,           ,          p
VP                  Wu,           ,          p\        V4       F-  pW,          WV,           &   W9   g   K  W,          WV,           &   K/  	  K  	  R# )zE
Copy over visible screen content and "zero width escape sequences".
N)r_   r^   ranger!   data_bufferr3   zero_width_escapes)r4   rR   ry   rT   rw   r_   r^   rc   temp_rowrowtemp_zero_width_escapesr   rb   s   &&&&&        r+   rp    ScrollablePane._copy_over_screen   s     """"~,,-A"..q3G3G/GHH$$QX.C&1&D&D((('# "(!:!:18!D=) (H/3J3M&4x0	 * .r.   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r   rS   r   r{   rT   r   rw   r   r'   r(   r)   )r*   s   "r+   r,   r-     sC     1T 1T%1T +1T &	1T
 1T 
1Tr.   c                  a aaa VP                   oVP                  o/ oR VV VV3R llpVP                  pVP                  p\        VP                  4       Fd  pW9   g   K  WxS P
                  ,           ,          p	WhS,           ,          p
\        V4       F"  pW9   g   K  V! W,          4      WS,           &   K$  	  Kf  	  R# )z
Copy over mouse handlers from virtual screen to real screen.

Note: we take `virtual_width` because we don't want to copy over mouse
      handlers that we possibly have behind the scrollbar.
c                    V ^8  d   QhRRRR/# )r   handlerr   r'   r)   )r*   s   "r+   r,   >ScrollablePane._copy_over_mouse_handlers.<locals>.__annotate__*  s     	3 	3 	3 	3r.   c                H   <a  S S9  d   R V VVV3R llpVSS &   SS ,          # )z:Wrap mouse handler. Translate coordinates in `MouseEvent`.c                    V ^8  d   QhRRRR/# )r   eventr   r'   r(   r)   )r*   s   "r+   r,   ZScrollablePane._copy_over_mouse_handlers.<locals>.wrap_mouse_handler.<locals>.__annotate__.  s     
' 
'z 
'd 
'r.   c                  < \        \        V P                  P                  S,
          V P                  P                  SP
                  ,           S,
          R 7      V P                  V P                  V P                  R7      pS! V4       R# )ra   )position
event_typebutton	modifiersN)	r   r   r   rb   rc   r3   r   r   r   )r   	new_eventr   r4   r^   r_   s   & r+   new_handlerYScrollablePane._copy_over_mouse_handlers.<locals>.wrap_mouse_handler.<locals>.new_handler.  sg     *!&#nn..5#nn..1E1EEL" $)#3#3$||"'//!I I&r.   r)   )r   r   mouse_handler_wrappersr4   r^   r_   s   f r+   wrap_mouse_handlerDScrollablePane._copy_over_mouse_handlers.<locals>.wrap_mouse_handler*  s.    44
' 
' 3>&w/)'22r.   N)r_   r^   rS   r   r!   r3   )r4   rS   r{   rT   rw   r   mouse_handlers_dicttemp_mouse_handlers_dictrc   temp_mouse_row	mouse_rowrb   r   r^   r_   s   f&&&&       @@@r+   rq   (ScrollablePane._copy_over_mouse_handlers  s     """" DF	3 	3( -;;#6#E#E ~,,-A,!9d>R>R:R!S/D9	}-A*.@AR.S	d(+ .	 .r.   c               (    V ^8  d   QhRRRRRRRR/# )r   rR   r   ry   rT   r   r'   r(   r)   )r*   s   "r+   r,   r-   I  s,      +1CP	r.   c                B   VP                   pVP                  pVP                  P                  4        Fh  w  rg\	        VP                  V,           VP                   V,           V P
                  ,
          VP                  VP                  R7      VP                  V&   Kj  	  R# )z#
Copy over window write positions.
)r^   r_   r!   r    N)r_   r^   rk   rs   r   r3   r!   r    )r4   rR   ry   rT   r_   r^   win	write_poss   &&&&    r+   rr   )ScrollablePane._copy_over_write_positionsI  s     """")LLRRTNC=J^^d*^^d*T-A-AA !''oo>F55c: Ur.   c                   V ^8  d   QhRR/# )r   r'   rW   r)   )r*   s   "r+   r,   r-   \  s     ' '$ 'r.   c                	6    V P                   P                  4       # r@   )r   is_modalr;   s   &r+   r   ScrollablePane.is_modal\  s    ||$$&&r.   c                   V ^8  d   QhRR/# )r   r'   zKeyBindingsBase | Noner)   )r*   s   "r+   r,   r-   _  s     / /"8 /r.   c                	6    V P                   P                  4       # r@   )r   get_key_bindingsr;   s   &r+   r   ScrollablePane.get_key_bindings_  s    ||,,..r.   c                   V ^8  d   QhRR/# )r   r'   zlist[Container]r)   )r*   s   "r+   r,   r-   b  s      o r.   c                	    V P                   .# r@   r:   r;   s   &r+   get_childrenScrollablePane.get_childrenb  s    ~r.   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r   visible_heightr   rx   r}   r   cursor_positionzPoint | Noner'   r(   r)   )r*   s   "r+   r,   r-   e  sC     @. @.@. @.  -	@.
 &@. 
@.r.   c                   ^ pW!,
          pV P                  4       '       dy   Veu   V P                  pVP                  V,
          ^,           VP                  ,           pVP                  VP                  ,
          p	\        WX4      p\        ^ \        Wi4      4      pV P                  4       '       d   VP                  V8:  d2   VP                  VP                  ,           V,
          p
VP                  pM0VP                  p
VP                  VP                  ,           V,
          p\        WZ4      p\        Wk4      pWV8  d   TpV P                  V8  d   W`n
        V P                  V8  d	   WPn
        R# R# )a  
Scroll the scrollable pane, so that this window becomes visible.

:param visible_height: Height of this `ScrollablePane` that is rendered.
:param virtual_height: Height of the virtual, temp screen.
:param visible_win_write_pos: `WritePosition` of the nested window on the
    temp screen.
:param cursor_position: The location of the cursor position of this
    window on the temp screen.
N)r   r   rc   r2   r1   rd   rL   r   r!   r_   r3   )r4   r   rx   r}   r   
min_scroll
max_scrolloffsetscpos_min_scrollcpos_max_scrollwindow_min_scrollwindow_max_scrolls   &&&&&       r+   rl   #ScrollablePane._make_window_visiblee  sV   & 
#4
##%%*--#%%6:W^^K   #2"3"3gkk"A =
 C
$DE
++-- %++~=)..+223$% "
 %:$>$>! %:$>$>!)..+223$% " Z;JZ;J"#J *,#- *,#-  -r.   c               (    V ^8  d   QhRRRRRRRR/# )	r   rT   r   content_heightr   rR   r   r'   r(   r)   )r*   s   "r+   r,   r-     s2     G G+G=@GJPG	Gr.   c           
       aa VP                   pV P                  4       pV'       d
   V^,          p VP                   \        V4      ,          pV P                  \        V4      ,          p\	        \        V\        ^WF,          4      4      4      o\	        WG,          4      oR VV3R llpVP                  VP                  ,           ^,
          p	VP                  p
VP                  pV'       d)   \        V P                  R4      W,          V	&   V
^,          p
RpRpRpRp\        V4       Ff  pRpV! V4      '       d   V! V^,           4      '       g   TpMTpMV! V^,           4      '       d   TpMTp\        R	V4      W,          V	&   V
^,          p
Kh  	  V'       d"   \        V P                  R4      W,          V	&   R
# R
#   \         d     R
# i ; i)zz
Draw the scrollbar on the screen.

Note: There is some code duplication with the `ScrollbarMargin`
      implementation.
c                    V ^8  d   QhRRRR/# )r   r   r   r'   rW   r)   )r*   s   "r+   r,   4ScrollablePane._draw_scrollbar.<locals>.__annotate__  s     P Pc Pd Pr.   c                >   < ST u;8*  ;'       d    SS,           8*  # u # )z/True if we should display a button on this row.r)   )r   scrollbar_heightscrollbar_tops   &r+   is_scroll_button8ScrollablePane._draw_scrollbar.<locals>.is_scroll_button  s"    $OO}?O/OOOOOr.   zclass:scrollbar.arrowzclass:scrollbar.backgroundz*class:scrollbar.background,scrollbar.startzclass:scrollbar.buttonz$class:scrollbar.button,scrollbar.end rZ   N)r!   r#   floatr3   r   rL   rd   r^   r    r_   r   r   r$   r   r&   ZeroDivisionError)r4   rT   r   rR   window_heightr#   fraction_visiblefraction_abover   r^   r_   r   scrollbar_backgroundscrollbar_background_startscrollbar_buttonscrollbar_button_endir\   r   r   s   &&&&              @@r+   rv   ScrollablePane._draw_scrollbar  s    '--,,.QM7	-44u^7LL!11E.4IIN"M3q-*J#KL    >?M
P P "&&)=)==AD!&&D ,,K *.((*A+!$' 	 $@ )U&7#I =)#A&&+AE22 !5 0'A.. : 4*.sE*:!$'	! *& *.**,C+!$' Y ! 		s   A.F= =GG)r   r#   r&   r!   r   r   r   r   r"   r$   r3   r    )__name__
__module____qualname____firstlineno____doc__MAX_AVAILABLE_HEIGHTr5   r<   rA   rF   rN   rf   ru   rp   rq   rr   r   r   r   rl   rv   __static_attributes__r)   r.   r+   r   r      s    F 04,048$8"#'+'+"!$!83?un"N61Tf&'/@.DG Gr.   N)
__future__r   prompt_toolkit.data_structuresr   prompt_toolkit.filtersr   r   prompt_toolkit.key_bindingr   prompt_toolkit.mouse_eventsr   
containersr	   r
   rO   r   r   r   r   rS   r   r   rR   r   r   r   __all__r   r   r)   r.   r+   <module>r      sD    " 0 : 6 2 0 S S 7 / /
  [Y [r.   