+
    '(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       E/home/ubuntu/cf-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!!9L### Q  &J$$$..|/D/DE % "/vay&*!ED**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)A3A9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)I5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    yyF"!]]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     JJ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      # )zIs 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$     {{{6M{{###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      # )zGet 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
6u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"GMG!g'++-$$U+==( #<]1=M<N!OPPOOM*% 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<NDAaS!<<Ns   >
)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!DII;'|||


C#(("ODJJ<L<L<N"OOOODLLL		55D8??4<<#,9NOOOD]]ED5<<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)zRecursively 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zztz444 #4s   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 5C 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    
(9CG(9 (9T5 A AI I#(   __    ]]  6 6 ( ( $ $ E E    $+0 49KL,515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   