ó
    /j-jÔ  ã                  ó`  • S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ r   SSK!r"SSK#J$r%  SSK#J&r&  SSK#J'r'  SSK#J(r(  SSK#J)r)  SSK#J*r*  SSK#J+r+  SSK#J,r,  SSK#J-r-  SSK#J.r.  \/" \\-   \-   5      r0\0Rc                  S5        S r2\	Rf                  \	Rh                  -   \	Rj                  -   r6S r7SPS jr8/ SQr9\9/ SQ-   r:\9/ SQ-   r;\9/ S Q-   r<\:\:\;\:\;-   \<S!.r=SQS" jr>SQS# jr? " S$ S%5      r@SRS& jrASSS' jrBSTS( jrCS) rD          SUS* jrES+ rFS, rGS- rHS. rIS/ rJS0 rKS1rLSVS2 jrMSWS3 jrNS4 rOS5 rPS6 rQS7 rRS8 rSSXS9 jrTSXS: jrUSYS; jrVSZS< jrWS= rXS> 4       S[S? jjrYSYS@ jrZS\SA jr[SB r\S]SC jr] S]       S^SD jjr^  S_           S`SE jjr_  SaSF jr`  SaSG jra          SbSH jrb ScSI jrcSJ rdSK reSdSL jrf       SeSM jrgSfSN jrh    SgSO jrig)hz1General helper utilities to parse the pdf tables.é    )ÚannotationsN)Úbisect_left)ÚCallable)Úgroupby)Ú
itemgetter)ÚPath)ÚAny)Úurlparse)Úuses_netloc)Úuses_params)Úuses_relative)ÚRequest)Úurlopen)ÚLAParams)ÚLTAnno)ÚLTChar)ÚLTContainer)ÚLTImage)ÚLTItem)Ú
LTTextLine)ÚLTTextLineHorizontal)ÚLTTextLineVerticalÚ c                ó\   •  [        U 5      R                  [        ;   $ ! [         a     gf = f)z´Check to see if a URL has a valid protocol.

Parameters
----------
url : str or unicode

Returns
-------
isurl : bool
    If url has a valid protocol return True otherwise False.

F)Ú	parse_urlÚschemeÚ_VALID_URLSÚ	Exception)Úurls    ÚJ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/camelot/utils.pyÚis_urlr!   ,   s.   € ðÜ˜‹~×$Ñ$¬Ñ3Ð3øÜó Ùðús   ‚ ž
+ª+c                óR   • SR                  [        R                  " [        U S95      $ )zšGenerate a random string.

Parameters
----------
length : int
    The length of the string to return.

Returns
-------
string
    returns a random string
r   )Úk)ÚjoinÚrandomÚchoicesÚ_RANDOM_STRING_ALPHABET)Úlengths    r    Úrandom_stringr)   D   s   € ð  �7‰7”6—>’>Ô"9¸VÑDÓEÐEó    c                ó&  • [        S5       S3n[        R                  " SSS9 nSSS.n[        U S	U5      n[	        U5      nUR                  5       R                  5       nUS
:w  a  [        S5      eUR                  UR                  5       5        S	S	S	5        [        R                  R                  [        R                  R                  WR                  5      U5      n[        R                   " UR                  U5        U$ ! , (       d  f       Nx= f)z‰Download file from specified URL.

Parameters
----------
url : str

Returns
-------
filepath : Union[str, Path]
    Temporary filepath.

é   z.pdfÚwbF)ÚdeletezMozilla/5.0z<gzip;q=1.0, deflate;q=0.9, br;q=0.8, compress;q=0.7, *;q=0.1)z
User-AgentzAccept-EncodingNzapplication/pdfzFile format not supported)r)   ÚtempfileÚNamedTemporaryFiler   r   ÚinfoÚget_content_typeÚNotImplementedErrorÚwriteÚreadÚosÚpathr$   ÚdirnameÚnameÚshutilÚmove)r   ÚfilenameÚfÚheadersÚrequestÚobjÚcontent_typeÚfilepaths           r    Údownload_urlrC   W   sØ   € ô   Ó"Ð# 4Ð(€HÜ	×	$Ò	$ T°%Ò	8¸Að (Ø]ñ
ˆô ˜#˜t WÓ-ˆÜ�gÓˆØ—x‘x“z×2Ñ2Ó4ˆØÐ,Ó,Ü%Ð&AÓBÐBØ	�‰�—‘“
Ô÷ 
9ô �w‰w�|‰|œBŸG™GŸO™O¨A¯F©FÓ3°XÓ>€HÜ
‡K‚K�—‘˜Ô!Ø€O÷ 
9Õ	8ús   ¤A,DÄ
D)Ú	flag_sizeÚmarginsÚreplace_textÚ
split_textÚ
strip_textÚtable_areasÚtable_regionsÚbackend)ÚcolumnsÚedge_tolÚrow_tolÚ
column_tol)Úprocess_backgroundÚ
line_scaleÚ	copy_textÚ
shift_textÚline_tolÚ	joint_tolÚthreshold_blocksizeÚthreshold_constantÚ
iterationsÚerode_iterationsÚ
resolutionÚuse_fallbackÚengine)rR   rS   rZ   r[   ÚdeviceÚstructure_modelÚdetection_modelÚdetection_thresholdÚstructure_thresholdÚcrop_paddingÚocr)ÚstreamÚnetworkÚlatticeÚhybridÚmlc           	     óì   • [         U   n[        U R                  5       5      R                  [        U5      5      nU(       a3  [	        SR                  SR                  [        U5      5      U5      5      eg)zÇValidates input keyword arguments.

Parameters
----------
kwargs : [type]
    [description]
flavor : str, optional
    [description], by default "lattice"

Raises
------
ValueError
    [description]
z"{} cannot be used with flavor='{}'Ú,N)Úflavor_to_kwargsÚsetÚkeysÚ
differenceÚ
ValueErrorÚformatr$   Úsorted)ÚkwargsÚflavorÚparser_kwargsÚisecs       r    Úvalidate_inputrv   ©   sa   € ô % VÑ,€Mäˆv�{‰{‹}Ó×(Ñ(¬¨]Ó);Ó<€DÞÜØ0×7Ñ7¸¿¹ÄÈÃÓ8NÐPVÓWó
ð 	
ð r*   c                óŒ   • [         U   n[        U R                  5       5      nU H  nXB;  d  M
  U R                  U5        M     U $ )zÜRemove extra key - value pairs from a kwargs dictionary.

Parameters
----------
kwargs : [type]
    [description]
flavor : str, optional
    [description], by default "lattice"

Returns
-------
[type]
    [description]

)rk   Úlistrm   Úpop)rr   rs   rt   Úkwargs_keysÚkeys        r    Úremove_extrar|   Á   s@   € ô  % VÑ,€Mä�v—{‘{“}Ó%€KÛˆØÕ#Ø�J‰J�sŽOñ ð €Mr*   c                  ó$   • \ rS rSrSrS rS rSrg)ÚTemporaryDirectoryéÜ   zAA class method that will be used to create temporary directories.c                ó¬   • [         R                  " 5       U l        [        R                  " [
        R                  U R                  5        U R                  $ )zJEnter the temporary directory .

Returns
-------
[type]
    [description]
)r/   Úmkdtempr9   ÚatexitÚregisterr:   Úrmtree)Úselfs    r    Ú	__enter__ÚTemporaryDirectory.__enter__ß   s6   € ô ×$Ò$Ó&ˆŒ	ô 	�ŠœŸ™ t§y¡yÔ1Ø�y‰yÐr*   c                ó   • g)z£Called when the client exits.

Parameters
----------
exc_type : [type]
    [description]
exc_value : [type]
    [description]
traceback : [type]
    [description]
N© )r…   Úexc_typeÚ	exc_valueÚ	tracebacks       r    Ú__exit__ÚTemporaryDirectory.__exit__í   s   � r*   )r9   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r†   r�   Ú__static_attributes__r‰   r*   r    r~   r~   Ü   s   † ÙKòõr*   r~   c                ó¤   • [        5        nU(       a  X-   n [        R                  R                  X 5      nSSS5        U$ ! , (       d  f       W$ = f)z›Generate a new path within a temporary directory.

Parameters
----------
filename : str
extension : str

Returns
-------
file_path_in_temporary_dir : str

N)r~   r6   r7   r$   )r<   Ú	extensionÚtemp_dirr7   s       r    Úbuild_file_path_in_temp_dirr˜   û   sE   € ô 
Ô	 ÞØÑ+ˆHÜ�w‰w�|‰|˜HÓ/ˆ÷ 
ð €K÷	 
Ô	ð €Kús   ‹+A Á 
Ac                ó
   • X-   $ )z²Translate x2 by x1.

Parameters
----------
x1 : float
    The offset to apply.
x2 : float
    The original y-coordinate.

Returns
-------
float
    The translated y-coordinate.

r‰   )Úx1Úx2s     r    Ú	translaterœ     s   € ð  ‰7€Nr*   c                ó
   • X-  $ )z²Scale a given value by a factor.

Parameters
----------
value : float
    The value to scale.
factor : float
    The scaling factor.

Returns
-------
float
    The scaled value.
r‰   )ÚvalueÚfactors     r    Úscaler    "  s   € ð ‰>Ðr*   c                ó  • U u  p#pEUu  pgn[        X&5      n[        [        [        U* U5      5      U5      n[        XF5      n[        [        [        U* U5      5      U5      n[        U5      [        U5      [        U5      [        U5      4n	U	$ )a/  Translate and scale pdf coordinate space to image coordinate space.

Parameters
----------
k : tuple
    Tuple (x1, y1, x2, y2) representing table bounding box where
    (x1, y1) -> lt and (x2, y2) -> rb in PDFMiner coordinate
    space.
factors : tuple
    Tuple (scaling_factor_x, scaling_factor_y, pdf_y) where the
    first two elements are scaling factors and pdf_y is height of
    pdf.

Returns
-------
knew : tuple
    Tuple (x1, y1, x2, y2) representing table bounding box where
    (x1, y1) -> lt and (x2, y2) -> rb in OpenCV coordinate
    space.

)r    Úabsrœ   Úint)
r#   Úfactorsrš   Úy1r›   Úy2Úscaling_factor_xÚscaling_factor_yÚpdf_yÚknews
             r    Ú	scale_pdfr«   4  s…   € ð, �N€BˆBØ07Ñ-Ð¨Ü	ˆrÓ	$€BÜ	Œs”9˜e˜V RÓ(Ó)Ð+;Ó	<€BÜ	ˆrÓ	$€BÜ	Œs”9˜e˜V RÓ(Ó)Ð+;Ó	<€BÜ�‹G”S˜“Wœc "›g¤s¨2£wÐ/€DØ€Kr*   c                óø  • Uu  pEn0 nU R                  5        HÑ  nUu  pšp¼[        X”5      n	[        [        [        U* U
5      5      U5      n
[        X´5      n[        [        [        U* U5      5      U5      n[	        X   6 u  pÞU Vs/ s H  n[        Xô5      PM     nnU Vs/ s H#  n[        [        [        U* U5      5      U5      PM%     nnS[        [	        UU5      5      0XyX«U4'   MÓ     / nU Hx  n[        US   U5      [        US   U5      p¹[        [        [        U* US   5      5      U5      [        [        [        U* US   5      5      U5      pÊUR                  XšX¼45        Mz     / nU Hx  n[        US   U5      [        US   U5      p¹[        [        [        U* US   5      5      U5      [        [        [        U* US   5      5      U5      pÊUR                  XšX¼45        Mz     UUU4$ s  snf s  snf )a?  Translate and scale image coordinate space to PDF coordinate space.

Parameters
----------
tables : dict
    A dictionary with table boundaries as keys (tuples of four floats)
    and a list of intersections (list of tuples of two floats) as values.
v_segments : list
    A list of vertical line segments, where each segment is a tuple
    of four floats (x1, y1, x2, y2).
h_segments : list
    A list of horizontal line segments, where each segment is a tuple
    of four floats (x1, y1, x2, y2).
factors : tuple
    A tuple (scaling_factor_x, scaling_factor_y, img_y) where the
    first two elements are scaling factors and img_y is the height of
    the image.

Returns
-------
Tuple[Dict[Tuple[float, float, float, float], Dict[str, List[Tuple[float, float]]]],
      List[Tuple[float, float, float, float]],
      List[Tuple[float, float, float, float]]]
    A tuple containing:
    - tables_new: A new dictionary with scaled table boundaries and joints.
    - v_segments_new: A new list of scaled vertical segments.
    - h_segments_new: A new list of scaled horizontal segments.
Újointsr   é   é   é   )rm   r    r¢   rœ   Úziprx   Úappend)ÚtablesÚ
v_segmentsÚ
h_segmentsr¤   r§   r¨   Úimg_yÚ
tables_newr#   rš   r¥   r›   r¦   Új_xÚj_yÚjÚ
j_x_scaledÚ
j_y_scaledÚv_segments_newÚvÚh_segments_newÚhs                         r    Úscale_imagerÁ   T  s  € ðL 18Ñ-Ð¨Ø€Jà�[‰[Ž]ˆØ‰ˆ�Ü�2Ó(ˆÜ”3”y % ¨Ó,Ó-Ð/?Ó@ˆÜ�2Ó(ˆÜ”3”y % ¨Ó,Ó-Ð/?Ó@ˆô ˜™	�?‰ˆÙ:=Ó>º#°Q”e˜AÖ0¹#ˆ
Ð>ÙRUÓVÒRUÈQ”eœC¤	¨5¨&°!Ó 4Ó5Ð7GÖHÑRUˆ
ÐVð ”dœ3˜z¨:Ó6Ó7ð(
ˆ
˜ Ð#Ó$ñ ð" €NÛˆÜ�q˜‘tÐ-Ó.´°a¸±dÐ<LÓ0MˆBä”#”i  ¨¨!©Ó-Ó.Ð0@ÓAÜ”#”i  ¨¨!©Ó-Ó.Ð0@ÓAð ð 	×Ñ˜r rÐ.Ö/ñ ð €NÛˆÜ�q˜‘tÐ-Ó.´°a¸±dÐ<LÓ0MˆBä”#”i  ¨¨!©Ó-Ó.Ð0@ÓAÜ”#”i  ¨¨!©Ó-Ó.Ð0@ÓAð ð 	×Ñ˜r rÐ.Ö/ñ ð �~ ~Ð5Ð5ùò7 ?ùÚVs   ÂG2Â!*G7c                ó‚  • Sn[        U Vs/ s H)  oDR                  5       R                  5       (       d  M'  UPM+     sn5      n[        U Vs/ s H)  oDR                  5       R                  5       (       d  M'  UPM+     sn5      nXV:  a-  [        S U  5       5      n[        S U  5       5      nXx:  a  SOSnU$ s  snf s  snf )a  Get text rotation.

Detects if text in table is rotated or not using the current
transformation matrix (CTM) and returns its orientation.

Parameters
----------
horizontal_text : list
    List of PDFMiner LTTextLineHorizontal objects.
vertical_text : list
    List of PDFMiner LTTextLineVertical objects.
ltchar : list
    List of PDFMiner LTChar objects.

Returns
-------
rotation : string
    '' if text in table is upright, 'anticlockwise' if
    rotated 90 degree anticlockwise and 'clockwise' if
    rotated 90 degree clockwise.

r   c              3  óv   #   • U  H/  oR                   S    S:  =(       a    UR                   S   S:„  v •  M1     g7f©r¯   r   r®   N©Úmatrix©Ú.0Úts     r    Ú	<genexpr>Úget_rotation.<locals>.<genexpr>¿  s.   é € ÐKÂUÀŸ™ ™ a™×;¨A¯H©H°Q©K¸!©OÔ;ÂUùó   ‚79c              3  óv   #   • U  H/  oR                   S    S:„  =(       a    UR                   S   S:  v •  M1     g7frÄ   rÅ   rÇ   s     r    rÊ   rË   À  s.   é € ÐOÊÀAŸH™H Q™K¨!™O×?°·±¸±¸a±Ô?ÊùrÌ   ÚanticlockwiseÚ	clockwise)ÚlenÚget_textÚstripÚsum)	ÚcharsÚhorizontal_textÚvertical_textÚrotationrÉ   ÚhlenÚvlenrÏ   rÎ   s	            r    Úget_rotationrÚ   ¤  s˜   € ð. €HÜ™?ÓCš?�a¯j©j«l×.@Ñ.@×.B—™?ÑCÓD€DÜ™=ÓAš=�a¯J©J«L×,>Ñ,>×,@—™=ÑAÓB€DØƒ{ÜÑKÁUÓKÓKˆ	ÜÑOÉÓOÓOˆØ&/Ó&?‘?À[ˆØ€Oùò DùÚAs   Œ&B7¶B7Á&B<Á6B<c                óœ  • U S   U S   4nU S   U S   4nU Vs/ s HI  nUS   US   S-
  :”  d  M  US   US   S-   :  d  M%  US   S-
  US   s=::  a  US   S-   ::  d  MC  O  MG  UPMK     nnU Vs/ s HI  nUS   US   S-
  :”  d  M  US   US   S-   :  d  M%  US   S-
  US   s=::  a  US   S-   ::  d  MC  O  MG  UPMK     nnXh4$ s  snf s  snf )añ  Return all line segments present inside a bounding box.

Parameters
----------
bbox : tuple
    Tuple (x1, y1, x2, y2) representing a bounding box where
    (x1, y1) -> lb and (x2, y2) -> rt in PDFMiner coordinate
    space.
v_segments : list
    List of vertical line segments.
h_segments : list
    List of vertical horizontal segments.

Returns
-------
v_s : list
    List of vertical line segments that lie inside table.
h_s : list
    List of horizontal line segments that lie inside table.

r   r¯   r®   r°   r‰   )	Úbboxr´   rµ   ÚlbÚrtr¾   Úv_srÀ   Úh_ss	            r    Úsegments_in_bboxrá   Å  s7  € ð, ˆq‰'�4˜‘7Ð	€BØ
ˆq‰'�4˜‘7Ð	€Bñ óâˆAØˆQ‰4�"�Q‘%˜!‘)Ñó 	
à ! !¡ r¨!¡u¨q¡yÑ 0ó 	
à57¸±U¸Q±YÀ!ÀAÁ$Õ5SÈ"ÈQÉ%ÐRSÉ)Ñ5Só 	
á5Sõ 	
Ùð ð ñ óâˆAØˆQ‰4�"�Q‘%˜!‘)Ñó 	
à ! !¡ r¨!¡u¨q¡yÑ 0ó 	
à57¸±U¸Q±YÀ!ÀAÁ$Õ5SÈ"ÈQÉ%ÐRSÉ)Ñ5Só 	
á5Sõ 	
Ùð ð ð
 ˆ8€Oùòùò
s:   ™C°CÁCÁCÁ#CÁ/C	ÂC	ÂC	Â5C	Â9C	c                óÌ   • U R                   U R                  U R                   U R                  -   S-  U R                  U R                  U R                  U R                  -   S-  S.$ )zACalculate the coordinates of each alignment for a given textline.ç       @)ÚleftÚrightÚmiddleÚbottomÚtopÚcenter)Úx0rš   Úy0r¥   )Útextlines    r    Úget_textline_coordsrí   ê  sT   € ð —‘Ø—‘Ø—;‘; §¡Ñ,°Ñ3Ø—+‘+Ø�{‰{Ø—;‘; §¡Ñ,°Ñ3ñð r*   c                óB  • U R                  S5      n[        U5      S:w  a  [        SU < S35      e S U 5       u  p#pEX$:X  d  X5:X  a  [        SU < S35      e[        X$5      [        X55      [	        X$5      [	        X55      4$ ! [         a    [        SU < S35      Sef = f)	uU  Deserialize bbox from string ("x1,y1,x2,y2") to tuple (x1, y1, x2, y2).

Parameters
----------
bbox_str : str
    Serialized bbox with comma separated coordinates, "x1,y1,x2,y2".

Returns
-------
bbox : tuple
    Tuple (x1, y1, x2, y2).

Raises
------
ValueError
    If the string isn't four numbers, or describes a zero-area box.
    The latter is the usual cause of the otherwise cryptic
    ``ZeroDivisionError`` downstream (#63), commonly because the
    coordinates came from a top-left-origin tool â€” PDF space has its
    origin at the bottom-left, so ``y1`` must be greater than ``y2``.

rj   é   zInvalid table area/region zB: expected four comma-separated numbers in the form 'x1,y1,x2,y2'.c              3  ó8   #   • U  H  n[        U5      v •  M     g 7f©N)Úfloat)rÈ   Úps     r    rÊ   Ú bbox_from_str.<locals>.<genexpr>  s   é € Ð2ªE qœ% Ÿ(˜(ªEùó   ‚z9: coordinates must be numbers, in the form 'x1,y1,x2,y2'.NuÚ   : it has zero width or height. Use 'x1,y1,x2,y2' where (x1, y1) is the top-left and (x2, y2) the bottom-right corner in PDF coordinate space â€” the origin is the bottom-left of the page, so y1 must be greater than y2.)ÚsplitrÐ   ro   ÚminÚmax)Úbbox_strÚpartsrš   r¥   r›   r¦   s         r    Úbbox_from_strrû   ö  sÎ   € ð. �N‰N˜3Ó€EÜ
ˆ5ƒz�QƒÜØ(¨©ð 5Að Aó
ð 	
ðÙ2©EÓ2‰ˆ�ð 
ƒx�2“8ÜØ(¨©ð 5ð ó
ð 	
ô �‹Kœ˜R›¤c¨"£k´3°r³;Ð?Ð?øô ó ÜØ(¨©ð 52ð 2ó
ð ð	ðús   ²B ÂBc                óà   • U u  p#pEUu  pgp‰X&s=:  =(       a    U:  Os  =(       d    X(s=:  =(       a    U:  Os  =(       a/    X7s=:  =(       a    U:  Os  =(       d    X9s=:  =(       a    U:  $ s  $ )a   Check if boundingboxes overlap.

Parameters
----------
bbox1 : tuple
    Tuple (x1, y1, x2, y2) representing a bounding box where
    (x1, y1) -> lb and (x2, y2) -> rt in the PDF coordinate
    space.
bbox2 : tuple
    Tuple (x1, y1, x2, y2) representing a bounding box where
    (x1, y1) -> lb and (x2, y2) -> rt in the PDF coordinate
    space.

Returns
-------
bool
    Returns True if two bounding boxes overlap
r‰   )
Úbbox1Úbbox2Úleft1Úbottom1Úright1Útop1Úleft2Úbottom2Úright2Útop2s
             r    Úbboxes_overlapr  %  sf   € ð& $)Ñ €E�FØ#(Ñ €E�FØ×#Ó#˜VÔ#×A¨×)@Ó)@¸&Ô)@÷ Ø	×	!Ó	!˜TÔ	!×= w×'<Ó'<¸Ñ'<ðÙ'<ðr*   c           
     ó°   • U Vs/ s HC  n[        XR                  UR                  UR                  UR                  45      (       d  MA  UPME     nnU$ s  snf )aZ  Return all text objects which overlap or are within a bounding box.

Parameters
----------
bbox : tuple
    Tuple (x1, y1, x2, y2) representing a bounding box where
    (x1, y1) -> lb and (x2, y2) -> rt in the PDF coordinate
    space.
textlines : List of PDFMiner text objects.

Returns
-------
t_bbox : list
    List of PDFMiner text objects.

)r  rê   rë   rš   r¥   )rÜ   Ú	textlinesrÉ   Út_bboxs       r    Útextlines_overlapping_bboxr  ?  sC   € ñ" #ÓUš�A¤n°T¿D¹DÀ!Ç$Á$ÈÏÉÈaÏdÉdÐ;S×&T�a™€FÐUØ€Mùò Vs   …A AÁ	AiÜ  c                ód   • [        U SS5      nUc  gU" 5       nU(       a  UR                  5       $ S$ )a   Whitespace-stripped text of a PDFMiner-style textline (#288, #625).

Returns ``""`` if the textline has no get_text or no content. Used by
the text_in_bbox dedup pass to confirm overlapping bboxes are *actual*
duplicates before discarding the shorter one.
rÑ   Nr   )ÚgetattrrÒ   )rÉ   ÚgetterÚss      r    Ú_normalised_textline_textr  Z  s4   € ô �Q˜
 DÓ)€FØ�~ØÙ‹€AÞˆ1�7‰7‹9Ð!˜rÐ!r*   c                ó   • U (       d  gX:H  $ )u“  Return True if textline A's content can be considered a duplicate of B's.

The bbox-overlap dedup pass introduced in #206 (to fix #15) was meant
to drop *literal* duplicate textlines emitted by PDF font-render
quirks â€” typically two textlines with identical content placed at
nearly the same coordinates. Skipping the content check made it also
discard legitimate adjacent-cell text whenever a wide neighbour's
bbox happened to cover it (#288, #625). Restricting the discard to
*equal* stripped text matches #206's original intent without false
positives (a single-char "B" textline is not a duplicate of a wider
sibling that merely contains the letter B).
Tr‰   )Úa_textÚb_texts     r    Ú_is_textual_duplicater  h  s   € ö ØØÑÐr*   c                ó&  • [        U 5      n[        5       nU  Vs/ s H  n[        U5      PM     nn[        U5       H¤  nXR;   a  M
  X   n[	        U5      nXE   n[        U5       Hx  n	XY:X  d  X’;   a  M  X	   n
[        Xj5      (       d  M%  US:X  d  [        Xj5      U-  S:”  d  M?  [        X¦5      (       d  MQ  [        X„U	   5      (       d  Mf  UR                  U5          M¢     M¦     [        U5       Vs/ s H  oUU;  d  M
  X   PM     sn$ s  snf s  snf )zÅReference Python implementation of the >80%-contained discard pass.

Used as a fallback when ``len(t_bbox)`` is large enough that the
NumPy NxN intersection matrix would exceed comfortable memory.
r   çš™™™™™é?)
rÐ   rl   r  ÚrangeÚ	bbox_areaÚbbox_intersectÚbbox_intersection_areaÚbbox_longerr  Úadd)r
  ÚnÚ	discardedrÉ   ÚtextsÚiÚbaÚba_areaÚai_textrº   Úbbs              r    Ú_text_in_bbox_loopr%  z  sû   € ô 	ˆF‹€AÜ›%€IÙ39Ó:²6¨aÔ& qÖ)±6€EÐ:Ü�1ŽXˆØ‹>ÙØ‰YˆÜ˜B“-ˆØ‘(ˆÜ�q–ˆAØ‹v˜›ÙØ‘ˆBÜ! "×)Ñ)ÙØ˜!‹|Ô 6°rÓ >ÀÑ HÈCÕOÜ˜r×&Ó&Ô+@ÀÐPQÉ(×+SÓ+SØ—M‘M !Ô$Úó ñ ô   % QœxÓ>šx˜!°IÑ+=‹IˆFŒI™xÑ>Ð>ùò# ;ùò" ?s   šD	Ã1	DÃ>Dc                óh  • U(       d  / $ [        U5      n[        R                  " U[        R                  S9n[        R                  " U[        R                  S9n[        R                  " U[        R                  S9n[        R                  " U[        R                  S9n[	        U5       H=  u  pxUR
                  X7'   UR                  XG'   UR                  XW'   UR                  Xg'   M?     U S   S-
  U S   S-
  U S   S-   U S   S-   4u  pšp¼X5-   S-  nXF-   S-  nXÙ:¬  XÛ:*  -  Xê:¬  -  Xì:*  -  n[        R                  " U5      nUR                  nUS:X  a  / $ US:X  a  U[        US   5         /$ UR                  5        Vs/ s H  oqU   PM	     nnU[        :”  a  [        U5      $ UU   nUU   nUU   nUU   n[        R                  " USS2S4   USSS24   5      n[        R                  " USS2S4   USSS24   5      n[        R                   " USS2S4   USSS24   5      n[        R                   " USS2S4   USSS24   5      n[        R"                  " UU-
  SS5      n[        R"                  " UU-
  SS5      nUU-  nUU-
  nUU-
  nUU-  n [        R$                  " S	S	S
9   [        R&                  " U SS2S4   S:„  UU SS2S4   -  S5      n!SSS5        [        R(                  " W!S5        USSS24   USS2S4   :„  n"U!S:„  U"-  n#[        R*                  " U[,        S9n$[        R                  " U#R/                  SS95      R                  5       n%U%(       as  U Vs/ s H  n[1        U5      PM     n&nU% HR  nU&U   n'[        R                  " U#U   5      R                  5        H  n([3        U'U&U(   5      (       d  M  SU$U'     MP     MT     [5        UU$R                  5       SS9 VV)s/ s H  u  nn)U)(       d  M  UPM     sn)n$ s  snf ! , (       d  f       GNB= fs  snf s  sn)nf )u…  Return all text objects in a bounding box.

Keeps every text object whose centre lies inside the bbox (with a
small pad), then discards each one whose bbox is >80% contained in a
longer sibling *and* whose stripped text equals that sibling's
stripped text. The content equality check (#288, #625) prevents
adjacent-cell text from being dropped when a wide neighbour's bbox
happens to cover it â€” the geometry-only rule introduced in #206 was
meant to deduplicate PDF font-render duplicates (#15), not to
discard legitimate non-duplicate content.

Parameters
----------
bbox : tuple
    Tuple (x1, y1, x2, y2) representing a bounding box where
    (x1, y1) -> lb and (x2, y2) -> rt in the PDF coordinate
    space.
text : List of PDFMiner text objects.

Returns
-------
t_bbox : list
    List of PDFMiner text objects that lie inside table, with
    duplicate-content overlapping siblings discarded.

)Údtyper   r®   r¯   r°   ç      à?Nç        Úignore)ÚdivideÚinvalidç      ð?r  )ÚaxisFT)Ústrict)rÐ   ÚnpÚemptyÚfloat64Ú	enumeraterê   rë   rš   r¥   ÚflatnonzeroÚsizer£   ÚtolistÚ_TEXT_IN_BBOX_NUMPY_MAXr%  ÚmaximumÚminimumÚclipÚerrstateÚwhereÚfill_diagonalÚonesÚboolÚanyr  r  r±   )*rÜ   ÚtextÚn_inrê   rë   rš   r¥   r   rÉ   Úx_loÚy_loÚx_hiÚy_hiÚxmÚymÚin_bboxÚidx_inr  r
  Úsx0Úsy0Úsx1Úsy1Úx_leftÚy_botÚx_rightÚy_topÚinter_wÚinter_hÚ
inter_areaÚwidthsÚheightsÚba_areasÚfracÚb_longerÚdiscard_candidateÚkeepÚcandidate_rowsr  r#  rº   r#   s*                                             r    Útext_in_bboxr^  –  sæ  € ö6 Øˆ	ô ˆt‹9€DÜ	�Š�$œbŸj™jÑ	)€BÜ	�Š�$œbŸj™jÑ	)€BÜ	�Š�$œbŸj™jÑ	)€BÜ	�Š�$œbŸj™jÑ	)€BÜ˜$–‰ˆØ—‘ˆ‰Ø—‘ˆ‰Ø—‘ˆ‰Ø—‘ˆ‹ñ	  ð " !™W q™[¨$¨q©'°A©+°t¸A±wÀ±{ÀDÈÁGÈaÁKÐOÑ€D�Ø
‰'�S‰€BØ
‰'�S‰€BØ‰z˜b™jÑ)¨R©ZÑ8¸B¹JÑG€GÜ�^Š^˜GÓ$€FØ�‰€AØˆAƒvØˆ	ØˆAƒvØ”S˜ ™“^Ñ$Ð%Ð%à%Ÿ}™}œÓ/š˜!�1Œg™€FÐ/ð 	Ô"Ó"Ü! &Ó)Ð)ð ˆV‰*€CØ
ˆV‰*€CØ
ˆV‰*€CØ
ˆV‰*€Cô �ZŠZ˜šA˜t˜G™ c¨$²¨'¡lÓ3€FÜ�JŠJ�sš1˜d˜7‘| S¨ªq¨¡\Ó2€EÜ�jŠj˜šQ ˜W™ s¨4²¨7¡|Ó4€GÜ�JŠJ�sš1˜d˜7‘| S¨ªq¨¡\Ó2€EÜ�gŠg�g Ñ&¨¨TÓ2€GÜ�gŠg�e˜e‘m S¨$Ó/€GØ˜7Ñ"€Jð
 �3‰Y€FØ�C‰i€GØ˜Ñ€HÜ	�Š˜H¨hÓ	7Ü�xŠx˜¢ D Ñ)¨AÑ-¨z¸HÂQÈÀWÑ<MÑ/MÈsÓSˆ÷ 
8ä×Ò�T˜3Ôð �dšA�g‰ ª¨4¨¡Ñ0€Hð  ™ xÑ/Ðô �7Š7�1œDÑ!€DÜ—^’^Ð$5×$9Ñ$9¸qÐ$9Ð$AÓB×IÑIÓK€NÞÙ7=Ó>²v°!Ô*¨1Ö-±vˆÐ>ÛˆAØ˜A‘hˆGÜ—^’^Ð$5°aÑ$8Ó9×@Ñ@ÖB�Ü(¨°%¸±(×;Ó;Ø#�D˜‘GÚó Cñ  ô ˜f d§k¡k£m¸DÒAÔGÒA‘$�!�QÄQ�AÑAÒGÐGùòo 0÷8 
8Ö	7üò" ?ùó Hs$   ÆPÊ/-PÍ+P)Ï6P.ÐP.Ð
P&c                óŽ   • 0 n[        X5      US'   [        X5      US'   US   R                  S S9  US   R                  S S9  U$ )a  Return all text objects present inside a bounding box.

split between horizontal and vertical text.

Parameters
----------
bbox : tuple
    Tuple (x1, y1, x2, y2) representing a bounding box where
    (x1, y1) -> lb and (x2, y2) -> rt in the PDF coordinate
    space.
horizontal_text : List of PDFMiner text objects.
vertical_text : List of PDFMiner text objects.

Returns
-------
t_bbox : dict
    Dict of lists of PDFMiner text objects that lie inside table, with one
    key each for "horizontal" and "vertical"
Ú
horizontalÚverticalc                ó4   • U R                   * U R                  4$ rñ   )rë   rê   ©Úxs    r    Ú<lambda>Ú'text_in_bbox_per_axis.<locals>.<lambda>  s   € ¨a¯d©d¨U°A·D±D©Mr*   ©r{   c                ó4   • U R                   U R                  * 4$ rñ   )rê   rë   rc  s    r    re  rf    s   € ¨1¯4©4°!·$±$°©-r*   )r^  Úsort)rÜ   rÕ   rÖ   r
  s       r    Útext_in_bbox_per_axisrj    sZ   € ð( €FÜ'¨Ó>€Fˆ<ÑÜ% dÓ:€Fˆ:ÑØ
ˆ<Ñ×ÑÑ"9ÐÑ:Ø
ˆ:Ñ×ÑÑ 7ÐÑ8Ø€Mr*   c                óÆ   • [        U S   UR                  5      [        U S   UR                  5      [        U S   UR                  5      [        U S   UR
                  5      4$ )zAExpand (if needed) a bbox so that it fits the parameter textline.r   r¯   r®   r°   )r÷   rê   rë   rø   rš   r¥   )rÜ   rì   s     r    Úexpand_bbox_with_textlinerl  "  sV   € ô 	ˆD�‰G�X—[‘[Ó!ÜˆD�‰G�X—[‘[Ó!ÜˆD�‰G�X—[‘[Ó!ÜˆD�‰G�X—[‘[Ó!ð	ð r*   c                óÈ   • [        U 5      S:X  a  gU S   R                  U S   R                  U S   R                  U S   R                  4nU SS  H  n[        X5      nM     U$ )a5  Return the smallest bbox containing all the text objects passed as a parameters.

Parameters
----------
textlines : List of PDFMiner text objects.

Returns
-------
bbox : tuple
    Tuple (x1, y1, x2, y2) representing a bounding box where
    (x1, y1) -> lb and (x2, y2) -> rt in the PDF coordinate
    space.
r   Nr¯   )rÐ   rê   rë   rš   r¥   rl  )r	  rÜ   Útls      r    Úbbox_from_textlinesro  ,  s`   € ô ˆ9ƒ~˜ÓØØ�a‰L�O‰O˜Y q™\Ÿ_™_¨i¸©l¯o©o¸yÈ¹|¿¹ÐO€Dà˜˜‹mˆÜ(¨Ó2Šñ à€Kr*   c                ó.  • [        U R                  UR                  5      n[        U R                  UR                  5      n[        U R                  UR                  5      n[        U R
                  UR
                  5      nXB:  d  XS:”  a  gXB-
  X5-
  -  nU$ )a	  Return area of the intersection of the bounding boxes of two PDFMiner objects.

Parameters
----------
ba : PDFMiner text object
bb : PDFMiner text object

Returns
-------
intersection_area : float
    Area of the intersection of the bounding boxes of both objects

r)  )rø   rê   r÷   r¥   rš   rë   )r!  r$  rO  rR  rQ  Úy_bottomÚintersection_areas          r    r  r  C  sy   € ô �—‘˜Ÿ™Ó€FÜ�—‘�r—u‘uÓ€EÜ�"—%‘%˜Ÿ™Ó€GÜ�2—5‘5˜"Ÿ%™%Ó €HàÓ˜8Ó+Øà Ñ)¨eÑ.>Ñ?ÐØÐr*   c                óh   • U R                   U R                  -
  U R                  U R                  -
  -  $ )z±Return area of the bounding box of a PDFMiner object.

