ó
    OÎhS‡ ã                  ó0  • S r SSKJr  SSKJr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  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  SSKJrJrJr  SSKJ r J!r!  SSK"J#r#  SSK$J%r%J&r&  SSK'J(r(J)r)J*r*J+r+  SSK,J-r-J.r.J/r/J0r0J1r1  SSK2J3r3J4r4J5r5J6r6J7r7  SSK8J9r9  SSK:J;r;  SSK<J=r=J>r>J?r?  SSK@JArA  \(       a  SSKBJCrCJDrD  SSKEJFrF  / SQrG " S S\S9rH\(       a   " S S\C5      rI\\HS4   rJS@S  jrK " S! S"\5      rL " S# S$\5      rM " S% S&\H5      rN " S' S(\N5      rO " S) S*\N5      rP " S+ S,\H5      rQ " S- S.5      rR " S/ S05      rS " S1 S25      rT " S3 S45      rU\\-  rV " S5 S6\5      rW " S7 S\H5      rX " S8 S9\H5      rY " S: S;\H5      rZSAS< jr[SBS= jr\SCS> jr]g?)Dza
Container for the layout.
(Containers can contain other containers or user interface controls.)
é    )Úannotations)ÚABCMetaÚabstractmethod)ÚEnum)Úpartial)ÚTYPE_CHECKINGÚCallableÚSequenceÚUnionÚcast)Úget_app)ÚSimpleCache)ÚPoint)ÚFilterOrBoolÚemacs_insert_modeÚ	to_filterÚvi_insert_mode)ÚAnyFormattedTextÚStyleAndTextTuplesÚto_formatted_text)Úfragment_list_to_textÚfragment_list_width)ÚKeyBindingsBase)Ú
MouseEventÚMouseEventType)Ú
get_cwidthÚtake_using_weightsÚto_intÚto_stré   )ÚDummyControlÚFormattedTextControlÚGetLinePrefixCallableÚ	UIContentÚ	UIControl)ÚAnyDimensionÚ	DimensionÚmax_layout_dimensionsÚsum_layout_dimensionsÚto_dimension)ÚMargin)ÚMouseHandlers)Ú_CHAR_CACHEÚScreenÚWritePosition)Úexplode_text_fragments)ÚProtocolÚ	TypeGuard)ÚNotImplementedOrNone)ÚAnyContainerÚ	ContainerÚHorizontalAlignÚVerticalAlignÚHSplitÚVSplitÚFloatContainerÚFloatÚWindowAlignÚWindowÚWindowRenderInfoÚConditionalContainerÚScrollOffsetsÚColorColumnÚto_containerÚ	to_windowÚis_containerÚDynamicContainerc                  ó¬   • \ rS rSrSr\SS j5       r\SS j5       r\SS j5       r\              SS j5       r	SS jr
SS jr\SS	 j5       rS
rg)r5   éR   z'
Base class for user interface layout.
c                ó   • g)z]
Reset the state of this container and all the children.
(E.g. reset scroll offsets, etc...)
N© ©Úselfs    Ú]/home/mande/repo/quber/.venv/lib/python3.13/site-packages/prompt_toolkit/layout/containers.pyÚresetÚContainer.resetW   ó   � ó    c                ó   • g)zj
Return a :class:`~prompt_toolkit.layout.Dimension` that represents the
desired width for this container.
NrI   ©rK   Úmax_available_widths     rL   Úpreferred_widthÚContainer.preferred_width^   rO   rP   c                ó   • g)zk
Return a :class:`~prompt_toolkit.layout.Dimension` that represents the
desired height for this container.
NrI   ©rK   ÚwidthÚmax_available_heights      rL   Úpreferred_heightÚContainer.preferred_heighte   rO   rP   c                ó   • g)aõ  
Write the actual content to the screen.

:param screen: :class:`~prompt_toolkit.layout.screen.Screen`
:param mouse_handlers: :class:`~prompt_toolkit.layout.mouse_handlers.MouseHandlers`.
:param parent_style: Style string to pass to the :class:`.Window`
    object. This will be applied to all content of the windows.
    :class:`.VSplit` and :class:`.HSplit` can use it to pass their
    style down to the windows that they contain.
:param z_index: Used for propagating z_index from parent to child.
NrI   ©rK   ÚscreenÚmouse_handlersÚwrite_positionÚparent_styleÚerase_bgÚz_indexs          rL   Úwrite_to_screenÚContainer.write_to_screenl   rO   rP   c                ó   • g)zŽ
When this container is modal, key bindings from parent containers are
not taken into account if a user control in this container is focused.
FrI   rJ   s    rL   Úis_modalÚContainer.is_modal‚   s   € ð
 rP   c                ó   • g)zÔ
Returns a :class:`.KeyBindings` object. These bindings become active when any
user control in this container has the focus, except if any containers
between this container and the focused user control is modal.
NrI   rJ   s    rL   Úget_key_bindingsÚContainer.get_key_bindings‰   s   € ð rP   c                ó   • / $ )z7
Return the list of child :class:`.Container` objects.
rI   rJ   s    rL   Úget_childrenÚContainer.get_children‘   s	   € ð
 ˆ	rP   rI   N©ÚreturnÚNone©rS   Úintrp   r'   ©rX   rs   rY   rs   rp   r'   ©r^   r.   r_   r,   r`   r/   ra   Ústrrb   Úboolrc   ú
int | Nonerp   rq   ©rp   rw   ©rp   úKeyBindingsBase | None©rp   zlist[Container])Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   rM   rT   rZ   rd   rg   rj   rm   Ú__static_attributes__rI   rP   rL   r5   r5   R   s¹   † ñð óó ðð óó ðð óó ðð ðàðð &ðð &ð	ð
 ðð ðð ðð 
óó ðô*ôð óó órP   r5   )Ú	metaclassc                  ó"   • \ rS rSrSrSS jrSrg)ÚMagicContaineré›   zI
Any object that implements ``__pt_container__`` represents a container.
c                ó   • g ©NrI   rJ   s    rL   Ú__pt_container__ÚMagicContainer.__pt_container__    s   € °CrP   rI   N)rp   r4   )r}   r~   r   r€   r�   r‰   r‚   rI   rP   rL   r…   r…   ›   s   † ñ	÷ 	8rP   r…   r=   c                 ó(   • [        [        S/S95      $ )z<Create a `Window` that displays the 'Window too small' text.)zclass:window-too-smallz Window too small... )Útext)r=   r"   rI   rP   rL   Ú_window_too_smallr�   ¦   s   € äÜÐ#VÐ"WÑXóð rP   c                  ó(   • \ rS rSrSrSrSrSrSrSr	g)	r7   é­   zAlignment for `HSplit`.ÚTOPÚCENTERÚBOTTOMÚJUSTIFYrI   N)
r}   r~   r   r€   r�   r�   r‘   r’   r“   r‚   rI   rP   rL   r7   r7   ­   s   † Ùà
€CØ€FØ€FØƒGrP   r7   c                  ó(   • \ rS rSrSrSrSrSrSrSr	g)	r6   é¶   zAlignment for `VSplit`.ÚLEFTr‘   ÚRIGHTr“   rI   N)
r}   r~   r   r€   r�   r–   r‘   r—   r“   r‚   rI   rP   rL   r6   r6   ¶   s   † Ùà€DØ€FØ€EØƒGrP   r6   c            
      ó¦   • \ rS rSrSrS\R                  " S5      SSSSSSSS4
                       SS jjrSS jrSS	 jr	SS
 jr
Srg)Ú_Splité¿   z,
The common parts of `VSplit` and `HSplit`.
Nr   Ú Fc                óì   • U Vs/ s H  n[        U5      PM     snU l        U=(       d
    [        5       U l        X0l        X@l        XPl        X`l        Xpl        X€l	        X�l
        X l        X°l        g s  snf rˆ   )rB   Úchildrenr�   Úwindow_too_smallÚpaddingÚpadding_charÚpadding_stylerX   Úheightrc   ÚmodalÚkey_bindingsÚstyle)rK   r�   rž   rŸ   r    r¡   rX   r¢   rc   r£   r¤   r¥   Úcs                rL   Ú__init__Ú_Split.__init__Ä   sd   € ñ 3;Ó;²(¨Qœ až±(Ñ;ˆŒØ 0× GÔ4EÓ4GˆÔØŒØ(ÔØ*ÔàŒ
ØŒØŒàŒ
Ø(ÔØ�
ùò <s   …A1c                ó   • U R                   $ rˆ   ©r£   rJ   s    rL   rg   Ú_Split.is_modalà   ó   € Ø�z‰zÐrP   c                ó   • U R                   $ rˆ   ©r¤   rJ   s    rL   rj   Ú_Split.get_key_bindingsã   ó   € Ø× Ñ Ð rP   c                ó   • U R                   $ rˆ   )r�   rJ   s    rL   rm   Ú_Split.get_childrenæ   s   € Ø�}‰}ÐrP   )r�   r¢   r¤   r£   rŸ   r    r¡   r¥   rX   rž   rc   )r�   úSequence[AnyContainer]rž   úContainer | NonerŸ   r&   r    ú
str | Noner¡   rv   rX   r&   r¢   r&   rc   rx   r£   rw   r¤   r{   r¥   ústr | Callable[[], str]rp   rq   ry   rz   r|   )r}   r~   r   r€   r�   r'   Úexactr§   rg   rj   rm   r‚   rI   rP   rL   r™   r™   ¿   sº   † ñð .2Ø )§¢°Ó 2Ø#'ØØ"Ø#Ø"ØØ/3Ø)+ðà(ðð +ðð ð	ð
 !ðð ðð ðð ðð ðð ðð -ðð 'ðð 
õô8ô!÷rP   r™   c                  óò   ^ • \ rS rSrSrS\R                  SSSSSSSSS4                         SU 4S jjjrSS jrSS	 jr	SS
 jr
\SS j5       r              SS jrSS jrSrU =r$ )r8   éê   aA  
Several layouts, one stacked above/under the other. ::

    +--------------------+
    |                    |
    +--------------------+
    |                    |
    +--------------------+

By default, this doesn't display a horizontal line between the children,
but if this is something you need, then create a HSplit as follows::

    HSplit(children=[ ... ], padding_char='-',
           padding=1, padding_style='#ffff00')

:param children: List of child :class:`.Container` objects.
:param window_too_small: A :class:`.Container` object that is displayed if
    there is not enough space for all the children. By default, this is a
    "Window too small" message.
:param align: `VerticalAlign` value.
: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 z_index: (int or None) When specified, this can be used to bring
    element in front of floating elements.  `None` means: inherit from parent.
:param style: A style string.
:param modal: ``True`` or ``False``.
:param key_bindings: ``None`` or a :class:`.KeyBindings` object.

