Ë
    ©2Úi?j  ã                   óØ  — d Z ddlZddlmZ  G d„ d«      Z G d„ de«      Z G d	„ d
e«      Z G d„ de«      Z G d„ dee«      Z G d„ de«      Z	 G d„ de«      Z
 G d„ de
e«      Z G d„ de
«      Z G d„ de
«      Z G d„ dee«      Z G d„ de«      Z G d„ dee«      Z G d„ d ee«      Z G d!„ d"ee«      Z G d#„ d$e«      Z G d%„ d&e«      Z G d'„ d(e«      Z G d)„ d*e«      Z G d+„ d,e«      Z G d-„ d.e«      Z G d/„ d0e«      Z G d1„ d2e«      Z G d3„ d4e«      Z G d5„ d6e«      Z G d7„ d8e«      Z G d9„ d:ee«      Z G d;„ d<ee
«      Z G d=„ d>e«      Z  G d?„ d@e e«      Z! G dA„ dBe e
«      Z"y)CuÓ  Classes for all types of boxes in the CSS formatting structure / box model.

See https://www.w3.org/TR/CSS21/visuren.html

Names are the same as in CSS 2.1 with the exception of ``TextBox``. In
WeasyPrint, any text is in a ``TextBox``. What CSS calls anonymous inline boxes
are text boxes but not all text boxes are anonymous inline boxes.

See https://www.w3.org/TR/CSS21/visuren.html#anonymous

Abstract classes, should not be instantiated:

* Box
* BlockLevelBox
* InlineLevelBox
* BlockContainerBox
* ReplacedBox
* ParentBox
* AtomicInlineLevelBox

Concrete classes:

* PageBox
* BlockBox
* InlineBox
* InlineBlockBox
* BlockReplacedBox
* InlineReplacedBox
* TextBox
* LineBox
* Various table-related Box subclasses

All concrete box classes whose name contains "Inline" or "Block" have one of
the following "outside" behavior:

* Block-level (inherits from :class:`BlockLevelBox`)
* Inline-level (inherits from :class:`InlineLevelBox`)

and one of the following "inside" behavior:

* Block container (inherits from :class:`BlockContainerBox`)
* Inline content (InlineBox and :class:`TextBox`)
* Replaced content (inherits from :class:`ReplacedBox`)

â€¦ with various combinasions of both.

See respective docstrings for details.

é    Né   )ÚAnonymousStylec                   óL  — e Zd ZdZdZdZdZdZdZdZ	dZ
dZdZdZdZdZdZdZdZdZdZdZdZdZd„ Zd)d„Zd„ Zd„ Zed„ «       Zd	„ Zd
„ Zd*d„Z d„ Z!d„ Z"d„ Z#d„ Z$d„ Z%d„ Z&d„ Z'd„ Z(d„ Z)d„ Z*d„ Z+d„ Z,d„ Z-d„ Z.d„ Z/d„ Z0d„ Z1d„ Z2d„ Z3d„ Z4d „ Z5d!„ Z6d"„ Z7d#„ Z8d$„ Z9d%„ Z:d&„ Z;d'„ Z<d(„ Z=y)+ÚBoxz"Abstract base class for all boxes.FNc                 ó   — | j                   S ©N)Úchildren©Úselfs    ú\/var/www/html/acx/venv/lib/python3.12/site-packages/weasyprint/formatting_structure/boxes.pyÚall_childrenzBox.all_childrenX   s   € Ø�}‰}Ðó    c              #   óš   K  — | –— | j                   D ]2  }|st        |t        «      r|j                  |«      E d{  –—†  Œ/|–— Œ4 y7 Œ­w)z9A flat generator for a box, its children and descendants.N)r	   Ú
isinstancer   Údescendants)r   ÚplaceholdersÚchilds      r   r   zBox.descendants[   sF   è ø€ àŠ
Ø—]‘]ò 	ˆEÙœz¨%´Ô5Ø ×,Ñ,¨\Ó:×:Ñ:à“ñ		à:ús   ‚:A¼A	½Ac                 óv   — || _         || _        || _        t        «       | _        g | _        d | _        d | _        y r   )Úelement_tagÚelementÚstyleÚsetÚremove_decoration_sidesr	   Úfirst_letter_styleÚfirst_line_style)r   r   r   r   s       r   Ú__init__zBox.__init__d   s9   € Ø&ˆÔØˆŒØˆŒ
Ü'*£uˆÔ$ØˆŒØ"&ˆÔØ $ˆÕr   c                 óN   — dt        | «      j                  › d| j                  › d�S ©Nú<ú ú>)ÚtypeÚ__name__r   r
   s    r   Ú__repr__zBox.__repr__m   s)   € Ø”4˜“:×&Ñ&Ð' q¨×)9Ñ)9Ð(:¸!Ð<Ð<r   c                 óp   — t        |j                  «      } | |j                  ||j                  g|¢­i |¤ŽS )z6Return an anonymous box that inherits from ``parent``.)r   r   r   r   )ÚclsÚparentÚargsÚkwargsr   s        r   Úanonymous_fromzBox.anonymous_fromp   s5   € ô ˜vŸ|™|Ó,ˆÙ�6×%Ñ% u¨f¯n©nÐN¸tÒNÀvÑNÐNr   c                 óˆ   — t        | «      }|j                  |«      }|j                  j                  | j                  «       |S )zReturn shallow copy of the box.)r"   Ú__new__Ú__dict__Úupdate)r   r&   Únew_boxs      r   ÚcopyzBox.copyv   s8   € ä�4‹jˆð —+‘+˜cÓ"ˆà×Ñ×Ñ §¡Ô.Øˆr   c                 ó"   — | j                  «       S )z?Return a copy of the box with recursive copies of its children.)r0   r
   s    r   ÚdeepcopyzBox.deepcopy€   s   € à�y‰y‹{Ðr   c                 óè   — ||cxk(  rdk(  ry | xj                   |z  c_         | xj                  |z  c_        | j                  «       D ](  }|r|j                  «       rŒ|j	                  |||«       Œ* y)uc   Change the boxâ€™s position.

        Also update the childrenâ€™s positions accordingly.

        r   N)Ú
