o
    a"<f
                     @   sX   d 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	 Zd
S )a/  
 source: https://gist.github.com/1311010
 Get django-sekizai, django-compessor (and django-cms) playing nicely together
 re: https://github.com/ojii/django-sekizai/issues/4
 using: https://github.com/django-compressor/django-compressor.git
 and: https://github.com/ojii/django-sekizai.git@0.6 or later
    )CompressorNode)UncompressableFileError)
Compressor)settings)	get_class)TextNodec              	      s  t tj| tdtd}}g g g }}}|dkrT  D ]2} |}	zd|	v r3||	d  W n tyL   d|	v rE|| n|| Y q w || q n<|dkr 	 D ]3} |}	z 
|dkrz|	d  dkrz||	d  W n ty   || Y q\w || q\d	 fd
d|D }tt||dd}
d	 fdd|D }tt||dd}d	 fdd|D }tt||dd}d|
j| d|j| d|j| dgS )z
    Data is the string from the template (the list of js files in this case)
    Name is either 'js' or 'css' (the sekizai namespace)
    Basically passes the string through the {% compress 'js' %} template tag
    jscsssrcdeferlinkrel
stylesheethref c                 3       | ]}  |V  qd S Nelem_str.0eparser Q/var/www/html/kck/venv/lib/python3.10/site-packages/compressor/contrib/sekizai.py	<genexpr>4       zcompress.<locals>.<genexpr>file)nodelistkindmodec                 3   r   r   r   r   r   r   r   r   6   r   c                 3   r   r   r   r   r   r   r   r   8   r   
)context)r   r   COMPRESS_PARSERr   js_elemselem_attribsget_basenamer   append	css_elems	elem_namelowerjoinr   r   get_original_contentrender)r#   datanamejs_compressorcss_compressorcompressable_elementsexpanded_elementsdeferred_elementselemattribsexpanded_nodecompressable_nodedeferred_noder   r   r   compress   sP   





r;   N)__doc__ compressor.templatetags.compressr   compressor.exceptionsr   compressor.baser   compressor.confr   compressor.utilsr   django.template.baser   r;   r   r   r   r   <module>   s    