
    Bh_                     H   S r SSKrSSKJrJrJr  SSKJr  SSKJ	r	  SSK
Jr  SS	KJrJrJrJrJrJr  SS
KJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8  0 r9 " S S\5      r:S r;S r<S r=\<" S5      \<" S5      \<" S5      \<" S5      \<" S5      \<" S5      S 5       5       5       5       5       5       r>\<" S5      \=" SSSSSS9S 5       5       r?\<" S5      \=" S S!S"SS9S# 5       5       r@\<" S$5      S% 5       rA\<" S&5      \<" S'5      \<" S(5      \<" S)5      \<" S*5      \<" S+5      \=" S,S-S.5      S/ 5       5       5       5       5       5       5       rB\<" S05      \=" S1S2S3S4S,SS9S5 5       5       rC\<" S65      \=" S1S2S3S4S,S7SS9S8 5       5       rD\<" S95      S: 5       rE\<" S;5      \=" S<S-S.S=5      S> 5       5       rFS? rG\<" S@5      \=" SA5      SB 5       5       rH\<" SC5      \=" SD5      SE 5       5       rI\<" SF5      \=" SG5      SH 5       5       rJ\<" SI5      \=" SJSK5      SL 5       5       rK\<" SM5      \=" SNSOSPSQSRS!5      SS 5       5       rL\<" ST5      \=" S.SUSVSWSXSYSZ5      S[ 5       5       rM\<" S\5      \=" S]5      S^ 5       5       rN\<" S_5      \=" S`SaSb5      Sc 5       5       rO\<" Sd5      \=" SeSf5      Sg 5       5       rPSh rQ\<" Si5      \=" SjSkSl5      Sm 5       5       rR\<" Sn5      \=" SoSpSqSrSsSt5      Su 5       5       rSSv rT\<" Sw5      \<" Sx5      \=" SySz5      S{ 5       5       5       rU\<" S|5      \=" S}S~SS5      S 5       5       rV\<" S5      \<" S5      \=" SS5      S 5       5       5       rW\<" S5      \=" S5      S 5       5       rX\<" S5      \=" S5      S 5       5       rY\<" S5      \=" SS5      S 5       5       rZ\<" S5      \=" SS5      S 5       5       r[\<" S5      \=" SS5      S 5       5       r\\<" S5      \=" SSS5      S 5       5       r]\<" S5      \=" SS5      S 5       5       r^g)zValidate properties expanders.    N)DimensionToken
IdentTokenNumberToken)parse_color   )INITIAL_VALUES   expand_font_variant)InvalidValuesPendingcheck_var_functionget_keywordget_single_keywordsplit_on_comma)&background_attachmentbackground_imagebackground_positionbackground_repeatbackground_sizeblock_ellipsisborder_image_sourceborder_image_sliceborder_image_widthborder_image_outsetborder_image_repeatborder_styleborder_widthboxcolumn_countcolumn_width
flex_basisflex_directionflex_grow_shrink	flex_wrapfont_family	font_sizefont_stretch
font_stylefont_variant_capsfont_weightgap	grid_linegrid_templateline_heightlist_style_imagelist_style_positionlist_style_typemask_border_modeother_colorsoverflow_wraptext_decoration_thicknessvalidate_non_shorthandc                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )PendingExpander   z>Expander with validation done when defining calculated values.c                 J   > [         TU ]  XR                  S   5        X l        g )Nname)super__init__keywords	validator)selftokensr@   	__class__s      U/var/www/html/env/lib/python3.13/site-packages/weasyprint/css/validation/expanders.pyr>   PendingExpander.__init__   s     !3!3F!;<"    c                     U R                  U5       HA  u  p4UR                  S5      (       a  U R                   R                  S    U 3nX2:X  d  M?  Us  $    [        e)N-r<   )r@   
startswithr?   KeyError)rA   rB   
wanted_keykeyvalues        rD   validatePendingExpander.validate!   sV    ..0JC~~c""0089#? 	 1
 rF   )r@   )	__name__
__module____qualname____firstlineno____doc__r>   rN   __static_attributes____classcell__)rC   s   @rD   r9   r9      s    H# rF   r9   c                     U  H3  n[        U5      (       d  M  [        X5      nU Vs0 s H  oUU_M     sns  $    gs  snf )z5Return pending expanders when var is found in tokens.N)r   r9   )rB   expanderexpanded_namestokenpendingr<   s         rD   	_find_varr\   *   s=    e$$%f7G.<=nd'Mn==	  >s   ;c                    ^  U 4S jnU$ )z1Decorator adding a function to the ``EXPANDERS``.c                 <   > T[         ;  d   T5       eU [         T'   U $ )z&Add ``function`` to the ``EXPANDERS``.)	EXPANDERS)functionproperty_names    rD   expander_decorator$expander.<locals>.expander_decorator5   s%    I-<}<-#+	- rF    )ra   rb   s   ` rD   rX   rX   3   s    
 rF   c                  N   ^ ^ UR                  SS5      mU(       a   eU U4S jnU$ )zDecorator helping expanders to handle ``inherit`` and ``initial``.

