+
    NV-jf+  ã                  ó�   € R t ^ RIHt ^ RIHtHt ^ RIt^ RIHtH	t	H
t
Ht ^RIHt  ! R R]	4      t]
! RR	R
7      t ! R R	4      tR# )zyA tree representation of a linear markdown-it token stream.

This module is not part of upstream JavaScript markdown-it.
)Úannotations)Ú	GeneratorÚSequenceN)ÚAnyÚ
NamedTupleÚTypeVarÚoverload)ÚTokenc                  ó,   € ] tR t^t$ R]R&   R]R&   RtR# )Ú_NesterTokensr	   ÚopeningÚclosing© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__Ú__static_attributes__r   ó    Úa/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/markdown_it/tree.pyr   r      s   ‡ ØƒNØ‡Nr   r   Ú	_NodeTypeÚSyntaxTreeNode)Úboundc                  óÂ  € ] tR t^tRtRKRR/R R llltR R lt]R R	 l4       t]R
 R l4       tR R ltR R lt	]
R R l4       t]P                  R R l4       t]
R R l4       t]P                  R R l4       t]
R R l4       t]
R R l4       t]
R R l4       t]
R R l4       t]
R  R! l4       t]
R" R# l4       tR$ R% ltR& R' ltR(^R)R*R+^ /R, R- lltR.R/R/ R0 lltR1 R2 lt]
R3 R4 l4       t]
R5 R6 l4       tR7 R8 lt]
R9 R: l4       t]
R; R< l4       t]
R= R> l4       t]
R? R@ l4       t]
RA RB l4       t ]
RC RD l4       t!]
RE RF l4       t"]
RG RH l4       t#RIt$RJ# )Lr   aE  A Markdown syntax tree node.

A class that can be used to construct a tree representation of a linear
`markdown-it-py` token stream.

Each node in the tree represents either:
  - root of the Markdown document
  - a single unnested `Token`
  - a `Token` "_open" and "_close" token pair, and the tokens nested in
      between
Úcreate_rootTc               ó$   € V ^8„  d   QhRRRRRR/# )é   ÚtokensúSequence[Token]r   ÚboolÚreturnÚNoner   )Úformats   "r   Ú__annotate__ÚSyntaxTreeNode.__annotate__$   s$   € ÷ (9ñ (9Ø%ð(9Ø<@ð(9à	ñ(9r   c               óÚ  € RV n         RV n        RV n        . V n        V'       d   V P	                  V4       R# V'       g   \        R4      h\        V4      ^8X  d^   V^ ,          pVP                  '       d   \        R4      hW0n         VP                  '       d   V P	                  VP                  4       R# R# \        V^ ,          VR,          4      V n        V P	                  V^R 4       R# )zsInitialize a `SyntaxTreeNode` from a token stream.

