Ë
    Áj—–  ã                  ó  — d Z ddlmZ ddlmZ ddlmZmZmZm	Z	 ddl
Z
ddlmc mZ ddlmZ erddlmZ dPd	„Zd
Z	 dZ	 dZ	 dZ	 dZ	 dZ	 dZ	 dZ	 dZ	 dZ	 dZ	 dZ	 dZ	 edz   Z 	 dZ!	 e Z"	 e!Z#	 dZ$	 dZ%	 dZ&	 dZ'	 dZ(	 dZ)	 dQd„Z* G d „ d!e	«      Z+ G d"„ d#«      Z, G d$„ d%e,«      Z- G d&„ d'e,«      Z. G d(„ d)e-«      Z/ G d*„ d+e-«      Z0 G d,„ d-e,«      Z1 G d.„ d/e-«      Z2 G d0„ d1e1«      Z3 G d2„ d3e2«      Z4 G d4„ d5e-«      Z5 G d6„ d7e1«      Z6 G d8„ d9e2«      Z7 G d:„ d;e-«      Z8 G d<„ d=e-«      Z9 G d>„ d?e9«      Z: G d@„ dAe-«      Z; G dB„ dCe;«      Z< G dD„ dEe;«      Z= G dF„ dGe=«      Z> G dH„ dIe=«      Z? G dJ„ dKe?«      Z@ G dL„ dMe-«      ZA G dN„ dOe-«      ZBy)RaB  
In version 3.0, a new, more flexible inline processor was added, [`markdown.inlinepatterns.InlineProcessor`][].   The
original inline patterns, which inherit from [`markdown.inlinepatterns.Pattern`][] or one of its children are still
supported, though users are encouraged to migrate.

The new `InlineProcessor` provides two major enhancements to `Patterns`:

1. Inline Processors no longer need to match the entire block, so regular expressions no longer need to start with
  `r'^(.*?)'` and end with `r'(.*?)%'`. This runs faster. The returned [`Match`][re.Match] object will only contain
   what is explicitly matched in the pattern, and extension pattern groups now start with `m.group(1)`.

2.  The `handleMatch` method now takes an additional input called `data`, which is the entire block under analysis,
    not just what is matched with the specified pattern. The method now returns the element *and* the indexes relative
    to `data` that the return element is replacing (usually `m.start(0)` and `m.end(0)`).  If the boundaries are
    returned as `None`, it is assumed that the match did not take place, and nothing will be altered in `data`.

    This allows handling of more complex constructs than regular expressions can handle, e.g., matching nested
    brackets, and explicit control of the span "consumed" by the processor.

é    )Úannotationsé   )Úutil)ÚTYPE_CHECKINGÚAnyÚ
CollectionÚ
NamedTupleN)Úentities)ÚMarkdownc                ó6  — t        j                  «       }|j                  t        t        «      dd«       |j                  t        t        | «      dd«       |j                  t        t        | «      dd«       |j                  t        t        | «      dd«       |j                  t        t        | «      d	d
«       |j                  t        t        | «      dd«       |j                  t        t        | «      dd«       |j                  t!        t        | «      dd«       |j                  t#        t$        | «      dd«       |j                  t'        t(        | «      dd«       |j                  t+        t,        d«      dd«       |j                  t/        t0        | «      dd«       |j                  t/        t2        | «      dd«       |j                  t5        t6        «      dd«       |j                  t9        d«      dd «       |j                  t;        d!«      d"d#«       |S )$a  
    Build the default set of inline patterns for Markdown.

    The order in which processors and/or patterns are applied is very important - e.g. if we first replace
    `http://.../` links with `<a>` tags and _then_ try to replace inline HTML, we would end up with a mess. So, we
    apply the expressions in the following order:

    * backticks and escaped characters have to be handled before everything else so that we can preempt any markdown
      patterns by escaping them;

    * then we handle the various types of links (auto-links must be handled before inline HTML);

    * then we handle inline HTML.  At this point we will simply replace all inline HTML strings with a placeholder
      and add the actual HTML to a stash;

    * finally we apply strong, emphasis, etc.

    Úbacktické¾   Úescapeé´   Ú	referenceéª   Úlinké    Ú
