ó
    /j-jÎƒ  ã                   ó”  • S 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JrJrJrJrJrJrJrJrJrJr  SSKJr  SS	KJrJrJr  SS
KJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)  SSK*J+r+J,r,J-r-J.r.J/r/  SSK0J1r1J2r2J3r3J4r4J5r5  \Rl                  " \75      r8\" S5      r9\" S5      r:\" S5      r;\" S5      r<\" S5      r=\" S5      r>\" S5      r?\S/\@4   rA\" S5      rB\(       a  SSKCJDrD  SSKEJFrFJGrG  SSKHJIrIJJrJ  SSKHJKrL  \ " S S\S   5      5       rM\ " S S5      5       rK S;S\\N\\N   \AS4   S \A4S! jjrO S;S"\S   S\\N\\N   \AS4   S \S   4S# jjrP " S$ S%\5      rQ " S& S'\\\M\K4      5      rR\ " S( S\Q\\S\M\K4      5      5       rS\R¨                  S)\S*\S+   S,\1S \\S\M\K4      4S- j5       rU\UR­                  \W5      S)\WS*\S+   S,\1S \\S\M\K4      4S. j5       rX\UR­                  \Y5      S)\YS*\S+   S,\1S \\M   4S/ j5       rZ\UR­                  \[5      S)\\N\4   S*\S+   S,\1S \\\M\KS4      4S0 j5       r\S)\\N\4   S*\S+   S,\1S \\M   4S1 jr]S)\\N\4   S*\S+   S,\1S \\\KS4      4S2 jr^S)\\N\4   S*\S+   S,\1S \\2S4   4S3 jr_S4S5S \\S\M\K4      4S6 jr` " S7 S8\Q\\S\M\K4      5      ra " S9 S:\\\SS4      5      rbg)<z>
Lazy interface to PDF logical structure (PDF 1.7 sect 14.7).
é    N)Údeque)Ú	dataclass)Úgroupby)Ú
attrgetter)ÚTYPE_CHECKINGÚCallableÚDequeÚDictÚIterableÚIteratorÚListÚPatternÚSequenceÚUnionÚoverload)Ú
NumberTree)ÚLITÚ	PDFObjectÚ	PSLiteral)ÚKWDÚContentStreamÚObjRefÚRectÚ
dict_valueÚ	int_valueÚ
list_valueÚliteral_nameÚresolve1Ú
rect_valueÚstream_value)Útransform_bboxÚget_bound_rectsÚstring_propertyÚchoplistÚdecode_text)ÚDocumentRefÚPageRefÚ_deref_documentÚ_deref_pageÚ_ref_documentÚAnnotÚXObjectÚImageÚMCRÚOBJRÚStructTreeRootÚ
StructElemÚElements   BDC)ÚDocument)Ú
AnnotationÚPage)ÚImageObjectÚXObjectObject)ÚContentObjectc                   ó  • \ rS rSr% Sr\\S'   \\S'   \\	S4   \S'   Sr
\\S4   \S'   Sr\\S4   \S'   \S	\S
   4S j5       r\SS j5       r\S	\\S4   4S j5       r\S	\4S j5       rS	\S   4S jrS	\S   4S jrSrg)ÚContentIteméK   zþContent item in logical structure tree.

This corresponds to an individual marked content section on a
specific page, and can be used to (lazily) find that section if
desired.

One can also iterate over ContentObjects inside it, or extract
text from it.
Ú_pagerefÚmcidNÚstreamÚ_bboxÚ_textÚreturn©r5   Nc                 óH   • U R                   c  g[        U R                   5      $ )z.Specific page for this structure tree, if any.N)r<   r)   ©Úselfs    ÚL/home/mande/repo/quber/.venv/lib/python3.13/site-packages/playa/structure.pyÚpageÚContentItem.page]   s    € ð �=‰=Ñ ØÜ˜4Ÿ=™=Ó)Ð)ó    c                 ó4   • U R                   u  p[        U5      $ ©z,The document containing this content object.©r<   r(   ©rE   ÚdocrefÚ_s      rF   ÚdocÚContentItem.docd   ó   € ð —M‘M‰	ˆÜ˜vÓ&Ð&rI   c                 ó”   • U R                   b  U R                   $ U R                  b  [        S U  5       5      U l         U R                   $ )zÃFind the bounding box, if any, of this item, which is the
smallest rectangle enclosing all objects in its marked content
section.

If the `page` attribute is `None`, then `bbox` will be `None`.

c              3   ó8   #   • U  H  oR                   v •  M     g 7f©N)Úbbox)Ú.0Úobjs     rF   Ú	<genexpr>Ú#ContentItem.bbox.<locals>.<genexpr>v   s   é € Ð(BºT°c¯®ºTùs   ‚)r?   rG   r"   rD   s    rF   rV   ÚContentItem.bboxj   s>   € ð �:‰:Ñ!Ø—:‘:ÐØ�9‰9Ñ Ü(Ñ(B¹TÓ(BÓBˆDŒJØ�z‰zÐrI   c                 ól  • SSK Jn  U R                  b  U R                  $ U R                  5       nUc  SU l        U R                  $ / nUR                  U R
                      H¯  n[        XA5      (       d  M  UR                  nUb  UR
                  c  M3  SUR                  ;   a=  [        UR                  S   [        5      (       d   e[        UR                  S   5      nOUR                  nUR                  SS5      nUR                  U5        M±     SR                  U5      U l        U R                  $ )z,Unicode text contained in this content item.r   )Ú
TextObjectÚ Ú
ActualTextô   Â­)Úplaya.contentr]   r@   Ú_page_or_xobjectÚmarked_contentr=   Ú
isinstanceÚmcsÚpropsÚbytesr%   ÚcharsÚreplaceÚappendÚjoin)rE   r]   Úpage_or_xobjectÚtextsrX   re   rh   s          rF   ÚtextÚContentItem.texty   s  € õ 	-à�:‰:Ñ!Ø—:‘:ÐØ×/Ñ/Ó1ˆØÑ"ØˆDŒJØ—:‘:ÐØˆØ"×1Ñ1°$·)±)Ô<ˆCÜ˜c×.Ñ.ÙØ—'‘'ˆCØ‰{˜cŸh™hÑ.ÙØ˜sŸy™yÓ(Ü! #§)¡)¨LÑ"9¼5×AÑAÐAÐAÜ# C§I¡I¨lÑ$;Ó<‘àŸ	™	�à—M‘M &¨"Ó-ˆEØ�L‰L˜Öñ =ð —W‘W˜U“^ˆŒ
Ø�z‰zÐrI   )r5   r7   Nc                 óî   • U R                   c  g U R                  bO  U R                   R                   H5  nUR                  R                  U R                  R                  :X  d  M3  Us  $    U R                   $ rU   )rG   r>   ÚxobjectsÚobjid)rE   rX   s     rF   rb   ÚContentItem._page_or_xobject–   sZ   € Ø�9‰9ÑØØ�;‰;Ñ"Ø—y‘y×)Ô)�Ø—:‘:×#Ñ# t§{¡{×'8Ñ'8Õ8Ø’Jñ *ð �y‰yÐrI   ÚPageContentObjectc                 ó¢   • U R                  5       nUc  [        S5      $ UR                  U R                     nUc  [        S5      $ [        U5      $ )z…Iterate over `playa.content.ContentObject` (not to be confused with
`playa.structure.ContentObject`) in this marked content section.
© )rb   Úiterrc   r=   )rE   rl   Úcontentss      rF   Ú__iter__ÚContentItem.__iter__Ÿ   sN   € ð ×/Ñ/Ó1ˆØÑ"Ü˜“8ˆOØ"×1Ñ1°$·)±)Ñ<ˆØÑÜ˜“8ˆOÜ�H‹~ÐrI   )r?   r@   ©rA   r3   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r'   Ú__annotations__Úintr   r   r?   r   r@   ÚstrÚpropertyrG   rP   rV   rn   rb   r   ry   Ú__static_attributes__rv   rI   rF   r:   r:   K   sß   ‡ ñð ÓØ
ƒIØ�- Ð%Ñ&Ó&Ø#€Eˆ5��t�ÑÓ#Ø"€Eˆ5��d�ÑÓ"àð*�e˜LÑ)ó *ó ð*ð ó'ó ð'ð
 ð�e˜D $˜JÑ'ó ó ðð ð�có ó ðð8 %Ð(EÑ"Fô ð