position_xÚ
position_yr   Ú
is_floatedÚ	translate)r   ÚdxÚdyÚignore_floatsr   s        r   r7   zBox.translate„   si   € ð �Œ=�qŠ=Øð à�Š˜2Ñ�Ø�Š˜2Ñ�Ø×&Ñ&Ó(ò 	7ˆEÙ! e×&6Ñ&6Õ&8Ø—‘  B¨Õ6ñ	7r   c                 óN   — | j                   | j                  z   | j                  z   S )zWidth of the padding box.)ÚwidthÚpadding_leftÚpadding_rightr
   s    r   Úpadding_widthzBox.padding_width•   s"   € à�z‰z˜D×-Ñ-Ñ-°×0BÑ0BÑBÐBr   c                 óN   — | j                   | j                  z   | j                  z   S )zHeight of the padding box.)ÚheightÚpadding_topÚpadding_bottomr
   s    r   Úpadding_heightzBox.padding_height™   s"   € à�{‰{˜T×-Ñ-Ñ-°×0CÑ0CÑCÐCr   c                 óV   — | j                  «       | j                  z   | j                  z   S )zWidth of the border box.)r?   Úborder_left_widthÚborder_right_widthr
   s    r   Úborder_widthzBox.border_width�   s,   € à×!Ñ!Ó# d×&<Ñ&<Ñ<Ø×#Ñ#ñ$ð 	$r   c                 óV   — | j                  «       | j                  z   | j                  z   S )zHeight of the border box.)rD   Úborder_top_widthÚborder_bottom_widthr
   s    r   Úborder_heightzBox.border_height¢   s,   € à×"Ñ"Ó$ t×'<Ñ'<Ñ<Ø×$Ñ$ñ%ð 	%r   c                 óV   — | j                  «       | j                  z   | j                  z   S )z)Width of the margin box (aka. outer box).)rH   Úmargin_leftÚmargin_rightr
   s    r   Úmargin_widthzBox.margin_width§   s'   € à× Ñ Ó" T×%5Ñ%5Ñ5¸×8IÑ8IÑIÐIr   c                 óV   — | j                  «       | j                  z   | j                  z   S )z*Height of the margin box (aka. outer box).)rL   Ú
