+
    ini                     2   ^ RI t ^ RIH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RRRRR4      t ]]!R3,          t" ! R R4      t#] ! R R4      4       t$]$! 4       t% ! R R4      t&R# )    N)	lru_cache)
attrgetter)dumpsloads)randint)AnyDictIterableListOptionalTypeUnioncast)errors)ColorColorParseErrorColorSystem	blend_rgb)Result	rich_repr)DEFAULT_TERMINAL_THEMETerminalTheme_color_bgcolor_attributes_set_attributes_link_metaStylec                   N   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__s   "]/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/pip/_vendor/rich/style.py__annotate___Bit.__annotate__   s      s t     c                "    ^V,          V n         R# )   Nr"   )selfr%   s   &&r+   __init___Bit.__init__   s    ;r.   c                H   < V ^8  d   QhRRRS[ R,          RS[S[,          /# )r$   objr   objtyper&   )r   r   bool)r)   r*   s   "r+   r,   r-      s*      7 T'] x~ r.   c                    VP                   V P                  ,          '       d!   VP                  V P                  ,          ^ 8g  # R# )r   N)r   r"   r   )r2   r6   r7   s   &&&r+   __get___Bit.__get__   s2    ))??TXX-22r.   r1   N)
__name__
__module____qualname____firstlineno____doc__	__slots__r3   r:   __static_attributes____classdictcell__r*   s   @r+   r!   r!      s#     8I  r.   r!   c            "         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.