˜(Ð#6Ñ7÷ 
rI   r:   rt   c                   óÂ   • \ rS rSr% Sr\\S'   \\\	\
\4   4   \S'   \S\S   4S j5       r\S\4S j5       r\SS	 j5       r\SS
 j5       r\S\\S4   4S j5       rSrg)r8   é¬   a…  Content object in logical structure tree.

This corresponds to a content item that is an entire PDF (X)Object
(PDF 1.7 section 14.7.43), and can be used to (lazily) get that

The standard is very unclear on what this could be aside from an
`Annotation` or an `XObject` (presumably either a Form XObject or
an image).  An XObject must be a content stream, so that's clear
enough... Otherwise, since the `Type` key is not required in an
annotation dictionary we presume that this is an annotation if
it's not present.

Not to be confused with `playa.content.ContentObject`.  While you
*can* get there from here with the `obj` property, it may not be a
great idea, because the only way to do that correctly in the case
of an `XObject` (or image) is to interpret the containing page.

Sometimes, but not always, you can nonetheless rapidly access the
`bbox`, so this is also provided as a property here.

r<   rf   rA   )r7   r6   r4   Nc                 óò  • U R                   nU[        L a-  SSKJn  UR                  " U R
                  U R                  5      $ U[        L a¬  [        U R
                  [        5      (       d   eU R
                  R                  S5      nU[        L a  U R                  R                  OU R                  R                  nU H5  nUR                  R                  U R
                  R                  :X  d  M3  Us  $    g)z+Return an instantiated object, if possible.r   )r4   ÚSubtypeN)ÚtypeÚLITERAL_ANNOTÚ
playa.pager4   Ú	from_dictrf   rG   ÚLITERAL_XOBJECTrd   r   ÚgetÚLITERAL_IMAGEÚimagesrq   r>   rr   )rE   Úobjtyper4   ÚsubtypeÚitorrX   s         rF   rX   ÚContentObject.objÇ   s¶   € ð —)‘)ˆØ”mÒ#Ý-à×'Ò'¨¯
©
°D·I±IÓ>Ð>à”oÒ%Ü˜dŸj™j¬-×8Ñ8Ð8Ð8Ø—j‘j—n‘n YÓ/ˆGØ'.´-Ò'?�4—9‘9×#Ò#ÀTÇYÁY×EWÑEWˆDÛ�Ø—:‘:×#Ñ# t§z¡z×'7Ñ'7Õ7Ø’Jñ ð rI   c                 ó¼   • [        U R                  [        5      (       a  [        $ U R                  R	                  S5      n[        U[
        5      (       d  [        $ U$ )z>Type of this object, usually LITERAL_ANNOT or LITERAL_XOBJECT.ÚType)rd   rf   r   rŽ   r�   r   r‹   )rE   r’   s     rF   rŠ   ÚContentObject.typeÚ   sE   € ô �d—j‘j¤-×0Ñ0Ü"Ð"Ø—*‘*—.‘. Ó(ˆÜ˜'¤9×-Ñ-Ü Ð ØˆrI   c                 ó,   • [        U R                  5      $ )z(Containing page for this content object.)r)   r<   rD   s    rF   rG   ÚContentObject.pageä   s   € ô ˜4Ÿ=™=Ó)Ð)rI   c                 ó4   • U R                   u  p[        U5      $ rK   rL   rM   s      rF   rP   ÚContentObject.docé   rR   rI   Nc                 óZ  • SU R                   ;   a8  [        U R                   S   5      n[        U R                  R                  U5      $ SU R                   ;   a8  [        U R                   S   5      n[        U R                  R                  U5      $ U R
                  nUc  gUR                  $ )zqFind the bounding box, if any, of this object.

