ó
    OÎh*  ã                  óV  • S SK Jr  S SKJrJrJrJrJrJrJ	r	J
r
  S SKJr  \(       a  S SKJr  S SKJr  / SQr\	\\\4   \\\\\/S4   4   4   r\\   r\(       a  S SKJr   " S	 S
\5      r\	\S
\\/ \4   S4   r S       SS jjrSS jr " S S\5      r " S S5      rSS jrg)é    )Úannotations)ÚTYPE_CHECKINGÚAnyÚCallableÚIterableÚListÚTupleÚUnionÚcast)Ú
MouseEvent)ÚProtocol)ÚNotImplementedOrNone)	ÚOneStyleAndTextTupleÚStyleAndTextTuplesÚMagicFormattedTextÚAnyFormattedTextÚto_formatted_textÚis_formatted_textÚTemplateÚmerge_formatted_textÚFormattedTextr   )Ú	TypeGuardc                  ó"   • \ rS rSrSrSS jrSrg)r   é#   zQ
Any object that implements ``__pt_formatted_text__`` represents formatted
text.
c                ó   • g ©N© ©Úselfs    Ú_/home/mande/repo/quber/.venv/lib/python3.13/site-packages/prompt_toolkit/formatted_text/base.pyÚ__pt_formatted_text__Ú(MagicFormattedText.__pt_formatted_text__)   s   € ¸só    r   N©Úreturnr   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r!   Ú__static_attributes__r   r#   r    r   r   #   s   † ñ	÷
 	Cr#   r   Nr   c           	     óþ  • U c  / nO›[        U [        5      (       a  SU 4/nO€[        U [        5      (       a  U nOh[        U S5      (       a  [	        SU 5      R                  5       nO<[        U 5      (       a  [        U " 5       US9$ U(       a  SU  4/nO[        SU < 35      eU(       a.  [	        [        U VVs/ s H  tpEUS-   U-   /UQ7PM     snn5      n[        U[        5      (       a  U$ [        U5      $ s  snnf )aH  
Convert the given value (which can be formatted text) into a list of text
fragments. (Which is the canonical form of formatted text.) The outcome is
always a `FormattedText` instance, which is a list of (style, text) tuples.

It can take a plain text string, an `HTML` or `ANSI` object, anything that
implements `__pt_formatted_text__` or a callable that takes no arguments and
returns one of those.

:param style: An additional style string which is applied to all text
    fragments.
:param auto_convert: If `True`, also accept other types, and convert them
    to a string first.