12345678921515253dimdboldbitalici	underlineublinkblink2reverserconcealcstrikes
underline2uuframeencircleoverlineocolorNbgcolorlinkmetac          %        < 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$   ri   rj   rU   rS   rW   rY   r[   r\   r]   r_   ra   rc   re   rf   rg   rk   rl   )r   r   r   strr8   r	   r   )r)   r*   s   "r+   r,   Style.__annotate__   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               |   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                R    V ^8  d   QhR\         \        \        3,          R\        /# )r$   ri   r&   )r   r   rn   )r)   s   "r+   r,   $Style.__init__.<locals>.__annotate__   s'     	M 	MuUCZ0 	MU 	Mr.   c                 ^    \        V \        4      '       d   V # \        P                  ! V 4      # N)
isinstancer   parse)ri   s   &r+   _make_color#Style.__init__.<locals>._make_color   s"    &ue445L%++e:LLr.                  ?B  )_ansi_style_definitionr   r   sumr   r   r   r   r   r   hash_link_id_hash_null)r2   ri   rj   rU   rS   rW   rY   r[   r\   r]   r_   ra   rc   re   rf   rg   rk   rl   rw   s   &$$$$$$$$$$$$$$$$$ r+   r3   Style.__init__   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*   s   "r+   r,   ro      s      W r.   c                    \         # )zCCreate an 'null' style, equivalent to Style(), but more performant.)
NULL_STYLE)clss   &r+   null
Style.null   s
     r.   c                J   < V ^8  d   QhRS[ S[,          RS[ S[,          RR/# )r$   ri   rj   r&   r   r   r   )r)   r*   s   "r+   r,   ro      s-      UO5=e_	r.   c                    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.
Nr   )__new__r   r   r   r   r   r   r   r   r   r   r   r   )r   ri   rj   styles   &&& r+   
from_colorStyle.from_color   sn     {{5)"&  ! ++G,r.   c                J   < V ^8  d   QhRS[ S[S[S[3,          ,          RR/# )r$   rl   r&   r   r   r	   rn   r   )r)   r*   s   "r+   r,   ro      s(      Xd38n5 ' r.   c                (   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.
Nr~   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   rl   r   s   && r+   	from_metaStyle.from_meta   s     {{5)"& !Dk#Av./U[[0A/BCjr.   c                P   < V ^8  d   QhRS[ S[S[S[3,          ,          RS[RR/# )r$   rl   handlersr&   r   r   )r)   r*   s   "r+   r,   ro      s/     # #htCH~. #3 #7 #r.   c                    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.
@)updateitemsr   )r   rl   r   keyvalues   &&,  r+   on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&   rn   )r)   r*   s   "r+   r,   ro     s       r.   c                    V P                   # )z+Get a link id, used in ansi code for links.)r   r2   s   &r+   link_idStyle.link_id       }}r.   c                    < V ^8  d   QhRS[ /# r   r   )r)   r*   s   "r+   r,   ro   "  s     ,& ,& ,&r.   c                t   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.rU   znot boldrS   znot dimrW   z
not italicrY   znot underline  r[   z	not blinkr\   z
not blink2r]   znot reverser_   znot concealra   z
not strike   rc   znot underline2re   z	not framerf   znot encirclerg   znot overliner   rk    nonery   rz   r{   r|   r}   )r   appendr   rU   rS   rW   rY   r[   r\   r]   r_   ra   rc   re   rf   rg   r   namer   r   join)r2   
attributesr   bitss   &   r+   __str__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                    < V ^8  d   QhRS[ /# r   r8   )r)   r*   s   "r+   r,   ro   P  s      $ r.   c                $    V P                   '       * # )z;A Style is false if it has no attributes, colors, or links.)r   r   s   &r+   __bool__Style.__bool__P  s    ::~r.   c                &   < V ^8  d   QhRS[ RS[/# )r$   color_systemr&   )r   rn   )r)   r*   s   "r+   r,   ro   T  s     ) )[ )S )r.   c                   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
foreground;)r   r   
_style_mapr   r   ranger   extend	downgradeget_ansi_codesr   r   )r2   r   sgrr   r   r   r"   s   &&     r+   _make_ansi_codesStyle._make_ansi_codesT  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.   r{   )maxsizec                &   < V ^8  d   QhRS[ RS[ /# )r$   r   r&   r   )r)   r*   s   "r+   r,   ro     s     ) )c )c )r.   c                     \        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.
)rn   rv   r   StyleSyntaxErrorstriplower)r   r   s   &&r+   	normalizeStyle.normalize  sE    	)syy'((&& 	);;=&&((	)s    3AAc                6   < V ^8  d   QhRS[ S[,          RS[/# )r$   valuesr&   )r   	StyleType)r)   r*   s   "r+   r,   ro     s$     A A)!4 A Ar.   c                :    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)
ValueError)r   r   r   s   &* r+   
pick_firstStyle.pick_first  s'     E   ?@@r.   c                    < V ^8  d   QhRS[ /# r   )r   )r)   r*   s   "r+   r,   ro     s     $ $v $r.   c              #  T  "   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)ri   Nrj   rU   rS   rW   rY   r[   r\   r]   r_   ra   rc   re   rf   rk   rl   )ri   rj   rU   rS   rW   rY   r[   r\   r]   r_   ra   rc   re   rf   rk   r   rl   r   s   &r+   __rich_repr__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                &   < V ^8  d   QhRS[ RS[/# r$   otherr&   r   r8   )r)   r*   s   "r+   r,   ro          3 3C 3D 3r.   c                |    \        V\        4      '       g   \        # V P                  4       VP                  4       8H  # rt   ru   r   NotImplemented__hash__r2   r   s   &&r+   __eq__Style.__eq__  -    %''!!}}%.."222r.   c                &   < V ^8  d   QhRS[ RS[/# r   r   )r)   r*   s   "r+   r,   ro     r   r.   c                |    \        V\        4      '       g   \        # V P                  4       VP                  4       8g  # rt   r   r   s   &&r+   __ne__Style.__ne__  r   r.   c                    < V ^8  d   QhRS[ /# r   r'   )r)   r*   s   "r+   r,   ro     s      # r.   c                    V P                   e   V P                   # \        \        V 4      4      V n         V P                   # rt   )r   r   _hash_getterr   s   &r+   r   Style.__hash__  s1    ::!::,t,-
zzr.   c                0   < V ^8  d   QhRS[ S[,          /# r   r   )r)   r*   s   "r+   r,   ro     s      x r.   c                    V P                   # )z.The foreground color or None if it is not set.)r   r   s   &r+   ri   Style.color  s     {{r.   c                0   < V ^8  d   QhRS[ S[,          /# r   r   )r)   r*   s   "r+   r,   ro     s      % r.   c                    V P                   # )z.The background color or None if it is not set.)r   r   s   &r+   rj   Style.bgcolor  r   r.   c                0   < V ^8  d   QhRS[ S[,          /# r   r   rn   )r)   r*   s   "r+   r,   ro     s      hsm r.   c                    V P                   # )zLink text, if set.)r   r   s   &r+   rk   
Style.link  s     zzr.   c                    < V ^8  d   QhRS[ /# r   r   )r)   r*   s   "r+   r,   ro     s     ? ? ?r.   c                Z    V P                   RJ ;'       g    V P                   P                  # )z6Check if the style specified a transparent background.N)rj   
is_defaultr   s   &r+   transparent_backgroundStyle.transparent_background  s%     ||t#>>t||'>'>>r.   c                   < V ^8  d   QhRR/# r   r   )r)   r*   s   "r+   r,   ro     s     + +' +r.   c                .    \        V P                  R7      # )zA Style with background only.)rj   )r   rj   r   s   &r+   background_styleStyle.background_style  s     T\\**r.   c                6   < V ^8  d   QhRS[ S[S[3,          /# r   )r	   rn   r   )r)   r*   s   "r+   r,   ro     s     U Ud38n Ur.   c                    V P                   f   / # \        \        \        \        3,          \        V P                   4      4      # )z=Get meta information (can not be changed after construction).)r   r   r	   rn   r   r   r   s   &r+   rl   
Style.meta  s0     ZZ'rTT$sCx.%

BS-TTr.   c                   < V ^8  d   QhRR/# r   r   )r)   r*   s   "r+   r,   ro     s      w r.   c                t   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.Nr~   r   F)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r2   r   s   & r+   without_colorStyle.without_color  s     :::||E*"& ,, $ 4 4jj48JJJGAv./Br.   r}   c                $   < V ^8  d   QhRS[ RR/# )r$   style_definitionr&   r   r   )r)   r*   s   "r+   r,   ro     s     ? ?S ?W ?r.   c           	        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   Nr   r   zcolor expected after 'on'zunable to parse z as background color; notz,expected style attribute after 'not', found Frk   zURL expected after 'link'Tz as color; ri   rj   r   )r   r   STYLE_ATTRIBUTESitersplitr   nextr   r   r   rv   r   getr   )r   r  r  ri   rj   r   rk   wordsoriginal_wordworderror	attributer   s   &&           r+   rv   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                6   < V ^8  d   QhRS[ S[,          RS[/# )r$   themer&   )r   r   rn   )r)   r*   s   "r+   r,   ro   0  s      " "H]$; "s "r.   c                L   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   ri   rj   r]   rS   foreground_colorget_truecolorr   from_tripletr   background_colorhexrU   rW   rY   ra   rg   r   )r2   r!  cssr   ri   rj   r#  theme_colors   &&      r+   get_html_styleStyle.get_html_style/  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*   s   "r+   r,   ro   U  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  r   r.  iter_styless   && r+   combineStyle.combineT       6l;[ 122r.   c                "   < V ^8  d   QhRRRR/# r-  r   )r)   r*   s   "r+   r,   ro   b  s     
3 
3G 
3 
3r.   c                B    \        V4      p\        V\        V4      4      # )zCombine styles from positional argument in to a single style.

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

Returns:
    Style: A new style instance.
r0  r1  s   &* r+   chainStyle.chaina  r5  r.   c                   < V ^8  d   QhRR/# r   r   )r)   r*   s   "r+   r,   ro   n  s      g r.   c                   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.
r~   r   F)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  s   & r+   copy
Style.copyn  s     :::||E*jj"&"8"8{{ ,, $ 4 4jj48JJJGAv./Bjjjjr.   c                   < V ^8  d   QhRR/# r   r   )r)   r*   s   "r+   r,   ro     s      g r.   c                r   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.
Nr   F)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  s   & r+   clear_meta_and_links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$   rk   r&   r   r   )r)   r*   s   "r+   r,   ro     s        r.   c                ~   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.
r~   r   NF)r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r2   rk   r   s   && r+   update_linkStyle.update_link  s     ||E*jj"&"8"8{{ ,, $ 4 448GAv./bjjr.   r   legacy_windowsFc                B   < V ^8  d   QhRS[ RS[S[,          RS[RS[ /# )r$   textr   rF  r&   )rn   r   r   r8   )r)   r*   s   "r+   r,   ro     s8       {+	
  
r.   c                  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[mz[0mz]8;id=r   z\z]8;;\)r   r   r   r   )r2   rH  r   rF  attrsrendereds   &&$$  r+   renderStyle.render  s|      |+K