If there is no bounding box (very unlikely) this will be
`None`.
ÚBBoxr   N)rf   r   r!   rG   ÚctmrX   rV   )rE   ÚrawboxrX   s      rF   rV   ÚContentObject.bboxï   s†   € ð �T—Z‘ZÓÜ §
¡
¨6Ñ 2Ó3ˆFÜ! $§)¡)§-¡-°Ó8Ð8à�T—Z‘ZÓÜ §
¡
¨6Ñ 2Ó3ˆFÜ! $§)¡)§-¡-°Ó8Ð8à�h‰hˆØ‰;ØØ�x‰xˆrI   rv   )rA   r5   r{   )r|   r}   r~   r   r€   r'   r�   r   r   r
   rƒ   r   r„   rX   r   rŠ   rG   rP   r   rV   r…   rv   rI   rF   r8   r8   ¬   s®   ‡ ñð, ÓØ�  S¨) ^Ñ 4Ð4Ñ5Ó5àð�UÐMÑNó ó ðð$ ð�ió ó ðð ó*ó ð*ð ó'ó ð'ð
 ð�e˜D $˜JÑ'ó ó órI   r8   ÚmatcherrA   c                 óÜ   ^ • SSS[         4S jnSSS[         4U 4S jjnSSS[         4U 4S jjnT c  U$ [        T [        5      (       a  U$ [        T [        R                  5      (       a  U$ T $ )NÚxr2   rA   c                 ó   • g)NTrv   )r¤   s    rF   Ú	match_allÚ#_make_match_func.<locals>.match_all  s   € ØrI   c                 ó"   >• U R                   T:H  $ )zMatch an element name.)Úrole©r¤   r¢   s    €rF   Ú	match_tagÚ#_make_match_func.<locals>.match_tag
  s   ø€ à�v‰v˜Ñ Ð rI   c                 ó:   >• TR                  U R                  5      $ )z,Match an element name by regular expression.)Úmatchr©   rª   s    €rF   Úmatch_regexÚ%_make_match_func.<locals>.match_regex  s   ø€ à�}‰}˜QŸV™VÓ$Ð$rI   )Úboolrd   rƒ   Úrer   )r¢   r¦   r«   r¯   s   `   rF   Ú_make_match_funcr³     sx   ø€ ð�Yð ¤4ô ð!�Yð !¤4÷ !ð%�yð %¤T÷ %ð �ØÐÜ	�GœS×	!Ñ	!ØÐÜ	�GœRŸZ™Z×	(Ñ	(ØÐàˆrI   Úelementsc              #   ó,  #   • [        U5      nU R                  5         U (       an  U R                  5       nU" U5      (       a  Uv •  [        [	        U5      5       H+  n[        U[        5      (       d  M  U R                  U5        M-     U (       a  Mm  gg7f)z5
Common code for `find_all()` in trees and elements.
N)r³   ÚreverseÚpopÚreversedÚlistrd   r2   rj   )r´   r¢   Ú
match_funcÚelÚchilds        rF   Ú	_find_allr½     sl   é € ô " 'Ó*€JØ×ÑÔÞ
Ø�\‰\‹^ˆÙ�b�>‰>ØŠHÜœd 2›hÖ'ˆEÜ˜%¤×)Ó)Ø—‘ Ö&ñ (÷	 Š(ùs   ‚A.BÁ4BÂBc                   ó|   • \ rS rSrSr SS\\\\   \S4   S\	S   4S jjr
 SS\\\\   \S4   S\S   4S	 jjrS
rg)ÚFindablei.  zNfind() and find_all() methods that can be inherited to avoid
repeating oneselfNr¢   rA   r2   c                 ó,   • [        [        U 5      U5      $ )a  Iterate depth-first over matching elements in subtree.

The `matcher` argument is either a string, a regular
expression, or a function taking a `Element` and returning
`True` if the element matches, or `None` (default) to return
all descendants in depth-first order.

For compatibility with `pdfplumber` and consistent behaviour
across documents, names and regular expressions are matched
against the `role` attribute.  If you wish to match the "raw"
structure type from the `type` attribute, you can do this with
a matching function.

)r½   r¹   ©rE   r¢   s     rF   Úfind_allÚFindable.find_all2  s   € ô" œ˜d› WÓ-Ð-rI   ©r2   Nc                 ó`   •  [        [        [        U 5      U5      5      $ ! [         a     gf = f)a#  Find the first matching element in subtree.

The `matcher` argument is either a string or a regular
expression to be matched against the `role` attribute, or a
function taking a `Element` and returning `True` if the
element matches, or `None` (default) to just get the first
child element.

N)Únextr½   r¹   ÚStopIterationrÁ   s     rF   ÚfindÚFindable.findE  s/   € ð	Üœ	¤$ t£*¨gÓ6Ó7Ð7øÜó 	Ùð	ús   ‚   
-¬-rv   rU   )r|   r}   r~   r   r€   r   rƒ   r   Ú	MatchFuncr   rÂ   rÈ   r…   rv   rI   rF   r¿   r¿   .  sr   † ñð DHñ.Ø˜S '¨#¡,°	¸4Ð?Ñ@ð.à	�)Ñ	õ.ð( DHñØ˜S '¨#¡,°	¸4Ð?Ñ@ðà	ˆÑ	÷ð rI   r¿   c                   óx   • \ rS rSrSrS\\S\\4      4S jr	\
S\\\\4      4S j5       rS\\\4   4S jrS	rg
)ÚContentIteratoriW  z.Iterator over contents of a structure element.r»   r2   c                 ó&   • [        U5      /U l        g rU   )rw   Ú_itors)rE   r»   s     rF   Ú__init__ÚContentIterator.__init__Z  s   € Ü˜B“x�jˆ�rI   rA   c              #   óÆ  #   • [        U 5      nUR                  [        S5      S9  [        U[        S5      5       GH   u  p#[        U5      n0 nU HC  n[	        U[
        5      (       a  Uv •  M  [	        U[        5      (       d  M5  XeUR                  '   ME     [        / S5      n[        UR                  R                  S0 5      5      nUR                   Hƒ  n	UR                  U	5        U	[        L d  M  Uu  p«n[	        U[        5      (       a  UR                  UR                   0 5      n[        U5      nSU;   d  Mh  [#        US   5      nXå;   d  M}  X^   v •  M…     GM#     g7f)a#  Iterate over content items and objects in page order as defined in
PDF 2.0 section 14.8.2.5.

Items are grouped by page, then ordered inside a page by their
appearance in the content stream.

Because content objects are outside the page's content stream,
it is not clear how they should be ordered with respect to
marked content sections.  For lack of a better idea, we will
place them at the start of the page ordering.

This interface is not at all Lazy as it requires us to create
the entire set of items/objects, then interpret all the pages.
zpage.page_idx)ÚkeyrG   é   Ú
PropertiesÚMCIDN)r¹   Úsortr   r   rd   r8   r:   r=   r   r   Ú	resourcesr�   rx   rj   ÚKWD_BDCr   Únamer   )rE   Ú	all_itemsrG   ÚitemsÚ
page_itemsÚby_mcidÚitemÚstackÚproprsrcrX   Útagrf   rO   Úpropdictr=   s                  rF   Ú
page_orderÚContentIterator.page_order]  s   é € ô  ˜“Jˆ	Ø�‰œ: oÓ6ˆÑ7Ü" 9¬j¸Ó.@×A‰KˆDÜ˜e›ˆJØ.0ˆGÛ"�Ü˜d¤M×2Ñ2Ø”JÜ ¤k×2Ó2Ø)-˜DŸI™IÓ&ñ	 #ô ',¨B°£lˆEÜ! $§.¡.×"4Ñ"4°\À2Ó"FÓGˆHØ—}”}�Ø—‘˜SÔ!Øœ'”>Ø$)‘M�C Ü! %¬×3Ñ3Ø (§¡¨U¯Z©Z¸Ó <˜Ü)¨%Ó0�HØ Õ)Ü(¨°&Ñ)9Ó:˜Ø�?Ø")¡-Ô/ô %ò Bùs    ‚A?E!ÂA*E!Ã3AE!Ä<E!ÅE!c                 ón  •  U R                   (       d  [        e [        U R                   S   5      n[	        U[
        5      (       a&  U R                   R                  [        U5      5        Ml  [	        U[        [        45      (       a  U$ MŠ  ! [         a    U R                   R                  5          M²  f = f)Néÿÿÿÿ)
rÎ   rÇ   rÆ   r·   rd   r2   rj   rw   r:   r8   )rE   Úkids     rF   Ú__next__ÚContentIterator.__next__†  s�   € ØØ—;—;Ü#Ð#ðÜ˜4Ÿ;™; r™?Ó+�ô ˜#œw×'Ñ'Ø—‘×"Ñ"¤4¨£9Ô-ÙÜ˜#¤¬]Ð;×<Ñ<Ø�
ñ øô
 !ó Ø—‘—‘Ô!Úðús   šB Â$B4Â3B4)rÎ   N)r|   r}   r~   r   r€   r   r   r:   r8   rÏ   r„   r   rã   rè   r…   rv   rI   rF   rÌ   rÌ   W  sc   † Ù8ð!˜8 E¨)°[À-Ð*OÑ$PÑQô !ð ð&0˜H U¨;¸Ð+EÑ%FÑGó &0ó ð&0ðP˜% ¨]Ð :Ñ;÷ rI   rÌ   c                   ór  • \ rS rSr% Sr\\S'   \\\	4   \S'   Sr
