a
    ¡˜ëjî_  ã                   @  s  d Z ddlmZ ddlZddlmZ ddlmZ ddlmZm	Z	m
Z
 ddlmZ ddlmZmZ G d	d
„ d
eeƒZG dd„ deƒZddœdd„ZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd „ d eƒZG d!d"„ d"eƒZG d#d$„ d$eƒZG d%d&„ d&eƒZG d'd(„ d(eƒZG d)d*„ d*eƒZ G d+d,„ d,eƒZ!G d-d.„ d.eƒZ"G d/d0„ d0eƒZ#G d1d2„ d2eƒZ$G d3d4„ d4eƒZ%G d5d6„ d6eƒZ&G d7d8„ d8eƒZ'G d9d:„ d:eƒZ(G d;d<„ d<eƒZ)G d=d>„ d>eƒZ*G d?d@„ d@eƒZ+G dAdB„ dBeƒZ,G dCdD„ dDeƒZ-G dEdF„ dFeƒZ.G dGdH„ dHeƒZ/G dIdJ„ dJeƒZ0G dKdL„ dLeƒZ1G dMdN„ dNeƒZ2G dOdP„ dPeƒZ3G dQdR„ dReƒZ4G dSdT„ dTeƒZ5G dUdV„ dVeƒZ6G dWdX„ dXeƒZ7G dYdZ„ dZeƒZ8G d[d\„ d\eƒZ9G d]d^„ d^eƒZ:G d_d`„ d`eƒZ;G dadb„ dbeƒZ<G dcdd„ ddeƒZ=G dedf„ dfeƒZ>G dgdh„ dheƒZ?G didj„ djeƒZ@G dkdl„ dleƒZAG dmdn„ dneƒZBG dodp„ dpeƒZCG dqdr„ dreƒZDG dsdt„ dteƒZEG dudv„ dveƒZFG dwdx„ dxeƒZGG dydz„ dzeƒZHG d{d|„ d|eƒZIG d}d~„ d~eƒZJG dd€„ d€eƒZKG d�d‚„ d‚eƒZLG dƒd„„ d„eƒZMG d…d†„ d†eƒZNG d‡dˆ„ dˆeƒZOG d‰dŠ„ dŠeƒZPG d‹dŒ„ dŒeƒZQG d�dŽ„ dŽeƒZRG d�d�„ d�eƒZSG d‘d’„ d’eƒZTG d“d”„ d”eƒZUG d•d–„ d–eƒZVG d—d˜„ d˜eƒZWG d™dš„ dšeƒZXG d›dœ„ dœeƒZYG d�dž„ džeƒZZdS )Ÿaf  
This file contains all classes allowed in the ontology V2.
This Type is used as intermediate representation between HTML
and Unstructured Elements.
All the processing could be done without the intermediate representation,
but it simplifies the process.
It needs to be decide whether we keep it or not.

The classes are represented as pydantic models to mimic Unstructured Elements V1 solutions.
However it results in lots of code that could be strongly simplified.

TODO (Pluto): OntologyElement is the only needed class. It could contains data about
 allowed html tags, css classes and descriptions as metadata.
