ó
    Âu„jÏ  ã                  óN  • S SK Jr  S SKJrJr  S SK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   -  r\\   r\(       a  S S	KJr   " S
 S\5      r\\S\\/ 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)ÚCallableÚIterable)ÚTYPE_CHECKINGÚ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    Ú°C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\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   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   7   sü   € ð& �}Ø‰Ü	�Eœ3×	Ñ	Ø�u�+�‰Ü	�Eœ4×	 Ñ	 Ø‰Ü	�Ð/×	0Ñ	0ÜÐ*¨EÓ2×HÑHÓJ‰Ü	�%�‰Ü ¡£°Ñ6Ð6Þ	Ø˜%˜Ð"Ð#‰äØiÐjoÑirÐsó
ð 	
ö
 ÜÜÙ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)r1   r-   r.   r/   r0   )r3   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   r@   ÚFormattedText.__repr__…   s   ø€ Ø¤¡Ñ 0Ó 2Ð3°1Ð5Ð5r    r   r!   )r"   r.   )	r#   r$   r%   r&   r'   r   r@   r(   Ú__classcell__)rA   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   rH   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*   éÿÿÿÿ)rH   ÚsplitÚlenr   ÚzipÚappendÚextendr   )Úpartsr5   Ú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   rW   rX   s   `` r   ÚformatÚTemplate.format˜   s   ù€ ÷
	ð 
	ð Ðr    rG   N)rH   r.   r"   ÚNone)rW   r   r"   r   )r#   r$   r%   r&   r'   rI   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   rS   r   )r5   ÚiÚitemss     €r   Ú_merge_formatted_textÚ3merge_formatted_text.<locals>._merge_formatted_text­   s+   ø€ Ü“ˆÛˆAØ�M‰MÔ+¨AÓ.Ö/ñ àˆr    rZ   r   )ra   rb   s   ` r   r   r   ¨   s   ø€ ÷
ð !Ð r    )r*   F)r3   r   r+   r.   r4   Úboolr"   r   )r3   Úobjectr"   zTypeGuard[AnyFormattedText])ra   zIterable[AnyFormattedText]r"   r   )Ú
__future__r   Úcollections.abcr   r   Útypingr   r   r   Úprompt_toolkit.mouse_eventsr	   Útyping_extensionsr
   Ú'prompt_toolkit.key_binding.key_bindingsr   Ú__all__Útupler.   r   r/   r   r   r   r   r   r   r   r   r   r   r    r   Ú<module>rn      sò   ðÝ "ç .ß -Ñ -å 2æÝ*åLò
€ð 
ˆ#ˆsˆ(�O�e˜C  h°
¨|Ð=SÐ/SÑ&TÐTÑUÑUð ð Ð.Ñ/Ð ö Ý ôC˜Xô Cð ØØØØˆRÐ#Ð#Ñ$Øð	
ñÐ ð DIð1%Øð1%Ø$'ð1%Ø<@ð1%àõ1%ôhô6Ð&ô 6÷ñ õ>!r    