+
     2iyL  c                  sX   R t ^ RIHt RtR.t^ RIHt ^ RIt^ RIH	t	H
t
HtHtHtHtHtHtHtHtHt ^ RIHtHtHtHtHtHt ^ RIHtHt ^ R	IHtH t H!t!H"t" ^ R
I#H$t$ ]'       d   ^ RI%H&t& ^ RIH't' ^ RI(H)t)H*t*H+t+ Rt,]
]]-]-3,          ]-]-.R3,          t. ! R R]]4      t/ ! R R]!4      t0R# )zCUse the HTMLParser library to parse HTML files that aren't too bad.)annotationsZMITHTMLParserTreeBuilder)
HTMLParserN)AnyCallablecastDictIterableListOptionalTYPE_CHECKINGTupleTypeUnion)AttributeDictCDataCommentDeclarationDoctypeProcessingInstruction)EntitySubstitutionUnicodeDammit)DetectsXMLParsedAsHTMLHTMLHTMLTreeBuilderSTRICTParserRejectedMarkup)BeautifulSoup)NavigableString)	_Encoding
_Encodings
_RawMarkupzhtml.parserc                  sR   ] tR t^>t$ RtR]R&   RtR]R&    R]/R R lltR	]R&   R
]R&   R]R&   R R ltR R lt	R*R R llt
R*R R lltR R lt]P                  ! R4      t]P                  ! R4      t]R R l4       tR R ltR R ltR  R! ltR" R# ltR$ R% ltR& R' ltR(tR)# )+BeautifulSoupHTMLParserZreplacestrREPLACEZignoreIGNOREon_duplicate_attributec               s(    V ^8  d   QhRRRRRRRR/# )   soupr   argsr   r%   &Union[str, _DuplicateAttributeHandler]kwargs Zformat   "</usr/lib/python3.14/site-packages/bs4/builder/_htmlparser.py__annotate__$BeautifulSoupHTMLParser.__annotate__U   s3     ( (( ( !G	(
 (    c               	s    Wn         W n        VP                  P                  V n        \        P
                  ! V .VO5/ VB  . V n        V P                  4        R # N)r'   r%   builderattribute_dict_classr   __init__already_closed_empty_elementZ_initialize_xml_detector)selfr'   r%   r(   r*   s   &&$*,r.   r5   Z BeautifulSoupHTMLParser.__init__U   sO     	&<#$(LL$E$E!D24262 -/)%%'r1   r)   z	List[str]r6   r   r'   c                    V ^8  d   QhRRRR/# )r&   messager"   returnNoner+   r,   r-   r.   r/   r0   p   s     , ,S ,T ,r1   c                	s    \        V4      hr2   r   )r7   r9      &&r.   errorZBeautifulSoupHTMLParser.errorp   s     #7++r1   c               $    V ^8  d   QhRRRRRR/# )r&   tagr"   attrsList[Tuple[str, Optional[str]]]r:   r;   r+   r,   r-   r.   r/   r0      s$         > 	 r1   c                sN    V P                  WRR7       V P                  V4       R# )zmHandle an incoming empty-element tag.

html.parser only calls this method when the markup looks like
<tag/>.
F)handle_empty_elementN)handle_starttaghandle_endtag)r7   r?   r@      &&&r.   handle_startendtagZ*BeautifulSoupHTMLParser.handle_startendtag   s%     	SeD3r1   c               s(    V ^8  d   QhRRRRRRRR/# )	r&   r?   r"   r@   rA   rB   boolr:   r;   r+   r,   r-   r.   r/   r0      s2     <, <,<, /<, #	<,
 
<,r1   c           	     s   V P                  4       pV Fg  w  rVVf   RpWT9   dS   V P                  pWpP                  8X  d   K/  VRV P                  39   d   WdV&   KH  \	        \
        V4      pV! WEV4       Kc  WdV&   Ki  	  V P                  P                  P                  '       d   V P                  4       w  rMR;rV P                  P                  VRRWHV	R7      p
V
eI   V
P                  '       d7   V'       d/   V P                  VRR7       V P                  P                  V4       V P                  f   V P!                  V4       R# R# )zHandle an opening tag, e.g. '<tag>'

:param handle_empty_element: True if this tag is known to be
    an empty-element tag (i.e. there is not expected to be any
    closing tag).
N )
sourceline	sourceposF)check_already_closed)r4   r%   r$   r#   r   _DuplicateAttributeHandlerr'   r3   Zstore_line_numbersZgetposrC   Zis_empty_elementrD   r6   appendZ_root_tag_nameZ_root_tag_encountered)r7   r?   r@   rB   Z	attr_dictZkeyvalueZon_duperI   rJ   ZtagObjs   &&&&       r.   rC   Z'BeautifulSoupHTMLParser.handle_starttag   s4    $(#<#<#>	JC } 55kk)t|| 44%*cN"#=wGGIE2!&#%  , 99///$(KKM!J	%))J**tY + 
 &"9"9"9>R s? --44S9&&&s+ 'r1   c               r>   )r&   r?   r"   rK   rG   r:   r;   r+   r,   r-   r.   r/   r0      s!     ) ) )D )D )r1   c                s    V'       d.   WP                   9   d   V P                   P                  V4       R# V P                  P                  V4       R# )zHandle a closing tag, e.g. '</tag>'