Parameters
----------
bb : PDFMiner text object

Returns
-------
area : float
    Area of the bounding box of the object

©rš   rê   r¥   rë   )r$  s    r    r  r  ]  s'   € ð �E‰E�B—E‘E‰M˜bŸe™e b§e¡e™mÑ,Ð,r*   c                óô   • U R                   UR                  :¬  =(       aY    UR                   U R                  :¬  =(       a9    U R                  UR                  :¬  =(       a    UR                  U R                  :¬  $ )zÛReturn True if the bounding boxes of two PDFMiner objects intersect.

Parameters
----------
ba : PDFMiner text object
bb : PDFMiner text object

Returns
-------
overlaps : bool
    True if the bounding boxes intersect

rt  ©r!  r$  s     r    r  r  m  sI   € ð �5‰5�B—E‘E‰>×R˜bŸe™e r§u¡u™n×R°·±¸"¿%¹%±×RÀBÇEÁEÈRÏUÉUÁNÐRr*   c                ó  • / nU R                  S S9  U  Hn  nU(       a  US   S   U-   UR                  :  a)  UR                  UR                  UR                  /5        ML  [	        US   S   UR                  5      US   S'   Mp     U$ )aÌ  Make a list of disjunct cols boundaries for a list of text objects.

Parameters
----------
tls : list of PDFMiner text object.