:param padding: (`Dimension` or int), size to be used for the padding.
:param padding_char: Character to be used for filling in the padding.
:param padding_style: Style to applied to the padding.
Nr   r›   Fc                óz   >• [         TU ]  UUUUUUUU	U
UUS9  X0l        [        SS9U l        [        5       U l        g ©N)r�   rž   rŸ   r    r¡   rX   r¢   rc   r£   r¤   r¥   r    ©Úmaxsize©Úsuperr§   Úalignr   Ú_children_cacher=   Ú_remaining_space_window©rK   r�   rž   rÀ   rŸ   r    r¡   rX   r¢   rc   r£   r¤   r¥   Ú	__class__s                €rL   r§   ÚHSplit.__init__  ó]   ø€ ô 	‰ÑØØ-ØØ%Ø'ØØØØØ%Øð 	ñ 	
ð Œ
ô  Ñ"ð 	Ôô (.£xˆÕ$rP   c                óð   • U R                   b  [        U R                   5      $ U R                  (       a5  U R                   Vs/ s H  o"R                  U5      PM     nn[	        U5      $ [        5       $ s  snf rˆ   )rX   r*   r�   rT   r(   r'   ©rK   rS   r¦   Ú
dimensionss       rL   rT   ÚHSplit.preferred_width0  s]   € Ø�:‰:Ñ!Ü §
¡
Ó+Ð+à�=�=ØJNÏ-Ê-ÓXÊ-ÀQ×+Ñ+Ð,?Ö@É-ˆJÐXÜ(¨Ó4Ð4ä“;Ðùò Ys   ÁA3c                óº   • U R                   b  [        U R                   5      $ U R                   Vs/ s H  o3R                  X5      PM     nn[	        U5      $ s  snf rˆ   )r¢   r*   Ú_all_childrenrZ   r)   )rK   rX   rY   r¦   rÉ   s        rL   rZ   ÚHSplit.preferred_height:  s]   € Ø�;‰;Ñ"Ü §¡Ó,Ð,ð FJ×EWÒEWó
ÚEWÀ×Ñ˜uÖ;ÑEWð 	ð 
ô % ZÓ0Ð0ùò
ó   ±Ac                óJ   • U R                    H  nUR                  5         M     g rˆ   ©r�   rM   ©rK   r¦   s     rL   rM   ÚHSplit.resetC  ó   € Ø—”ˆAØ�G‰GŽIò rP   c                ór   ^ • SU 4S jjnT R                   R                  [        T R                  5      U5      $ )ú+
List of child objects, including padding.
c            	     ó&  >• / n TR                   [        R                  [        R                  4;   a  U R	                  [        [        SS9S95        TR                   HL  nU R	                  U5        U R	                  [        TR                  TR                  TR                  S95        MN     U (       a  U R                  5         TR                   [        R                  [        R                  4;   a  U R	                  [        [        SS9S95        U $ )Nr   ©Ú	preferred©rX   )r¢   Úcharr¥   )rÀ   r7   r‘   r’   Úappendr=   r'   r�   rŸ   r    r¡   Úpopr�   ©ÚresultÚchildrK   s     €rL   ÚgetÚ!HSplit._all_children.<locals>.getM  sÎ   ø€ Ø&(ˆFð �z‰zœm×2Ñ2´M×4HÑ4HÐIÓIØ—‘œf¬9¸qÑ+AÑBÔCð Ÿœ�Ø—‘˜eÔ$Ø—‘ÜØ#Ÿ|™|Ø!×.Ñ.Ø"×0Ñ0ñöñ 'ö Ø—
‘
”ð �z‰zœm×2Ñ2´M×4EÑ4EÐFÓFØ—‘œf¬9¸qÑ+AÑBÔCàˆMrP   r|   ©rÁ   rà   Útupler�   ©rK   rà   s   ` rL   rÌ   ÚHSplit._all_childrenG  ó,   ø€ ÷	ð4 ×#Ñ#×'Ñ'¬¨d¯m©mÓ(<¸cÓBÐBrP   c                ó:  • U R                  U5      nUS-   [        U R                  5      -   nU R                  c  UOU R                  nUc  U R                  R                  XX8XV5        gUR                  n	UR                  n
UR                  n[        XpR                  5       H)  u  pÍUR                  UU[        X©X¼5      UUU5        Xœ-  n	M+     UR                  UR                  -   U	-
  nUS:”  a+  U R                  R                  UU[        X©X¾5      UUU5        gg)úž
Render the prompt to a `Screen` instance.

:param screen: The :class:`~prompt_toolkit.layout.screen.Screen` class
    to which the output has to be written.
Ú Nr   )Ú_divide_heightsr   r¥   rc   rž   rd   ÚyposÚxposrX   ÚziprÌ   r/   r¢   rÂ   )rK   r^   r_   r`   ra   rb   rc   Úsizesr¥   rë   rì   rX   Úsr¦   Úremaining_heights                  rL   rd   ÚHSplit.write_to_screeni  s$  € ð ×$Ñ$ ^Ó4ˆØ˜sÑ"¤V¨D¯J©JÓ%7Ñ7ˆØ!Ÿ\™\Ñ1‘'°t·|±|ˆà‰=Ø×!Ñ!×1Ñ1Ø¨¸xõð
 "×&Ñ&ˆDØ!×&Ñ&ˆDØ"×(Ñ(ˆEô ˜E×#5Ñ#5Ö6‘�Ø×!Ñ!ØØ"Ü! $¨eÓ7ØØØôð ‘	’ñ 7ð   .×2Ñ2°^×5JÑ5JÑJÈTÑQÐØ !Ó#Ø×,Ñ,×<Ñ<ØØ"Ü! $¨eÓFØØØõð $rP   c           	     óÚ  • U R                   (       d  / $ UR                  nUR                  nU R                   Vs/ s H  oDR	                  X#5      PM     nn[        U5      nUR                  U:”  a  gU Vs/ s H  owR                  PM     nn[        [        [        [        U5      5      5      U Vs/ s H  owR                  PM     snS9n	[        U	5      n
[        X6R                  5      nU Vs/ s H  owR                  PM     nn[        U5      U:  a2  XŠ   XÊ   :  a  XŠ==   S-  ss'   [        U	5      n
[        U5      U:  a  M2  [        5       R                   (       dq  [        X6R"                  5      nU Vs/ s H  owR"                  PM     nn[        U5      U:  a2  XŠ   Xê   :  a  XŠ==   S-  ss'   [        U	5      n
[        U5      U:  a  M2  U$ s  snf s  snf s  snf s  snf s  snf )zJ
Return the heights for all rows.
Or None when there is not enough space.
N©ÚitemsÚweightsr    )r�   rX   r¢   rÌ   rZ   r)   Úminr   ÚlistÚrangeÚlenÚweightÚnextrØ   Úsumr   Úis_doneÚmax)rK   r`   rX   r¢   r¦   rÉ   Úsum_dimensionsÚdrî   Úchild_generatorÚiÚpreferred_stopÚpreferred_dimensionsÚmax_stopÚmax_dimensionss                  rL   rê   ÚHSplit._divide_heights¢  s¹  € ð
 �}�}ØˆIà×$Ñ$ˆØ×&Ñ&ˆð BF×ASÒASÓTÒAS¸A×(Ñ(¨Ö7ÑASˆ
ÐTô /¨zÓ:ˆð ×Ñ Ó&Øñ !+Ó+¢
˜1—”¡
ˆÐ+ä,Ü”uœS ›_Ó-Ó.É:Ó8VÊ:Àa¿¼É:Ñ8Vñ
ˆô �Ó!ˆô ˜V×%=Ñ%=Ó>ˆÙ5?Ó@²Z°§¤±ZÐÐ@ä�%‹j˜>Ó)Ø‰xÐ.Ñ1Ó1Ø“˜A‘“Ü�_Ó%ˆAô �%‹j˜>Õ)ô ‹y× × Ü˜6×#5Ñ#5Ó6ˆHÙ-7Ó8ªZ¨Ÿeœe©ZˆNÐ8ä�e“*˜xÓ'Ø‘8˜nÑ/Ó/Ø“H ‘M“HÜ˜Ó)�ô �e“*˜xÕ'ð
 ˆùòO Uùò ,ùò 9Wùò  Aùò 9s   ºGÁ6GÂ2G
Ã0G#Å:G(©rÁ   rÂ   rÀ   )r�   r³   rž   r´   rÀ   r7   rŸ   r&   r    rµ   r¡   rv   rX   r&   r¢   r&   rc   rx   r£   rw   r¤   r{   r¥   r¶   rp   rq   rr   rt   ro   r|   ru   )r`   r/   rp   úlist[int] | None)r}   r~   r   r€   r�   r7   r“   r§   rT   rZ   rM   ÚpropertyrÌ   rd   rê   r‚   Ú__classcell__©rÄ   s   @rL   r8   r8   ê   s7  ø† ñðH .2Ø,×4Ñ4Ø !Ø#'ØØ"Ø#Ø"ØØ/3Ø)+ð"0à(ð"0ð +ð"0ð ð	"0ð
 ð"0ð !ð"0ð ð"0ð ð"0ð ð"0ð ð"0ð ð"0ð -ð"0ð 'ð"0ð 
÷"0ð "0ôHô1ôð óCó ðCðB7àð7ð &ð7ð &ð	7ð
 ð7ð ð7ð ð7ð 
ô7÷r3ò 3rP   r8   c                  óò   ^ • \ rS rSrSrS\R                  SSSSSSSSS4                         SU 4S jjjrSS jrSS	 jr	SS
 jr
\SS j5       rSS jr              SS jrSrU =r$ )r9   iØ  a(  
Several layouts, one stacked left/right of the other. ::

    +---------+----------+
    |         |          |
    |         |          |
    +---------+----------+

By default, this doesn't display a vertical line between the children, but
if this is something you need, then create a HSplit as follows::

    VSplit(children=[ ... ], padding_char='|',
           padding=1, padding_style='#ffff00')

:param children: List of child :class:`.Container` objects.
:param window_too_small: A :class:`.Container` object that is displayed if
    there is not enough space for all the children. By default, this is a
    "Window too small" message.
:param align: `HorizontalAlign` value.
: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 z_index: (int or None) When specified, this can be used to bring
    element in front of floating elements.  `None` means: inherit from parent.
:param style: A style string.
:param modal: ``True`` or ``False``.
:param key_bindings: ``None`` or a :class:`.KeyBindings` object.

:param padding: (`Dimension` or int), size to be used for the padding.
:param padding_char: Character to be used for filling in the padding.
:param padding_style: Style to applied to the padding.
Nr   r›   Fc                óz   >• [         TU ]  UUUUUUUU	U
UUS9  X0l        [        SS9U l        [        5       U l        g r»   r¾   rÃ   s                €rL   r§   ÚVSplit.__init__ù  rÆ   rP   c                óº   • U R                   b  [        U R                   5      $ U R                   Vs/ s H  o"R                  U5      PM     nn[	        U5      $ s  snf rˆ   )rX   r*   rÌ   rT   r)   rÈ   s       rL   rT   ÚVSplit.preferred_width  s]   € Ø�:‰:Ñ!Ü §
¡
Ó+Ð+ð =A×<NÒ<Nó
Ú<N°q×ÑÐ1Ö2Ñ<Nð 	ð 
ô % ZÓ0Ð0ùò	
rÎ   c                ó  • U R                   b  [        U R                   5      $ U R                  U5      nU R                  nUc
  [	        5       $ [        X45       VVs/ s H  u  pVUR                  XR5      PM     nnn[        U5      $ s  snnf rˆ   )r¢   r*   Ú_divide_widthsrÌ   r'   rí   rZ   r(   )rK   rX   rY   rî   r�   rï   r¦   rÉ   s           rL   rZ   ÚVSplit.preferred_height'  s‹   € Ø�;‰;Ñ"Ü §¡Ó,Ð,ð ×#Ñ# EÓ*ˆØ×%Ñ%ˆà‰=Ü“;Ðô   Ô0ôâ0‘D�Að ×"Ñ" 1Ö;Ù0ð ñ ô )¨Ó4Ð4ùó	s   ÁBc                óJ   • U R                    H  nUR                  5         M     g rˆ   rÐ   rÑ   s     rL   rM   ÚVSplit.reset?  rÓ   rP   c                ór   ^ • SU 4S jjnT R                   R                  [        T R                  5      U5      $ )rÕ   c            	     ó&  >• / n TR                   [        R                  [        R                  4;   a  U R	                  [        [        SS9S95        TR                   HL  nU R	                  U5        U R	                  [        TR                  TR                  TR                  S95        MN     U (       a  U R                  5         TR                   [        R                  [        R                  4;   a  U R	                  [        [        SS9S95        U $ )Nr   r×   rÙ   )rX   rÚ   r¥   )rÀ   r6   r‘   r—   rÛ   r=   r'   r�   rŸ   r    r¡   rÜ   r–   rÝ   s     €rL   rà   Ú!VSplit._all_children.<locals>.getI  sÎ   ø€ Ø&(ˆFð �z‰zœo×4Ñ4´o×6KÑ6KÐLÓLØ—‘œf¬9¸qÑ+AÑBÔCð Ÿœ�Ø—‘˜eÔ$Ø—‘ÜØ"Ÿl™lØ!×.Ñ.Ø"×0Ñ0ñöñ 'ö Ø—
‘
”ð �z‰zœo×4Ñ4´o×6JÑ6JÐKÓKØ—‘œf¬9¸qÑ+AÑBÔCàˆMrP   r|   râ   rä   s   ` rL   rÌ   ÚVSplit._all_childrenC  ræ   rP   c           	     óh  • U R                   nU(       d  / $ U Vs/ s H  o3R                  U5      PM     nnU Vs/ s H  oUR                  PM     nn[        U5      nUR                  U:”  a  gU Vs/ s H  oUR                  PM     nn[        [        [        [        U5      5      5      U Vs/ s H  oUR                  PM     snS9n	[        U	5      n
[	        XR                  5      n[        U5      U:  a2  XŠ   Xj   :  a  XŠ==   S-  ss'   [        U	5      n
[        U5      U:  a  M2  U Vs/ s H  oUR                  PM     nn[	        XR                  5      n[        U5      U:  a2  XŠ   XÊ   :  a  XŠ==   S-  ss'   [        U	5      n
[        U5      U:  a  M2  U$ s  snf s  snf s  snf s  snf s  snf )zL
Return the widths for all columns.
Or None when there is not enough space.
Nró   r    )rÌ   rT   rØ   r)   rö   r   r÷   rø   rù   rú   rû   rü   rþ   )rK   rX   r�   r¦   rÉ   r   r  rÿ   rî   r  r  r  r  r  s                 rL   r  ÚVSplit._divide_widthse  s“  € ð
 ×%Ñ%ˆæØˆIñ 9AÓAº°1×'Ñ'¨Ö.¹ˆ
ÐAÙ5?Ó@²Z°§¤±ZÐÐ@ô /¨zÓ:ˆð ×Ñ Ó%Øñ !+Ó+¢
˜1—”¡
ˆÐ+ä,Ü”uœS ›_Ó-Ó.É:Ó8VÊ:Àa¿¼É:Ñ8Vñ
ˆô �Ó!ˆô ˜U×$<Ñ$<Ó=ˆä�%‹j˜>Ó)Ø‰xÐ.Ñ1Ó1Ø“˜A‘“Ü�_Ó%ˆAô �%‹j˜>Õ)ñ *4Ó4ª AŸ%œ%©ˆÐ4Ü�u×0Ñ0Ó1ˆä�%‹j˜8Ó#Ø‰x˜.Ñ+Ó+Ø“˜A‘“Ü�_Ó%ˆAô �%‹j˜8Õ#ð
 ˆùòM BùÚ@ùò ,ùò 9Wùò 5s   šFºF Á1F%Â-F*
Ä,F/c                ó\  • U R                   (       d  gU R                  nU R                  UR                  5      nUS-   [	        U R
                  5      -   n	U R                  c  UOU R                  nUc  U R                  R                  XX9XV5        g[        X‡5       V
Vs/ s H*  u  p«UR                  X£R                  5      R                  PM,     nn
n[        UR                  [        UR                  [        U5      5      5      nUR                  nUR                   n[        X‡5       H,  u  nnUR                  UU[#        XþUU5      U	UU5        UU-  nM.     UR                   UR                  -   U-
  nUS:”  a,  U R$                  R                  UU[#        XþUU5      U	UU5        ggs  snn
f )rè   Nré   r   )r�   rÌ   r  rX   r   r¥   rc   rž   rd   rí   rZ   r¢   rØ   rþ   rö   rë   rì   r/   rÂ   )rK   r^   r_   r`   ra   rb   rc   r�   rî   r¥   rX   rß   Úheightsr¢   rë   rì   rï   r¦   Úremaining_widths                      rL   rd   ÚVSplit.write_to_screen˜  s¦  € ð �}�}Øà×%Ñ%ˆØ×#Ñ# N×$8Ñ$8Ó9ˆØ˜sÑ"¤V¨D¯J©JÓ%7Ñ7ˆØ!Ÿ\™\Ñ1‘'°t·|±|ˆð ‰=Ø×!Ñ!×1Ñ1Ø¨¸xôð ô !$ EÔ 4ô
â 4‘�ð ×"Ñ" 5×*?Ñ*?Ó@×JÔJÙ 4ð 	ñ 
ô �^×*Ñ*¬C°×0EÑ0EÄsÈ7Ã|Ó,TÓUˆð ×"Ñ"ˆØ×"Ñ"ˆô ˜Ö(‰DˆAˆqØ×ÑØØÜ˜d¨!¨VÓ4ØØØôð �A‰IŠDñ )ð  )×-Ñ-°×0DÑ0DÑDÀtÑKˆØ˜QÓØ×(Ñ(×8Ñ8ØØÜ˜d¨/¸6ÓBØØØõð ùó9
s   Â1F(r  )r�   r³   rž   r´   rÀ   r6   rŸ   r&   r    rµ   r¡   rv   rX   r&   r¢   r&   rc   rx   r£   rw   r¤   r{   r¥   r¶   rp   rq   rr   rt   ro   r|   )rX   rs   rp   r	  ru   )r}   r~   r   r€   r�   r6   r“   r§   rT   rZ   rM   r
  rÌ   r  rd   r‚   r  r  s   @rL   r9   r9   Ø  s@  ø† ñðF .2Ø!0×!8Ñ!8Ø !Ø#'ØØ"Ø#Ø"ØØ/3Ø)+ð"0à(ð"0ð +ð"0ð ð	"0ð
 ð"0ð !ð"0ð ð"0ð ð"0ð ð"0ð ð"0ð ð"0ð -ð"0ð 'ð"0ð 
÷"0ð "0ôH1ô5ô0ð óCó ðCôB1ðfDàðDð &ðDð &ð	Dð
 ðDð ðDð ðDð 
÷Dò DrP   r9   c                  óÞ   • \ rS rSrSr    S             SS jjrSS jrSS jrSS jr              SS jr	                SS	 jr
SS
 jrSS jrSS jrSS jrSrg)r:   iß  aQ  
Container which can contain another container for the background, as well
as a list of floating containers on top of it.

Example Usage::

    FloatContainer(content=Window(...),
                   floats=[
                       Float(xcursor=True,
                            ycursor=True,
                            content=CompletionsMenu(...))
                   ])

:param z_index: (int or None) When specified, this can be used to bring
    element in front of floating elements.  `None` means: inherit from parent.
    This is the z_index for the whole `Float` container as a whole.
Nc                ó`   • [        U5      U l        X l        X0l        X@l        XPl        X`l        g rˆ   )rB   ÚcontentÚfloatsr£   r¤   r¥   rc   )rK   r#  r$  r£   r¤   r¥   rc   s          rL   r§   ÚFloatContainer.__init__ò  s*   € ô $ GÓ,ˆŒØŒàŒ
Ø(ÔØŒ
Ø�rP   c                ó’   • U R                   R                  5         U R                   H  nUR                   R                  5         M     g rˆ   )r#  rM   r$  )rK   Úfs     rL   rM   ÚFloatContainer.reset  s.   € Ø�‰×ÑÔà—”ˆAØ�I‰I�O‰OÖò rP   c                ó8   • U R                   R                  U5      $ rˆ   )r#  rT   rR   s     rL   rT   ÚFloatContainer.preferred_width	  s   € Ø�|‰|×+Ñ+Ð,?Ó@Ð@rP   c                ó8   • U R                   R                  X5      $ )z«
Return the preferred height of the float container.
(We don't care about the height of the floats, they should always fit
into the dimensions provided by the container.)
)r#  rZ   rW   s      rL   rZ   ÚFloatContainer.preferred_height  s   € ð �|‰|×,Ñ,¨UÓIÐIrP   c                ó0  • US-   [        U R                  5      -   nU R                  c  UOU R                  nU R                  R	                  XX7XV5        [        U R                  5       Hª  u  p‰U=(       d    SU	R                  -   n
US-   [        U R                  5      -   nU	R                  S L=(       d    U	R                  S LnU(       a1  US-   n
UR                  U
[        U R                  U	UUUUUU
5      S9  M“  U R                  U	UUUUUU
5        M¬     g )Nré   r   i áõ©rc   Ú	draw_func)r   r¥   rc   r#  rd   Ú	enumerater$  ÚxcursorÚycursorÚdraw_with_z_indexr   Ú_draw_float)rK   r^   r_   r`   ra   rb   rc   r¥   ÚnumberÚflÚnew_z_indexÚpostpones               rL   rd   ÚFloatContainer.write_to_screen  s  € ð ˜sÑ"¤V¨D¯J©JÓ%7Ñ7ˆØ!Ÿ\™\Ñ1‘'°t·|±|ˆà�‰×$Ñ$Ø N¸8ô	
ô $ D§K¡KÖ0‰JˆFð #Ÿ< a¨2¯:©:Ñ5ˆKØ  3Ñ&¬°·
±
Ó);Ñ;ˆEð —z‘z¨Ð-×G°·±À4Ð1GˆHæà˜U‘Nð ð ×(Ñ(Ø'Ü%Ø×(Ñ(ØØØ&Ø&ØØ Ø#ó	ð )ó ð × Ñ ØØØ"Ø"ØØØöò? 1rP   c           	     óô
  • UR                  UR                  =(       d    [        5       R                  R                  5      n[        UR                  UR                  -
  UR                  UR                  -
  S9n	UR                  5       n
UR                  5       nUR                  b  U
b  UR                  nU
nGOñUR                  bA  UR                  b4  UR                  nUR                  UR                  -
  UR                  -
  nGO£U
b-  UR                  b   UR                  UR                  -
  U
-
  nU
nGOsUR                  (       aƒ  U
cF  UR                   R#                  UR                  5      R$                  n['        UR                  U5      nOU
nU	R                  nXÍ-   UR                  :”  a  [)        SUR                  U-
  5      nOßU
(       a  [+        UR                  U
-
  S-  5      nU
nOºUR                   R#                  UR                  5      R$                  nUR                  b  UR                  nOYUR                  b'  [)        SUR                  U-
  UR                  -
  5      nO%[)        S[+        UR                  U-
  S-  5      5      n['        XÔR                  U-
  5      nUR,                  b  Ub  UR,                  nUnGO#UR,                  bA  UR.                  b4  UR,                  nUR0                  UR,                  -
  UR.                  -
  nGOÕUb-  UR.                  b   UR0                  U-
  UR.                  -
  nUnGO¥UR2                  (       aµ  U	R                  UR4                  (       a  SOS-   nUc0  UR                   R7                  XÔR0                  5      R$                  nOUnXôR0                  U-
  :”  aK  UR0                  U-
  S-   U:¼  a  UR0                  U-
  nGO['        XùR                  5      nU	R                  U-
  nOßU(       a  [+        UR0                  U-
  S-  5      nUnOºUR                   R7                  XÔR0                  5      R$                  nUR,                  b  UR,                  nOYUR.                  b'  [)        SUR0                  U-
  UR.                  -
  5      nO%[)        S[+        UR0                  U-
  S-  5      5      n['        XôR0                  U-
  5      nUS:”  a†  US:”  a  [9        XÄR                  -   XäR                  -   UUS9nUR:                  (       a  U R=                  UU5      (       a2  UR                   R?                  UUUUURA                  5       (       + US9  gggg)zDraw a single Float.©ÚxÚyNr   é   r    ©rì   rë   rX   r¢   )rb   rc   )!Úget_menu_positionÚattach_to_windowr   ÚlayoutÚcurrent_windowr   r<  rì   r=  rë   Ú	get_widthÚ
get_heightÚleftÚrightrX   r1  r#  rT   rØ   rö   rþ   rs   ÚtopÚbottomr¢   r2  Úallow_cover_cursorrZ   r/   Úhide_when_covering_contentÚ_area_is_emptyrd   Útransparent)rK   r6  r^   r_   r`   r¥   rb   rc   ÚcposÚcursor_positionÚfl_widthÚ	fl_heightrì   rX   rë   r¢   Úwps                    rL   r4  ÚFloatContainer._draw_floatM  s´  € ð  ×'Ñ'Ø×Ñ×B¤7£9×#3Ñ#3×#BÑ#Bó
ˆô  Ø�f‰f�~×*Ñ*Ñ*¨d¯f©f°~×7JÑ7JÑ.Jñ
ˆð —<‘<“>ˆØ—M‘M“Oˆ	ð �7‰7Ñ 8Ñ#7Ø—7‘7ˆDØŠEà�W‰WÑ  R§X¡XÑ%9Ø—7‘7ˆDØ"×(Ñ(¨2¯7©7Ñ2°R·X±XÑ=ŠEàÑ! b§h¡hÑ&:Ø!×'Ñ'¨"¯(©(Ñ2°XÑ=ˆDØŠEà�Z�ZØÑØŸ
™
×2Ñ2°>×3GÑ3GÓH×RÑR�Ü˜N×0Ñ0°%Ó8‘à �à"×$Ñ$ˆDØ‰|˜n×2Ñ2Ó2Ü˜1˜n×2Ñ2°UÑ:Ó;�øæÜ˜×,Ñ,¨xÑ7¸1Ñ<Ó=ˆDØ‰Eð —J‘J×.Ñ.¨~×/CÑ/CÓD×NÑNˆEà�w‰wÑ"Ø—w‘w‘Ø—‘Ñ%Ü˜1˜n×2Ñ2°UÑ:¸R¿X¹XÑEÓF‘ä˜1œc >×#7Ñ#7¸%Ñ#?À1Ñ"DÓEÓF�ô ˜×3Ñ3°dÑ:Ó;ˆEð �6‰6Ñ )Ñ"7Ø—6‘6ˆDØŠFà�V‰VÑ B§I¡IÑ$9Ø—6‘6ˆDØ#×*Ñ*¨R¯V©VÑ3°b·i±iÑ?ŠFàÑ" r§y¡yÑ'<Ø!×(Ñ(¨9Ñ4°r·y±yÑ@ˆDØŠFà�Z�ZØ"×$Ñ$¨R×-B×-B©ÈÑJˆDàÑ ØŸ™×4Ñ4Ø×0Ñ0óç‘)ñ ð #�ð ×-Ñ-°Ñ4Ó4Ø!×(Ñ(¨4Ñ/°!Ñ3°tÓ;ð ,×2Ñ2°TÑ9’Fô ! ×):Ñ):Ó;�FØ*×,Ñ,¨vÑ5�Døö Ü˜×-Ñ-°	Ñ9¸QÑ>Ó?ˆDØ‰Fð —Z‘Z×0Ñ0°×8MÑ8MÓN×XÑXˆFà�v‰vÑ!Ø—v‘v‘Ø—‘Ñ&Ü˜1˜n×3Ñ3°fÑ<¸r¿y¹yÑHÓI‘ä˜1œc >×#8Ñ#8¸6Ñ#AÀQÑ"FÓGÓH�ô ˜×!6Ñ!6¸Ñ!=Ó>ˆFð �A‹:˜% !›)ÜØ×/Ñ/Ñ/Ø×/Ñ/Ñ/ØØñ	ˆBð ×0×0°D×4GÑ4GÈÐPR×4SÑ4SØ—
‘
×*Ñ*ØØ"ØØØ!#§¡Ó!1Ô1Ø#ð +ò ð 5Tð $ˆ:rP   c                óF  • Un[        UR                  UR                  UR                  -   5       Hn  nXAR                  ;   d  M  UR                  U   n[        UR                  UR                  UR
                  -   5       H  nXV   nUR                  S:w  d  M      g   Mp     g)zz
Return True when the area below the write position is still empty.
(For floats that should not hide content underneath.)
ré   FT)rø   rë   r¢   Údata_bufferrì   rX   rÚ   )rK   r^   r`   rR  r=  Úrowr<  r¦   s           rL   rL  ÚFloatContainer._area_is_emptyÝ  sƒ   € ð
 ˆä�r—w‘w §¡¨"¯)©)Ñ 3Ö4ˆAØ×&Ñ&Õ&Ø×(Ñ(¨Ñ+�ä˜rŸw™w¨¯©°"·(±(Ñ(:Ö;�AØ™�AØ—v‘v •}Ú$ó <ñ	 5ð rP   c                ó   • U R                   $ rˆ   rª   rJ   s    rL   rg   ÚFloatContainer.is_modalï  r¬   rP   c                ó   • U R                   $ rˆ   r®   rJ   s    rL   rj   ÚFloatContainer.get_key_bindingsò  r°   rP   c                ód   • U R                   /nUR                  S U R                   5       5        U$ )Nc              3  ó8   #   • U  H  oR                   v •  M     g 7frˆ   ©r#  )Ú.0r'  s     rL   Ú	<genexpr>Ú.FloatContainer.get_children.<locals>.<genexpr>÷  s   é € Ð7ª; aŸ	ž	ª;ùs   ‚)r#  Úextendr$  )rK   r�   s     rL   rm   ÚFloatContainer.get_childrenõ  s(   € Ø—L‘L�>ˆØ�‰Ñ7¨4¯;ª;Ó7Ô7ØˆrP   )r#  r$  r¤   r£   r¥   rc   )FNr›   N)r#  r4   r$  zlist[Float]r£   rw   r¤   r{   r¥   r¶   rc   rx   rp   rq   ro   rr   rt   ru   )r6  r;   r^   r.   r_   r,   r`   r/   r¥   rv   rb   rw   rc   rx   rp   rq   )r^   r.   r`   r/   rp   rw   ry   rz   r|   )r}   r~   r   r€   r�   r§   rM   rT   rZ   rd   r4  rL  rg   rj   rm   r‚   rI   rP   rL   r:   r:   ß  s*  † ñð, Ø/3Ø)+Ø"ðàðð ðð ð	ð
 -ðð 'ðð ðð 
õô"ôAôJð7àð7ð &ð7ð &ð	7ð
 ð7ð ð7ð ð7ð 
ô7ðrNàðNð ðNð &ð	Nð
 &ðNð ðNð ðNð ðNð 
ôNô`ô$ô!÷rP   r:   c                  ó˜   • \ rS rSrSr             S	                             S
S jjrSS jrSS jrSS jrSr	g)r;   iû  a’  
Float for use in a :class:`.FloatContainer`.
Except for the `content` parameter, all other options are optional.

:param content: :class:`.Container` instance.

:param width: :class:`.Dimension` or callable which returns a :class:`.Dimension`.
:param height: :class:`.Dimension` or callable which returns a :class:`.Dimension`.

:param left: Distance to the left edge of the :class:`.FloatContainer`.
:param right: Distance to the right edge of the :class:`.FloatContainer`.
:param top: Distance to the top of the :class:`.FloatContainer`.
:param bottom: Distance to the bottom of the :class:`.FloatContainer`.

:param attach_to_window: Attach to the cursor from this window, instead of
    the current window.
:param hide_when_covering_content: Hide the float when it covers content underneath.
:param allow_cover_cursor: When `False`, make sure to display the float
    below the cursor. Not on top of the indicated position.
:param z_index: Z-index position. For a Float, this needs to be at least
    one. It is relative to the z_index of the parent container.
:param transparent: :class:`.Filter` indicating whether this float needs to be
    drawn transparently.
Nc                ó
  • US:¼  d   eXPl         X0l        X l        X@l        X`l        Xpl        X€l        X�l        U
(       a  [        U
5      OS U l	        [        U5      U l        X°l        XÀl        XÐl        [        U5      U l        g )Nr    )rF  rG  rH  rI  rX   r¢   r1  r2  rC   rA  rB   r#  rK  rJ  rc   r   rM  )rK   r#  rH  rG  rI  rF  rX   r¢   r1  r2  rA  rK  rJ  rc   rM  s                  rL   r§   ÚFloat.__init__  s{   € ð" ˜!‹|Ðˆ|àŒ	ØŒ
ØŒØŒàŒ
ØŒàŒØŒö ,<ŒIÐ&Ô'Àð 	Ôô $ GÓ,ˆŒØ*DÔ'Ø"4ÔØŒÜ$ [Ó1ˆÕrP   c                ón   • [        U R                  5      (       a  U R                  5       $ U R                  $ rˆ   )ÚcallablerX   rJ   s    rL   rD  ÚFloat.get_width=  s'   € Ü�D—J‘J×ÑØ—:‘:“<ÐØ�z‰zÐrP   c                ón   • [        U R                  5      (       a  U R                  5       $ U R                  $ rˆ   )rh  r¢   rJ   s    rL   rE  ÚFloat.get_heightB  s'   € Ü�D—K‘K× Ñ Ø—;‘;“=Ð Ø�{‰{ÐrP   c                ó$   • SU R                   < S3$ )NzFloat(content=Ú)r^  rJ   s    rL   Ú__repr__ÚFloat.__repr__G  s   € Ø §¡Ñ/¨qÐ1Ð1rP   )rJ  rA  rI  r#  r¢   rK  rF  rG  rH  rM  rX   r1  r2  rc   )NNNNNNFFNFFr    F)r#  r4   rH  rx   rG  rx   rI  rx   rF  rx   rX   úint | Callable[[], int] | Noner¢   rp  r1  rw   r2  rw   rA  úAnyContainer | NonerK  rw   rJ  rw   rc   rs   rM  rw   rp   rq   ©rp   rx   ©rp   rv   )
r}   r~   r   r€   r�   r§   rD  rE  rn  r‚   rI   rP   rL   r;   r;   û  sÙ   † ñð8 Ø Ø!ØØ04Ø15ØØØ04Ø+0Ø#(ØØ!ð&2àð&2ð ð&2ð ð	&2ð
 ð&2ð ð&2ð .ð&2ð /ð&2ð ð&2ð ð&2ð .ð&2ð %)ð&2ð !ð&2ð ð&2ð ð&2ð  
õ!&2ôPô
÷
2rP   r;   c                  ó^  • \ rS rSrSr                          SS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
\SS j5       rSSS	 jjrSSS
 jjr S     SS jjr\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       rS S jrSrg)!r>   iK  a#  
Render information for the last render time of this control.
It stores mapping information between the input buffers (in case of a
:class:`~prompt_toolkit.layout.controls.BufferControl`) and the actual
render position on the output screen.

(Could be used for implementation of the Vi 'H' and 'L' key bindings as
well as implementing mouse support.)

:param ui_content: The original :class:`.UIContent` instance that contains
    the whole input, without clipping. (ui_content)
:param horizontal_scroll: The horizontal scroll of the :class:`.Window` instance.
:param vertical_scroll: The vertical scroll of the :class:`.Window` instance.
:param window_width: The width of the window that displays the content,
    without the margins.
:param window_height: The height of the window that displays the content.
:param configured_scroll_offsets: The scroll offsets as configured for the
    :class:`Window` instance.
:param visible_line_to_row_col: Mapping that maps the row numbers on the
    displayed screen (starting from zero for the first visible line) to
    (row, col) tuples pointing to the row and column of the :class:`.UIContent`.
:param rowcol_to_yx: Mapping that maps (row, column) tuples representing
    coordinates of the :class:`UIContent` to (y, x) absolute coordinates at
    the rendered screen.
c                óˆ   • Xl         X l        X@l        XPl        X`l        Xpl        X€l        XÀl        X�l        X l	        X°l
        g rˆ   )ÚwindowÚ
ui_contentÚvertical_scrollÚwindow_widthÚwindow_heightÚconfigured_scroll_offsetsÚvisible_line_to_row_colÚ
wrap_linesÚ_rowcol_to_yxÚ	_x_offsetÚ	_y_offset)rK   rv  rw  Úhorizontal_scrollrx  ry  rz  r{  r|  Úrowcol_to_yxÚx_offsetÚy_offsetr}  s                rL   r§   ÚWindowRenderInfo.__init__f  sA   € ð ŒØ$ŒØ.ÔØ(ÔØ*Ôà)BÔ&Ø'>Ô$Ø$Œà)Ôà!ŒØ!�rP   c                ór   • U R                   R                  5        VVs0 s H
  u  pXS   _M     snn$ s  snnf ©Nr   )r|  rô   )rK   Úvisible_lineÚrowcols      rL   Úvisible_line_to_input_lineÚ+WindowRenderInfo.visible_line_to_input_line„  sB   € ð )-×(DÑ(D×(JÑ(JÔ(Lô
â(LÑ$�ð  ™)Ò#Ù(Lò
ð 	
ùó 
s   ž3c                óö   • U R                   R                  n U R                  UR                  UR                  4   u  p#[        X0R                  -
  X R                  -
  S9$ ! [         a    [        SSS9s $ f = f)za
Return the cursor position coordinates, relative to the left/top corner
of the rendered screen.
r;  r   )	rw  rO  r~  r=  r<  r   r  r€  ÚKeyError)rK   rN  r=  r<  s       rL   rO  Ú WindowRenderInfo.cursor_position‹  ss   € ð �‰×.Ñ.ˆð	EØ×%Ñ% d§f¡f¨d¯f©f nÑ5‰DˆAô ˜1Ÿ~™~Ñ-°·^±^Ñ1CÑDÐDøô ó 	#ô ˜1 ‘?Ò"ð	#ús   ˜'A! Á!A8Á7A8c                óh  • U R                   S   S:X  a  SnOLU R                  U R                  R                  R                     n[        X R                  R                  5      n[        U[        U R                  R                  U R                   S   -
  S-
  U R                  R                  5      SSS9$ )zì
Return a :class:`.ScrollOffsets` instance that indicates the actual
offset. This can be less than or equal to what's configured. E.g, when
the cursor is completely at the top, the top offset will be zero rather
than what's configured.
r   éÿÿÿÿr    )rH  rI  rF  rG  )Údisplayed_linesÚinput_line_to_visible_linerw  rO  r=  rö   r{  rH  r@   Ú
line_countrI  )rK   rH  r=  s      rL   Úapplied_scroll_offsetsÚ'WindowRenderInfo.applied_scroll_offsets›  s¥   € ð ×Ñ Ñ" aÓ'Ø‰Cð ×/Ñ/°·±×0OÑ0O×0QÑ0QÑRˆAÜ�a×7Ñ7×;Ñ;Ó<ˆCäØÜØ—‘×*Ñ*¨T×-AÑ-AÀ"Ñ-EÑEÈÑIØ×.Ñ.×5Ñ5óð Øñ
ð 	
rP   c                óV   • [        S U R                  R                  5        5       5      $ )zn
List of all the visible rows. (Line numbers of the input buffer.)
The last line may not be entirely visible.
c              3  ó*   #   • U  H	  u  pUv •  M     g 7frˆ   rI   )r_  rV  Úcols      rL   r`  Ú3WindowRenderInfo.displayed_lines.<locals>.<genexpr>½  s   é € ÐPÒ*O™h˜c•cÒ*Oùs   ‚)Úsortedr|  ÚvaluesrJ   s    rL   r‘  Ú WindowRenderInfo.displayed_lines·  s$   € ô ÑP¨$×*FÑ*F×*MÑ*MÔ*OÓPÓPÐPrP   c                ó†   • 0 nU R                   R                  5        H   u  p#X1;   a  [        X   U5      X'   M  X!U'   M"     U$ )z·
Return the dictionary mapping the line numbers of the input buffer to
the lines of the screen. When a line spans several rows at the screen,
the first row appears in the dictionary.
)rŠ  rô   rö   )rK   rÞ   ÚkÚvs       rL   r’  Ú+WindowRenderInfo.input_line_to_visible_line¿  sG   € ð "$ˆØ×3Ñ3×9Ñ9Ö;‰DˆAØ‹{Ü ¡	¨1Ó-�“	à�q“	ñ	 <ð
 ˆrP   c                ót   • U(       a#  U R                   U R                  R                     $ U R                   S   $ )zf
Return the line number (0 based) of the input document that corresponds
with the first visible line.
r   )r‘  r”  rH  )rK   Úafter_scroll_offsets     rL   Úfirst_visible_lineÚ#WindowRenderInfo.first_visible_lineÎ  s5   € ö
 Ø×'Ñ'¨×(CÑ(C×(GÑ(GÑHÐHà×'Ñ'¨Ñ*Ð*rP   c                óz   • U(       a&  U R                   SU R                  R                  -
     $ U R                   S   $ )z;
Like `first_visible_line`, but for the last visible line.
r�  )r‘  r”  rI  )rK   Úbefore_scroll_offsets     rL   Úlast_visible_lineÚ"WindowRenderInfo.last_visible_lineØ  s:   € ö  Ø×'Ñ'¨¨T×-HÑ-H×-OÑ-OÑ(OÑPÐPà×'Ñ'¨Ñ+Ð+rP   c                ór   • U R                  U5      U R                  U5      U R                  U5      -
  S-  -   $ )z=
Like `first_visible_line`, but for the center visible line.
r>  )r£  r§  )rK   r¦  r¢  s      rL   Úcenter_visible_lineÚ$WindowRenderInfo.center_visible_lineá  sJ   € ð ×#Ñ#Ð$7Ó8à×&Ñ&Ð';Ó<Ø×)Ñ)Ð*=Ó>ñ?ð ñ	ñð	
rP   c                ó.   • U R                   R                  $ )z&
The full height of the user control.
)rw  r“  rJ   s    rL   Úcontent_heightÚWindowRenderInfo.content_heightð  s   € ð
 �‰×)Ñ)Ð)rP   c                óh   • U R                   S:H  =(       a    U R                  5       U R                  :H  $ )zE
True when the full height is visible (There is no vertical scroll.)
r   )rx  r§  r­  rJ   s    rL   Úfull_height_visibleÚ$WindowRenderInfo.full_height_visible÷  s4   € ð × Ñ  AÑ%÷ @Ø×&Ñ&Ó(¨D×,?Ñ,?Ñ?ð	
rP   c                ó    • U R                   S:H  $ )z-
True when the top of the buffer is visible.
r   )rx  rJ   s    rL   Útop_visibleÚWindowRenderInfo.top_visible  s   € ð
 ×#Ñ# qÑ(Ð(rP   c                óB   • U R                  5       U R                  S-
  :H  $ )z0
True when the bottom of the buffer is visible.
r    )r§  r­  rJ   s    rL   Úbottom_visibleÚWindowRenderInfo.bottom_visible  s#   € ð
 ×%Ñ%Ó'¨4×+>Ñ+>ÀÑ+BÑBÐBrP   c                ó^   • U R                   (       a  gSU R                  -  U R                  -  $ )zc
Vertical scroll as a percentage. (0 means: the top is visible,
100 means: the bottom is visible.)
éd   )r¶  rx  r­  rJ   s    rL   Úvertical_scroll_percentageÚ+WindowRenderInfo.vertical_scroll_percentage  s,   € ð ××Øà˜×-Ñ-Ñ-°×1DÑ1DÑDÐDrP   c                óš   • U R                   (       a:  U R                  R                  XR                  U R                  R
                  5      $ g)zd
Return the height of the given line.
(The height that it would take, if this line became visible.)
r    )r}  rw  Úget_height_for_linery  rv  Úget_line_prefix)rK   Úlinenos     rL   r½  Ú$WindowRenderInfo.get_height_for_line  s<   € ð
 �?�?Ø—?‘?×6Ñ6Ø×)Ñ)¨4¯;©;×+FÑ+Fóð ð rP   )r~  r  r€  r{  rw  rx  r|  rv  rz  ry  r}  N)rv  r=   rw  r$   r�  rs   rx  rs   ry  rs   rz  rs   r{  r@   r|  zdict[int, tuple[int, int]]r‚  z&dict[tuple[int, int], tuple[int, int]]rƒ  rs   r„  rs   r}  rw   rp   rq   )rp   zdict[int, int])rp   r   )rp   r@   )rp   z	list[int]©F)r¢  rw   rp   rs   )r¦  rw   rp   rs   )FF)r¦  rw   r¢  rw   rp   rs   ©rp   rs   ry   ©r¿  rs   rp   rs   )r}   r~   r   r€   r�   r§   r
  rŠ  rO  r”  r‘  r’  r£  r§  rª  r­  r°  r³  r¶  rº  r½  r‚   rI   rP   rL   r>   r>   K  s�  † ñð4"àð"ð ð"ð ð	"ð
 ð"ð ð"ð ð"ð $1ð"ð "<ð"ð =ð"ð ð"ð ð"ð ð"ð 
