+
    iT  c                   s   R t ^ RIt^ RIt^ RIHt ^ RIHt R.t]P                  ! R4      t
]P                  ! R4      t]P                  ! R4      t]P                  ! R4      t]P                  ! R	4      t]P                  ! R
4      t]P                  ! R4      t]P                  ! R4      t]P                  ! R4      t]P                  ! R4      t]P                  ! R4      t]P                  ! R4      t]P                  ! R]P,                  4      t]P                  ! R]P,                  4      t]P                  ! R]P,                  4      t]P                  ! R4      t]P                  ! R4      tR tR t ! R R]P<                  4      tR# )zA parser for HTML and XHTML.N)unescape)html5
HTMLParserz[&<]z
&[a-zA-Z#]z%&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]z)&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]z&#(?:[0-9]|[xX][0-9a-fA-F])z6&(#[0-9]+|#[xX][0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*)[;=]?z	<[a-zA-Z]z
</[a-zA-Z]>z--!?>z-?>z0([a-zA-Z][^\t\n\r\f />]*)(?:[\t\n\r\f ]|/(?!>))*a{  
  (
    (?<=['"\t\n\r\f /])[^\t\n\r\f />][^\t\n\r\f /=>]*  # attribute name
   )
  ([\t\n\r\f ]*=[\t\n\r\f ]*        # value indicator
    ('[^']*'                        # LITA-enclosed value
    |"[^"]*"                        # LIT-enclosed value
    |(?!['"])[^>\t\n\r\f ]*         # bare value
    )
   )?
  (?:[\t\n\r\f ]|/(?!>))*           # possibly followed by a space
a  
  [a-zA-Z][^\t\n\r\f />]*           # tag name
  [\t\n\r\f /]*                     # optional whitespace before attribute name
  (?:(?<=['"\t\n\r\f /])[^\t\n\r\f />][^\t\n\r\f /=>]*  # attribute name
    (?:[\t\n\r\f ]*=[\t\n\r\f ]*    # value indicator
      (?:'[^']*'                    # LITA-enclosed value
        |"[^"]*"                    # LIT-enclosed value
        |(?!['"])[^>\t\n\r\f ]*     # bare value
       )
     )?
    [\t\n\r\f /]*                   # possibly followed by a space
   )*
   >?
aF  
  <[a-zA-Z][^\t\n\r\f />\x00]*       # tag name
  (?:[\s/]*                          # optional whitespace before attribute name
    (?:(?<=['"\s/])[^\s/>][^\s/=>]*  # attribute name
      (?:\s*=+\s*                    # value indicator
        (?:'[^']*'                   # LITA-enclosed value
          |"[^"]*"                   # LIT-enclosed value
          |(?!['"])[^>\s]*           # bare value
         )
        \s*                          # possibly followed by a space
       )?(?:\s|/(?!>))*
     )*
   )?
  \s*                                # trailing whitespace
z#</\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>c                 s    V P                  ^ 4      pVP                  R4      '       d   \        V4      # VP                  R4      '       g   VR,          \        9   d   \        V4      # V# )    &#Z=:   NN)group
startswithr    endswithhtml5_entities)matchZrefs   & $/usr/lib64/python3.14/html/parser.py_replace_attr_charrefr   ]   sS    
++a.C
~~d} <<RN!:}J    c                 s6    \         P                  \        V 4      # N)attr_charrefZsubr   )Zs   &r   _unescape_attrvaluer   i   s    1155r   c                   s   a a ] tR t^mt oRtR#tR$tRRRR/V 3R lltV 3R ltR t	R	 t
R
tR tRR/R ltR tR%R ltR tR tR%R ltR&R ltR tR tR tR tR tR tR tR tR tR tR tR tR  t R! t!R"t"Vt#V ;t$# )'r   a  Find tags and other markup and call handler functions.

Usage:
    p = HTMLParser()
    p.feed(data)
    ...
    p.close()

Start tags are handled by calling self.handle_starttag() or
self.handle_startendtag(); end tags by self.handle_endtag().  The
data between tags is passed from the parser to the derived class
by calling self.handle_data() with the data as argument (the data
may be split up in arbitrary chunks).  If convert_charrefs is
True the character references are converted automatically to the
corresponding Unicode character (and self.handle_data() is no
longer split in chunks), otherwise they are passed by calling
self.handle_entityref() or self.handle_charref() with the string
containing respectively the named or numeric reference as the
argument.
convert_charrefsT	scriptingFc               s\   < \         SV `  4        Wn        W n        V P	                  4        R# )aJ  Initialize and reset this instance.

If convert_charrefs is true (the default), all character references
are automatically converted to the corresponding Unicode characters.

If *scripting* is false (the default), the content of the
``noscript`` element is parsed normally; if it's true,
it's returned as is without being parsed.
N)super__init__r   r   reset)selfr   r   	__class__s   &$$r   r   ZHTMLParser.__init__   s$     	 0"

r   c                s   < RV n         RV n        \        V n        RV n        RV n        RV n        \        SV `!  4        R# )z1Reset this instance.  Loses all unprocessed data.Z z???NT)	rawdatalasttaginteresting_normalinteresting
cdata_elem_support_cdata
_escapabler   r   )r   r   s   &r   r   ZHTMLParser.reset   s8    -"r   c                sX    V P                   V,           V n         V P                  ^ 4       R# )zyFeed data to the parser.

Call this as often as you want, with as little or as much text
as you want (may include '\n').
N)r   goaheadr   Zdata   &&r   feedZHTMLParser.feed   s     ||d*Qr   c                s(    V P                  ^4       R# )zHandle any buffered data.N)r!   r   r   r   closeZHTMLParser.close   s    Qr   Nc                s    V P                   # )z)Return full source of start tag: '<...>'.)_HTMLParser__starttag_textr%   r   r   get_starttag_textZHTMLParser.get_starttag_text   s    ###r   	escapablec               s   VP                  4       V n        W n        V P                  R 8X  d   \        P                  ! R4      V n        R# V'       de   V P                  '       gS   \        P                  ! RV P                  ,          \        P                  \        P                  ,          4      V n        R# \        P                  ! RV P                  ,          \        P                  \        P                  ,          4      V n        R# )	plaintextz\zz&|</%s(?=[\t\n\r\f />])z</%s(?=[\t\n\r\f />])N)	lowerr   r    recompiler   r   Z
IGNORECASEZASCII)r   Zelemr)   s   &&$r   set_cdata_modeZHTMLParser.set_cdata_mode   s    **,#??k)!zz%0Dt444!zz*Dt*V*,--*@ BD  "zz*BT__*T*,--*@ BDr   c                s8    \         V n        R V n        RV n        R # )NT)r   r   r   r    r%   r   r   clear_cdata_modeZHTMLParser.clear_cdata_mode   s    -r   c                s    Wn         R# )a  Enable or disable support of the CDATA sections.
If enabled, "<[CDATA[" starts a CDATA section which ends with "]]>".
If disabled, "<[CDATA[" starts a bogus comments which ends with ">".

This method is not called by default. Its purpose is to be called
in custom handle_starttag() and handle_endtag() methods, with
value that depends on the adjusted current node.
See https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state
for details.
N)r   )r   Zflagr#   r   _set_support_cdataZHTMLParser._set_support_cdata   s
     #r   c                sJ   V P                   p^ p\        V4      pW48  Ed   V P                  '       d   V P                  '       gs   VP	                  RV4      pV^ 8  dY   VP                  R\        W4^",
          4      4      pV^ 8  d.   \        P                  ! R4      P                  W&4      '       g   EMTpMJV P                  P                  W#4      pV'       d   VP                  4       pMV P                  '       d   EMTpW58  dU   V P                  '       d0   V P                  '       d   V P                  \        W#V 4      4       MV P                  W#V 4       V P                  W54      pW48X  d   EM3VP                   pV! RV4      '       Ed   \"        P%                  W#4      '       d   V P'                  V4      p	MV! RV4      '       d   V P)                  V4      p	MV! RV4      '       d   V P+                  V4      p	MuV! RV4      '       d   V P-                  V4      p	MTV! RV4      '       d   V P/                  V4      p	M3V^,           V8  g	   V'       d   V P                  R4       V^,           p	MEM3V	^ 8  Ed   V'       g   EM!\"        P%                  W#4      '       d   EMV! RV4      '       d[   V^,           V8X  d   V P                  R4       EMt\0        P%                  W#4      '       d   EMWV P3                  W#^,           R 4       EM;V! RV4      '       dY   TpR F5  p
