
    kj                     
   d dl Z d dlZd dlmZ d dlmZ d dlmZ 	 dej                  z   ej                  z   dz   dej                  z   ej                  z   dz   dej                  z   dz   d	ej                  z   d
z   fZ
dZddedefdZ G d de      Z e       Zedk(  rZ ed      5 Zej'                         Zddd        ej                         Z ee      Z ed ej                         ez
  dd       yy# 1 sw Y   CxY w)    N)Contentview)Metadata)strutils'"z/\*z\*/z//$z{};:dataindentc                    t        j                  | j                         t        t              } t        j                  dd|       } t        j                  dd|       } t        j                  dd|       } t        j                  dd|       } t        j                  d	d
|       } t        j                  dd|       } t        j                  dd|z   |       } t        j                  |       } | j                  d      dz   S )z%Beautify a string containing CSS codez\s*;\s*z;
z\s*{\s*z {
z\s*}\s*z
}

z\s*:\s*(?=[^{]+})z: z\s*,\s*z, z
[ 	]+
z
(?![}
])(?=[^{]*}))	r   escape_special_areasstripCSS_SPECIAL_AREASCSS_SPECIAL_CHARSresubunescape_special_areasrstrip)r	   r
   s     i/home/ubuntu/.cache/pipx/cdb5059130eadca/lib/python3.12/site-packages/mitmproxy/contentviews/_view_css.pybeautifyr      s    ((

D 66*eT*D66*fd+D66*i.D 66&d3D66*dD)D 66*dD)D66)4&=$?D**40D;;tt##    c                   8    e Zd ZdZdededefdZdededefdZ	y)ViewCSScssr	   metadatareturnc                 <    |j                  dd      }t        |      S )Nutf8surrogateescape)decoder   )selfr	   r   data_strs       r   prettifyzViewCSS.prettify7   s    ;;v'89!!r   c                 L    t        t        |      xr |j                  dk(        S )Nztext/css)floatboolcontent_type)r!   r	   r   s      r   render_priorityzViewCSS.render_priority;   s#    
 T$ZGH$9$9Z$GHHr   N)
__name__
__module____qualname__syntax_highlightbytesr   strr#   r%   r(    r   r   r   r   4   sG    "U "h "3 "II I 
	Ir   r   __main__z../tools/web/static/vendor.csszBeautifying vendor.css took z.2s)z    )r   timemitmproxy.contentviews._apir   r   mitmproxy.utilsr   SINGLELINE_CONTENT	NO_ESCAPEMULTILINE_CONTENTr   r   r.   r   r   r   r)   openfreadr	   txprintr/   r   r   <module>r>      s*   	  3 0 $ (
%
%%(:(::S@(
%
%%(:(::S@
X'''&08&&&,	   $3 $ $4Ik I i z	.	/ 1vvx 			AA	(q(<A
>?  s   &C99D