min_gap : minimum distance between columns. Any elements closer than
    this threshold are merged together.  This is to prevent spaces between
    words to be misinterpreted as boundaries.

Returns
-------
boundaries : list
    List x-coordinates for cols.
    [(1st col left, 1st col right), (2nd col left, 2nd col right), ...]


c                ó   • U R                   $ rñ   )rê   )rn  s    r    re  Ú)find_columns_boundaries.<locals>.<lambda>’  s   € ˜BŸEšEr*   rg  éÿÿÿÿr¯   )ri  rê   r²   rš   rø   )ÚtlsÚmin_gapÚcols_boundsrn  s       r    Úfind_columns_boundariesr~  ~  s‚   € ð& €KØ‡H�HÑ!€HÑ"ÛˆÞ ¨B¡°Ñ 2°WÑ <¸r¿u¹uÓ DØ×Ñ §¡ r§u¡u˜~Ö.ä!$ [°¡_°QÑ%7¸¿¹Ó!?ˆK˜‰O˜AÓñ	 ð
 Ðr*   c                óò   ^ • T (       d  / $ [        T 5      S:  a  / $ [        [        U 4S j[        S[        T 5      5      5      5      nUR	                  ST S   S   5        UR                  T S   S   5        U$ )aä  Find split lines given a list of boundaries between rows or cols.

Boundaries:     [ a ]         [b]     [   c   ]  [d]
Splits:         |        |         |            |  |

Parameters
----------
boundaries : list
    List of tuples of x- (for columns) or y- (for rows) coord boundaries.
    These are the (left, right most) or (bottom, top most) coordinates.

Returns
-------
anchors : list
    List of coordinates representing the split points, each half way
    between boundaries
r¯   c                ó2   >• TU S-
     S   TU    S   -   S-  $ )Nr¯   r   rã   r‰   )ÚidxÚ
boundariess    €r    re  Ú+boundaries_to_split_lines.<locals>.<lambda>¹  s&   ø€ ˜ C¨!¡GÑ,¨QÑ/°*¸S±/À!Ñ2DÑDÈÒKr*   r   rz  )rÐ   rx   Úmapr  Úinsertr²   )r‚  Úanchorss   ` r    Úboundaries_to_split_linesr‡  ›  sz   ø€ ö& Øˆ	ô ˆ:ƒ˜ÓØˆ	ô ÜÜKÜ�!”S˜“_Ó%ó	
ó€Gð ‡N�N�1�j ‘m AÑ&Ô'ð ‡N�N�:˜b‘> !Ñ$Ô%à€Nr*   c                ó   • U $ rñ   r‰   rc  s    r    re  re  È  s   € ÉQr*   c                ó\  • [        U5      nUS:X  a  gX" US   5      ::  a  gX" US   5      :¼  a  US-
  $ SUS-
  pTXE:  a%  XE-   S-  nU" X   5      nXp:  a  US-   nOUnXE:  a  M%  US:X  a  gXC:X  a  US-
  $ [        U" X   5      U -
  5      [        U" XS-
     5      U -
  5      :  a  U$ US-
  $ )ax  Find the index of the closest point in sorted_list.

Parameters
----------
point : Any
    The reference sortable element to search.
sorted_list : List[Any]
    A sorted list of elements.
fn : Callable[[Any], Any], optional
    Optional accessor function, by default lambda x: x

Returns
-------
Optional[int]
    The index of the closest point, or None if the list is empty.
r   Nrz  r¯   r®   )rÐ   r¢   )ÚpointÚsorted_listÚfnr  rä   rå   ÚmidÚmid_vals           r    Úget_index_closest_pointr�  Ç  sé   € ô& 	ˆKÓ€Að 	ˆAƒvØð ��;˜q‘>Ó"Ó"ØØ��;˜r‘?Ó#Ó#Ø�1‰uˆð �Q˜‘Uˆ%à
‹,Ø‰| Ñ!ˆÙ�[Ñ%Ó&ˆà‹?Ø˜‘7‰DàˆEð �,ð ˆqƒyØØƒyØ�1‰uˆô ‰2ˆkÑÓ  5Ñ(Ó)¬C±°;Àa¹xÑ3HÓ0IÈEÑ0QÓ,RÓRØˆà�a‰xˆr*   c                óh   • U R                   U R                  -
  UR                   UR                  -
  :¬  $ )a  Return True if the bounding box of the first PDFMiner object is longer or equal to the second.

Parameters
----------
ba : PDFMiner text object
bb : PDFMiner text object

Returns
-------
longer : bool
    True if the bounding box of the first object is longer or equal

)rš   rê   rv  s     r    r  r     s'   € ð �E‰E�B—E‘E‰M˜rŸu™u r§u¡u™}Ñ-Ð-r*   c                óÊ   • / nU  HZ  nU(       d  UR                  U5        M  US   n[        R                  " XCUS9(       a  XC-   S-  nXBS'   MI  UR                  U5        M\     U$ )zÕMerge lines which are within a tolerance.

By calculating a moving mean, based on their x or y axis projections.

Parameters
----------
ar : list
line_tol : int, optional (default: 2)

Returns
-------
ret : list

rz  )Úabs_tolrã   )r²   ÚmathÚisclose)ÚarrT   ÚretÚaÚtemps        r    Úmerge_close_linesr™    s]   € ð €CÛˆÞØ�J‰J�qŽMà�r‘7ˆDÜ�|Š|˜D¨X×6Ø™ CÑ'�Ø�B“à—
‘
˜1–ñ ð €Jr*   c                óš  ^• U(       d  U $ [        US5      (       a  [        UR                  5       5      nO[        U5      nU VVs/ s H  u  p4U(       d  M  X44PM     nnnU(       d  U $ UR                  S SS9  SR	                  S U 5       5      n[        U5      m[        R                  " UU4S jU [        R                  S9$ s  snnf )	uŠ  Apply keyâ†’value substring substitutions to `text`.

Parameters
----------
text : str
    Text to process.
replacements : dict[str, str] or sequence of (str, str), optional
    Mapping of pattern â†’ replacement. Each key is matched as a
    literal substring (regex metacharacters are escaped) and every
    occurrence is replaced with the corresponding value. Empty
    keys are ignored. Falsy `replacements` returns the text
    unchanged. Order: when several keys could match at the same
    position, the longest one wins (so ``{"abc": "X", "ab": "Y"}``
    replaces ``"abc"`` with ``"X"`` rather than producing ``"Yc"``).

Returns
-------
str
Úitemsc                ó   • [        U S   5      $ ©Nr   ©rÐ   )Úkvs    r    re  Útext_replace.<locals>.<lambda>N  s   € œc " Q¡%œjr*   T)r{   ÚreverseÚ|c              3  óR   #   • U  H  u  p[         R                  " U5      v •  M     g 7frñ   ©ÚreÚescape)rÈ   r#   Ú_s      r    rÊ   Útext_replace.<locals>.<genexpr>O  s   é € Ð6²©¨”r—y’y —|�|²ùs   ‚%'c                ó,   >• TU R                  S5         $ r�  )Úgroup)ÚmÚtables    €r    re  r   Q  s   ø€  U¨1¯7©7°1«:Ò%6r*   ©Úflags)	Úhasattrrx   r›  ri  r$   Údictr¥  ÚsubÚUNICODE)rA  Úreplacementsr›  r#   r¾   Úpatternr¬  s         @r    Útext_replacerµ  .  sª   ø€ ö( ØˆÜˆ|˜W×%Ñ%Ü�\×'Ñ'Ó)Ó*‰ä�\Ó"ˆñ !&Ô+¢™˜¬‹Vˆa‹V¡€EÑ+ÞØˆØ	‡J�JÑ(°$€JÑ7Ø�h‰hÑ6±Ó6Ó6€GÜ�‹K€EÜ�6Š6�'Ô6¸ÄBÇJÁJÑOÐOùó ,s   ÁCÁCc           	     ó¸  • U(       d  U $ [        U[        [        45      (       a`  U Vs/ s H  o"(       d  M  UPM     nnU(       d  U $ SR                  S U 5       5      n[        R
                  " USU [        R                  S9$ [        R
                  " SSR                  [        [        R                  U5      5       S3SU [        R                  S9nU$ s  snf )u`  Strip characters (or whole substrings) from `text`.

Parameters
----------
text : str
    Text to process and strip.
strip : str or sequence of str, optional (default: '')
    If a ``str``: every occurrence of *any character* in `strip` is
    removed from `text` (the long-standing behaviour).
    If a list/tuple of ``str``: every occurrence of *each substring*
    is removed from `text`. This is the request from #484 â€” the
    whole-substring mode is opt-in by passing a sequence, so
    existing callers passing a single string keep their per-character
    semantics.

Returns
-------
stripped : str
r¢  c              3  óN   #   • U  H  n[         R                  " U5      v •  M     g 7frñ   r¤  )rÈ   r  s     r    rÊ   Útext_strip.<locals>.<genexpr>r  s   é € Ð8²¨Aœ2Ÿ9š9 QŸ<˜<²ùs   ‚#%r   r­  Ú[Ú])	Ú
isinstancerx   Útupler$   r¥  r±  r²  r„  r¦  )rA  rÒ   r  Úpiecesr´  Ústrippeds         r    Ú
text_stripr¿  T  s±   € ö( Øˆä�%œ$¤˜×'Ñ'ñ #Ó(šU˜£a—!™UˆÐ(ÞØˆKØ—(‘(Ñ8±Ó8Ó8ˆÜ�vŠv�g˜r 4¬r¯z©zÑ:Ð:ô �vŠvØˆR�W‰W”SœŸ™ EÓ*Ó+Ð,¨AÐ.°°DÄÇ
Á
ñ€Hð €Oùò )s
   ©