VP5                  W^,           4      '       g   K#  V\        V
4      ,          p M	  V P3                  W#^,           V 4       MV! R	V4      '       d.   V P6                  '       d   V P9                  W#^,           R 4       MW#V^	,            P;                  4       R
8X  d   V P=                  W#^,           R 4       M_V! RV4      '       d   V P3                  W#^,           R 4       M5V! RV4      '       d   V P?                  W#^,           R 4       M\A        R4      hTp	V P                  W94      pEKC  V! RV4      '       Ed   \B        P%                  W#4      pV'       dh   VPE                  4       ^R pV PG                  V4       VPI                  4       p	V! RV	^,
          4      '       g
   V	^,
          p	V P                  W94      pEK  \J        P%                  W#4      pV'       d8   V'       d.   V PG                  W#^,           R 4       V P                  W44      pEMdEMbV^,           V8  d-   V P                  R4       V P                  W3^,           4      pEKe  EM&V! RV4      '       Ed   \L        P%                  W#4      pV'       df   VPE                  ^4      pV PO                  V4       VPI                  4       p	V! RV	^,
          4      '       g
   V	^,
          p	V P                  W94      pEK  \P        P%                  W#4      pV'       d6   V'       d-   V PO                  W#^,           R 4       V P                  W44      pMCMBV^,           V8  d-   V P                  R4       V P                  W3^,           4      pEK  MQ R4       hV'       dl   W48  df   V P                  '       d0   V P                  '       d   V P                  \        W#V 4      4       MV P                  W#V 4       V P                  W44      pW#R V n         R# )r   Z<Z&z[\t\n\r\f ;]</<!--<?<!N	<![CDATA[	<!doctypezwe should not get here!r   Z;zinteresting.search() lied)z--!z--Z-))r   Zlenr   r   findZrfindZmaxr,   r-   searchr   startr    handle_datar    Z	updateposr   starttagopenr   parse_starttagparse_endtagparse_commentparse_piparse_html_declaration
