a
    [Xh!                     @   s   d Z ddlmZmZ ddlmZmZ ddlmZm	Z	m
Z
mZ ddlmZ ddlmZmZ d	d
lmZ d	dlmZmZmZmZ h dZe
d	d	dZe
d	d	de	d	d	dfZdddZdS )z/Validate properties, expanders and descriptors.    )SelectorErrorcompile_selector_list)parse_blocks_contents	serialize)FunctionBlock
IdentTokenLiteralTokenWhitespaceToken   )LOGGER   )InvalidValuesremove_whitespace   )	EXPANDERS)PREFIXPROPRIETARYUNSTABLEvalidate_non_shorthand>[   zwill-changez
cue-beforeZcueZ	animationzscroll-padding-leftzanimation-directionzscroll-padding-block-endzanimation-play-statezscroll-margin-inlinezscroll-margin-block-endzview-timeline-insetzview-timeline-namezfield-sizingzscroll-snap-typezanimation-compositionZspeakzanimation-durationzoverscroll-behavior-inlineztouch-actionZstresszanimation-timing-functionzanimation-range-startztimeline-scopevolumeztransition-timing-functionZrichnesszoverscroll-behavior-blockzvoice-familyZ
transitionzview-timelinezscroll-margin-block-startzscroll-margin-rightzview-transition-namecaretzview-timeline-axiszscroll-padding-topzscroll-padding-blockzanimation-namezscrollbar-colorresizezscroll-padding-inline-endzoverscroll-behavior-xztransition-propertyzoverscroll-behaviorzscroll-margin-inline-startZ	elevationzscroll-marginzanimation-timelinezspeech-ratezscroll-padding-inline-startzscroll-timelinezscroll-padding-block-startzcaret-shapezplay-duringzscrollbar-widthzanimation-iteration-countzpitch-rangezscroll-padding-bottompauseztransition-durationzpointer-eventszscroll-padding-rightzscroll-snap-alignzscrollbar-gutterzscroll-snap-stopzanimation-range-endzscroll-margin-inline-endzscroll-behaviorzanimation-rangezspeak-numeralzscroll-margin-leftzspeak-punctuationzscroll-timeline-axiszspeak-headerzcaret-colorcursorzscroll-margin-bottomzscroll-timeline-namezanimation-fill-modezscroll-margin-blockzscroll-padding-inlineztransition-delayZazimuthzscroll-paddingzanimation-delayzpause-afterzpause-beforeZpitchz	cue-afterzoverscroll-behavior-yzscroll-margin-top&:rootNc                 #   s  |durvzFt |v rD|g  }}|D ]"}|t kr8|t q || q t|}W n& tyt   tdt| dY n0 tdddtddd|f}|D ]  j	dkrt
d j j j  j	dkr|du rqg }g g} jD ]&}|d	kr|g  q|d
 | q|D ]}	t |	v rJ jD ]&}|t kr:|| n
|| q n8tdddtddd|f}|g |tddd|	 |tddd	 qt| t j|dd
 E dH   j	dkrq j}
|
dsވ j}
 fdd}|
tv r |dd q|
tr~|
ttd }|tv r,|}
nR|tv r\t
d jt j j j| |}
n"t
d jt j j j| q|
dr|
ds|dd qt|
t}t  j}z"|st!dt"|||
| }W nZ t!y4 } z@|d|j#r|j#d r|j#d nd W Y d}~qW Y d}~n
d}~0 0  j$}|D ]F\}}|durp|%dd||f | fV  n|%dd||fV  q@qdS )zExpand shorthand properties, filter unsupported properties and values.

    Log a warning for every ignored declaration.

    Return a iterable of ``(name, value, important)`` tuples.

    N'r   r   iserrorzError: %s at %d:%d.zqualified-rule, declarationz--c                    s(   t t| d jt j j j| d S )NzIgnored `%s:%s` at %d:%d, %s.)getattrr   namer   valuesource_linesource_column)levelreasonr#    g/var/www/viveiro_mudafortebrasil/venv/lib/python3.9/site-packages/weasyprint/css/validation/__init__.pyvalidation_error   s
    
z1preprocess_declarations.<locals>.validation_errordebugz/the property does not apply for the print mediaz\Deprecated `%s:%s` at %d:%d, prefixes on unstable attributes are deprecated, use %r instead.zTIgnored `%s:%s` at %d:%d, prefix on this attribute is not supported, use %r instead.-zprefixed selectors are ignoredzno valuewarningr   zinvalid value_)&NESTING_SELECTORextend
ROOT_TOKENappendr   r   r   r   r   typer   r1   messager'   r(   preluder	   preprocess_declarationsr   contentr%   
startswithZ
lower_nameNOT_PRINT_MEDIAr   lenr   r   r&   r   getr   r   r   listargs	importantreplace)base_urlZdeclarationsr9   Zoriginal_preludetoken	selectorsZis_tokenZdeclaration_preludeZtoken_groupsZtoken_groupr%   r.   Zunprefixed_nameZ	validatortokensresultexcrB   Z	long_namer&   r,   r+   r-   r:   r   s    	
















 "
r:   )N)__doc__Z
cssselect2r   r   Ztinycss2r   r   Ztinycss2.astr   r   r   r	    r   utilsr   r   Z	expandersr   Z
propertiesr   r   r   r   r=   r3   r5   r:   r,   r,   r,   r-   <module>   s   a