:param tag: A tag name.
:param check_already_closed: True if this tag is expected to
   be the closing portion of an empty-element tag,
   e.g. '<tag></tag>'.
N)r6   Zremover'   rD   )r7   r?   rK   rE   r.   rD   Z%BeautifulSoupHTMLParser.handle_endtag   s:      C+L+L$L
 --44S9II##C(r1   c               r8   r&   datar"   r:   r;   r+   r,   r-   r.   r/   r0      s     $ $ $ $r1   c                s<    V P                   P                  V4       R# )z4Handle some textual data that shows up between tags.N)r'   handle_datar7   rP   r<   r.   rQ   Z#BeautifulSoupHTMLParser.handle_data   s    		d#r1   z^([0-9]+)(.*)z^([0-9a-f]+)(.*)c               r8   )r&   namer"   r:   zTuple[str, bool, str]r+   r,   r-   r.   r/   r0      s     4; 4;3 4;CX 4;r1   c                s   RpRpRp^
pV P                   pVP                  R4      '       g   VP                  R4      '       d   VR,          p^pV P                  pRp \        W4      pVf   RpTpM\        P                  ! V4      w  r#W#V3#   \         dQ    TP                  T4      pTe9   \        TP                  4       ^ ,          T4      pTP                  4       ^,          p Li ; i)aX  Convert a numeric character reference into an actual character.

:param name: The number of the character reference, as
  obtained by html.parser

:return: A 3-tuple (dereferenced, replacement_added,
  extra_data). `dereferenced` is the dereferenced character
  reference, or the empty string if there was no
  reference. `replacement_added` is True if the reference
  could only be dereferenced by replacing content with U+FFFD
  REPLACEMENT CHARACTER. `extra_data` is a portion of data
  following the character reference, which was deemed to be
  normal data and not part of the reference at all.
rH   FZxZX:i   NNN)	&_DECIMAL_REFERENCE_WITH_FOLLOWING_DATA
startswith"_HEX_REFERENCE_WITH_FOLLOWING_DATAZintZ
ValueErrorZsearchZgroupsr   Znumeric_character_reference)	clsrS   dereferencedreplacement_added
extra_dataZbaseZregZ	real_nameZmatchs	   &&       r.   (_dereference_numeric_character_referenceZ@BeautifulSoupHTMLParser._dereference_numeric_character_reference   s      !&
88??34??3#7#78DD88C"&		/DI$ LJ.;.W.WXa.b+L
::-  	/ JJt$E q 148	"\\^A.
	/s   B AC('C(c               r8   r&   rS   r"   r:   r;   r+   r,   r-   r.   r/   r0     s     ) )3 )4 )r1   c                s    V P                  V4      w  r#pV'       d   RV P                  n        Ve   V P                  V4       Ve   V P                  V4       R# R# )zHandle a numeric character reference by converting it to the
corresponding Unicode character and treating it as textual
data.

:param name: Character number, possibly in hexadecimal.
TN)r[   r'   contains_replacement_charactersrQ   )r7   rS   rX   rY   rZ   s   &&   r.   handle_charrefZ&BeautifulSoupHTMLParser.handle_charref  sV     7;6c6cdh6i38<DII5#\*!Z( "r1   c               r8   r\   r+   r,   r-   r.   r/   r0   ,  s      S T r1   c                s    \         P                  P                  V4      pVe   TpM	RV,          pV P                  V4       R# )zHandle a named entity reference by converting it to the
corresponding Unicode character(s) and treating it as textual
data.

:param name: Name of the entity reference.
Nz&%s)r   ZHTML_ENTITY_TO_CHARACTERZgetrQ   )r7   rS   Z	characterrP   s   &&  r.   handle_entityrefZ(BeautifulSoupHTMLParser.handle_entityref,  s>     '??CCDI	 D 4<Dr1   c               r8   rO   r+   r,   r-   r.   r/   r0   ?  s     # #3 #4 #r1   c                s    V P                   P                  4        V P                   P                  V4       V P                   P                  \        4       R# )z?Handle an HTML comment.

:param data: The text of the comment.
N)r'   endDatarQ   r   rR   r<   r.   handle_commentZ&BeautifulSoupHTMLParser.handle_comment?  s8    
 					d#		'"r1   c               r8   )r&   declr"   r:   r;   r+   r,   r-   r.   r/   r0   H  s     # # # #r1   c                s    V P                   P                  4        V\        R4      R pV P                   P                  V4       V P                   P                  \        4       R# )zIHandle a DOCTYPE declaration.