\\S4   \S'   \SSS	\\\	4   S
S 4S j5       r\S
\4S j5       r\S
\4S j5       r\S S j5       r\S
\S   4S j5       r\S
\S   4S j5       r\S
\4S j5       r\S
\4S j5       r\S
\\S4   4S j5       r\S
\\S4   4S j5       r\S
\\S4   4S j5       r\S
\\S4   4S j5       r\S
\\S4   4S j5       r\S
\\S4   4S j5       r\S
\\\\	4   S4   4S j5       r\S
\\S4   4S j5       rS
\ \S \!\"4      4S jr#S
\$4S jr%Sr&g)!r2   i–  zcLogical structure element.

Attributes:
  props: Structure element dictionary (PDF 1.7 table 323).
Ú_docrefrf   NÚ_rolerP   r3   rX   rA   c                 ó"   • U " [        U5      US9$ )z0Construct from PDF structure element dictionary.©rë   rf   )r*   )ÚclsrP   rX   s      rF   r�   ÚElement.from_dict¢  s   € ñ œ=¨Ó-°SÑ9Ð9rI   c                 ó2   • [        U R                  S   5      $ )a›  Structure type for this element.

Note: Raw and standard structure types
    This type is quite likely idiosyncratic and defined by
    whatever style sheets the author used in their word
    processor.  Standard structure types (PDF 1.7 section
    14.8.4) are accessible through the `role_map` attribute of
    the structure root, or, for convenience (this is slow) via
    the `role` attribute on elements.

ÚS)r   rf   rD   s    rF   rŠ   ÚElement.type§  s   € ô ˜DŸJ™J s™OÓ,Ð,rI   c                 óÞ   • U R                   b  U R                   $ U R                  R                  nUc  U R                  $ UR                  R                  U R                  U R                  5      $ )aÌ  Standardized structure type.