margin_topÚmargin_bottomr
   s    r   Úmargin_heightzBox.margin_height«   s%   € à×!Ñ!Ó# d§o¡oÑ5¸×8JÑ8JÑJÐJr   c                 óh   — | j                   | j                  z   | j                  z   | j                  z   S )z0Absolute horizontal position of the content box.)r4   rN   r=   rF   r
   s    r   Úcontent_box_xzBox.content_box_x±   s2   € à�‰ ×!1Ñ!1Ñ1°D×4EÑ4EÑEØ×"Ñ"ñ#ð 	#r   c                 óh   — | j                   | j                  z   | j                  z   | j                  z   S )z.Absolute vertical position of the content box.)r5   rR   rB   rJ   r
   s    r   Úcontent_box_yzBox.content_box_y¶   s0   € à�‰ §¡Ñ0°4×3CÑ3CÑCØ×!Ñ!ñ"ð 	"r   c                 óN   — | j                   | j                  z   | j                  z   S )z0Absolute horizontal position of the padding box.)r4   rN   rF   r
   s    r   Úpadding_box_xzBox.padding_box_x»   s"   € à�‰ ×!1Ñ!1Ñ1°D×4JÑ4JÑJÐJr   c                 óN   — | j                   | j                  z   | j                  z   S )z.Absolute vertical position of the padding box.)r5   rR   rJ   r
   s    r   Úpadding_box_yzBox.padding_box_y¿   s    € à�‰ §¡Ñ0°4×3HÑ3HÑHÐHr   c                 ó4   — | j                   | j                  z   S )z/Absolute horizontal position of the border box.)r4   rN   r
   s    r   Úborder_box_xzBox.border_box_xÃ   s   € à�‰ ×!1Ñ!1Ñ1Ð1r   c                 ó4   — | j                   | j                  z   S )z-Absolute vertical position of the border box.)r5   rR   r
   s    r   Úborder_box_yzBox.border_box_yÇ   s   € à�‰ §¡Ñ0Ð0r   c                 ó~   — | j                  «       | j                  «       | j                  «       | j                  «       fS ©z=Return the (x, y, w, h) rectangle where the box is clickable.)r^   r`   rH   rL   r
   s    r   Úhit_areazBox.hit_areaË   s<   € ð
 ×!Ñ!Ó# T×%6Ñ%6Ó%8Ø×!Ñ!Ó# T×%7Ñ%7Ó%9ð;ð 	;r   c           
      óò  — | j                   \  }}| j                  \  }}| j                  \  }	}
| j                  \  }}t	        d||z
  «      }t	        d||z
  «      }t	        d||z
  «      }t	        d||z
  «      }t	        d|	|z
  «      }	t	        d|
|z
  «      }
t	        d||z
  «      }t	        d||z
  «      }| j                  «       |z   }| j                  «       |z   }| j                  «       |z
  |z
  }| j                  «       |z
  |z
  }t        dg|||z   f|||	z   f|||z   f|||
z   ffD ��cg c]  \  }}|dkD  r||z  ‘Œ c}}z   «      }||||||z  ||z  f||z  ||z  f|	|z  |
|z  f||z  ||z  ffS c c}}w )z¹Position, size and radii of a box inside the outer border box.

        bt, br, bb, and bl are distances from the outer border box,
        defining a rectangle to be rounded.

        r   é   )
Úborder_top_left_radiusÚborder_top_right_radiusÚborder_bottom_right_radiusÚborder_bottom_left_radiusÚmaxr^   r`   rH   rL   Úmin)r   ÚbtÚbrÚbbÚblÚtlrxÚtlryÚtrrxÚtrryÚbrrxÚbrryÚblrxÚblryÚxÚyr<   rA   ÚextentÚ	sum_radiiÚratios                       r   Úrounded_boxzBox.rounded_boxÓ   sá  € ð ×0Ñ0‰
ˆˆdØ×1Ñ1‰
ˆˆdØ×4Ñ4‰
ˆˆdØ×3Ñ3‰
ˆˆdä�1�d˜R‘iÓ ˆÜ�1�d˜R‘iÓ ˆÜ�1�d˜R‘iÓ ˆÜ�1�d˜R‘iÓ ˆÜ�1�d˜R‘iÓ ˆÜ�1�d˜R‘iÓ ˆÜ�1�d˜R‘iÓ ˆÜ�1�d˜R‘iÓ ˆà×ÑÓ "Ñ$ˆØ×ÑÓ "Ñ$ˆØ×!Ñ!Ó# bÑ(¨2Ñ-ˆØ×#Ñ#Ó%¨Ñ*¨RÑ/ˆô �Q�Cð ˜˜t™Ð$Ø˜˜t™Ð$Ø˜ ™Ð%Ø˜ ™Ð%ð	&÷	
á!�˜	ð ˜1Š}ð �YÓó	
ñ 	
ó 	ˆð ˆq�%˜Ø�E‰\˜4 %™<Ð(Ø�E‰\˜4 %™<Ð(Ø�E‰\˜4 %™<Ð(Ø�E‰\˜4 %™<Ð(ð*ð 	*ùó	
s   Ä+E3c                 ó’   — | j                  | j                  |z  | j                  |z  | j                  |z  | j                  |z  «      S r   ©r}   rJ   rG   rK   rF   )r   r|   s     r   Úrounded_box_ratiozBox.rounded_box_ratio   sM   € Ø×ÑØ×!Ñ! EÑ)Ø×#Ñ# eÑ+Ø×$Ñ$ uÑ,Ø×"Ñ" UÑ*ó	,ð 	,r   c                 óz   — | j                  | j                  | j                  | j                  | j                  «      S )z?Return the position, size and radii of the rounded padding box.r   r
   s    r   Úrounded_padding_boxzBox.rounded_padding_box  s9   € à×ÑØ×!Ñ!Ø×#Ñ#Ø×$Ñ$Ø×"Ñ"ó	$ð 	$r   c                 ó*   — | j                  dddd«      S )z>Return the position, size and radii of the rounded border box.r   )r}   r
   s    r   Úrounded_border_boxzBox.rounded_border_box  s   € à×Ñ  1 a¨Ó+Ð+r   c                 óâ   — | j                  | j                  | j                  z   | j                  | j                  z   | j
                  | j                  z   | j                  | j                  z   «      S )z?Return the position, size and radii of the rounded content box.)	r}   rJ   rB   rG   r>   rK   rC   rF   r=   r
   s    r   Úrounded_content_boxzBox.rounded_content_box  se   € à×ÑØ×!Ñ! D×$4Ñ$4Ñ4Ø×#Ñ# d×&8Ñ&8Ñ8Ø×$Ñ$ t×':Ñ':Ñ:Ø×"Ñ" T×%6Ñ%6Ñ6ó	8ð 	8r   c                 ó$   — | j                   d   dv S )z#Return whether this box is floated.Úfloat)ÚleftÚright©r   r
   s    r   r6   zBox.is_floated  s   € à�z‰z˜'Ñ"Ð&7Ð7Ð7r   c                 ó&   — | j                   d   dk(  S )z&Return whether this box is a footnote.rˆ   Úfootnoter‹   r
   s    r   Úis_footnotezBox.is_footnote!  s   € à�z‰z˜'Ñ" jÑ0Ð0r   c                 ó$   — | j                   d   dv S )z>Return whether this box is in the absolute positioning scheme.Úposition)ÚabsoluteÚfixedr‹   r
   s    r   Úis_absolutely_positionedzBox.is_absolutely_positioned%  s   € à�z‰z˜*Ñ%Ð)>Ð>Ð>r   c                 ó,   — | j                   d   d   dk(  S )z-Return whether this box is a running element.r�   r   z	running()r‹   r
   s    r   Ú
is_runningzBox.is_running)  s   € à�z‰z˜*Ñ% aÑ(¨KÑ7Ð7r   c                 ó�   — | j                  «       xs4 | j                  «       xs" | j                  «       xs | j                  «        S )z*Return whether this box is in normal flow.)r6   r“   r•   rŽ   r
   s    r   Úis_in_normal_flowzBox.is_in_normal_flow-  sH   € ð �O‰OÓò 4 ×!>Ñ!>Ó!@ò 4Ø�O‰OÓò4Ø!%×!1Ñ!1Ó!3ð5ð 	5r   c                 ó¼   — t        | t        «      xsK t        | t        «      xs9 | j                  d   dv xs& | j                  d   dk(  xr | j                  d   dk7  S )z&Return whether this box is monolithic.Úoverflow)ÚautoÚscrollÚhiddenrA   rš   )r   ÚAtomicInlineLevelBoxÚReplacedBoxr   r
   s    r   Úis_monolithiczBox.is_monolithic3  sh   € ô �tÔ1Ó2ò -Ü�tœ[Ó)ò-à�J‰J�zÑ"Ð&8Ð8ò-ð �Z‰Z˜
