+
    IV-j”.  ã                   ób   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHtH	t	H
t
Ht R.t ! R R]4      tR# )zÇ
pygments.formatters.rtf
~~~~~~~~~~~~~~~~~~~~~~~

A formatter that generates RTF files.

:copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
)ÚOrderedDict)Ú	Formatter)Ú_ansimap)Úget_bool_optÚget_int_optÚget_list_optÚsurrogatepairÚRtfFormatterc                   ó˜   a € ] tR t^t o RtRtR.tR.tR tR t	R t
]R 4       tR	 tR
 t]R 4       t]R 4       t]R 4       tR tRtV tR# )r	   a°  
Format tokens as RTF markup. This formatter automatically outputs full RTF
documents with color information and other useful stuff. Perfect for Copy and
Paste into Microsoft(R) Word(R) documents.

Please note that ``encoding`` and ``outencoding`` options are ignored.
The RTF format is ASCII natively, but handles unicode characters correctly
thanks to escape sequences.

.. versionadded:: 0.6

Additional options accepted:

`style`
    The style to use, can be a string or a Style subclass (default:
    ``'default'``).

`fontface`
    The used font family, for example ``Bitstream Vera Sans``. Defaults to
    some generic font which is supposed to have fixed width.

`fontsize`
    Size of the font used. Size is specified in half points. The
    default is 24 half-points, giving a size 12 font.

    .. versionadded:: 2.0

`linenos`
    Turn on line numbering (default: ``False``).

    .. versionadded:: 2.18

`lineno_fontsize`
    Font size for line numbers. Size is specified in half points
    (default: `fontsize`). 

    .. versionadded:: 2.18

`lineno_padding`
    Number of spaces between the (inline) line numbers and the
    source code (default: ``2``).

    .. versionadded:: 2.18

`linenostart`
    The line number for the first line (default: ``1``).

    .. versionadded:: 2.18

`linenostep`
    If set to a number n > 1, only every nth line number is printed.

    .. versionadded:: 2.18

`lineno_color`
    Color for line numbers specified as a hex triplet, e.g. ``'5e5e5e'``. 
    Defaults to the style's line number color if it is a hex triplet, 
    otherwise ansi bright black.

    .. versionadded:: 2.18

`hl_lines`
    Specify a list of lines to be highlighted, as line numbers separated by
    spaces, e.g. ``'3 7 8'``. The line numbers are relative to the input 
    (i.e. the first line is line 1) unless `hl_linenostart` is set.

    .. versionadded:: 2.18