é    )ÚannotationsN)Úcopy)ÚEnum)ÚAnyÚListÚOptional)ÚBeautifulSoup)Ú	BaseModelÚFieldc                   @  sD   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdS )ÚElementTypeEnumZLayoutÚTextr   ÚTableZMediaZCodeZMathematicalZ	ReferenceZMetadataZ
NavigationÚFormZ
AnnotationzSpecialized TextzDocument-SpecificN)Ú__name__Ú
__module__Ú__qualname__ÚlayoutÚtextÚlistÚtableÚmediaÚcodeÚmathematicalÚ	referenceÚmetadataÚ
navigationÚformÚ
annotationÚspecialized_textÚdocument_specific© r    r    ú^/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/unstructured/documents/ontology.pyr      s   r   c                      sT  e Zd ZU eddd�Zded< edd„ dd	�Zded
< edd„ dd	�Zded< edd�Zded< ee	dd	�Z
ded< edd�Zded< edd�Zded< eedd	�Zded< ddœ‡ fdd„Zedd œd!d"„ƒZd:d$dd%œd&d'„Zd;d$d$dd(œd)d*„Zd+dd,œd-d.„Zd$dd%œd/d0„Zdddd1œd2d3„Zed4d œd5d6„ƒZed7d œd8d9„ƒZ‡  ZS )<ÚOntologyElementÚ zText content of the element)ÚdescriptionzOptional[str]r   c                   C  s   dS ©Nr#   r    r    r    r    r!   Ú<lambda>/   ó    zOntologyElement.<lambda>z%CSS class associated with the element)Údefault_factoryr$   Úcss_class_namec                   C  s   dS r%   r    r    r    r    r!   r&   2   r'   z)HTML Tag name associated with the elementÚhtml_tag_namezType of the elementr   ÚelementTypezList of child elementszlist['OntologyElement']ÚchildrenzDescription of the elementÚstrr$   z%HTML tags associated with the elementz	list[str]Úallowed_tagsz*Optional HTML attributes or CSS propertieszdict[str, Any]Úadditional_attributes)Úkwargsc                   sX   t ƒ jf i |¤Ž | jdkr&| jj| _| jdkr<| jd | _d| jvrT|  ¡ | jd< d S )Nr#   r   Úid)	ÚsuperÚ__init__r)   Ú	__class__r   r*   r.   r/   Úgenerate_unique_id)Úselfr0   ©r4   r    r!   r3   @   s    



zOntologyElement.__init__)Úreturnc                   C  s   t t ¡ ƒ dd¡S )Nú-r#   )r-   ÚuuidÚuuid4Úreplacer    r    r    r!   r5   I   s    z"OntologyElement.generate_unique_idTÚbool©Úadd_childrenr8   c                 C  sp   t | jƒ}| dd ¡ | dd ¡ |  |¡}| jr@d| j› d�nd}|› d|› � ¡ }|  |¡}|  ||¡}|S )NÚclassr1   zclass="ú"r#   ú )r   r/   ÚpopÚ_construct_attribute_stringr)   ÚstripÚ_generate_children_htmlÚ_generate_final_html)r6   r?   Zadditional_attrsÚattr_strZ
class_attrZcombined_attr_strÚchildren_htmlZresult_htmlr    r    r!   Úto_htmlM   s    


zOntologyElement.to_html©r?   Úadd_img_alt_textr8   c                   sx   | j r*ˆ r*d ‡ ‡fdd„| j D ƒ¡}|S t|  ¡ dƒ ¡  ¡ }ˆrp| jdkrpd| jv rp|d| j dd¡› �7 }| ¡ S )aK  
        Returns the text representation of the element.

        Args:
            add_children: If True, the text of the children will be included.
                            Otherwise, element is represented as single self-closing tag.
            add_img_alt_text: If True, the alt text of the image will be included.
        rB   c                 3  s   | ]}|  ˆ ˆ¡ ¡ V  qd S ©N)Úto_textrE   ©Ú.0Úchild©r?   rL   r    r!   Ú	<genexpr>g   s   z*OntologyElement.to_text.<locals>.<genexpr>úhtml.parserÚimgZaltr#   )	r,   Újoinr   rJ   Zget_textrE   r*   r/   Úget)r6   r?   rL   Zchildren_textr   r    rR   r!   rN   ]   s    	
