
    }f0                     2   d dl 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
mZ ddlmZmZmZmZmZmZmZ ddlmZ dd	lmZ dd
lmZ e	j        fZ G d d          Z G d dee          Z G d de          Z G d de          Z G d de          Z dS )    N)datetime)
NamedTupleTupleUnion   )Action)AnnotationFlagAnnotationNameFileAttachmentAnnotationName)build_obj_dictDestinationNamePDFContentStreamPDFDate	PDFObject	PDFString)create_dictionary_string)create_list_string)iobj_refc            '           e Zd Zeddddddddddddddfdededededed	ee         d
edede	de
dedede
dedeeef         dee         dededef&dZdS )AnnotationMixinNr    subtypexywidthheightflagscontentsdestactioncolormodification_timetitlequad_pointsborder_widthnameink_list	file_spec
field_typedefault_appearancec           	         t          d          | _        t          |          | _        d|dd|dd||z   dd||z
  dd	| _        d| d| _        |rt          |          nd | _        || _        t          |          | _        |rt          |d          nd | _
        |	| _        || _        |
rd|
d	          d|
d
          d|
d          dnd | _        |rt          |d          nd | _        |rt          |d          nd | _        |rt#          d |D                       nd | _        d | _        || _        |rdt#          d |D                       z   dz   nd | _        || _        || _        d S )NAnnot[.2f ]z[0 0 T)encryptr   r      c              3      K   | ]}|d V  	dS r/   Nr   ).0
quad_points     I/var/www/rtfcompare/venv/lib/python3.11/site-packages/fpdf/annotations.py	<genexpr>z+AnnotationMixin.__init__.<locals>.<genexpr>?   s(      GGZ
((GGGGGG    c              3      K   | ]}|d V  	dS r5   r   )r6   coords     r8   r9   z+AnnotationMixin.__init__.<locals>.<genexpr>F   s&      AAuuNNAAAAAAr:   )r   typer   rectborderf_tvsumfr   r   ar    ctr   mpdf_listr%   pr'   r(   f_sd_a)selfr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   valuer+   s                        r8   __init__zAnnotationMixin.__init__   s   . MM	G}}IIIIIIIE	IIIF
IIII	-l---'1;4
###tU=EO	(D99994	:?I6U1X66a66586666T38B5$////d=NX*D9999TX HGG;GGGGGG 	
 	 S8AAAAAAAACGG 	
 %r:   )__name__
__module____qualname__DEFAULT_ANNOT_FLAGSstrintr   r	   r   r   tupler   r   r
   r   rN   r   r:   r8   r   r      s,        (; &*!DH!"&+1& 1&1& 1& 	1&
 1& 1& ^$1& 1& 1& 1& 1& $1& 1& 1& 1&  N$@@A!1&" *#1&$ %1&& '1&*  +1& 1& 1& 1& 1& 1&r:   r   c                   "     e Zd ZdZ fdZ xZS )PDFAnnotationz?A PDF annotation that get serialized as an obj<</>>endobj blockc                 :     t                      j        |i | d S N)superrN   )rL   argskwargs	__class__s      r8   rN   zPDFAnnotation.__init__Q   s%    $)&)))))r:   )rO   rP   rQ   __doc__rN   __classcell__r]   s   @r8   rW   rW   N   s>        EE* * * * * * * * *r:   rW   c                   $    e Zd ZdZdZddZd ZdS )AnnotationDictzAA PDF annotation that get serialized as an inline <<dictionnary>>)r=   r   r>   r?   r@   rA   rC   r   rD   r    rE   rF   r%   rI   r'   r(   rJ   rK   Nc                 x     t           fdt                     D             ||          }t          |          S )Nc                 2    i | ]}|t          |          S r   getattrr6   keyrL   s     r8   
<dictcomp>z,AnnotationDict.serialize.<locals>.<dictcomp>n   s%    :::S'$$$:::r:   )_security_handler_obj_id)r   dirpdf_dictrL   rj   rk   obj_dicts   `   r8   	serializezAnnotationDict.serializel   sJ    !::::D		:::/
 
 

 !!!r:   c                      d t                     D             } fd|D             }d |                                D             }d| dS )Nc                 <    g | ]}|                     d           |S )__)