:param data: The text of the declaration.
zDOCTYPE N)r'   r`   lenrQ   r   )r7   rb   r<   r.   handle_declZ#BeautifulSoupHTMLParser.handle_declH  sI    
 			C
O%&		d#		'"r1   c               r8   rO   r+   r,   r-   r.   r/   r0   R  s        r1   c                s&   VP                  4       P                  R4      '       d   \        pV\        R4      R pM\        pV P
                  P                  4        V P
                  P                  V4       V P
                  P                  V4       R# )zkHandle a declaration of unknown type -- probably a CDATA block.

:param data: The text of the declaration.
zCDATA[N)ZupperrU   r   rc   r   r'   r`   rQ   )r7   rP   rW   s   && r.   unknown_declZ$BeautifulSoupHTMLParser.unknown_declR  si     ::<""8,,CH(DC				d#		#r1   c               r8   rO   r+   r,   r-   r.   r/   r0   a  s     1 1c 1d 1r1   c                s    V P                   P                  4        V P                   P                  V4       V P                  V4       V P                   P                  \        4       R# )zLHandle a processing instruction.

:param data: The text of the instruction.
N)r'   r`   rQ   Z_document_might_be_xmlr   rR   r<   r.   	handle_piZ!BeautifulSoupHTMLParser.handle_pia  sG    
 					d###D)		/0r1   )r6   r4   r%   r'   N)T)__name__
__module____qualname____firstlineno__r#   __annotations__r$   r5   r=   rF   rC   rD   rQ   reZcompilerT   rV   Zclassmethodr[   r^   r_   ra   rd   re   rf   __static_attributes__r+   r1   r.   r!   r!   >   s     GS FC( JQ	(. CB"++
,  <,|)$$ .0ZZ-H*)+4F)G&4; 4;l)&##1 1r1   r!   c                  s   a  ] tR tRt$ RtRtR]R&   RtR]R&   ]t	R]R	&   ]	]
].tR
]R&   R]R&   RtR]R&   RR V 3R llltRR R llt]3R R lltRtV ;t# )r   il  zA Beautiful soup `bs4.builder.TreeBuilder` that uses the
:py:class:`html.parser.HTMLParser` parser, found in the Python
standard library.

FrG   is_xmlT	picklabler"   NAMEzIterable[str]featuresz$Tuple[Iterable[Any], Dict[str, Any]]parser_argsTRACKS_LINE_NUMBERSc               r>   )r&   rr   zOptional[Iterable[Any]]parser_kwargszOptional[Dict[str, Any]]r*   r   r+   r,   r-   r.   r/   "HTMLParserTreeBuilder.__annotate__}  s(     8 8,8 08 	8r1   c                s   < \        4       pR F   pWS9   g   K  VP                  V4      pWdV&   K"  	  \        \        V `  ! R/ VB  T;'       g    . pT;'       g    / pVP                  V4       RVR&   W3V n        R# )aB  Constructor.

:param parser_args: Positional arguments to pass into
    the BeautifulSoupHTMLParser constructor, once it's
    invoked.
:param parser_kwargs: Keyword arguments to pass into
    the BeautifulSoupHTMLParser constructor, once it's
    invoked.
:param kwargs: Keyword arguments for the superclass constructor.
FZconvert_charrefsN)r%   r+   )ZdictZpopZsuperr   r5   Zupdaterr   )r7   rr   rt   r*   Zextra_parser_kwargsZargrN   	__class__s   &&&,   r.   r5   ZHTMLParserTreeBuilder.__init__}  s    $ #f.C}

