+
     hi  c                   s   ^ RI t ^ RIHt ^ RIHtHt ^ RIHt ^ RIH	t	H
t
HtHtHtHtHtHt ^RIHt ^RIHtHtHtHt ^RIHtHt ^R	IHtHt ]]R
3,          t ! R R4      t ] ! R R
4      4       t!]!! 4       t" ! R R4      t#R# )    N)	lru_cache)dumpsloads)randint)AnyDictIterableListOptionalTypeUnioncast)errors)ColorColorParseErrorColorSystem	blend_rgb)Result	rich_repr)DEFAULT_TERMINAL_THEMETerminalThemeStylec                   sN   a  ] tR t^t o RtR.tV 3R lR ltV 3R lR ltRtV t	R# )	_Bitz.A descriptor to get/set a style attribute bit.bitc                $   < V ^8  d   QhRS[ RR/# )   bit_noreturnNintformat__classdict__   ";/usr/lib/python3.14/site-packages/pip/_vendor/rich/style.py__annotate___Bit.__annotate__   s      s t     c                s"    ^V,          V n         R# )i   Nr   )selfr      &&r#   __init__Z_Bit.__init__   s    ;r&   c                sH   < V ^8  d   QhRRRS[ R,          RS[S[,          /# )r   objr   objtyper   )r
   r	   boolr   r"   r#   r$   r%      s*      7 T'] x~ r&   c                s    VP                   V P                  ,          '       d!   VP                  V P                  ,          ^ 8g  # R# )r    N)_set_attributesr   _attributes)r(   r+   r,   s   &&&r#   __get__Z_Bit.__get__   s2    ))??TXX-22r&   r'   N)
__name__
__module____qualname____firstlineno____doc__	__slots__r*   r0   __static_attributes____classdictcell__r!      @r#   r   r      s#     8I  r&   r   c            "       s  a  ] tR t^t o Rt. RtOt^ R^R^R^R^R^R^R^R	^R
^	R^
R^R^R/t/ RRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbR RR!R!R"R"R#R#R$R#/CtR%R&R'R&RR&RR&RR&RR&RR&RR&RR&RR&RR&RR&R!R&R"R&R#R&R(R&R)R&/V 3R* lR+ llt]	V 3R, lR- l4       t
]	RuV 3R. lR/ ll4       t]	V 3R0 lR1 l4       t]	RvV 3R2 lR3 ll4       t]! ^ 4      t]! ^4      t]! ^4      t]! ^4      t]! ^4      t]! ^4      t]! ^4      t]! ^4      t]! ^4      t]! ^	4      t]! ^
4      t]! ^4      t]! ^4      t]V 3R4 lR5 l4       tV 3R6 lR7 ltV 3R8 lR9 ltV 3R: lR; lt ]	]!! R<R=7      V 3R> lR? l4       4       t"]	V 3R@ lRA l4       t#V 3RB lRC lt$V 3RD lRE lt%V 3RF lRG lt&V 3RH lRI lt']V 3RJ lRK l4       t(]V 3RL lRM l4       t)]V 3RN lRO l4       t*]V 3RP lRQ l4       t+]V 3RR lRS l4       t,]V 3RT lRU l4       t-]V 3RV lRW l4       t.]	]!! RXR=7      V 3RY lRZ l4       4       t/]!! R<R=7      RvV 3R[ lR\ ll4       t0]	V 3R] lR^ l4       t1]	V 3R_ lR` l4       t2V 3Ra lRb lt3]!! ^R=7      V 3Rc lRd l4       t4RvV 3Re lRf llt5RwRg]6Pn                  RhRi/V 3Rj lRk lllt8RvV 3Rl lRm llt9]!! R<R=7      V 3Rn lRo l4       t:V 3Rp lRq lt;V 3Rr lt<Rst=V t>R&# )xr   a|  A terminal style.

A terminal style consists of a color (`color`), a background color (`bgcolor`), and a number of attributes, such
as bold, italic etc. The attributes have 3 states: they can either be on
(``True``), off (``False``), or not set (``None``).