`hl_color`
    Color for highlighting the lines specified in `hl_lines`, specified as 
    a hex triplet (default: style's `highlight_color`).

    .. versionadded:: 2.18

`hl_linenostart`
    If set to ``True`` line numbers in `hl_lines` are specified
    relative to `linenostart` (default ``False``).

    .. versionadded:: 2.18
ÚRTFÚrtfz*.rtfc                ó<  € \         P                  ! V 3/ VB  VP                  R4      ;'       g    RV n        \	        VR^ 4      V n        \        VRR4      V n        \	        VRV P
                  4      V n        \	        VR^4      V n	        \        \	        VR^4      4      V n        \        \	        VR	^4      4      V n        \        VR
R4      V n        VP                  RR4      V n        V P                  '       g   V P                  P                   V n        . V n        \%        VR. 4       FU  p \'        V4      pV P                  '       d   W P                  ,
          ^,           pV P"                  P)                  V4       KW  	  VP                  RR4      V n        V P,                  '       gJ   V P                  P.                  R8X  d   \0        R,          V n        MV P                  P.                  V n        V P3                  4       V n        R#   \*         d     Kð  i ; i)aR  
Additional options accepted:

``fontface``
    Name of the font used. Could for example be ``'Courier New'``
    to further specify the default which is ``'\fmodern'``. The RTF
    specification claims that ``\fmodern`` are "Fixed-pitch serif
    and sans serif fonts". Hope every RTF implementation thinks
    the same about modern...

ÚfontfaceÚ ÚfontsizeÚlinenosFÚlineno_fontsizeÚlineno_paddingÚlinenostartÚ
linenostepÚhl_linenostartÚhl_colorÚhl_linesÚlineno_colorÚinheritÚansibrightblackN)r   Ú__init__Úgetr   r   r   r   r   r   r   Úabsr   r   r   r   ÚstyleÚhighlight_colorr   r   ÚintÚappendÚ
ValueErrorr   Úline_number_colorr   Ú_create_color_mappingÚcolor_mapping)ÚselfÚoptionsÚlinenos   &, Úh/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/pygments/formatters/rtf.pyr   ÚRtfFormatter.__init__i   s¸  € ô 	×Ò˜4Ñ+ 7Ò+ØŸ™ JÓ/×5Ð5°2ˆŒÜ# G¨Z¸Ó;ˆŒÜ# G¨Y¸Ó>ˆŒÜ*¨7Ð4EØ+/¯=©=ó :ˆÔä)¨'Ð3CÀQÓGˆÔÜœ{¨7°MÀ1ÓEÓFˆÔÜœk¨'°<ÀÓCÓDˆŒÜ*¨7Ð4DÀeÓLˆÔàŸ™ J°Ó3ˆŒØ�}�}ˆ}Ø ŸJ™J×6Ñ6ˆDŒMàˆŒÜ" 7¨J¸Ö;ˆFðÜ˜V›�Ø×&×&Ð&Ø#×&6Ñ&6Õ6¸Õ:�FØ—‘×$Ñ$ VÖ,ñ <ð $ŸK™K¨¸Ó;ˆÔØ× × Ð Ø—
‘
×,Ñ,°	Ô9ô %-Ð->Õ$?�Õ!ð %)§J¡J×$@Ñ$@�Ô!à!×7Ñ7Ó9ˆÖøô ô Úðús   Ä.AHÈHÈHc                óf   € VP                  R R4      P                  RR4      P                  RR4      # )Ú\z\\Ú{z\{Ú}z\})Úreplace)r'   Útexts   &&r*   Ú_escapeÚRtfFormatter._escape›   s-   € Ø�|‰|˜D &Ó)ß‘G˜C Ó'ß‘G˜C Ó'ð	(ó    c                ó˜  € V'       g   R # V P                  V4      p. pV F‡  p\        V4      pV^€8  d   VP                  \        V4      4       K1  ^€Tu;8:  d   R8  d   M MVP                  RV,          4       K]  RV8:  g   Kf  VP                  R\	        V4      ,          4       K‰  	  R P                  V4      P                  RR4      # )r   z{\u%d}z{\u%d}{\u%d}Ú
z\pari   )r2   Úordr"   Ústrr   Újoinr0   )r'   r1   ÚbufÚcÚcns   &&   r*   Ú_escape_textÚRtfFormatter._escape_text    s¡   € çÙð �|‰|˜DÓ!ˆàˆÛˆAÜ�Q“ˆBØ�TŒ{à—
‘
œ3˜q›6Ö"Ø˜2Ö' ×'à—
‘
˜9 r�>Ö*Ø˜B–ð —
‘
Ð+¬m¸BÓ.?Õ?Ö@ñ ð �w‰w�s‹|×#Ñ# D¨'Ó2Ð2r4   c                ó®   € V ^ ,          R8X  d
   V R,          p R\        V R,          ^4      \        V R,          ^4      \        V R,          ^4      3,          # )é    Ú#:é   NNz\red%d\green%d\blue%d;:r@   é   N:rC   é   N:rD   é   N)r!   )Ú	hex_colors   &r*   Úhex_to_rtf_colorÚRtfFormatter.hex_to_rtf_color¸   sS   € à�Q�<˜3ÔØ! "�ˆIà*Ü˜I c�N¨BÓ/Ü˜I c�N¨BÓ/Ü˜I c�N¨BÓ/ð.õ ð 	r4   c              #  óè   "  € V Fg  w  r#VR8X  d   W#3x € K  RV9   dI   VP                  R4      pVRR  F  pW%R,           3x € K  	  VR,          '       d   W$R,          3x € K`  Kb  W#3x € Ki  	  R# 5i)z£