3+0C( / 	#T3=f=!''R%++01,1()'7r1   c          
     s,    V ^8  d   QhRRRRRRRRRR	/# )
r&   markupr    user_specified_encodingzOptional[_Encoding]document_declared_encodingexclude_encodingszOptional[_Encodings]r:   zDIterable[Tuple[str, Optional[_Encoding], Optional[_Encoding], bool]]r+   r,   r-   r.   r/   ru     sD     F FF "5F %8	F
 0F 
NFr1   c              #  sl  "   \        V\        4      '       d   VRRR3x  R# . pV'       d   VP                  V4       . pV'       d   VP                  V4       \        VVVRVR7      pVP                  f   \        R4      hVP                  VP                  VP                  VP                  3x  R# 5i)a  Run any preliminary steps necessary to make incoming markup
acceptable to the parser.

:param markup: Some markup -- probably a bytestring.
:param user_specified_encoding: The user asked to try this encoding.
:param document_declared_encoding: The markup itself claims to be
    in this encoding.
:param exclude_encodings: The user asked _not_ to try any of
    these encodings.

:yield: A series of 4-tuples: (markup, encoding, declared encoding,
     has undergone character replacement)

    Each 4-tuple represents a strategy for parsing the document.
    This TreeBuilder uses Unicode, Dammit to convert the markup
    into Unicode, so the ``markup`` element of the tuple will
    always be a string.
NFT)known_definite_encodingsuser_encodingsZis_htmlrz   zPCould not convert input to Unicode, and html.parser will not accept bytestrings.)	
isinstancer"   rM   r   Zunicode_markupr   Zoriginal_encodingZdeclared_html_encodingr]   )r7   rw   rx   ry   rz   r{   r|   Zdammits   &&&&&   r.   prepare_markupZ$HTMLParserTreeBuilder.prepare_markup  s     2 fc""4u-- 57 "
 %++,CD*,% !!"<=%=)/
   ( 'b 
 %%((--66	 s   *B4B4A,B4c               r>   )r&   rw   r    _parser_classztype[BeautifulSoupHTMLParser]r:   r;   r+   r,   r-   r.   r/   ru     s#     1 1: 15R 1pt 1r1   c                s,   V P                   w  r4\        V\        4      '       g   Q hV P                  f   Q hV! V P                  .VO5/ VB p VP	                  V4       VP                  4        . Tn        R#   \         d   p\        T4      hRp?ii ; i)z
:param markup: The markup to feed into the parser.
:param _parser_class: An HTMLParser subclass to use. This is only intended for use in unit tests.
N)	rr   r}   r"   r'   feedZcloseZAssertionErrorr   r6   )r7   rw   r   r(   r*   ZparserZes   &&&    r.   r   ZHTMLParserTreeBuilder.feed  s    
 '' &#&&&&
 yy$$$tyy:4:6:	*KKLLN /1+  	* 'q))		*s   !A8 8BBB)rr   )NN)NNN)rg   rh   ri   rj   __doc__rn   rk   ro   
HTMLPARSERrp   r   r   rq   rs   r5   r~   r!   r   rm   Z__classcell__)rv   s   @r.   r   r   l  sn     FDItD##T62Hm255 !%$8 8<FP Ul 1 1r1   )1r   Z
__future__r    Z__license__Z__all__Zhtml.parserr   rl   Ztypingr   r   r   r   r   r   r	   r
   r   r   r   Zbs4.elementr   r   r   r   r   r   Z
bs4.dammitr   r   Zbs4.builderr   r   r   r   Zbs4.exceptionsr   Zbs4r   r   Zbs4._typingr   r   r    r   r"   rL   r!   r   r+   r1   r.   <module>r      s    I "   # 	     9  0!+  
%tCH~sC&@$&FG k1j*@ k1\	T1O T1r1   