
    !<i                         d Z ddlZddlmZ ej        dk    rddlmZ nddlmZ erddlmZ ddl	m
Z
  G d d	          ZdS )
z@InlineText class for rich text rendering with appended metadata.    N)TYPE_CHECKING)      )Self)RenderableTypeTextc                   d    e Zd ZddddZeddddedz  d	ed
ededef
d            ZddZ	d Z
dS )
InlineTextFforce_empty_endprimary_renderabler   c                0    || _         g | _        || _        d S N)r   textsr   )selfr   r   s      /Users/kimhansen/Desktop/03 Workspace/ceo-agents/chl-effectiveness/mcp-servers/whoop/.venv/lib/python3.11/site-packages/cyclopts/help/inline_text.py__init__zInlineText.__init__   s    "4
.    )r   show_errorscontentNformatr   r   returnc                x   |ddl m}  |d          }n|dk    r$ddl m}  ||                                          }no|dv rddlm}  ||          }nY|dv r%dd	lm} dd
lm}	  |	|          }
 ||
|          }n0|dk    rddl m}  |j	        |          }nt          d| d           | ||          S )Nr   r    end	plaintext)markdownmd)Markdown)restructuredtextrst)RestructuredText)process_sphinx_directives)r   richzUnknown help_format ""r   )	rich.textr	   rstriprich.markdownr!   rich_rstr$   cyclopts.help.rst_preprocessorr%   from_markup
ValueError)clsr   r   r   r   r	   r   r!   r$   r%   processed_contents              r   from_formatzInlineText.from_format   sX    ?&&&&&&!%"{""&&&&&&!%gnn&6&6!7!7)))......!)'!2!2222111111PPPPPP 9 9' B B!1!12CQ\!]!]!]v&&&&&&!1!1'!:!:>V>>>???s%GGGGr   textr	   c                 :    | j                             |           d S r   )r   append)r   r2   s     r   r4   zInlineText.append;   s    
$r   c              #   z  K   ddl m} ddlm} | j        s	| j        sd S g g }}|                    | j        |          D ]>}|j        dk    r|                    ||gz              g })|                    |           ?|r|                    |           |s4| j        r+ |j	        | j         }|                    ||          E d {V  d S |d d         D ]}	|	D ]}|V  |rX|d         }
|
o|
d         j        dk    }|r|

                                nd }|
r<|
d         } ||j                                        |j        |j                  }||
d<    |dd          }|
D ])}|j        r |                    |j        |j                   * |d	          }| j        D ]}|r||z  }||z  }t          |                    ||                    }| j        rB|d         }|r8|j                            d          s|                     |d                     |r|                    |           |E d {V  d S d S )
Nr   )Segmentr   
)stylecontrolr   r    )rich.segmentr6   r(   r	   r   r   renderr2   r4   assemblepopr)   r9   r:   listr   endswith)r   consoleoptionsr6   r	   lines_of_segmentscurrent_linesegmentcombined_textline	last_linehas_newlinenewline_segmentlast_segmentlast_line_text	separatorr2   wrapped_segmentss                     r   __rich_console__zInlineText.__rich_console__>   s-     ((((((""""""& 	tz 	F +-b<~~d&=wGG 	- 	-G|t##!((	)ABBB!##G,,,, 	3$$\222 ! 	z B -tz :">>-AAAAAAAAAF &crc* 	 	D  
  )	()"-I $B	"(:d(BK1<Fimmooo$O  -(}&w %,,..&,(0     
 !-	" "T""---N$ G G< G"))',FFFS		I
 ' '! 0"i/N$&  $GNN>7$K$KLL# ;/3 ;(9(B(B4(H(H ;$++GGDMM:::  9 ''888''''''''''S)	( )	(r   )r   r   )r2   r	   )__name__
__module____qualname__r   classmethodstrboolr   r1   r4   rP    r   r   r   r      s        PU / / / / / /
  !&!"H "H "Ht"H "H
 "H "H 
"H "H "H ["HH       J( J( J( J( J(r   r   )__doc__systypingr   version_infor   typing_extensionsrich.consoler   r(   r	   r   rW   r   r   <module>r^      s    F F 



            w&&&&&& ++++++x( x( x( x( x( x( x( x( x( x(r   