image_linké–   Úimage_referenceéŒ   Úshort_referenceé‚   Úshort_image_refé}   Úautolinkéx   Úautomailén   ÚbrÚ	linebreakéd   ÚhtmléZ   ÚentityéP   Ú
not_strongéF   z\*Ú	em_strongé<   Ú_Ú
em_strong2é2   )r   ÚRegistryÚregisterÚBacktickInlineProcessorÚBACKTICK_REÚEscapeInlineProcessorÚ	ESCAPE_REÚReferenceInlineProcessorÚREFERENCE_REÚLinkInlineProcessorÚLINK_REÚImageInlineProcessorÚIMAGE_LINK_REÚImageReferenceInlineProcessorÚIMAGE_REFERENCE_REÚShortReferenceInlineProcessorÚ"ShortImageReferenceInlineProcessorÚAutolinkInlineProcessorÚAUTOLINK_REÚAutomailInlineProcessorÚAUTOMAIL_REÚSubstituteTagInlineProcessorÚLINE_BREAK_REÚHtmlInlineProcessorÚHTML_REÚ	ENTITY_REÚSimpleTextInlineProcessorÚNOT_STRONG_REÚAsteriskProcessorÚUnderscoreProcessor)ÚmdÚkwargsÚinlinePatternss      úJ/var/www/html/venv/lib/python3.12/site-packages/markdown/inlinepatterns.pyÚbuild_inlinepatternsrP   5   sÆ  € ô& —]‘]“_€NØ×ÑÔ3´KÓ@À*ÈcÔRØ×ÑÔ1´)¸RÓ@À(ÈCÔPØ×ÑÔ4´\À2ÓFÈÐUXÔYØ×ÑÔ/´¸Ó<¸fÀcÔJØ×ÑÔ0´ÀÓCÀ\ÐSVÔWØ×ÑÜ%Ô&8¸"Ó=Ð?PÐRUôð ×ÑÜ%¤l°BÓ7Ð9JÈCôð ×ÑÜ*Ô+=¸rÓBÐDUÐWZôð ×ÑÔ3´KÀÓDÀjÐRUÔVØ×ÑÔ3´KÀÓDÀjÐRUÔVØ×ÑÔ8¼ÈÓMÈ{Ð\_Ô`Ø×ÑÔ/´¸Ó<¸fÀbÔIØ×ÑÔ/´	¸2Ó>ÀÈ"ÔMØ×ÑÔ5´mÓDÀlÐTVÔWØ×ÑÔ-¨eÓ4°kÀ2ÔFØ×ÑÔ/°Ó5°|ÀRÔHØÐó    z(?<!\!)z;(?:(?<!\\)((?:\\{2})+)(?=`+)|(?<!\\)(`+)(.+?)(?<!`)\2(?!`))z\\(.)z(\*)([^\*]+)\1z(\*{2})(.+?)\1z%(?<!\w)(_{2})(?!_)(.+?)(?<!_)\1(?!\w)z"(?<!\w)(_)(?!_)(.+?)(?<!_)\1(?!\w)z7(?<!\w)(\_)\1(?!\1)(.+?)(?<!\w)\1(?!\1)(.+?)\1{3}(?!\w)z(\*)\1{2}(.+?)\1(.*?)\1{2}z(_)\1{2}(.+?)\1(.*?)\1{2}z(\*)\1{2}(.+?)\1{2}(.*?)\1z(_)\1{2}(.+?)\1{2}(.*?)\1z&(\*)\1(?!\1)([^*]+?)\1(?!\1)(.+?)\1{3}z\[z\!\[z%((^|(?<=\s))(\*{1,3}|_{1,3})(?=\s|$))z+<((?:[Ff]|[Hh][Tt])[Tt][Pp][Ss]?://[^<>]*)>z<([^<> !]+@[^@<> ]+)>z(<(\/?[a-zA-Z][^<>@ ]*( [^<>]*)?|!--(?:(?!<!--|-->).)*--|[?](?:(?!<[?]|[?]>).)*[?]|!\[CDATA\[(?:(?!<!\[CDATA\[|\]\]>).)*\]\])>)z-(&(?:\#[0-9]+|\#x[0-9a-fA-F]+|[a-zA-Z0-9]+);)z  \nc                ó˜   — | j                  d«      r| j                  d«      s"| j                  d«      r| j                  d«      r| dd S | S )z#Remove quotes from around a string.Ú"Ú'r   éÿÿÿÿ)Ú
startswithÚendswith)Ústrings    rO   ÚdequoterY   ±   sE   € à	×	Ñ	˜3Ô	 F§O¡O°CÔ$8Ø×Ñ˜#Ô 6§?¡?°3Ô#7Ø�a˜ˆ|ÐàˆrQ   c                  ó0   — e Zd ZU dZded<   ded<   ded<   y)ÚEmStrongItemzEmphasis/strong pattern item.úre.Pattern[str]ÚpatternÚstrÚbuilderÚtagsN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__© rQ   rO   r[   r[   º   s   … Ù'ØÓØƒLØ
„IrQ   r[   c                  ój   — e Zd ZU dZ e«       Zded<   	 ded<   ded<   ddd	„Zdd
„Zdd„Z	dd„Z
dd„Zy)ÚPatternaí  
    Base class that inline patterns subclass.

    Inline patterns are handled by means of `Pattern` subclasses, one per regular expression.
    Each pattern object uses a single regular expression and must support the following methods:
    [`getCompiledRegExp`][markdown.inlinepatterns.Pattern.getCompiledRegExp] and
    [`handleMatch`][markdown.inlinepatterns.Pattern.handleMatch].

    All the regular expressions used by `Pattern` subclasses must capture the whole block.  For this
    reason, they all start with `^(.*)` and end with `(.*)!`.  When passing a regular expression on
    class initialization, the `^(.*)` and `(.*)!` are added automatically and the regular expression
    is pre-compiled.

    It is strongly suggested that the newer style [`markdown.inlinepatterns.InlineProcessor`][] that
    use a more efficient and flexible search approach be used instead. However, the older style
    `Pattern` remains for backward compatibility with many existing third-party extensions.

    zCollection[str]ÚANCESTOR_EXCLUDESr\   Úcompiled_reúMarkdown | NonerL   Nc                óš   — || _         t        j                  d|z  t        j                  t        j                  z  «      | _        || _        y)a!  
        Create an instant of an inline pattern.

        Arguments:
            pattern: A regular expression that matches a pattern.
            md: An optional pointer to the instance of `markdown.Markdown` and is available as
                `self.md` on the class instance.


        z^(.*?)%s(.*)$N)r]   ÚreÚcompileÚDOTALLÚUNICODErj   rL   ©Úselfr]   rL   s      rO   Ú__init__zPattern.__init__â   s=   € ð ˆŒÜŸ:™:Ð&6¸Ñ&@Ü&(§i¡i´"·*±*Ñ&<ó>ˆÔð ˆ�rQ   c                ó   — | j                   S )z' Return a compiled regular expression. )rj   ©rr   s    rO   ÚgetCompiledRegExpzPattern.getCompiledRegExpó   s   € à×ÑÐrQ   c                 ó   — y)zóReturn a ElementTree element from the given match.

        Subclasses should override this method.

        Arguments:
            m: A match object containing a match of the pattern.

        Returns: An ElementTree Element object.

        Nrf   ©rr   Úms     rO   ÚhandleMatchzPattern.handleMatch÷   s   € ð 	rQ   c                ó.   — | j                   j                  S )z+ Return class name, to define pattern type )Ú	__class__ra   ru   s    rO   ÚtypezPattern.type  s   € à�~‰~×&Ñ&Ð&rQ   c                ó¸   ‡— 	 | j                   j                  d   j                  Šˆfd„}t        j
                  j                  ||«      S # t        $ r |cY S w xY w)ú> Return unescaped text given text with an inline placeholder. Úinlinec                ó´   •— | j                  d«      }|‰v rB‰j                  |«      }t        |t        «      r|S dj	                  |j                  «       «      S y )Nr   Ú )ÚgroupÚgetÚ
isinstancer^   ÚjoinÚitertext)ry   ÚidÚvalueÚstashs      €rO   Ú	get_stashz#Pattern.unescape.<locals>.get_stash  sP   ø€ Ø—‘˜“ˆBØ�U‰{ØŸ	™	 "›�Ü˜e¤SÔ)Ø �Lð Ÿ7™7 5§>¡>Ó#3Ó4Ð4ð rQ   ©rL   ÚtreeprocessorsÚstashed_nodesÚKeyErrorr   ÚINLINE_PLACEHOLDER_REÚsub©rr   Útextr‹   rŠ   s      @rO   ÚunescapezPattern.unescape  sX   ø€ ð	Ø—G‘G×*Ñ*¨8Ñ4×BÑBˆEô	5ô ×)Ñ)×-Ñ-¨i¸Ó>Ð>øô ò 	ØŠKð	ús   ƒ#A ÁAÁA©N©r]   r^   rL   rk   )Úreturnz
re.Pattern)ry   úre.Match[str]r—   zetree.Element | str)r—   r^   ©r“   r^   r—   r^   )ra   rb   rc   rd   Útupleri   re   rs   rv   rz   r}   r”   rf   rQ   rO   rh   rh   Å   sB   … ññ& */«Ð�Ó0ðð
 !Ó ØÓôó" óó'ô?rQ   rh   c                  ó"   — e Zd ZdZddd„Zdd„Zy)ÚInlineProcessorz¡
    Base class that inline processors subclass.

    This is the newer style inline processor that uses a more
    efficient and flexible search approach.

    Nc                ó¢   — || _         t        j                  |t        j                  t        j                  z  «      | _        d| _        || _        y)a"  
        Create an instant of an inline processor.

        Arguments:
            pattern: A regular expression that matches a pattern.
            md: An optional pointer to the instance of `markdown.Markdown` and is available as
                `self.md` on the class instance.

        FN)r]   rm   rn   ro   rp   rj   Ú	safe_moderL   rq   s      rO   rs   zInlineProcessor.__init__$  s;   € ð ˆŒÜŸ:™: g¬r¯y©y¼2¿:¹:Ñ/EÓFˆÔð ˆŒØˆ�rQ   c                 ó   — y)a™  Return a ElementTree element from the given match and the
        start and end index of the matched text.

        If `start` and/or `end` are returned as `None`, it will be
        assumed that the processor did not find a valid region of text.

        Subclasses should override this method.

        Arguments:
            m: A re match object containing a match of the pattern.
            data: The buffer currently under analysis.

        Returns:
            el: The ElementTree element, text or None.
            start: The start of the region that has been matched or None.
            end: The end of the region that has been matched or None.

        Nrf   ©rr   ry   Údatas      rO   rz   zInlineProcessor.handleMatch5  s   € ð& 	rQ   r•   r–   )ry   r˜   r¡   r^   r—   z9tuple[etree.Element | str | None, int | None, int | None]©ra   rb   rc   rd   rs   rz   rf   rQ   rO   rœ   rœ     s   „ ñôô"rQ   rœ   c                  ó   — e Zd ZdZdd„Zy)ÚSimpleTextPatternz2 Return a simple text of `group(2)` of a Pattern. c                ó$   — |j                  d«      S )z< Return string content of `group(2)` of a matching pattern. é   )rƒ   rx   s     rO   rz   zSimpleTextPattern.handleMatchM  s   € à�w‰w�q‹zÐrQ   N©ry   r˜   r—   r^   ©ra   rb   rc   rd   rz   rf   rQ   rO   r¤   r¤   K  s
   „ Ù<ôrQ   r¤   c                  ó   — e Zd ZdZdd„Zy)rH   z2 Return a simple text of `group(1)` of a Pattern. c                óf   — |j                  d«      |j                  d«      |j                  d«      fS )z< Return string content of `group(1)` of a matching pattern. r   r   )rƒ   ÚstartÚendr    s      rO   rz   z%SimpleTextInlineProcessor.handleMatchT  s'   € à�w‰w�q‹z˜1Ÿ7™7 1›: q§u¡u¨Q£xÐ/Ð/rQ   N©ry   r˜   r¡   r^   r—   ztuple[str, int, int]r¨   rf   rQ   rO   rH   rH   R  s
   „ Ù<ô0rQ   rH   c                  ó   — e Zd ZdZdd„Zy)r3   z Return an escaped character. c                óL  — |j                  d«      }|| j                  j                  v rYdj                  t        j
                  t        |«      t        j                  «      |j                  d«      |j                  d«      fS d|j                  d«      |j                  d«      fS )aµ  
        If the character matched by `group(1)` of a pattern is in [`ESCAPED_CHARS`][markdown.Markdown.ESCAPED_CHARS]
        then return the integer representing the character's Unicode code point (as returned by [`ord`][]) wrapped
        in [`util.STX`][markdown.util.STX] and [`util.ETX`][markdown.util.ETX].

        If the matched character is not in [`ESCAPED_CHARS`][markdown.Markdown.ESCAPED_CHARS], then return `None`.
        r   ú{}{}{}r   N)
rƒ   rL   ÚESCAPED_CHARSÚformatr   ÚSTXÚordÚETXr«   r¬   )rr   ry   r¡   Úchars       rO   rz   z!EscapeInlineProcessor.handleMatch\  sw   € ð �w‰w�q‹zˆØ�4—7‘7×(Ñ(Ñ(Ø—?‘?¤4§8¡8¬S°«Y¼¿¹ÓAÀ1Ç7Á7È1Ã:ÈqÏuÉuÐUVËxÐWÐWà˜Ÿ™ › Q§U¡U¨1£XÐ-Ð-rQ   N)ry   r˜   r¡   r^   r—   ztuple[str | None, int, int]r¨   rf   rQ   rO   r3   r3   Y  s
   „ Ù(ô.rQ   r3   c                  ó    — e Zd ZdZdd„Zdd„Zy)ÚSimpleTagPatternz]
    Return element of type `tag` with a text attribute of `group(3)`
    of a Pattern.

    c                ó>   — t         j                  | |«       || _        y)zµ
        Create an instant of an simple tag pattern.

        Arguments:
            pattern: A regular expression that matches a pattern.
            tag: Tag of element.

        N)rh   rs   Útag©rr   r]   rº   s      rO   rs   zSimpleTagPattern.__init__r  s   € ô 	×Ñ˜˜wÔ'ØˆŒØ0rQ   c                óp   — t        j                  | j                  «      }|j                  d«      |_        |S )z¤
        Return [`Element`][xml.etree.ElementTree.Element] of type `tag` with the string in `group(3)` of a
        matching pattern as the Element's text.
        é   )ÚetreeÚElementrº   rƒ   r“   )rr   ry   Úels      rO   rz   zSimpleTagPattern.handleMatch  s*   € ô
 �]‰]˜4Ÿ8™8Ó$ˆØ—'‘'˜!“*ˆŒØˆ	rQ   N©r]   r^   rº   r^   ©ry   r˜   r—   úetree.Elementr¢   rf   rQ   rO   r¸   r¸   l  s   „ ñó
1ôrQ   r¸   c                  ó    — e Zd ZdZdd„Zdd„Zy)ÚSimpleTagInlineProcessorz]
    Return element of type `tag` with a text attribute of `group(2)`
    of a Pattern.

    c                ó>   — t         j                  | |«       || _        y)z·
        Create an instant of an simple tag processor.

        Arguments:
            pattern: A regular expression that matches a pattern.
            tag: Tag of element.

        N)rœ   rs   rº   r»   s      rO   rs   z!SimpleTagInlineProcessor.__init__�  s   € ô 	× Ñ   wÔ/ØˆŒØ0rQ   c                ó²   — t        j                  | j                  «      }|j                  d«      |_        ||j                  d«      |j                  d«      fS )z¤
        Return [`Element`][xml.etree.ElementTree.Element] of type `tag` with the string in `group(2)` of a
        matching pattern as the Element's text.
        r¦   r   )r¾   r¿   rº   rƒ   r“   r«   r¬   ©rr   ry   r¡   rÀ   s       rO   rz   z$SimpleTagInlineProcessor.handleMatchœ  sB   € ô
 �]‰]˜4Ÿ8™8Ó$ˆØ—'‘'˜!“*ˆŒØ�1—7‘7˜1“:˜qŸu™u Q›xÐ'Ð'rQ   NrÁ   ©ry   r˜   r¡   r^   r—   ztuple[etree.Element, int, int]r¢   rf   rQ   rO   rÅ   rÅ   ‰  s   „ ñó
1ô(rQ   rÅ   c                  ó   — e Zd ZdZdd„Zy)ÚSubstituteTagPatternú3 Return an element of type `tag` with no children. c                ó@   — t        j                  | j                  «      S )úH Return empty [`Element`][xml.etree.ElementTree.Element] of type `tag`. )r¾   r¿   rº   rx   s     rO   rz   z SubstituteTagPattern.handleMatch¨  s   € ä�}‰}˜TŸX™XÓ&Ð&rQ   NrÂ   r¨   rf   rQ   rO   rË   rË   ¦  s
   „ Ù=ô'rQ   rË   c                  ó   — e Zd ZdZdd„Zy)rC   rÌ   c                ó‚   — t        j                  | j                  «      |j                  d«      |j	                  d«      fS )rÎ   r   )r¾   r¿   rº   r«   r¬   r    s      rO   rz   z(SubstituteTagInlineProcessor.handleMatch¯  s,   € ä�}‰}˜TŸX™XÓ&¨¯©°«
°A·E±E¸!³HÐ<Ð<rQ   NrÉ   r¨   rf   rQ   rO   rC   rC   ­  s
   „ Ù=ô=rQ   rC   c                  ó    — e Zd ZdZdd„Zdd„Zy)r1   zA Return a `<code>` element containing the escaped matching text. c                ó¸   — t         j                  | |«       dj                  t        j                  t        d«      t        j                  «      | _        d| _        y )Nr°   Ú\Úcode)	rœ   rs   r²   r   r³   r´   rµ   ÚESCAPED_BSLASHrº   )rr   r]   s     rO   rs   z BacktickInlineProcessor.__init__¶  s=   € Ü× Ñ   wÔ/Ø&Ÿo™o¬d¯h©h¼¸D»	Ä4Ç8Á8ÓLˆÔØˆŒØ0rQ   c                óÔ  — |j                  d«      rŒt        j                  | j                  «      }t	        j
                  t	        j                  |j                  d«      j                  «       «      «      |_        ||j                  d«      |j                  d«      fS |j                  d«      j                  d| j                  «      |j                  d«      |j                  d«      fS )a€  
        If the match contains `group(3)` of a pattern, then return a `code`
        [`Element`][xml.etree.ElementTree.Element] which contains HTML escaped text (with
        [`code_escape`][markdown.util.code_escape]) as an [`AtomicString`][markdown.util.AtomicString].

        If the match does not contain `group(3)` then return the text of `group(1)` backslash escaped.

        r½   r   r   z\\)rƒ   r¾   r¿   rº   r   ÚAtomicStringÚcode_escapeÚstripr“   r«   r¬   ÚreplacerÕ   rÈ   s       rO   rz   z#BacktickInlineProcessor.handleMatch¼  s©   € ð �7‰7�1Œ:Ü—‘˜tŸx™xÓ(ˆBÜ×'Ñ'¬×(8Ñ(8¸¿¹À»×9IÑ9IÓ9KÓ(LÓMˆBŒGØ�q—w‘w˜q“z 1§5¡5¨£8Ð+Ð+à—7‘7˜1“:×%Ñ% f¨d×.AÑ.AÓBÀAÇGÁGÈAÃJÐPQ×PUÑPUÐVWÓPXÐXÐXrQ   N)r]   r^   )ry   r˜   r¡   r^   r—   z$tuple[etree.Element | str, int, int]r¢   rf   rQ   rO   r1   r1   ´  s   „ ÙKó1ôYrQ   r1   c                  ó   — e Zd ZdZdd„Zy)ÚDoubleTagPatternúfReturn a ElementTree element nested in tag2 nested in tag1.

    Useful for strong emphasis etc.

    c                ó(  — | j                   j                  d«      \  }}t        j                  |«      }t        j                  ||«      }|j                  d«      |_        t        |j                  «       «      dk(  r|j                  d«      |_	        |S )z¬
        Return [`Element`][xml.etree.ElementTree.Element] in following format:
        `<tag1><tag2>group(3)</tag2>group(4)</tag2>` where `group(4)` is optional.

        Ú,r½   é   é   )
rº   Úsplitr¾   r¿   Ú
SubElementrƒ   r“   ÚlenÚgroupsÚtail)rr   ry   Útag1Útag2Úel1Úel2s         rO   rz   zDoubleTagPattern.handleMatchÓ  so   € ð —X‘X—^‘^ CÓ(‰
ˆˆdÜ�m‰m˜DÓ!ˆÜ×Ñ˜s DÓ)ˆØ—7‘7˜1“:ˆŒÜˆq�x‰x‹z‹?˜aÒØ—w‘w˜q“zˆCŒHØˆ
rQ   NrÂ   r¨   rf   rQ   rO   rÜ   rÜ   Í  s   „ ñô
rQ   rÜ   c                  ó   — e Zd ZdZdd„Zy)ÚDoubleTagInlineProcessorrÝ   c                ój  — | j                   j                  d«      \  }}t        j                  |«      }t        j                  ||«      }|j                  d«      |_        t        |j                  «       «      dk(  r|j                  d«      |_	        ||j                  d«      |j                  d«      fS )z¬
        Return [`Element`][xml.etree.ElementTree.Element] in following format:
        `<tag1><tag2>group(2)</tag2>group(3)</tag2>` where `group(3)` is optional.

        rß   r¦   r½   r   )rº   râ   r¾   r¿   rã   rƒ   r“   rä   rå   ræ   r«   r¬   )rr   ry   r¡   rç   rè   ré   rê   s          rO   rz   z$DoubleTagInlineProcessor.handleMatchè  s‡   € ð —X‘X—^‘^ CÓ(‰
ˆˆdÜ�m‰m˜DÓ!ˆÜ×Ñ˜s DÓ)ˆØ—7‘7˜1“:ˆŒÜˆq�x‰x‹z‹?˜aÒØ—w‘w˜q“zˆCŒHØ�A—G‘G˜A“J §¡ a£Ð(Ð(rQ   NrÉ   r¨   rf   rQ   rO   rì   rì   â  s   „ ñô
)rQ   rì   c                  ó(   — e Zd ZdZdd„Zdd„Zdd„Zy)rE   z1 Store raw inline html and return a placeholder. c                óð   — | j                  | j                  |j                  d«      «      «      }| j                  j                  j                  |«      }||j                  d«      |j                  d«      fS )zL Store the text of `group(1)` of a pattern and return a placeholder string. r   r   )Úbackslash_unescaper”   rƒ   rL   Ú	htmlStashÚstorer«   r¬   )rr   ry   r¡   ÚrawhtmlÚplace_holders        rO   rz   zHtmlInlineProcessor.handleMatchù  sZ   € à×)Ñ)¨$¯-©-¸¿¹À»
Ó*CÓDˆØ—w‘w×(Ñ(×.Ñ.¨wÓ7ˆØ˜QŸW™W Q›Z¨¯©¨q«Ð1Ð1rQ   c                ó¾   ‡ ‡— 	 ‰ j                   j                  d   j                  Šdˆ ˆfd„}t        j
                  j                  ||«      S # t        $ r |cY S w xY w)r   r€   c                óÌ   •— | j                  d«      }‰j                  |«      }|�+	 ‰j                  ‰j                  j	                  |«      «      S y # t
        $ r d|z  cY S w xY w)Nr   z\%s)rƒ   r„   r”   rL   Ú
serializerÚ	Exception)ry   rˆ   r‰   rr   rŠ   s      €€rO   r‹   z/HtmlInlineProcessor.unescape.<locals>.get_stash  sf   ø€ Ø—‘˜“ˆBØ—I‘I˜b“MˆEØÐ ð*àŸ=™=¨¯©×);Ñ);¸EÓ)BÓCÐCð !øô !ò *Ø! E™>Ò)ð*ús   §)A ÁA#Á"A#r§   rŒ   r’   s   `  @rO   r”   zHtmlInlineProcessor.unescapeÿ  sX   ù€ ð	Ø—G‘G×*Ñ*¨8Ñ4×BÑBˆEö	*ô ×)Ñ)×-Ñ-¨i¸Ó>Ð>øô ò 	ØŠKð	ús   „#A ÁAÁAc                ó˜   — 	 | j                   j                  d   j                  }dd„}|j	                  ||«      S # t        $ r |cY S w xY w)zG Return text with backslash escapes undone (backslashes are restored). r”   c                óH   — t        t        | j                  d«      «      «      S )Nr   )ÚchrÚintrƒ   )ry   s    rO   Ú	_unescapez9HtmlInlineProcessor.backslash_unescape.<locals>._unescape  s   € Ü”s˜1Ÿ7™7 1›:“Ó'Ð'rQ   r§   )rL   r�   ÚREr�   r‘   )rr   r“   rþ   rý   s       rO   rð   z&HtmlInlineProcessor.backslash_unescape  sO   € ð	Ø—‘×'Ñ'¨
Ñ3×6Ñ6ˆBó	(ð �v‰v�i Ó&Ð&øô ò 	ØŠKð	ús   ‚#; »A	ÁA	Nr­   r™   )ra   rb   rc   rd   rz   r”   rð   rf   rQ   rO   rE   rE   ÷  s   „ Ù;ó2ó?ô&
'rQ   rE   c                  óD  — e Zd ZdZ e ej                  eej                  ej                  z  «      dd«       e ej                  e
ej                  ej                  z  «      dd«       e ej                  eej                  ej                  z  «      dd«       e ej                  eej                  ej                  z  «      dd«       e ej                  eej                  ej                  z  «      dd«      gZ	 dd	„Zdd
„Zdd„Z	 	 	 	 	 	 	 	 	 	 dd„Zdd„Zdd„Zy)rJ   zGEmphasis processor for handling strong and em matches inside asterisks.Údoubleú	strong,emú	em,strongÚdouble2ÚsingleÚstrongÚemc                óz   — t        j                  |«      }|j                  d«      }| j                  ||d|«       |S )zReturn single tag.r¦   N)r¾   r¿   rƒ   Úparse_sub_patterns)rr   ry   rº   Úidxré   r“   s         rO   Úbuild_singlezAsteriskProcessor.build_single+  s6   € ä�m‰m˜CÓ ˆØ�w‰w�q‹zˆØ×Ñ  c¨4°Ô5Øˆ
rQ   c                óp  — |j                  d«      \  }}t        j                  |«      }t        j                  |«      }|j                  d«      }| j	                  ||d|«       |j                  |«       t        |j                  «       «      dk(  r%|j                  d«      }| j	                  ||||«       |S )zReturn double tag.rß   r¦   Nr½   )râ   r¾   r¿   rƒ   r  Úappendrä   rå   ©	rr   ry   r`   r	  rç   rè   ré   rê   r“   s	            rO   Úbuild_doublezAsteriskProcessor.build_double2  s•   € ð —Z‘Z “_‰
ˆˆdÜ�m‰m˜DÓ!ˆÜ�m‰m˜DÓ!ˆØ�w‰w�q‹zˆØ×Ñ  c¨4°Ô5Ø�
‰
�3ŒÜˆq�x‰x‹z‹?˜aÒØ—7‘7˜1“:ˆDØ×#Ñ# D¨#¨s°CÔ8Øˆ
rQ   c                ó8  — |j                  d«      \  }}t        j                  |«      }t        j                  |«      }|j                  d«      }| j	                  ||d|«       |j                  d«      }|j                  |«       | j	                  ||d|«       |S )zFReturn double tags (variant 2): `<strong>text <em>text</em></strong>`.rß   r¦   Nr½   )râ   r¾   r¿   rƒ   r  r  r  s	            rO   Úbuild_double2zAsteriskProcessor.build_double2@  sƒ   € ð —Z‘Z “_‰
ˆˆdÜ�m‰m˜DÓ!ˆÜ�m‰m˜DÓ!ˆØ�w‰w�q‹zˆØ×Ñ  c¨4°Ô5Ø�w‰w�q‹zˆØ�
‰
�3ŒØ×Ñ  c¨4°Ô5Øˆ
rQ   c                ó2  — d}d}t        |«      }||k  rê| j                  j                  ||«      rÃd}t        | j                  «      D ]¡  \  }	}
|	|k  rŒ|
j
                  j                  ||«      }|sŒ+|||j                  d«       }|r|�||_        n||_        | j                  ||
j                  |
j                  |	«      }|j                  |«       |}|j                  d«      x}}d}Œ£ |s|dz  }n|dz  }||k  rŒê||d }|r|�||_        y||_        yy)a/  
        Parses sub patterns.

        `data`: text to evaluate.

        `parent`: Parent to attach text and sub elements to.

        `last`: Last appended child to parent. Can also be None if parent has no children.

        `idx`: Current pattern index that was used to evaluate the parent.
        r   FNTr   )rä   rj   ÚmatchÚ	enumerateÚPATTERNSr]   r«   ræ   r“   Úbuild_elementr_   r`   r  r¬   )rr   r¡   ÚparentÚlastr	  ÚoffsetÚposÚlengthÚmatchedÚindexÚitemry   r“   rÀ   s                 rO   r  z$AsteriskProcessor.parse_sub_patternsM  s3  € ð ˆØˆä�T“ˆØ�FŠlà×Ñ×%Ñ% d¨CÔ0Ø�ä#,¨T¯]©]Ö#;‘K�E˜4à ’|Ø ØŸ™×*Ñ*¨4°Ó5�AÚð
  $ F¨1¯7©7°1«:Ð6˜ÙØ#Ð/Ø,0 ¥	à.2 ¤Ø!×/Ñ/°°4·<±<ÀÇÁÈEÓR˜ØŸ™ bÔ)Ø!˜à'(§u¡u¨Q£xÐ/˜ Ø"&™ð+ $<ñ, à˜1‘H‘Cð �q‘�ðA �F‹lðF �F�Gˆ}ˆÙØÐØ �•	à"�•ð	 rQ   c                óˆ   — |dk(  r| j                  |||«      S |dk(  r| j                  |||«      S | j                  |||«      S )zElement builder.r  r   )r  r  r
  )rr   ry   r_   r`   r  s        rO   r  zAsteriskProcessor.build_elementŠ  sS   € ð �iÒØ×%Ñ% a¨¨uÓ5Ð5Ø˜Ò Ø×$Ñ$ Q¨¨eÓ4Ð4à×$Ñ$ Q¨¨eÓ4Ð4rQ   c                óD  — d}d}d}t        | j                  «      D ]~  \  }}|j                  j                  ||j	                  d«      «      }|sŒ4|j	                  d«      }|j                  d«      }| j                  ||j                  |j                  |«      } n |||fS )zParse patterns.Nr   )	r  r  r]   r  r«   r¬   r  r_   r`   )	rr   ry   r¡   rÀ   r«   r¬   r  r  Úm1s	            rO   rz   zAsteriskProcessor.handleMatch”  s”   € ð ˆØˆØˆä$ T§]¡]Ö3‰KˆE�4Ø—‘×#Ñ# D¨!¯'©'°!«*Ó5ˆBÚØŸ™ ›�Ø—f‘f˜Q“i�Ø×'Ñ'¨¨D¯L©L¸$¿)¹)ÀUÓK�Ùð 4ð �5˜#ˆ~ÐrQ   N)ry   r˜   rº   r^   r	  rü   r—   rÃ   )ry   r˜   r`   r^   r	  rü   r—   rÃ   )
