+
    f0ib                        ^ RI t ^ RIt^ RIHtHtHt ^ RIHtHtH	t	H
t
 ^ RIHt ^ RIHtHt ^ RIHt ^ RIHtHt ^ RIHt ^ R	IHtHtHtHtHtHtHtHtH t H!t!H"t"H#t#H$t$ ]PJ                  ! ]&4      t' ! R
 R4      t( ! R R4      t) ! R R4      t* ! R R4      t+ ! R R]*4      t, ! R R],4      t- ! R R]-4      t. ! R R]-4      t/ ! R R],4      t0 ! R R]*]+4      t1 ! R R],]+4      t2]! R ]*R!7      t3 ! R" R#],]]3,          4      t4 ! R$ R%]4]3,          4      t5 ! R& R']5]3,          ]+4      t6]	]2]13,          t7 ! R( R)]6]7,          4      t8 ! R* R+]84      t9 ! R, R-]84      t: ! R. R/]6]8,          4      t; ! R0 R1];4      t< ! R2 R3];4      t=]	];R43,          t> ! R5 R4]6]>,          4      t? ! R6 R7]?4      t@ ! R8 R9]?4      tA ! R: R;]4],,          4      tB ! R< R=]B4      tC ! R> R?]B4      tDR# )@    N)IterableIteratorSequence)GenericTypeVarUnioncast)PDFColorSpace)PDFTypeErrorPDFValueError)PDFFont)ColorPDFGraphicState)	PDFStream)INFLTComponentTMatrixPathSegmentPlanePointRectapply_matrix_rectbbox2strfsplit	get_bound
matrix2struniqc                   H   a  ] tR t^#t o RV 3R lR lltV 3R lR ltRtV tR# )IndexAssignerc                $   < V ^8  d   QhRS[ RR/# )   indexreturnNint)format__classdict__s   "U/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/pdfminer/layout.py__annotate__IndexAssigner.__annotate__$   s      c $     c                    Wn         R # Nr"   )selfr"   s   &&r(   __init__IndexAssigner.__init__$   s    
r+   c                "   < V ^8  d   QhRRRR/# )r!   objLTItemr#   N )r&   r'   s   "r(   r)   r*   '   s      x D r+   c                    \        V\        4      '       d-   V P                  Vn        V ;P                  ^,          un        R# \        V\        4      '       d   V F  pV P	                  V4       K  	  R# R# )   N)
isinstance	LTTextBoxr"   LTTextGrouprun)r/   r3   xs   && r(   r;   IndexAssigner.run'   sN    c9%%

CIJJ!OJ[))  *r+   r.   Nr   )__name__
__module____qualname____firstlineno__r0   r;   __static_attributes____classdictcell__r'   s   @r(   r   r   #   s       r+   r   c                   ^   a  ] tR t^0t o RtR
V 3R lR lltV 3R lR ltV 3R lR ltRtV t	R	# )LAParamsa  Parameters for layout analysis

:param line_overlap: If two characters have more overlap than this they
    are considered to be on the same line. The overlap is specified
    relative to the minimum height of both characters.
:param char_margin: If two characters are closer together than this
    margin they are considered part of the same line. The margin is
    specified relative to the width of the character.
:param word_margin: If two characters on the same line are further apart
    than this margin then they are considered to be two separate words, and
    an intermediate space will be added for readability. The margin is
    specified relative to the width of the character.
:param line_margin: If two lines are are close together they are
    considered to be part of the same paragraph. The margin is
    specified relative to the height of a line.
:param boxes_flow: Specifies how much a horizontal and vertical position
    of a text matters when determining the order of text boxes. The value
    should be within the range of -1.0 (only horizontal position
    matters) to +1.0 (only vertical position matters). You can also pass
    `None` to disable advanced layout analysis, and instead return text
    based on the position of the bottom left corner of the text box.
:param detect_vertical: If vertical text should be considered during
    layout analysis
:param all_texts: If layout analysis should be performed on text in
    figures.