ÿzOntologyElement.to_textzdict[str, str])Ú
attributesr8   c                 C  s   d  dd„ | ¡ D ƒ¡S )NrB   c                 s  s,   | ]$\}}|r|› d |› d�n|› V  qdS )z="rA   Nr    )rP   ÚkeyÚvaluer    r    r!   rS   t   s   z>OntologyElement._construct_attribute_string.<locals>.<genexpr>)rV   Úitems)r6   rX   r    r    r!   rD   s   s    
ÿz+OntologyElement._construct_attribute_stringc                 C  s$   |r
| j sdS d dd„ | j D ƒ¡S )Nr#   c                 s  s   | ]}|  ¡ V  qd S rM   )rJ   rO   r    r    r!   rS   {   r'   z:OntologyElement._generate_children_html.<locals>.<genexpr>)r,   rV   )r6   r?   r    r    r!   rF   x   s    
z'OntologyElement._generate_children_html)rH   rI   r8   c              	   C  s^   | j pd}|s|rF|› d|› � ¡ }d| j› d|› d|› d| j› d�	S d| j› d|› d�S d S )Nr#   rB   ú<ú>z</z />)r   rE   r*   )r6   rH   rI   r   Zinside_tag_textr    r    r!   rG   }   s
    
"z$OntologyElement._generate_final_htmlz
str | Nonec                 C  s   | j  dd ¡S )Nr1   )r/   rW   )r6   r    r    r!   r1   †   s    zOntologyElement.idz
int | Nonec                 C  sF   d| j v rBz"| j  d¡}|d ur*t|ƒW S W n ty@   Y d S 0 d S )Nzdata-page-number)r/   rW   ÚintÚ
ValueError)r6   Z	page_attrr    r    r!   Úpage_numberŠ   s    
zOntologyElement.page_number)T)TT)r   r   r   r
   r   Ú__annotations__r)   r*   r+   r   r,   r$   r.   Údictr/   r3   Ústaticmethodr5   rJ   rN   rD   rF   rG   Úpropertyr1   r`   Ú__classcell__r    r    r7   r!   r"   ,   s8   
ÿÿÿÿ		r"   r   )Úsoupc                 C  s<   |   d¡D ],}|jdkrq
|j dd ¡ |j dd ¡ q
| S )NTr   r@   r1   )Zfind_allÚnameÚattrsrC   )rf   Útagr    r    r!   Úremove_ids_and_class_from_table–   s    
rj   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚDocumentzRoot element of the documentT©Úfrozenr-   r$   r   r+   Úbodyú	List[str]r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   rk       s   
rk   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚSectionz,A distinct part or subdivision of a documentTrl   r-   r$   r   r+   Úsectionro   r.   Nrp   r    r    r    r!   rq   ¦   s   
rq   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚPagez&A single side of a paper in a documentTrl   r-   r$   r   r+   Údivro   r.   Nrp   r    r    r    r!   rs   ¬   s   
rs   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚColumnzA vertical section of a pageTrl   r-   r$   r   r+   rt   ro   r.   Nrp   r    r    r    r!   ru   ²   s   
ru   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )Ú	Paragraphz-A self-contained unit of discourse in writingTrl   r-   r$   r   r+   Úpro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   rv   ¸   s   
rv   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚHeaderzThe top section of a pageTrl   r-   r$   r   r+   Úheaderro   r.   Nrx   r    r    r    r!   ry   ¾   s   
ry   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚFooterzThe bottom section of a pageTrl   r-   r$   r   r+   Úfooterro   r.   Nrx   r    r    r    r!   r{   Ä   s   
r{   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚSidebarzA side section of a pageTrl   r-   r$   r   r+   Úasidero   r.   Nrp   r    r    r    r!   r}   Ê   s   
r}   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )Ú	PageBreakzA break between pagesTrl   r-   r$   r   r+   Úhrro   r.   Nrp   r    r    r    r!   r   Ð   s   
r   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚTitlez%Main heading of a document or sectionTrl   r-   r$   r   r+   Úh1ro   r.   Nrx   r    r    r    r!   r�   Ö   s   
r�   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚSubtitlez(Secondary title of a document or sectionTrl   r-   r$   r   r+   Úh2ro   r.   Nrx   r    r    r    r!   rƒ   Ü   s   
rƒ   c                   @  sP   e Zd ZU eddd�Zded< eejdd�Zded< eg d¢dd�Z	d	ed
< dS )ÚHeadingzSection headings (levels 1-6)Trl   r-   r$   r   r+   )r‚   r„   Úh3Úh4Úh5Úh6ro   r.   Nrx   r    r    r    r!   r…   â   s   
r…   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚNarrativeTextzMain content textTrl   r-   r$   r   r+   rw   ro   r.   Nrx   r    r    r    r!   rŠ   è   s   
rŠ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚQuotez(A repetition of someone else's statementTrl   r-   r$   r   r+   Ú
blockquotero   r.   Nrx   r    r    r    r!   r‹   î   s   
r‹   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚFootnotezA note at the bottom of a pageTrl   r-   r$   r   r+   rt   ro   r.   Nrx   r    r    r    r!   r�   ô   s   
r�   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚCaptionz!Text describing a figure or imageTrl   r-   r$   r   r+   Ú
figcaptionro   r.   Nrx   r    r    r    r!   rŽ   ú   s   
rŽ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )Ú
PageNumberzThe number of a pageTrl   r-   r$   r   r+   Úspanro   r.   Nrx   r    r    r    r!   r�      s   
r�   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚUncategorizedTextzMiscellaneous textTrl   r-   r$   r   r+   r‘   ro   r.   Nrx   r    r    r    r!   r’     s   
r’   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚOrderedListzA list with a specific sequenceTrl   r-   r$   r   r+   Úolro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   r“     s   
r“   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚUnorderedListz"A list without a specific sequenceTrl   r-   r$   r   r+   Úulro   r.   Nr•   r    r    r    r!   r–     s   
r–   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚDefinitionListú%A list of terms and their definitionsTrl   r-   r$   r   r+   Údlro   r.   Nr•   r    r    r    r!   r˜     s   
r˜   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚListItemzAn item in a listTrl   r-   r$   r   r+   Úliro   r.   Nr•   r    r    r    r!   r›     s   
r›   c                      sh   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< ddddœ‡ fdd„Z
‡  ZS )r   zA structured set of dataTrl   r-   r$   r   r+   r   ro   r.   r=   r>   c                   s"   t tƒ  |¡dƒ}t|ƒ}t|ƒS ©NrT   ©r   r2   rJ   rj   r-   ©r6   r?   rf   r7   r    r!   rJ   )  s    zTable.to_html)T©r   r   r   r
   r$   ra   r   r   r+   r.   rJ   re   r    r    r7   r!   r   $  s   
r   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )Ú	TableBodyzA body of the tableTrl   r-   r$   r   r+   Útbodyro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   r¡   /  s   
r¡   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚTableHeaderzA header of the tableTrl   r-   r$   r   r+   Útheadro   r.   Nr£   r    r    r    r!   r¤   5  s   
r¤   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚTableRowzA row in a tableTrl   r-   r$   r   r+   Útrro   r.   Nr£   r    r    r    r!   r¦   ;  s   
r¦   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )Ú	TableCellzA cell in a tableTrl   r-   r$   r   r+   Útdro   r.   Nr£   r    r    r    r!   r¨   A  s   
r¨   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚTableCellHeaderzA header cell in a tableTrl   r-   r$   r   r+   Úthro   r.   Nr£   r    r    r    r!   rª   H  s   
rª   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚImagezA visual representationTrl   r-   r$   r   r+   rU   ro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   r¬   N  s   
r¬   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚFigurez(An illustration or diagram in a documentTrl   r-   r$   r   r+   Úfigurero   r.   Nr­   r    r    r    r!   r®   T  s   
r®   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚVideozA moving visual media elementTrl   r-   r$   r   r+   Úvideoro   r.   Nr­   r    r    r    r!   r°   Z  s   
r°   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚAudiozA sound or music elementTrl   r-   r$   r   r+   Úaudioro   r.   Nr­   r    r    r    r!   r²   `  s   
r²   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚBarcodez)A machine-readable representation of dataTrl   r-   r$   r   r+   rU   ro   r.   Nr­   r    r    r    r!   r´   f  s   
r´   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚQRCodezA two-dimensional barcodeTrl   r-   r$   r   r+   rU   ro   r.   Nr­   r    r    r    r!   rµ   l  s   
rµ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚLogoz0A graphical representation of a company or brandTrl   r-   r$   r   r+   rU   ro   r.   Nr­   r    r    r    r!   r¶   r  s   
r¶   c                   @  sP   e Zd ZU eddd�Zded< eejdd�Zded< edd	gdd�Z	d
ed< dS )Ú	CodeBlockzA block of programming codeTrl   r-   r$   r   r+   Úprer   ro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   r·   x  s   
r·   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )Ú
InlineCodezCode within a line of textTrl   r-   r$   r   r+   r   ro   r.   Nr¹   r    r    r    r!   rº   ~  s   
rº   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚFormulazA mathematical formulaTrl   r-   r$   r   r+   Úmathro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   r»   „  s   
r»   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚEquationzA mathematical equationTrl   r-   r$   r   r+   r¼   ro   r.   Nr½   r    r    r    r!   r¾   Š  s   
r¾   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚFootnoteReferencez9A subscripted reference to a note at the bottom of a pageTrl   r-   r$   r   r+   Úsubro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   r¿   �  s
   