r¡   r^   r  rÃ   r  zetree.Element | Noner	  rü   r—   ÚNone)
ry   r˜   r_   r^   r`   r^   r  rü   r—   rÃ   ©ry   r˜   r¡   r^   r—   z3tuple[etree.Element | None, int | None, int | None])ra   rb   rc   rd   r[   rm   rn   ÚEM_STRONG_REro   rp   ÚSTRONG_EM_REÚSTRONG_EM3_REÚ	STRONG_REÚEMPHASIS_REr  r
  r  r  r  r  rz   rf   rQ   rO   rJ   rJ     s  „ ÙQñ 	�Z�R—Z‘Z ¨b¯i©i¸"¿*¹*Ñ.DÓEÀxÐQ\Ó]Ù�Z�R—Z‘Z ¨b¯i©i¸"¿*¹*Ñ.DÓEÀxÐQ\Ó]Ù�Z�R—Z‘Z ¨r¯y©y¸2¿:¹:Ñ/EÓFÈ	ÐS^Ó_Ù�Z�R—Z‘Z 	¨2¯9©9°r·z±zÑ+AÓBÀHÈhÓWÙ�Z�R—Z‘Z ¨R¯Y©Y¸¿¹Ñ-CÓDÀhÐPTÓUð€Hð Póóóð;#Øð;#Ø!.ð;#Ø6Jð;#ØQTð;#à	ó;#óz5ôrQ   rJ   c                  óþ  — e Zd ZdZ e ej                  eej                  ej                  z  «      dd«       e ej                  e
ej                  ej                  z  «      dd«       e ej                  eej                  ej                  z  «      dd«       e ej                  eej                  ej                  z  «      dd«       e ej                  eej                  ej                  z  «      dd«      gZy	)
rK   zIEmphasis processor for handling strong and em matches inside underscores.r   r  r  r  r  r  r  N)ra   rb   rc   rd   r[   rm   rn   ÚEM_STRONG2_REro   rp   ÚSTRONG_EM2_REÚSMART_STRONG_EM_REÚSMART_STRONG_REÚSMART_EMPHASIS_REr  rf   rQ   rO   rK   rK   ¥  sÙ   „ ÙSñ 	�Z�R—Z‘Z ¨r¯y©y¸2¿:¹:Ñ/EÓFÈÐR]Ó^Ù�Z�R—Z‘Z ¨r¯y©y¸2¿:¹:Ñ/EÓFÈÐR]Ó^Ù�Z�R—Z‘ZÐ 2°B·I±IÀÇ
Á
Ñ4JÓKÈYÐXcÓdÙ�Z�R—Z‘Z °·±¸R¿Z¹ZÑ1GÓHÈ(ÐT\Ó]Ù�Z�R—Z‘ZÐ 1°2·9±9¸r¿z¹zÑ3IÓJÈHÐVZÓ[ð€Hð PrQ   rK   c                  ó    — e Zd ZdZ ej
                  dej                  ej                  z  «      Z ej
                  d«      Z	dd„Z
d	d„Zd
d„Zy)r7   z- Return a link element from the given match. z2\(\s*(?:(<[^<>]*>)\s*(?:('[^']*'|"[^"]*")\s*)?\))?z\sc                ó2  — | j                  ||j                  d«      «      \  }}}|sy| j                  ||«      \  }}}}|syt        j                  d«      }||_        |j                  d|«       |�|j                  d|«       ||j                  d«      |fS )zS Return an `a` [`Element`][xml.etree.ElementTree.Element] or `(None, None, None)`. r   ©NNNÚaÚhrefÚtitle)ÚgetTextr¬   ÚgetLinkr¾   r¿   r“   Úsetr«   )	rr   ry   r¡   r“   r  Úhandledr2  r3  rÀ   s	            rO   rz   zLinkInlineProcessor.handleMatch·  s’   € à#Ÿ|™|¨D°!·%±%¸³(Ó;Ñˆˆe�WáØ#à&*§l¡l°4¸Ó&?Ñ#ˆˆe�U˜GÙØ#ä�]‰]˜3ÓˆØˆŒà
�‰ˆv�tÔàÐØ�F‰F�7˜EÔ"à�1—7‘7˜1“:˜uÐ$Ð$rQ   c           	     ó¾  — d}d}d}| j                   j                  ||¬«      }|rm|j                  d«      r\|j                  d«      dd j                  «       }|j                  d«      r|j                  d«      dd }|j	                  d«      }d	}�nc|�r`d}d}|j	                  «       }	|	}d}
d}d}d}d}d}d}d}d}t        |t        |«      «      D �]  }||   }|d
k(  r|s|dz  }n~|dkD  ry|dz  }ns|dk(  r4|dk7  r||k(  s
|dk7  r||k(  rd}nW|s|dz  }nO|dkD  rJ|dz  }|dk(  r@|dz   }
n:|dv r6|sd	}|}d}|dz   }|}n&||k7  r
|s|dz   }|}n||k(  r|dz   }n|r
||k(  r|dz   }|dz  }|dk(  r^|dk\  r%||k(  r ||	|dz
   }dj                  |||dz
   «      }n2|dk\  r%||k(  r ||	|dz
   }dj                  |||dz
   «      }n||	|dz
   } n|dk7  s�Œ|}�Œ |dk7  r|dk(  r||	|
dz
   }|
}d}|dk(  }|�B| j                  j                  dt        | j                  |j                  «       «      «      «      }| j                  |«      j                  «       }||||fS )z?Parse data between `()` of `[Text]()` allowing recursive `()`. r‚   NF©r  r   rU   r¦   r   TÚ(Ú))rT   rS   Ú )ÚRE_LINKr  rƒ   rÙ   r¬   Úrangerä   r†   ÚRE_TITLE_CLEANr‘   rY   r”   )rr   r¡   r  r2  r3  r7  ry   Úbracket_countÚbacktrack_countÚstart_indexÚlast_bracketÚquoteÚstart_quoteÚ
exit_quoteÚignore_matchesÚ	alt_quoteÚstart_alt_quoteÚexit_alt_quoter  r  Úcs                        rO   r5  zLinkInlineProcessor.getLinkÌ  s  € ð ˆØ ˆØˆà�L‰L×Ñ˜t¨ÐÓ/ˆÙ�—‘˜”à—7‘7˜1“:˜a Ð#×)Ñ)Ó+ˆDØ�w‰w�qŒzØŸ™ ›
 1 RÐ(�Ø—E‘E˜!“HˆEØŠGÚàˆMØˆOØŸ%™%›'ˆKØˆEØˆLð !%ˆEØˆKØˆJØ"ˆNð ˆIØ ˆOØˆNð ˆDä˜U¤C¨£I×.�Ø˜‘I�Ø˜’8ñ *Ø%¨Ñ*™Ø(¨1Ò,Ø'¨1Ñ,™Ø˜#’Xð $ rÒ)¨e°tªmÀÐSUÒAUÐZcÐgkÒZkØ()™Ù+Ø%¨Ñ*™Ø(¨1Ò,Ø'¨1Ñ,˜à*¨aÒ/Ø+0°1©9™Là˜*‘_á ð *.˜Ø*7˜Ø()˜Ø&+¨a¡i˜Ø !™à˜eš©IØ*/°!©)˜Ø$%™	à˜ešØ%*¨Q¡Y™
á" q¨I¢~Ø).°©˜à˜‘
�ð ! AÒ%à! Q’¨5°Dª=Ø# K°¸a±Ð@˜Ø "§¡¨¨[¸Àa¹Ð(HÓ I™Ø'¨1Ò,°¸dÒ1BØ# K°À!Ñ0CÐD˜Ø "§¡¨¨_¸^ÈaÑ=OÐ(PÓ Q™à# K°¸±	Ð:˜Ùà˜”8Ø’Dðw /ðB  Ò! o¸Ò&:Ø˜K¨°qÑ(8Ð9�Ø$�Ø !�à# qÑ(ˆGàÐØ×'Ñ'×+Ñ+¨C´¸¿¹ÀuÇ{Á{Ã}Ó9UÓ1VÓWˆEà�}‰}˜TÓ"×(Ñ(Ó*ˆà�U˜E 7Ð*Ð*rQ   c                óÚ   — d}g }t        |t        |«      «      D ]9  }||   }|dk(  r|dz  }n
|dk(  r|dz  }|dz  }|dk(  r n|j                  |«       Œ; dj                  |«      ||dk(  fS )zsParse the content between `[]` of the start of an image or link
        resolving nested square brackets.

        r   Ú]Ú[r   r‚   )r>  rä   r  r†   )rr   r¡   r  r@  r“   r  rK  s          rO   r4  zLinkInlineProcessor.getText@  s‰   € ð
 ˆØˆÜ˜¤ D£	Ö*ˆCØ�S‘	ˆAØ�CŠxØ Ñ"‘Ø�c’Ø Ñ"�Ø�Q‰JˆEØ Ò!ÙØ�K‰K˜�Nð +ð �w‰w�t‹}˜e ]°aÑ%7Ð7Ð7rQ   Nr"  )r¡   r^   r  rü   r—   z!tuple[str, str | None, int, bool])r¡   r^   r  rü   r—   útuple[str, int, bool])ra   rb   rc   rd   rm   rn   ro   rp   r=  r?  rz   r5  r4  rf   rQ   rO   r7   r7   ²  sL   „ Ù7Øˆb�j‰jÐRÐTV×T]ÑT]Ð`b×`jÑ`jÑTjÓk€GØ�R—Z‘Z Ó&€Nó%ó*r+ôh8rQ   r7   c                  ó   — e Zd ZdZdd„Zy)r9   z. Return a `img` element from the given match. c                óf  — | j                  ||j                  d«      «      \  }}}|sy| j                  ||«      \  }}}}|syt        j                  d«      }|j                  d|«       |�|j                  d|«       |j                  d| j                  |«      «       ||j                  d«      |fS )zU Return an `img` [`Element`][xml.etree.ElementTree.Element] or `(None, None, None)`. r   r0  ÚimgÚsrcr3  Úalt)r4  r¬   r5  r¾   r¿   r6  r”   r«   )	rr   ry   r¡   r“   r  r7  rS  r3  rÀ   s	            rO   rz   z ImageInlineProcessor.handleMatchW  s¢   € à#Ÿ|™|¨D°!·%±%¸³(Ó;Ñˆˆe�WÙØ#à%)§\¡\°$¸Ó%>Ñ"ˆˆU�E˜7ÙØ#ä�]‰]˜5Ó!ˆà