c                V   < V ^8  d   QhRS[ RS[ RS[ RS[ RS[ R,          RS[RS[R	R/# )
r!   line_overlapchar_marginline_marginword_margin
boxes_flowNdetect_vertical	all_textsr#   )floatbool)r&   r'   s   "r(   r)   LAParams.__annotate__L   s_        	
  DL   
r+   c                z    Wn         W n        W0n        W@n        WPn        W`n        Wpn        V P                  4        R # r-   )rI   rJ   rK   rL   rM   rN   rO   	_validate)r/   rI   rJ   rK   rL   rM   rN   rO   s   &&&&&&&&r(   r0   LAParams.__init__L   s6     )&&&$."r+   c                   < V ^8  d   QhRR/# r!   r#   Nr5   )r&   r'   s   "r(   r)   rR   `   s     8 84 8r+   c                    V P                   e\   Rp\        V P                   \        \        34      '       g   \	        V4      hRV P                   u;8:  d   ^8:  g   M \        V4      hR # R # )Nz@LAParam boxes_flow should be None, or a number between -1 and +1)rM   r8   r%   rP   r   r   )r/   boxes_flow_err_msgs   & r(   rT   LAParams._validate`   s^    ??&R  te=="#566-A-#$677 . 'r+   c                    < V ^8  d   QhRS[ /# r!   r#   str)r&   r'   s   "r(   r)   rR   j   s     
 
# 
r+   c           	     x    R V P                   R RV P                  R RV P                  R RV P                  : R2	# )z<LAParams: char_margin=z.1fz, line_margin=z, word_margin=z all_texts=>)rJ   rK   rL   rO   r/   s   &r(   __repr__LAParams.__repr__j   sS    %d&6&6s%; <++C0 1++C0 1*!-	
r+   )rO   rM   rJ   rN   rK   rI   rL   N)      ?g       @re   g?re   FF)
r?   r@   rA   rB   __doc__r0   rT   rc   rC   rD   rE   s   @r(   rG   rG   0   s(     6 (8 8
 
r+   rG   c                   6   a  ] tR t^st o RtV 3R lR ltRtV tR# )r4   z)Interface for things that can be analyzedc                $   < V ^8  d   QhRS[ RR/# r!   laparamsr#   NrG   )r&   r'   s   "r(   r)   LTItem.__annotate__v   s     + + +T +r+   c                    R# )zPerform the layout analysis.Nr5   r/   rj   s   &&r(   analyzeLTItem.analyzev   s    r+   r5   N)r?   r@   rA   rB   rf   ro   rC   rD   rE   s   @r(   r4   r4   s   s     3+ +r+   r4   c                   H   a  ] tR t^zt o RtV 3R lR ltV 3R lR ltRtV tR# )LTTextz#Interface for things that have textc                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   LTText.__annotate__}   s     B B# Br+   c                Z    R V P                   P                   RV P                  4       : R2# < ra   )	__class__r?   get_textrb   s   &r(   rc   LTText.__repr__}   s)    4>>**+1T]]_,?qAAr+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   rt      s     " "# "r+   c                    \         h)zText contained in this objectNotImplementedErrorrb   s   &r(   rz   LTText.get_text   s    !!r+   r5   N)	r?   r@   rA   rB   rf   rc   rz   rC   rD   rE   s   @r(   rr   rr   z   s     -B B" "r+   rr   c                      a  ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# ) LTComponentzObject with a bounding boxc                $   < V ^8  d   QhRS[ RR/# r!   bboxr#   Nr   )r&   r'   s   "r(   r)   LTComponent.__annotate__   s      T d r+   c                R    \         P                  V 4       V P                  V4       R # r-   )r4   r0   set_bboxr/   r   s   &&r(   r0   LTComponent.__init__   s    dr+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r      s     D D# Dr+   c                b    R V P                   P                   R\        V P                  4       R2# rv   )ry   r?   r   r   rb   s   &r(   rc   LTComponent.__repr__   s,    4>>**+1Xdii-@,ACCr+   c                &   < V ^8  d   QhRS[ RS[/# r!   _r#   objectrQ   )r&   r'   s   "r(   r)   r             4 r+   c                    \         hr-   r   r/   r   s   &&r(   __lt__LTComponent.__lt__       r+   c                &   < V ^8  d   QhRS[ RS[/# r   r   )r&   r'   s   "r(   r)   r      r   r+   c                    \         hr-   r   r   s   &&r(   __le__LTComponent.__le__   r   r+   c                &   < V ^8  d   QhRS[ RS[/# r   r   )r&   r'   s   "r(   r)   r      r   r+   c                    \         hr-   r   r   s   &&r(   __gt__LTComponent.__gt__   r   r+   c                &   < V ^8  d   QhRS[ RS[/# r   r   )r&   r'   s   "r(   r)   r      r   r+   c                    \         hr-   r   r   s   &&r(   __ge__LTComponent.__ge__   r   r+   c                $   < V ^8  d   QhRS[ RR/# r   r   )r&   r'   s   "r(   r)   r      s      T d r+   c                    Vw  r#rEW n         W0n        W@n        WPn        WB,
          V n        WS,
          V n        Wn        R # r-   )x0y0x1y1widthheightr   )r/   r   r   r   r   r   s   &&    r(   r   LTComponent.set_bbox   s7    W
g	r+   c                    < V ^8  d   QhRS[ /# r]   rQ   )r&   r'   s   "r(   r)   r      s     3 3$ 3r+   c                N    V P                   ^ 8*  ;'       g    V P                  ^ 8*  # r>   )r   r   rb   s   &r(   is_emptyLTComponent.is_empty   s!    zzQ22$++"22r+   c                $   < V ^8  d   QhRRRS[ /# r!   r3   r   r#   r   )r&   r'   s   "r(   r)   r           7 7} 7 7r+   c                    \        V\        4      '       g   Q \        \        V4      4      4       hVP                  V P
                  8*  ;'       d    V P                  VP
                  8*  # r-   )r8   r   r_   typer   r   r/   r3   s   &&r(   is_hoverlapLTComponent.is_hoverlap   J    #{++;Sc^;+vv 66TWW%66r+   c                $   < V ^8  d   QhRRRS[ /# r   rP   )r&   r'   s   "r(   r)   r           E E] Eu Er+   c                :   \        V\        4      '       g   Q \        \        V4      4      4       hV P	                  V4      '       d   ^ # \        \        V P                  VP                  ,
          4      \        V P                  VP                  ,
          4      4      # r>   	r8   r   r_   r   r   minabsr   r   r   s   &&r(   	hdistanceLTComponent.hdistance   g    #{++;Sc^;+C  s477SVV+,c$''CFF2B.CDDr+   c                $   < V ^8  d   QhRRRS[ /# r   r   )r&   r'   s   "r(   r)   r            M e r+   c                :   \        V\        4      '       g   Q \        \        V4      4      4       hV P	                  V4      '       dU   \        \        V P                  VP                  ,
          4      \        V P                  VP                  ,
          4      4      # ^ # r>   r   r   s   &&r(   hoverlapLTComponent.hoverlap   g    #{++;Sc^;+C  s477SVV+,c$''CFF2B.CDDr+   c                $   < V ^8  d   QhRRRS[ /# r   r   )r&   r'   s   "r(   r)   r      r   r+   c                    \        V\        4      '       g   Q \        \        V4      4      4       hVP                  V P
                  8*  ;'       d    V P                  VP
                  8*  # r-   )r8   r   r_   r   r   r   r   s   &&r(   is_voverlapLTComponent.is_voverlap   r   r+   c                $   < V ^8  d   QhRRRS[ /# r   r   )r&   r'   s   "r(   r)   r      r   r+   c                :   \        V\        4      '       g   Q \        \        V4      4      4       hV P	                  V4      '       d   ^ # \        \        V P                  VP                  ,
          4      \        V P                  VP                  ,
          4      4      # r>   	r8   r   r_   r   r   r   r   r   r   r   s   &&r(   	vdistanceLTComponent.vdistance   r   r+   c                $   < V ^8  d   QhRRRS[ /# r   r   )r&   r'   s   "r(   r)   r      r   r+   c                :   \        V\        4      '       g   Q \        \        V4      4      4       hV P	                  V4      '       dU   \        \        V P                  VP                  ,
          4      \        V P                  VP                  ,
          4      4      # ^ # r>   r   r   s   &&r(   voverlapLTComponent.voverlap   r   r+   )r   r   r   r   r   r   r   N)r?   r@   rA   rB   rf   r0   rc   r   r   r   r   r   r   r   r   r   r   r   r   rC   rD   rE   s   @r(   r   r      s     $ D D     3 37 7E E 7 7E E r+   r   c                   L   a  ] tR t^t o RtRV 3R lR lltV 3R lR ltRtV tR# )	LTCurvezA generic Bezier curve

The parameter `original_path` contains the original
pathing information from the pdf (e.g. for reconstructing Bezier Curves).

`dashing_style` contains the Dashing information if any.
Nc                   < V ^8  d   QhRS[ RS[S[,          RS[RS[RS[RS[R,          RS[R,          R	S[S[,          R,          R
S[S[S[3,          R,          RR/
# )r!   	linewidthptsstrokefillevenoddstroking_colorNnon_stroking_colororiginal_pathdashing_styler#   )rP   listr   rQ   r   r   tupler   )r&   r'   s   "r(   r)   LTCurve.__annotate__   s     + ++ %[+ 	+
 + + + "DL+ K(4/+ VV^,t3+ 
+r+   c
                    \         P                  V \        V4      4       W n        Wn        W0n        W@n        WPn        W`n        Wpn	        Wn
        Wn        R # r-   )r   r0   r   r   r   r   r   r   r   r   r   r   )
r/   r   r   r   r   r   r   r   r   r   s
   &&&&&&&&&&r(   r0   LTCurve.__init__   sI     	T9S>2"	,"4**r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r      s     F F Fr+   c                F    R P                  R V P                   4       4      # ),c              3   B   "   T F  pR P                   ! V!  x  K  	  R# 5i)z{:.3f},{:.3f}N)r&   ).0ps   & r(   	<genexpr>"LTCurve.get_pts.<locals>.<genexpr>   s     EHq..2Hs   )joinr   rb   s   &r(   get_ptsLTCurve.get_pts   s    xxEDHHEEEr+   )	r   r   r   r   r   r   r   r   r   FFFNNNN)	r?   r@   rA   rB   rf   r0   r   rC   rD   rE   s   @r(   r   r      s      + +.F Fr+   r   c                   :   a  ] tR t^t o RtRV 3R lR lltRtV tR# )LTLinezGA single straight line.

Could be used for separating text or figures.
Nc                   < V ^8  d   QhRS[ RS[RS[RS[RS[RS[RS[R,          R	S[R,          R
S[S[,          R,          RS[S[S[3,          R,          RR/# )r!   r   p0p1r   r   r   r   Nr   r   r   r#   )rP   r   rQ   r   r   r   r   r   )r&   r'   s   "r(   r)   LTLine.__annotate__   s     
 

 
 	

 
 
 
 
 "DL
 K(4/
 VV^,t3
 

r+   c                D    \         P                  V VW#.VVVVVV	V
4
       R # r-   r   r0   )r/   r   r   r   r   r   r   r   r   r   r   s   &&&&&&&&&&&r(   r0   LTLine.__init__   s2     	H	
r+   r5   r   r?   r@   rA   rB   rf   r0   rC   rD   rE   s   @r(   r   r           

 
 
r+   r   c                   :   a  ] tR tRt o RtRV 3R lR lltRtV tR# )LTRecti  zEA rectangle.

Could be used for framing another pictures or figures.
Nc                   < V ^8  d   QhRS[ RS[RS[RS[RS[RS[R,          RS[R,          R	S[S[,          R,          R
S[S[S[3,          R,          RR/
# )r!   r   r   r   r   r   r   Nr   r   r   r#   )rP   r   rQ   r   r   r   r   r   )r&   r'   s   "r(   r)   LTRect.__annotate__  s     
 

 
 	

 
 
 
 "DL
 K(4/
 VV^,t3
 

r+   c
                \    Vw  rr\         P                  V VW3W3W3W3.VVVVVVV	4
       R # r-   r   )r/   r   r   r   r   r   r   r   r   r   r   r   r   r   s   &&&&&&&&&&    r(   r0   LTRect.__init__  sK      Xx"B84	
r+   r5   r   r  rE   s   @r(   r  r    r  r+   r  c                   H   a  ] tR tRt o RtV 3R lR ltV 3R lR ltRtV tR# )	LTImagei4  zCAn image object.

Embedded images can be in JPEG, Bitmap or JBIG2.
c                0   < V ^8  d   QhRS[ RS[RS[RR/# )r!   namestreamr   r#   N)r_   r   r   )r&   r'   s   "r(   r)   LTImage.__annotate__:  s)     	0 	0S 	0) 	04 	0D 	0r+   c                   \         P                  W4       Wn        W n        VP	                  R4      VP	                  R4      3V n        VP	                  R4      V n        VP	                  R^4      V n        VP	                  R4      V n        \        V P                  \        4      '       g   V P                  .V n        R# R# )WN)r  Width)HHeight)IM	ImageMask)BPCBitsPerComponent)CS
ColorSpace)r   r0   r  r  get_anysrcsize	imagemaskbits
colorspacer8   r   )r/   r  r  r   s   &&&&r(   r0   LTImage.__init__:  s    T(	~68WX(;<NN#>B	 ..)=>$//400#/DO 1r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r  E       
 
# 
r+   c           	         R V P                   P                   RV P                   R\        V P                  4       RV P
                  : R2	# rw   () rx   ra   )ry   r?   r  r   r   r  rb   s   &r(   rc   LTImage.__repr__E  sF    ''($))B		"#1T\\$4A7	
r+   )r  r  r  r  r  r  N	r?   r@   rA   rB   rf   r0   rc   rC   rD   rE   s   @r(   r
  r
  4  s     
	0 	0
 
r+   r
  c                   H   a  ] tR tRt o RtV 3R lR ltV 3R lR ltRtV tR# )	LTAnnoiL  a  Actual letter in the text as a Unicode string.

Note that, while a LTChar object has actual boundaries, LTAnno objects does
not, as these are "virtual" characters, inserted by a layout analyzer
according to the relationship between two characters (e.g. a space).
c                $   < V ^8  d   QhRS[ RR/# )r!   textr#   Nr^   )r&   r'   s   "r(   r)   LTAnno.__annotate__T  s      S T r+   c                    Wn         R # r-   _text)r/   r+  s   &&r(   r0   LTAnno.__init__T  s    
r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r,  W        # r+   c                    V P                   # r-   r.  rb   s   &r(   rz   LTAnno.get_textW      zzr+   r.  N)	r?   r@   rA   rB   rf   r0   rz   rC   rD   rE   s   @r(   r)  r)  L  s       r+   r)  c                   Z   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltR	tV t	R
# )LTChari[  z.Actual letter in the text as a Unicode string.c                   < V ^8  d   QhRS[ RS[RS[RS[RS[RS[RS[RS[S[S[R	,          S[3,          ,          R
S[RS[RR	/# )r!   matrixfontfontsizescalingriser+  	textwidthtextdispNncsgraphicstater#   )r   r   rP   r_   r   r
   r   )r&   r'   s   "r(   r)   LTChar.__annotate__^  s     +$ +$+$ +$ 	+$
 +$ +$ +$ +$ %e 344+$ +$ &+$ 
+$r+   c                   \         P                  V 4       W`n        Wn        VP                  V n        Wn        Wn        Ws,          V,          V n        VP                  4       '       d}   \        V\        4      '       g   Q hVw  rVf
   VR,          MW,          R,          pRV,
          V,          R,          pV) W,           V P                  ,           V) V,           W,           3pM:VP                  4       V,          p^ W,           V P                  W,           V,           3pV P                  w  ppppppVV,          V,          ^ 8  ;'       d    VV,          ^ 8*  V n        \        V P                  V4      w  ppppVV8  d   TTppVV8  d   TTpp\        P                  V VVVV34       VP                  4       '       d   V P                  V n        R # V P"                  V n        R # )Nre   gMbP?i  )rr   r0   r/  r9  fontnamer@  rA  advis_verticalr8   r   get_descentuprightr   r   r   sizer   )r/   r9  r:  r;  r<  r=  r+  r>  r?  r@  rA  vxvyr   descentabcd_e_fr   r   r   r   s   &&&&&&&&&&&              r(   r0   LTChar.__init__^  s    	
(''1h....HR#%:C2=53HB)x'%/BCTXX-sX~ryID &&(83Gw~txx(1JKD#{{Aq!R1uw*99q1uz,T[[$?RR7BR7BRTBB#34

DIDIr+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   rB    s     
 
# 
r+   c                    R V P                   P                   R\        V P                  4       R\	        V P
                  4       RV P                  : RV P                   RV P                  4       : R2# )rw   rx    matrix=z font=z adv=z text=ra   )	ry   r?   r   r   r   r9  rD  rE  rz   rb   s   &r(   rc   LTChar.__repr__  sr    ''((499*=)> ? -. /MM$ %88* MMO&a	)	
r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   rB    r2  r+   c                    V P                   # r-   r.  rb   s   &r(   rz   LTChar.get_text  r5  r+   )r/  rE  rD  rA  r9  r@  rI  rH  N)
r?   r@   rA   rB   rf   r0   rc   rz   rC   rD   rE   s   @r(   r7  r7  [  s'     8+$ +$Z
 
 r+   r7  LTItemT)boundc                      a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	V 3R lR lt
RtV tR# )LTContaineri  z(Object that can be extended and analyzedc                $   < V ^8  d   QhRS[ RR/# r   r   )r&   r'   s   "r(   r)   LTContainer.__annotate__  s     ' 'T 'd 'r+   c                >    \         P                  W4       . V n        R # r-   )r   r0   _objsr   s   &&r(   r0   LTContainer.__init__  s    T($&
r+   c                0   < V ^8  d   QhRS[ S[,          /# r]   )r   r[  )r&   r'   s   "r(   r)   r`    s        (7+  r+   c                ,    \        V P                  4      # r-   )iterrb  rb   s   &r(   __iter__LTContainer.__iter__  s    DJJr+   c                    < V ^8  d   QhRS[ /# r]   r$   )r&   r'   s   "r(   r)   r`    s       r+   c                ,    \        V P                  4      # r-   )lenrb  rb   s   &r(   __len__LTContainer.__len__  s    4::r+   c                $   < V ^8  d   QhRS[ RR/# r!   r3   r#   N)r[  )r&   r'   s   "r(   r)   r`    s      w 4 r+   c                <    V P                   P                  V4       R # r-   )rb  appendr   s   &&r(   addLTContainer.add  s    

#r+   c                4   < V ^8  d   QhRS[ S[,          RR/# r!   objsr#   N)r   r[  )r&   r'   s   "r(   r)   r`    s       8G,  r+   c                :    V F  pV P                  V4       K  	  R # r-   )rr  )r/   rv  r3   s   && r(   extendLTContainer.extend  s    CHHSM r+   c                $   < V ^8  d   QhRS[ RR/# ri   rk   )r&   r'   s   "r(   r)   r`    s     " " "T "r+   c                N    V P                    F  pVP                  V4       K  	  R # r-   )rb  ro   r/   rj   r3   s   && r(   ro   LTContainer.analyze  s    ::CKK! r+   )rb  N)r?   r@   rA   rB   rf   r0   rg  rl  rr  rx  ro   rC   rD   rE   s   @r(   r^  r^    sD     2' '      " "r+   r^  c                   D   a  ] tR tRt o V 3R lR ltV 3R lR ltRtV tR# )LTExpandableContaineri  c                   < V ^8  d   QhRR/# rW   r5   )r&   r'   s   "r(   r)   "LTExpandableContainer.__annotate__  s     = =$ =r+   c                b    \         P                  V \        5\        5\        ) \        ) 34       R # r-   )r^  r0   r   rb   s   &r(   r0   LTExpandableContainer.__init__  s#    TSD3$sd#;<r+   c                $   < V ^8  d   QhRS[ RR/# ro  r   )r&   r'   s   "r(   r)   r    s     	
 	
{ 	
t 	
r+   c           	     h   \         P                  V \        \        V4      4       V P	                  \        V P                  VP                  4      \        V P                  VP                  4      \        V P                  VP                  4      \        V P                  VP                  4      34       R # r-   )r^  rr  r	   r[  r   r   r   r   maxr   r   r   s   &&r(   rr  LTExpandableContainer.add  sp    d7C01DGGSVV$DGGSVV$DGGSVV$DGGSVV$		
r+   r5   N)r?   r@   rA   rB   r0   rr  rC   rD   rE   s   @r(   r  r    s     = =
	
 	
r+   r  c                   D   a  ] tR tRt o V 3R lR ltV 3R lR ltRtV tR# )LTTextContaineri  c                   < V ^8  d   QhRR/# rW   r5   )r&   r'   s   "r(   r)   LTTextContainer.__annotate__  s     - -$ -r+   c                Z    \         P                  V 4       \        P                  V 4       R # r-   )rr   r0   r  rb   s   &r(   r0   LTTextContainer.__init__  s    &&t,r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r    s     
 
# 
r+   c                2    R P                  R V  4       4      # ) c              3      "   T F;  p\        V\        4      '       g   K  \        \        V4      P                  4       x  K=  	  R # 5ir-   )r8   rr   r	   rz   )r   r3   s   & r(   r   +LTTextContainer.get_text.<locals>.<genexpr>  s2      
48SJsF<S(D&&((Ds
   A&A)r   rb   s   &r(   rz   LTTextContainer.get_text  s     ww 
48
 
 	
r+   r5   N)r?   r@   rA   rB   r0   rz   rC   rD   rE   s   @r(   r  r    s     - -
 
r+   r  c                      a a ] tR tRt oRtV3R lV 3R lltV3R lR ltV3R lR ltV3R	 lR
 ltV3R lV 3R llt	Rt
VtV ;t# )
LTTextLinei  zContains a list of LTChar objects that represent a single text line.

The characters are aligned either horizontally or vertically, depending on
the text's writing mode.
c                $   < V ^8  d   QhRS[ RR/# r!   rL   r#   Nr   )r&   r'   s   "r(   r)   LTTextLine.__annotate__  s     ' 'E 'd 'r+   c                0   < \         SV `  4        Wn        R # r-   )superr0   rL   )r/   rL   ry   s   &&r(   r0   LTTextLine.__init__  s    &r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r    s     X X# Xr+   c                    R V P                   P                   R\        V P                  4       RV P	                  4       : R2# rv   )ry   r?   r   r   rz   rb   s   &r(   rc   LTTextLine.__repr__  s:    4>>**+1Xdii-@,A4==?BUUVWWr+   c                $   < V ^8  d   QhRS[ RR/# ri   rk   )r&   r'   s   "r(   r)   r    s     , , ,T ,r+   c                    V P                    F  pVP                  V4       K  	  \        P                  V \	        R 4      4       R# )
N)rb  ro   r^  rr  r)  r|  s   && r(   ro   LTTextLine.analyze  s.    ::CKK! fTl+r+   c                J   < V ^8  d   QhRS[ S[,          RS[RS[R,          /# )r!   planeratior#   r  )r   r   rP   r   )r&   r'   s   "r(   r)   r    s3     " "\"" " 
l		"r+   c                    \         hr-   r~   )r/   r  r  s   &&&r(   find_neighborsLTTextLine.find_neighbors  s
    
 "!r+   c                    < V ^8  d   QhRS[ /# r]   r   )r&   r'   s   "r(   r)   r    s     ? ?$ ?r+   c                l   < \         SV `  4       ;'       g    V P                  4       P                  4       # r-   )r  r   rz   isspace)r/   ry   s   &r(   r   LTTextLine.is_empty  s(    w!>>T]]_%<%<%>>r+   )rL   )r?   r@   rA   rB   rf   r0   rc   ro   r  r   rC   rD   __classcell__ry   r'   s   @@r(   r  r    sC     ' 'X X, ,
" "? ? ?r+   r  c                      a a ] tR tRt oV3R lR ltV3R lV 3R lltV3R lR ltRV3R lR	 lltRV3R
 lR lltRV3R lR llt	RV3R lR llt
RtVtV ;t# )LTTextLineHorizontali  c                $   < V ^8  d   QhRS[ RR/# r  r   )r&   r'   s   "r(   r)   !LTTextLineHorizontal.__annotate__        E d r+   c                H    \         P                  W4       \        5V n        R # r-   )r  r0   r   _x1r/   rL   s   &&r(   r0   LTTextLineHorizontal.__init__      D.$r+   c                $   < V ^8  d   QhRS[ RR/# ro  r  )r&   r'   s   "r(   r)   r          { t r+   c                |  < \        V\        4      '       d   V P                  '       ds   V P                  \        VP                  VP
                  4      ,          pV P                  VP                  V,
          8  d    \        P                  V \        R 4      4       VP                  V n        \        SV `%  V4       R# rx   N)r8   r7  rL   r  r   r   r  r   r^  rr  r)  r   r  r/   r3   marginry   s   && r(   rr  LTTextLineHorizontal.add  sw    c6""t'7'7'7%%CIIszz(BBFxx#&&6/)fSk266Cr+   c                L   < V ^8  d   QhRS[ S[,          RS[RS[S[,          /# r!   r  r  r#   r   r   rP   r   r  )r&   r'   s   "r(   r)   r    3     
 
\"
 
 
j		
r+   c                   W P                   ,          pVP                  V P                  V P                  V,
          V P                  V P
                  V,           34      pV Uu. uF  p\        V\        4      '       g   K  V P                  WSR7      '       g   K5  V P                  WSR7      '       g3   V P                  WSR7      '       g   V P                  WSR7      '       g   K  VNK  	  up# u upi )a  Finds neighboring LTTextLineHorizontals in the plane.

Returns a list of other LTTestLineHorizontals in the plane which are
close to self. "Close" can be controlled by ratio. The returned objects
will be the same height as self, and also either left-, right-, or
centrally-aligned.
	tolerance)r   findr   r   r   r   r8   r  _is_same_height_as_is_left_aligned_with_is_right_aligned_with_is_centrally_aligned_withr/   r  r  rP  rv  r3   s   &&&   r(   r  #LTTextLineHorizontal.find_neighbors  s     KKzz477DGGaK$''A+FG 
3 45  ++C+=	  ..s.@@2232DD66s6H C
 	
 
   "C,?C,AC,#C,c                ,   < V ^8  d   QhRS[ RS[RS[/# r!   otherr  r#   r   rP   rQ   )r&   r'   s   "r(   r)   r    s#     4 4; 45 4QU 4r+   c                T    \        VP                  V P                  ,
          4      V8*  # )z<Whether the left-hand edge of `other` is within `tolerance`.)r   r   r/   r  r  s   &&&r(   r  *LTTextLineHorizontal._is_left_aligned_with      588dgg%&)33r+   c                ,   < V ^8  d   QhRS[ RS[RS[/# r  r  )r&   r'   s   "r(   r)   r  !  #     4 4K 4E 4RV 4r+   c                T    \        VP                  V P                  ,
          4      V8*  # )z=Whether the right-hand edge of `other` is within `tolerance`.)r   r   r  s   &&&r(   r  +LTTextLineHorizontal._is_right_aligned_with!  r  r+   c                ,   < V ^8  d   QhRS[ RS[RS[/# r  r  )r&   r'   s   "r(   r)   r  %  .     U UU U 
	Ur+   c                    \        VP                  VP                  ,           ^,          V P                  V P                  ,           ^,          ,
          4      V8*  # )z?Whether the horizontal center of `other` is within `tolerance`.)r   r   r   r  s   &&&r(   r  /LTTextLineHorizontal._is_centrally_aligned_with%  =     EHHuxx'1,$''0AQ/FFG9TTr+   c                ,   < V ^8  d   QhRS[ RS[RS[/# r  r  )r&   r'   s   "r(   r)   r  -  s"     < < < <d <r+   c                T    \        VP                  V P                  ,
          4      V8*  # r-   )r   r   r  s   &&&r(   r  'LTTextLineHorizontal._is_same_height_as-  s    5<<$++-.);;r+   )r  r>   )r?   r@   rA   rB   r0   rr  r  r  r  r  r  rC   rD   r  r  s   @@r(   r  r    sR       
 
84 44 4U U< < <r+   r  c                      a a ] tR tRt oV3R lR ltV3R lV 3R lltV3R lR ltRV3R lR	 lltRV3R
 lR lltRV3R lR llt	V3R lR lt
RtVtV ;t# )LTTextLineVerticali1  c                $   < V ^8  d   QhRS[ RR/# r  r   )r&   r'   s   "r(   r)   LTTextLineVertical.__annotate__2  r  r+   c                H    \         P                  W4       \        ) V n        R # r-   )r  r0   r   _y0r  s   &&r(   r0   LTTextLineVertical.__init__2  r  r+   c                $   < V ^8  d   QhRS[ RR/# ro  r  )r&   r'   s   "r(   r)   r  8  r  r+   c                |  < \        V\        4      '       d   V P                  '       ds   V P                  \        VP                  VP
                  4      ,          pVP                  V,           V P                  8  d    \        P                  V \        R 4      4       VP                  V n        \        SV `%  V4       R# r  )r8   r7  rL   r  r   r   r   r  r^  rr  r)  r   r  r  s   && r(   rr  LTTextLineVertical.add8  sw    c6""t'7'7'7%%CIIszz(BBFvv)fSk266Cr+   c                L   < V ^8  d   QhRS[ S[,          RS[RS[S[,          /# r  r  )r&   r'   s   "r(   r)   r  @  r  r+   c                   W P                   ,          pVP                  V P                  V,
          V P                  V P                  V,           V P
                  34      pV Uu. uF  p\        V\        4      '       g   K  V P                  WSR7      '       g   K5  V P                  WSR7      '       g3   V P                  WSR7      '       g   V P                  WSR7      '       g   K  VNK  	  up# u upi )a  Finds neighboring LTTextLineVerticals in the plane.

Returns a list of other LTTextLineVerticals in the plane which are
close to self. "Close" can be controlled by ratio. The returned objects
will be the same width as self, and also either upper-, lower-, or
centrally-aligned.
r  )r   r  r   r   r   r   r8   r  _is_same_width_as_is_lower_aligned_with_is_upper_aligned_withr  r  s   &&&   r(   r  !LTTextLineVertical.find_neighbors@  s     JJzz477Q;1dggFG 
3 23  **3*<	  ///AA2232DD66s6H C
 	
 
r  c                ,   < V ^8  d   QhRS[ RS[RS[/# r  r  )r&   r'   s   "r(   r)   r  \  r  r+   c                T    \        VP                  V P                  ,
          4      V8*  # )z8Whether the lower edge of `other` is within `tolerance`.)r   r   r  s   &&&r(   r  )LTTextLineVertical._is_lower_aligned_with\  r  r+   c                ,   < V ^8  d   QhRS[ RS[RS[/# r  r  )r&   r'   s   "r(   r)   r  `  r  r+   c                T    \        VP                  V P                  ,
          4      V8*  # )z8Whether the upper edge of `other` is within `tolerance`.)r   r   r  s   &&&r(   r  )LTTextLineVertical._is_upper_aligned_with`  r  r+   c                ,   < V ^8  d   QhRS[ RS[RS[/# r  r  )r&   r'   s   "r(   r)   r  d  r  r+   c                    \        VP                  VP                  ,           ^,          V P                  V P                  ,           ^,          ,
          4      V8*  # )z=Whether the vertical center of `other` is within `tolerance`.)r   r   r   r  s   &&&r(   r  -LTTextLineVertical._is_centrally_aligned_withd  r  r+   c                ,   < V ^8  d   QhRS[ RS[RS[/# r  r  )r&   r'   s   "r(   r)   r  l  s"     : :{ :u : :r+   c                T    \        VP                  V P                  ,
          4      V8*  # r-   )r   r   r  s   &&&r(   r  $LTTextLineVertical._is_same_width_asl  s    5;;+,	99r+   )r  r>   )r?   r@   rA   rB   r0   rr  r  r  r  r  r  rC   rD   r  r  s   @@r(   r  r  1  sR       
 
84 44 4U U: : :r+   r  c                   Z   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltR	tV t	R
# )r9   ip  zRepresents a group of text chunks in a rectangular area.

Note that this box is created by geometric analysis and does not
necessarily represents a logical boundary of the text. It contains a list
of LTTextLine objects.
c                   < V ^8  d   QhRR/# rW   r5   )r&   r'   s   "r(   r)   LTTextBox.__annotate__x  s      $ r+   c                >    \         P                  V 4       RV n        R# )r7   NrY   )r  r0   r"   rb   s   &r(   r0   LTTextBox.__init__x  s      &
r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r  |  r!  r+   c           	         R V P                   P                   RV P                   R\        V P                  4       RV P                  4       : R2	# r#  )ry   r?   r"   r   r   rz   rb   s   &r(   rc   LTTextBox.__repr__|  sH    ''($**R		"#1T]]_$7q:	
r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r    s     " "# "r+   c                    \         hr-   r~   rb   s   &r(   get_writing_modeLTTextBox.get_writing_mode  s    !!r+   r.   N)
r?   r@   rA   rB   rf   r0   rc   r
  rC   rD   rE   s   @r(   r9   r9   p  s(      
 
" "r+   r9   c                   P   a a ] tR tRt oV3R lV 3R lltV3R lR ltRtVtV ;t# )LTTextBoxHorizontali  c                $   < V ^8  d   QhRS[ RR/# ri   rk   )r&   r'   s   "r(   r)    LTTextBoxHorizontal.__annotate__       1 1 1T 1r+   c                `   < \         SV `  V4       V P                  P                  R  R7       R# )c                     V P                   ) # r-   )r   r3   s   &r(   <lambda>-LTTextBoxHorizontal.analyze.<locals>.<lambda>  
    r+   keyNr  ro   rb  sortr/   rj   ry   s   &&r(   ro   LTTextBoxHorizontal.analyze  "    !

/0r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r          # r+   c                    R # )zlr-tbr5   rb   s   &r(   r
  $LTTextBoxHorizontal.get_writing_mode      r+   r5   	r?   r@   rA   rB   ro   r
  rC   rD   r  r  s   @@r(   r  r         1 1  r+   r  c                   P   a a ] tR tRt oV3R lV 3R lltV3R lR ltRtVtV ;t# )LTTextBoxVerticali  c                $   < V ^8  d   QhRS[ RR/# ri   rk   )r&   r'   s   "r(   r)   LTTextBoxVertical.__annotate__  r  r+   c                `   < \         SV `  V4       V P                  P                  R  R7       R# )c                     V P                   ) # r-   )r   r  s   &r(   r  +LTTextBoxVertical.analyze.<locals>.<lambda>  r  r+   r  Nr  r  s   &&r(   ro   LTTextBoxVertical.analyze  r  r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r(    r  r+   c                    R # )ztb-rlr5   rb   s   &r(   r
  "LTTextBoxVertical.get_writing_mode  r"  r+   r5   r#  r  s   @@r(   r&  r&    r$  r+   r&  r:   c                   >   a a ] tR tRt oV3R lV 3R lltRtVtV ;t# )r:   i  c                4   < V ^8  d   QhRS[ S[,          RR/# ru  )r   TextGroupElement)r&   r'   s   "r(   r)   LTTextGroup.__annotate__  s!      X&67 D r+   c                F   < \         SV `  4        V P                  V4       R # r-   )r  r0   rx  )r/   rv  ry   s   &&r(   r0   LTTextGroup.__init__  s    Dr+   r5   )r?   r@   rA   rB   r0   rC   rD   r  r  s   @@r(   r:   r:     s       r+   c                   >   a a ] tR tRt oV3R lV 3R lltRtVtV ;t# )LTTextGroupLRTBi  c                $   < V ^8  d   QhRS[ RR/# ri   rk   )r&   r'   s   "r(   r)   LTTextGroupLRTB.__annotate__       
 
 
T 
r+   c                   <a \         SV `  V4       VP                  f   Q hVP                  oV P                  P	                  V3R lR7       R # )Nc                    < ^S,
          V P                   ,          ^S,           V P                  V P                  ,           ,          ,
          # r7   )r   r   r   r3   rM   s   &r(   r  )LTTextGroupLRTB.analyze.<locals>.<lambda>  s/    Q^svv5:~#&&366/23r+   r  r  ro   rM   rb  r  r/   rj   rM   ry   s   &&@r(   ro   LTTextGroupLRTB.analyze  sF    !""...((


3 	 	
r+   r5   r?   r@   rA   rB   ro   rC   rD   r  r  s   @@r(   r7  r7         
 
 
r+   r7  c                   >   a a ] tR tRt oV3R lV 3R lltRtVtV ;t# )LTTextGroupTBRLi  c                $   < V ^8  d   QhRS[ RR/# ri   rk   )r&   r'   s   "r(   r)   LTTextGroupTBRL.__annotate__  r:  r+   c                   <a \         SV `  V4       VP                  f   Q hVP                  oV P                  P	                  V3R lR7       R # )Nc                    < ^S,           ) V P                   V P                  ,           ,          ^S,
          V P                  ,          ,
          # r=  )r   r   r   r>  s   &r(   r  )LTTextGroupTBRL.analyze.<locals>.<lambda>  s2    a*n-#&&A:~'(r+   r  r@  rA  s   &&@r(   ro   LTTextGroupTBRL.analyze  sF    !""...((


( 	 	
r+   r5   rC  r  s   @@r(   rF  rF    rD  r+   rF  c                   z   a  ] tR tRt o V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR ltRt	V t
R# )LTLayoutContaineri  c                $   < V ^8  d   QhRS[ RR/# r   r   )r&   r'   s   "r(   r)   LTLayoutContainer.__annotate__  s     5 5T 5d 5r+   c                >    \         P                  W4       R V n        R # r-   )r^  r0   groupsr   s   &&r(   r0   LTLayoutContainer.__init__  s    T(04r+   c                L   < V ^8  d   QhRS[ RS[S[,          RS[S[,          /# )r!   rj   rv  r#   )rG   r   r   r   r  )r&   r'   s   "r(   r)   rP    s8     K KK {#K 
*		Kr+   c              #    "   R pR pV EF  pVEex   VP                  V4      ;'       d    \        VP                  VP                  4      VP                  ,          VP	                  V4      8  ;'       dD    VP                  V4      \        VP                  VP                  4      VP                  ,          8  pVP                  ;'       d    VP                  V4      ;'       d    \        VP                  VP                  4      VP                  ,          VP                  V4      8  ;'       dD    VP                  V4      \        VP                  VP                  4      VP                  ,          8  pV'       d   \        V\        4      '       g   V'       d)   \        V\        4      '       d   VP!                  V4       MVe   Vx  R pMV'       dA   V'       g9   \        VP"                  4      pVP!                  V4       VP!                  V4       MtV'       dA   V'       g9   \        VP"                  4      pVP!                  V4       VP!                  V4       M,\        VP"                  4      pVP!                  V4       Vx  R pTpEK  	  Vf-   \        VP"                  4      pVf   Q hVP!                  V4       Vx  R # 5ir-   )r   r   r   rI   r   r   r  r   rJ   rN   r   r   r   r8   r  r  rr  rL   )r/   rj   rv  obj0lineobj1halignvaligns   &&&     r(   group_objectsLTLayoutContainer.group_objects  s@    
 "&D $$T* I IDKK58M8MMmmD)*I I t,$**djj1H4H4HHI	 . ,, K K((.K KDJJ

3h6K6KKmmD)*K K t,$++t{{3h6J6JJK  z$0DEEz$0BCCHHTN%JDF-h.B.BCDHHTNHHTNF/0D0DEDHHTNHHTN/0D0DEDHHTNJDD @ <'(<(<=D###HHTN
sK   'KA
K5AKK%A
K0AK<K:KK?KK%B!Kc                L   < V ^8  d   QhRS[ RS[S[,          RS[S[,          /# )r!   rj   linesr#   )rG   r   r  r   r9   )r&   r'   s   "r(   r)   rP    s3          
#  
)		 r+   c              #    "   \        V P                  4      pVP                  V4       / pV F  pVP                  W1P                  4      pV.pV F<  pVP                  V4       W9   g   K  VP                  VP                  V4      4       K>  	  \        V\        4      '       d   \        4       p	M
\        4       p	\        V4       F  p
V	P                  V
4       WV
&   K  	  K  	  \        4       pV FH  pWT9  d   K  WE,          p	W9   d   K  VP                  V	4       V	P                  4       '       d   KD  V	x  KJ  	  R# 5i)z$Group neighboring lines to textboxesN)r   r   rx  r  rK   rq  popr8   r  r  r&  r   rr  setr   )r/   rj   r^  r  boxesrW  	neighborsmembersrX  boxr3   dones   &&&         r(   group_textlines!LTLayoutContainer.group_textlines  s     $)#3U-/D++E3G3GHIfG!t$=NN599T?3 " $ 455!4!6')G} c
 %  uD +C{HHSM<<>>	 s   A%E ,CE 6
E c                L   < V ^8  d   QhRS[ RS[S[,          RS[S[,          /# )r!   rj   rb  r#   )rG   r   r9   r   r:   )r&   r'   s   "r(   r)   rP  .  s8     [5 [5[5 	"[5 
k		[5r+   c           
       aa \         \        \        3,          o\        V P                  4      oR R lpV3R lV3R llp. p\        \        V4      4       Fd  pW&,          p\        V^,           \        V4      4       F9  pW(,          p	VP                  RV! Wy4      \        V4      \        V	4      Wy34       K;  	  Kf  	  \        P                  ! V4       SP                  V4       \        4       p
\        V4      ^ 8  Ed:   \        P                  ! V4      w  rrppW9  g   K4  W9  g   K<  V'       g-   V! VV4      '       d   \        P                  ! VRWWV34       Kp  \        V\         \"        34      '       g   \        V\         \"        34      '       d   \#        VV.4      pM\%        VV.4      pSP'                  V4       SP'                  V4       V
P)                  W.4       S F9  p\        P                  ! VRV! VV4      \        V4      \        V4      VV34       K;  	  SP+                  V4       EKJ  S Uu. uF  p\-        \        V4      NK  	  up# u upi )a  Group textboxes hierarchically.

Get pair-wise distances, via dist func defined below, and then merge
from the closest textbox pair. Once obj1 and obj2 are merged /
grouped, the resulting group is considered as a new object, and its
distances to other objects & groups are added to the process queue.

For performance reason, pair-wise distances and object pair info are
maintained in a heap of (idx, dist, id(obj1), id(obj2), obj1, obj2)
tuples. It ensures quick access to the smallest element. Note that
since comparison operators, e.g., __lt__, are disabled for
LTComponent, id(obj) has to appear before obj in element tuples.

:param laparams: LAParams object.
:param boxes: All textbox objects to be grouped.
:return: a list that has only one element, the final top level group.
c                <    V ^8  d   QhR\         R\         R\        /# r!   rX  obj2r#   )r   rP   )r&   s   "r(   r)   7LTLayoutContainer.group_textboxes.<locals>.__annotate__G  s!     	 	{ 	+ 	% 	r+   c                   \        V P                  VP                  4      p\        V P                  VP                  4      p\        V P                  VP                  4      p\        V P
                  VP
                  4      pWB,
          WS,
          ,          V P                  V P                  ,          ,
          VP                  VP                  ,          ,
          # )aX  A distance function between two TextBoxes.

Consider the bounding rectangle for obj1 and obj2.
Return its area less the areas of obj1 and obj2,
shown as 'www' below. This value may be negative.
        +------+..........+ (x1, y1)
        | obj1 |wwwwwwwwww:
        +------+www+------+
        :wwwwwwwwww| obj2 |
(x0, y0) +..........+------+
)r   r   r   r  r   r   r   r   )rX  rm  r   r   r   r   s   &&    r(   dist/LTLayoutContainer.group_textboxes.<locals>.distG  s     TWWdgg&BTWWdgg&BTWWdgg&BTWWdgg&BRW%**t{{*+**t{{*+r+   c                <   < V ^8  d   QhRSRSR\         S,          /# rl  )ra  )r&   ElementTs   "r(   r)   rn  ]  s&     	1 	1 	1 	1S] 	1r+   c                `  < \        V P                  VP                  4      p\        V P                  VP                  4      p\        V P                  VP                  4      p\        V P
                  VP
                  4      p\        SP                  W#WE34      4      pVP                  W34      # )z8Check if there's any other object between obj1 and obj2.)	r   r   r   r  r   r   ra  r  
difference)rX  rm  r   r   r   r   rv  r  s   &&     r(   isany0LTLayoutContainer.group_textboxes.<locals>.isany]  s|    TWWdgg&BTWWdgg&BTWWdgg&BTWWdgg&Buzz22"234D??D<00r+   FT)r   r9   r:   r   r   rangerk  rq  idheapqheapifyrx  ra  heappopheappushr8   r&  rF  r7  removeupdaterr  r	   )r/   rj   rb  rp  rv  distsibox1jbox2rf  
skip_isanyrP  id1id2rX  rm  groupr  grs  r  s   &&&                 @@r(   group_textboxes!LTLayoutContainer.group_textboxes.  s   , K/0!&tyy!1	,	1 	1 IKs5z"A8D1q5#e*-xeT$%5r$xD4VW . #
 	eUu%j1n49MM%4H1ZCdDco!eD$&7&7NN54D*IJd%6$HIIZ&8N N *9$)FE+T4L9ET"T"SJ'"ENNUE 2BuIr%y%QVW #
 		% .34e[!$e444s   >Ic                $   < V ^8  d   QhRS[ RR/# ri   rk   )r&   r'   s   "r(   r)   rP    s     #
 #
 #
T #
r+   c                   \        R  V 4      w  r#V F  pVP                  V4       K  	  V'       g   R# \        V P                  W4      4      p\        R V4      w  reV F  pVP                  V4       K  	  \        V P	                  W4      4      pVP
                  f4   V F  pVP                  V4       K  	  R R lp	VP                  V	R7       MhV P                  W4      V n        \        4       p
V P                   F%  pVP                  V4       V
P                  V4       K'  	  VP                  R R7       \        \        \        ,          V4      V,           \        \        \        ,          V4      ,           V n        R# )c                 "    \        V \        4      # r-   )r8   r7  r  s   &r(   r  +LTLayoutContainer.analyze.<locals>.<lambda>  s    :c63Jr+   Nc                 "    V P                  4       # r-   )r   r  s   &r(   r  r    s
    #,,.r+   c                \    V ^8  d   QhR\         R\        \        \        \        3,          /# )r!   re  r#   )r9   r   r%   rP   )r&   s   "r(   r)   /LTLayoutContainer.analyze.<locals>.__annotate__  s&     0 0I 0%UE0A*B 0r+   c                     \        V \        4      '       d   ^ V P                  ) V P                  ) 3# ^V P                  ) V P                  3# r>   )r8   r&  r   r   r   re  s   &r(   getkey)LTLayoutContainer.analyze.<locals>.getkey  s@    c#455w00w//r+   r  c                     V P                   # r-   r.   r  s   &r(   r  r    s    399r+   )r   ro   r   r[  rg  rM   r  r  rR  r   r;   r	   r   rb  )r/   rj   textobjs	otherobjsr3   	textlinesempties	textboxestextboxr  assignerr  s   &&          r(   ro   LTLayoutContainer.analyze  s9    !''JD QCKK! ++H?@	%&@)LCKK! --hBC	&$) %0 NNvN&..xCDK$Hh'U# % NN4N5k"I.4$g./ 	
r+   )rb  rR  N)r?   r@   rA   rB   r0   r[  rg  r  ro   rC   rD   rE   s   @r(   rN  rN    s>     5 5
K KZ   D[5 [5z#
 #
r+   rN  c                   Z   a  ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltR	tV t	R
# )LTFigurei  zRepresents an area used by PDF Form objects.

PDF Forms can be used to present figures or pictures by embedding yet
another PDF document within a page. Note that LTFigure objects can appear
recursively.
c                0   < V ^8  d   QhRS[ RS[RS[RR/# )r!   r  r   r9  r#   N)r_   r   r   )r&   r'   s   "r(   r)   LTFigure.__annotate__  s)     / /S / /f / /r+   c                    Wn         W0n        Vw  rErgWEWF,           WW,           3p\        W84      p\        P	                  W4       R # r-   )r  r9  r   rN  r0   )	r/   r  r   r9  r<   ywhrects	   &&&&     r(   r0   LTFigure.__init__  s=    	qaeQU# .""4.r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r         
 
# 
r+   c           
         R V P                   P                   RV P                   R\        V P                  4       R\        V P                  4       R2	# )rw   r$  r%  rV  ra   )ry   r?   r  r   r   r   r9  rb   s   &r(   rc   LTFigure.__repr__  sO    ''($))B		"# $ -.a1	
r+   c                $   < V ^8  d   QhRS[ RR/# ri   rk   )r&   r'   s   "r(   r)   r    s     2 2 2T 2r+   c                X    VP                   '       g   R # \        P                  W4       R # r-   )rO   rN  ro   rn   s   &&r(   ro   LTFigure.analyze  s    !!!!!$1r+   )r9  r  N)
r?   r@   rA   rB   rf   r0   rc   ro   rC   rD   rE   s   @r(   r  r    s(     / /
 
2 2r+   r  c                   L   a  ] tR tRt o RtR	V 3R lR lltV 3R lR ltRtV tR# )
LTPagei  zRepresents an entire page.

Like any other LTLayoutContainer, an LTPage can be iterated to obtain child
objects like LTTextBox, LTFigure, LTImage, LTRect, LTCurve and LTLine.
c                0   < V ^8  d   QhRS[ RS[RS[RR/# )r!   pageidr   rotater#   N)r%   r   rP   )r&   r'   s   "r(   r)   LTPage.__annotate__  s)      s $  d r+   c                H    \         P                  W4       Wn        W0n        R # r-   )rN  r0   r  r  )r/   r  r   r  s   &&&&r(   r0   LTPage.__init__  s    ""4.r+   c                    < V ^8  d   QhRS[ /# r]   r^   )r&   r'   s   "r(   r)   r    r  r+   c           	         R V P                   P                   RV P                  : R\        V P                  4       RV P
                  : R2	# )rw   r$  r%  z rotate=ra   )ry   r?   r  r   r   r  rb   s   &r(   rc   LTPage.__repr__  sI    ''($++		"# $kk_A'	
r+   )r  r  Nr>   r'  rE   s   @r(   r  r    s      

 
r+   r  )Erz  loggingcollections.abcr   r   r   typingr   r   r   r	   pdfminer.pdfcolorr
   pdfminer.pdfexceptionsr   r   pdfminer.pdffontr   pdfminer.pdfinterpr   r   pdfminer.pdftypesr   pdfminer.utilsr   r   r   r   r   r   r   r   r   r   r   r   r   	getLoggerr?   loggerr   rG   r4   rr   r   r   r   r  r
  r)  r7  r[  r^  r  r  TextLineElementr  r  r  r9   r  r&  r2  r:   r7  rF  rN  r  r  r5   r+   r(   <module>r     s     8 8  , > $ 5 '     
		8	$
 
@
 @
F+ +" "F& FR!Fk !FH
W 
B
W 
B
k 
0VV :[& :z )6
*"+ww/ "2
K0 
$
+G4f 
 '?1 ?<<<: <<~<: <:~"
+ ",) 	  M12 /"23 	
k 	
	
k 	
u
K0 u
p2  2:
 
r+   