If `create_root` is True, create a root node for the document.
NzGCan only create root from empty token sequence. Set `create_root=True`.z;Unequal nesting level at the start and end of token stream.éÿÿÿÿ)
ÚtokenÚnester_tokensÚ_parentÚ	_childrenÚ_set_children_from_tokensÚ
ValueErrorÚlenÚnestingÚchildrenr   )Úselfr   r   Úinline_tokens   &&$ r   Ú__init__ÚSyntaxTreeNode.__init__$   sÜ   € ð $(ˆŒ
ð 48ˆÔð !ˆŒð %'ˆŒçØ×*Ñ*¨6Ô2ÙçÜð+óð ô �‹[˜AÔØ! !�9ˆLØ×#×#Ð#Ü ØQóð ð &ŒJØ×$×$Ð$Ø×.Ñ.¨|×/DÑ/DÖEñ %ô "/¨v°a­y¸&À½*Ó!EˆDÔØ×*Ñ*¨6°!°B¨<Ö8r   c               ó   € V ^8„  d   QhRR/# ©r   r!   Ústrr   )r#   s   "r   r$   r%   N   s   € ÷ 5ñ 5˜#ñ 5r   c                	óL   € \        V 4      P                   R V P                    R2# )Ú(Ú))Útyper   ©r1   s   &r   Ú__repr__ÚSyntaxTreeNode.__repr__N   s$   € Ü�t“*×%Ñ%Ð& a¨¯	©	 {°!Ð4Ð4r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   ÚitemÚintr!   r   )r#   s   "r   r$   r%   R   s   € ×AÑA˜)ÐA¨3ÐA°9ÑAr   c                	ó   € R # ©Nr   ©r1   r@   s   &&r   Ú__getitem__ÚSyntaxTreeNode.__getitem__Q   s   € Ù>Ar   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   r@   Úslicer!   úlist[_NodeType]r   )r#   s   "r   r$   r%   U   s   € ×IÑI˜)ÐI¨5ÐI°_ÑIr   c                	ó   € R # rC   r   rD   s   &&r   rE   rF   T   s   € ÙFIr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   r@   zint | slicer!   z_NodeType | list[_NodeType]r   )r#   s   "r   r$   r%   W   s"   € ÷ #ñ #˜)ð #¨;ð #Ð;Vñ #r   c                	ó(   € V P                   V,          # rC   )r0   rD   s   &&r   rE   rF   W   s   € Ø�}‰}˜TÕ"Ð"r   c               ó    € V ^8„  d   QhRRRR/# )r   r1   r   r!   úlist[Token]r   )r#   s   "r   r$   r%   Z   s   € ÷ ñ ˜	ð  kñ r   c                ó.   a€ R V3R llo. pS! W4       V# )z Recover the linear token stream.c               ó$   € V ^8„  d   QhRRRRRR/# )r   Únoder   Ú
token_listrN   r!   r"   r   )r#   s   "r   r$   Ú.SyntaxTreeNode.to_tokens.<locals>.__annotate__]   s"   € ÷ 	>ñ 	>¨9ð 	>À+ð 	>ÐRVñ 	>r   c                ó´  <€ V P                   R 8X  d   V P                   F  pS! W!4       K  	  R# V P                  '       d   VP                  V P                  4       R# V P                  '       g   Q hVP                  V P                  P
                  4       V P                   F  pS! W!4       K  	  VP                  V P                  P                  4       R# )ÚrootN)r;   r0   r(   Úappendr)   r   r   )rQ   rR   ÚchildÚrecursive_collect_tokenss   && €r   rX   Ú:SyntaxTreeNode.to_tokens.<locals>.recursive_collect_tokens]   sœ   ø€ Ø�y‰y˜FÔ"Ø!Ÿ]œ]�EÙ,¨UÖ?ó +à——�Ø×!Ñ! $§*¡*Ö-à×)×)Ð)Ð)Ð)Ø×!Ñ! $×"4Ñ"4×"<Ñ"<Ô=Ø!Ÿ]œ]�EÙ,¨UÖ?ñ +à×!Ñ! $×"4Ñ"4×"<Ñ"<Ö=r   r   )r1   r   rX   s   & @r   Ú	to_tokensÚSyntaxTreeNode.to_tokensZ   s!   ø€ ÷	>ð 	>ð !ˆÙ  Ô.Øˆr   c               ó    € V ^8„  d   QhRRRR/# )r   r1   r   r!   rI   r   )r#   s   "r   r$   r%   o   s   € ÷ ñ �yð  _ñ r   c                	ó   € V P                   # rC   ©r+   r<   s   &r   r0   ÚSyntaxTreeNode.childrenn   s   € à�~‰~Ðr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   ÚvaluerI   r!   r"   r   )r#   s   "r   r$   r%   s   s!   € ÷ ñ �yð ¨ð ¸Tñ r   c                	ó   € Wn         R # rC   r^   ©r1   ra   s   &&r   r0   r_   r   s   € àŽr   c               ó    € V ^8„  d   QhRRRR/# ©r   r1   r   r!   ú_NodeType | Noner   )r#   s   "r   r$   r%   w   s   € ÷ ñ �Yð Ð#3ñ r   c                	ó   € V P                   # rC   ©r*   r<   s   &r   ÚparentÚSyntaxTreeNode.parentv   s   € à�|‰|Ðr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   ra   rf   r!   r"   r   )r#   s   "r   r$   r%   {   s"   € ÷ ñ �Yð Ð'7ð ¸Dñ r   c                	ó   € Wn         R # rC   rh   rc   s   &&r   ri   rj   z   s   € àŽr   c               ó   € V ^8„  d   QhRR/# ©r   r!   r    r   )r#   s   "r   r$   r%      s   € ÷ 6ñ 6˜ñ 6r   c                óL   € V P                   ;'       g    V P                  '       * # )z Is the node a special root node?)r(   r)   r<   s   &r   Úis_rootÚSyntaxTreeNode.is_root~   s   € ð —J‘J×4Ð4 $×"4Ñ"4Ô5Ð5r   c               ó   € V ^8„  d   QhRR/# rn   r   )r#   s   "r   r$   r%   „   s   € ÷ (ñ (˜4ñ (r   c                ó,   € \        V P                  4      # )zÙIs this node nested?.