�‰ˆu�cÔàÐØ�F‰F�7˜EÔ"à
�‰ˆu�d—m‘m DÓ)Ô*Ø�1—7‘7˜1“:˜uÐ$Ð$rQ   Nr"  r¨   rf   rQ   rO   r9   r9   T  s
   „ Ù8ô%rQ   r9   c                  ó¶   — e Zd ZdZ ej
                  dej                  «      Z ej
                  dej                  ej                  z  «      Z
dd„Zd	d„Zd
d„Zy)r5   z6 Match to a stored reference and return link element. z\s+z\s?\[([^\]]*)\]c                ó˜  — | j                  ||j                  d«      «      \  }}}|sy| j                  |||«      \  }}}|sy| j                  j	                  d|«      }|| j
                  j                  vrd|j                  d«      |fS | j
                  j                  |   \  }}	| j                  ||	|«      |j                  d«      |fS )zz
        Return [`Element`][xml.etree.ElementTree.Element] returned by `makeTag` method or `(None, None, None)`.

        r   r0  r<  N)	r4  r¬   ÚevalIdÚNEWLINE_CLEANUP_REr‘   rL   Ú
referencesr«   ÚmakeTag)
rr   ry   r¡   r“   r  r7  rˆ   r¬   r2  r3  s
             rO   rz   z$ReferenceInlineProcessor.handleMatchr  sÃ   € ð
  $Ÿ|™|¨D°!·%±%¸³(Ó;Ñˆˆe�WÙØ#àŸ;™; t¨U°DÓ9ÑˆˆC�ÙØ#ð ×$Ñ$×(Ñ(¨¨bÓ1ˆØ�T—W‘W×'Ñ'Ñ'Ø˜Ÿ™ › SÐ(Ð(à—g‘g×(Ñ(¨Ñ,‰ˆˆeà�|‰|˜D %¨Ó.°·±¸³
¸CÐ?Ð?rQ   c                óØ   — | j                   j                  ||¬«      }|sd|dfS |j                  d«      j                  «       }|j	                  d«      }|s|j                  «       }||dfS )z\
        Evaluate the id portion of `[ref][id]`.

        If `[ref][]` use `[ref]`.
        r9  NFr   r   T)r=  r  rƒ   Úlowerr¬   )rr   r¡   r  r“   ry   rˆ   r¬   s          rO   rW  zReferenceInlineProcessor.evalIdˆ  sj   € ð �L‰L×Ñ˜t¨ÐÓ/ˆÙØ˜ Ð%Ð%à—‘˜“×!Ñ!Ó#ˆBØ—%‘%˜“(ˆCÙØ—Z‘Z“\�Ø�3˜ˆ}ÐrQ   c                óŠ   — t        j                  d«      }|j                  d|«       |r|j                  d|«       ||_        |S )z; Return an `a` [`Element`][xml.etree.ElementTree.Element]. r1  r2  r3  )r¾   r¿   r6  r“   ©rr   r2  r3  r“   rÀ   s        rO   rZ  z ReferenceInlineProcessor.makeTag˜  s;   € ä�]‰]˜3Óˆà
