
    ,h@                     Z    d dl mZ d dlmZ  G d dej                        Z G d d      Zy)   )	xmlwriter)_preserve_whitespacec                   :     e Zd ZdZ fdZd Zd Zd Zd Z xZ	S )SharedStringszA
    A class for writing the Excel XLSX sharedStrings file.

    c                 0    t         |           d| _        y)z
        Constructor.

        N)super__init__string_table)self	__class__s    Z/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/xlsxwriter/sharedstrings.pyr	   zSharedStrings.__init__   s     	     c                     | j                          | j                          | j                          | j                  d       | j	                          y )Nsst)_xml_declaration
_write_sst_write_sst_strings_xml_end_tag
_xml_closer   s    r   _assemble_xml_filez SharedStrings._assemble_xml_file+   sF     	 	 	! 	%  	r   c                     d}d|fd| j                   j                  fd| j                   j                  fg}| j                  d|       y )Nz9http://schemas.openxmlformats.org/spreadsheetml/2006/mainxmlnscountuniqueCountr   )r
   r   unique_count_xml_start_tag)r   r   
attributess      r   r   zSharedStrings._write_sstC   sR    K ed''--.D--::;

 	E:.r   c                 \    | j                   j                  D ]  }| j                  |        y )N)r
   string_array	_write_si)r   strings     r   r   z SharedStrings._write_sst_stringsO   s+     ''44 	#FNN6"	#r   c                     g }| j                  |      }t        |      r|j                  d       |j                  d      r#|j	                  d      r| j                  |       y | j                  ||       y )N)z	xml:spacepreservez<r>z</r>)_escape_control_charactersr   append
startswithendswith_xml_rich_si_element_xml_si_element)r   r"   r   s      r   r!   zSharedStrings._write_siU   sk    
 008  '78 U#(?%%f-  4r   )
__name__
__module____qualname____doc__r	   r   r   r   r!   __classcell__)r   s   @r   r   r      s!    ! 0
/#5r   r   c                   (    e Zd ZdZd Zd Zd Zd Zy)SharedStringTablezD
    A class to track Excel shared strings between worksheets.

    c                 <    d| _         d| _        i | _        g | _        y )N    )r   r   r
   r    r   s    r   r	   zSharedStringTable.__init__n   s!    
r   c                     || j                   vrG| j                  }|| j                   |<   | xj                  dz  c_        | xj                  dz  c_        |S | j                   |   }| xj                  dz  c_        |S )z: " Get the index of the string in the Shared String table.r   )r
   r   r   )r   r"   indexs      r   _get_shared_string_indexz*SharedStringTable._get_shared_string_indext   sr    ***%%E(-Df%JJ!OJ"L !!&)

a
r   c                      | j                   |   S )z& " Get a shared string from the index.)r    )r   r5   s     r   _get_shared_stringz$SharedStringTable._get_shared_string   s      ''r   c                 r    t        | j                  | j                  j                        | _        i | _        y)z= " Sort the shared string data and convert from dict to list.)keyN)sortedr
   __getitem__r    r   s    r   _sort_string_dataz#SharedStringTable._sort_string_data   s+    "4#4#4$:K:K:W:WXr   N)r+   r,   r-   r.   r	   r6   r8   r=    r   r   r1   r1   h   s    
(r   r1   N) r   utilityr   	XMLwriterr   r1   r>   r   r   <module>rB      s,     )U5I'' U5r" "r   