Ú r!   r   )Ústylez[No formatted text. Expecting a unicode object, HTML, ANSI or a FormattedText instance. Got Ú )Ú
isinstanceÚstrÚlistÚhasattrr   r!   Úcallabler   Ú
ValueErrorr   r   )Úvaluer.   Úauto_convertÚresultÚ
item_styleÚrests         r    r   r   6   s   € ð& �}Ø‰Ü	�Eœ3×	Ñ	Ø�u�+�‰Ü	�Eœ4×	 Ñ	 Ø‰Ü	�Ð/×	0Ñ	0ÜÐ*¨EÓ2×HÑHÓJ‰Ü	�%�‰Ü ¡£°Ñ6Ð6Þ	Ø˜%˜Ð"Ð#‰äð;Ø;@¹)ðEó
ð 	
ö ÜÜÙHNÔOÊÐ3D°:ˆe�c‰k˜JÑ&Ð.¨Ô.ÉÒOó
ˆô �&œ-×(Ñ(Øˆä˜VÓ$Ð$ùó Ps   Â8C9c                ó‚   • [        U 5      (       a  g[        U [        [        45      (       a  g[	        U S5      (       a  gg)zŠ
Check whether the input is valid formatted text (for use in assert
statements).
In case of a callable, it doesn't check the return type.
Tr!   F)r4   r0   r1   r2   r3   )r6   s    r    r   r   k   s8   € ô �‡�ØÜ�%œ#œt˜×%Ñ%ØÜˆuÐ-×.Ñ.ØØr#   c                  ó:   ^ • \ rS rSrSrSS jrSU 4S jjrSrU =r$ )r   éz   zv
A list of ``(style, text)`` tuples.

(In some situations, this can also be ``(style, text, mouse_handler)``
tuples.)
c                ó   • U $ r   r   r   s    r    r!   Ú#FormattedText.__pt_formatted_text__‚   s   € Øˆr#   c                ó(   >• S[         TU ]  5        S3$ )NzFormattedText(Ú))ÚsuperÚ__repr__)r   Ú	__class__s    €r    rC   ÚFormattedText.__repr__…   s   ø€ Ø¤¡Ñ 0Ó 2Ð3°1Ð5Ð5r#   r   r$   )r%   r1   )	r&   r'   r(   r)   r*   r!   rC   r+   Ú__classcell__)rD   s   @r    r   r   z   s   ø† ñô÷6õ 6r#   c                  ó,   • \ rS rSrSrSS jrSS jrSrg)	r   é‰   z�
Template for string interpolation with formatted text.

Example::

    Template(' ... {} ... ').format(HTML(...))

:param text: Plain text.
c                ó    • SU;  d   eXl         g )Nz{0}©Útext)r   rK   s     r    Ú__init__ÚTemplate.__init__”   s   € Ø˜DÓ Ð Ð Ø�	r#   c                ó   ^ ^• SU U4S jjnU$ )Nc                 ó<  >• TR                   R                  S5      n [        U 5      S-
  [        T5      :X  d   e[        5       n[	        U T5       H2  u  p#UR                  SU45        UR                  [        U5      5        M4     UR                  SU S   45        U$ )Nz{}é   r-   éÿÿÿÿ)rK   ÚsplitÚlenr   ÚzipÚappendÚextendr   )Úpartsr8   ÚpartÚvalr   Úvaluess       €€r    Ú
get_resultÚ#Template.format.<locals>.get_result™   s†   ø€ à—I‘I—O‘O DÓ)ˆEÜ�u“: ‘>¤S¨£[Ó0Ð0Ð0ä"“_ˆFÜ  ¨Ö/‘	�Ø—‘˜r 4˜jÔ)Ø—‘Ô/°Ó4Ö5ñ 0ð �M‰M˜2˜u R™y˜/Ô*ØˆMr#   ©r%   r   r   )r   rZ   r[   s   `` r    ÚformatÚTemplate.format˜   s   ù€ ÷
	ð 
	ð Ðr#   rJ   N)rK   r1   r%   ÚNone)rZ   r   r%   r   )r&   r'   r(   r)   r*   rL   r^   r+   r   r#   r    r   r   ‰   s   † ñô÷r#   r   c                ó   ^ • SU 4S jjnU$ )z@
Merge (Concatenate) several pieces of formatted text together.
c                 ób   >• [        5       n T H  nU R                  [        U5      5        M     U $ r   )r   rV   r   )r8   ÚiÚitemss     €r    Ú_merge_formatted_textÚ3merge_formatted_text.<locals>._merge_formatted_text­   s+   ø€ Ü“ˆÛˆAØ�M‰MÔ+¨AÓ.Ö/ñ àˆr#   r]   r   )rd   re   s   ` r    r   r   ¨   s   ø€ ÷
ð !Ð r#   )r-   F)r6   r   r.   r1   r7   Úboolr%   r   )r6   Úobjectr%   zTypeGuard[AnyFormattedText])rd   zIterable[AnyFormattedText]r%   r   )Ú
__future__r   Útypingr   r   r   r   r   r	   r
   r   Úprompt_toolkit.mouse_eventsr   Útyping_extensionsr   Ú'prompt_toolkit.key_binding.key_bindingsr   Ú__all__r1   r   r   r   r   r   r   r   r   r   r   r   r#   r    Ú<module>ro      sö   ðÝ "ç S× SÓ Så 2æÝ*åLò
€ð Ø	ˆ#ˆsˆ(�O�U˜3  X¨z¨lÐ<RÐ.RÑ%SÐSÑTÐTñÐ ð
 Ð.Ñ/Ð ö Ý+ôC˜Xô Cð ØØØàˆR�ˆWÑØð
ñÐ ð DIð2%Øð2%Ø$'ð2%Ø<@ð2%àõ2%ôjô6Ð&ô 6÷ñ õ>!r#   