�‰ˆv�tÔÙØ�F‰F�7˜EÔ"àˆŒØˆ	rQ   Nr"  )r¡   r^   r  rü   r“   r^   r—   ztuple[str | None, int, bool]©r2  r^   r3  r^   r“   r^   r—   rÃ   )ra   rb   rc   rd   rm   rn   Ú	MULTILINErX  ro   rp   r=  rz   rW  rZ  rf   rQ   rO   r5   r5   l  sL   „ Ù@Ø#˜Ÿ™ F¨B¯L©LÓ9Ðàˆb�j‰jÐ+¨R¯Y©Y¸¿¹Ñ-CÓD€Gó@ó,ô 	rQ   r5   c                  ó   — e Zd ZdZdd„Zy)r=   z%Short form of reference: `[google]`. c                ó(   — |j                  «       |dfS ©zEvaluate the id of `[ref]`.  T©r\  ©rr   r¡   r  r“   s       rO   rW  z$ShortReferenceInlineProcessor.evalId¦  ó   € ð �z‰z‹|˜U DÐ(Ð(rQ   N©r¡   r^   r  rü   r“   r^   r—   rO  ©ra   rb   rc   rd   rW  rf   rQ   rO   r=   r=   ¤  s
   „ Ù/ô)rQ   r=   c                  ó   — e Zd ZdZdd„Zy)r;   z7 Match to a stored reference and return `img` element. c                ó¾   — t        j                  d«      }|j                  d|«       |r|j                  d|«       |j                  d| j                  |«      «       |S )z= Return an `img` [`Element`][xml.etree.ElementTree.Element]. rR  rS  r3  rT  )r¾   r¿   r6  r”   r^  s        rO   rZ  z%ImageReferenceInlineProcessor.makeTag®  sK   € ä�]‰]˜5Ó!ˆØ