Ñ# xÑ/ò ,Ø�Z‰Z˜Ñ! VÑ+ð	.r   c                 ó  — | j                  «       xs| | j                  «       xsj | j                  xs\ t        | t        «      xr t        | t
        «       xs7 t        | t
        «      xr | j                  d   dk7  xs d| j                  d   v S )z?Return whether this box establishes a block formatting context.r™   Úvisiblez	flow-rootÚdisplay)r6   r“   Ú	is_columnr   ÚBlockContainerBoxÚBlockBoxr   r
   s    r   Úestablishes_formatting_contextz"Box.establishes_formatting_context=  s�   € ð �O‰OÓò 1Ø×)Ñ)Ó+ò1à�N‰Nò1ô ˜Ô/Ó0ÒS¼ÀDÌ(Ó9SÐ5Sò1ô ˜œhÓ'ÒO¨D¯J©J°zÑ,BÀiÑ,Oò	1ð
 ˜4Ÿ:™: iÑ0Ð0ð	2r   c                 ó>   — | j                   d   | j                   d   fS )z!Return start and end page values.Úpager‹   r
   s    r   Úpage_valueszBox.page_valuesJ  s   € à—
‘
˜6Ñ" D§J¡J¨vÑ$6Ð7Ð7r   c                 ó€   — ddl m} | j                  �,| j                  j                  dk(  r || j                  d«      S y)z>Return whether this link should be stored as a PDF attachment.r   )Úelement_has_link_typeÚaÚ
attachmentF)Úhtmlr«   r   Útag)r   r«   s     r   Úis_attachmentzBox.is_attachmentP  s4   € å0à�<‰<Ð#¨¯©×(8Ñ(8¸CÒ(?Ù(¨¯©°|ÓDÐDØr   c                 óž   — | j                   d   dk(  r;| j                  �/| j                  j                  dv rt        | t        t
        f«       S y)z(Return whether this box is a form input.Ú
appearancerš   )ÚbuttonÚinputÚselectÚtextareaF)r   r   r¯   r   ÚLineBoxÚTextBoxr
   s    r   Úis_inputzBox.is_inputZ  sI   € ð �:‰:�lÑ# vÒ-°$·,±,Ð2JØ�|‰|×ÑÐ#LÑLÜ% d¬W´gÐ,>Ó?Ð?Ð?Ør   c                 óN   — | j                   €y| j                   j                  dk(  S )z*Return whether this box is a form element.FÚform)r   r¯   r
   s    r   Úis_formzBox.is_formb  s$   € à�<‰<ÐØØ�|‰|×Ñ 6Ñ)Ð)r   )F©r   r   F)>r#   Ú
