ó
    Ð]jí  ã                  ó„   • S SK Jr  S SKJrJr  S SKrS SKJrJ	r	  S SK
r
S
S jr\R                  " SS9 " S S	5      5       rg)é    )Úannotations)ÚCallableÚMutableMappingN)ÚAnyÚLiteralc                óX   • U (       d  0 $ [        U [        5      (       a  [        U 5      $ U $ )z‚Convert Token.attrs set as ``None`` or ``[[key, value], ...]`` to a dict.

This improves compatibility with upstream markdown-it.
)Ú
isinstanceÚlistÚdict)Úvalues    ÚN/home/mande/repo/quber/.venv/lib/python3.13/site-packages/markdown_it/token.pyÚconvert_attrsr   	   s(   € ö
 Øˆ	Ü�%œ×ÑÜ�E‹{ÐØ€Ló    T)Úslotsc                  ó¦  • \ rS rSr% S\S'    S\S'    S\S'    \R                  " \S9rS\S	'    S
r	S\S'    Sr
S\S'    S
rS\S'    SrS\S'    SrS\S'    SrS\S'    \R                  " \S9rS\S'    SrS\S'    SrS\S'    S)S jrS*S jrS+S jrS,S jrS-S  jrS.S! jrS/S" jrS0S# jrS$S$S
S
\S%.           S1S& jjr\S2S' j5       rS(rg
)3ÚTokené   ÚstrÚtypeÚtagzLiteral[-1, 0, 1]Únesting)Údefault_factoryzdict[str, str | int | float]ÚattrsNzlist[int] | NoneÚmapr   ÚintÚlevelzlist[Token] | NoneÚchildrenÚ ÚcontentÚmarkupÚinfozdict[Any, Any]ÚmetaFÚboolÚblockÚhiddenc                ó8   • [        U R                  5      U l        g ©N)r   r   ©Úselfs    r   Ú__post_init__ÚToken.__post_init__M   s   € Ü" 4§:¡:Ó.ˆ�
r   c                ó¼   • [         R                  " S[        5        XR                  ;  a  g[	        U R                  R                  5       5      R                  U5      $ )NzEToken.attrIndex should not be used, since Token.attrs is a dictionaryéÿÿÿÿ)ÚwarningsÚwarnÚUserWarningr   r
   ÚkeysÚindex©r)   Únames     r   Ú	attrIndexÚToken.attrIndexP   sD   € Ü�ŠØSÜô	
ð —z‘zÓ!ØÜ�D—J‘J—O‘OÓ%Ó&×,Ñ,¨TÓ2Ð2r   c                óH   • [        U R                  R                  5       5      $ )zGet (key, value) list of attrs.)r
   r   Úitemsr(   s    r   Ú	attrItemsÚToken.attrItemsY   s   € ä�D—J‘J×$Ñ$Ó&Ó'Ð'r   c                ó.   • Uu  p#U R                  X#5        g)zAAdd `[ name, value ]` attribute to list. Init attrs if necessary.N)ÚattrSet)r)   ÚattrDatar4   r   s       r   ÚattrPushÚToken.attrPush]   s   € à‰ˆØ�‰�TÕ!r   c                ó    • X R                   U'   g)z>Set `name` attribute to `value`. Override old value if exists.N©r   )r)   r4   r   s      r   r<   ÚToken.attrSetb   s   € à �
‰
�4Òr   c                ó:   • U R                   R                  US5      $ )z@Get the value of attribute `name`, or null if it does not exist.N)r   Úgetr3   s     r   ÚattrGetÚToken.attrGetf   s   € à�z‰z�~‰~˜d DÓ)Ð)r   c                óæ   • XR                   ;   aT  U R                   U   n[        U[        5      (       d  [        SU R                   U    35      eU SU 3U R                   U'   gX R                   U'   g)zyJoin value to existing attribute via space.
Or create new attribute if not exists.
Useful to operate with token classes.
z#existing attr 'name' is not a str: Ú N)r   r	   r   Ú	TypeError)r)   r4   r   Úcurrents       r   ÚattrJoinÚToken.attrJoinj   sq   € ð
 —:‘:ÓØ—j‘j Ñ&ˆGÜ˜g¤s×+Ñ+ÜØ9¸$¿*¹*ÀTÑ:JÐ9KÐLóð ð #* ¨!¨E¨7Ð3ˆD�J‰J�tÒà$�J‰J�tÒr   c                ó0   • [         R                  " U 40 UD6$ )z&Return a shallow copy of the instance.)ÚdcÚreplace)r)   Úchangess     r   ÚcopyÚ
Token.copyy   s   € ä�zŠz˜$Ñ* 'Ñ*Ð*r   T)r   Úas_upstreamÚmeta_serializerÚfilterÚdict_factoryc               ó
  ^ ^• U" U 4S j[         R                  " T 5       5       5      nT(       a   U" U4S jUR                  5        5       5      nU(       a>  SU;   a8  US   (       d  SO(US   R                  5        VVs/ s H  u  pxXx/PM
     snnUS'   U(       a  SU;   a  U" US   5      US'   U(       aA  UR                  SS5      (       a*  US    V	s/ s H  n	U	R	                  UTUUUS9PM     sn	US'   U$ s  snnf s  sn	f )a’  Return the token as a dictionary.

:param children: Also convert children to dicts
:param as_upstream: Ensure the output dictionary is equal to that created by markdown-it
    For example, attrs are converted to null or lists
:param meta_serializer: hook for serializing ``Token.meta``
:param filter: A callable whose return code determines whether an
    attribute or element is included (``True``) or dropped (``False``).
    Is called with the (key, value) pair.
:param dict_factory: A callable to produce dictionaries from.
    For example, to produce ordered dictionaries instead of normal Python
    dictionaries, pass in ``collections.OrderedDict``.

c              3  óf   >#   • U  H&  oR                   [        TUR                   5      4v •  M(     g 7fr'   )r4   Úgetattr)Ú.0Úfr)   s     €r   Ú	<genexpr>Ú Token.as_dict.<locals>.<genexpr>”   s#   øé € ÐXÊÀ1§¡¬°°a·f±fÓ(=Õ>Êùs   ƒ.1c              3  óL   >#   • U  H  u  pT" X5      (       d  M  X4v •  M     g 7fr'   © )rZ   ÚkÚvrU   s      €r   r\   r]   –   s   øé € Ð"V²o©d¨aÉÐPQÏ£6 A¥6²oùs   ƒ$š
$r   Nr"   r   )r   rU   rV   rS   rT   )rN   Úfieldsr8   rD   Úas_dict)
r)   r   rS   rT   rU   rV   Úmappingr`   ra   Úchilds
   `   `     r   rc   ÚToken.as_dict}   s  ù€ ñ. ÔXÌÏ	Ê	ÐRVÌÓXÓXˆÞÙ"Ô"V°g·m±m´oÓ"VÓVˆGÞ˜7 gÓ-ð ˜w×'ñ à)0°Ñ)9×)?Ñ)?Ô)AÔBÒ)A¡ �q“fÑ)AÒBð �GÑö
 ˜v¨Ó0Ù-¨g°f©oÓ>ˆG�F‰OÞ˜Ÿ™ J°×5Ñ5ð % ZÒ0ó	#ò 1�Eð —‘Ø%Ø!Ø!-Ø +Ø$3ð ó ñ 1ñ	#ˆG�JÑð ˆùó Cùò
	#s   Á?C:ÃD c                ó¢   • U " S0 UD6nUR                   (       a0  UR                    Vs/ s H  o0R                  U5      PM     snUl         U$ s  snf )zConvert a dict to a Token.r_   )r   Ú	from_dict)ÚclsÚdctÚtokenÚcs       r   rh   ÚToken.from_dict¬   sB   € ñ ‘
�c‘
ˆØ�>�>Ø8=¿ºÓGº°1Ÿm™m¨AÖ.¹ÑGˆEŒNØˆùò Hs   ¨ArA   )ÚreturnÚNone)r4   r   rn   r   )rn   z#list[tuple[str, str | int | float]])r=   ztuple[str, str | int | float]rn   ro   )r4   r   r   zstr | int | floatrn   ro   )r4   r   rn   zNone | str | int | float)r4   r   r   r   rn   ro   )rP   r   rn   r   )r   r#   rS   r#   rT   z&Callable[[dict[Any, Any]], Any] | NonerU   z!Callable[[str, Any], bool] | NonerV   z'Callable[..., MutableMapping[str, Any]]rn   úMutableMapping[str, Any])rj   rp   rn   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__rN   Úfieldr   r   r   r   r   r   r    r!   r"   r$   r%   r*   r5   r9   r>   r<   rE   rK   rQ   rc   Úclassmethodrh   Ú__static_attributes__r_   r   r   r   r      sR  ‡ à
ƒIØ;à	ƒHØ!àÓðð +-¯(ª(À4Ñ*H€EÐ'ÓHðð
 !€CÐ	Ó Ø=à€Eˆ3ƒNØ2à#'€HÐ Ó'Ø7à€GˆSÓØUà€FˆCÓØ?à€Dˆ#ƒNðð Ÿ8š8°DÑ9€Dˆ.Ó9Ø9à€Eˆ4Óðð €FˆDÓðô/ô3ô(ô"ô
!ô*ô%ô+ð Ø ØBFØ48Ø@Dñ-ð ð-ð ð	-ð
 @ð-ð 2ð-ð >ð-ð 
"õ-ð^ óó ór   r   )r   r   rn   r   )Ú
__future__r   Úcollections.abcr   r   ÚdataclassesrN   Útypingr   r   r.   r   Ú	dataclassr   r_   r   r   Ú<module>r~      s>   ðÝ "ç 4Û ß Û ô	ð ‡‚�DÑ÷\ð \ó ñ\r   