�‰ˆu�dÔÙØ�F‰F�7˜EÔ"Ø
�‰ˆu�d—m‘m DÓ)Ô*Øˆ	rQ   Nr_  )ra   rb   rc   rd   rZ  rf   rQ   rO   r;   r;   ¬  s
   „ ÙAôrQ   r;   c                  ó   — e Zd ZdZdd„Zy)r>   z* Short form of image reference: `![ref]`. c                ó(   — |j                  «       |dfS rc  rd  re  s       rO   rW  z)ShortImageReferenceInlineProcessor.evalIdº  rf  rQ   Nrg  rh  rf   rQ   rO   r>   r>   ¸  s
   „ Ù4ô)rQ   r>   c                  ó   — e Zd ZdZdd„Zy)r?   zD Return a link Element given an auto-link (`<http://example/com>`). c                ó$  — t        j                  d«      }|j                  d| j                  |j	                  d«      «      «       t        j                  |j	                  d«      «      |_        ||j                  d«      |j                  d«      fS )zI Return an `a` [`Element`][xml.etree.ElementTree.Element] of `group(1)`. r1  r2  r   r   )
r¾   r¿   r6  r”   rƒ   r   r×   r“   r«   r¬   rÈ   s       rO   rz   z#AutolinkInlineProcessor.handleMatchÂ  sf   € ä�]‰]˜3ÓˆØ
�‰ˆv�t—}‘} Q§W¡W¨Q£ZÓ0Ô1Ü×#Ñ# A§G¡G¨A£JÓ/ˆŒØ�1—7‘7˜1“:˜qŸu™u Q›xÐ'Ð'rQ   NrÉ   r¨   rf   rQ   rO   r?   r?   À  s
   „ ÙNô(rQ   r?   c                  ó   — e Zd ZdZdd„Zy)rA   zW
    Return a `mailto` link Element given an auto-mail link (`<foo@example.com>`).
    c           
     ó@  — t        j                  d«      }| j                  |j                  d«      «      }|j	                  d«      r|t        d«      d }d
