
    kj:                       d dl mZ d dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dlm
Z
 d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ  ej*                  e      Zddd fZej2                   G d dej4                               Zej2                   G d deej4                               Ze G d d             Zdej<                  _        y)    )annotationsN)abstractmethod)	dataclass)PathLiteral)http)tcp)udp)
DNSMessage)Flow)WebSocketMessageSyntaxHighlightc                     t         d   S )N)css
javascriptxmlyamlnoneerrorr        d/home/ubuntu/.cache/pipx/cdb5059130eadca/lib/python3.12/site-packages/mitmproxy/contentviews/_api.pyr   r      s    wRS Sr   c                  l    e Zd ZdZedd       Zed	d       Ze	 	 	 	 	 	 d
d       Z	 	 	 	 	 	 ddZ	d Z
y)Contentviewz*
    Base class for all contentviews.
    c                J    t        |       j                  j                  d      S )zq
        The name of this contentview, e.g. "XML/HTML".
        Inferred from the class name by default.
        r   )type__name__removesuffixselfs    r   namezContentview.name   s     Dz""//>>r   c                     y)zMOptional syntax highlighting that should be applied to the prettified output.r   r   r    s    r   syntax_highlightzContentview.syntax_highlight%   s     r   c                     y)z
        Transform raw data into human-readable output.
        May raise an exception (e.g. `ValueError`) if data cannot be prettified.
        Nr   r!   datametadatas      r   prettifyzContentview.prettify*       r   c                     y)z
        Return the priority of this view for rendering `data`.
        If no particular view is chosen by the user, the view with the highest priority is selected.
        If this view does not support the given data, return a float < 0.
        r   r   r&   s      r   render_priorityzContentview.render_priority5   s     r   c                L    | j                   j                  |j                         S )N)r"   __lt__)r!   others     r   r.   zContentview.__lt__A   s    yy

++r   N)returnstr)r0   r   )r'   bytesr(   Metadatar0   r1   )r'   r2   r(   r3   r0   float)r   
__module____qualname____doc__propertyr"   r$   r   r)   r,   r.   r   r   r   r   r      s     ? ?     
	 

 
 
	
,r   r   c                  .    e Zd ZdZe	 	 	 	 	 	 dd       Zy)InteractiveContentviewzJA contentview that prettifies raw data and allows for interactive editing.c                     y)z
        Reencode the given (modified) `prettified` output into the original data format.
        May raise an exception (e.g. `ValueError`) if reencoding failed.
        Nr   )r!   
prettifiedr(   s      r   reencodezInteractiveContentview.reencodeI   r*   r   N)r<   r1   r(   r3   r0   r2   )r   r5   r6   r7   r   r=   r   r   r   r:   r:   E   s3    T  
	 r   r:   c                      e Zd ZU dZdZded<   	 dZded<   	 dZded<   	 dZd	ed
<   	 dZ	ded<   	 dZ
ded<   	 dZded<   	 dZded<   	 dZded<   y)r3   zr
    Metadata about the data that is being prettified.

    Do not rely on any given attribute to be present.
    NzFlow | Noneflowz
str | Nonecontent_typezhttp.Message | Nonehttp_messageztcp.TCPMessage | Nonetcp_messagezudp.UDPMessage | Noneudp_messagezWebSocketMessage | Nonewebsocket_messagezDNSMessage | Nonedns_messagezPath | Noneprotobuf_definitionszbytes | Noneoriginal_data)r   r5   r6   r7   r?   __annotations__r@   rA   rB   rC   rD   rE   rF   rG   r   r   r   r3   r3   U   s     D+4#L*#4(,L%,<)-K&-;)-K&-;15.5A%)K");(,+,L"&M<&Ar   r3   z@private) 
__future__r   loggingtypingabcr   dataclassesr   pathlibr   r   	mitmproxyr	   r
   r   mitmproxy.dnsr   mitmproxy.flowr   mitmproxy.websocketr   	getLoggerr   loggerr   runtime_checkableProtocolr   r:   r3   __init__r7   r   r   r   <module>rX      s    "    !      $  0			8	$ T *,&// *, *,Z [&//   B B B< '   r   