Split tokens containing newline characters into multiple token
each representing a line of the input file. Needed for numbering
lines of e.g. multiline comments.
r6   Néÿÿÿÿ)Úsplit)r'   ÚtokensourceÚttypeÚvalueÚlinesÚlines   &&    r*   Ú_split_tokens_on_newlinesÚ&RtfFormatter._split_tokens_on_newlinesÃ   sy   é € ó (‰LˆEØ˜Œ}Ø�nÔ$Ø˜”ØŸ™ DÓ)�Ø! # 2›J�DØ  t¥)Ð,Ô,ñ 'à˜—9”9Ø ¨¥)Ð,Ô,ñ ð �nÔ$ó (ùs   ‚A0A2c                ól  € \        4       p^pV P                  '       d   W!V P                  &   V^,          pV P                  '       d   W!V P                  &   V^,          pV P
                   FE  w  r4VR,          VR,          VR,          3 F"  pV'       g   K  WQ9  g   K  W!V&   V^,          pK$  	  KG  	  V# )zN
Create a mapping of style hex colors to index/offset in
the RTF color table.
ÚcolorÚbgcolorÚborder)r   r   r   r   r   r   )r'   r&   ÚoffsetÚ_r   rT   s   &     r*   r%   Ú"RtfFormatter._create_color_mappingÕ   s    € ô
 $›ˆØˆà�<�<ˆ<Ø/5˜$×+Ñ+Ñ,Ø�a�KˆFà�=�=ˆ=Ø+1˜$Ÿ-™-Ñ(Ø�a�KˆFàŸ
œ
‰HˆAØ˜w�¨¨yÕ)9¸5À½?ÓJ�ß‘5˜UÖ7Ø+1 %Ñ(Ø˜a•K’Fó Kñ #ð Ðr4   c                óF  € V P                   V P                  8w  dJ   R P                  V P                   V P                  V P                  ,          RV P
                  ,          4      # RP                  V P                  V P                  ,          RV P
                  ,          4      # )z{{\fs{} \cf{} %s{}}}Ú z{{\cf{} %s{}}})r   r   Úformatr&   r   r   ©r'   s   &r*   Ú_lineno_templateÚRtfFormatter._lineno_templateí   s‡   € à×Ñ 4§=¡=Ô0Ø+×2Ñ2°4×3GÑ3GØ×,Ñ,¨T×->Ñ->Õ?Ø × 3Ñ 3Õ3ó5ð 5ð !×'Ñ'¨×(:Ñ(:¸4×;LÑ;LÕ(MØ˜D×/Ñ/Õ/ó1ð 	1r4   c                óD   € R V P                   V P                  ,           R2# )z{\highlightr[   )r&   r   r]   s   &r*   Ú_hl_open_strÚRtfFormatter._hl_open_str÷   s!   € à˜t×1Ñ1°$·-±-Õ@ÐAÀÐCÐCr4   c                ó,  € . pTP                  R V P                  ;'       d+    RV P                  V P                  4      ,           ;'       g    R,          4       VP                  R4       V P                  P	                  4        F%  w  r#VP                  V P                  V4      4       K'  	  VP                  R4       VP                  R4       V P                  '       d#   VP                  RV P                  ,          4       VP                  R4       V# )z?{\rtf1\ansi\uc0\deff0{\fonttbl{\f0\fmodern\fprq1\fcharset0%s;}}r[   r   z{\colortbl;r/   z\f0\sa0z\fs%dz\dntblnsbdb)r"   r   r2   r&   ÚitemsrG   r   )r'   rO   rT   rX   s   &   r*   Ú_rtf_headerÚRtfFormatter._rtf_headerû   sÞ   € àˆà�‰ð GàŸ™÷ 6ð 6¨#ØŸ,™, t§}¡}Ó5õ+6÷ <ð <Ø9;õ=ô 	>ð 	�‰�^Ô$Ø×*Ñ*×0Ñ0Ö2‰HˆEØ�L‰L˜×.Ñ.¨uÓ5Ö6ñ 3à�‰�SÔð 	�‰�[Ô!Ø�=�=ˆ=Ø�L‰L˜ D§M¡MÕ1Ô2ð
 	�‰�^Ô$àˆr4   c                ó  € V P                    F  pVP                  VR ,           4       K  	  V P                  V4      pV P                  '       dq   ^ p. pV F9  w  rgVP	                  Wg34       VP                  R 4      '       g   K0  V^,          pK;  	  \        \        W@P                  ,           ^,
          4      4      pTp^p	Rp
V EF$  w  rgV
'       d,   W�P                  9   d   VP                  V P                  4       V
'       d©   V P                  '       d—   W�P                  ,
          ^,           V P                  ,          ^ 8X  d5   W�P                  ,           ^,
          p\        V4      P                  X4      pMRP                  X4      pVP                  V P                  V,          4       V P                  P                  V4      '       g!   VP                   '       d   VP                   pKA  V P                  P#                  V4      p. pVR,          '       d1   VP	                  RV P$                  VR,          ,          ,          4       VR,          '       d1   VP	                  RV P$                  VR,          ,          ,          4       VR,          '       d   VP	                  R4       VR	,          '       d   VP	                  R
4       VR,          '       d   VP	                  R4       VR,          '       d1   VP	                  RV P$                  VR,          ,          ,          4       RP'                  V4      pV'       d   VP                  RV R24       VP                  V P)                  V4      4       V'       d   VP                  R4       Rp
VP                  R 4      '       g   EKç  W�P                  9   d   VP                  R4       VP                  R 4       Rp
V	^,          p	EK'  	  VP                  R4       R# )r6   Tr   rU   z\cb%drT   z\cf%dÚboldz\bÚitalicz\iÚ	underlinez\ulrV   z\chbrdr\chcfpat%dr.   r[   r/   Fz}
N)re   ÚwriterQ   r   r"   ÚendswithÚlenr8   r   r   ra   r   Úrjustr^   r   Ústyles_tokenÚparentÚstyle_for_tokenr&   r9   r=   )r'   rL   ÚoutfilerP   Ú
line_countÚtokensrM   rN   Úlinenos_widthr)   Ústart_new_lineÚcurrent_linenoÚ
lineno_strr   r:   Ústarts   &&&             r*   Úformat_unencodedÚRtfFormatter.format_unencoded  sñ  € Ø×$Ô$ˆDØ�M‰M˜$ �+Ö&ñ %ð ×4Ñ4°[ÓAˆð �<�<ˆ<ØˆJØˆFÛ +‘�Ø—‘˜u˜nÔ-Ø—>‘> $×'Ô'Ø !•O’Jñ !,ô  ¤ J×/?Ñ/?Õ$?ÀÕ$AÓ BÓCˆMà ˆKð ˆØˆÜ'‰LˆEß &¯M©MÔ"9Ø—‘˜d×/Ñ/Ô0ç $§,§, ,Ø×+Ñ+Õ+¨AÕ-¨t¯©Õ>À!ÔCØ%+×.>Ñ.>Õ%>ÀÕ%B�NÜ!$ ^Ó!4×!:Ñ!:¸=Ó!I‘Jà!#§¡¨-Ó!8�JØ—‘˜d×3Ñ3°jÕ@ÔAà—j‘j×-Ñ-¨e×4Ò4¸¿¿¸ØŸ™’Ø—J‘J×.Ñ.¨uÓ5ˆEØˆCØ�Y×ÔØ—
‘
˜8 d×&8Ñ&8¸¸yÕ9IÕ&JÕJÔKØ�W�~Œ~Ø—
‘
˜8 d×&8Ñ&8¸¸w½Õ&HÕHÔIØ�V�}Œ}Ø—
‘
˜5Ô!Ø�X�ŒØ—
‘
˜5Ô!Ø�[×!Ô!Ø—
‘
˜6Ô"Ø�X�ŒØ—
‘
Ð0Ø×-Ñ-¨e°H­oÕ>õ?ô @à—G‘G˜C“LˆEßØ—‘  5 '¨˜mÔ,Ø�M‰M˜$×+Ñ+¨EÓ2Ô3ßØ—‘˜cÔ"Ø"ˆNð �~‰~˜d×#Õ#àŸ]™]Ô*Ø—M‘M #Ô&à—‘˜dÔ#à!%�Ø˜!•“ñ] (ð` 	�‰�eÖr4   )r&   r   r   r   r   r   r   r   r   r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚnameÚaliasesÚ	filenamesr   r2   r=   ÚstaticmethodrG   rQ   r%   Úpropertyr^   ra   re   rz   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r*   r	   r	      s™   ø‡ € ñOð` €DØˆg€GØ�	€Iò0:òd(ò
3ð0 ñó ðò%ò$ð0 ñ1ó ð1ð ñDó ðDð ñó ð÷4Gð Gr4   N)r€   Úcollectionsr   Úpygments.formatterr   Úpygments.styler   Úpygments.utilr   r   r   r   Ú__all__r	   © r4   r*   Ú<module>r�      s3   ðñõ $Ý (Ý #ß PÓ Pð Ð
€ôI�9ö Ir4   