__module__Ú__qualname__Ú__doc__Úproper_table_childÚinternal_table_or_captionÚtabular_containerÚleading_collapsible_spaceÚtrailing_collapsible_spaceÚis_table_wrapperÚis_flex_itemÚis_grid_itemÚis_for_root_elementr£   Ú	is_leaderÚis_outside_markerÚtransformation_matrixÚbookmark_labelÚ
string_setr�   Úcached_counter_valuesÚmissing_linkÚlink_annotationÚforce_fragmentationr   r   r   r$   Úclassmethodr*   r0   r2   r7   r?   rD   rH   rL   rP   rT   rV   rX   rZ   r\   r^   r`   rc   r}   r€   r‚   r„   r†   r6   rŽ   r“   r•   r—   rŸ   r¦   r©   r°   r¹   r¼   © r   r   r   r   8   sM  „ Ù,ð ÐØ %ÐØÐð !&ÐØ!&Ðð ÐØ€LØ€LØÐØ€IØ€IØÐð !ÐØ€NØ€JØ€HØ ÐØ€LØ€OØÐòóò%ò=ð ñOó ðOò
òó7ò"CòDò$ò
%ò
JòKò#ò
"ò
KòIò2ò1ò;ò+*òZ,ò$ò,ò8ò8ò1ò?ò8ò5ò.ò	2ò8òòó*r   r   c                   óV   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	ˆ fd„Z
d	„ Zd
„ Zˆ xZS )Ú	ParentBoxzA box that has children.c                 óH   •— t         ‰| �  |||«       t        |«      | _        y r   )Úsuperr   Útupler	   ©r   r   r   r   r	   Ú	__class__s        €r   r   zParentBox.__init__k  s   ø€ Ü‰Ñ˜ e¨WÔ5Ü˜h›ˆ�r   c                 óœ   — | j                   j                  |«       t        | d|› �d«       t        | d|› �d«       t        | d|› d�d«       y)z4Set to 0 the margin, padding and border of ``side``.Úmargin_r   Úpadding_Úborder_Ú_widthN)r   ÚaddÚsetattr©r   Úsides     r   Ú_reset_spacingzParentBox._reset_spacingo  sQ   € à×$Ñ$×(Ñ(¨Ô.Ü�˜ ˜vÐ&¨Ô*Ü�˜  Ð'¨Ô+Ü�˜ ˜v VÐ,¨aÕ0r   c                 óx   — | j                   d   dk(  ry |r| j                  d«       |r| j                  d«       y y )NÚbox_decoration_breakÚcloneÚtopÚbottom©r   rå   )r   ÚstartÚends      r   Úremove_decorationzParentBox.remove_decorationv  s>   € Ø�:‰:Ð,Ñ-°Ò8ØÙØ×Ñ Ô&ÙØ×Ñ Õ)ð r   c                 óR   — | j                  «       }||_        t        «       | _        |S )z8Create a new equivalent box with given ``new_children``.)r0   r	   r   r   )r   Únew_childrenr/   s      r   Úcopy_with_childrenzParentBox.copy_with_children~  s&   € à—)‘)“+ˆØ'ˆÔô (+£uˆÔ$àˆr   c                 óh   — | j                  «       }t        d„ | j                  D «       «      |_        |S )Nc              3   ó<   K  — | ]  }|j                  «       –— Œ y ­wr   )r2   )Ú.0r   s     r   ú	<genexpr>z%ParentBox.deepcopy.<locals>.<genexpr>‹  s   è ø€ ÒK°E˜uŸ~™~×/ÑKùs   ‚)r0   Úlistr	   )r   Úresults     r   r2   zParentBox.deepcopy‰  s(   € Ø—‘“ˆÜÑK¸T¿]¹]ÔKÓKˆŒØˆr   c                 ó~   — | j                   sJ ‚| j                  D ]  }t        |t        «      sŒ|c S  t	        d«      ‚)z!Get the table wrapped by the box.zTable wrapper without a table)rÆ   r	   r   ÚTableBoxÚ
ValueError)r   r   s     r   Úget_wrapped_tablezParentBox.get_wrapped_tableŽ  sA   € à×$Ò$Ð$Ð$Ø—]‘]ò 	>ˆEÜ˜%¤Õ*Ø’ð	>ô Ð<Ó=Ð=r   c                 ón  •— t         ‰| �  «       \  }}| j                  D �cg c]  }|j                  «       sŒ|‘Œ }}|rot	        |«      dk(  r)|d   j                  «       }|d   xs |}|d   xs |}||fS |d   |d   }}|j                  «       d   xs |}|j                  «       d   xs |}||fS c c}w )Nre   r   éÿÿÿÿ)rØ   r©   r	   r—   Úlen)	r   Ústart_valueÚ	end_valuer   r	   r©   Ú	start_boxÚend_boxrÛ   s	           €r   r©   zParentBox.page_values—  sá   ø€ Ü!&¡Ñ!4Ó!6Ñˆ�Yð
  $Ÿ}™}öKØ°×0GÑ0GÕ0IŠEðKˆð KáÜ�8‹} Ò!Ø& q™k×5Ñ5Ó7�Ø)¨!™nÒ;°�Ø'¨™NÒ7¨i�	ð
 ˜IÐ%Ð%ð &.¨a¡[°(¸2±,˜7�	Ø'×3Ñ3Ó5°aÑ8ÒG¸K�Ø#×/Ñ/Ó1°!Ñ4ÒA¸	�	Ø˜IÐ%Ð%ùòKs
   ¡B2·B2c                 óÌ   — | j                   xsV | j                  xsH | j                  xs: | j                  xs, | j	                  «       xs | j
                  xs | j                   S r   )rJ   rB   rÇ   rÈ   r¦   rÆ   rÉ   r
   s    r   Útop_margin_collapseszParentBox.top_margin_collapses©  so   € à×!Ñ!ò % T×%5Ñ%5ò %Ø×Ñò%Ø!%×!2Ñ!2ò%à×/Ñ/Ó1ò%ð ×!Ñ!ò%ð ×$Ñ$ð&ð 	&r   c                 óÌ   — | j                   xsV | j                  xsH | j                  xs: | j                  xs, | j	                  «       xs | j
                  xs | j                   S r   )rK   rC   rÇ   rÈ   r¦   rÆ   rÉ   r
   s    r   Úbottom_margin_collapsesz!ParentBox.bottom_margin_collapses±  so   € à×$Ñ$ò %¨×(;Ñ(;ò %Ø×Ñò%Ø!%×!2Ñ!2ò%à×/Ñ/Ó1ò%ð ×!Ñ!ò%ð ×$Ñ$ð&ð 	&r   )r#   r¾   r¿   rÀ   r   rå   rî   rñ   r2   rû   r©   r  r  Ú__classcell__©rÛ   s   @r   rÖ   rÖ   i  s3   ø„ Ù"ô(ò1ò*ò	òò
>ô&ò$&ö&r   rÖ   c                   ó   — e Zd ZdZdZy)ÚBlockLevelBoxz°A box that participates in an block formatting context.

    An element with a ``display`` value of ``block``, ``list-item`` or
    ``table`` generates a block-level box.

    N)r#   r¾   r¿   rÀ   Ú	clearancerÔ   r   r   r
  r
  º  s   „ ñð �Ir   r
  c                   ó   — e Zd ZdZy)r¤   aj  A box that contains only block-level boxes or only line boxes.

    A box that either contains only block-level boxes or establishes an inline
    formatting context and thus contains only line boxes.

    A non-replaced element with a ``display`` value of ``block``,
    ``list-item``, ``inline-block`` or 'table-cell' generates a block container
    box.

    N©r#   r¾   r¿   rÀ   rÔ   r   r   r¤   r¤   Ä  s   „ ò	r   r¤   c                   ó   — e Zd ZdZy)r¥   z£A block-level box that is also a block container.

    A non-replaced element with a ``display`` value of ``block``, ``list-item``
    generates a block box.

    Nr  rÔ   r   r   r¥   r¥   Ñ  ó   „ òr   r¥   c                   ó4   ‡ — e Zd ZdZdZdZeˆ fd„«       Zˆ xZS )r·   aK  A box that represents a line in an inline formatting context.

    Can only contain inline-level boxes.

    In early stages of building the box tree a single line box contains many
    consecutive inline boxes. Later, during layout phase, each line boxes will
    be split into multiple line boxes, one for each actual line.

    ÚclipÚnonec                 óz   •— t        ‰| �  |g|¢­i |¤Ž}|j                  d   dk7  r|j                  d   |_        |S )Nr™   r¡   Útext_overflow)rØ   r*   r   r  )r&   r'   r(   r)   ÚboxrÛ   s        €r   r*   zLineBox.anonymous_fromç  sC   ø€ ä‰gÑ$ VÐ=¨dÒ=°fÑ=ˆØ�<‰<˜
Ñ# yÒ0Ø &§¡¨_Ñ =ˆCÔØˆ
r   )	r#   r¾   r¿   rÀ   r  Úblock_ellipsisrÓ   r*   r  r  s   @r   r·   r·   Ú  s&   ø„ ñð €MØ€Nàóó ôr   r·   c                   ó   — e Zd ZdZd„ Zy)ÚInlineLevelBoxaQ  A box that participates in an inline formatting context.

    An inline-level box that is not an inline box is said to be "atomic". Such
    boxes are inline blocks, replaced elements and inline tables.

    An element with a ``display`` value of ``inline``, ``inline-table``, or
    ``inline-block`` generates an inline-level box.

    c                 ó¬   — | j                   d   dk(  ry | j                   d   dk(  }|r| j                  |rdnd«       |r| j                  |rdnd«       y y )Nrç   rè   Ú	directionÚltrr‰   rŠ   rë   )r   rì   rí   r  s       r   rî   z InlineLevelBox.remove_decorationù  sY   € Ø�:‰:Ð,Ñ-°Ò8ØØ�j‰j˜Ñ%¨Ñ.ˆÙØ×Ñ©#¡°7Ô;ÙØ×Ñ©3¡°FÕ;ð r   N)r#   r¾   r¿   rÀ   rî   rÔ   r   r   r  r  ï  s   „ ñó<r   r  c                   ó   — e Zd ZdZd„ Zy)Ú	InlineBoxa  An inline box with inline children.

    A box that participates in an inline formatting context and whose content
    also participates in that inline formatting context.

    A non-replaced element with a ``display`` value of ``inline`` generates an
    inline box.

    c                 óv   — | j                  «       | j                  | j                  «       | j                  «       fS rb   )r^   r5   rH   rT   r
   s    r   rc   zInlineBox.hit_area  s7   € ð ×!Ñ!Ó# T§_¡_Ø×!Ñ!Ó# T×%7Ñ%7Ó%9ð;ð 	;r   N)r#   r¾   r¿   rÀ   rc   rÔ   r   r   r  r    s   „ ñó;r   r  c                   ó,   ‡ — e Zd ZdZdZˆ fd„Zd„ Zˆ xZS )r¸   z²A box that contains only text and has no box children.

    Any text in the document ends up in a text box. What CSS calls "anonymous
    inline boxes" are also text boxes.

    r   c                 ó>   •— |sJ ‚t         ‰| �  |||«       || _        y r   )rØ   r   Útext)r   r   r   r   r!  rÛ   s        €r   r   zTextBox.__init__  s"   ø€ ÙˆˆtÜ‰Ñ˜ e¨WÔ5Øˆ�	r   c                 ó<   — |sJ ‚| j                  «       }||_        |S )z?Return a new TextBox identical to this one except for the text.)r0   r!  )r   r!  r/   s      r   Úcopy_with_textzTextBox.copy_with_text"  s    € áˆˆtØ—)‘)“+ˆØˆŒØˆr   )r#   r¾   r¿   rÀ   Újustification_spacingr   r#  r  r  s   @r   r¸   r¸     s   ø„ ñð Ðôö
r   r¸   c                   ó   — e Zd ZdZy)r�   zpAn atomic box in an inline formatting context.

    This inline-level box cannot be split for line breaks.

    Nr  rÔ   r   r   r�   r�   *  ó   „ òr   r�   c                   ó   — e Zd ZdZy)ÚInlineBlockBoxzëA box that is both inline-level and a block container.

    It behaves as inline on the outside and as a block on the inside.

    A non-replaced element with a 'display' value of 'inline-block' generates
    an inline-block box.

    Nr  rÔ   r   r   r(  r(  2  s   „ òr   r(  c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )rž   u£   A box whose content is replaced.

    For example, ``<img>`` are replaced: their content is rendered externally
    and is opaque from CSSâ€™s point of view.

    c                 ó6   •— t         ‰| �  |||«       || _        y r   )rØ   r   Úreplacement)r   r   r   r   r+  rÛ   s        €r   r   zReplacedBox.__init__D  s   ø€ Ü‰Ñ˜ e¨WÔ5Ø&ˆÕr   ©r#   r¾   r¿   rÀ   r   r  r  s   @r   rž   rž   =  s   ø„ ñ÷'ð 'r   rž   c                   ó   — e Zd ZdZy)ÚBlockReplacedBoxz·A box that is both replaced and block-level.

    A replaced element with a ``display`` value of ``block``, ``liste-item`` or
    ``table`` generates a block-level replaced box.

    Nr  rÔ   r   r   r.  r.  I  r  r   r.  c                   ó   — e Zd ZdZy)ÚInlineReplacedBoxzÉA box that is both replaced and inline-level.

    A replaced element with a ``display`` value of ``inline``,
    ``inline-table``, or ``inline-block`` generates an inline-level replaced
    box.

    Nr  rÔ   r   r   r0  r0  R  s   „ òr   r0  c                   ó4   ‡ — e Zd ZdZdZd„ Zdˆ fd„	Zd„ Zˆ xZS )rù   z(Box for elements with ``display: table``Tc                 óV   — t        j                  | j                  | j                  «      S r   )Ú	itertoolsÚchainr	   Úcolumn_groupsr
   s    r   r   zTableBox.all_childrenb  s   € Ü�‰˜tŸ}™}¨d×.@Ñ.@ÓAÐAr   c                 ót   •— | j                   D �cg c]  }||z   ‘Œ	 c}| _         t        ‰| �	  |||«      S c c}w r   )Úcolumn_positionsrØ   r7   )r   r8   r9   r:   r�   rÛ   s        €r   r7   zTableBox.translatee  sA   ø€ à*.×*?Ñ*?ö!AØ&ˆH�r‹Mò!AˆÔä‰wÑ   R¨Ó7Ð7ùò!As   �5c                 ó>   — | j                   d   | j                   d   fS )Nr¨   r‹   r
   s    r   r©   zTableBox.page_valuesj  s   € Ø—
‘
˜6Ñ" D§J¡J¨vÑ$6Ð7Ð7r   r½   )	r#   r¾   r¿   rÀ   rÃ   r   r7   r©   r  r  s   @r   rù   rù   \  s   ø„ Ù2ð ÐòBõ8ö
8r   rù   c                   ó   — e Zd ZdZy)ÚInlineTableBoxz/Box for elements with ``display: inline-table``Nr  rÔ   r   r   r:  r:  n  s   „ Ú9r   r:  c                   ó,   — e Zd ZdZdZdZdZeefZ	dZ
dZy)ÚTableRowGroupBoxz2Box for elements with ``display: table-row-group``TFN)r#   r¾   r¿   rÀ   rÁ   rÂ   rÃ   rù   r:  Úproper_parentsÚ	is_headerÚ	is_footerrÔ   r   r   r<  r<  r  s-   „ Ù<ØÐØ $ÐØÐØ Ð/€Nð €IØ�Ir   r<  c                   ó&   — e Zd ZdZdZdZdZeee	fZ
y)ÚTableRowBoxz,Box for elements with ``display: table-row``TN)r#   r¾   r¿   rÀ   rÁ   rÂ   rÃ   rù   r:  r<  r=  rÔ   r   r   rA  rA  ~  s$   „ Ù6ØÐØ $ÐØÐØ Ð0@ÐA�Nr   rA  c                   óV   — e Zd ZdZdZdZeefZdZ	dZ
dZdZdZdZdZdZd„ Zed„ «       Zy)ÚTableColumnGroupBoxz5Box for elements with ``display: table-column-group``Tr   c                 óp   — | j                   D ��cg c]  }|j                  «       D ]  }|‘Œ Œ c}}S c c}}w )z3Return cells that originate in the group's columns.)r	   Ú	get_cells)r   ÚcolumnÚcells      r   rE  zTableColumnGroupBox.get_cells—  sF   € ð  $Ÿ}™}÷MØ¸×9IÑ9IÓ9KòMØ15ŠDðMØóMð 	Mùó Ms   �2c                 óÞ   — | j                   rt        | j                   «      S 	 t        t        | j                  j                  dd«      j                  «       «      d«      S # t        $ r Y yw xY w©NÚspanÚ re   )r	   rþ   rj   Úintr   ÚgetÚstriprú   r
   s    r   rJ  zTableColumnGroupBox.spanœ  s[   € à�=Š=Ü�t—}‘}Ó%Ð%ðÜœ3˜tŸ|™|×/Ñ/°¸Ó;×AÑAÓCÓDÀaÓHÐHøÜò Ùðús   £<A  Á 	A,Á+A,N)r#   r¾   r¿   rÀ   rÁ   rÂ   rù   r:  r=  rR   rS   rN   rO   rB   rC   r=   r>   rE  ÚpropertyrJ  rÔ   r   r   rC  rC  †  s_   „ Ù?ØÐØ $ÐØ Ð/€Nð €JØ€MØ€KØ€Là€KØ€NØ€LØ€MòMð
 ñó ñr   rC  c                   óX   — e Zd ZdZdZdZeeefZ	dZ
dZdZdZdZdZdZdZd„ Zed„ «       Zy)ÚTableColumnBoxz/Box for elements with ``display: table-column``Tr   c                 ó   — t         ‚)zRReturn cells that originate in the column.

        Is set on instances.

        )ÚNotImplementedErrorr
   s    r   rE  zTableColumnBox.get_cells¹  s
   € ô "Ð!r   c                 óœ   — 	 t        t        | j                  j                  dd«      j	                  «       «      d«      S # t
        $ r Y yw xY wrI  )rj   rL  r   rM  rN  rú   r
   s    r   rJ  zTableColumnBox.spanÁ  sE   € ð	Ü”s˜4Ÿ<™<×+Ñ+¨F°BÓ7×=Ñ=Ó?Ó@À!ÓDÐDøÜò 	Ùð	ús   ‚<? ¿	AÁ
AN)r#   r¾   r¿   rÀ   rÁ   rÂ   rù   r:  rC  r=  rR   rS   rN   rO   rB   rC   r=   r>   rE  rO  rJ  rÔ   r   r   rQ  rQ  ¨  sa   „ Ù9ØÐØ $ÐØ Ð0CÐD€Nð €JØ€MØ€KØ€Là€KØ€NØ€LØ€Mò"ð ñó ñr   rQ  c                   ó&   ‡ — e Zd ZdZdZˆ fd„Zˆ xZS )ÚTableCellBoxz-Box for elements with ``display: table-cell``Tc                 ó   •— t        ‰| �  |i |¤Ž 	 t        t        | j                  j                  dd«      j                  «       «      d«      | _        	 t        t        | j                  j                  dd«      j                  «       «      d«      | _
        y # t        t        f$ r
 d| _        Y Œ\w xY w# t        t        f$ r
 d| _
        Y y w xY w)NÚcolspanrK  re   Úrowspanr   )rØ   r   rj   rL  r   rM  rN  rX  ÚAttributeErrorrú   rY  )r   r(   r)   rÛ   s      €r   r   zTableCellBox.__init__Í  s²   ø€ Ü‰Ñ˜$Ð) &Ò)ð	Üœs 4§<¡<×#3Ñ#3°I¸rÓ#B×#HÑ#HÓ#JÓKÈQÓOˆDŒLð	Üœs 4§<¡<×#3Ñ#3°I¸rÓ#B×#HÑ#HÓ#JÓKÈQÓOˆD�Løô ¤
Ð+ò 	ØˆDŽLð	ûô ¤
Ð+ò 	ØˆDŽLð	ús%   ’AB ÁAB4 ÂB1Â0B1Â4CÃC)r#   r¾   r¿   rÀ   rÂ   r   r  r  s   @r   rV  rV  É  s   ø„ Ù7Ø $Ð÷ð r   rV  c                   ó    — e Zd ZdZdZdZeefZy)ÚTableCaptionBoxz0Box for elements with ``display: table-caption``TN)	r#   r¾   r¿   rÀ   rÁ   rÂ   rù   r:  r=  rÔ   r   r   r\  r\  ß  s   „ Ù:ØÐØ $ÐØ Ð/�Nr   r\  c                   óH   ‡ — e Zd ZdZˆ fd„Zd„ Zed„ «       Zed„ «       Zˆ xZ	S )ÚPageBoxz¤Box for a page.

    Initially the whole document will be in the box for the root element.
    During layout a new page box is created after every page break.

    c                 ó:   •— || _         t        ‰| �	  d |d g ¬«       y ©N)r   r   r   r	   )Ú	page_typerØ   r   )r   ra  r   rÛ   s      €r   r   zPageBox.__init__í  s&   ø€ Ø"ˆŒä‰ÑØ E°4À"ð 	õ 	Fr   c                 óN   — dt        | «      j                  › d| j                  › d�S r   )r"   r#   ra  r
   s    r   r$   zPageBox.__repr__ó  s'   € Ø”4˜“:×&Ñ&Ð' q¨¯©Ð(8¸Ð:Ð:r   c                 ób   — dD �ci c]  }|| j                   d|› �   j                  “Œ! c}S c c}w )N)ré   rŠ   rê   r‰   Úbleed_)r   Úvaluerã   s     r   ÚbleedzPageBox.bleedö  s>   € ð ;ö<àð �$—*‘*˜v d V˜_Ñ-×3Ñ3Ñ3ò<ð 	<ùò <s   …$,c                 óþ   — | j                   d    | j                   d    | j                  «       | j                   d   z   | j                   d   z   | j                  «       | j                   d   z   | j                   d   z   fS )Nr‰   ré   rŠ   rê   )rf  rP   rT   r
   s    r   Ú
bleed_areazPageBox.bleed_areaü  s}   € ð �Z‰Z˜ÑÐ $§*¡*¨UÑ"3Ð!3Ø×ÑÓ $§*¡*¨VÑ"4Ñ4°t·z±zÀ'Ñ7JÑJØ×ÑÓ  4§:¡:¨eÑ#4Ñ4°t·z±zÀ(Ñ7KÑKðMð 	Mr   )
r#   r¾   r¿   rÀ   r   r$   rO  rf  rh  r  r  s   @r   r^  r^  æ  s=   ø„ ñôFò;ð ñ<ó ð<ð
 ñMó ôMr   r^  c                   ó(   ‡ — e Zd ZdZˆ fd„Zd„ Zˆ xZS )Ú	MarginBoxz3Box in page margins, as defined in CSS3 Paged Mediac                 ó:   •— || _         t        ‰| �	  d |d g ¬«       y r`  )Ú