startswith)r6   rh   s     r8   
<listcomp>z+AnnotationDict.__repr__.<locals>.<listcomp>u   s)    EEEt0D0DEEEEr:   c                 2    i | ]}|t          |          S r   re   rg   s     r8   ri   z+AnnotationDict.__repr__.<locals>.<dictcomp>v   s%    555S'$$$555r:   c                 8    i | ]\  }}t          |          ||S r   )callable)r6   rh   rM   s      r8   ri   z+AnnotationDict.__repr__.<locals>.<dictcomp>w   s)    KKKJC8E??KS%KKKr:   zAnnotationDict(**))rl   items)rL   keysds   `  r8   __repr__zAnnotationDict.__repr__t   sa    EEs4yyEEE5555555KK!''))KKK'1''''r:   NN)rO   rP   rQ   r^   	__slots__rp   r}   r   r:   r8   rb   rb   U   sD        GGI*" " " "( ( ( ( (r:   rb   c                   `     e Zd Z	 	 	 	 	 ddededededed	ed
ef fdZd Zd Z	d Z
d Z xZS )PDFEmbeddedFile NFbasenamer   desccreation_datemodification_datecompresschecksumc                 (   t                                          ||           t          d          | _        dt	          |          i}|r&t          |d                                          |d<   |r&t          |d                                          |d<   |rMt          j        dd	
          }	|		                    | j
                   |	                                }
d|
 d|d<   t          |          | _        || _        || _        d| _        d S )N)r   r   EmbeddedFilez/SizeT)with_tzz/CreationDatez/ModDatemd5F)usedforsecurity<>z	/CheckSum)rZ   rN   r   r=   lenr   rp   hashlibnewupdate	_contents	hexdigestrm   params	_basename_desc_globally_enclosed)rL   r   r   r   r   r   r   r   r   	file_hashhash_hexr]   s              r8   rN   zPDFEmbeddedFile.__init__|   s    	(X>>>((	3x==) 	W&-mT&J&J&J&T&T&V&VF?# 	V!():D!I!I!I!S!S!U!UF: 	2E5AAAIT^,,, **,,H"1h///F;v&&!
"&r:   c                     | j         S rY   r   rL   s    r8   globally_enclosedz!PDFEmbeddedFile.globally_enclosed   s    &&r:   c                     || _         d S rY   r   )rL   rM   s     r8   set_globally_enclosedz%PDFEmbeddedFile.set_globally_enclosed   s    "'r:   c                     | j         S rY   )r   r   s    r8   r   zPDFEmbeddedFile.basename   s
    ~r:   c                 8    t          | | j        | j                  S rY   )FileSpecr   r   r   s    r8   r)   zPDFEmbeddedFile.file_spec   s    dndj999r:   )r   NNFF)rO   rP   rQ   rS   bytesr   boolrN   r   r   r   r)   r_   r`   s   @r8   r   r   {   s        
 "&&*' '' ' 	'
  ' $' ' ' ' ' ' ' '6' ' '( ( (  : : : : : : :r:   r   c                   6    e Zd ZU eed<   eed<   eed<   ddZdS )r   embedded_filer   r   Nc                 $   dt          | j                                                  t          dt	          | j        j                  i          d}| j        r)t          | j                                                  |d<   t          |d          S )Nz	/Filespec/F)z/Typer   z/EFz/Descr0   )
field_join)r   r   rp   rm   pdf_refr   idr   rn   s       r8   rp   zFileSpec.serialize   s     DM**4466T74+=+@#A#ABCC
 

 9 	A )$) 4 4 > > @ @HWS1111r:   r~   )rO   rP   rQ   r   __annotations__rS   rp   r   r:   r8   r   r      sH         """"MMM
III2 2 2 2 2 2r:   r   )!r   r   typingr   r   r   actionsr   enumsr	   r
   r   syntaxr   r   r   r   r   r   r   r   rm   r   rH   r   r   PRINTrR   r   rW   rb   r   r   r   r:   r8   <module>r      s          + + + + + + + + + +       O O O O O O O O O O                  9 8 8 8 8 8 2 2 2 2 2 2 ' ' ' ' ' ' &+- 2& 2& 2& 2& 2& 2& 2& 2&j* * * * *OY * * *#( #( #( #( #(_ #( #( #(L&: &: &: &: &:& &: &: &:R2 2 2 2 2z 2 2 2 2 2r:   