endtagopenhandle_commentr	   r   unknown_declr+   handle_decl	handle_piZAssertionErrorcharrefr   handle_charrefendincomplete_charref	entityrefhandle_entityref
incomplete)r   rI   r   iZnjZampposr   r   kZsuffixnames   &&          r   r!   ZHTMLParser.goahead   s   ,,Le$$$T___LLa(q5 %]]3At=F!JJ7>>wOOA((//;AAu(((T___$$Xgl%;<$$Wq\2q$Avu ++J#q!!%%g11++A.Aa(())!,A****1-Aa((a(Aa((33A6A!eq[C$$S)AAq5#))'55#D!,,q5A: ,,T2'--g99  !//!>#FA..&8F&//!<< !S[ 0 % '9 ++GaCN;#K338K8K8K))'A#$-8 1Q3--/;>((17#D!,,++GaCDM:#D!,,wst}5,-FGGANN1(D!$$g1 ;;=2.D''-		A%c1Q3//Eq,A*00<++GaCDM: NN10UQY $$T*qa%0AC##!3 ;;q>D))$/		A%c1Q3//Eq,A"((4--gcdm< NN10UQY $$S)qa%0A555q15$$$  'A,!78  1.q$Ar{r   c                s@   V P                   pW!V^,            R8X  g   Q R4       hW!V^,            R8X  d   V P                  V4      # W!V^	,            R8X  dX   V P                  '       dF   VP                  RV^	,           4      pV^ 8  d   R# V P	                  W!^,           V 4       V^,           # W!V^	,            P                  4       R8X  dF   VP                  RV^	,           4      pVR8X  d   R# V P                  W!^,           V 4       V^,           # V P                  V4      # )	   r4   z+unexpected call to parse_html_declaration()r2   r5   z]]>r6   r   r7   )r   r?   r   r8   rD   r+   rE   parse_bogus_comment)r   rN   r   rO   Zgtpos   &&   r   rA   Z!HTMLParser.parse_html_declarationj  s   ,,1~% 	D )C 	D%QqS>V#%%a((qs^{*t/B/B/BUAaC(A1u	gc1o.q5Lqs^!!#{2LLac*E{	WqS/07N++A..r   c                sp   V P                   pVP                  R V4      '       g   Q R4       h\        P                  W1^,           4      pV'       g'   \        P                  W1^,           4      pV'       g   R# V'       d+   VP                  4       pV P                  W1^,           V 4       VP                  4       # )r2   z"unexpected call to parse_comment()r7   )	r   r   commentcloser9   commentabruptcloser   r:   rC   rI   )r   rN   reportr   r   rO   s   &&&   r   r?   ZHTMLParser.parse_comment  s    ,,!!&!,,R.RR,##GqS1&,,Wc:E	A!Q0yy{r   c                s    V P                   pW1V^,            R9   g   Q R4       hVP                  RV^,           4      pVR8X  d   R# V'       d   V P                  W1^,           V 4       V^,           # )rR   z(unexpected call to parse_bogus_comment()r   )r4   r1   r7   )r   r8   rC   )r   rN   rW   r   Zposs   &&&  r   rS   ZHTMLParser.parse_bogus_comment  ss    ,,1~- 	I 1H 	I-ll3!$"9I!C 01Qwr   c                s   V P                   pW!V^,            R8X  g   Q R4       h\        P                  W!^,           4      pV'       g   R# VP                  4       pV P	                  W!^,           V 4       VP                  4       pV# )rR   r3   zunexpected call to parse_pi()r7   )r   picloser9   r:   rF   rI   r   rN   r   r   rO   rT   r   r@   ZHTMLParser.parse_pi  sp    ,,1~%F'FF%w!,IKKMwsA'IIKr   c                sh   R V n         V P                  V4      pV^ 8  d   V# V P                  pW1V V n         . p\        P	                  W1^,           4      pV'       g   Q R4       hVP                  4       pVP                  ^4      P                  4       ;V n        pWb8  d   \        P	                  W64      pV'       g   MVP                  ^^^4      w  rpV
'       g   R pM<VR,          Ru;8X  d   VRR  8X  g   M VR,          Ru;8X  d   VRR  8X  d	   M MV^R pV'       d   \        V4      pVP                  V	P                  4       V34       VP                  4       pK  W6V P                  4       pVR9  d   V P                  W1V 4       V# VP                  R4      '       d   V P                  Wt4       V# V P!                  Wt4       WpP"                  9   g!   V P$                  '       d   VR8X  g   VR8X  d   V P'                  VRR	7       V# WpP(                  9   d   V P'                  VR
R	7       V# )Nz#unexpected call to parse_starttag():Nr   NZ'Z"/>Znoscriptr*   F)r)   Tr7   )r   rZ   )r'   check_for_whole_start_tagr   tagfind_tolerantr   rI   r   r+   r   attrfind_tolerantr   ZappendZstripr;   r	   handle_startendtaghandle_starttagCDATA_CONTENT_ELEMENTSr   r.   RCDATA_CONTENT_ELEMENTS)r   rN   Zendposr   attrsr   rP   tagZmZattrnameZrestZ	attrvaluerI   s   &&           r   r=   ZHTMLParser.parse_starttag  s     $//2A:M,,&0  &&w!4;;;uIIK"[[^1133sj!''3A()1a(8%HI 	2$8)BC.82#7237%aO	/	:	LL(..*I67A%%'k!Wv./M<<##C/    ,222C:$5{"##C5#9  444##C4#8r   c                s    V P                   p\        P                  W!^,           4      pV'       g   Q hVP                  4       pW$^,
          ,          R8w  d   R# V# )r   r   r7   )r   locatetagendr   rI   rY   rT   r   r[   Z$HTMLParser.check_for_whole_start_tag  sI    ,,""7aC0uIIKQ3<3Ir   c                s   V P                   pW!V^,            R8X  g   Q R4       hVP                  RV^,           4      ^ 8  d   R# \        P                  W!4      '       g2   W!^,           V^,            R8X  d
   V^,           # V P	                  V4      # \
        P                  W!^,           4      pV'       g   Q hVP                  4       pW$^,
          ,          R8w  d   R# \        P                  W!^,           4      pV'       g   Q hVP                  ^4      P                  4       pV P                  V4       V P                  4        V# )rR   r1   zunexpected call to parse_endtagr   r7   )r   r8   rB   r   rS   rd   rI   r\   r   r+   handle_endtagr/   )r   rN   r   r   rO   rc   s   &&    r   r>   ZHTMLParser.parse_endtag  s    ,,1~%H'HH%<<QqS!A%I++s1Q33&s
//22""7aC0uIIKQ3<3I !&&w!4ukk!n""$3r   c                sJ    V P                  W4       V P                  V4       R # r   )r_   re   r   rc   rb      &&&r   r^   ZHTMLParser.handle_startendtag  s    S(3r   c                    R # r    rf   rg   r   r_   ZHTMLParser.handle_starttag	      r   c                rh   r   ri   )r   rc   r#   r   re   ZHTMLParser.handle_endtag  rj   r   c                rh   r   ri   r   rQ   r#   r   rH   ZHTMLParser.handle_charref  rj   r   c                rh   r   ri   rk   r#   r   rL   ZHTMLParser.handle_entityref  rj   r   c                rh   r   ri   r"   r#   r   r;   ZHTMLParser.handle_data  rj   r   c                rh   r   ri   r"   r#   r   rC   ZHTMLParser.handle_comment  rj   r   c                rh   r   ri   )r   Zdeclr#   r   rE   ZHTMLParser.handle_decl!  rj   r   c                rh   r   ri   r"   r#   r   rF   ZHTMLParser.handle_pi%  rj   r   c                rh   r   ri   r"   r#   r   rD   ZHTMLParser.unknown_decl(  rj   r   )	Z__starttag_textr    r   r   r   r   r   r   r   )ZscriptZstyleZxmpZiframeZnoembedZnoframes)ZtextareaZtitle)T)r   )%Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__r`   ra   r   r   r$   r&   r'   r(   r.   r/   r0   r!   rA   r?   rS   r@   r=   r[   r>   r^   r_   re   rH   rL   r;   rC   rE   rF   rD   Z__static_attributes__Z__classdictcell__Z__classcell__)r   Z__classdict__s   @@r   r   r   m   s     0 Y34 5  O$
B 
B
# O#h/2		.d< 
 r   ) rl   r,   Z_markupbaseZhtmlr    Zhtml.entitiesr   r
   Z__all__r-   r   rM   rK   rG   rJ   r   r<   rB   rX   rU   rV   r\   ZVERBOSEr]   rd   Zlocatestarttagend_tolerantZ	endendtagZ
endtagfindr   r   Z
ParserBaser   ri   r   r   <module>rm      si   " 
   1 . ZZ' ZZ%
JJ>?	
**@
AZZ => zzSTzz+&ZZ%

**S/zz(#ZZ'  ::QR JJ   ZZ  zz  ZZ   ZZ ) ZZ  JJsO	ZZ>?

6|'' |r   