ô"ð< ó
ó ð
ð óEó ðEð ó
ó ð
ð6 óQó ðQð óó ðö+ö,ð OTð
Ø$(ð
ØGKð
à	õ
ð ó*ó ð*ð ó
ó ð
ð ó)ó ð)ð óCó ðCð óEó ðE÷
rP   r>   c                  óš   • \ rS rSrSr    S         SS jjr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
SS jrS	rg
)r@   i'  z|
Scroll offsets for the :class:`.Window` class.

Note that left/right offsets only make sense if line wrapping is disabled.
c                ó4   • Xl         X l        X0l        X@l        g rˆ   ©Ú_topÚ_bottomÚ_leftÚ_right)rK   rH  rI  rF  rG  s        rL   r§   ÚScrollOffsets.__init__.  s   € ð Œ	ØŒØŒ
Ø�rP   c                ó,   • [        U R                  5      $ rˆ   )r   rÇ  rJ   s    rL   rH  ÚScrollOffsets.top:  s   € ä�d—i‘iÓ Ð rP   c                ó,   • [        U R                  5      $ rˆ   )r   rÈ  rJ   s    rL   rI  ÚScrollOffsets.bottom>  s   € ä�d—l‘lÓ#Ð#rP   c                ó,   • [        U R                  5      $ rˆ   )r   rÉ  rJ   s    rL   rF  ÚScrollOffsets.leftB  s   € ä�d—j‘jÓ!Ð!rP   c                ó,   • [        U R                  5      $ rˆ   )r   rÊ  rJ   s    rL   rG  ÚScrollOffsets.rightF  s   € ä�d—k‘kÓ"Ð"rP   c           	     óx   • SU R                   < SU R                  < SU R                  < SU R                  < S3	$ )NzScrollOffsets(top=z	, bottom=z, left=z, right=rm  rÆ  rJ   s    rL   rn  ÚScrollOffsets.__repr__J  s>   € Ø# D§I¡I¡=°	¸$¿,¹,Ñ9IÈÐQU×Q[ÑQ[ÑP^Ð^fÐgk×grÑgrÑfuÐuvÐwÐwrP   )rÈ  rÉ  rÊ  rÇ  N)r   r   r   r   )
rH  úint | Callable[[], int]rI  rÖ  rF  rÖ  rG  rÖ  rp   rq   rÂ  rs  )r}   r~   r   r€   r�   r§   r
  rH  rI  rF  rG  rn  r‚   rI   rP   rL   r@   r@   '  s    † ñð ()Ø*+Ø()Ø)*ð