C·Cc           	     óš  • / nUS:X  aW  U  Vs/ s HI  n[        U[        5      (       a  M  UR                  5       [        R                  " UR
                  SS94PMK     nnOhUS:X  aW  U  Vs/ s HI  n[        U[        5      (       a  M  UR                  5       [        R                  " UR                  SS94PMK     nnO[        S5      e0 nU H&  u  pgUR                  U/ 5      R                  U5        M(     [        U5      S:”  a›  [        UR                  5       5      n/ n	UR                  5        HZ  u  pzSR                  U
5      R                  5       nU(       d  M-  Xx:X  a  U	R                  SU S	35        MI  U	R                  U5        M\     SR                  U	5      nOSR                  S
 U 5       5      n[!        XÂ5      $ s  snf s  snf )aì  Flag super/subscripts.

Flag super/subscripts in text by enclosing them with <s></s>.
May give false positives.

Parameters
----------
textline : List[LTChar | LTAnno]
    List of objects implementing the LTCharProtocol.
direction : str
    Direction of the PDFMiner LTTextLine object.
strip_text : str, optional (default: '')
    Characters that should be stripped from a string before
    assigning it to a cell.

Returns
-------
str
    The processed string with flagged super/subscripts.
r`  r,   )Údecimalsra  z;Invalid direction provided. Use 'horizontal' or 'vertical'.r¯   r   z<s>z</s>c              3  ó*   #   • U  H	  u  pUv •  M     g 7frñ   r‰   )rÈ   rA  r§  s      r    rÊ   Ú!flag_font_size.<locals>.<genexpr>½  s   é € Ð0ªa¡7 4�$ªaùs   ‚)r»  r   rÑ   r0  ÚroundÚheightÚwidthro   Ú
setdefaultr²   rÐ   r÷   rm   r›  r$   rÒ   r¿  )rì   Ú	directionrH   ÚdrÉ   Úsize_groupsrA  r5  Úmin_sizeÚflistrÔ   Úcombined_charsÚfstrings                r    Úflag_font_sizerÏ  �  s£  € ð0 "$€AØ�LÓ ñ ó
â�Ü˜a¤×(ó ;ˆQ�Z‰Z‹\œ2Ÿ8š8 A§H¡H°qÑ9Ó:Ùð 	
ð 
ˆð
 
�jÓ	 ñ ó
â�Ü˜a¤×(ó :ˆQ�Z‰Z‹\œ2Ÿ8š8 A§G¡G°aÑ8Ó9Ùð 	
ð 
ˆô ÐVÓWÐWð +-€KÛ‰
ˆØ×Ñ˜t RÓ(×/Ñ/°Ö5ñ ô ˆ;Ó˜!ÓÜ�{×'Ñ'Ó)Ó*ˆØˆà&×,Ñ,Ö.‰KˆDØŸW™W U›^×1Ñ1Ó3ˆNßˆ~ØÓ#Ø—L‘L 3 ~Ð&6°dÐ!;Ö<à—L‘L Ö0ñ /ð —'‘'˜%“.‰à—'‘'Ñ0©aÓ0Ó0ˆä�gÓ*Ð*ùòI
ùò
s   �Gª3GÁ*GÂ3Gc                óÖ   • / nUR                   nUR                  5       (       a  SSUR                  5       4/$ US:X  a  [        XU5      nOUS:X  a  [	        XU5      n[        XSX$5      nU$ )a¼  Split textline into substrings if it spans across multiple rows/columns.

Parameters
----------
table : camelot.core.Table
    The table structure containing rows and columns.
textline : LTTextLine
    PDFMiner LTTextLine object.
direction : str
    Direction of the PDFMiner LTTextLine object, either "horizontal" or "vertical".
flag_size : bool
    Whether to highlight a substring using <s></s> if its size differs from the rest of the string.
strip_text : str
    Characters to strip from a string before assigning it to a cell.

Returns
-------
List[tuple[int, int, str]]
    A list of tuples of the form (idx, text) where idx is the index of row/column
    and text is an LTTextLine substring.
rz  r`  ra  )rÜ   Úis_emptyrÑ   Ú_process_horizontal_cutÚ_process_vertical_cutÚ_group_and_process_chars)r¬  rì   rÈ  rD   rH   Úcut_textrÜ   Úgrouped_charss           r    Úsplit_textliner×  Â  st   € ð8 8:€HØ�=‰=€Dà×Ñ×ÑØ�R˜×*Ñ*Ó,Ð-Ð.Ð.à�LÓ Ü*¨5¸DÓA‰Ø	�jÓ	 Ü(¨¸$Ó?ˆä,¨XÀ)ÓX€MØÐr*   c                ó  • / n[        U R                  5       VVs/ s H#  u  pEUS   US   ::  d  M  US   US   ::  d  M!  UPM%     nnn[        U R                  5       VVs/ s H,  u  pxUS   US   US   -   S-  s=::  a  US   ::  d  M&  O  M*  UPM.     n	nnU	(       d  U$ U	S   nU V
s/ s HB  o R                  U   U
   R                  (       d  M%  X R                  U   U
   R
                  4PMD     sn
=(       d"    US   U R                  U   S   R
                  4/nUR                   HÉ  nU R                  U   nU H±  n[        U[        5      (       al  US   UR                  UR                  -   S-  s=::  a	  US   ::  a?  O  O<UR                  UR                  -   S-  US   ::  a  UR                  XŽS   U45          M˜  [        U[        5      (       d  M›  UR                  XŽS   U45        M³     MË     U$ s  snnf s  snnf s  sn
f )z(Process horizontal cuts of the textline.r   r®   r¯   r°   rz  )r3  ÚcolsÚrowsÚcellsrå   r›   Ú_objsr»  r   rë   r¥   rê   rš   r²   r   )r¬  rì   rÜ   rÕ  r   rd  Ú	x_overlaprº   ÚrÚr_idxÚcÚx_cutsr@   ÚrowÚcuts                  r    rÒ  rÒ  í  sñ  € ð 8:€Hä §
¡
Ô+ôÚ+‰dˆa¨q°©t°t¸A±w©‹À4ÈÁ7ÈaÐPQÉdÁ?�Ñ+ð ñ ô   §
¡
Ô+ôÚ+‰dˆa¨q°©t¸¸Q¹À$ÀqÁ'Ñ8IÈQÑ7NÕ/VÐRSÐTUÑRVÑ/V‹Ñ/V�Ñ+ð 
ñ ö Øˆàˆa‰€Aá+4óÚ+4 a¿¹ÀA¹ÀqÑ8I×8OÕ8OÓ!ˆ�K‰K˜‰N˜1Ñ× Ñ Ó!©9ñ÷ 1à�Q‰<˜Ÿ™ Q™¨Ñ+×.Ñ.Ð
/Ð	0ð ð �~Œ~ˆØ�j‰j˜‰mˆÛˆCä˜3¤×'Ñ'Ø˜‘F˜sŸv™v¨¯©™°!Ñ3Õ=°s¸1±vÖ=Ø—V‘V˜cŸf™f‘_¨Ñ)¨S°©VÓ3à—‘ ¨¡F¨CÐ 0Ô1ÚÜ˜C¤×(Ó(Ø—‘ ¨¡F¨CÐ 0Ö1ó ñ ð €Oùó7ùóùòó-   ›G8±
G8¿G8Á %G>Â	G>ÂG>Â($HÃ!Hc                ó  • / n[        U R                  5       VVs/ s H#  u  pEUS   US   ::  d  M  US   US   ::  d  M!  UPM%     nnn[        U R                  5       VVs/ s H,  u  pxUS   US   US   -   S-  s=::  a  US   ::  d  M&  O  M*  UPM.     n	nnU	(       d  U$ U	S   nU V
s/ s HB  o R                  U
   U   R                  (       d  M%  X R                  U
   U   R
                  4PMD     sn
=(       d"    US   U R                  S   U   R
                  4/nUR                   HÉ  nU R                  U   nU H±  n[        U[        5      (       al  US   UR                  UR                  -   S-  s=::  a	  US   ::  a?  O  O<UR                  UR
                  -   S-  US   :¼  a  UR                  US   XŒ45          M˜  [        U[        5      (       d  M›  UR                  US   XŒ45        M³     MË     U$ s  snnf s  snnf s  sn
f )z&Process vertical cuts of the textline.r¯   r°   r   r®   rz  )r3  rÚ  rÙ  rÛ  rç   r¥   rÜ  r»  r   rê   rš   rë   r²   r   )r¬  rì   rÜ   rÕ  rº   ÚyÚ	y_overlapr   rà  Úc_idxrÞ  Úy_cutsr@   Úcolrã  s                  r    rÓ  rÓ    sñ  € ð 8:€Hä §
¡
Ô+ôÚ+‰dˆa¨q°©t°t¸A±w©‹À4ÈÁ7ÈaÐPQÉdÁ?�Ñ+ð ñ ô   §
¡
Ô+ôÚ+‰dˆa¨q°©t¸¸Q¹À$ÀqÁ'Ñ8IÈQÑ7NÕ/VÐRSÐTUÑRVÑ/V‹Ñ/V�Ñ+ð 
ñ ö Øˆàˆa‰€Aá+4óÚ+4 a¿¹ÀA¹ÀqÑ8I×8PÕ8PÓ!ˆ�K‰K˜‰N˜1Ñ× Ñ Ó!©9ñ÷ 1à�Q‰<˜Ÿ™ R™¨Ñ+×.Ñ.Ð
/Ð	0ð ð �~Œ~ˆØ�j‰j˜‰mˆÛˆCä˜3¤×'Ñ'Ø˜‘F˜sŸv™v¨¯©™°!Ñ3Õ=°s¸1±vÖ=Ø—V‘V˜cŸf™f‘_¨Ñ)¨S°©VÓ3à—‘  Q¡¨Ð 0Ô1ÚÜ˜C¤×(Ó(Ø—‘  Q¡¨Ð 0Ö1ó ñ ð €Oùó7ùóùòrä  c                ó¤  • / n[        U [        SS5      5       H®  u  pV[        U5      nU(       a7  UR                  US   US   [	        U Vs/ s H  oˆS   PM	     snX#S945        MN  / n	U H%  nU	R                  US   R                  5       5        M'     UR                  US   US   [        SR                  U	5      U5      45        M°     U$ s  snf )a€  
Group characters and process them based on size flag.

Parameters
----------
cut_text : list of tuples
    Each tuple consists of (x0, y0, character), where x0 and y0 are
    coordinates and character can be an instance of LTChar or LTAnno.

flag_size : bool
    A flag indicating whether to group by font size.

direction : str
    Direction for processing the text (e.g., 'horizontal' or 'vertical').

strip_text : str
    Characters to strip from the text.

Returns
-------
list of tuples
    Each tuple consists of (x0, y0, processed_text), where processed_text
    is the grouped and processed text based on the specified conditions.
r   r¯   r®   ©rH   r   )r   r   rx   r²   rÏ  rÑ   r¿  r$   )
rÕ  rD   rÈ  rH   rÖ  r{   rÔ   Ú
chars_listrÉ   Úgcharss
             r    rÔ  rÔ  3  sÓ   € ð< 13€Mä˜h¬
°1°aÓ(8Ö9‰
ˆÜ˜%“[ˆ
æØ× Ñ à˜‘FØ˜‘FÜ"Ù'1Ó2¢z !˜1œ¡zÑ2°Iñðöð ˆFÛ�Ø—‘˜a ™dŸm™m›oÖ.ñ  ð × Ñ Ø�Q‘˜˜Q™¤¨B¯G©G°F«O¸ZÓ!HÐIöñ% :ð, Ðùò 3s   ÁCc                ó&  • UR                   UR                  -   S-  nUR                  nUR                  nU R                  n	U R
                  n
U R                  nUc'  U R                  5         U R                  nU(       d  / S4$ [        X¶* 5      nUS:X  a  / S4$ U R                  (       a  US-
  nX�   S   U:  a  UnO1/ S4$ Sn[        U5       H  nXŸ   S   U:  d  M  Un  O   US:X  a  / S4$ U R                  nSnSn[        U
5       HM  u  nu  nnUU::  d  M  UU:¼  d  M  UU::  a  UOUnUU:¼  a  UOUn[        UU-
  5      UU   -  nUU:”  d  MI  UnUnMO     US:X  aO  UR                  5       R                  S5      nXx4nU
S   S   U
S   S   4n[         R"                  " U SU S	U 3SS
9  Un[%        XUU5      nU(       a  ['        XX$US9U4$ U(       a  UU[)        UR*                  X%S94/U4$ UU[-        UR                  5       U5      4/U4$ )a  
Get indices of the table cell.

Get the index of a table cell where a given text object lies by
comparing their y and x-coordinates.

Parameters
----------
table : camelot.core.Table
    The table structure containing rows and columns.
t : object
    PDFMiner LTTextLine object.
direction : string
    Direction of the PDFMiner LTTextLine object.
split_text : bool, optional (default: False)
    Whether or not to split a text line if it spans across multiple cells.
flag_size : bool, optional (default: False)
    Whether to highlight a substring using <s></s> if its size is different
    from the rest of the string.
strip_text : str, optional (default: '')
    Characters that should be stripped from a string before assigning it to a cell.

Returns
-------
list
    List of tuples of the form (r_idx, c_idx, text) where r_idx and c_idx
    are row and column indices, respectively.
float
    Assignment error, percentage of text area that lies outside a cell.
    +-------+
    |       |
    |   [Text bounding box]
    |       |
    +-------+
r(  r-  r   r¯   rz  g      ð¿Ú
Ú z does not lie in column range )Ú
stacklevel)rD   rH   rì  )rë   r¥   rê   rš   rÚ  rÙ  Ú_neg_y_tops_listÚ_build_search_cachesr   Ú_rows_disjointr  Ú_col_widths_listr3  r¢   rÑ   rÒ   ÚwarningsÚwarnÚcalculate_assignment_errorr×  rÏ  rÜ  r¿  )r¬  rÉ   rÈ  rG   rD   rH   Úy_midÚt_x0Út_x1rÚ  rÙ  Úneg_topsÚr_endÚlastrß  rÞ  rV  Úbest_overlapÚbest_cÚcidxÚc_leftÚc_righträ   rå   ÚovrA  Ú
text_rangeÚ	col_rangerè  Úerrors                                 r    Úget_table_indexr	  l  sg  € ðv �T‰T�A—D‘D‰[˜CÑ€EØ�4‰4€DØ�4‰4€DØ�:‰:€DØ�:‰:€Dð
 ×%Ñ%€HØÑØ×"Ñ"Ô$Ø×)Ñ)ˆÞØ�s�7ˆNô ˜ &Ó)€EØ�ƒzØ�3ˆwˆð ××Ø�q‰yˆØ‰:�a‰=˜5Ó Ø‰Eà�s�7ˆNàˆÜ�u–ˆAØ‰w�q‰z˜EÕ!Ø�Ùñ ð �B‹;Ø�s�7ˆNð ×#Ñ#€FØ€LØ€FÜ#,¨T¦?ÑˆÑˆv�wØ�T�>˜g¨�oØ! T›>‘4¨vˆDØ# t›O‘D°ˆEÜ�T˜E‘\Ó" V¨D¡\Ñ1ˆBØ�LÕ Ø!�Ø’ñ $3ð �ƒ|Ø�z‰z‹|×!Ñ! $Ó'ˆØ�\ˆ
Ø˜!‘W˜Q‘Z  b¡¨!¡Ð-ˆ	Ü�ŠØˆf�A�j�\Ð!?À	¸{ÐKØò	
ð €Eä& q°¸Ó>€EæäØ˜)ÀZñð ð	
ð 	
ö à�Eœ>¨!¯'©'°9ÑTÐUð
àðð 	ð ˜œz¨!¯*©*«,¸
ÓCÐDÐEÀuÐLÐLr*   c                ó¬  • S/S-  u  pEpgU R                   UR                  U   S   :”  a(  [        U R                   UR                  U   S   -
  5      nU R                  UR                  U   S   :  a(  [        U R                  UR                  U   S   -
  5      nU R                  UR
                  U   S   :  a(  [        U R                  UR
                  U   S   -
  5      nU R                  UR
                  U   S   :”  a(  [        U R                  UR
                  U   S   -
  5      n[        U R                  U R                  -
  5      S:X  a  SO![        U R                  U R                  -
  5      n[        U R                   U R                  -
  5      S:X  a  SO![        U R                   U R                  -
  5      n	X‰-  n
X„U-   -  X–U-   -  -   U
-  nU$ )a„  
Calculate the assignment error for the given text object.

Parameters
----------
t : object
    PDFMiner LTTextLine object.
table : camelot.core.Table
    The table structure containing rows and columns.
r_idx : int
    Row index where the text object is located.
c_idx : int
    Column index where the text object is located.

Returns
-------
float
    The calculated assignment error.
r   rï   r¯   r)  r-  )rë   rÚ  r¢   r¥   rê   rÙ  rš   )rÉ   r¬  rß  rè  Ú	y0_offsetÚ	y1_offsetÚ	x0_offsetÚ	x1_offsetrd  ræ  Úcharear  s               r    rù  rù    s‹  € ð( 34°°q±Ñ.€I˜)Ø‡t�tˆe�j‰j˜Ñ Ñ"Ó"Ü˜Ÿ™˜uŸz™z¨%Ñ0°Ñ3Ñ3Ó4ˆ	Ø‡t�tˆe�j‰j˜Ñ Ñ"Ó"Ü˜Ÿ™˜uŸz™z¨%Ñ0°Ñ3Ñ3Ó4ˆ	Ø‡t�tˆe�j‰j˜Ñ Ñ"Ó"Ü˜Ÿ™˜uŸz™z¨%Ñ0°Ñ3Ñ3Ó4ˆ	Ø‡t�tˆe�j‰j˜Ñ Ñ"Ó"Ü˜Ÿ™˜uŸz™z¨%Ñ0°Ñ3Ñ3Ó4ˆ	ä�1—4‘4˜!Ÿ$™$‘;Ó 3Ó&‰¬C°·±°q·t±t±Ó,<€AÜ�1—4‘4˜!Ÿ$™$‘;Ó 3Ó&‰¬C°·±°q·t±t±Ó,<€Aà‰U€FØ˜yÑ(Ñ)¨a¸yÑ3HÑ.IÑJÈfÑT€EØ€Lr*   c                ó   • Sn Sn[        U  Vs/ s H  o3S   PM	     sn5      U:w  a  [        S5      eU  H-  nUS   [        US   5      -  nUS    H  nX$SU-
  -  -  nM     M/     U$ s  snf ! [         a    Sn U$ f = f)a^  Compute Accuracy.

Calculates a score based on weights assigned to various
parameters and their error percentages.

Parameters
----------
error_weights : list
    Two-dimensional list of the form [[p1, e1], [p2, e2], ...]
    where pn is the weight assigned to list of errors en.
    Sum of pn should be equal to 100.

Returns
-------
score : float

éd   r   z&Sum of weights should be equal to 100.r¯   )rÓ   ro   rÐ   ÚZeroDivisionError)Úerror_weightsÚ	score_valÚscoreÚewÚweightÚerror_percentages         r    Úcompute_accuracyr  (  s¦   € ð$ €Ið	ØˆÜ¡Ó.¢˜"�1”¡Ñ.Ó/°9Ó<ÜÐEÓFÐFÛˆBØ˜‘UœS  A¡›ZÑ'ˆFØ$& q¤EÐ Ø 1Ð'7Ñ#7Ñ8Ñ8’ó %*ñ  ð €Lùò /øô ó Ø‰Ø€Lðús"   „A- �A(�A	A- Á(A- Á-A=Á<A=c                óÂ   • U  Vs/ s H  n[        U[        5      (       d  M  UPM     nn[        S U 5       5      nUS:X  a  g[        S U 5       5      nSXC-  -  $ s  snf )zçCalculate the percentage of empty strings in a two-dimensional list.

Parameters
----------
d : list
    A two-dimensional list (list of lists) containing strings.

Returns
-------
whitespace : float
    Percentage of empty cells.
c              3  ó8   #   • U  H  n[        U5      v •  M     g 7frñ   rž  )rÈ   râ  s     r    rÊ   Ú%compute_whitespace.<locals>.<genexpr>Y  s   é € Ð2ªT cœ˜SŸ˜ªTùrõ   r   r)  c              3  ó”   #   • U  H>  o  H5  n[        U[        5      (       d  M  UR                  5       (       a  M1  S v •  M7     M@     g7f)r¯   N)r»  ÚstrrÒ   )rÈ   râ  Úcells      r    rÊ   r  \  s0   é € ð Úˆc£c˜d¬Z¸¼c×-B‹È4Ï:É:Ï<�‰¡c‰’Tùs   ‚A¤A»Ar  )r»  rx   rÓ   )rÉ  râ  rÚ  Útotal_elementsÚ
whitespaces        r    Úcompute_whitespacer"  H  sh   € ñ  Ó6š1�C¤
¨3´× 5�C™1€DÐ6ÜÑ2©TÓ2Ó2€NØ˜ÓØÜñ Ùóó €Jð �*Ñ-Ñ.Ð.ùò 7s
   …A¢Ac           
     ó”   • [        UUUUUUUS9n[        R                  " X5      n	U	R                  S   n
U	R                  S   nX«4nXœ4$ )aý  Return a PDFMiner LTPage object and page dimension from a page of a PDF.

To get the definitions of kwargs, see
https://pdfminersix.rtfd.io/en/latest/reference/composable.html.

Parameters
----------
filename : string
    Path to pdf file.
line_overlap : float
char_margin : float
line_margin : float
word_margin : float
boxes_flow : float
detect_vertical : bool
all_texts : bool

Returns
-------
layout : object
    PDFMiner LTPage object.
dim : tuple
    Dimension of pdf page in the form (width, height).

)Úline_overlapÚchar_marginÚline_marginÚword_marginÚ
boxes_flowÚdetect_verticalÚ	all_textsr®   r°   )r   ÚpmÚextract_pagerÜ   )Úpager$  r%  r&  r'  r(  r)  r*  ÚlaparamsÚlayoutrÆ  rÅ  Údims                r    Úget_page_layoutr1  b  s]   € ôF Ø!ØØØØØ'Øñ€Hô �_Š_˜TÓ,€FØ�K‰K˜‰N€EØ�[‰[˜‰^€FØˆ/€CØˆ;Ðr*   c                óö   • / n U  H^  n[        U[        5      (       a  UR                  U5        M+  [        U[        5      (       d  MB  [	        U5      nUR                  U5        M`     U$ ! [         a     U$ f = f)zóGet charachter objects from a pdf layout.

Recursively parses pdf layout to get a list of PDFMiner LTChar

Parameters
----------
layout : object
    PDFMiner LTContainer object.

Returns
-------
result : list
    List of LTChar text objects.

)r»  r   r²   r   Úget_char_objectsÚextendÚAttributeError)r/  ÚcharÚ_objectÚ
child_chars       r    r3  r3  •  st   € ð  €DðÛˆGÜ˜'¤6×*Ñ*Ø—‘˜GÖ$Ü˜G¤[×1Ó1Ü-¨gÓ6�
Ø—‘˜JÖ'ñ ð €Køô ó ØØ€Kðús   „A A* Á A* Á*
A8Á7A8c                ór  • / n/ n/ n/ n U  GH  n[        U[        5      (       a  UR                  U5        OM[        U[        5      (       a  UR                  U5        O&[        U[        5      (       a  UR                  U5        [        U[
        5      (       a  UR                  U5        M   [        U[        5      (       d  M·  [        U5      u  pgp‰UR                  U5        [        U5      nUR                  U5        UR                  U5        UR                  U	5        GM     XX44$ ! [         a     Nf = f)a±  Parse a PDF layout to get objects.

Recursively parses pdf layout to get a list of
PDFMiner LTImage, LTTextLineHorizontal, LTTextLineVertical objects.

Parameters
----------
layout : object
    PDFMiner LTContainer object
        ( LTPage, LTTextLineHorizontal, LTTextLineVertical).

Returns
-------
result : tuple
    Include List of LTImage objects, list of LTTextLineHorizontal objects
    and list of LTTextLineVertical objects

)r»  r   r²   r   r   r   r   Úget_image_char_and_text_objectsr4  r3  r5  )
r/  Úimager6  rÕ   rÖ   r7  Úchild_imager8  Úchild_horizontal_textÚchild_vertical_texts
             r    r:  r:  ²  s  € ð. €EØ€DØ€OØ€MðÜˆGÜ˜'¤7×+Ñ+Ø—‘˜WÕ%Ü˜GÔ%9×:Ñ:Ø×&Ñ& wÕ/Ü˜GÔ%7×8Ñ8Ø×$Ñ$ WÔ-Ü˜'¤6×*Ñ*Ø—‘˜GÖ$Ü˜G¤[×1Ó1ä3°GÓ<ñ T�Ð)>ð —‘˜[Ô)Ü-¨gÓ6�
Ø—‘˜JÔ'Ø×&Ñ&Ð'<Ô=Ø×$Ñ$Ð%8×9ñ# ð( ˜Ð6Ð6øô ó Ùðús   ŠB5D) ÃA"D) Ä)
D6Ä5D6)r   r  Úreturnz
str | Path)rf   rñ   )rš   rò   r›   rò   r?  rò   )rž   rò   rŸ   rò   r?  rò   )
r³   zBdict[tuple[float, float, float, float], list[tuple[float, float]]]r´   ú'list[tuple[float, float, float, float]]rµ   r@  r¤   ztuple[float, float, float]r?  z¦tuple[dict[tuple[float, float, float, float], dict[str, list[tuple[float, float]]]], list[tuple[float, float, float, float]], list[tuple[float, float, float, float]]])r?  r  )r  r  r  r  r?  r?  )r?  rò   )r?  r?  )r-  )rŠ  r	   r‹  z	list[Any]rŒ  zCallable[[Any], Any]r?  z
int | None)r®   )r   )rì   zlist[LTChar | LTAnno]rÈ  r  rH   r  r?  r  )Fr   )r¬  r	   rì   r   rÈ  r  rD   r?  rH   r  r?  úlist[tuple[int, int, str]])r?  ú&list[tuple[int, int, LTChar | LTAnno]])
rÕ  rB  rD   r?  rÈ  r  rH   r  r?  rA  )FFr   )rÉ  zlist[list[str]]r?  rò   )r(  r-  r(  gš™™™™™¹?r(  TT)r/  zLTContainer[Any]r?  zlist[LTChar])r/  zLTContainer[LTItem]r?  zXtuple[list[LTImage], list[LTChar], list[LTTextLineHorizontal], list[LTTextLineVertical]])jr“   Ú
__future__r   r‚   r“  r6   r%   r¥  r:   Ústringr/   r÷  Úbisectr   Úcollections.abcr   Ú	itertoolsr   Úoperatorr   Úpathlibr   Útypingr	   Úurllib.parser
   r   r   r   r   Úurllib.requestr   r   Únumpyr0  Úplaya.minerÚminerr+  r   r   r   r   r   r   r   r   r   rl   r   Údiscardr!   ÚdigitsÚascii_lowercaseÚascii_uppercaser'   r)   rC   Úcommon_kwargsÚtext_kwargsÚlattice_kwargsÚ	ml_kwargsrk   rv   r|   r~   r˜   rœ   r    r«   rÁ   rÚ   rá   rí   rû   r  r  r7  r  r  r%  r^  rj  rl  ro  r  r  r  r~  r‡  r�  r  r™  rµ  r¿  rÏ  r×  rÒ  rÓ  rÔ  r	  rù  r  r"  r1  r3  r:  r‰   r*   r    Ú<module>rX     sA  ðÙ 7å "ã Û Û 	Û Û 	Û Û Û Û Ý Ý $Ý Ý Ý Ý Ý .Ý $Ý $Ý &Ý "Ý "ã Ý Ý  Ý Ý Ý #Ý Ý Ý "Ý ,Ý *á�- +Ñ-°Ñ;Ó<€Ø × Ñ �BÔ òð( ‡M�M�F×*Ñ*Ñ*¨V×-CÑ-CÑCð ò
Fô&ò>	€ð ÒNÑN€Øò "ñ €ð$ ò ñ €	ð ØØØ˜NÑ*Ø
ñÐ ô
ô0÷6ñ ô>ô(ô&ò$ð@M6ØNðM6à7ðM6ð 8ðM6ð (ð	M6ð
ôM6ò`òB"òJ	ò,@ò^ò4ð0 Ð ô"ôò$?ò8mHò`ò8òô.ô4-ô Sô"ò:)ñZ DOð6Øð6Ø&ð6Ø,@ð6àõ6ôr.ô"ò:#PôL%ð\ HJð>+Ø#ð>+Ø03ð>+ØADð>+àõ>+ðJ Øð(Øð(àð(ð ð(ð ð	(ð
 ð(ð  õ(ðV à+ô ðF à+ô ðF6Ø4ð6àð6ð ð6ð ð	6ð
  ô6ðt HJôSMòl#òLô@/ð8 ØØØØØØô0ôfð:17Øð17ðõ17r*   