Note: Roles are always mapped
    Since it is common for documents to use standard types
    directly for some of their structure elements (typically
    ones with no content) and thus to omit them from the role
    map, `role` will always return a string in order to
    facilitate processing.  If you must absolutely know
    whether an element's type has no entry in the role map
    then you will need to consult it directly.
)rì   rP   Ú	structurerŠ   Úrole_mapr�   )rE   Útrees     rF   r©   ÚElement.role¶  sU   € ð �:‰:Ñ!Ø—:‘:ÐØ�x‰x×!Ñ!ˆØ‰<Ø—9‘9ÐØ�}‰}× Ñ  §¡¨D¯I©IÓ6Ð6rI   c                 ó,   • [        U R                  5      $ )z%Containing document for this element.©r(   rë   rD   s    rF   rP   ÚElement.docÊ  ó   € ô ˜tŸ|™|Ó,Ð,rI   rB   c                 ól  • U R                   R                  S5      nUc  g[        U[        5      (       a0   U R                  R
                  R                  UR                  5      $ [        R                  SU R                   5        g! [         a#    [        R                  SU R                   5         gf = f)z)Containing page for this element, if any.ÚPgNú$'Pg' entry not found in document: %rú2'Pg' entry is not an indirect object reference: %r)rf   r�   rd   r   rP   ÚpagesÚby_idrr   ÚKeyErrorÚLOGÚwarning)rE   Úpgs     rF   rG   ÚElement.pageÏ  s•   € ð �Z‰Z�^‰^˜DÓ!ˆØ‰:ØÜ˜œF×#Ñ#ðPØ—x‘x—~‘~×+Ñ+¨B¯H©HÓ5Ð5ô �K‰KØDÀdÇjÁjôð øô ó PÜ—‘ÐBÀDÇJÁJÕOð
 ðPús   ¶.B Â*B3Â2B3)r2   ÚTreeNc                 ó  • [        U R                  R                  S5      5      nUc  g [        U5      nUR                  S5      [        L a  U R
                  R                  $ [        R                  U R
                  U5      $ )NÚPr—   )	r   rf   r�   r   ÚLITERAL_STRUCTTREEROOTrP   rõ   r2   r�   )rE   Úps     rF   ÚparentÚElement.parentà  sb   € ä�T—Z‘Z—^‘^ CÓ(Ó)ˆØ‰9ØÜ�q‹MˆØ�5‰5�‹=Ô2Ò2Ø—8‘8×%Ñ%Ð%Ü× Ñ  §¡¨1Ó-Ð-rI   c                 ó   • [        U 5      $ )z¶Iterate over all content items contained in an element.

By default these are returned in depth-first order, which is
"logical content order" as defined in PDF 2.0 section 14.8.2.5.
©rÌ   rD   s    rF   rx   ÚElement.contentsê  s   € ô ˜tÓ$Ð$rI   c                 óF   • SR                  S U R                   5       5      $ )z2Unicode text of all content items in this element.r^   c              3   óh   #   • U  H(  n[        U[        5      (       d  M  UR                  v •  M*     g 7frU   )rd   r:   rn   )rW   rÞ   s     rF   rY   ÚElement.text.<locals>.<genexpr>ö  s"   é € ð 
Ú"/˜$´:¸dÄK×3P‹IˆD�IŽI¢-ùs   ‚2Ÿ2)rk   rx   rD   s    rF   rn   ÚElement.textó  s&   € ð �w‰wñ 
Ø"&§-¢-ó
ó 
ð 	
rI   c                 óâ   ^• U R                   mTc  gSU R                  ;   a.  [        U R                  S   5      n[        TR                  U5      $ U4S jU R
                   5       n[        U5      $ )aÂ  The bounding box, if any, of this element.

Elements may explicitly define a `BBox` in default user space,
in which case this is used.  Otherwise, the bounding box is
the smallest rectangle enclosing all of the content items
contained by this element (which may take some time to compute).

Note that this is currently quite inefficient as it involves
interpreting the entire page for
every.single.marked.content.section.omg.yikes

Note: Elements may span multiple pages!
    In the case of an element (such as a `Document` for
    instance) that spans multiple pages, the bounding box
    cannot exist, and `None` will be returned.  If the
    `page` attribute is `None`, then `bbox` will be
    `None`.

Nrž   c              3   ó\   >#   • U  H!  oR                   TL d  M  UR                  v •  M#     g 7frU   )rG   rV   )rW   rÞ   rG   s     €rF   rY   ÚElement.bbox.<locals>.<genexpr>  s    øé € ÐNª= 4¿I¹IÈÐ<M“Y�T—Y–Yª=ùs   ƒ,™,)rG   rf   r   r!   rŸ   rx   r"   )rE   r    ÚboxesrG   s      @rF   rV   ÚElement.bboxú  s_   ø€ ð* �y‰yˆØ‰<ØØ�T—Z‘ZÓÜ §
¡
¨6Ñ 2Ó3ˆFÜ! $§(¡(¨FÓ3Ð3äN¨4¯=ª=ÓNˆEÜ" 5Ó)Ð)rI   c                 ó.   • [        U R                  S5      $ )zTitle of a structure element.ÚT©r#   rf   rD   s    rF   ÚtitleÚElement.title  ó   € ô ˜tŸz™z¨3Ó/Ð/rI   c                 ó.   • [        U R                  S5      $ )z%Language code of a structure element.ÚLangr  rD   s    rF   ÚlanguageÚElement.language  s   € ô ˜tŸz™z¨6Ó2Ð2rI   c                 ó.   • [        U R                  S5      $ )z$Alternate text for a figure element.ÚAltr  rD   s    rF   Úalternate_descriptionÚElement.alternate_description#  s   € ô ˜tŸz™z¨5Ó1Ð1rI   c                 ó.   • [        U R                  S5      $ )z9If element's contents are an abbreviation, the expansion.ÚEr  rD   s    rF   Úabbreviation_expansionÚElement.abbreviation_expansion(  r   rI   c                 ó.   • [        U R                  S5      $ )z)Replacement text for a structure element.r_   r  rD   s    rF   Úactual_textÚElement.actual_text-  s   € ô ˜tŸz™z¨<Ó8Ð8rI   c                 óL  • [        U R                  R                  S5      5      nUc  g[        U[        5      (       a  U$ [        U[
        5      (       aº  SnSn[        SU5       H¤  u  pE[        U5      n[        U[        5      (       a  UR                  n[        U[        5      (       d  [        R                  SU5        M^  [        U5      n[        U[        5      (       d  [        R                  SU5        M–  Ub  XS:”  d  M   UnUnM¦     U$ [        R                  SU5        g)zAttribute dictionaryÚANr   é   z!A is not dictionary or stream: %rzRevision is not an integer: %rzUnrecognizable A property: %r)r   rf   r�   rd   Údictr¹   r$   r   Úattrsr  r  r‚   )rE   r4  ÚlatestÚlatest_revisionÚattrdictÚrevisions         rF   Ú
attributesÚElement.attributes2  sõ   € ô ˜Ÿ™Ÿ™¨Ó,Ó-ˆØ‰=ØÜ�eœT×"Ñ"ØˆLÜ�eœT×"Ñ"Ø8<ˆFØˆOÜ&.¨q°%Ö&8Ñ"�Ü# HÓ-�Ü˜h¬×6Ñ6Ø'Ÿ~™~�HÜ! (¬D×1Ñ1Ü—K‘KÐ CÀXÔNÙÜ# HÓ-�Ü! (¬C×0Ñ0Ü—K‘KÐ @À(ÔKÙØ‘> XÕ%?Ø%�FØ&.’Oñ '9ð ˆMÜ�‰Ð3°UÔ;ØrI   c                 ó`  • [        U R                  R                  S5      5      nUc  g[        U[        5      (       a  [        U5      $ [        U[        5      (       a;  SnSn[        SU5       H  u  pEUb  XS:”  d  M  [        U5      nUnM     [        U5      $ [        R                  SU5        g)zAttribute class nameÚCNr   r2  zUnrecognizable C property: %r)
r   rf   r�   rd   r   r   r¹   r$   r  r  )rE   Úclassesr5  r6  Ú	classnamer8  s         rF   Ú
class_nameÚElement.class_nameO  sž   € ô ˜4Ÿ:™:Ÿ>™>¨#Ó.Ó/ˆØ‰?ØÜ�gœy×)Ñ)Ü Ó(Ð(Ü�gœt×$Ñ$ØˆFØˆOÜ'/°°7Ö';Ñ#�	Ø‘> XÕ%?Ü% iÓ0�FØ&.’Oñ (<ô   Ó'Ð'Ü�‰Ð3°WÔ=ØrI   c              #   ó²   #   • SU R                   ;   aA  [        U R                   S   5      n[        XR                  U R                  5       S h  v•N   g g  N7f)NÚK)rf   r   Ú
_make_kidsrG   rë   )rE   Úkidss     rF   ry   ÚElement.__iter__b  sC   é € Ø�$—*‘*ÓÜ˜DŸJ™J s™OÓ,ˆDÜ! $¯	©	°4·<±<Ó@×@Ñ@ð á@ùs   ‚AAÁAÁAc                 óV   • [        U R                  [        U R                  5      45      $ rU   )Úhashrë   Úreprrf   rD   s    rF   Ú__hash__ÚElement.__hash__g  s!   € ô �T—\‘\¤4¨¯
©
Ó#3Ð4Ó5Ð5rI   rv   r{   )'r|   r}   r~   r   r€   r&   r�   r
   rƒ   r   rì   r   Úclassmethodr�   r„   rŠ   r©   rP   rG   r  rÌ   rx   rn   r   rV   r  r#  r'  r+  r.  r9  r?  r   r:   r8   ry   r‚   rI  r…   rv   rI   rF   r2   r2   –  sw  ‡ ñð ÓØ��Y�ÑÓØ"€Eˆ5��d�ÑÓ"àð:˜Jð :¨T°#°y°.Ñ-Að :Àió :ó ð:ð ð-�có -ó ð-ð ð7�có 7ó ð7ð& ó-ó ð-ð ð�e˜LÑ)ó ó ðð  ð.˜Ð5Ñ6ó .ó ð.ð ð%˜/ó %ó ð%ð ð
�có 
ó ð
ð ð*�e˜D $˜JÑ'ó *ó ð*ð< ð0�u˜S $˜YÑ'ó 0ó ð0ð ð3˜%  T 	Ñ*ó 3ó ð3ð ð2 u¨S°$¨YÑ'7ó 2ó ð2ð ð0¨¨c°4¨iÑ(8ó 0ó ð0ð ð9˜U 3¨ 9Ñ-ó 9ó ð9ð ð˜E $ s¨I ~Ñ"6¸Ð"<Ñ=ó ó ðð8 ð˜E # t )Ñ,ó ó ðð$A˜( 5¨°KÀÐ)NÑ#OÑPô Að
6˜#÷ 6rI   ÚkrG   rB   rN   c              #   óP   #   • [         R                  SU 5        S Sh  v•N   g N7f)a  
Make a child for this element from its K array.

K in Element can be (PDF 1.7 Table 323):
- a structure element (not a content item)
- an integer marked-content ID
- a marked-content reference dictionary
- an object reference dictionary
- an array of one or more of the above
zUnrecognized 'K' element: %rrv   N)r  r  ©rL  rG   rN   s      rF   rC  rC  n  s   é € ô ‡K�KÐ.°Ô2Ø‡MƒMùs   ‚&ž$Ÿ&c              #   ó\   #   • U  H   n[        [        U5      X5       S h  v•N   M"     g  N	7frU   )rC  r   )rL  rG   rN   r»   s       rF   Ú_make_kids_listrP  €  s(   é € ó ˆÜœh r›l¨DÓ9×9Ò9ò Ù9ùs   ‚, *¡
,c              #   ón   #   • Uc  [         R                  SU 5        g [        UR                  U S S9v •  g 7f)Nú.No page found for marked-content reference: %r©r<   r=   r>   )r  r  r:   ÚpagerefrN  s      rF   Ú_make_kids_intrU  ˆ  s1   é € ð �|Ü�‰ÐDÀaÔHØÜ
˜tŸ|™|°!¸DÑ
AÓAùs   ‚35c              #   óÄ   #   • U R                  S5      nU[        L a  [        XU5       S h  v•N   g U[        L a  [	        XU5       S h  v•N   g [        X S9v •  g  N/ N7f)Nr—   rî   )r�   ÚLITERAL_MCRÚ_make_kids_mcrÚLITERAL_OBJRÚ_make_kids_objrr2   )rL  rG   rN   Úktypes       rF   Ú_make_kids_dictr\  ’  sW   é € ð �E‰E�&‹M€EØ”ÒÜ! !¨6Ó2×2Ñ2Ø	”,Ò	Ü" 1¨FÓ3×3Ñ3ä˜fÑ.Ó.ñ	 	3á3ùs!   ‚*A ¬A­A Á
AÁA ÁA c              #   óZ  #   • [        U R                  S5      5      nUb  [        U[        5      (       d  [        R                  SU 5        g S n[        XU5      nUc  g  [        U S   5      n[        XSUS9v •  g ! [         a     N[         a    [        R                  SU 5         N:f = f7f)NrÕ   z'MCID' entry is not an int: %rÚStmz''Stm' entry is not a content stream: %rrS  )r   r�   rd   r‚   r  r  Ú_get_kid_pagerefr    r  Ú	TypeErrorr:   )rL  rG   rN   r=   r>   rT  s         rF   rX  rX  Ÿ  s¤   é € ô �A—E‘E˜&“MÓ"€DØ�|œ: d¬C×0Ñ0Ü�‰Ð4°aÔ8ØØ)-€FÜ˜q¨Ó/€GØ�ØðBÜ˜a ™hÓ'ˆô ˜w¸&Ñ
AÓAøô ó ÙÜó BÜ�‰Ð=¸qÖAðBüs6   ‚AB+ÁA: Á-B+Á:
B(ÂB+ÂB(Â%B+Â'B(Â(B+c              #   óä  #   • U R                  S5      n[        U[        5      (       d  [        R	                  SU 5        g UR                  5       n[        U[        [        45      (       d  [        R	                  SU5        g UR                  S5      nU[        L a8  [        U[        5      (       d  [        R	                  SU5        g [        X$S9v •  g [        XU5      nUc  g [        XdS9v •  g 7f)NÚObjz3'Obj' entry is not an indirect object reference: %rz9'Obj' entry does not point to a dict or ContentStream: %rr—   z('Obj' entry does not point to a dict: %rrî   )r<   rf   )r�   rd   r   r  r  Úresolver3  r   ÚLITERAL_STRUCTELEMr2   r_  r8   )rL  rG   rN   ÚrefrX   r[  rT  s          rF   rZ  rZ  ´  sÂ   é € ð �%‰%�‹,€CÜ�cœ6×"Ñ"Ü�‰ÐIÈ1ÔMØØ
�+‰+‹-€CÜ�cœD¤-Ð0×1Ñ1Ü�‰ÐOÐQTÔUØà�G‰G�F‹O€EØÔ"Ò"Ü˜#œt×$Ñ$Ü�K‰KÐBÀCÔHØÜ˜fÑ0Ó0ä" 1¨FÓ3ˆØ‰?ØÜ WÑ8Ó8ùs   ‚C.C0c                 ó‚  • U R                  S5      nUb]  [        U[        5      (       a2   [        U5      nUR                  R                  UR                  5      nO[        R                  SU 5        Uc  Uc  [        R                  SU 5        g UR                  $ ! [         a    [        R                  SU 5         NKf = f)Nrþ   rÿ   r   rR  )r�   rd   r   r(   r  r  rr   r  r  r  rT  )rL  rG   rN   r  rP   s        rF   r_  r_  Í  s¢   € ð 
�‰ˆt‹€BØ	�~Ü�bœ&×!Ñ!ðGÜ% fÓ-�Ø—y‘y—‘ r§x¡xÓ0‘ô �K‰KÐLÈaÔPØ�|Ø‰<Ü�K‰KÐHÈ!ÔLØØ�<‰<Ðøô ó GÜ—‘ÐBÀAÖFðGús   «0B Â B>Â=B>rP   r3   c              #   óà  #   • [        U R                  R                  S5      5      nUc  g [        U5      n[        UR                  S5      5      nUc  [        R                  SU5        g [        U[        5      (       a  U/nO-[        U[        5      (       a  O[        R                  SU5        g U Hµ  n[        U5      n[        U[        5      (       d  [        R                  SU5        O]UR                  S5      [        L a  [        R                  SU5        O.UR                  S5      [        L a  [        R                  SU5        [        US [        U 5      5       S h  v•N   M·     g  N	7f)	Nr0   rB  z5'K' entry in StructTreeRoot could not be resolved: %rz<'K' entry in StructTreeRoot should be dict or list but is %rz3'K' entry in StructTreeRoot contains non-element %rr—   z8'K' entry in StructTreeRoot contains object reference %rz@'K' entry in StructTreeRoot contains marked content reference %r)r   Úcatalogr�   r   r  r  rd   r3  r¹   rY  rW  rC  r*   )rP   ÚrootrD  rL  s       rF   Ú_iter_structurerj  á  s'  é € ô �C—K‘K—O‘OÐ$4Ó5Ó6€DØ�|ØÜ�dÓ€DÜ�D—H‘H˜S“MÓ"€DØ�|Ü�‰ÐKÈTÔRØô �$œ×ÑØˆv‰Ü	�Dœ$×	Ñ	Øä�‰ØJÈDô	
ð 	ÛˆÜ�Q‹Kˆô
 ˜!œT×"Ñ"Ü�K‰KÐMÈqÕQØ�U‰U�6‹]œlÒ*Ü�K‰KÐRÐTUÕVØ�U‰U�6‹]œkÒ)Ü�K‰KØRÐTUôô ˜a ¤}°SÓ'9Ó:×:Ò:ò ñ 	;ùs   ‚E E.Å"E,Å#
E.c                   ó  • \ rS rSr% Sr\\S'   \\\	4   \S'   Sr
\\\\4   S4   \S'   Sr\\S4   \S'   SrSrSrSrSrSS
 jrS	\\S\\4      4S jr\S	\\\4   4S j5       r\S	\4S j5       r\S	\4S j5       r\SS j5       rSrg)r  i	  a8  Logical structure tree.

A structure tree can be iterated over in the same fashion as its
elements.  Note that even though it is forbidden for structure
tree root to contain content items, PLAYA is robust to this
possibility, thus you should not presume that iterating over it
will only yield `Element` instances.

The various attributes (role map, class map, pronunciation
dictionary, etc, etc) are accessible through `props` but currently
have no particular interpretation aside from the role map which is
accessible in normalized form through `role_map`.

Attributes:
  props: Structure tree root dictionary (PDF 1.7 table 322).
  role_map: Mapping of structure element types (as strings) to
      standard structure types (as strings) (PDF 1.7 section 14.8.4)
  parent_tree: Parent tree linking marked content sections to
      structure elements (PDF 1.7 section 14.7.4.4)
  parent: A structure tree has no parent element, so this is `None`
  bbox: A structure tree has no bounding box so this is `None`
  type: This is "StructTreeRoot"
  role: This is also "StructTreeRoot"
rë   rf   NÚ	_role_mapÚ_parent_treer0   rA   c                 ó^   • [        U5      U l        [        UR                  S   5      U l        g )Nr0   )r*   rë   r   rh  rf   ©rE   rP   s     rF   rÏ   ÚTree.__init__-  s$   € Ü$ SÓ)ˆŒÜ §¡Ð,<Ñ =Ó>ˆ�
rI   r2   c                 óB   • [        U R                  5      n[        U5      $ rU   )r(   rë   rj  ro  s     rF   ry   ÚTree.__iter__1  s   € Ü˜dŸl™lÓ+ˆÜ˜sÓ#Ð#rI   c                 ór  • U R                   b  U R                   $ 0 U l         [        U R                  R                  S5      5      n[	        U[
        5      (       aS  UR                  5        H?  u  p#[	        U[        5      (       a  [        U5      nO[        U5      nX@R                   U'   MA     U R                   $ )zZDictionary mapping some (not necessarily all) element types
to their standard equivalents.ÚRoleMap)
rl  r   rf   r�   rd   r3  rÛ   r   r   rƒ   )rE   ÚrmrL  Úvr©   s        rF   rö   ÚTree.role_map5  sŒ   € ð �>‰>Ñ%Ø—>‘>Ð!ØˆŒÜ�d—j‘j—n‘n YÓ/Ó0ˆÜ�bœ$×ÑØŸ™ž
‘�Ü˜a¤×+Ñ+Ü'¨›?‘Dä˜q›6�DØ$(—‘˜qÓ!ñ #ð �~‰~ÐrI   c                 óÞ   • U R                   b  U R                   $ SU R                  ;  a  [        0 5      U l         U R                   $ [        U R                  S   5      U l         U R                   $ )aö  Parent tree for this document.

This is a somewhat obscure data structure that links marked
content sections to their corresponding structure elements.
If you don't know what that means, you probably don't need it,
but if you do, here it is.

Unlike the structure tree itself, if there is no parent tree,
this will be an empty `NumberTree`, not `None`.  This is
because the parent tree is required by the spec in the case
where structure elements contain marked content, which is
nearly all the time.

Ú
ParentTree)rm  rf   r   rD   s    rF   Úparent_treeÚTree.parent_treeF  sf   € ð  ×ÑÑ(Ø×$Ñ$Ð$Ø˜tŸz™zÓ)Ü *¨2£ˆDÔð × Ñ Ð ô !+¨4¯:©:°lÑ+CÓ DˆDÔØ× Ñ Ð rI   c                 ó   • [        U 5      $ )z+Iterate over all content items in the tree.r  rD   s    rF   rx   ÚTree.contents^  s   € ô ˜tÓ$Ð$rI   c                 ó,   • [        U R                  5      $ )z6Document with which this structure tree is associated.rú   rD   s    rF   rP   ÚTree.docc  rü   rI   )rë   rm  rl  rf   )rP   r3   rA   Nr{   )r|   r}   r~   r   r€   r&   r�   r
   rƒ   r   rl  r   rm  r   rG   r  rV   rŠ   r©   rÏ   r   r:   r8   ry   r„   rö   rz  rÌ   rx   rP   r…   rv   rI   rF   r  r  	  sö   ‡ ñð2 ÓØ��Y�ÑÓØ-1€Iˆu�T˜#˜s˜(‘^ TÐ)Ñ*Ó1Ø,0€L�%˜
 DÐ(Ñ)Ó0Ø€DØ€FØ€DØ€DØ€Dô?ð$˜( 5¨°KÀÐ)NÑ#OÑPô $ð ð˜$˜s C˜x™.ó ó ðð  ð!˜Zó !ó ð!ð. ð%˜/ó %ó ð%ð ó-ó ó-rI   r  c                   óD  • \ rS rSr% Sr\\   \S'   \\	\
4   \S'   S\S\SS4S jr\SS	 j5       rS\	4S
 jr\S\	S\\
S4   4S j5       r\S\SS 4S j5       rS\\	\4   S\S \
S4   4S jr SS\\\\   \S4   S\S   4S jjr SS\\\\   \S4   S\S   4S jjrSrg)ÚPageStructureii  zE
Sequence of structural content elements for a page or Form XObject.
Úparentsr´   rT  rA   Nc                 óR   • Uu  U l         nXl        [        U5      U l        0 U l        g rU   )rN   rT  r   r‚  r´   )rE   rT  r‚  rO   s       rF   rÏ   ÚPageStructure.__init__q  s%   € Ø ‰ˆŒ�QØŒÜ! 'Ó*ˆŒØˆ�rI   c                 ó,   • [        U R                  5      $ )z%Get associated document if it exists.)r(   rN   rD   s    rF   rP   ÚPageStructure.docw  s   € ô ˜tŸ{™{Ó+Ð+rI   c                 ó,   • [        U R                  5      $ rU   )Úlenr‚  rD   s    rF   Ú__len__ÚPageStructure.__len__|  s   € Ü�4—<‘<Ó Ð rI   Úidxc                 ó   • g rU   rv   ©rE   r‹  s     rF   Ú__getitem__ÚPageStructure.__getitem__  s   € Ø=@rI   c                 ó   • g rU   rv   r�  s     rF   rŽ  r�  ‚  s   € Ø:=rI   c           
      óP  • [        U[        5      (       a[  [        U R                  [	        UR                  [        U R                  5      5      6  Vs/ s H  o R                  U   PM     sn5      $ U R                  U   nUc  g [        U[        5      (       as  UR                  U R                  ;  a@  [        R                  U R                  [        U5      5      U R                  UR                  '   U R                  UR                     $ [        R!                  SU5        g s  snf )Nz:ParentTree element is not an indirect object reference: %r)rd   Úslicer�  rT  ÚrangeÚindicesrˆ  r‚  r   rr   r´   r2   r�   rP   r   r  r  )rE   r‹  r¤   Úobjrefs       rF   rŽ  r�  …  sé   € ô �cœ5×!Ñ!Ü Ø—‘Ü*/°·±¼SÀÇÁÓ=NÓ1OÑ*PÓQÒ*P Q—‘˜a”Ñ*PÑQóð ð —‘˜cÑ"ˆØ‰>ØÜ˜¤×'Ñ'ð �|‰| 4§=¡=Ó0Ü.5×.?Ñ.?Ø—H‘Hœj¨Ó0ó/�—‘˜fŸl™lÑ+ð —=‘= §¡Ñ.Ð.ä�K‰KØLÈfôð ùò# Rs   ÁD#
r¢   r2   c              #   ó  #   • [        U5      n[        5       nU  Hc  nUc  M  U" U5      (       a  XC;  a  Uv •  UR                  U5        M1  [        UR                  [
        5      (       a  MR  UR                  nUb  M[  Me     g7f)a!  Search up depth-first for matching elements in the parent tree.

The `matcher` argument is either a string, a regular
expression, or a function taking a `Element` and returning
`True` if the element matches, or `None` (default) to return
all descendants in depth-first order.

For compatibility with `pdfplumber` and consistent behaviour
across documents, names and regular expressions are matched
against the `role` attribute.  If you wish to match the "raw"
structure type from the `type` attribute, you can do this with
a matching function.

N)r³   ÚsetÚaddrd   r  r  )rE   r¢   rº   ÚseenÚelements        rF   rÂ   ÚPageStructure.find_allž  sr   é € ô" & gÓ.ˆ
Ü‹uˆÛˆGØÓ%Ù˜g×&Ñ&ØÓ*Ø%šØ—H‘H˜WÔ%Ùä˜gŸn™n¬d×3Ñ3ÙØ!Ÿ.™.�ð Õ%ò ùs   ‚B¢ABÁ=BrÄ   c                 óX   •  [        U R                  U5      5      $ ! [         a     gf = f)a+  Find the first matching element in the parent tree.

The `matcher` argument is either a string or a regular
expression to be matched against the `role` attribute, or a
function taking a `Element` and returning `True` if the
element matches, or `None` (default) to just get the first
child element.

N)rÆ   rÂ   rÇ   rÁ   s     rF   rÈ   ÚPageStructure.find½  s-   € ð	Ü˜Ÿ™ gÓ.Ó/Ð/øÜó 	Ùð	ús   ‚ œ
)¨))rN   r´   rT  r‚  r{   rU   )r|   r}   r~   r   r€   r   r   r�   r
   r‚   r2   r'   rÏ   r„   rP   r‰  r   r   rŽ  r’  rƒ   r   rÊ   r   rÂ   rÈ   r…   rv   rI   rF   r�  r�  i  s.  ‡ ñð �iÑ Ó Ø�3˜�<Ñ Ó ð ð °)ð Àô ð ó,ó ð,ð!˜ô !ð Ø@˜sÐ@ u¨W°d¨]Ñ';Ó@ó Ø@àØ=˜uÐ=¨Ó=ó Ø=ðØ˜˜e˜Ñ$ðà	ˆ ¨Ð-Ñ	.ôð4 DHñ)Ø˜S '¨#¡,°	¸4Ð?Ñ@ð)à	�)Ñ	õ)ð@ DHñØ˜S '¨#¡,°	¸4Ð?Ñ@ðà	ˆÑ	÷ð rI   r�  rU   )cr€   Ú	functoolsÚloggingr²   Úcollectionsr   Údataclassesr   Ú	itertoolsr   Úoperatorr   Útypingr   r   r	   r
   r   r   r   r   r   r   r   Úplaya.data_structuresr   Úplaya.parserr   r   r   Úplaya.pdftypesr   r   r   r   r   r   r   r   r   r   r    Úplaya.utilsr!   r"   r#   r$   r%   Úplaya.workerr&   r'   r(   r)   r*   Ú	getLoggerr|   r  r‹   rŽ   r�   rW  rY  r  rd  r±   rÊ   rØ   Úplaya.documentr3   rŒ   r4   r5   ra   r6   r7   r8   rt   r:   rƒ   r³   r½   r¿   rÌ   r2   ÚsingledispatchrC  Úregisterr¹   rP  r‚   rU  r3  r\  rX  rZ  r_  rj  r  r�  rv   rI   rF   Ú<module>r®     sa  ðñó Û Û 	Ý Ý !Ý Ý ÷÷ ÷ ñ õ -ß 2Ñ 2÷÷ ÷ ñ ÷õ ÷õ ð ×Ò˜Ó!€Ù�G“€Ù�i“.€Ù�G“€Ù�%‹j€Ù�6‹{€ÙÐ-Ó.Ð Ù˜Ó&Ð Ø�i�[ $Ð&Ñ'€	Ù
ˆf‹+€æÝ'ß+ß8Ý@ð ô]�(Ð.Ñ/ó ]ó ð]ð@ ÷Tð Tó ðTðp :>ñØ�3˜ ™ i°Ð5Ñ6ðàõð4 :>ñ'Ø�9‰oð'à�3˜ ™ i°Ð5Ñ6ð'ð ˆiÑõ'ô$&ˆxô &ôR<�h˜u [°-Ð%?Ñ@ÑAô <ð~ ôT6ˆh˜  y°+¸}Ð'LÑ!MÑNó T6ó ðT6ðn ×ÑðØðØ˜lÑ+ðØ5@ðàˆe�I˜{¨MÐ9Ñ:Ñ;óó ðð" ×Ñ�TÓð:Øð:Ø˜Ñ&ð:Ø0;ð:àˆe�I˜{¨MÐ9Ñ:Ñ;ó:ó ð:ð ×Ñ�SÓðBØ
ðBØ˜Ñ%ðBØ/:ðBàˆkÑóBó ðBð ×Ñ�TÓð	/ØˆC�ˆNÑð	/Ø#(¨Ñ#6ð	/Ø@Kð	/àˆe�K °	Ð9Ñ:Ñ;ó	/ó ð	/ðBØˆC�ˆNÑðBØ#(¨Ñ#6ðBØ@KðBàˆkÑôBð*9ØˆC�ˆNÑð9Ø#(¨Ñ#6ð9Ø@Kð9àˆe�M 9Ð,Ñ-Ñ.ô9ð2ØˆC�ˆNÑðØ#(¨Ñ#6ðØ@Kðà
ˆ7�Dˆ=Ñôð(%;Ø	ð%;àˆe�I˜{¨MÐ9Ñ:Ñ;ô%;ôP]-ˆ8�X˜e I¨{¸MÐ$IÑJÑKô ]-ô@c�H˜U 7¨D =Ñ1Ñ2õ crI   