ÿr¿   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚCitationzA reference to a sourceTrl   r-   r$   r   r+   Zcitero   r.   NrÁ   r    r    r    r!   rÂ   ˜  s   
rÂ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚBibliographyzA list of sourcesTrl   r-   r$   r   r+   r—   ro   r.   NrÁ   r    r    r    r!   rÃ   ž  s   
rÃ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚGlossaryr™   Trl   r-   r$   r   r+   rš   ro   r.   NrÁ   r    r    r    r!   rÄ   ¤  s   
rÄ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚAuthorzThe creator of the documentTrl   r-   r$   r   r+   Úmetaro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   rÅ   ª  s   
rÅ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚMetaDatez%The date associated with the documentTrl   r-   r$   r   r+   rÆ   ro   r.   NrÇ   r    r    r    r!   rÈ   °  s   
rÈ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚKeywordsz&Key terms associated with the documentTrl   r-   r$   r   r+   rÆ   ro   r.   NrÇ   r    r    r    r!   rÉ   ¶  s   
rÉ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚAbstractzA summary of the documentTrl   r-   r$   r   r+   rr   ro   r.   NrÇ   r    r    r    r!   rÊ   ¼  s   
rÊ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )Ú	Hyperlinkz1A reference to data that can be directly followedTrl   r-   r$   r   r+   Úaro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   rË   Â  s   
rË   c                      sh   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< ddddœ‡ fdd„Z
‡  ZS )ÚTableOfContentszžA list of the document's contents. Total table columns will be equal to the degree of hierarchy (n) plus 1 for the target value. Header Row: L1,L2,...Ln,ValueTrl   r-   r$   r   r+   r   ro   r.   r=   r>   c                   s"   t tƒ  |¡dƒ}t|ƒ}t|ƒS r�   rž   rŸ   r7   r    r!   rJ   Ò  s    zTableOfContents.to_html)Tr    r    r    r7   r!   rÎ   È  s   
ürÎ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚIndexz4An alphabetical list of terms and their page numbersTrl   r-   r$   r   r+   Únavro   r.   NrÍ   r    r    r    r!   rÏ   Ø  s   
rÏ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )r   z,A document section with interactive controlsTrl   r-   r$   r   r+   r   ro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   r   Þ  s   
r   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )Ú	FormFieldzA property value of a formTrl   r-   r$   r   r+   Úlabelro   r.   NrÑ   r    r    r    r!   rÒ   ä  s   
rÒ   c                      sj   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dddddœ‡ fdd„Z
‡  ZS )ÚFormFieldValuezA field for user inputTrl   r-   r$   r   r+   Úinputro   r.   r=   rK   c                   s6   t ƒ  ||¡}| j dd¡}|s$|S |› d|› � ¡ S )NrZ   r#   rB   )r2   rN   r/   rW   rE   )r6   r?   rL   r   rZ   r7   r    r!   rN   ï  s
    zFormFieldValue.to_text)TT)r   r   r   r
   r$   ra   r   r   r+   r.   rN   re   r    r    r7   r!   rÔ   ê  s   