AAd33LA49U5'4&0t:::nT]]O1TZZLxjW  r.   c                4   < V ^8  d   QhRS[ S[,          RR/# )r$   rH  r&   Nr   )r)   r*   s   "r+   r,   ro     s     
3 
3# 
3$ 
3r.   c                    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.


N)rn   sysstdoutwriterM  )r2   rH  s   &&r+   test
Style.test  s8       s4y

DKK-.b12r.   c                2   < V ^8  d   QhRS[ R,          RR/# r$   r   r   r&   r   )r)   r*   s   "r+   r,   ro     s       (7+  r.   c                   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# rt   )r   r   r   r   r   r   r   r   r   r   r   r   r   rl   r   )r2   r   	new_styles   && r+   _add
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                2   < V ^8  d   QhRS[ R,          RR/# rX  rY  )r)   r*   s   "r+   r,   ro     s$     P PXg. P7 Pr.   c                l    V P                  V4      pVP                  '       d   VP                  4       # T# rt   )r\  rk   r<  )r2   r   combined_styles   && r+   __add__Style.__add__  s/    5)(6(;(;(;~""$OOr.   c                   < 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   r   r   r   )r   r   r(   r8   bytes)r)   r*   s   "r+   r,   ro   #   su     8 UO9 : uo; < = > ? @ C=A B KC D E?E r.   )r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   )NNrt   )r   )?r<   r=   r>   r?   r@   rA   r   r  r3   classmethodr   r   r   r   r!   rU   rS   rW   rY   r[   r\   r]   r_   ra   rc   re   rf   rg   propertyr   r   r   r   r   r   r   r   r   r   r   ri   rj   rk   r  r  rl   r  rv   r*  r3  r8  r<  r@  rD  r   	TRUECOLORrM  rU  r\  ra  __annotate_func__rB   rC   rD   s   @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]  r.   c                      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                "   < V ^8  d   QhRRRR/# )r$   default_styler   r&   Nr   )r)   r*   s   "r+   r,   StyleStack.__annotate__  s     3 3g 3$ 3r.   c                    V.V n         R # rt   rk  )r2   rm  s   &&r+   r3   StyleStack.__init__  s    $1?r.   c                    < V ^8  d   QhRS[ /# r   r   )r)   r*   s   "r+   r,   rn    s     / /# /r.   c                $    R V P                   : R2# )z<stylestack >rp  r   s   &r+   __repr__StyleStack.__repr__  s    dkk_A..r.   c                    < V ^8  d   QhRS[ /# r   r   )r)   r*   s   "r+   r,   rn    s       r.   c                (    V P                   R,          # )z&Get the Style at the top of the stack.rp  r   s   &r+   currentStyleStack.current  s     {{2r.   c                $   < V ^8  d   QhRS[ RR/# )r$   r   r&   Nrx  )r)   r*   s   "r+   r,   rn  	  s     4 4% 4D 4r.   c                l    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.
Nrz  )rk  r   r  s   &&r+   pushStyleStack.push	  s#     	4;;r?U23r.   c                    < V ^8  d   QhRS[ /# r   rx  )r)   r*   s   "r+   r,   rn    s      U r.   c                \    V P                   P                  4        V P                   R,          # )zePop last style and discard.

Returns:
    Style: New current style (also available as stack.current)
rz  )rk  popr   s   &r+   r  StyleStack.pop  s      	{{2r.   rp  N)r<   r=   r>   r?   r@   rA   r3   ru  rf  r{  r  r  rB   rC   rD   s   @r+   rj  rj    sK     
I3 3/ /  4 4 r.   rj  )'rR  	functoolsr   operatorr   pickler   r   randomr   typingr   r	   r
   r   r   r   r   r   r   r   ri   r   r   r   r   reprr   r   terminal_themer   r   r   rn   r   r!   r   r   rj  r   r.   r+   <module>r     s    
     I I I  A A # Aj-):GW
 #w,	  OP OP OPd W
 r.   