à$ð
ð (ð
ð &ð	
ð
 'ð
ð 
õ
ð ó!ó ð!ð ó$ó ð$ð ó"ó ð"ð ó#ó ð#÷xrP   r@   c                  ó&   • \ rS rSrSrSSS jjrSrg)rA   iN  z.
Column for a :class:`.Window` to be colored.
c                ó   • Xl         X l        g rˆ   ©Úpositionr¥   )rK   rÚ  r¥   s      rL   r§   ÚColorColumn.__init__S  s   € Ø ŒØ�
rP   rÙ  N)zclass:color-column)rÚ  rs   r¥   rv   rp   rq   )r}   r~   r   r€   r�   r§   r‚   rI   rP   rL   rA   rA   N  s   † ñ÷ñ rP   rA   c                  ó$   • \ rS rSrSrSrSrSrSrg)r<   i[  zË
Alignment of the Window content.

Note that this is different from `HorizontalAlign` and `VerticalAlign`,
which are used for the alignment of the child containers in respectively
`VSplit` and `HSplit`.
r–   r—   r‘   rI   N)	r}   r~   r   r€   r�   r–   r—   r‘   r‚   rI   rP   rL   r<   r<   [  s   † ñð €DØ€EØƒFrP   r<   c                  óô  • \ rS rSrSrSSSSSSSSSSSSSSSSSSS\R                  SSS4                                               S#S jjrS$S jrS%S jr	S&S	 jr
S'S
 jrS(S jrS)S jr\ S*       S+S jj5       rS,S jrS-S jr              S.S jr            S/S jrSSSSSSS\R                  S4	                             S0S jjr        S1S jr        S2S jrS3S jrS3S jr              S4S jr            S5S jrS6S jr        S6S jr        S6S jrS7S jrS%S jrS%S jr S8S  jr!S9S! jr"S"r#g):r=   ii  av  
Container that holds a control.

:param content: :class:`.UIControl` instance.
:param width: :class:`.Dimension` instance or callable.
:param height: :class:`.Dimension` instance or callable.
:param z_index: When specified, this can be used to bring element in front
    of floating elements.
:param dont_extend_width: When `True`, don't take up more width then the
                          preferred width reported by the control.
:param dont_extend_height: When `True`, don't take up more width then the
                           preferred height reported by the control.
:param ignore_content_width: A `bool` or :class:`.Filter` instance. Ignore
    the :class:`.UIContent` width when calculating the dimensions.
:param ignore_content_height: A `bool` or :class:`.Filter` instance. Ignore
    the :class:`.UIContent` height when calculating the dimensions.
:param left_margins: A list of :class:`.Margin` instance to be displayed on
    the left. For instance: :class:`~prompt_toolkit.layout.NumberedMargin`
    can be one of them in order to show line numbers.
:param right_margins: Like `left_margins`, but on the other side.
:param scroll_offsets: :class:`.ScrollOffsets` instance, representing the
    preferred amount of lines/columns to be always visible before/after the
    cursor. When both top and bottom are a very high number, the cursor
    will be centered vertically most of the time.
:param allow_scroll_beyond_bottom: A `bool` or
    :class:`.Filter` instance. When True, allow scrolling so far, that the
    top part of the content is not visible anymore, while there is still
    empty space available at the bottom of the window. In the Vi editor for
    instance, this is possible. You will see tildes while the top part of
    the body is hidden.
:param wrap_lines: A `bool` or :class:`.Filter` instance. When True, don't
    scroll horizontally, but wrap lines instead.
:param get_vertical_scroll: Callable that takes this window
    instance as input and returns a preferred vertical scroll.
    (When this is `None`, the scroll is only determined by the last and
    current cursor position.)
:param get_horizontal_scroll: Callable that takes this window
    instance as input and returns a preferred vertical scroll.
:param always_hide_cursor: A `bool` or
    :class:`.Filter` instance. When True, never display the cursor, even
    when the user control specifies a cursor position.
:param cursorline: A `bool` or :class:`.Filter` instance. When True,
    display a cursorline.
:param cursorcolumn: A `bool` or :class:`.Filter` instance. When True,
    display a cursorcolumn.
:param colorcolumns: A list of :class:`.ColorColumn` instances that
    describe the columns to be highlighted, or a callable that returns such
    a list.
:param align: :class:`.WindowAlign` value or callable that returns an
    :class:`.WindowAlign` value. alignment of content.
:param style: A style string. Style to be applied to all the cells in this
    window. (This can be a callable that returns a string.)
:param char: (string) Character to be used for filling the background. This
    can also be a callable that returns a character.
:param get_line_prefix: None or a callable that returns formatted text to
    be inserted before a line. It takes a line number (int) and a
    wrap_count and returns formatted text. This can be used for
    implementation of line continuations, things like Vim "breakindent" and
    so on.
NFr›   c                ó°  • [        U5      U l        [        U5      U l        [        U5      U l        [        U5      U l        [        U5      U l        U=(       d
    [        5       U l        [        U5      U l        [        U5      U l	        [        U5      U l
        [        U5      U l        U	=(       d    / U l        U
=(       d    / U l        U=(       d
    [        5       U l        Xàl        Xðl        U=(       d    / U l        UU l        UU l        UU l        UU l        X l        X0l        X@l        [5        SS9U l        [5        SS9U l        U R;                  5         g )Né   r¼   r    )r   Úallow_scroll_beyond_bottomÚalways_hide_cursorr}  Ú
cursorlineÚcursorcolumnr!   r#  Údont_extend_widthÚdont_extend_heightÚignore_content_widthÚignore_content_heightÚleft_marginsÚright_marginsr@   Úscroll_offsetsÚget_vertical_scrollÚget_horizontal_scrollÚcolorcolumnsrÀ   r¥   rÚ   r¾  rX   r¢   rc   r   Ú_ui_content_cacheÚ_margin_width_cacherM   )rK   r#  rX   r¢   rc   rä  rå  ræ  rç  rè  ré  rê  rà  r}  rë  rì  rá  râ  rã  rí  rÀ   r¥   rÚ   r¾  s                           rL   r§   ÚWindow.__init__§  s+  € ô8 +4Ð4NÓ*OˆÔ'Ü"+Ð,>Ó"?ˆÔÜ# JÓ/ˆŒÜ# JÓ/ˆŒÜ% lÓ3ˆÔà×0¤,£.ˆŒÜ!*Ð+<Ó!=ˆÔÜ"+Ð,>Ó"?ˆÔÜ$-Ð.BÓ$CˆÔ!Ü%.Ð/DÓ%EˆÔ"Ø(×.¨BˆÔØ*×0¨bˆÔØ,×?´³ˆÔØ#6Ô Ø%:Ô"Ø(×.¨BˆÔØˆŒ
ØˆŒ
ØˆŒ	Ø.ˆÔàŒ
ØŒØŒô  Ñ"ð 	Ôô JUØñJ
ˆÔ ð 	�
‰
�rP   c                ó$   • SU R                   < S3$ )NzWindow(content=rm  r^  rJ   s    rL   rn  ÚWindow.__repr__ç  s   € Ø  §¡Ñ 0°Ð2Ð2rP   c                óp   • U R                   R                  5         SU l        SU l        SU l        S U l        g r‡  )r#  rM   rx  r�  Úvertical_scroll_2Úrender_inforJ   s    rL   rM   ÚWindow.resetê  s8   € Ø�‰×ÑÔð  !ˆÔØ!"ˆÔð
 "#ˆÔð 59ˆÕrP   c                óŒ   ^ ^^• SU 4S jjmSUU4S jjnT[        5       R                  4nT R                  R                  X25      $ )zJ
Return the width for this margin.
(Calculate only once per render time.)
c                 ó$   >• T R                  SSS9$ )Nr   ©rX   r¢   )Ú_get_ui_contentrJ   s   €rL   Úget_ui_contentÚ0Window._get_margin_width.<locals>.get_ui_content  s   ø€ Ø×'Ñ'¨a¸Ð'Ð:Ð:rP   c                 ó&   >• TR                  T 5      $ rˆ   )rD  )rû  Úmargins   €€rL   rD  Ú+Window._get_margin_width.<locals>.get_width  s   ø€ Ø×#Ñ# NÓ3Ð3rP   ©rp   r$   rÂ  )r   Úrender_counterrï  rà   )rK   rþ  rD  Úkeyrû  s   ``  @rL   Ú_get_margin_widthÚWindow._get_margin_widthú  s=   ú€ ÷	;÷	4ð 	4ð ”w“y×/Ñ/Ð0ˆØ×'Ñ'×+Ñ+¨CÓ;Ð;rP   c                ó‚   ^ • [        U 4S jT R                   5       5      [        U 4S jT R                   5       5      -   $ )z>
Calculate and return the width of the margin (left + right).
c              3  óF   >#   • U  H  nTR                  U5      v •  M     g 7frˆ   ©r  ©r_  ÚmrK   s     €rL   r`  Ú1Window._get_total_margin_width.<locals>.<genexpr>  s!   øé € ÐHÒ6G°�4×)Ñ)¨!×,Ð,Ò6Gùó   ƒ!c              3  óF   >#   • U  H  nTR                  U5      v •  M     g 7frˆ   r  r  s     €rL   r`  r
    s$   øé € ð O
Ú/A¨!ˆD×"Ñ" 1×%Ð%Ò/Aùr  )rü   rè  ré  rJ   s   `rL   Ú_get_total_margin_widthÚWindow._get_total_margin_width
  s@   ø€ ô ÔH°d×6GÒ6GÓHÓHÌ3ô O
Ø/3×/AÒ/AóO
ó L
ñ 
ð 	
rP   c                ó|   ^ ^• SUU 4S jjnT R                  [        T R                  5      UT R                  5       S9$ )z0
Calculate the preferred width for this window.
c                 óž   >• TR                  5       (       a  gTR                  5       n TR                  R                  TU -
  5      nUb  X-  nU$ )zMContent width: is only calculated if no exact width for the
window was given.N)ræ  r  r#  rT   )Útotal_margin_widthrT   rS   rK   s     €€rL   Úpreferred_content_widthÚ7Window.preferred_width.<locals>.preferred_content_width  s]   ø€ ð ×(Ñ(×*Ñ*Øð "&×!=Ñ!=Ó!?Ðð #Ÿl™l×:Ñ:Ø#Ð&8Ñ8óˆOð Ñ*àÑ5�Ø"Ð"rP   ©Ú	dimensionÚget_preferredÚdont_extendrr  )Ú_merge_dimensionsr*   rX   rä  )rK   rS   r  s   `` rL   rT   ÚWindow.preferred_width  sB   ù€ ÷
	#ð 	#ð( ×%Ñ%Ü" 4§:¡:Ó.Ø1Ø×.Ñ.Ó0ð &ð 
ð 	
rP   c                ó€   ^ ^^• SUU U4S jjnT R                  [        T R                  5      UT R                  5       S9$ )z1
Calculate the preferred height for this window.
c                 óÆ   >• TR                  5       (       a  gTR                  5       n TR                  5       nTR                  R	                  TU -
  TUTR
                  5      $ )zOContent height: is only calculated if no exact height for the
window was given.N)rç  r  r}  r#  rZ   r¾  )r  r}  rY   rK   rX   s     €€€rL   Úpreferred_content_heightÚ9Window.preferred_height.<locals>.preferred_content_height6  sa   ø€ ð ×)Ñ)×+Ñ+Øà!%×!=Ñ!=Ó!?ÐØŸ™Ó*ˆJà—<‘<×0Ñ0ØÐ*Ñ*Ø$ØØ×$Ñ$ó	ð rP   r  rr  )r  r*   r¢   rå  )rK   rX   rY   r  s   ``` rL   rZ   ÚWindow.preferred_height1  sB   ú€ ÷
	ñ 	ð  ×%Ñ%Ü" 4§;¡;Ó/Ø2Ø×/Ñ/Ó1ð &ð 
ð 	
rP   c                óö  • U =(       d
    [        5       n U R                  (       a  U R                  nOU" 5       nUbL  U R                  (       a  [	        X0R
                  5      nU R                  (       a  [        X0R                  5      nU(       a  Ub  [	        U R
                  U5      nOU R                  (       a  U R
                  OSnU R                  (       a  U R                  OSn[        XTX0R                  S9$ )zž
Take the Dimension from this `Window` class and the received preferred
size from the `UIControl` and return a `Dimension` to report to the
parent container.
N)rö   rþ   rØ   rú   )r'   Úpreferred_specifiedrØ   Úmax_specifiedrö   rþ   Úmin_specifiedrú   )r  r  r  rØ   Úmax_Úmin_s         rL   r  ÚWindow._merge_dimensionsL  s½   € ð ×,¤£ˆ	ð ×(×(Ø!×+Ñ+‰Iñ &›ˆIð Ñ Ø×&×&Ü 	¯=©=Ó9�	à×&×&Ü 	¯=©=Ó9�	ö ˜9Ñ0Ü�y—}‘} iÓ0‰Dà$-×$;×$;�9—=’=ÀˆDà )× 7× 7ˆy�}Š}¸TˆäØ¨)×<LÑ<Lñ
ð 	
rP   c                ó€   ^ ^^• SUU U4S jjn[        5       R                  TT4nT R                  R                  XC5      $ )z 
Create a `UIContent` instance.
c                 ó8   >• TR                   R                  TT S9$ )Nrù  )r#  Úcreate_content)r¢   rK   rX   s   €€€rL   Úget_contentÚ+Window._get_ui_content.<locals>.get_content‚  s   ø€ Ø—<‘<×.Ñ.°UÀ6Ð.ÐJÐJrP   r   )r   r  rî  rà   )rK   rX   r¢   r)  r  s   ```  rL   rú  ÚWindow._get_ui_content}  s<   ú€ ÷
	Kñ 	Kô ‹y×'Ñ'¨°Ð7ˆØ×%Ñ%×)Ñ)¨#Ó;Ð;rP   c                óÖ   • [        5       nUR                  (       a  gUR                  R                  (       a2  UR                  R                  (       a  UR                  R                  $ gg)z1Return `False`, or the Digraph symbol to be used.Ú^Ú?N)r   Úquoted_insertÚvi_stateÚwaiting_for_digraphÚdigraph_symbol1)rK   Úapps     rL   Ú_get_digraph_charÚWindow._get_digraph_charˆ  sE   € ä‹iˆØ××ØØ�<‰<×+×+Ø�|‰|×+×+Ø—|‘|×3Ñ3Ð3ØØrP   c                óx  • [        UR                  UR                  UR                  UR                  S9nU R                  5       (       a>  [        UR                  U R                  UR                  5      R                  5      Ul        U R                  5       (       aI  [        UR                  U R                  UR                  UR                  5      R                  5      Ul        U R                  c  UOU R                  n[        U R                  UUUUU5      nUb  US::  a  U" 5         gUR                  XgS9  g)z�
Write window to screen. This renders the user control, the margins and
copies everything over to the absolute position at the given screen.
r?  Nr   r.  )r/   rì   rë   rX   r¢   rä  rö   rT   rØ   rå  rZ   rc   r   Ú_write_to_screen_at_indexr3  )rK   r^   r_   r`   ra   rb   rc   r/  s           rL   rd   ÚWindow.write_to_screen“  s  € ô" 'Ø×$Ñ$Ø×$Ñ$Ø ×&Ñ&Ø!×(Ñ(ñ	
ˆð ×!Ñ!×#Ñ#Ü#&Ø×$Ñ$Ø×$Ñ$ ^×%9Ñ%9Ó:×DÑDó$ˆNÔ ð
 ×"Ñ"×$Ñ$Ü$'Ø×%Ñ%Ø×%Ñ%Ø"×(Ñ(¨.×*?Ñ*?óç‘)ó	%ˆNÔ!ð "Ÿ\™\Ñ1‘'°t·|±|ˆäØ×*Ñ*ØØØØØó
ˆ	ð ‰?˜g¨›lá�Kð ×$Ñ$¨WÐ$ÒJrP   c                óX  ^ ^^^^• TR                   S::  d  TR                  S::  a  g T R                   Vs/ s H  nT R                  U5      PM     nnT R                   Vs/ s H  nT R                  U5      PM     nn[        Xx-   5      n	T R                  R                  TR                  U	-
  TR                   5      n
[        U
[        5      (       d   eT R                  5       nT R                  U
TR                  U	-
  TR                   5        T R                  UTU5        [        T R                  5      (       a  T R                  5       OT R                  nT R                  U
UT[        U5      TR                  U	-
  T R                   T R"                  UST R$                  T R'                  5       [)        5       R*                  R,                  T R                  :H  UT R.                  S9u  mmTR0                  [        U5      -   nTR2                  n[5        T U
T R"                  T R                   TR                  U	-
  TR                   T R6                  TTUUUS9mTT l        SUU UU4S jjnUR;                  TR0                  [        U5      -   TR0                  TR                  -   U	-
  TR2                  TR2                  TR                   -   US9  SnS	UU4S jjn[=        T R                  U5       H1  u  nnUS:”  d  M  U" UU5      nT R?                  UUTUU5        UU-  nM3     TR                  [        U5      -
  n[=        T R                  U5       H)  u  nnU" UU5      nT R?                  UUTUU5        UU-  nM+     T RA                  UTU5        TURB                  T '   g s  snf s  snf )
Nr   T)r}  Úhighlight_linesrô  rá  Ú	has_focusrÀ   r¾  )rv  rw  r�  rx  ry  rz  r{  r|  r‚  rƒ  r„  r}  c           	     ó  >• T[        5       R                  R                  5       ;  a  [        $ T
R	                  5        VVs0 s H  u  pX!_M	     nnnU R
                  R                  nU R
                  R                  nTR                  [        T5      -   S-
  n[        Xd5      nUS:¼  aT   X4U4   u  pxTR                  R                  [        [        X‡S9U R                  U R                   U R"                  S95      n	OKTR                  R                  [        [        SSS9U R                  U R                   U R"                  S95      n	U	[        :X  a  TR'                  U 5      n	U	$ s  snnf ! [$         a    US-  n Of = fUS:¼  a  Mß  NŒ)z©
Wrapper around the mouse_handler of the `UIControl` that turns
screen coordinates into line coordinates.
Returns `NotImplemented` if no UI invalidation should be done.
r    r   r;  )rÚ  Ú
event_typeÚbuttonÚ	modifiers)r   rB  Úwalk_through_modal_areaÚNotImplementedrô   rÚ  r=  r<  rë   rù   rö   r#  Úmouse_handlerr   r   r=  r>  r?  r�  Ú_mouse_handler)Úmouse_eventrž  rŸ  Úyx_to_rowcolr=  r<  Úmax_yrV  r˜  rÞ   r‚  rK   r|  r`   s             €€€€rL   rB  Ú7Window._write_to_screen_at_index.<locals>.mouse_handler  s€  ø€ ð œ7›9×+Ñ+×CÑCÓEÓEÜ%Ð%ð .:×-?Ñ-?Ô-AÔBÒ-A¡T Q˜AšDÑ-AˆLÑBØ×$Ñ$×&Ñ&ˆAØ×$Ñ$×&Ñ&ˆAð #×'Ñ'¬#Ð.EÓ*FÑFÈÑJˆEÜ�E“ˆAð �q“&ðØ+¨q¨DÑ1‘H�Cð "Ÿ\™\×7Ñ7Ü"Ü%*¨SÑ%8Ø'2×'=Ñ'=Ø#.×#5Ñ#5Ø&1×&;Ñ&;ñ	ó�Fð ð Ÿ™×3Ñ3ÜÜ!&¨¨a¡Ø#.×#9Ñ#9Ø*×1Ñ1Ø"-×"7Ñ"7ñ	ó�ð œÓ'Ø×,Ñ,¨[Ó9�àˆMùó] Cøô  ó ð ˜‘F’Aðúð �q–&s   ÁE&Â+E, Å,E>Å=E>)Úx_minÚx_maxÚy_minÚy_maxÚhandlerc                óŽ   >• U R                  TUTR                  5      n[        U5      R                  US-   TR                  5      $ )zRender margin. Return `Screen`.r    )Úcreate_marginr¢   r"   r(  )r	  rX   Ú	fragmentsrõ  r`   s      €€rL   Úrender_marginÚ7Window._write_to_screen_at_index.<locals>.render_margin^  sF   ø€ ð Ÿ™¨°U¸N×<QÑ<QÓRˆIô (¨	Ó2×AÑAØ˜‘	˜>×0Ñ0óð rP   ©rD  r   rp   r3   )r	  r+   rX   rs   rp   r$   )"r¢   rX   rè  r  ré  rü   r#  r(  Ú
isinstancer$   r}  Ú_scrollÚ_fill_bgrh  rÀ   Ú
_copy_bodyrx  r�  rô  rá  r   rB  Úcurrent_controlr¾  rì   rë   r>   rê  rõ  Úset_mouse_handler_for_rangerí   Ú_copy_marginÚ_apply_styleÚ"visible_windows_to_write_positions)rK   r^   r_   r`   ra   rb   r	  Úleft_margin_widthsÚright_margin_widthsr  rw  r}  rÀ   rƒ  r„  rB  Úmove_xrP  rX   Úmargin_contentrõ  r‚  r|  s   `  `                @@@rL   r7  Ú Window._write_to_screen_at_indexÌ  s£  ü€ ð × Ñ  AÓ%¨×)=Ñ)=ÀÓ)BØð BF×ARÒARÓSÒAR¸A˜d×4Ñ4°QÖ7ÑARÐÐSØBF×BTÒBTÓUÒBT¸Q˜t×5Ñ5°aÖ8ÑBTÐÐUÜ Ð!3Ñ!IÓJÐð —\‘\×0Ñ0Ø× Ñ Ð#5Ñ5°~×7LÑ7Ló
ˆ
ô ˜*¤i×0Ñ0Ð0Ð0ð —_‘_Ó&ˆ
Ø�‰Ø˜×,Ñ,Ð/AÑAÀ>×CXÑCXô	
ð
 	�‰�f˜n¨hÔ7ô !)¨¯©× 4Ñ 4�—
‘
”¸$¿*¹*ˆð 15·±ØØØÜÐ"Ó#Ø× Ñ Ð#5Ñ5Ø× Ñ Ø×"Ñ"Ø!Ø Ø"×4Ñ4Ø#×6Ñ6Ó8Ü“i×&Ñ&×6Ñ6¸$¿,¹,ÑFØØ ×0Ñ0ð 1@ð 1
Ñ-Ð ð$ "×&Ñ&¬Ð-?Ó)@Ñ@ˆØ!×&Ñ&ˆä&ØØ!Ø"×4Ñ4Ø ×0Ñ0Ø'×-Ñ-Ð0BÑBØ(×/Ñ/Ø&*×&9Ñ&9Ø$;Ø%ØØØ!ñ
ˆð 'ˆÔ÷:	ò :	ðx 	×2Ñ2Ø ×%Ñ%¬Ð,>Ó(?Ñ?Ø ×%Ñ%¨×(<Ñ(<Ñ<Ð?QÑQØ ×%Ñ%Ø ×%Ñ%¨×(=Ñ(=Ñ=Ø!ð 	3ñ 	
ð ˆ÷		ð 		ô ˜D×-Ñ-Ð/AÖB‰HˆAˆuØ�q�yá!.¨q°%Ó!8�ð ×!Ñ! .°&¸.È&ÐRWÔXØ˜%‘’ñ Cð  ×%Ñ%¬Ð,?Ó(@Ñ@ˆä˜D×.Ñ.Ð0CÖD‰HˆAˆuá*¨1¨eÓ4ˆNð ×Ñ˜n¨f°nÀfÈeÔTØ�e‰OŠFñ Eð 	×Ñ˜& .°,Ô?ð ;Iˆ×1Ñ1°$Ò7ùòO TùÚUs   µN"Á N'r   c                óÜ  ^^^^^^^^
^^^^^^^^^^• TR                   U-   mTR                  mTR                  mTR                  m[        S   m0 m0 m S           SUUUUUUUUUUUUUU4S jjjmSUUUUUU
UU4S jjnU" 5         S	U4S jjnTR
                  (       a¢  U" TR
                  R                  TR
                  R                  5      nU(       aC  TR                  U U5        U(       a  STl	        OTR                  Tl	        U R                  T5        U	(       a   U R                  TUTTTTR                  5        U(       a"  TR
                  (       a  U R                  T5        TR                  (       aA  TR                  U U" TR                  R                  TR                  R                  5      5        [!        TR                  TTR                  -   5      Tl        TT4$ )
zä
Copy the UIContent into the output screen.
Return (visible_line_to_row_col, rowcol_to_yx) tuple.

:param get_line_prefix: None or a callable that takes a line number
    (int) and a wrap_count (int) and returns formatted text.
)r›   r›   Fc           
     ó  >• U(       a  TnO0 nU(       a#  T(       a  [        T" US5      5      nT" XaX#SS9u  p#SnT(       aR  U(       aK  Tn[        U 5      n US:”  a4  U (       a-  U[        U S   S   5      -  nUS-  nU SS2	 US:”  a	  U (       a  M-  X(-  nT[        R                  :X  a  [        U 5      n	U	T :  a  UT U	-
  S-  -  nO-T[        R                  :X  a  [        U 5      n	U	T :  a  UT U	-
  -  nSn
SnU  GH�  tpÍnTUT$-      nSU;   a"  TR                  UT$-      UT#-   ==   U-  ss'   M6  U GHS  n[        UU4   nUR                  nT!(       ap  UU-   T :”  ag  UTU   S   U-   4TUS-   '   US-  nUS-  nSnU(       a"  T(       a  [        T" X5      5      nT" XaX#SS9u  p#TUT$-      nUT"R                  :¼  a  X#4s  s  $ US:¼  a±  US:¼  a«  UT :  a¥  UXòT#-   '   US:”  a  [        SU5       H  nTXòT#-   U-   '   M     OjUS:X  ad  S H^  nUU-
  S:¼  d  M  XòT#-   U-
     R                  U:X  d  M(  XòT#-   U-
     n[        UR                  U-   UR                  4   nUXòT#-   U-
  '   M`     UT$-   UT#-   4XQX§-   4'   U
S-  n
UU-  nGMV     GM“     X#4$ )	z�
Copy over a single line to the output screen. This can wrap over
multiple lines in the output. It will call the prefix (prompt)
function before every line.
r   F©Úis_inputr    Nr>  z[ZeroWidthEscape])r>  r    )r   r0   r   r<   r‘   r   r—   Úzero_width_escapesr-   rX   r¢   rø   rÚ   r¥   )%Úliner¿  r<  r=  rd  Úcurrent_rowcol_to_yxÚpromptÚskippedÚh_scrollÚ
line_widthr˜  Ú
wrap_countr¥   rŒ   Ú_Únew_buffer_rowr¦   rÚ   Ú
char_widthr  ÚpwÚ	prev_charÚchar2rÀ   Ú	copy_lineÚ
empty_charr¾  r�  Ú
new_bufferÚ
new_screenr‚  r|  rX   r}  r`   rì   rë   s%                          €€€€€€€€€€€€€€rL   rs  Ú$Window._copy_body.<locals>.copy_line¨  s$  ø€ ö Ø'3Ñ$à')Ð$ö žOÜ*©?¸6À1Ó+EÓF�Ù  °ÀÑF‘�ð ˆGÞ ¦XØ,�Ü-¨dÓ3�Ø “l¦tØ¤
¨4°©7°1©:Ó 6Ñ6�HØ˜q‘L�GØ˜R˜a˜R˜ð  “l§t tð
 ‘�ð
 œ×*Ñ*Ó*Ü0°Ó6�
Ø Ó%Ø˜% *Ñ,°Ñ2Ñ2�AøØœ+×+Ñ+Ó+Ü0°Ó6�
Ø Ó%Ø˜ Ñ+Ñ+�AàˆCØˆJÜ#'��˜aØ!+¨A°©HÑ!5�ð '¨%Ó/Ø×1Ñ1°!°d±(Ñ;¸AÀ¹HÓEÈÑMÓEÙä�AÜ& q¨% xÑ0�DØ!%§¡�Jö " a¨*¡n°uÓ&<à"Ø3°AÑ6°qÑ9¸AÑ=ð:Ð/°°A±Ñ6ð ˜Q™˜Ø" a™˜
Ø˜ö $®Ü%6Ù /°Ó Có&˜Fñ $-¨V¸QÈEÑ#R™D˜Aà)3°A¸±HÑ)=˜à × 5Ñ 5Ó5Ø#$ 4œKð ˜A“v ! q£&¨Q°«YØ37˜¨4¡xÑ0ð &¨›>Ü%*¨1¨jÖ%9 Ø?I °4©x¸!©|Ó <ò &:ð (¨1›_ó '- à$%¨¡F¨a¥KØ(6¸4±xÀ"±}Ñ(E×(KÑ(KÈrÕ(Qà0>À4¹xÈ"¹}Ñ0M IÜ,7Ø(1¯©¸Ñ(:¸I¿O¹OÐ(Kñ-& Eð EJ N°t±8¸b±=Ó$Añ '-ð  ™HØ ™HðGÐ,°S±]Ð-BÑCð
 ˜1‘H�CØ˜‘O“AôA ñ $(ðT �4ˆKrP   c                 óÊ   >• T	* n TnU TR                   :  aL  UT:  aF  TR                  U5      nUT4T
U '   SnT" X!X0SS9u  p0US-  nU S-  n U TR                   :  a  UT:  a  MF  U $ )Nr   Trc  r    )r¢   Úget_line)r=  r¿  rf  r<  rs  r�  r“  rw  rx  rô  r|  r`   s       €€€€€€€€rL   ÚcopyÚWindow._copy_body.<locals>.copy%  s�   ø€ Ø"Ð"ˆAØ$ˆFà�n×+Ñ+Ó+°¸Ó0Cà!×*Ñ*¨6Ó2�à.4Ð6GÐ-HÐ'¨Ñ*ð �Ù  ¨q¸dÑC‘�à˜!‘�Ø�Q‘�ð �n×+Ñ+Ó+°¸Õ0Cð ˆHrP   c                ó\   >•  TX4   u  p#[        X2S9$ ! [         a    [        SSS9s $ f = f)z<Translate row/col from UIContent to real Screen coordinates.r;  r   )r   r�  )rV  r˜  r=  r<  r‚  s       €rL   Úcursor_pos_to_screen_posÚ3Window._copy_body.<locals>.cursor_pos_to_screen_pos9  sA   ø€ ð'Ø# C HÑ-‘�ô ˜q‘Ð&øô ó 'ô ˜q A‘Ò&ð'ús   ƒ ”+ª+rÁ  )rf  r   r¿  rs   r<  rs   r=  rs   rd  rw   rp   ztuple[int, int]rÂ  )rV  rs   r˜  rs   rp   r   )rì   rë   r“  rU  r-   rO  r=  r<  Úset_cursor_positionÚshow_cursorÚ_highlight_digraphÚ_highlight_cursorlinesr¢   Ú_show_key_processor_key_bufferÚmenu_positionÚset_menu_positionrþ   )rK   rw  rv  r`   r^  rX   rx  r�  r}  r:  rô  rá  r;  rÀ   r¾  rz  r}  Úscreen_cursor_positionrs  rt  r“  ru  r‚  r|  rì   rë   s    ``` ```` `  ``   @@@@@@@@rL   rV  ÚWindow._copy_bodyƒ  sâ  ÿÿù€ ð0 ×"Ñ" VÑ+ˆØ×"Ñ"ˆØ×*Ñ*ˆ
Ø×+Ñ+ˆ
Ü  Ñ(ˆ
ð ?AÐð @Bˆð #ðz	Ø$ðz	àðz	ð ðz	ð ð	z	ð
 ðz	ð ÷z	÷ z	õ z	÷z	ö 	ñ$ 	Œ÷	'ð" ×%×%Ù%=Ø×*Ñ*×,Ñ,¨j×.HÑ.H×.JÑ.Jó&Ð"ö Ø×.Ñ.¨tÐ5KÔLæ%Ø-2�JÕ*à-7×-CÑ-C�JÔ*à×'Ñ'¨
Ô3æØ×+Ñ+ØØ*ØØØØ"×)Ñ)ôö ˜×3×3Ø×/Ñ/°
Ô;ð ×#×#Ø×(Ñ(ØÙ(Ø×,Ñ,×.Ñ.°
×0HÑ0H×0JÑ0Jóôô   
× 1Ñ 1°4¸.×:OÑ:OÑ3OÓPˆ
Ôà&¨Ð4Ð4rP   c                ó²  • [        U R                  5      (       a  U R                  5       nOU R                  nU(       d  U(       a’  Un[        U=(       d    SS4   n[        UR                  UR                  UR
                  -   5       HJ  nUR                  U   n[        UR                  UR                  UR                  -   5       H  n	XhU	'   M	     ML     gg)zR
Erase/fill the background.
(Useful for floats and when a `char` has been given.)
ré   r›   N)	rh  rÚ   r-   rø   rë   r¢   rU  rì   rX   )
rK   r^   r`   rb   rÚ   rR  Úchar_objr=  rV  r<  s
             rL   rU  ÚWindow._fill_bgu  s£   € ô �D—I‘I×ÑØ—9‘9“;‰Dà—9‘9ˆDæ–tØˆBÜ" 4§;¨3° ?Ñ3ˆHä˜2Ÿ7™7 B§G¡G¨b¯i©iÑ$7Ö8�Ø×(Ñ(¨Ñ+�Ü˜rŸw™w¨¯©°"·(±(Ñ(:Ö;�AØ%˜“Fó <ò 9ð	 rP   c                óô   • US-   [        U R                  5      -   nUR                  X$SS9  [        UR                  UR
                  UR                  -   S-
  UR                  S5      nUR                  USSS9  g )Nré   F)r¥   Úafterr    zclass:last-lineT)rŒ  )r   r¥   Ú	fill_arear/   rì   rë   r¢   rX   )rK   rv  r`   ra   r¥   rR  s         rL   rZ  ÚWindow._apply_style‹  s�   € ð ˜sÑ"¤V¨D¯J©JÓ%7Ñ7ˆà×Ñ˜^ÀÐÑFô Ø×ÑØ×Ñ .×"7Ñ"7Ñ7¸!Ñ;Ø× Ñ Øó	
ˆð 	×Ñ˜RÐ!2¸$ÐÒ?rP   c                ó´   • U R                  5       nU(       aA  UR                  U 5      n[        US4   UR                  UR                     UR
                  '   gg)zL
When we are in Vi digraph mode, put a question mark underneath the
cursor.
zclass:digraphN)r4  Úget_cursor_positionr-   rU  r=  r<  )rK   rv  Údigraph_charrN  s       rL   r�  ÚWindow._highlight_digraph�  sT   € ð
 ×-Ñ-Ó/ˆÞØ×1Ñ1°$Ó7ˆDÜ5@Ø˜oÐ-ñ6ˆJ×"Ñ" 4§6¡6Ñ*¨4¯6©6Ò2ð rP   c                óV  • [        5       nUR                  R                  nU(       a‚  [        5       (       ar  UR                  (       d`  US   R
                  n[        U5      S:X  aA  UR                  U 5      n[        US4   UR                  UR                     UR                  '   ggggg)a8  
When the user is typing a key binding that consists of several keys,
display the last pressed key if the user is in insert mode and the key
is meaningful to be displayed.
E.g. Some people want to bind 'jj' to escape in Vi insert mode. But the
     first 'j' needs to be displayed in order to get some feedback.
r�  r    zclass:partial-key-bindingN)r   Úkey_processorÚ
key_bufferÚ_in_insert_moderý   Údatar   r�  r-   rU  r=  r<  )rK   rv  r3  r•  r—  rN  s         rL   rƒ  Ú%Window._show_key_processor_key_buffer©  s˜   € ô ‹iˆØ×&Ñ&×1Ñ1ˆ
æœ/×+Ñ+°C·K·Kð ˜b‘>×&Ñ&ˆDô ˜$Ó 1Ó$Ø!×5Ñ5°dÓ;�Ü9DØÐ5Ð5ñ:�
×&Ñ& t§v¡vÑ.¨t¯v©vÒ6ð %ð 5@Ð+ˆ:rP   c                ó  • SnSnUR                   n	U R                  5       (       aK  X’R                     n
[        X3U-   5       H+  nX£   n[        UR
                  UR                  U-   4   X£'   M-     U R                  5       (       aU  [        XDU-   5       HC  nXœ   n
X¢R                     n[        UR
                  UR                  U-   4   X¢R                  '   ME     U R                  n[        U5      (       a  U" 5       nU H†  n[        U[        5      (       d   eUR                  nXóU-   :  d  M0  SUR                  -   n[        XDU-   5       H5  nXœ   n
X¯U-      n[        UR
                  UR                  U-   4   X¯U-   '   M7     Mˆ     g)z
Highlight cursor row/column.
z class:cursor-line z class:cursor-column ré   N)rU  râ  r=  rø   r-   rÚ   r¥   rã  r<  rí  rh  rS  rA   rÚ  )rK   rv  rN  r<  r=  rX   r¢   Úcursor_line_styleÚcursor_column_stylerU  rV  Úoriginal_charÚy2rí  ÚccÚcolumnÚcolor_column_styles                    rL   r‚  ÚWindow._highlight_cursorlinesÀ  s‚  € ð 2ÐØ5Ðà ×,Ñ,ˆð �?‰?×ÑØŸf™fÑ%ˆCÜ˜1 %™iÖ(�Ø #¡�Ü$Ø!×&Ñ&¨×(;Ñ(;Ð>OÑ(OÐOñ�“ñ )ð ×Ñ×ÑÜ˜A 6™zÖ*�Ø!‘o�Ø #§F¡F¡�Ü)Ø!×&Ñ&¨×(;Ñ(;Ð>QÑ(QÐQñ�—F‘F“ñ +ð ×(Ñ(ˆÜ�L×!Ñ!Ù'›>ˆLãˆBÜ˜b¤+×.Ñ.Ð.Ð.Ø—[‘[ˆFà˜E™	Õ!Ø%(¨2¯8©8¡^Ð"ä  v¡:Ö.�BØ%™/�CØ$'°©
¡O�MÜ&1Ø%×*Ñ*¨M×,?Ñ,?ÐBTÑ,TÐTñ'�C ™
“Oó /ò rP   c                óŽ   • UR                   U-   nUR                  n[        XgXSR                  5      nU R	                  XUSU5        g)z<
Copy characters from the margin screen to the real screen.
r   N)rì   rë   r/   r¢   rV  )	rK   r_  rv  r`   r^  rX   rì   rë   Úmargin_write_positions	            rL   rY  ÚWindow._copy_marginð  sE   € ð ×"Ñ" VÑ+ˆØ×"Ñ"ˆä -¨d¸%×AVÑAVÓ WÐØ�‰˜Ð4IÈ1ÈeÕTrP   c                ór   • U R                  5       (       a  U R                  nOU R                  nU" XU5        g)z1
Scroll body. Ensure that the cursor is visible.
N)r}  Ú_scroll_when_linewrappingÚ_scroll_without_linewrapping)rK   rw  rX   r¢   Úfuncs        rL   rT  ÚWindow._scroll	  s1   € ð �?‰?×ÑØ×1Ñ1‰Dà×4Ñ4ˆDáˆZ Õ'rP   c                ó¸  ^ ^^^^
^^• T R                   R                  mT R                   R                  mST l        S	U UU4S jjm
TS::  a#  TR                  R
                  T l        ST l        gT
" TR                  R
                  5      nUTT-
  :”  a¡  TR                  TR                  R
                  TT R                  TR                  R                  S9nTR                  R
                  T l        [        US-
  UT-
  T R                  5      T l        [        SUT-
  T R                  5      T l        gST l        S
U
UUU4S jjnS
U
UU4S jjnS
U
UU4S jjnU" 5       n	[        T R                  [        X–" 5       5      5      T l        [        T R                  U" 5       5      T l        T R                  5       (       d  [        T R                  U	5      T l        gg)ú•
Scroll to make sure the cursor position is visible and that we maintain
the requested scroll offset.

Set `self.horizontal_scroll/vertical_scroll`.
r   c                ó>   >• TR                  U TTR                  5      $ rˆ   )r½  r¾  )r¿  rK   rw  rX   s    €€€rL   Úget_line_heightÚ9Window._scroll_when_linewrapping.<locals>.get_line_height	  s   ø€ Ø×1Ñ1°&¸%À×AUÑAUÓVÐVrP   N)Ú
slice_stopr    c                 óº   >• Sn TR                   R                  n[        TR                   R                  SS5       H  nU T" U5      -  n U TT-
  :”  a  Us  $ UnM     g)Nr   r�  ©rO  r=  rø   )Úused_heightÚprev_linenor¿  r­  r¢   Úscroll_offsets_bottomrw  s      €€€€rL   Úget_min_vertical_scrollÚAWindow._scroll_when_linewrapping.<locals>.get_min_vertical_scrollH	  sh   ø€ ð ˆKØ$×4Ñ4×6Ñ6ˆKä 
× :Ñ :× <Ñ <¸bÀ"ÖE�Ø™¨vÓ6Ñ6�à Ð*?Ñ!?Ó?Ø&Ò&à"(’Kñ Fð rP   c                 ó¼   >• TR                   R                  n Sn[        TR                   R                  S-
  SS5       H  nUT" U5      -  nUT:”  a  U s  $ Un M     U $ )Nr   r    r�  r±  )r³  r²  r¿  r­  Úscroll_offsets_toprw  s      €€€rL   Úget_max_vertical_scrollÚAWindow._scroll_when_linewrapping.<locals>.get_max_vertical_scrollW	  si   ø€ à$×4Ñ4×6Ñ6ˆKØˆKä 
× :Ñ :× <Ñ <¸qÑ @À"ÀbÖI�Ø™¨vÓ6Ñ6�àÐ!3Ó3Ø&Ò&à"(’Kñ Jð ÐrP   c                 óš   >• TR                   S-
  n Sn[        TR                   S-
  SS5       H  nUT" U5      -  nUT:”  a  U s  $ Un M     U $ )z«
Calculate the upper most line that can be visible, while the bottom
is still visible. We should not allow scroll more than this if
`allow_scroll_beyond_bottom` is false.
r    r   r�  )r“  rø   )r³  r²  r¿  r­  r¢   rw  s      €€€rL   Úget_topmost_visibleÚ=Window._scroll_when_linewrapping.<locals>.get_topmost_visiblee	  sc   ø€ ð %×/Ñ/°!Ñ3ˆKØˆKÜ 
× 5Ñ 5¸Ñ 9¸2¸rÖB�Ø™¨vÓ6Ñ6�Ø Ó'Ø&Ò&à"(’Kñ Cð ÐrP   rÃ  rÂ  )rê  rI  rH  r�  rO  r=  rx  rô  r½  r¾  r<  rö   rþ   rà  )rK   rw  rX   r¢   Úline_heightÚtext_before_heightrµ  r¹  r¼  Útopmost_visibler­  r´  r¸  s   ````      @@@rL   r¦  Ú Window._scroll_when_linewrapping	  sÑ  þ€ ð !%× 3Ñ 3× :Ñ :ÐØ!×0Ñ0×4Ñ4Ðð "#ˆÔ÷	Wñ 	Wð �A‹:Ø#-×#=Ñ#=×#?Ñ#?ˆDÔ Ø%&ˆDÔ"Øñ & j×&@Ñ&@×&BÑ&BÓCˆØ˜Ð"4Ñ4Ó4ð ",×!?Ñ!?Ø×*Ñ*×,Ñ,ØØ×$Ñ$Ø%×5Ñ5×7Ñ7ð	 "@ð "Ðð $.×#=Ñ#=×#?Ñ#?ˆDÔ Ü%(Ø" QÑ&ØØñà×&Ñ&ó	&ˆDÔ"ô &)ØÐ%¨Ñ.°×0FÑ0Fó&ˆDÔ"ð à%&ˆDÔ"÷	ò 	÷	ñ 	÷	ñ 	ñ$ .Ó/ˆô
  #Ø× Ñ ¤# oÐ7NÓ7PÓ"Qó 
ˆÔô  # 4×#7Ñ#7Ñ9PÓ9RÓSˆÔð ×.Ñ.×0Ñ0Ü#& t×';Ñ';¸_Ó#MˆDÕ ð 1rP   c                óH  ^ • UR                   =(       d
    [        SSS9nST l        UR                  S:X  a  ST l        ST l        g[        UR                  UR                  5      5      n              SU 4S jjnT R                  (       a7  T R                  T 5      T l        [        T R                  [        5      (       d   eT R                  (       a7  T R                  T 5      T l        [        T R
                  [        5      (       d   eT R                  nU" T R                  UR                  UR                  UR                   R                  UUR                  S9T l        T R                   (       a9  [#        [%        T R!                  UR                   R                  S5      5      5      nOSnU" T R
                  UR&                  UR(                  [+        USUR                   R,                   5      X(-
  [/        [+        U5      T R
                  U-   5      S9T l        g)r«  r   r;  Nc                ó8  >• [        [        XS-  U5      5      n[        [        X$S-  US-
  U-
  5      5      nU S:  a  Sn TR                  5       (       d  XU-
  :”  a  [        SXT-
  5      n XU-
  :”  a  [        SX1-
  5      n XS-   U-
  U-   :  a  US-   U-
  U-   n U $ )zEScrolling algorithm. Used for both horizontal and vertical scrolling.r>  r    r   )rs   rö   rà  rþ   )Úcurrent_scrollÚscroll_offset_startÚscroll_offset_endÚ
cursor_posÚwindow_sizeÚcontent_sizerK   s         €rL   Ú	do_scrollÚ6Window._scroll_without_linewrapping.<locals>.do_scroll�	  sÍ   ø€ ô #&ÜÐ'°q©¸*ÓEó#Ðô !$ÜÐ%°Q¡¸ÀqÑ8HÈ:Ñ8UÓVó!Ðð
  Ó!Ø!"�ð ×3Ñ3×5Ñ5Ø"°KÑ%?Ó?ä!$ Q¨Ñ(BÓ!C�ð Ð-@Ñ @Ó@Ü!$ Q¨
Ñ(HÓ!I�ð ¨a¡°;Ñ >ÐARÑ RÓRØ",¨q¡.°KÑ!?ÐBSÑ!S�à!Ð!rP   )rÄ  rÅ  rÆ  rÇ  rÈ  rÉ  )rÄ  rs   rÅ  rs   rÆ  rs   rÇ  rs   rÈ  rs   rÉ  rs   rp   rs   )rO  r   rô  r“  rx  r�  r   ry  r=  rë  rS  rs   rì  rê  rH  rI  r¾  r   r   rF  rG  r   r<  rþ   )	rK   rw  rX   r¢   rO  Úcurrent_line_textrÊ  ÚoffsetsÚcurrent_line_prefix_widths	   `        rL   r§  Ú#Window._scroll_without_linewrapping…	  s  ø€ ð %×4Ñ4×G¼ÀÀQ¹ˆð "#ˆÔà× Ñ  AÓ%Ø#$ˆDÔ Ø%&ˆDÔ"Øä 5Ø×#Ñ# O×$5Ñ$5Ó6ó!Ðð&	"Øð&	"à!$ð&	"ð  #ð&	"ð ð	&	"ð
 ð&	"ð ð&	"ð ÷&	"ðR ×#×#Ø#'×#;Ñ#;¸DÓ#AˆDÔ Ü˜d×2Ñ2´C×8Ñ8Ð8Ð8Ø×%×%Ø%)×%?Ñ%?ÀÓ%EˆDÔ"Ü˜d×4Ñ4´c×:Ñ:Ð:Ð:ð ×%Ñ%ˆá(Ø×/Ñ/Ø '§¡Ø%Ÿn™nØ!×1Ñ1×3Ñ3ØØ#×.Ñ.ñ 
ˆÔð ××Ü(;Ü! $×"6Ñ"6°z×7QÑ7Q×7SÑ7SÐUVÓ"WÓXó)Ñ%ð )*Ð%á!*Ø×1Ñ1Ø '§¡Ø%Ÿm™mÜ!Ð"3Ð4R°j×6PÑ6P×6RÑ6RÐ"SÓTØÑ9ô ÜÐ,Ó-¨t×/EÑ/EÈÑ/Móñ"
ˆÕrP   c                óÊ   • UR                   [        R                  :X  a  U R                  5         gUR                   [        R                  :X  a  U R                  5         g[        $ )zÍ
Mouse handler. Called when the UI control doesn't handle this
particular event.

Return `NotImplemented` if nothing was done as a consequence of this
key binding (no UI invalidate required in that case).
N)r=  r   ÚSCROLL_DOWNÚ_scroll_downÚ	SCROLL_UPÚ
_scroll_uprA  )rK   rD  s     rL   rC  ÚWindow._mouse_handlerî	  sN   € ð ×!Ñ!¤^×%?Ñ%?Ó?Ø×ÑÔØØ×#Ñ#¤~×'?Ñ'?Ó?Ø�O‰OÔØäÐrP   c                ó.  • U R                   nUc  gU R                  UR                  UR                  -
  :  a^  UR                  R
                  UR                  R                  ::  a  U R                  R                  5         U =R                  S-  sl        gg)zScroll window down.Nr    )
rõ  rx  r­  rz  rO  r=  r{  rH  r#  Úmove_cursor_down©rK   Úinfos     rL   rÒ  ÚWindow._scroll_downÿ	  s{   € à×Ñˆà‰<Øà×Ñ $×"5Ñ"5¸×8JÑ8JÑ"JÓJØ×#Ñ#×%Ñ%¨×)GÑ)G×)KÑ)KÓKØ—‘×-Ñ-Ô/à× Ò  AÑ%Ö ð	 KrP   c                ó   • U R                   nUc  gUR                  S:”  an  UR                  R                  UR                  S-
  UR
                  R                  -
  :¼  a  U R                  R                  5         U =R                  S-  sl        gg)zScroll window up.Nr   r    )	rõ  rx  rO  r=  rz  r{  rI  r#  Úmove_cursor_uprØ  s     rL   rÔ  ÚWindow._scroll_up
  s�   € à×Ñˆà‰<Øà×Ñ !Ó#ð ×$Ñ$×&Ñ&Ø×%Ñ%¨Ñ)¨D×,JÑ,J×,QÑ,QÑQóRð —‘×+Ñ+Ô-à× Ò  AÑ%Ö ð $rP   c                ó6   • U R                   R                  5       $ rˆ   )r#  rj   rJ   s    rL   rj   ÚWindow.get_key_bindings
  s   € Ø�|‰|×,Ñ,Ó.Ð.rP   c                ó   • / $ rˆ   rI   rJ   s    rL   rm   ÚWindow.get_children 
  s   € Øˆ	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¥   rx  rô  rX   r}  rc   )0r#  zUIControl | NonerX   r&   r¢   r&   rc   rx   rä  r   rå  r   ræ  r   rç  r   rè  úSequence[Margin] | Noneré  râ  rê  zScrollOffsets | Nonerà  r   r}  r   rë  úCallable[[Window], int] | Nonerì  rã  rá  r   râ  r   rã  r   rí  z:None | list[ColorColumn] | Callable[[], list[ColorColumn]]rÀ   z'WindowAlign | Callable[[], WindowAlign]r¥   r¶   rÚ   zNone | str | Callable[[], str]r¾  zGetLinePrefixCallable | Nonerp   rq   rs  ro   )rþ  r+   rp   rs   rÂ  rr   rt   rÁ  )r  zDimension | Noner  zCallable[[], int | None]r  rw   rp   r'   )rX   rs   r¢   rs   rp   r$   )rp   rµ   ru   )r^   r.   r_   r,   r`   r/   ra   rv   rb   rw   rp   rq   )rw  r$   rv  r.   r`   r/   r^  rs   rX   rs   rx  rs   r�  rs   r}  rw   r:  rw   rô  rs   rá  rw   r;  rw   rÀ   r<   r¾  z-Callable[[int, int], AnyFormattedText] | Nonerp   zItuple[dict[int, tuple[int, int]], dict[tuple[int, int], tuple[int, int]]])r^   r.   r`   r/   rb   rw   rp   rq   )rv  r.   r`   r/   ra   rv   rp   rq   )rv  r.   rp   rq   )rv  r.   rN  r   r<  rs   r=  rs   rX   rs   r¢   rs   rp   rq   )r_  r$   rv  r.   r`   r/   r^  rs   rX   rs   rp   rq   )rw  r$   rX   rs   r¢   rs   rp   rq   rR  rz   r|   )$r}   r~   r   r€   r�   r<   r–   r§   rn  rM   r  r  rT   rZ   Ústaticmethodr  rú  r4  rd   r7  rV  rU  rZ  r�  rƒ  r‚  rY  rT  r¦  r§  rC  rÒ  rÔ  rj   rm   r‚   rI   rP   rL   r=   r=   i  sw  † ñ;ð~ %)Ø"Ø#Ø"Ø*/Ø+0Ø-2Ø.3Ø04Ø15Ø/3Ø38Ø#(Ø>BØ@DØ+0Ø#(Ø%*ð Ø9D×9IÑ9IØ)+Ø/3Ø8<ð5>à!ð>ð ð>ð ð	>ð
 ð>ð (ð>ð )ð>ð +ð>ð  ,ð>ð .ð>ð /ð>ð -ð>ð %1ð>ð !ð>ð <ð>ð   >ð!>ð" )ð#>ð$ !ð%>ð& #ð'>ð* Gð+>ð. 7ð/>ð0 'ð1>ð2 -ð3>ð4 6ð5>ð6 
õ7>ô@3ô9ô <ô 
ô
ô>
ð6 ð "ð.
Ø#ð.
à/ð.
ð ð.
ð 
ô	.
ó ð.
ô`	<ô	ð7Kàð7Kð &ð7Kð &ð	7Kð
 ð7Kð ð7Kð ð7Kð 
ô7KðruIàðuIð &ðuIð &ð	uIð
 ðuIð ðuIð 
ôuIð|  !Ø!"Ø Ø %Ø!"Ø#(ØØ(×-Ñ-ØIMðp5àðp5ð ðp5ð &ð	p5ð
 ðp5ð ðp5ð ðp5ð ðp5ð ðp5ð ðp5ð ðp5ð !ðp5ð ðp5ð ðp5ð Gðp5ð  
Sõ!p5ðd&Øð&Ø.;ð&ØGKð&à	ô&ð,@Ø ð@Ø2?ð@ØORð@à	ô@ô$
ôð..Ø ð.Ø(-ð.Ø25ð.Ø:=ð.ØFIð.ØSVð.à	ô.ð`Uà!ðUð ðUð &ð	Uð
 ðUð ðUð 
ôUô"	(ðwNØ#ðwNØ,/ðwNØ9<ðwNà	ôwNðrg
Ø#ðg
Ø,/ðg
Ø9<ðg
à	ôg
ôRô"&ô&ô"/÷rP   c                  óŽ   • \ rS rSrSr S       SS jjrSS jrSS jrSS jrSS jr	              SS	 jr
SS
 jrSrg)r?   i$
  zö
Wrapper around any other container that can change the visibility. The
received `filter` determines whether the given container should be
displayed or not.

:param content: :class:`.Container` instance.
:param filter: :class:`.Filter` instance.
Nc                ón   • [        U5      U l        Ub  [        U5      OS U l        [        U5      U l        g rˆ   )rB   r#  Úalternative_contentr   Úfilter)rK   r#  rè  rç  s       rL   r§   ÚConditionalContainer.__init__.
  s<   € ô $ GÓ,ˆŒð #Ñ.ô Ð,Ô-àð 	Ô ô
   Ó'ˆ�rP   c                ó@   • SU R                   < SU R                  < S3$ )NzConditionalContainer(z	, filter=rm  )r#  rè  rJ   s    rL   rn  ÚConditionalContainer.__repr__<
  s    € Ø& t§|¡|Ñ&6°iÀÇÁ¹ÈaÐPÐPrP   c                ó8   • U R                   R                  5         g rˆ   )r#  rM   rJ   s    rL   rM   ÚConditionalContainer.reset?
  s   € Ø�‰×ÑÕrP   c                óÜ   • U R                  5       (       a  U R                  R                  U5      $ U R                  b  U R                  R                  U5      $ [        R
                  " 5       $ rˆ   )rè  r#  rT   rç  r'   ÚzerorR   s     rL   rT   Ú$ConditionalContainer.preferred_widthB
  sT   € Ø�;‰;�=‰=Ø—<‘<×/Ñ/Ð0CÓDÐDØ×%Ñ%Ñ1Ø×+Ñ+×;Ñ;Ð<OÓPÐPä—>’>Ó#Ð#rP   c                óÜ   • U R                  5       (       a  U R                  R                  X5      $ U R                  b  U R                  R                  X5      $ [        R
                  " 5       $ rˆ   )rè  r#  rZ   rç  r'   rï  rW   s      rL   rZ   Ú%ConditionalContainer.preferred_heightJ
  sY   € Ø�;‰;�=‰=Ø—<‘<×0Ñ0°ÓMÐMØ×%Ñ%Ñ1Ø×+Ñ+×<Ñ<Øóð ô —>’>Ó#Ð#rP   c                óÂ   • U R                  5       (       a  U R                  R                  XX4XV5      $ U R                  b   U R                  R                  UUUUUU5      $ g rˆ   )rè  r#  rd   rç  r]   s          rL   rd   Ú$ConditionalContainer.write_to_screenT
  sk   € ð �;‰;�=‰=Ø—<‘<×/Ñ/Ø¨Àhóð ð ×%Ñ%Ñ1Ø×+Ñ+×;Ñ;ØØØØØØóð ð 2rP   c                óp   • U R                   /nU R                  b  UR                  U R                  5        U$ rˆ   )r#  rç  rÛ   )rK   rÞ   s     rL   rm   Ú!ConditionalContainer.get_childrenk
  s0   € Ø—,‘,�ˆØ×#Ñ#Ñ/Ø�M‰M˜$×2Ñ2Ô3ØˆrP   )rç  r#  rè  rˆ   )r#  r4   rè  r   rç  rq  rp   rq   rs  ro   rr   rt   ru   r|   )r}   r~   r   r€   r�   r§   rn  rM   rT   rZ   rd   rm   r‚   rI   rP   rL   r?   r?   $
  sš   † ñð 48ð	(àð(ð ð(ð 1ð	(ð
 
õ(ôQôô$ô$ðàðð &ðð &ð	ð
 ðð ðð ðð 
ô÷.rP   r?   c                  óŽ   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	              SS jr
SS	 jrSS
 jrSS jrSrg)rE   ir
  z»
Container class that dynamically returns any Container.

:param get_container: Callable that returns a :class:`.Container` instance
    or any widget with a ``__pt_container__`` method.
c                ó   • Xl         g rˆ   ©Úget_container)rK   rú  s     rL   r§   ÚDynamicContainer.__init__z
  s   € Ø*ÕrP   c                ó8   • U R                  5       n[        U5      $ )z”
Return the current container object.

We call `to_container`, because `get_container` can also return a
widget with a ``__pt_container__`` method.
)rú  rB   )rK   Úobjs     rL   Ú_get_containerÚDynamicContainer._get_container}
  s   € ð × Ñ Ó"ˆÜ˜CÓ Ð rP   c                ó@   • U R                  5       R                  5         g rˆ   )rþ  rM   rJ   s    rL   rM   ÚDynamicContainer.reset‡
  s   € Ø×ÑÓ×#Ñ#Õ%rP   c                ó@   • U R                  5       R                  U5      $ rˆ   )rþ  rT   rR   s     rL   rT   Ú DynamicContainer.preferred_widthŠ
  s   € Ø×"Ñ"Ó$×4Ñ4Ð5HÓIÐIrP   c                ó@   • U R                  5       R                  X5      $ rˆ   )rþ  rZ   rW   s      rL   rZ   Ú!DynamicContainer.preferred_height�
  s   € Ø×"Ñ"Ó$×5Ñ5°eÓRÐRrP   c                óF   • U R                  5       R                  XX4XV5        g rˆ   )rþ  rd   r]   s          rL   rd   Ú DynamicContainer.write_to_screen�
  s"   € ð 	×ÑÓ×-Ñ-Ø NÀ(õ	
rP   c                ó   • g)NFrI   rJ   s    rL   rg   ÚDynamicContainer.is_modal�
  s   € ØrP   c                ó   • g rˆ   rI   rJ   s    rL   rj   Ú!DynamicContainer.get_key_bindings 
  s   € ð rP   c                ó$   • U R                  5       /$ rˆ   )rþ  rJ   s    rL   rm   ÚDynamicContainer.get_children¥
  s   € ð
 ×#Ñ#Ó%Ð&Ð&rP   rù  N)rú  zCallable[[], AnyContainer]rp   rq   )rp   r5   ro   rr   rt   ru   ry   rz   r|   )r}   r~   r   r€   r�   r§   rþ  rM   rT   rZ   rd   rg   rj   rm   r‚   rI   rP   rL   rE   rE   r
  sz   † ñô+ô!ô&ôJôSð
àð
ð &ð
ð &ð	
ð
 ð
ð ð
ð ð
ð 
ô
ôô÷
'rP   rE   c                ó¢   • [        U [        5      (       a  U $ [        U S5      (       a  [        U R	                  5       5      $ [        SU < 35      e)z;
Make sure that the given object is a :class:`.Container`.
r‰   zNot a container object: )rS  r5   ÚhasattrrB   r‰   Ú
ValueError©Ú	containers    rL   rB   rB   ­
  sL   € ô �)œY×'Ñ'ØÐÜ	�Ð.×	/Ñ	/Ü˜I×6Ñ6Ó8Ó9Ð9äÐ3°I±=ÐAÓBÐBrP   c                ó¸   • [        U [        5      (       a  U $ [        U S5      (       a#  [        [	        SU 5      R                  5       5      $ [        SU < S35      e)z:
Make sure that the given argument is a :class:`.Window`.
r‰   r…   zNot a Window object: Ú.)rS  r=   r  rC   r   r‰   r  r  s    rL   rC   rC   ¹
  sV   € ô �)œV×$Ñ$ØÐÜ	�Ð.×	/Ñ	/ÜœÐ.°	Ó:×KÑKÓMÓNÐNäÐ0°±¸QÐ?Ó@Ð@rP   c                ó˜   • [        U [        5      (       a  g[        U S5      (       a#  [        [	        SU 5      R                  5       5      $ g)zV
Checks whether the given value is a container object
(for use in assert statements).
Tr‰   r…   F)rS  r5   r  rD   r   r‰   )Úvalues    rL   rD   rD   Å
  sA   € ô
 �%œ×#Ñ#ØÜˆuÐ(×)Ñ)ÜœDÐ!1°5Ó9×JÑJÓLÓMÐMØrP   N)rp   r=   )r  r4   rp   r5   )r  r4   rp   r=   )r  Úobjectrp   zTypeGuard[AnyContainer])^r�   Ú
__future__r   Úabcr   r   Úenumr   Ú	functoolsr   Útypingr   r	   r
   r   r   Ú"prompt_toolkit.application.currentr   Úprompt_toolkit.cacher   Úprompt_toolkit.data_structuresr   Úprompt_toolkit.filtersr   r   r   r   Úprompt_toolkit.formatted_textr   r   r   Ú#prompt_toolkit.formatted_text.utilsr   r   Úprompt_toolkit.key_bindingr   Úprompt_toolkit.mouse_eventsr   r   Úprompt_toolkit.utilsr   r   r   r   Úcontrolsr!   r"   r#   r$   r%   r  r&   r'   r(   r)   r*   Úmarginsr+   r_   r,   r^   r-   r.   r/   Úutilsr0   Útyping_extensionsr1   r2   Ú'prompt_toolkit.key_binding.key_bindingsr3   Ú__all__r5   r…   r4   r�   r7   r6   r™   r8   r9   r:   r;   r>   r@   rA   r–  r<   r=   r?   rE   rB   rC   rD   rI   rP   rL   Ú<module>r,     s’  ðñõ
 #ç 'Ý Ý ß AÕ Aå 6Ý ,Ý 0÷ó ÷ñ ÷
õ 7ß Bß OÓ O÷õ ÷õ õ Ý )ß 6Ñ 6Ý )æß5åLò€ô,D˜'ò DöN ô8˜ô 8ð �YÐ 0Ð0Ñ1€ôô�Dô ô�dô ô(ˆYô (ôVkˆVô kô\DˆVô DôNY�Yô Y÷xM2ñ M2÷`Yñ Y÷x$xñ $x÷Nñ ð !Ð#4Ñ4€ô�$ô ôxˆYô xôv%K˜9ô Kô\8'�yô 8'ôv	Cô	Aõ	rP   