Args:
    color (Union[Color, str], optional): Color of terminal text. Defaults to None.
    bgcolor (Union[Color, str], optional): Color of terminal background. Defaults to None.
    bold (bool, optional): Enable bold text. Defaults to None.
    dim (bool, optional): Enable dim text. Defaults to None.
    italic (bool, optional): Enable italic text. Defaults to None.
    underline (bool, optional): Enable underlined text. Defaults to None.
    blink (bool, optional): Enabled blinking text. Defaults to None.
    blink2 (bool, optional): Enable fast blinking text. Defaults to None.
    reverse (bool, optional): Enabled reverse text. Defaults to None.
    conceal (bool, optional): Enable concealed text. Defaults to None.
    strike (bool, optional): Enable strikethrough text. Defaults to None.
    underline2 (bool, optional): Enable doubly underlined text. Defaults to None.
    frame (bool, optional): Enable framed text. Defaults to None.
    encircle (bool, optional): Enable encircled text. Defaults to None.
    overline (bool, optional): Enable overlined text. Defaults to None.
    link (str, link): Link URL. Defaults to None.

Z1Z2Z3Z4Z5Z6Z7Z8Z9Z21Z51Z52Z53dimZdboldZbitalicZi	underlineZublinkblink2reverseZrconcealZcstrikeZs
underline2ZuuframeencircleoverlineZocolorNbgcolorlinkmetac          %      s  < V ^8  d   QhRS[ S[S[S[3,          ,          RS[ S[S[S[3,          ,          RS[ S[,          RS[ S[,          RS[ S[,          RS[ S[,          RS[ S[,          RS[ S[,          R	S[ S[,          R
S[ S[,          RS[ S[,          RS[ S[,          RS[ S[,          RS[ S[,          RS[ S[,          RS[ S[,          RS[ S[S[S[3,          ,          /# )r   rH   rI   r<   r;   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rJ   rK   )r	   r   r   strr-   r   r   r   r"   r#   r$   Style.__annotate__z   s>    JT JT eSj)*JT %s
+,	JT
 tnJT d^JT JT D>JT ~JT JT $JT $JT JT TNJT ~JT  4.!JT" 4.#JT$ sm%JT& tCH~&'JTr&   c               s|   R V n         R V n        R R lpVf   R MV! V4      V n        Vf   R MV! V4      V n        \	        VR JVR J;'       d    ^VR J;'       d    ^VR J;'       d    ^VR J;'       d    ^VR J;'       d    ^ V	R J;'       d    ^@V
R J;'       d    ^VR J;'       d    RVR J;'       d    RVR J;'       d    RVR J;'       d    RVR J;'       d    R34      V n        V P
                  '       Ed   \	        T;'       d    ^;'       g    ^ T;'       d    ^;'       g    ^ T;'       d    ^;'       g    ^ T;'       d    ^;'       g    ^ T;'       d    ^;'       g    ^ T;'       d    ^ ;'       g    ^ T	;'       d    ^@;'       g    ^ T
;'       d    ^;'       g    ^ T;'       d    R;'       g    ^ T;'       d    R;'       g    ^ T;'       d    R;'       g    ^ T;'       d    R;'       g    ^ T;'       d    R;'       g    ^ 34      M^ V n        VV n        Vf   R M
\        V4      V n	        V'       g	   V'       d$   \        ^ R4       \        V P                  4       2MR	V n        R V n        V P
                  ;'       g!    T;'       g    T;'       g    T;'       g    T'       * V n        R # )
Nc                sR    V ^8  d   QhR\         \        \        3,          R\        /# )r   rH   r   )r   r   rL   )r    s   "r#   r$   Z$Style.__init__.<locals>.__annotate__   s'     	M 	MuUCZ0 	MU 	Mr&   c                 s^    \        V \        4      '       d   V # \        P                  ! V 4      # N)
isinstancer   parse)rH      &r#   _make_colorZ#Style.__init__.<locals>._make_color   s"    &ue445L%++e:LLr&                  ?B  )_ansi_style_definition_color_bgcolorsumr.   r/   _linkr   _metar   hash_link_id_hash_null)r(   rH   rI   r<   r;   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rJ   rK   rR   s   &$$$$$$$$$$$$$$$$$ r#   r*   ZStyle.__init__z   s   * %)
04	M $mdU1C '[5I"D 4%%Ad"((q%++!T!((bd"))rt#**t#++d"**s$&..3T!**d$--$-- 
F #### JJQOO!IIANNLLq%%AOO!((qLLb%%AMMr&&QNN''aOO((qNNs''a&&3++!NNd''a%%**%%**$ ' 	, 
!\TuT{
:>$wq&!"4

#3"45R 	 %)
..RR%RR7RRdRRdS
r&   c                   < V ^8  d   QhRR/# r   r   r    r   r"   r#   r$   rM      s      W r&   c                s    \         # )zCCreate an 'null' style, equivalent to Style(), but more performant.)
NULL_STYLE)clsrQ   r#   nullZ
Style.null   s
     r&   c                sJ   < V ^8  d   QhRS[ S[,          RS[ S[,          RR/# )r   rH   rI   r   r   r	   r   r   r"   r#   r$   rM      s-      UO5=e_	r&   c                s    V P                  \        4      pRVn        RVn        Wn        W#n        ^ Vn        ^ Vn        RVn        RVn	        RVn
        T;'       g    T'       * Vn        RVn        V# )zCreate a new style with colors and no attributes.

Returns:
    color (Optional[Color]): A (foreground) color, or None for no color. Defaults to None.
    bgcolor (Optional[Color]): A (background) color, or None for no color. Defaults to None.
NrY   )__new__r   rZ   r[   r\   r]   r.   r/   r_   rb   r`   rd   rc   )ri   rH   rI   styles   &&& r#   
from_colorZStyle.from_color   sn     {{5)"&  ! ++G,r&   c                sJ   < V ^8  d   QhRS[ S[S[S[3,          ,          RR/# )r   rK   r   r   r	   r   rL   r   r   r"   r#   r$   rM      s(      Xd38n5 ' r&   c                s(   V P                  \        4      pRVn        RVn        RVn        RVn        ^ Vn        ^ Vn        RVn        \        V4      Vn
        \        ^ R4       \        VP                  4       2Vn        RVn        V'       * Vn        V# )zCreate a new style with meta data.

Returns:
    meta (Optional[Dict[str, Any]]): A dictionary of meta data. Defaults to None.
NrX   )rl   r   rZ   r[   r\   r]   r.   r/   r_   r   r`   r   ra   rb   rc   rd   )ri   rK   rm      && r#   	from_metaZStyle.from_meta   s     {{5)"& !Dk#Av./U[[0A/BCjr&   c                sP   < V ^8  d   QhRS[ S[S[S[3,          ,          RS[RR/# )r   rK   handlersr   r   ro   r   r"   r#   r$   rM      s/     # #htCH~. #3 #7 #r&   c                s    Vf   / MTpTP                  VP                  4        UUu/ uF  w  r4RV 2VbK  	  upp4       V P                  V4      # u uppi )a@  Create a blank style with meta information.

Example:
    style = Style.on(click=self.on_click)

Args:
    meta (Optional[Dict[str, Any]], optional): An optional dict of meta information.
    **handlers (Any): Keyword arguments are translated in to handlers.

Returns:
    Style: A Style with meta information attached.
Z@)ZupdateZitemsrq   )ri   rK   rr   Zkeyvalues   &&,  r#   onZStyle.on   sU     \rt8HI8H*#qY%8HIJ}}T"" Js   A
c                    < V ^8  d   QhRS[ /# r   r   rL   r   r"   r#   r$   rM     s       r&   c                    V P                   # )z+Get a link id, used in ansi code for links.)rb   r(   rQ   r#   link_idZStyle.link_id       }}r&   c                ru   rv   rw   r   r"   r#   r$   rM     s     ,& ,& ,&r&   c                st   V P                   Ef   . pVP                  pV P                  pV^,          '       d   V^,          '       d   T! V P                  '       d   RMR4       V^,          '       d   T! V P                  '       d   RMR4       V^,          '       d   T! V P
                  '       d   RMR4       V^,          '       d   T! V P                  '       d   RMR4       VR	,          '       d   V^,          '       d   T! V P                  '       d   R
MR4       V^ ,          '       d   T! V P                  '       d   RMR4       V^@,          '       d   T! V P                  '       d   RMR4       V^,          '       d   T! V P                  '       d   RMR4       VR!,          '       d   T! V P                  '       d   RMR4       VR,          '       d   VR",          '       d   T! V P                  '       d   RMR4       VR#,          '       d   T! V P                  '       d   RMR4       VR$,          '       d   T! V P                  '       d   RMR4       VR%,          '       d   T! V P                  '       d   RMR4       V P                   e   V! V P                   P"                  4       V P$                  e%   V! R4       V! V P$                  P"                  4       V P&                  '       d   V! R4       V! V P&                  4       RP)                  V4      ;'       g    R V n         V P                   # )&z-Re-generate style definition from attributes.r<   znot boldr;   znot dimr=   z
not italicr>   znot underline  r?   z	not blinkr@   z
not blink2rA   znot reverserB   znot concealrC   z
not strike   rD   znot underline2rE   z	not framerF   znot encirclerG   znot overlinert   rJ   Z nonerS   rT   rU   rV   rW   )r[   appendr.   r<   r;   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   r\   Znamer]   r_   join)r(   
attributesr   Zbitss   &   r#   __str__ZStyle.__str__  s0   !!)$&J&&F''Do%%!88TYYY6J?6??DHHH5)<6??t{{{8E6??$...;oNo%%6??djjj7kB6??t{{{8E6??9-H6??9-H6??t{{{8Eo%%6??4???<@PQ7##djjj7kB7##:NK7##:NK{{&t{{''(}}(tt}}))*zzzvtzz"%(XXj%9%C%CVD"%%%r&   c                ru   rv   r-   r   r"   r#   r$   rM   K  s      $ r&   c                s$    V P                   '       * # )z;A Style is false if it has no attributes, colors, or links.)rd   ry   rQ   r#   __bool__ZStyle.__bool__K  s    ::~r&   c                &   < V ^8  d   QhRS[ RS[/# )r   color_systemr   )r   rL   r   r"   r#   r$   rM   O  s     ) )[ )S )r&   c                s   V P                   Ef   . pVP                  pV P                  pV P                  V P                  ,          pV'       Ed	   V^,          '       d   V! V^ ,          4       V^,          '       d   V! V^,          4       V^,          '       d   V! V^,          4       V^,          '       d   V! V^,          4       VR,          '       d:   \        ^^	4       F)  pV^V,          ,          '       g   K  V! WF,          4       K+  	  VR,          '       d:   \        ^	^4       F)  pV^V,          ,          '       g   K  V! WF,          4       K+  	  V P                  e9   VP                  V P                  P                  V4      P                  4       4       V P                  e;   VP                  V P                  P                  V4      P                  RR7      4       RP                  V4      V n         V P                   # )zGenerate ANSI codes for this style.

Args:
    color_system (ColorSystem): Color system.

Returns:
    str: String containing codes.
r|   r}   FZ
foreground;)rZ   r   
_style_mapr/   r.   Zranger\   ZextendZ	downgradeZget_ansi_codesr]   r   )r(   r   Zsgrr   r   r   r   s   &&     r#   _make_ansi_codesZStyle._make_ansi_codesO  s    ::CZZFJ))D,@,@@Jz>>:a=)>>:a=)>>:a=)>>:a=)//$Q{%c22":?3  + //$Q|%c22":?3  , {{&

4;;00>MMOP}}(

MM++L9HH#( I 
 #DJzzr&   rU   )Zmaxsizec                s&   < V ^8  d   QhRS[ RS[ /# )r   rm   r   rw   r   r"   r#   r$   rM   |  s     ) )c )c )r&   c                s     \        V P                  V4      4      #   \        P                   d"    TP	                  4       P                  4       u # i ; i)zNormalize a style definition so that styles with the same effect have the same string
representation.

Args:
    style (str): A style definition.

Returns:
    str: Normal form of style definition.
)rL   rP   r   StyleSyntaxErrorstriplower)ri   rm   r)   r#   	normalizeZStyle.normalizez  sE    	)syy'((&& 	);;=&&((	)s    3AAc                s6   < V ^8  d   QhRS[ S[,          RS[/# )r   valuesr   )r	   	StyleTyper   r"   r#   r$   rM     s$     A A)!4 A Ar&   c                s:    V F  pVf   K	  Vu # 	  \        R4      h)zPick first non-None style.z$expected at least one non-None style)Z
ValueError)ri   r   rs      &* r#   
pick_firstZStyle.pick_first  s'     E   ?@@r&   c                ru   rv   )r   r   r"   r#   r$   rM     s     $ $v $r&   c              #  sT  "   R V P                   R3x  RV P                  R3x  RV P                  R3x  RV P                  R3x  RV P                  R3x  RV P
                  R3x  RV P                  R3x  RV P                  R3x  R	V P                  R3x  R
V P                  R3x  RV P                  R3x  RV P                  R3x  RV P                  R3x  RV P                  R3x  RV P                  R3x  V P                  '       d   RV P                   3x  R# R# 5i)rH   NrI   r<   r;   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rJ   rK   )rH   rI   r<   r;   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rJ   r`   rK   ry   rQ   r#   __rich_repr__ZStyle.__rich_repr__  s!    tzz4''t++dii&&TXXt$$T))4>>400tzz4''T))t++t++T))DOOT11tzz4''$----dii%%:::$))## s   D&D(c                r   r   otherr   r   r-   r   r"   r#   r$   rM          3 3C 3D 3r&   c                s|    \        V\        4      '       g   \        # V P                  4       VP                  4       8H  # rN   rO   r   ZNotImplemented__hash__r(   r   r)   r#   __eq__ZStyle.__eq__  -    %''!!}}%.."222r&   c                r   r   r   r   r"   r#   r$   rM     r   r&   c                s|    \        V\        4      '       g   \        # V P                  4       VP                  4       8g  # rN   r   r   r)   r#   __ne__ZStyle.__ne__  r   r&   c                ru   rv   r   r   r"   r#   r$   rM     s      # r&   c                s    V P                   e   V P                   # \        V P                  V P                  V P                  V P
                  V P                  V P                  34      V n         V P                   # rN   )rc   ra   r\   r]   r/   r.   r_   r`   ry   rQ   r#   r   ZStyle.__hash__  sa    ::!::  $$



	

 zzr&   c                0   < V ^8  d   QhRS[ S[,          /# rv   rk   r   r"   r#   r$   rM     s      x r&   c                rx   )z.The foreground color or None if it is not set.)r\   ry   rQ   r#   rH   ZStyle.color  s     {{r&   c                r   rv   rk   r   r"   r#   r$   rM     s      % r&   c                rx   )z.The background color or None if it is not set.)r]   ry   rQ   r#   rI   ZStyle.bgcolor  r{   r&   c                r   rv   r	   rL   r   r"   r#   r$   rM     s      hsm r&   c                rx   )zLink text, if set.)r_   ry   rQ   r#   rJ   Z
Style.link  s     zzr&   c                ru   rv   r   r   r"   r#   r$   rM     s     ? ? ?r&   c                sZ    V P                   RJ ;'       g    V P                   P                  # )z6Check if the style specified a transparent background.N)rI   Z
is_defaultry   rQ   r#   transparent_backgroundZStyle.transparent_background  s%     ||t#>>t||'>'>>r&   c                re   rf   rg   r   r"   r#   r$   rM     s     + +' +r&   c                s.    \        V P                  R7      # )zA Style with background only.)rI   )r   rI   ry   rQ   r#   background_styleZStyle.background_style  s     T\\**r&   c                s6   < V ^8  d   QhRS[ S[S[3,          /# rv   )r   rL   r   r   r"   r#   r$   rM     s     U Ud38n Ur&   c                s    V P                   f   / # \        \        \        \        3,          \        V P                   4      4      # )z=Get meta information (can not be changed after construction).)r`   r   r   rL   r   r   ry   rQ   r#   rK   Z
Style.meta  s0     ZZ'rTT$sCx.%

BS-TTr&   c                re   rf   rg   r   r"   r#   r$   rM     s      w r&   c                st   V P                   '       d   \        # V P                  \        4      pRVn        RVn        RVn        RVn        V P                  Vn        V P                  Vn	        V P                  Vn
        V P                  '       d   \        ^ R4       MRVn        RVn         RVn        RVn        V# )z+Get a copy of the style with color removed.NrX   rY   F)rd   rh   rl   r   rZ   r[   r\   r]   r/   r.   r_   r   rb   r`   rc   r(   rm      & r#   without_colorZStyle.without_color  s     :::||E*"& ,, $ 4 4jj48JJJGAv./Br&   rW   c                r   )r   style_definitionr   r   rw   r   r"   r#   r$   rM     s     ? ?S ?W ?r&   c           	     s   VP                  4       R8X  g	   V'       g   V P                  4       # V P                  pRpRp/ pRp\        VP	                  4       4      pV EF	  pVP                  4       p	V	R8X  dF   \        VR4      p	V	'       g   \        P                  ! R4      h \        P                  ! V	4       T	pK`  V	R8X  dB   \        VR4      p	VP                  V	4      pVf   \        P                  ! R	V	: 24      hR
W[&   K  V	R8X  d/   \        VR4      p	V	'       g   \        P                  ! R4      hT	pK  W9   d   RWRV	,          &   K   \        P                  ! V	4       T	pEK  	  \        RRVRVRV/VB pV#   \         d$   p
\        P                  ! RT	: RT
 24      RhRp
?
ii ; i  \         d$   p
\        P                  ! RT	: RT
 24      RhRp
?
ii ; i)zParse a style definition.

Args:
    style_definition (str): A string containing a style.

Raises:
    errors.StyleSyntaxError: If the style definition syntax is invalid.

Returns:
    `Style`: A Style instance.
r~   Nrt   rY   zcolor expected after 'on'zunable to parse z as background color; Znotz,expected style attribute after 'not', found FrJ   zURL expected after 'link'Tz as color; rH   rI   rg   )r   rj   STYLE_ATTRIBUTESiterZsplitr   nextr   r   r   rP   r   Zgetr   )ri   r   r   rH   rI   r   rJ   ZwordsZoriginal_wordZwordZerrorZ	attributerm   s   &&           r#   rP   ZStyle.parse  s    !!#v-5E88://#!%/1
"%++-."M &&(Dt|E2 112MNN KK%
 E2,006	$ 11FthO  ).
%E2 112MNN)59
D12 KK%
 O #P LEL7LLLC '   11*4(2HP  6 '   11*4(+eWE  s0   #E>F/>F,	F''F,/G:GGc                s6   < V ^8  d   QhRS[ S[,          RS[/# )r   themer   )r	   r   rL   r   r"   r#   r$   rM   4  s      " "H]$; "s "r&   c                sL   T;'       g    \         p. pVP                  pV P                  pV P                  pV P                  '       d   YTrTV P
                  '       dL   Vf   VP                  MVP                  V4      p\        P                  ! \        WaP                  R4      4      pVe<   VP                  V4      pV! RVP                   24       V! RVP                   24       Ve)   VP                  VRR7      pV! RVP                   24       V P                  '       d	   V! R4       V P                  '       d	   V! R4       V P                  '       d	   V! R	4       V P                   '       d	   V! R
4       V P"                  '       d	   V! R4       RP%                  V4      # )zGet a CSS style rule.g      ?zcolor: ztext-decoration-color: Fr   zbackground-color: zfont-weight: boldzfont-style: italicztext-decoration: underlineztext-decoration: line-throughztext-decoration: overlinez; )r   r   rH   rI   rA   r;   foreground_colorZget_truecolorr   Zfrom_tripletr   Zbackground_colorZhexr<   r=   r>   rC   rG   r   )r(   r   Zcssr   rH   rI   r   Ztheme_colors   &&      r#   get_html_styleZStyle.get_html_style3  se    ///

,,<<<$7888*/-&&U=P=PQV=W  &&*,B,BCHE --e4KW[__-./,[__,=>?!//%/HK''89:999&';;;'(>>>/0;;;23===./yy~r&   c                2   < V ^8  d   QhRS[ R,          RR/# r   stylesr   r   )r   r   r"   r#   r$   rM   Y  s      
3 
3Xg. 
37 
3r&   c                B    \        V4      p\        V\        V4      4      # )zCombine styles and get result.

Args:
    styles (Iterable[Style]): Styles to combine.

Returns:
    Style: A new style instance.
r   r^   r   ri   r   Ziter_stylesrp   r#   combineZStyle.combineX       6l;[ 122r&   c                s"   < V ^8  d   QhRRRR/# r   rg   r   r"   r#   r$   rM   f  s     
3 
3G 
3 
3r&   c                r   )zCombine styles from positional argument in to a single style.

Args:
    *styles (Iterable[Style]): Styles to combine.

Returns:
    Style: A new style instance.
r   r   r   r#   chainZStyle.chaine  r   r&   c                re   rf   rg   r   r"   r#   r$   rM   r  s      g r&   c                s   V P                   '       d   \        # V P                  \        4      pV P                  Vn        V P
                  Vn        V P                  Vn        V P                  Vn        V P                  Vn        V P                  Vn	        V P                  Vn
        V P                  '       d   \        ^ R4       MRVn        V P                  Vn        RVn         V P                  Vn        V# )z_Get a copy of this style.

Returns:
    Style: A new Style instance with identical attributes.
rX   rY   F)rd   rh   rl   r   rZ   r[   r\   r]   r/   r.   r_   r   rb   rc   r`   r   r   r#   copyZ
Style.copyr  s     :::||E*jj"&"8"8{{ ,, $ 4 4jj48JJJGAv./Bjjjjr&   c                re   rf   rg   r   r"   r#   r$   rM     s      g r&   c                sr   V P                   '       d   \        # V P                  \        4      pV P                  Vn        V P
                  Vn        V P                  Vn        V P                  Vn        V P                  Vn        V P                  Vn	        RVn
        RVn        RVn        RVn         RVn        V# )zhGet a copy of this style with link and meta information removed.

Returns:
    Style: New style object.
NrY   F)rd   rh   rl   r   rZ   r[   r\   r]   r/   r.   r_   rb   rc   r`   r   r   r#   clear_meta_and_linksZStyle.clear_meta_and_links  s     :::||E*jj"&"8"8{{ ,, $ 4 4r&   c                4   < V ^8  d   QhRS[ S[,          RR/# )r   rJ   r   r   r   r   r"   r#   r$   rM     s        r&   c                s~   V P                  \        4      pV P                  Vn        V P                  Vn        V P                  Vn        V P
                  Vn        V P                  Vn        V P                  Vn        Wn        V'       d   \        ^ R4       MRVn
        RVn        RVn        V P                  Vn        V# )zGet a copy with a different value for link.

Args:
    link (str, optional): New value for link. Defaults to None.

Returns:
    Style: A new Style instance.
rX   rY   NF)rl   r   rZ   r[   r\   r]   r/   r.   r_   r   rb   rc   rd   r`   )r(   rJ   rm   rp   r#   update_linkZStyle.update_link  s     ||E*jj"&"8"8{{ ,, $ 4 448GAv./bjjr&   r   legacy_windowsFc                sB   < V ^8  d   QhRS[ RS[S[,          RS[RS[ /# )r   textr   r   r   )rL   r	   r   r-   r   r"   r#   r$   rM     s8       {+	
  
r&   c               s   V'       d   Vf   V# V P                   ;'       g    V P                  V4      pV'       d
   RV RV R2MTpV P                  '       d)   V'       g!   RV P                   RV P                   RV R2pV# )a  Render the ANSI codes for the style.

Args:
    text (str, optional): A string to style. Defaults to "".
    color_system (Optional[ColorSystem], optional): Color system to render to. Defaults to ColorSystem.TRUECOLOR.

Returns:
    str: A string containing ANSI style codes.
z[Zmz[0mz]8;id=r   z\z]8;;\)rZ   r   r_   rb   )r(   r   r   r   ZattrsZrendereds   &&$$  r#   renderZStyle.render  s|      |+K

AAd33LA49U5'4&0t:::nT]]O1TZZLxjW  r&   c                r   )r   r   r   Nr   r   r"   r#   r$   rM     s     
3 
3# 
3$ 
3r&   c                s    T;'       g    \        V 4      p\        P                  P                  V P	                  V4       R24       R# )zWrite text with style directly to terminal.

This method is for testing purposes only.

Args:
    text (Optional[str], optional): Text to style or None for style name.

Z
N)rL   sysZstdoutZwriter   )r(   r   r)   r#   testZ
Style.test  s8       s4y

DKK-.b12r&   c                r   r   rm   r   r   r	   r   r"   r#   r$   rM     s       (7+  r&   c                s   Ve   VP                   '       d   V # V P                   '       d   V# V P                  \        4      pR Vn        R Vn        VP
                  ;'       g    V P
                  Vn        VP                  ;'       g    V P                  Vn        V P                  VP                  ( ,          VP                  VP                  ,          ,          Vn        V P                  VP                  ,          Vn        VP                  ;'       g    V P                  Vn	        VP                  ;'       g    V P                  Vn
        VP                   Vn         V P                  '       d<   VP                  '       d*   \        / V P                  CVP                  C4      Vn        M%V P                  ;'       g    VP                  Vn        R Vn        V# rN   )rd   rl   r   rZ   r[   r\   r]   r/   r.   r_   rb   r`   r   rK   rc   )r(   rm   Z	new_stylerp   r#   _addZ
Style._add  sM   =EKKKK:::L<<.		&*	# <<664;;	"^^<<t}}	!%!1!1U5J5J4J!J 5 55!
	 %)$8$85;P;P$P	!++33	"^^<<t}}	++	:::%+++#$?tyy$?EJJ$?@IO"jj77EKKIO	r&   c                r   r   r   r   r"   r#   r$   rM     s$     P PXg. P7 Pr&   c                sl    V P                  V4      pVP                  '       d   VP                  4       # T# rN   )r   rJ   r   )r(   rm   Zcombined_stylerp   r#   __add__ZStyle.__add__  s/    5)(6(;(;(;~""$OOr&   c                s   < V ^8  d   Qh/ S[ S[,          ;R&   S[ S[,          ;R&   S[;R&   S[;R&   S[ S[,          ;R&   S[;R&   S[ S[,          ;R&   # )r   r\   r]   r/   r.   rc   rd   r`   )r	   r   r   r-   Zbytesr   r"   r#   r$   rM      su     8 UO9 : uo; < = > ? @ C=A B KC D E?E r&   )rZ   r/   r]   r\   rc   r_   rb   r`   rd   r.   r[   )r\   r]   r/   r.   r_   rb   rZ   r[   rc   rd   r`   )NNrN   )rY   )?r1   r2   r3   r4   r5   r6   r   r   r*   Zclassmethodrj   rn   rq   rt   r   r<   r;   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   propertyrz   r   r   r   r   r   r   r   r   r   r   rH   rI   rJ   r   r   rK   r   rP   r   r   r   r   r   r   r   Z	TRUECOLORr   r   r   r   Z__annotate_func__r7   r8   r9   r:   r#   r   r      s    DI  	
3	3	3	3	3	3	3	3	3	4
D
D
DJ uU 	 	V	
 	( 	X 	[ 	[ 	 	( 	9 	Y 	9 	Y 	(  	X!" 	l#$ 	lJJZ-2JT .2JT 04	JT
  $JT #JT "&JT %)JT !%JT "&JT #'JT #'JT "&JT &*JT !%JT  $(!JT" $(#JT$ #%JT& *.'JT JTX     .  ( # # #" 7D
q'C!WFQIGE!WF1gG1gG!WFaJHEBxHBxH ,& ,&\ ) )V t)  ) A A$ $&3 3
3 3
        ? ? + + U U  $ t?  ?B t" " "H 
3 
3 
3 
3 , s , . /:.C.C	
  % 4
3 
3 t 0P Po  r&   c                   s   a  ] tR tRt o RtR.tV 3R lR ltV 3R lR lt]V 3R lR	 l4       t	V 3R
 lR lt
V 3R lR ltRtV tR# )
StyleStacki  zA stack of styles._stackc                s"   < V ^8  d   QhRRRR/# )r   default_styler   r   Nrg   r   r"   r#   r$   StyleStack.__annotate__  s     3 3g 3$ 3r&   c                s    V.V n         R # rN   r   )r(   r   r)   r#   r*   ZStyleStack.__init__  s    $1?r&   c                ru   rv   rw   r   r"   r#   r$   r     s     / /# /r&   c                s$    R V P                   : R2# )z<stylestack Z>r   ry   rQ   r#   __repr__ZStyleStack.__repr__  s    dkk_A..r&   c                ru   rv   r   r   r"   r#   r$   r   	  s       r&   c                s(    V P                   R,          # )z&Get the Style at the top of the stack.r   ry   rQ   r#   currentZStyleStack.current  s     {{2r&   c                r   )r   rm   r   Nr   r   r"   r#   r$   r     s     4 4% 4D 4r&   c                sl    V P                   P                  V P                   R,          V,           4       R# )zePush a new style on to the stack.

Args:
    style (Style): New style to combine with current style.
Nr   )r   r   r   r)   r#   pushZStyleStack.push  s#     	4;;r?U23r&   c                ru   rv   r   r   r"   r#   r$   r     s      U r&   c                s\    V P                   P                  4        V P                   R,          # )zePop last style and discard.

Returns:
    Style: New current style (also available as stack.current)
r   )r   popry   rQ   r#   r   ZStyleStack.pop  s      	{{2r&   r   N)r1   r2   r3   r4   r5   r6   r*   r   r   r   r   r   r7   r8   r9   r:   r#   r   r     sK     
I3 3/ /  4 4 r&   r   )$r   Z	functoolsr   Zmarshalr   r   Zrandomr   Ztypingr   r   r   r   r	   r
   r   r   rY   r   rH   r   r   r   r   Zreprr   r   Zterminal_themer   r   rL   r   r   r   rh   r   rg   r&   r#   <module>r      sv    
     I I I  A A # A #w,	  XP XP XPv W
 r&   