Wrap an expander so that it does not have to handle the 'inherit' and
'initial' cases, and can just yield name suffixes. Missing suffixes
get the initial value.

wants_base_urlFc                 P   >^ ^ [         R                  " T 5      UUUU 4S j5       mT$ )z"Decorate the ``wrapped`` expander.c              3   &  >#    [         R                  " TXS9nSn[        U 5      nUS;   a  T Vs0 s H  oU_M     nnSnO[        XT5      nU(       a  SnU(       d_  0 nT(       a  T" U WU5      nO	T" U W5      nU H<  u  pUT;   d   U5       eX;   a!  [	        SUR                  S5       SU S35      eXU'   M>     T HI  nUR                  S5      (       a  W U 3n
OUn
X;   a  Xh   nU(       d  [        XUSS	9u  u  pOS
nX4v   MK     gs  snf 7f)zWrap the expander.r<   base_urlF)inheritinitialTzgot multiple rH   z values in a z
 shorthandrequiredrl   N)	functoolspartialr   r\   r   striprI   r7   )rB   r<   rj   rX   skip_validationkeywordresultsresultnew_name	new_tokenactual_new_namerM   rY   generic_expander_wrapperrf   wrappeds               rD   ry   Vgeneric_expander.<locals>.generic_expander_decorator.<locals>.generic_expander_wrapperJ   s\     !(((tHH $O(0G005CD^T=^D"&#FnE&*O"!$VT8<F$VT2F+1'H#~5?x?5*++HNN3,?+@ A$$(656 6 )2H% ,2 +&&s++)-xj&9O&.O&#-E*4J!Ht5M10 &E%,,! ++ Es   -DDCD)ro   wraps)rz   ry   rY   rf   s   `@rD   generic_expander_decorator4generic_expander.<locals>.generic_expander_decoratorH   s'    		!-	- 
"-	-\ ('rF   )pop)rY   kwargsr}   rf   s   `  @rD   generic_expanderr   =   s,     ZZ 0%8N:1(d &%rF   zborder-colorzborder-stylezborder-widthmarginpaddingbleedc              #   `  #    / nS HM  nUR                  S5      =nS:X  a  UR                  U U 35        M1  UR                  USU  U XS  35        MO     [        R                  " [        XS9n[        XU5      =n(       a  UR                  5        Sh  vN   g[        U 5      S:X  a  U S-  n OS[        U 5      S:X  a  U S-  n O>[        U 5      S	:X  a	  X S   4-  n O&[        U 5      S:w  a  [        S
[        U 5       35      e[        X05       H  u  p[        U	/XSS9u  nUv   M     g N7f)z>Expand properties setting a token for the four sides of a box.z-topz-rightz-bottomz-leftrH   Nri   r	      r      %Expected 1 to 4 token components got Trm   )rfindappendro   rp   expand_four_sidesr\   itemslenr   zipr7   )
rB   r<   rj   rY   suffixirX   ru   expanded_namerZ   s
             rD   r   r   }   sF     N8C AR'!!TF6("34 !!T"1XJvhtBxj"AB 9   9H6^<<v<<<>!! 6{a!	V	!	V	!9,	V	3CK=AC 	C #N ; )G]t= !< 	"s   BD.D,BD.zborder-radiuszborder-top-left-radiuszborder-top-right-radiuszborder-bottom-right-radiuszborder-bottom-left-radiusT)rf   c              #   \  #    / =p4/ nU  HZ  nUR                   S:X  a6  UR                  S:X  a&  X4L a  X`S   :X  a  [        S5      eUnM>  [        S5      eUR                  U5        M\     U(       d  USS nXE4 Hz  n[	        U5      S:X  a  US-  nM  [	        U5      S	:X  a  US	-  nM/  [	        U5      S
:X  a  UR                  US   5        MT  [	        U5      S:w  d  Me  [        S[	        U5       35      e   Sn[        U[        XE5      5       H  u  pSU	 S3n[        XUSS9  X4v   M     g7f)z-Validator for the ``border-radius`` property.literal/r   z"Expected value after "/" separatorzExpected only one "/" separatorNr	   r   r   r   r   )ztop-leftz	top-rightzbottom-rightzbottom-leftzborder-z-radiusTrm   )typerM   r   r   r   r   r7   )
rB   r<   rj   current
horizontalverticalrZ   valuescornerscorners
             rD   border_radiusr      s;     GH::"u{{c'9$2J&'(LMM&G#$EFFNN5!  a=&v;!aKF[AaKF[AMM&)$[A7F}EG G ' GGgs:'@A(vXEl Bs   CD,AD,z
list-style-type	-position-imagec              #   \  #    S=p4SnU  H\  n[        U5      S:X  a	  US-  nUnM  [        U/U5      b  SnSnO([        U/5      b  SnO[        U/5      b  S	nSnO[        eX/4v   M^     U(       d  U(       a  S	W/4v   US-  nU(       d  U(       a  SW/4v   US-  nU(       a  [        eg7f)
zqExpand the ``list-style`` shorthand property.

See https://www.w3.org/TR/CSS21/generate.html#propdef-list-style

Fr   noner	   Nr   Tr   r   )r   r0   r1   r2   r   )	rB   r<   rj   type_specifiedimage_specified
none_countrZ   
none_tokenr   s	            rD   expand_list_styler      s      (-,NJu' !OJJUGX.:F"O %)5 FeW%1F!Ngo% ( j
|##a
z$$a
 s   B*B,borderc              #   R   #    S H  n[        XU-   U5       H  nUv   M	     M     g7f)zdExpand the ``border`` shorthand property.

See https://www.w3.org/TR/CSS21/box.html#propdef-border

r   N)expand_border_side)rB   r<   rj   r   new_props        rD   expand_borderr      s,      9*6&=(KHN L 9s   %'z
border-topzborder-rightzborder-bottomzborder-leftzcolumn-ruleoutline-width-color-stylec              #      #    U  H>  n[        U5      b  SnO&[        U/5      b  SnO[        U/5      b  SnO[        eX2/4v   M@     g7f)zlExpand the ``border-*`` shorthand properties.

See https://www.w3.org/TR/CSS21/box.html#propdef-border-top

Nr   r   r   )r   r   r   r   )rB   r<   rZ   r   s       rD   r   r     sU      u)F5'".F5'".Fgo s   AAzborder-image-outset-repeat-slice-sourcec              #     #    [        U 5      n U (       GaL  [        U SS U5      (       a  SU R                  S5      /4v   GO[        U SS 5      (       ap  U R                  S5      /nU (       aO  [        U SS 5      (       a<  UR	                  U R                  S5      5        U (       a  [        U SS 5      (       a  M<  SU4v   GO[        U SS 5      (       d  [        U S   5      S:X  Gaf  U R                  S5      /nU (       aS  [        X@SS -   5      (       a>  UR	                  U R                  S5      5        U (       a  [        X@SS -   5      (       a  M>  SU4v   U (       a8  U S   R                  S:X  a%  U S   R                  S	:X  a  U R                  S5        OGM  U (       d  [        e[        U SS 5      (       a  U R                  S5      /nU (       aS  [        XPSS -   5      (       a>  UR	                  U R                  S5      5        U (       a  [        XPSS -   5      (       a  M>  S
U4v   U (       a8  U S   R                  S:X  a%  U S   R                  S	:X  a  U R                  S5        OHGMe  U (       a8  U S   R                  S:X  a%  U S   R                  S	:X  a  U R                  S5        O[        eU (       d  [        e[        U SS 5      (       as  U R                  S5      /nU (       aS  [        X`SS -   5      (       a>  UR	                  U R                  S5      5        U (       a  [        X`SS -   5      (       a  M>  SU4v   O[        e[        eU (       a  GMK  gg7f)zuExpand the ``border-image-*`` shorthand properties.

See https://drafts.csswg.org/css-backgrounds/#the-border-image

Nr	   r   r   r   fillr   r   r   r   r   )listr   r   r   r   r   r   r   rM   r   r   r   rB   r<   rj   repeatssliceswidthsoutsetss          rD   expand_border_imager   !  s     &\F
vbqz844fjjm_,, ,,zz!}oG0<<vzz!}- 0<<W$$r
++{6!9/E/Ojjm_F/0CDDfjjm, /0CDDF""&)..I5&)//S:P

1 ##!&!*-- **Q-!3FBQZ4G!H!HMM&**Q-0 !3FBQZ4G!H!H&&fQinn	9fQiooQT>TJJqM F1INNi7F1IOOs<R

1 $###"6"1:..!::a=/!4Wbqz5I!J!JNN6::a=1 !4Wbqz5I!J!J(( $#g &s'   B9M#=BM#CM#+DM#M#!M#zmask-border-modec              #      #    [        U 5      n U (       Gaw  [        U SS U5      (       a  SU R                  S5      /4v   GO@[        U SS 5      (       a  SU R                  S5      /4v   GO[	        U SS 5      (       ap  U R                  S5      /nU (       aO  [	        U SS 5      (       a<  UR                  U R                  S5      5        U (       a  [	        U SS 5      (       a  M<  SU4v   GO[        U SS 5      (       d  [        U S   5      S:X  Gaf  U R                  S5      /nU (       aS  [        X@SS -   5      (       a>  UR                  U R                  S5      5        U (       a  [        X@SS -   5      (       a  M>  SU4v   U (       a8  U S   R                  S	:X  a%  U S   R                  S
:X  a  U R                  S5        OGM  U (       d  [        e[        U SS 5      (       a  U R                  S5      /nU (       aS  [        XPSS -   5      (       a>  UR                  U R                  S5      5        U (       a  [        XPSS -   5      (       a  M>  SU4v   U (       a8  U S   R                  S	:X  a%  U S   R                  S
:X  a  U R                  S5        OHGM  U (       a8  U S   R                  S	:X  a%  U S   R                  S
:X  a  U R                  S5        O[        eU (       d  [        e[        U SS 5      (       as  U R                  S5      /nU (       aS  [        X`SS -   5      (       a>  UR                  U R                  S5      5        U (       a  [        X`SS -   5      (       a  M>  SU4v   O[        e[        eU (       a  GMv  gg7f)znExpand the ``mask-border-*`` shorthand properties.

See https://drafts.fxtf.org/css-masking/#the-mask-border

Nr	   r   r   r   r   r   r   r   r   r   r   )r   r   r   r3   r   r   r   r   r   rM   r   r   r   r   s          rD   expand_mask_borderr   a  s     &\F
vbqz844fjjm_,,fRaj))FJJqM?** ,,zz!}oG0<<vzz!}- 0<<W$$r
++{6!9/E/Ojjm_F/0CDDfjjm, /0CDDF""&)..I5&)//S:P

1 ##!&!*-- **Q-!3FBQZ4G!H!HMM&**Q-0 !3FBQZ4G!H!H&&fQinn	9fQiooQT>TJJqM F1INNi7F1IOOs<R

1 $###"6"1:..!::a=/!4Wbqz5I!J!JNN6::a=1 !4Wbqz5I!J!J(( $#k &s'   C$N(BNCNDN/NN
backgroundc              #   j  ^^#    Sm[        U 5      nUS;   a  T H  nX4v   M
     g[        R                  " [        UTS9n[	        XT5      =n(       a  UR                  5        Sh  vN   gS
UU4S jjn[        [        U 5      5      nU" [        U5      SS9u  pU	R                  5        V
Vs0 s H  u  pX/_M
     nn
nU H9  n U" U 5      u  pUR                  5        H  u  pX   R                  U5        M     M;     UR                  5        H  u  pXSSS2   4v   M     S	U4v   g Ns  snn
f 7f)zoExpand the ``background`` shorthand property.

See https://drafts.csswg.org/css-backgrounds-3/#the-background

)background-colorzbackground-imagezbackground-repeatzbackground-attachmentzbackground-positionzbackground-sizezbackground-clipzbackground-origin)rl   rk   Nri   c           	        >^ 0 mU4S jnU S S S2   n U (       Gaj  U" S[         R                  " U SS  S S S2   5      5      (       a  U SS 2	 M:  U SS  nU(       a)  U" S[        U5      5      (       a  U R                  5         Mo  U" S[        R                  " UT5      5      (       a  U R                  5         M  U" S[         R                  " U5      5      (       a  U R                  5         M  U" S[
        R                  " U5      5      (       a  U R                  5         GM  S[        U 5      * S   H  nX* S  S S S2   n[        R                  " U5      nUc  M)  U" S	U5      (       d   eX* S 2	 U (       aw  U S   R                  S
:X  ad  U S   R                  S:X  aQ  S[        U 5      * S   H>  nX* S S S S2   n[        R                  " U5      nUc  M)  U" SU5      (       d   eX* S 2	 M@       O   Wb  GM  U" S[        R                  " U5      5      (       ah  U R                  5         U SS  nU" S[        R                  " U5      5      (       a  U R                  5         OU" S[        R                  " U5      5        GMl  [        eTR                  S[        S   5      n	T H2  n
U
T;  d  M  U
S:w  d  M  [        U
R                  SS5         S   TU
'   M4     U	T4$ )Nc                 :   > Uc  gSU  3n U T;   a  [         eUTU '   g)NFzbackground-Tr   )r<   rM   rt   s     rD   add3expand_background.<locals>.parse_layer.<locals>.add  s0    } 'Dw##!GDMrF   r   repeatcolorimage
attachment)r   r   r   r	   positionr   r   )r   r   sizeoriginclipr   background_colorrH   _r   )r   single_valuer4   r   r   r   r   r   r   rM   r   r   r   r   replace)rB   final_layerr   rZ   nn_tokensr   r   
next_tokenr   r<   rt   rj   rY   s              @rD   parse_layer&expand_background.<locals>.parse_layer  s   	 "8$11&+dd2CDF F23K23KEs7L,?@@

7,99%JKK

8.;;EBCC

<!6!C!CE!JKK

!3v;,-0!"#;tt,.;;HE'z84444rs6":??i#?"2J,,3!'V!6A'-b}TrT':H#2#?#?#ID#/'*64'8'8 8'8$*23K "7  1  #8S--e455

#BC[
vs//
;<<JJL  0 0 78/A BD"D7"t/A'A .t||C/E Fq I # g~rF   T)r   r   r   )F)
r   ro   rp   expand_backgroundr\   r   reversedr   nextr   )rB   r<   rj   rs   rX   ru   r   layersr   
last_layerrL   rM   rt   r   layerr   rY   s     `             @rD   r   r     s=    0N !(G(("D- #  x9H6^<<v<<<>!!B BH nV,-F#DLdCE.8.>.>.@A.@
sG|.@GAv& ;;=KDM  ' )   4R4L   (
e
##a 	"R Bs&   A#D3'D+(AD3/D->A.D3-D3ztext-decoration-line
-thicknessc              #   (  #    / n/ n/ n/ nSnU  H  n[        U5      nUS;   a*  UR                  U5        U(       a  [        eUS:X  a  SnM<  M>  US;   a   U(       a  [        eUR                  U5        Md  [        U5      (       a   U(       a  [        eUR                  U5        M  [	        U/5      (       a   U(       a  [        eUR                  U5        M  [        e   U(       a  SU4v   U(       a  SU4v   U(       a  SU4v   U(       a  S	U4v   g
g
7f)z2Expand the ``text-decoration`` shorthand property.F)r   	underlineoverlinezline-throughblinkr   T)soliddoubledotteddashedwavyr   r   r   r   N)r   r   r   r   r6   )	rB   r<   liner   style	thicknessnone_in_linerZ   rs   s	            rD   expand_text_decorationr   
  s     DEEILe$PPKK##F"# #GG##LL##LL&w//##U#+ . tmooI%% s   DDc              #      #    [        U 5      nUR                  SS5      S   nUS;   a  X04v   gUS:X  a.  [        U S   R                  U S   R                  S5      nX4/4v   g[
        e7f)zExpand legacy ``page-break-before`` and ``page-break-after`` properties.

See https://www.w3.org/TR/css-break-3/#page-break-properties

rH   r	   )autoleftrightavoidalwaysr   pageN)r   splitr   source_linesource_columnr   )rB   r<   rs   rv   rZ   s        rD   expand_page_break_before_afterr   5  sw      !(Gzz#q!!$H44	H	1I!!6!9#:#:FDs   A'A)zpage-break-afterzbreak-afterc                     [        X5      $ )zlExpand legacy ``page-break-after`` property.

See https://www.w3.org/TR/css-break-3/#page-break-properties

r   rB   r<   s     rD   expand_page_break_afterr  G       *&77rF   zpage-break-beforezbreak-beforec                     [        X5      $ )zmExpand legacy ``page-break-before`` property.

See https://www.w3.org/TR/css-break-3/#page-break-properties

r   r  s     rD   expand_page_break_beforer  R  r  rF   zpage-break-insidebreak-insidec              #   F   #    [        U 5      nUS;   a  SU 4v   g[        e7f)zqExpand the legacy ``page-break-inside`` property.

See https://www.w3.org/TR/css-break-3/#page-break-properties

)r   r   r  N)r   r   rB   r<   rs   s      rD   expand_page_break_insider	  ]  s+      !(G##f$$s   !columnscolumn-widthcolumn-countc              #   f  #    Sn[        U 5      S:X  a  [        U S   5      S:X  a  U SSS2   n U  H5  n[        U/5      b	  US:w  a  SnO[        U/5      b  SnO[        eX/4v   M7     [        U 5      S:X  a8  US:X  a  SOSn[        U S   R                  U S   R                  S5      nX/4v   gg7f)	z*Expand the ``columns`` shorthand property.Nr   r   r   r   r  r  r	   )r   r   r!   r    r   r   r   r   )rB   r<   rZ   s      rD   expand_columnsr  l  s      D
6{aKq	2f<" ,1G!D5'".!DGm  6{a!%!7~^1I!!6!9#:#:FDGm	 s   B/B1zfont-variantz-alternatesz-capsz-east-asianz
-ligaturesz-numericc                     [        U 5      $ )zgExpand the ``font-variant`` shorthand property.

https://www.w3.org/TR/css-fonts-3/#font-variant-prop

r
   r  s     rD   font_variantr    s     v&&rF   font-variant-caps-weight-stretch-sizeline-height-familyc              #   ,  #    [        U 5      nUS;   a  [        S5      e[        [        U 5      5      n [	        S5       Hy  nU R                  5       n[        U5      S:X  a  M$  [        U/5      b  SnO2[        U/5      b  SnO"[        U/5      b  SnO[        U/5      b  S	nO  O4XT/4v   U (       a  Mu  [        e   U (       d  [        eU R                  5       n[        U/5      c  [        eS
U/4v   U (       d  [        eU R                  5       nUR                  S:X  a;  UR                  S:X  a+  U R                  5       n[        U/5      c  [        eSU/4v   OU R                  U5        U R!                  5         [#        U 5      c  [        eSU 4v   g7f)zWExpand the ``font`` shorthand property.

https://www.w3.org/TR/css-fonts-3/#font-prop

)captioniconmenuzmessage-boxzsmall-captionz
status-barzSystem fonts are not supportedr   normalNr   r  r  r  r  r   r   r  r  )r   r   r   r   ranger   r   r)   r*   r+   r(   r'   r   rM   r/   r   reverser&   )rB   r<   expand_font_keywordr   rZ   r   s         rD   expand_fontr     s     -V4 > ><== (6"#F 1X

u) ug*Fw'3$F%!-F5'".F gov+ . 

 %!
E7
 JJLEzzY5;;##5

w'eW$$ 	e NN6"
V
s   B-F3C!Fz	word-wrapoverflow-wrapc              #   @   #    [        U 5      nUc  [        eSU 4v   g7f)z`Expand the ``word-wrap`` legacy property.

See https://www.w3.org/TR/css-text-3/#overflow-wrap

Nr!  )r5   r   r  s      rD   expand_word_wrapr#    s'      F#G
6
!!   flex-grow-shrink-basisc           	   #     #    [        U 5      nUS:X  aM  U S   R                  U S   R                  pC[        X4SSS5      n[	        X4S5      nSU/4v   SU/4v   SU/4v   gSu  pxn	S	u  pnU  H  nUR
                  S
:H  =(       a'    UR                  S:H  =(       a    [        X45      (       + nU(       d  U(       d  [        U/5      nUb  Un	SnMc  U
(       d  [        U/5      nUc  [        eUnSn
M  U(       d  [        U/5      nUc  [        eUnSnM  [        e   U S   R                  U S   R                  pC[        U5      R                  5       (       a  [        U5      OSn[        U5      R                  5       (       a  [        U5      OSn[        X4UU[        U5      5      n[        X4UU[        U5      5      nU(       d  [        X4SSSS5      n	SU/4v   SU/4v   SU	/4v   g7f)zExpand the ``flex`` property.r   r   0r   r&  r'  r(  )r	   r	   N)FFFnumberNTpx)r   r   r   r   r   r   	int_valueallr"   r$   r   float
is_integerintstrr   )rB   r<   rs   r   column
zero_token
auto_tokengrowshrinkbasis
grow_foundshrink_foundbasis_foundrZ   forced_flex_factor	new_basisnew_grow
new_shrinkint_grow
int_shrink
grow_tokenshrink_tokens                         rD   expand_flexrD    s     !(G&ay,,fQi.E.Ef q!S9
f5

|##*%%$$(e0C-
+E 

h& 45??a+? 4233  '9&w/	(!E"&K+UG4#''#D!%J!-ug6
%'''F#'L##; < ay,,fQi.E.Ef %d 6 6 8 83t9d$)&M$<$<$>$>S[D
 tXs4yI
"&*c&k;"4AsDAE
|##,''s   G'G)z	flex-flowflex-direction	flex-wrapc              #     #    [        U 5      S:X  aZ  X SSS2   4 HG  n[        US   /5      n[        US   /5      nU(       d  M*  U(       d  M3  SUS   /4v   SUS   /4v     g   [        e[        U 5      S:X  aH  [        U S   /5      nU(       a  SU S   /4v   g[        U S   /5      nU(       a  SU S   /4v   g[        e[        e7f)z"Expand the ``flex-flow`` property.r   Nr   r   r	   rE  rF  )r   r#   r%   r   )rB   r<   sorted_tokens	directionwraps        rD   expand_flex_flowrK    s      6{a#DbD\1M&a(8'9:ImA./0DyTT&q)9(:::!M!$4#555 2  	V	"F1I;/	"VAYK//fQi[)D!F1I;..##s   ?C	C	A;C	c              #   t  #    U S   R                   U S   R                  p2[        X#S5      n[        U 5      S:X  a(  [	        U S   5      S:X  a  SU/4v   SU/4v   SU/4v   g / /nU  HJ  nUR
                  S:X  a#  UR                  S:X  a  UR                  / 5        M6  US	   R                  U5        ML     [        U5      S
:X  aU  [        US   5      n[        US   5      nU(       a,  U(       a  SUS   4v   SUS   4v   SU/4v   g US   n[        e[        e[        U5      S:X  a	  U/n[        e[        e7f)Nr   r   r	   -columns-rows-areasr   r   r   r   )
r   r   r   r   r   r   rM   r   r.   r   )	rB   r<   r   r3  r   slash_separatedrZ   rowsr
  s	            rD   _expand_grid_templaterR  ;  s[    !9((&)*A*A&dF+D
6{aKq	2f<4&  vodO::"u{{c'9""2&B&&u-	 
 ?q _Q/0 23 /!"444q111&&%a(G   	_		"&  s   D6D8grid-templaterM  rN  rO  c              #   6   #    [        X5       Sh  vN   g N7f)z&Expand the ``grid-template`` property.N)rR  r  s     rD   expand_grid_templaterU  ]  s      %V222s   gridz-template-columnsz-template-rows-template-areas-auto-columns
-auto-rows
-auto-flowc              #     #    U S   R                   U S   R                  p2[        X#S5      n[        X#S5      n[        X#S5      n[        X#S5      n [        [	        U S5      5      nU H   u  pSUR                  S5      S	    3U	4v   M"     S
U/4v   SU/4v   SU/4v   g! [         a     Of = f/ /n
U  HJ  nUR                  S:X  a#  UR                  S:X  a  U
R                  / 5        M6  U
S	   R                  U5        ML     [        U
5      S:w  a  [        eSnSn/ / S.n[        XR                  5       5      nU H  u  n u  nnSnU  H  n[        U5      S:X  a   U(       d  U(       a  UU:w  a  [        eUnUnM2  [        U5      S:X  a   U(       d  U(       a  UU:w  a  [        eSnUnMa  XS	   :X  a  UR                  U5        M|  [        e   M     U(       d  [        eUS:X  a  SOSnUS:X  a  UOUnSU(       a  UU4OU44v   SU S3[        X   5      4v   SU S3U/4v   SU S3U/4v   SU S3[        UU   5      4v   SU/4v   g7f)zExpand the ``grid`` property.r   r   r   rowr3  rS  z
-template-rH   r   rX  rY  rZ  Nr   r   r   )r\  r3  Fdensez	auto-flowTz-auto-srW  )r   r   r   tuplerR  r   r   r   rM   r   r   r   r   r   )rB   r<   r   r3  r   r   r\  templaterL   rM   split_tokensrZ   
auto_trackr]  	templatesiterabletracktrack_templatesauto_flow_tokennon_auto_trackauto_track_tokens                        rD   expand_gridrj  d  s    
 !9((&)*A*A&dF+DdF+D
T5
)Ch/F
.vGH #JCsyy~b123U:: #v%%TF""SE!!   4L::"u{{c'9#R&	 
 <AJEb)I<!23H,4((E5!W,ZJ%,?''"
U#{2"zjE6I''"&"
*$&&u-##  -5" (H4U(N!+x!7vS
%*	5!1A0CE E:,a
 %	(=">
>>>"!
$tf
,,zl!
$tf
,,~&a
(%	.0I*J
JJ
dV
##s+   AIB" &<I"
B/,I.B//F Ic              #     #    / /nU  HJ  nUR                   S:X  a#  UR                  S:X  a  UR                  / 5        M6  US   R                  U5        ML     S[        U5      s=::  a  U::  d   [        e  [        e/ nU H9  n [        U 5      =n(       d  [        eUR                  U5        [        U 5      v   M;     [        WR                  UR                  S5      n[        U5      =nS::  aV  [        US   S S 5      S 1:H  nU(       a  [        US   5      OU4n	UR                  U 5        UR                  US   5        U	v   USs=::  a  U:  a2  O  O/[        US   S S 5      S 1:H  nU(       a  [        US   5      OU4v   USs=::  a  U:  a3  O  g [        US   S S 5      S 1:H  nU(       a  [        US   5      OU4v   g g 7f)	Nr   r   r   r	   r   r   r   r   )r   rM   r   r   r   r-   r_  r   r   r   set)
rB   
max_number
grid_linesrZ   validations
validationr   linescustom_identrM   s
             rD   _expand_grid_column_row_arears    s    J::"u{{c'9b!2e$	 
 J-:- .K'//
/:&Fm	 
 e'')<)<fEDZ Q&;q>"1-.4&8(4jm$4'&!;q>*J;q>"1-.4&8&2eJqM"?J;q>"1-.4&8&2eJqM"? s   GGzgrid-columnzgrid-rowz-startz-endc              #   `   #    [        U S5      n[        US5       H  u  pSU 3U 4v   M     g7f)z,Expand the ``grid-[column|row]`` properties.r   )startendrH   Nrs  r   )rB   r<   tokens_listsides       rD   expand_grid_column_rowrz    s8     
 /vq9KK)9:$j&   ;s   ,.z	grid-areazgrid-row-startzgrid-row-endzgrid-column-startzgrid-column-endc              #   b   #    [        U S5      nSn[        X#5       H  u  pSU 3U 4v   M     g7f)z"Expand the ``grid-area`` property.r   )z	row-startzcolumn-startzrow-endz
column-endzgrid-Nrw  )rB   r<   rx  sidesry  s        rD   expand_grid_arear}    s:     
 /vq9KBEK/dVnf$$ 0s   -/zgrid-gapr,   
column-gaprow-gapc              #     #    [        U 5      S:X  a  [        U 5      c  [        eSU 4v   SU 4v   g[        U 5      S:X  a;  [        U SS 5      [        U SS 5      p2SX#4;   a  [        eSU SS 4v   SU SS 4v   g[        e7f)zExpand the ``gap`` property.r	   Nr  r~  r   r   )r   r,   r   )rB   r<   
column_gaprow_gaps       rD   
expand_gapr    s     
 6{av;F""	V	!&1+.F1QK0@GJ((!$$F1QK''s   A?Bzgrid-column-gapc              #   @   #    [        U 5      nUc  [        eSU 4v   g7f)z+Expand legacy ``grid-column-gap`` property.Nr~  r,   r   r  s      rD   expand_legacy_column_gapr    s&      &kG

r$  zgrid-row-gapc              #   @   #    [        U 5      nUc  [        eSU 4v   g7f)z(Expand legacy ``grid-row-gap`` property.Nr  r  r  s      rD   expand_legacy_row_gapr    s&      &kG
V
r$  zplace-contentzalign-contentzjustify-contentc                     [         e)z&Expand the ``place-content`` property.r   r  s     rD   expand_place_contentr    
    
 rF   zplace-itemszalign-itemszjustify-itemsc                     [         e)z$Expand the ``place-items`` property.r   r  s     rD   expand_place_itemsr    r  rF   z
place-selfz
align-selfzjustify-selfc                     [         e)z#Expand the ``place-self`` property.r   r  s     rD   expand_place_selfr    r  rF   z
line-clamp	max-linescontinueblock-ellipsisc              #     #    [        U 5      S:X  a  [        U 5      nUS:X  aK  U S   R                  U S   R                  pC[	        X4S5      n[	        X4S5      nSU/4v   SU/4v   SU/4v   g	U S   R
                  S:X  a^  U S   R                  bN  U S   R                  U S   R                  pC[	        X4S5      n[	        X4S
5      nSU S   /4v   SU/4v   SU/4v   g	[        e[        U 5      S:X  a  U S   R
                  S:X  as  U S   R                  n[        U S   /5      n	U(       aH  U	bE  U S   R                  U S   R                  pC[	        X4S
5      nSU S   /4v   SU/4v   SU S   /4v   g	[        e[        e[        e7f)z#Expand the ``line-clamp`` property.r	   r   r   r   r  r  r  r+  Ndiscardr   )	r   r   r   r   r   r   r-  r   r   )
rB   r<   rs   r   r3  r   r5  discard_token	max_linesellipsiss
             rD   expand_line_clampr    s     6{a$V,f!!900&)2I2I&#D&9J#D&9J
|++zl**"ZL00AY^^x'F1I,?,?,K!!900&)2I2I&#D&9J&tY?Mq	{**}o--"ZL00	V	!9>>X%q	++I%vayk2HX1%ay44fQi6M6Mf *4 C!F1I;.. =/11&33##s   FFz
text-align-all-lastc              #   H  #    [        U 5      S:X  a  [        U 5      nUc  [        eUS:X  a*  U S   R                  U S   R                  pC[        X4S5      nOU S   nSU/4v   US:X  a*  U S   R                  U S   R                  pC[        X4S5      nOUnSU/4v   g[        e7f)	z#Expand the ``text-align`` property.r	   Nzjustify-allr   justifyr  ru  r  )r   r   r   r   r   r   )rB   r<   rs   r   r3  	align_all
align_lasts          rD   expand_text_alignr  >  s      6{a$V,?m#!!900&)2I2I&"4;Iq	Iyk!!i!!900&)2I2I&#D':J"J
|##s   B B")_rT   ro   tinycss2.astr   r   r   tinycss2.color4r   
propertiesr   descriptorsr   utilsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r_   r9   r\   rX   r   r   r   r   r   r   r   r   r   r   r   r  r  r	  r  r  r   r#  rD  rK  rR  rU  rj  rs  rz  r}  r  r  r  r  r  r  r  r  rd   rF   rD   <module>r     s"   $  @ @ ' ' , T T T T T T T T T T 	g >=&@ 
.	.	.	(	)	'!      !H 
/7 "="	 
"J 
,';F& G &R 
(  
,	.	/	-	-	)(Hh/ 0      $ 
.)Y)X!%': ' : z 
-)Y)Xw!%'< ' < ~ 
,c$ c$L 

'8X|<&& = &&R$ 

- 8 ! 8 

.!8 " 8 

.!
 " 
 
)..1 2 ( 
.--k+'+ ' 
&(OY
G,C, CL 
+/"	" # 	" 
&'9h/5  0 5 p 
+"K0 1 4D 
/*gx03 1 3
 
&%'79J!<?9$? 9$x@< 
-	*(F#! $  ! 
+"N%'8:%: % 
*	%,	* +  " 

,    
.)   
//#45 6  
--1 2  
,,/ 0  
,+z+;<# = #L 
,&'" # rF   