at_keywordrØ   r   )r   rl  r   rÛ   s      €r   r   zMarginBox.__init__  s&   ø€ Ø$ˆŒä‰ÑØ E°4À"ð 	õ 	Fr   c                 óN   — dt        | «      j                  › d| j                  › d�S r   )r"   r#   rl  r
   s    r   r$   zMarginBox.__repr__  s'   € Ø”4˜“:×&Ñ&Ð' q¨¯©Ð(9¸Ð;Ð;r   ©r#   r¾   r¿   rÀ   r   r$   r  r  s   @r   rj  rj    s   ø„ Ù=ôFö<r   rj  c                   ó(   ‡ — e Zd ZdZˆ fd„Zd„ Zˆ xZS )ÚFootnoteAreaBoxz-Box displaying footnotes, as defined in GCPM.c                 ó:   •— || _         t        ‰| �	  d |d g ¬«       y r`  )r¨   rØ   r   )r   r¨   r   rÛ   s      €r   r   zFootnoteAreaBox.__init__  s&   ø€ ØˆŒ	ä‰ÑØ E°4À"ð 	õ 	Fr   c                 ó4   — dt        | «      j                  › d�S )Nr   z @footnote>)r"   r#   r
   s    r   r$   zFootnoteAreaBox.__repr__  s   € Ø”4˜“:×&Ñ&Ð' {Ð3Ð3r   rn  r  s   @r   rp  rp    s   ø„ Ù7ôFö4r   rp  c                   ó   — e Zd ZdZy)ÚFlexContainerBoxz$A box that contains only flex-items.Nr  rÔ   r   r   rt  rt    s   „ Ú.r   rt  c                   ó   — e Zd ZdZy)ÚFlexBoxz‰A box that is both block-level and a flex container.

    It behaves as block on the outside and as a flex container on the inside.

    Nr  rÔ   r   r   rv  rv     r&  r   rv  c                   ó   — e Zd ZdZy)ÚInlineFlexBoxz‹A box that is both inline-level and a flex container.

    It behaves as inline on the outside and as a flex container on the inside.

    Nr  rÔ   r   r   rx  rx  (  r&  r   rx  c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚGridContainerBoxz$A box that contains only grid-items.c                 ó8   •— t         ‰| �  ||||«       i | _        y r   )rØ   r   ÚadvancementsrÚ   s        €r   r   zGridContainerBox.__init__2  s   ø€ Ü‰Ñ˜ e¨W°hÔ?àˆÕr   r,  r  s   @r   rz  rz  0  s   ø„ Ù.÷ð r   rz  c                   ó   — e Zd ZdZy)ÚGridBoxz‰A box that is both block-level and a grid container.

    It behaves as block on the outside and as a grid container on the inside.

    Nr  rÔ   r   r   r~  r~  8  r&  r   r~  c                   ó   — e Zd ZdZy)ÚInlineGridBoxz‹A box that is both inline-level and a grid container.

    It behaves as inline on the outside and as a grid container on the inside.

    Nr  rÔ   r   r   r€  r€  @  r&  r   r€  )#rÀ   r3  Úcssr   r   rÖ   r
  r¤   r¥   r·   r  r  r¸   r�   r(  rž   r.  r0  rù   r:  r<  rA  rC  rQ  rV  r\  r^  rj  rp  rt  rv  rx  rz  r~  r€  rÔ   r   r   ú<module>r‚     s¯  ðñ0ód å  ÷n*ñ n*ôb	N&�ô N&ôb�Cô ô
˜	ô 
ôÐ  -ô ôˆiô ô*<�Sô <ô(;� 	ô ;ô"ˆnô ô,˜>ô ôÐ)Ð+<ô ô	'�#ô 	'ô�{ Mô ô˜Ð%9ô ô8ˆ}˜iô 8ô$:�Xô :ô	�yô 	ôB�)ô Bô˜)ô ôD�Yô ôBÐ$ô ô,0�hô 0ôMˆiô Mô<	<Ð!ô 	<ô	4�hô 	4ô/�yô /ôÐ ô ôÐ$ nô ô�yô ôÐ ô ôÐ$ nõ r   