d„}|D �cg c]  } |t        |«      «      ‘Œ }}t        j                  dj                  |«      «      |_
        d|z   }dj                  |D �cg c]!  }t        j                  dt        |«      z  z   ‘Œ# c}«      }|j                  d|«       ||j                  d	«      |j                  d	«      fS c c}w c c}w )za Return an [`Element`][xml.etree.ElementTree.Element] containing a `mailto` link  of `group(1)`. r1  r   zmailto:Nc                ó®   — t         j                  j                  | «      }|r dj                  t        j
                  |«      S dt        j
                  | fz  S )z=Return entity definition by code, or the code if not defined.z{}{};z%s#%d;)r
   Úcodepoint2namer„   r²   r   ÚAMP_SUBSTITUTE)rÔ   r&   s     rO   rr  z;AutomailInlineProcessor.handleMatch.<locals>.codepoint2nameÕ  sH   € ä×,Ñ,×0Ñ0°Ó6ˆFÙØ—~‘~¤d×&9Ñ&9¸6ÓBÐBà¤4×#6Ñ#6¸Ð"=Ñ=Ð=rQ   r‚   z#%d;r2  r   )rÔ   rü   r—   r^   )r¾   r¿   r”   rƒ   rV   rä   r´   r   r×   r†   r“   rs  r6  r«   r¬   )	rr   ry   r¡   rÀ   Úemailrr  ÚletterÚlettersÚmailtos	            rO   rz   z#AutomailInlineProcessor.handleMatchÎ  s  € ä�]‰]˜3ÓˆØ—‘˜aŸg™g a›jÓ)ˆØ×Ñ˜IÔ&Øœ#˜i›.˜/Ð*ˆEó	>ñ >CÓC¹U°6‘>¤# f£+Õ.¸UˆÐCÜ×#Ñ# B§G¡G¨GÓ$4Ó5ˆŒà˜UÑ"ˆØ—‘Ù4:ó<Ù4:¨&ô ×-Ñ-°Ü˜f›+ñ1&ó &Ø4:ñ<ó =ˆà