Returns `True` if the node represents a `Token` pair and tokens in the
sequence between them, where `Token.nesting` of the first `Token` in
the pair is 1 and nesting of the other `Token` is -1.
)r    r)   r<   s   &r   Ú	is_nestedÚSyntaxTreeNode.is_nestedƒ   s   € ô �D×&Ñ&Ó'Ð'r   c               ó    € V ^8„  d   QhRRRR/# )r   r1   r   r!   zSequence[_NodeType]r   )r#   s   "r   r$   r%   Ž   s   € ÷ $ñ $�yð $Ð%8ñ $r   c                óX   € V P                   '       g   V .# V P                   P                  # )zMGet siblings of the node.

Gets the whole group of siblings, including self.
)ri   r0   r<   s   &r   ÚsiblingsÚSyntaxTreeNode.siblings�   s$   € ð �{�{ˆ{Ø�6ˆMØ�{‰{×#Ñ#Ð#r   c               ó   € V ^8„  d   QhRR/# r6   r   )r#   s   "r   r$   r%   ˜   s   € ÷ Eñ E�cñ Er   c                ó   € V P                   '       d   R# V P                  '       d   V P                  P                  # V P                  '       g   Q hV P                  P                  P                  P                  R4      # )zðGet a string type of the represented syntax.

- "root" for root nodes
- `Token.type` if the node represents an unnested token
- `Token.type` of the opening token, with "_open" suffix stripped, if
    the node represents a nester token pair
rU   Ú_open)rp   r(   r;   r)   r   Úremovesuffixr<   s   &r   r;   ÚSyntaxTreeNode.type—   s\   € ð �<�<ˆ<ÙØ�:�:ˆ:Ø—:‘:—?‘?Ð"Ø×!×!Ð!Ð!Ð!Ø×!Ñ!×)Ñ)×.Ñ.×;Ñ;¸GÓDÐDr   c               ó    € V ^8„  d   QhRRRR/# re   r   )r#   s   "r   r$   r%   ¨   s   € ÷ ñ ˜9ð Ð)9ñ r   c                ó²   € V P                   P                  V 4      pV^,           \        V P                   4      8  d   V P                   V^,           ,          # R# )z\Get the next node in the sequence of siblings.

Returns `None` if this is the last sibling.
N)rx   Úindexr.   ©r1   Ú
self_indexs   & r   Únext_siblingÚSyntaxTreeNode.next_sibling§   sC   € ð —]‘]×(Ñ(¨Ó.ˆ
Ø˜�>œC §¡Ó.Ô.Ø—=‘= ¨a¥Õ0Ð0Ùr   c               ó    € V ^8„  d   QhRRRR/# re   r   )r#   s   "r   r$   r%   ³   s   € ÷ ñ ˜yð Ð-=ñ r   c                óŒ   € V P                   P                  V 4      pV^,
          ^ 8¼  d   V P                   V^,
          ,          # R# )zaGet the previous node in the sequence of siblings.

Returns `None` if this is the first sibling.
N)rx   r�   r‚   s   & r   Úprevious_siblingÚSyntaxTreeNode.previous_sibling²   s:   € ð —]‘]×(Ñ(¨Ó.ˆ
Ø˜�>˜QÔØ—=‘= ¨a¥Õ0Ð0Ùr   c               ó    € V ^8„  d   QhRRRR/# ©r   r   r   r!   r"   r   )r#   s   "r   r$   r%   ½   s   € ÷ $ñ $àð$ð 
ñ$r   c                ón   € \        V 4      ! VRR7      pWn        V P                  P                  V4       R# )zMake a child node for `self`.F)r   N)r;   ri   r0   rV   )r1   r   rW   s   && r   Ú
_add_childÚSyntaxTreeNode._add_child½   s+   € ô
 �T”
˜6¨uÔ5ˆØŒØ�‰×Ñ˜UÖ#r   c               ó    € V ^8„  d   QhRRRR/# r‹   r   )r#   s   "r   r$   r%   Æ   s   € ÷ +ñ +°ð +ÀDñ +r   c                óÖ  € \        \        V4      4      pV'       dÍ   VP                  4       pVP                  '       g   V P	                  V.4       K>  VP                  ^8w  d   \        R4      hV.p^pV'       d>   V'       d6   VP                  4       pVP                  V4       WSP                  ,          pKE  V'       d   \        RV^ ,           24      hV P	                  V4       KÔ  R# )z_Convert the token stream to a tree structure and set the resulting
nodes as children of `self`.zInvalid token nestingzunclosed tokens starting N)ÚlistÚreversedÚpopr/   r�   r-   rV   )r1   r   Úreversed_tokensr(   Únested_tokensr/   s   &&    r   r,   Ú(SyntaxTreeNode._set_children_from_tokensÆ   s¼   € ô œx¨Ó/Ó0ˆßØ#×'Ñ'Ó)ˆEà—=—=�=Ø—‘  Ô(ÙØ�}‰} Ô!Ü Ð!8Ó9Ð9à"˜GˆMØˆGß!§gØ'×+Ñ+Ó-�Ø×$Ñ$ UÔ+ØŸ=™=Õ(’ßÜ Ð#<¸]È1Õ=MÐ<NÐ!OÓPÐPà�O‰O˜MÖ*ñ% r   ÚindentÚ	show_textFÚ_currentc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r—   rA   r˜   r    r™   r!   r7   r   )r#   s   "r   r$   r%   Þ   s,   € ÷ ñ ØðØ-1ðØEHðà	ñr   c          	     ó‚  € RV,          pVRV P                    2,           pV P                  '       gQ   V P                  '       d?   VRRP                  R V P                  P	                  4        4       4      ,           ,          pVR,          pV'       ds   V P                  '       ga   V P                   R9   dP   V P
                  '       d>   VR\        P                  ! V P
                  VRV,          ,           4      ,           ,          pV P                   F*  pVRVP                  WW1,           R7      ,           ,          pK,  	  V# )z'Create an XML style string of the tree.Ú Ú<c              3  ó6   "  € T F  w  rV R V: 2x € K  	  R# 5i)Ú=Nr   )Ú.0ÚkÚvs   &  r   Ú	<genexpr>Ú(SyntaxTreeNode.pretty.<locals>.<genexpr>å   s   é € Ð"OÑ<N±D°A a S¨¨!©¥<Ó<Nùs   ‚Ú>Ú
)r—   r˜   r™   )ÚtextÚtext_special)
r;   rp   ÚattrsÚjoinÚitemsÚcontentÚtextwrapr—   r0   Úpretty)r1   r—   r˜   r™   Úprefixr§   rW   s   &$$$   r   r®   ÚSyntaxTreeNode.prettyÞ   sí   € ð �x•ˆØ˜!˜DŸI™I˜;˜Õ'ˆØ�|�|ˆ| §
§
 