rÔ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚCheckboxz,A small box that can be checked or uncheckedTrl   r-   r$   r   r+   rÕ   ro   r.   NrÑ   r    r    r    r!   rÖ   ÷  s   
rÖ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚRadioButtonz&A circular button that can be selectedTrl   r-   r$   r   r+   rÕ   ro   r.   NrÑ   r    r    r    r!   r×   ý  s   
r×   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚButtonzAn interactive button elementTrl   r-   r$   r   r+   Úbuttonro   r.   NrÑ   r    r    r    r!   rØ     s   
rØ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚCommentzA note or remarkTrl   r-   r$   r   r+   r‘   ro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   rÚ   	  s   
rÚ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )Ú	HighlightzEmphasized text or sectionTrl   r-   r$   r   r+   Úmarkro   r.   NrÛ   r    r    r    r!   rÜ     s   
rÜ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚRevisionInsertionúA changed or edited elementTrl   r-   r$   r   r+   Zinsro   r.   NrÛ   r    r    r    r!   rÞ     s   
rÞ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚRevisionDeletionrß   Trl   r-   r$   r   r+   Údelro   r.   NrÛ   r    r    r    r!   rà     s   
rà   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚAddresszA physical locationTrl   r-   r$   r   r+   Úaddressro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   râ   !  s   
râ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚEmailAddresszAn email addressTrl   r-   r$   r   r+   rÌ   ro   r.   Nrä   r    r    r    r!   rå   '  s   
rå   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚPhoneNumberzA telephone numberTrl   r-   r$   r   r+   r‘   ro   r.   Nrä   r    r    r    r!   ræ   -  s   
ræ   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚCalendarDatezA calendar dateTrl   r-   r$   r   r+   Útimero   r.   Nrä   r    r    r    r!   rç   3  s   
rç   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚTimezA specific timeTrl   r-   r$   r   r+   rè   ro   r.   Nrä   r    r    r    r!   ré   9  s   
ré   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚCurrencyzA monetary valueTrl   r-   r$   r   r+   r‘   ro   r.   Nrä   r    r    r    r!   rê   ?  s   
rê   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )ÚMeasurementzA quantitative value with unitsTrl   r-   r$   r   r+   r‘   ro   r.   Nrä   r    r    r    r!   rë   E  s   
rë   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )Ú
Letterheadz"The heading at the top of a letterTrl   r-   r$   r   r+   rz   ro   r.   N©
r   r   r   r
   r$   ra   r   r   r+   r.   r    r    r    r!   rì   K  s   