�‰ˆv�vÔØ�1—7‘7˜1“:˜qŸu™u Q›xÐ'Ð'ùò Dùò<s   ÁDÂ4&DNrÉ   r¨   rf   rQ   rO   rA   rA   Ê  s   „ ñô(rQ   rA   )rL   r   rM   r   r—   zutil.Registry[InlineProcessor])rX   r^   r—   r^   )Crd   Ú
__future__r   r‚   r   Útypingr   r   r   r	   rm   Úxml.etree.ElementTreer¾   ÚElementTreer$   r
   Úmarkdownr   rP   ÚNOIMGr2   r4   r'  r&  r,  r-  r+  r#  r)  r$  r*  r%  r8   r:   r6   r<   rI   r@   rB   rF   rG   rD   rY   r[   rh   rœ   r¤   rH   r3   r¸   rÅ   rË   rC   r1   rÜ   rì   rE   rJ   rK   r7   r9   r5   r=   r;   r>   r?   rA   rf   rQ   rO   Ú<module>r~     s5  ðñ(õ* #å ß =Ó =Û 	ß %Ð %Ý áÝ!ó*ð` 	€Ø \àL€Ø Mà€	Ø =à€Ø 7à€	Ø 5à:€Ø bà9Ð Ø càOÐ Ø Bà,€Ø Sà,€Ø Và,€Ø ?à,€Ø Bà9€Ø ?à
�%‰-€Ø `à€Ø Sà€Ø 5à"Ð Ø :à8€Ø 'à<€Ø =à&€Ø ;ð
ð ð %à<€	Ø Và€Ø (óô�:ô ÷S?ñ S?ôl-�gô -ô`˜ô ô0 ô 0ô.˜Oô .ô&�wô ô:(˜ô (ô:'Ð+ô 'ô=Ð#;ô =ôY˜oô Yô2Ð'ô ô*)Ð7ô )ô*%'˜/ô %'ôPC˜ô CôL
PÐ+ô 
Pô_8˜/ô _8ôD%Ð.ô %ô05Ð2ô 5ôp)Ð$<ô )ô	Ð$<ô 	ô)Ð)Fô )ô(˜oô (ô(˜oõ (rQ   