Ø�C˜#Ÿ(™(Ñ"O¸D¿J¹J×<LÑ<LÔ<NÓ"OÓOÕOÕOˆDØ��ˆçØ—L—L�LØ—	‘	Ð5Ô5Ø——�à�Dœ8Ÿ?š?¨4¯<©<¸À#ÈÅ,Õ9NÓOÕOÕOˆDØ—]”]ˆEØ�D˜5Ÿ<™<Ø¸XÕ=Nð (ó õ õ ŠDñ #ð ˆr   Úinclude_selfc               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   r±   r    r!   z Generator[_NodeType, None, None]r   )r#   s   "r   r$   r%   ô   s$   € ÷ 5ñ 5Øð5Ø*.ð5à	)ñ5r   c             #  ó„   "  € V'       d   V x € V P                    F  pVP                  RR7       Rj  x€L
  K  	  R#  L
5i)z›Recursively yield all descendant nodes in the tree starting at self.

The order mimics the order of the underlying linear token
stream (i.e. depth first).
T)r±   N)r0   Úwalk)r1   r±   rW   s   &$ r   r´   ÚSyntaxTreeNode.walkô   s4   é € ÷ ØŠJØ—]”]ˆEØ—z‘z¨t�zÓ4×4Ò4ó #Ù4ùs   ‚1A ³>´A c               ó   € V ^8„  d   QhRR/# )r   r!   r	   r   )r#   s   "r   r$   r%   
  s   € ÷ Oñ O %ñ Or   c                ó¤   € V P                   '       d   V P                   # V P                  '       d   V P                  P                  # \        R4      h)zTReturn the `Token` that is used as the data source for the
