
    }f                         d Z ddlmZmZ ddlmZmZmZ ddlm	Z	  G d de          Z
 G d d	e          Z G d
 de          Zd ZdS )u  
Quoting section 8.2.2 "Document Outline" of the 2006 PDF spec 1.7:
> The document outline consists of a tree-structured hierarchy of outline items (sometimes called bookmarks),
> which serve as a visual table of contents to display the document’s structure to the user.

The contents of this module are internal to fpdf2, and not part of the public API.
They may change at any time without prior warning or any deprecation period,
in non-backward-compatible ways.
    )
NamedTupleOptional   )Destination	PDFObject	PDFString)
StructElemc                   R    e Zd ZU eed<   eed<   eed<   eed<   dZee	         ed<   dS )OutlineSectionnamelevelpage_numberdestNstruct_elem)
__name__
__module____qualname__str__annotations__intr   r   r   r	        E/var/www/rtfcompare/venv/lib/python3.11/site-packages/fpdf/outline.pyr   r      sQ         
IIIJJJ
(,K*%,,,,,r   r   c                   6     e Zd ZdZ	 	 ddededef fdZ xZS )OutlineItemDictionary)
_idtitleparentprevnextfirstlastcountr   r   Nr   r   r   c                     t                                                       t          |d          | _        d | _        d | _        d | _        d | _        d | _        d| _	        || _
        || _        d S )NT)encryptr   )super__init__r   r   r   r   r    r!   r"   r#   r   r   )selfr   r   r   	__class__s       r   r'   zOutlineItemDictionary.__init__'   sn     	ud333
		
	
	&r   )NN)	r   r   r   	__slots__r   r   r	   r'   __classcell__r)   s   @r   r   r      sm        I  !"&	' '' '  	' ' ' ' ' ' ' ' ' 'r   r   c                   "     e Zd ZdZ fdZ xZS )OutlineDictionary)r   typer!   r"   r#   c                 r     t                      j        di | d| _        d | _        d | _        d| _        d S )Nz	/Outlinesr   r   )r&   r'   r/   r!   r"   r#   )r(   kwargsr)   s     r   r'   zOutlineDictionary.__init__<   s@    ""6"""	
	


r   )r   r   r   r*   r'   r+   r,   s   @r   r.   r.   9   s=        9I        r   r.   c              #     K   t                      }|V  g }i }| D ]Պt          j        j        j                  }|V  j        |v r|j                 }||_        ||_        j        dz
  |v r|j        dz
           }n|}||_        |j	        ||_	        ||_
        |xj        dz  c_        |                    |           ||j        <   fd|                                D             }|g|z   S )z
    Build PDF objects constitutive of the documents outline,
    and yield them one by one, starting with the outline dictionary
    )r   r   r   r   Nc                 2    i | ]\  }}|j         k    ||S r   )r   ).0r   oitemsections      r   
<dictcomp>z&build_outline_objs.<locals>.<dictcomp>c   s6     '
 '
 '
u%% 5%%%r   )r.   r   r   r   r   r   r    r   r   r!   r"   r#   appenditems)sectionsoutlineoutline_itemslast_outline_item_per_leveloutline_itemlast_outline_item_at_levelparent_outline_itemr6   s          @r   build_outline_objsrA   D   sb     
  !!G
MMMM"$ 
 
,,+
 
 

 =777)DW])S&.:&+ :L=1 ;;;"=gma>O"P")1$,(4%#/ !!Q&!!\***5A#GM2'
 '
 '
 '
 ; A A C C'
 '
 '
##
 9}$$r   N)__doc__typingr   r   syntaxr   r   r   structure_treer	   r   r   r.   rA   r   r   r   <module>rF      s     ( ' ' ' ' ' ' ' 5 5 5 5 5 5 5 5 5 5 & & & & & &- - - - -Z - - -' ' ' ' 'I ' ' '@    	   $% $% $% $% $%r   