rì   c                   @  sP   e Zd ZU eddd�Zded< eejdd�Zded< edd	gdd�Z	d
ed< dS )Ú	Signaturez,A person's name written in a distinctive wayTrl   r-   r$   r   r+   rU   Úsvgro   r.   Nrí   r    r    r    r!   rî   Q  s   
rî   c                   @  sN   e Zd ZU eddd�Zded< eejdd�Zded< edgdd�Z	d	ed
< dS )Ú	Watermarkz/A faint design made in paper during manufactureTrl   r-   r$   r   r+   rt   ro   r.   Nrí   r    r    r    r!   rð   W  s   
rð   c                   @  sP   e Zd ZU eddd�Zded< eejdd�Zded< edd	gdd�Z	d
ed< dS )ÚStampzAn official mark or sealTrl   r-   r$   r   r+   rU   rï   ro   r.   Nrí   r    r    r    r!   rñ   ]  s   
rñ   )[Ú__doc__Ú
__future__r   r:   r   Úenumr   Útypingr   r   r   Zbs4r   Zpydanticr	   r
   r-   r   r"   rj   rk   rq   rs   ru   rv   ry   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°   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Ø   rÚ   rÜ   rÞ   rà   râ   rå   ræ   rç   ré   rê   rë   rì   rî   rð   rñ   r    r    r    r!   Ú<module>   s¢   j