properties defined below.z.Root node does not have the accessed attribute)r(   r)   r   ÚAttributeErrorr<   s   &r   Ú_attribute_tokenÚSyntaxTreeNode._attribute_token
  sA   € ð �:�:ˆ:Ø—:‘:ÐØ××ÐØ×%Ñ%×-Ñ-Ð-ÜÐMÓNÐNr   c               ó   € V ^8„  d   QhRR/# r6   r   )r#   s   "r   r$   r%     s   € ÷ +ñ +�Sñ +r   c                ó6   € V P                  4       P                  # )zhtml tag name, e.g. "p")r¹   Útagr<   s   &r   r½   ÚSyntaxTreeNode.tag  s   € ð ×$Ñ$Ó&×*Ñ*Ð*r   c               ó   € V ^8„  d   QhRR/# )r   r!   zdict[str, str | int | float]r   )r#   s   "r   r$   r%     s   € ÷ -ñ -Ð3ñ -r   c                ó6   € V P                  4       P                  # )zHtml attributes.)r¹   r©   r<   s   &r   r©   ÚSyntaxTreeNode.attrs  ó   € ð ×$Ñ$Ó&×,Ñ,Ð,r   c               ó    € V ^8„  d   QhRRRR/# )r   Únamer7   r!   zNone | str | int | floatr   )r#   s   "r   r$   r%     s   € ÷ 5ñ 5˜Cð 5Ð$<ñ 5r   c                ó@   € V P                  4       P                  V4      # )z@Get the value of attribute `name`, or null if it does not exist.)r¹   ÚattrGet)r1   rÄ   s   &&r   rÆ   ÚSyntaxTreeNode.attrGet  s   € à×$Ñ$Ó&×.Ñ.¨tÓ4Ð4r   c               ó   € V ^8„  d   QhRR/# )r   r!   ztuple[int, int] | Noner   )r#   s   "r   r$   r%   "  s   € ÷ ñ Ð+ñ r   c                ó`   € V P                  4       P                  pV'       d   \        V4      # R# )z8Source map info. Format: `tuple[ line_begin, line_end ]`N)r¹   ÚmapÚtuple)r1   Úmap_s   & r   rÊ   ÚSyntaxTreeNode.map!  s(   € ð ×$Ñ$Ó&×*Ñ*ˆßä˜“;ÐÙr   c               ó   € V ^8„  d   QhRR/# )r   r!   rA   r   )r#   s   "r   r$   r%   +  s   € ÷ -ñ -�sñ -r   c                ó6   € V P                  4       P                  # )z(nesting level, the same as `state.level`)r¹   Úlevelr<   s   &r   rÐ   ÚSyntaxTreeNode.level*  rÂ   r   c               ó   € V ^8„  d   QhRR/# r6   r   )r#   s   "r   r$   r%   0  s   € ÷ /ñ /˜ñ /r   c                ó6   € V P                  4       P                  # )zUIn a case of self-closing tag (code, html, fence, etc.), it
has contents of this tag.)r¹   r¬   r<   s   &r   r¬   ÚSyntaxTreeNode.content/  s   € ð ×$Ñ$Ó&×.Ñ.Ð.r   c               ó   € V ^8„  d   QhRR/# r6   r   )r#   s   "r   r$   r%   6  s   € ÷ .ñ .˜ñ .r   c                ó6   € V P                  4       P                  # )z5'*' or '_' for emphasis, fence string for fence, etc.)r¹   Úmarkupr<   s   &r   r×   ÚSyntaxTreeNode.markup5  s   € ð ×$Ñ$Ó&×-Ñ-Ð-r   c               ó   € V ^8„  d   QhRR/# r6   r   )r#   s   "r   r$   r%   ;  s   € ÷ ,ñ ,�cñ ,r   c                ó6   € V P                  4       P                  # )zfence infostring)r¹   Úinfor<   s   &r   rÛ   ÚSyntaxTreeNode.info:  ó   € ð ×$Ñ$Ó&×+Ñ+Ð+r   c               ó   € V ^8„  d   QhRR/# )r   r!   zdict[Any, Any]r   )r#   s   "r   r$   r%   @  s   € ÷ ,ñ ,�nñ ,r   c                ó6   € V P                  4       P                  # )z/A place for plugins to store an arbitrary data.)r¹   Úmetar<   s   &r   rà   ÚSyntaxTreeNode.meta?  rÝ   r   c               ó   € V ^8„  d   QhRR/# rn   r   )r#   s   "r   r$   r%   E  s   € ÷ -ñ -�tñ -r   c                ó6   € V P                  4       P                  # )z5True for block-level tokens, false for inline tokens.)r¹   Úblockr<   s   &r   rä   ÚSyntaxTreeNode.blockD  rÂ   r   c               ó   € V ^8„  d   QhRR/# rn   r   )r#   s   "r   r$   r%   J  s   € ÷ .ñ .˜ñ .r   c                ó6   € V P                  4       P                  # )zZIf it's true, ignore this element when rendering.
Used for tight lists to hide paragraphs.)r¹   Úhiddenr<   s   &r   rè   ÚSyntaxTreeNode.hiddenI  s   € ð ×$Ñ$Ó&×-Ñ-Ð-r   )r+   r*   r)   r(   N)r   )%r   r   r   r   Ú__doc__r3   r=   r   rE   rZ   Úpropertyr0   Úsetterri   rp   rt   rx   r;   r„   rˆ   r�   r,   r®   r´   r¹   r½   r©   rÆ   rÊ   rÐ   r¬   r×   rÛ   rà   rä   rè   r   r   r   r   r   r      s   † ñ
ñ(9ØCG÷(9ð (9õT5ð ÜAó ØAàÜIó ØIõ#õð( ôó ðð ‡_�_ôó ðð ôó ðð ‡]�]ôó ðð ô6ó ð6ð ô(ó ð(ð ô$ó ð$ð ôEó ðEð ôó ðð ôó ðõ$õ+ð0Ø ðØ49ðØKL÷ð,5Ø15÷5õ,Oð ô+ó ð+ð ô-ó ð-õ5ð ôó ðð ô-ó ð-ð ô/ó ð/ð
 ô.ó ð.ð ô,ó ð,ð ô,ó ð,ð ô-ó ð-ð ô.ó ô.r   )rê   Ú
__future__r   Úcollections.abcr   r   r­   Útypingr   r   r   r   r(   r	   r   r   r   r   r   r   Ú<module>rð      sE   ðñõ
 #ç /Û ß 5Ó 5å ô�Jô ñ
 �KÐ'7Ô8€	÷v.ó v.r   