
    Rj                     x   U d dl Z d dlmZ d dlmZmZmZmZ d dlm	Z	 d dl
mZmZmZmZmZmZmZmZmZ ddlmZ ddlmZmZ erdd	lmZmZmZmZ dd
lmZ  G d de          Z edd          Z  edd          Z! edd          Z" G d de          Z# G d de          Z$ G d de          Z% G d de#          Z& G d de#          Z' G d de#          Z( G d de#          Z) G d d e%          Z* G d! d"e%          Z+ G d# d$e%          Z,e G d% d&                      Z-e G d' d(                      Z. G d) d*e j/                  Z0 G d+ d,e0          Z1 e1            e0_2         G d- d.e0          Z3 e3            e0_4         G d/ d0e0          Z5 e5            e0_6         G d1 d2e0          Z7 e7            e0_8         G d3 d4e0          Z9 e9            e0_:         G d5 d6e0          Z; e;            e0_<         G d7 d8e0          Z= e=            e0_>         G d9 d:e          Z?d;Z@eeAd<<    G d= d>e#          ZB G d? d@e#          ZC G dA dBe$          ZD G dC dDe#          ZE G dE dFe$          ZF G dG dHe#          ZG G dI dJe#          ZH G dK dLe$          ZI G dM dNe#          ZJ G dO dPe#          ZK G dQ dRe#          ZL G dS dTe#          ZM G dU dVe#          ZN G dW dXe$          ZO G dY dZe#          ZP G d[ d\e#          ZQ G d] d^e#          ZR G d_ d`e#          ZS G da dbe#          ZT G dc dde$          ZU G de dfe$          ZV G dg dhe          ZW G di dje#          ZX G dk dle          ZY G dm dne          ZZ G do dpe          Z[ G dq dre#          Z\ G ds dte#          Z] G du dve#          Z^ G dw dxe#          Z_ G dy dze#          Z` G d{ d|e#          Za G d} d~e          Zb G d de#          Zc G d de#          Zd G d de          Ze G d de#          ZfdS )    N)	dataclass)EnumFlagIntEnumIntFlag)intern)	TYPE_CHECKINGClassVarOptionalProtocolType	TypeAliasTypeVarUnioncast   )convert_to_device_color)Namewrap_in_local_context)Color
DeviceCMYK
DeviceGray	DeviceRGB)FPDFc                       e Zd ZdZ	 dZdS )SignatureFlagr      N)__name__
__module____qualname__SIGNATURES_EXISTAPPEND_ONLY     K/usr/local/lib/hermes-agent/venv/lib/python3.11/site-packages/fpdf/enums.pyr   r      s"        AK r$   r   ECoerciveEnum)boundIECoerciveIntEnumIFCoerciveIntFlagc            
       N    e Zd ZdZed	dee         deez  dedefd            Z	dS )
r'   zQAn enumeration that provides a helper to coerce strings into enumeration members.Fclsvaluecase_sensitivereturnc                 V   t          ||           r|S t          |t                    rj	  | |          S # t          $ r Y nw xY w	 |r| |         n| |                                         S # t          $ r Y nw xY wt          | d| j                   t          | d| j                   )a  
        Attempt to coerce `value` into a member of this enumeration.

        If value is already a member of this enumeration it is returned unchanged.
        Otherwise, if it is a string, attempt to convert it as an enumeration value. If
        that fails, attempt to convert it (case insensitively, by upcasing) as an
        enumeration name.

        If all different conversion attempts fail, an exception is raised.

        Args:
            value (Enum, str): the value to be coerced.

        Raises:
            ValueError: if `value` is a string but neither a member by name nor value.
            TypeError: if `value`'s type is neither a member of the enumeration nor a
                string.
         is not a valid z cannot be converted to a )
isinstancestr
ValueErrorupperKeyErrorr   	TypeError)r.   r/   r0   s      r%   coercezCoerciveEnum.coerce,   s    * eS!! 	LeS!! 
	Gs5zz!   %3Ks5zzU[[]]9KK    EEs|EEFFF5JJCLJJKKKs!   
4 
A A#A) )
A65A6NF)
r   r   r    __doc__classmethodr   r&   r5   boolr:   r#   r$   r%   r'   r'   )   sl        WW#L #LDG #LAG #LT #La #L #L #L [#L #L #Lr$   c                   N    e Zd ZdZedee         deez  ez  defd            Z	dS )r*   zl
    An enumeration that provides a helper to coerce strings and integers into
    enumeration members.
    r.   r/   r1   c                 H   t          ||           r|S t          |t                    rC	 | |                                         S # t          $ r t	          | d| j                   dw xY wt          |t                    r | |          S t          | d| j                   )a  
        Attempt to coerce `value` into a member of this enumeration.

        If value is already a member of this enumeration it is returned unchanged.
        Otherwise, if it is a string, attempt to convert it (case insensitively, by
        upcasing) as an enumeration name. Otherwise, if it is an int, attempt to
        convert it as an enumeration value.

        Otherwise, an exception is raised.

        Args:
            value (IntEnum, str, int): the value to be coerced.

        Raises:
            ValueError: if `value` is an int but not a member of this enumeration.
            ValueError: if `value` is a string but not a member by name.
            TypeError: if `value`'s type is neither a member of the enumeration nor an
                int or a string.
        r3   N cannot convert to a r4   r5   r7   r8   r6   r   intr9   )r.   r/   s     r%   r:   zCoerciveIntEnum.coerceY   s    * eS!! 	LeS!! 	UU5;;==)) U U U E!I!I3<!I!IJJPTTU eS!! 	3u::5EEs|EEFFFs   A %A(N)
r   r   r    r<   r=   r   r)   r5   rC   r:   r#   r$   r%   r*   r*   S   sh         
  GDH  GR#X^  G  G  G  G [ G  G  Gr$   c                   N    e Zd ZdZedee         deez  ez  defd            Z	dS )r,   z
    Enumerated constants that can be combined using the bitwise operators,
    with a helper to coerce strings and integers into enumeration members.
    r.   r/   r1   c                    t          ||           r|S t          |t                    r	 | |                                         S # t          $ r Y nw xY w	 | |d                                                  }|dd         D ]}|| |                                         z  } |S # t          $ r t	          | d| j                   dw xY wt          |t                    r | |          S t          | d| j                   )a  
        Attempt to coerce `value` into a member of this enumeration.

        If value is already a member of this enumeration it is returned unchanged.
        Otherwise, if it is a string, attempt to convert it (case insensitively, by
        upcasing) as an enumeration name. Otherwise, if it is an int, attempt to
        convert it as an enumeration value.
        Otherwise, an exception is raised.

        Args:
            value (IntEnum, str, int): the value to be coerced.

        Raises:
            ValueError: if `value` is an int but not a member of this enumeration.
            ValueError: if `value` is a string but not a member by name.
            TypeError: if `value`'s type is neither a member of the enumeration nor an
                int or a string.
        r   r   Nr3   rA   rB   )r.   r/   flagschars       r%   r:   zCoerciveIntFlag.coerce   s9   ( eS!! 	LeS!! 	U5;;==))   UE!HNN,,-!!""I 6 6D!C

$55EE U U U E!I!I3<!I!IJJPTTU eS!! 	3u::5EEs|EEFFFs   A 
AAAB   %CN)
r   r   r    r<   r=   r   r+   r5   rC   r:   r#   r$   r%   r,   r,   }   sh         
 &GDH &GR#X^ &G &G &G &G [&G &G &Gr$   c                   @    e Zd ZdZ ed          Z	  ed          ZdS )WrapModez7Defines how to break and wrap lines in multi-line text.WORDCHARN)r   r   r    r<   r   rJ   rK   r#   r$   r%   rI   rI      s3        ==6&>>D6&>>Dr$   rI   c                       e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z	dS )CharVPosz;Defines the vertical position of text relative to the line.SUPSUBNOMDENOMLINEN)
r   r   r    r<   r   rN   rO   rP   rQ   rR   r#   r$   r%   rM   rM      sc        AA
&--C
&--C
&--CF7OOE6&>>Dr$   rM   c                        e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z		 e
	 dded ef         d	ed
d f fd            Z xZS )Alignz$Defines how to render text in a cellCENTERX_CENTERLEFTRIGHTJUSTIFYFr/   r0   r1   c                     |dk    r| j         S t          |t                    r|                                }t	          | |                               ||          S N )Lr4   r5   r7   superr:   r.   r/   r0   	__class__s      r%   r:   zAlign.coerce   sY     B;;5LeS!! 	"KKMMES#%%>
 
 	
r$   r;   )r   r   r    r<   r   CXr]   RJr=   r   r5   r>   r:   __classcell__r`   s   @r%   rT   rT      s        **xAzA8vAwAyA@E	
 	
'3,'	
9=	
		
 	
 	
 	
 	
 [	
 	
 	
 	
 	
r$   rT   c                        e Zd ZdZ ed          Z	  ed          Z	  ed          Z	 e	 d
de	d e
f         dedd f fd	            Z xZS )VAlignzLDefines how to vertically render text in a cell.
    Default value is MIDDLEMIDDLETOPBOTTOMFr/   r0   r1   c                 f    |dk    r| j         S t          | |                               ||          S r[   )Mr^   r:   r_   s      r%   r:   zVAlign.coerce   s:     B;;5LS#%%>
 
 	
r$   r;   )r   r   r    r<   r   rm   TBr=   r   r5   r>   r:   re   rf   s   @r%   rh   rh      s          	xAuACxAFAF
 
(C-(
:>
	
 
 
 
 
 [
 
 
 
 
r$   rh   c                        e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZ	 e	de
fd            Zdd
ZddZed	ed e
ef         dd f fd            Z xZS )TextEmphasisz
    Indicates use of bold / italics / underline.

    This enum values can be combined with & and | operators:
        style = B | I
    r   r   r         r1   c                 ~     d                      fd j        j                                        D                       S )Nr\   c              3   ,   K   | ]\  }}|z  
|V  d S Nr#   ).0namer/   selfs      r%   	<genexpr>z%TextEmphasis.style.<locals>.<genexpr>  sE       
 
 T5%RV,

 
 
 
 
 
r$   )joinr`   __members__itemsry   s   `r%   stylezTextEmphasis.style  sP    ww 
 
 
 
$(N$>$D$D$F$F
 
 
 
 
 	
r$   r/   c                     | |z  S rv   r#   ry   r/   s     r%   addzTextEmphasis.add  s    e|r$   c                     t                               d                    fd| j        D                                 S )Nr\   c              3   .   K   | ]}|j         v|V  d S rv   )r   )rw   sr/   s     r%   rz   z&TextEmphasis.remove.<locals>.<genexpr>#  s/      BB!Qek-A-AA-A-A-A-ABBr$   )rq   r:   r{   r   r   s    `r%   removezTextEmphasis.remove!  sA    ""GGBBBBtzBBBBB
 
 	
r$   c                    t          |t                    r|dk    r| j        S |                                dk    r| j        S |                                dk    r| j        S |                                dk    r| j        S |                                dk    r| j        S t          | |           	                    |          S )Nr\   BOLDITALICS	UNDERLINESTRIKETHROUGH)
r4   r5   NONEr7   ro   IUSr^   r:   r.   r/   r`   s     r%   r:   zTextEmphasis.coerce&  s    eS!! 
	{{x{{}}&&u{{}}	))u{{}}++u{{}}//uS#%%e,,,r$   )r/   rq   r1   rq   )r   r   r    r<   r   ro   r   r   r   propertyr5   r   r   r   r=   r   rC   r:   re   rf   s   @r%   rq   rq     s          D	A
	A	A	A
s 
 
 
 X

   
 
 
 

 -5c!9: -~ - - - - - [- - - - -r$   rq   c                   "    e Zd ZdZdZ	 dZ	 dZdS )MethodReturnValuez
    Defines the return value(s) of a FPDF content-rendering method.

    This enum values can be combined with & and | operators:
        PAGE_BREAK | LINES
    r   r   rr   N)r   r   r    r<   
PAGE_BREAKLINESHEIGHTr#   r$   r%   r   r   6  s1          JJE[F==r$   r   c                        e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZ	 eez  ez  ez  Z		 dZ
	 eded eef         d	d f fd
            Zded	d f fdZded	d f fdZd	efdZ xZS )CellBordersLayouta  Defines how to render cell borders in table

    The integer value of `border` determines which borders are applied. Below are some common examples:

    - border=1 (LEFT): Only the left border is enabled.
    - border=3 (LEFT | RIGHT): Both the left and right borders are enabled.
    - border=5 (LEFT | TOP): The left and top borders are enabled.
    - border=12 (TOP | BOTTOM): The top and bottom borders are enabled.
    - border=15 (ALL): All borders (left, right, top, bottom) are enabled.
    - border=16 (INHERIT): Inherit the border settings from the parent element.

    Using `border=3` will combine LEFT and RIGHT borders, as it represents the
    bitwise OR of `LEFT (1)` and `RIGHT (2)`.
    r   r   r   rr   rs      r/   r1   c                     t          |t                    r|dk    rt          d          t                                          |          S Nr   z,INHERIT cannot be combined with other values)r4   rC   r6   r^   r:   r   s     r%   r:   zCellBordersLayout.coercem  sC    eS!! 	MebjjKLLLww~~e$$$r$   c                 t    t                                          |          }|dk    rt          d          |S r   )r^   __and__r6   ry   r/   r`   s     r%   r   zCellBordersLayout.__and__s  s5    &&2::KLLLr$   c                 t    t                                          |          }|dk    rt          d          |S r   )r^   __or__r6   r   s     r%   r   zCellBordersLayout.__or__y  s5    u%%2::KLLLr$   c                 X   g }| t           j        z  r|                    d           | t           j        z  r|                    d           | t           j        z  r|                    d           | t           j        z  r|                    d           |rd                    |          ndS )Nr]   rc   rn   ro   r\   r   )r   rW   appendrX   rj   rk   r{   )ry   
border_strs     r%   __str__zCellBordersLayout.__str__  s     "
#(( 	#c"""#)) 	#c"""#'' 	#c"""#** 	#c"""&0<rwwz"""f<r$   )r   r   r    r<   r   rW   rX   rj   rk   ALLINHERITr=   r   r5   rC   r:   r   r   r   re   rf   s   @r%   r   r   H  s*         D(D.E/
C-F0
,
v
%C)G>%5!4c3!>? %DW % % % % % [%
S %8      C $7      
= 
= 
= 
= 
= 
= 
= 
= 
=r$   r   c                   Z   e Zd ZU dZdZee         ed<   dZe	e
ee
e
e
f         ddddf         ed<   dZee         ed<   d	Zeed
<   d	Zeed<   ede	ed f         dd fd            ZdddefdZdddefdZedeeee         f         fd            ZdddefdZdddefdZdefdZ	 d"deded         dee         fdZd"ded         dee         fdZ	 d"deded         dee         fdZdedee         fdZedededededee         f
d             Z dddededededee         fd!Z!dS )#TableBorderStylezA helper class for drawing one border of a table

    Attributes:
        thickness: The thickness of the border. If None use default. If <= 0 don't draw the border.
        color: The color of the border. If None use default.
    N	thicknessr   r   r   colordash        gapphaseshould_drawr1   c                 p    t          | t                    r| S | rt                      S t          d          S )zk
        From boolean or TableBorderStyle input, convert to definite TableBorderStyle class object
        r   r   r4   r   )r   s    r%   	from_boolzTableBorderStyle.from_bool  sB    
 k#344 	 	&#%%%#....r$   pdfr   c                 J    | j         duo| j         dk    o| j         |j        k    S )zTReturn True if this style changes the thickness of the draw command, False otherwiseNr   r   
line_widthry   r   s     r%   _changes_thicknessz#TableBorderStyle._changes_thickness  s3     N$& 1$1#.0	
r$   c                 4    | j         duo| j         |j        k    S )zPReturn True if this style changes the color of the draw command, False otherwiseN)r   
draw_colorr   s     r%   _changes_colorzTableBorderStyle._changes_color  s    z%F$**FFr$   c                 ,    | j         | j        | j        dS )zGReturn dict object specifying dash in the same format as the pdf objectr   r   r   r   r~   s    r%   	dash_dictzTableBorderStyle.dash_dict  s     	$(TZHHHr$   c                 4    | j         duo| j        |j        k    S )zOReturn True if this style changes the dash of the draw command, False otherwiseN)r   r   dash_patternr   s     r%   _changes_dashzTableBorderStyle._changes_dash  s    y$K3;K)KKr$   c                     |                                  o>|                     |          p)|                     |          p|                     |          S )zUReturn True if this style changes the any aspect of the draw command, False otherwise)should_renderr   r   r   r   s     r%   changes_strokezTableBorderStyle.changes_stroke  sX    !!## 
$$ '&&s++'!!#&&	
r$   c                 *    | j         du p
| j         dk    S )zDReturn True if this style produces a visible stroke, False otherwiseNr   r   r~   s    r%   r   zTableBorderStyle.should_render  s    ~%=#)==r$   scalec                 >    || j         n|j        }|g n	||z  ddgS )zUReturn list with string for the draw command to change thickness (empty if no change)N.2fz wr   )ry   r   r   r   s       r%   _get_change_thickness_commandz.TableBorderStyle._get_change_thickness_command  s8     '*kDNNs~	&rr	E0A-I-I-I-I,JJr$   c                     || j         }n|j        }|g n3t          |                                                                          gS )zQReturn list with string for the draw command to change color (empty if no change))r   r   r   	serializer7   )ry   r   r   s      r%   _get_change_line_color_commandz/TableBorderStyle._get_change_line_color_command  sP    ;JEENE } B)%00::<<BBDDE	
r$   c                     || j         n|j        }|d         |d         |d         }}}|g S |dk    rdgS |J ||dk    rd||z  dd	||z  dd
gS d||z  dd||z  dd	||z  dd
gS )zPReturn list with string for the draw command to change dash (empty if no change)Nr   r   r   r   z[] 0 d[z.3fz] z d )r   r   )ry   r   r   r   r   r   r   s          r%   _get_change_dash_commandz)TableBorderStyle._get_change_dash_command  s     '*kDNNs7G	$V,i.>	'@R5c<I199:   ;#((AuAAAEEMAAAABBOD5LOOOsU{OOO%%-OOOOPPr$   c                     |                      |          |                                 z   |                     |          z   S )zQReturn list of strings for the draw command to change stroke (empty if no change))r   r   r   )ry   r   s     r%   get_change_stroke_commandsz+TableBorderStyle.get_change_stroke_commands  sD     ))%001133400778	
r$   x1y1x2y2c                 (    | dd|dd|dd|ddgS )zQReturn list with string for the command to draw a line at the specified endpointsr   r   z m z l Sr#   )r   r   r   r   s       r%   get_line_commandz!TableBorderStyle.get_line_command  s:     <<<B<<<r<<<<<<<==r$   c                    |                                  sg S |                     |          rC|                     |j                  |                     ||||          z   }t          |          S |                     ||||          S )z
        Get draw commands for this section of a cell border. x and y are presumed to be already
        shifted and scaled.
        )r   )r   r   r   kr   r   )ry   r   r   r   r   r   draw_commandss          r%   get_draw_commandsz"TableBorderStyle.get_draw_commands  s     !!## 	Is## 	8 ;;e <  %%b"b"556M )777$$RR444r$   rv   )"r   r   r    r<   r   r   float__annotations__r   r   rC   tupler   r   r   staticmethodr>   r   r   r   r   dictr5   r   r   r   r   listr   r   r   r   r   r   r#   r$   r%   r   r     s<          "&Ix%%% 	 
5U3S=!;lDP    !D(5/   CE5/uT+=%=> /CU / / / \/
f 
 
 
 
 
G& GT G G G G I4Xe_ 45 I I I XIL LD L L L L
& 
T 
 
 
 
>t > > > >
 59K KK!)&!1K	cK K K K

 

(62B 

dSVi 

 

 

 

 59Q QQ!)&!1Q	cQ Q Q Q
 
$s) 
 
 
 
 >U > >5 >e >S	 > > > \>55$5*/55:5@E5	c5 5 5 5 5 5r$   r   c                      e Zd ZU dZdZeez  ed<   dZeez  ed<   dZ	eez  ed<   dZ
eez  ed<   deeez           fdZed	ed
ef         dee         fd            Z	 ddddededededeed
ef                  dee         fdZdededededddeed
ef                  deee         ef         fdZdededededddeed
ef                  deee         ef         fdZdededededddeed
ef                  dedeeez           deee         ef         fdZdedd fdZ	 ddddededededeed
ef                  ddfdZdS )TableCellStylea  A helper class for drawing all the borders of one cell in a table

    Attributes:
        left: bool or TableBorderStyle specifying the style of the cell's left border
        bottom: bool or TableBorderStyle specifying the style of the cell's bottom border
        right: bool or TableBorderStyle specifying the style of the cell's right border
        top: bool or TableBorderStyle specifying the style of the cell's top border
    Fleftbottomrighttopr1   c                    t          d | j        | j        | j        | j        fD                       rgt          d | j        | j        | j        | j        fD                       rdS t          d | j        | j        | j        | j        fD                       rdS ngt          d | j        | j        | j        | j        fD                       r6| j        t          fd| j        | j        | j        fD                       rS dS )	zRReturn bool or TableBorderStyle if all borders have the same style, otherwise Nonec              3   @   K   | ]}t          |t                    V  d S rv   )r4   r>   rw   borders     r%   rz   z:TableCellStyle._get_common_border_style.<locals>.<genexpr>  s@       
 
 vt$$
 
 
 
 
 
r$   c              3      K   | ]}|V  d S rv   r#   r   s     r%   rz   z:TableCellStyle._get_common_border_style.<locals>.<genexpr>!  s"      WWf6WWWWWWr$   Tc              3      K   | ]}| V  d S rv   r#   r   s     r%   rz   z:TableCellStyle._get_common_border_style.<locals>.<genexpr>#  s5        %F
     r$   Fc              3   @   K   | ]}t          |t                    V  d S rv   r   r   s     r%   rz   z:TableCellStyle._get_common_border_style.<locals>.<genexpr>'  sA       
 
 v/00
 
 
 
 
 
r$   c              3   $   K   | ]
}|k    V  d S rv   r#   )rw   r   commons     r%   rz   z:TableCellStyle._get_common_border_style.<locals>.<genexpr>,  s(      VV6V#VVVVVVr$   N)allr   r   r   r   )ry   r   s    @r%   _get_common_border_stylez'TableCellStyle._get_common_border_style  sJ    
 
9dk4:txH
 
 
 
 
 	 WWDKTX(VWWWWW t  *.)T[$*dh)W      u  
 
9dk4:txH
 
 
 
 
 	 YFVVVV4;
DH2UVVVVV tr$   r   r   c                 r    | g n3t          |                                                                           gS )zSReturn list with string for command to change device color (empty list if no color))r   r   lower)r   s    r%   get_change_fill_color_commandz,TableCellStyle.get_change_fill_color_command0  s;    
 } B)%00::<<BBDDE	
r$   Nr   r   r   r   r   r   
fill_colorc           
      `   |j         |z
  }|j         |z
  }|j        }||z  }||z  }||z  }||z  }|                                 }||                     ||||||          n9|du r|                     ||||||          n|                     ||||||||          \  }	}
|
rt          |	          }	|	S )z
        Get list of primitive commands to draw the cell border for this cell, and fill it with the
        given fill color.
        NF)hr   r   _draw_when_no_common_style_draw_with_no_border_draw_all_borders_the_samer   )ry   r   r   r   r   r   r   r   common_border_styler   
needs_wraps              r%   r   z TableCellStyle.get_draw_commands9  s     URZURZ
e
e
e
e";;== #* ++BBCLLL '%// ))"b"b#zJJJ44BCU<O  	"z  	A1-@@Mr$   c           
         d}g }|`||j         k    r*d}|                    |                     |                     |                    |dd|dd||z
  dd||z
  dd           |                    t                              | j                                      |||||          t                              | j                                      |||||          z   t                              | j	                                      |||||          z   t                              | j
                                      |||||          z              ||fS )zIGet draw commands for case when some of the borders have different stylesFNTr   r    re f)r   extendr   r   r   r   r   r   r   r   r   	ry   r   r   r   r   r   r   r   r   s	            r%   r   z)TableCellStyle._draw_when_no_common_styleb  s~    
#%!S^++!
$$T%G%G
%S%STTT  B!V!V!VR!V!V!Vb2g!V!V!VBG!V!V!V!VWWW&&ty11CCCRQSUWXX((55GGRR  ((44FFRR 	 ((22DDRR 		
 	
 	
 j((r$   c           
          d}g }|`||j         k    r*d}|                    |                     |                     |                    |dd|dd||z
  dd||z
  dd           ||fS )zFGet draw commands for case when all of the borders are off / not drawnFNTr   r   r  )r   r  r   r   r  s	            r%   r   z#TableCellStyle._draw_with_no_border  s     
#%!S^++!
$$T%G%G
%S%STTT  B!V!V!VR!V!V!Vb2g!V!V!VBG!V!V!V!VWWWj((r$   r   r   c	           
         d}	g }
t          |t                    r?|                    |          r*|
                    |                    |                     d}	|a||j        k    r*d}	|
                    |                     |                     |
                    |dd|dd||z
  dd||z
  dd           n+|
                    |dd|dd||z
  dd||z
  dd           |
|	fS )zCGet draw commands for case when all the borders have the same styleFTNr   r   z re Bz re S)r4   r   r   r  r   r   r   r   )ry   r   r   r   r   r   r   r   r   r   r   s              r%   r   z)TableCellStyle._draw_all_borders_the_same  sC    
#%!1
 
 	!0055	   !4!O!OPU!V!VWWWJ!S^++!
$$T%G%G
%S%STTT  B!V!V!VR!V!V!Vb2g!V!V!VBG!V!V!V!VWWWW   B!V!V!VR!V!V!Vb2g!V!V!VBG!V!V!V!VWWWj((r$   cell_borderc           	         |t           j        k    r| nzt          t          |t           j        z            t          |t           j        z            t          |t           j        z            t          |t           j        z                      S )z-Allow override by CellBordersLayout mechanismr   r   r   r   )r   r   r   r>   rW   rk   rX   rj   )ry   r  s     r%   override_cell_borderz#TableCellStyle.override_cell_border  s     /777 D+(9(>>??K*;*BBCC;):)@@AA'8'<<==	  		
r$   c                     |                     d                    |                     ||||||                               dS )z\
        Draw the cell border for this cell, and fill it with the given fill color.
        r   )r   N)_outr{   r   )ry   r   r   r   r   r   r   s          r%   draw_cell_borderzTableCellStyle.draw_cell_border  sN     	HHT++CRRJ+WWXX	
 	
 	
 	
 	
r$   rv   )r   r   r    r<   r   r>   r   r   r   r   r   r   r   r   r   r5   r   r   r   r   r   r   r   r   r   r	  r  r#   r$   r%   r   r     s^          %*D$!
!)))&+FD##+++%*E4""***#(C 	 ((((4:J3J*K    * 
U7C<-@ 
T#Y 
 
 
 \
 59' '' ' 	'
 ' ' U7C<01' 
c' ' ' 'R)) ) 	)
 ) ) U7C<01) 
tCy$	) ) ) )B)) ) 	)
 ) ) U7C<01) 
tCy$	) ) ) )()) ) 	)
 ) ) U7C<01) ) &&6&=>) 
tCy$	) ) ) )@
0A 
FV 
 
 
 
( 59
 

 
 	

 
 
 U7C<01
 

 
 
 
 
 
r$   r   c                       e Zd ZU dZed          ed<   ed          ed<   ed          ed<   ed          ed<   ed          ed<   ed          ed<   ed          ed<   ej        d	ed
edededededede	fd            Z
eded ef         dd fd            ZdS )TableBordersLayoutah  
    Customizable class for setting the drawing style of cell borders for the whole table.
    cell_style_getter is an abstract method that derived classes must implement. All current classes
    do not use self, but it is available in case a very complicated derived class needs to refer to
    stored internal data.

    Standard TableBordersLayouts are available as static members of this class

    Attributes:
        cell_style_getter: a callable that takes row_num, column_num,
            num_heading_rows, num_rows, num_columns; and returns the drawing style of
            the cell border (as a TableCellStyle object)
        ALL: static TableBordersLayout that draws all table cells borders
        NONE: static TableBordersLayout that draws no table cells borders
        INTERNAL: static TableBordersLayout that draws only internal horizontal & vertical borders
        MINIMAL: static TableBordersLayout that draws only the top horizontal border, below the
            headings, and internal vertical borders
        HORIZONTAL_LINES: static TableBordersLayout that draws only horizontal lines
        NO_HORIZONTAL_LINES: static TableBordersLayout that draws all cells border except interior
            horizontal lines after the headings
        SINGLE_TOP_LINE: static TableBordersLayout that draws only the top horizontal border, below
            the headings
    r   r   INTERNALMINIMALHORIZONTAL_LINESNO_HORIZONTAL_LINESSINGLE_TOP_LINErow_idxcol_idxcol_posnum_heading_rowsnum_rowsnum_col_idxnum_col_posr1   c                     t           )ar  Specify the desired TableCellStyle for the given position in the table

        Args:
            row_idx: the 0-based index of the row in the table
            col_idx: the 0-based logical index of the cell in the row. If colspan > 1, this indexes
                into non-null cells. e.g. if there are two cells with colspan = 3, then col_idx will
                be 0 or 1
            col_pos: the 0-based physical position of the cell in the row. If colspan > 1, this
                indexes into all cells including null ones. e.g. e.g. if there are two cells with
                colspan = 3, then col_pos will be 0 or 3
            num_heading_rows: the number of rows in the table heading
            num_rows: the total number of rows in the table
            num_col_idx: the number of non-null cells. e.g. if there are two cells with colspan = 3,
                then num_col_idx = 2
            num_col_pos: the full width of the table in physical cells. e.g. if there are two cells
                with colspan = 3, then num_col_pos = 6
        Returns:
            TableCellStyle for the given position in the table
        )NotImplementedErrorry   r  r  r  r  r  r  r  s           r%   cell_style_getterz$TableBordersLayout.cell_style_getter  s
    < "!r$   r/   c                    t          ||           r|S t          |t                    rF	 t          | |                                          }t          ||           r|S n# t          $ r Y nw xY wt	          | d| j                   )a  
        Attempt to coerce `value` into a member of this class.

        If value is already a member of this enumeration it is returned unchanged.
        Otherwise, if it is a string, attempt to convert it as an enumeration value. If
        that fails, attempt to convert it (case insensitively, by upcasing) as an
        enumeration name.

        If all different conversion attempts fail, an exception is raised.

        Args:
            value (Enum, str): the value to be coerced.

        Raises:
            ValueError: if `value` is a string but neither a member by name nor value.
            TypeError: if `value`'s type is neither a member of the enumeration nor a
                string.
        r3   )r4   r5   getattrr7   r6   r   )r.   r/   coerced_values      r%   r:   zTableBordersLayout.coerce  s    * eS!! 	LeS!! 	 'U[[]] ; ;mS11 )(()    EAA3<AABBBs   3A 
A+*A+N)r   r   r    r<   r
   r   abcabstractmethodrC   r   r  r=   r   r5   r:   r#   r$   r%   r  r    sR         0 
&	''''
'
((((+,,,,*++++34444!"6777723333"" " 	"
 " " " " 
" " " "> C5!5s!:; C@T C C C [C C Cr$   r  c                   :    e Zd ZdZdededededededed	efd
ZdS )TableBordersLayoutAllz"Class for drawing all cell bordersr  r  r  r  r  r  r  r1   c                 (    t          dddd          S )NTr  r   r  s           r%   r  z'TableBordersLayoutAll.cell_style_getter<  s     4DdKKKKr$   Nr   r   r    r<   rC   r   r  r#   r$   r%   r%  r%  9  s        ,,
L
L 
L 	
L
 
L 
L 
L 
L 

L 
L 
L 
L 
L 
Lr$   r%  c                   :    e Zd ZdZdededededededed	efd
ZdS )TableBordersLayoutNonez#Class for drawing zero cell bordersr  r  r  r  r  r  r  r1   c                 (    t          dddd          S )NFr  r'  r  s           r%   r  z(TableBordersLayoutNone.cell_style_getterP  s     5eOOOOr$   Nr(  r#   r$   r%   r*  r*  M  s        --
P
P 
P 	
P
 
P 
P 
P 
P 

P 
P 
P 
P 
P 
Pr$   r*  c                   :    e Zd ZdZdededededededed	efd
ZdS )TableBordersLayoutInternalz9Class to draw only internal horizontal & vertical bordersr  r  r  r  r  r  r  r1   c                 T    t          |dk    ||dz
  k     ||dz
  k     |dk              S Nr   r   r  r'  r  s           r%   r  z,TableBordersLayoutInternal.cell_style_getterd  sA     1X\)K!O+!	
 
 
 	
r$   Nr(  r#   r$   r%   r-  r-  a  s|        CC

 
 	

 
 
 
 
 

 
 
 
 
 
r$   r-  c                   :    e Zd ZdZdededededededed	efd
ZdS )TableBordersLayoutMinimalzi
    Class to draw only the top horizontal border, below the headings, and internal vertical borders
    r  r  r  r  r  r  r  r1   c                 b    t          |dk    ||k     ||dz
  k     d|cxk     o|k    nc           S r/  r'  r  s           r%   r  z+TableBordersLayoutMinimal.cell_style_getter  sW     1--K!O+G/////////	
 
 
 	
r$   Nr(  r#   r$   r%   r1  r1  z  s         

 
 	

 
 
 
 
 

 
 
 
 
 
r$   r1  c                   :    e Zd ZdZdededededededed	efd
ZdS )!TableBordersLayoutHorizontalLinesz#Class to draw only horizontal linesr  r  r  r  r  r  r  r1   c                 >    t          d||dz
  k     d|dk              S )NFr   r   r  r'  r  s           r%   r  z3TableBordersLayoutHorizontalLines.cell_style_getter  s4     X\)!	
 
 
 	
r$   Nr(  r#   r$   r%   r4  r4    s|        --

 
 	

 
 
 
 
 

 
 
 
 
 
r$   r4  c                   :    e Zd ZdZdededededededed	efd
ZdS )#TableBordersLayoutNoHorizontalLineszRClass to draw all cells border except interior horizontal lines after the headingsr  r  r  r  r  r  r  r1   c                 >    t          d||dz
  k    d||k              S )NTr   r  r'  r  s           r%   r  z5TableBordersLayoutNoHorizontalLines.cell_style_getter  s6     hl*++	
 
 
 	
r$   Nr(  r#   r$   r%   r7  r7    s|        \\

 
 	

 
 
 
 
 

 
 
 
 
 
r$   r7  c                   :    e Zd ZdZdededededededed	efd
ZdS )TableBordersLayoutSingleTopLinezClass to draw a single top liner  r  r  r  r  r  r  r1   c                 6    t          d||dz
  k    dd          S )NFr   r  r'  r  s           r%   r  z1TableBordersLayoutSingleTopLine.cell_style_getter  s0     w*:Q*>>eQV
 
 
 	
r$   Nr(  r#   r$   r%   r:  r:    s|        ))

 
 	

 
 
 
 
 

 
 
 
 
 
r$   r:  c                   &    e Zd ZdZdededefdZdS )CellFillProtocolz0Protocol for custom table cell fill mode classesijr1   c                     d S rv   r#   ry   r>  r?  s      r%   should_fill_cellz!CellFillProtocol.should_fill_cell  s      r$   N)r   r   r    r<   rC   r>   rB  r#   r$   r%   r=  r=    s1        ::;#;#;$;;;;;;r$   r=  z$TableCellFillMode | CellFillProtocolTableCellFillModeTypec                        e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z		  ed          Z
	 e	 dd	eeef         d
edef fd            ZdededefdZ xZS )TableCellFillModez!Defines which table cells to fillr   r   ROWSCOLUMNS	EVEN_ROWSEVEN_COLUMNSFr/   r0   r1   c                     t          t          |dd                     rt          t          |          S t	                                          ||          S )NrB  )callabler   r   r=  r^   r:   r_   s      r%   r:   zTableCellFillMode.coerce  sK     GE#5t<<== 	1(%000ww~~e^444r$   r>  r?  c                    | t           j        u rdS | t           j        u rdS | t           j        u r	|dz  dk    S | t           j        u r	|dz  dk    S | t           j        u r	|dz  dk    S | t           j        u r	|dz  dk    S t          )NFTr   r   r   )rE  r   r   rF  rG  rH  rI  r  rA  s      r%   rB  z"TableCellFillMode.should_fill_cell  s    $)))5$(((4$)))q5A:$,,,q5A:$...q5A:$111q5A:!!r$   r;   )r   r   r    r<   r   r   r   rF  rG  rH  rI  r=   r   rC  r5   r>   r:   rC   rB  re   rf   s   @r%   rE  rE    s       ''6&>>D
&--C6&>>D'fYG*{##I(6.))L+  %5 5*C/05 5 
	5 5 5 5 5 [5"# "# "$ " " " " " " " "r$   rE  c                   <    e Zd Z ed          Z	  ed          ZdS )	TableSpanROWCOLN)r   r   r    r   rO  rP  r#   r$   r%   rN  rN    s-        
&--C:
&--C==r$   rN  c                       e Zd ZdZdZ	 dZdS )TableHeadingsDisplayz2Defines how the table headings should be displayedr   r   N)r   r   r    r<   r   ON_TOP_OF_EVERY_PAGEr#   r$   r%   rR  rR    s$        88DE__r$   rR  c                        e Zd ZdZ ed          Z	  ed          Z	  ed          Z	 ede	fd            Z
edefd            Zedefd            Ze	 dd
ed e	f         dedd f fd            Z xZS )RenderStylezDefines how to render shapesDRAWFILL	DRAW_FILLr1   c                 Z    t           j        dt           j        dt           j        di|          S )Nr   fro   )rU  DFDFr~   s    r%   operatorzRenderStyle.operator:  s     sKM3LTRRr$   c                 6    | t           j        t           j        fv S rv   )rU  r[  r]  r~   s    r%   is_drawzRenderStyle.is_draw>      {~666r$   c                 6    | t           j        t           j        fv S rv   )rU  r\  r]  r~   s    r%   is_fillzRenderStyle.is_fillB  ra  r$   Fr/   r0   c                 n    |s| j         S |dk    rd}t          | |                               ||          S )NFDr]  )r[  r^   r:   r_   s      r%   r:   zRenderStyle.coerceF  sG      	5LD==ES#%%>
 
 	
r$   r;   )r   r   r    r<   r   r[  r\  r]  r   r5   r^  r>   r`  rc  r=   r   r:   re   rf   s   @r%   rU  rU  '  s+       ""vA 	vA
 
		BS# S S S XS 7 7 7 7 X7 7 7 7 7 X7 FK	
 	
-,-	
?C	
		
 	
 	
 	
 	
 [	
 	
 	
 	
 	
r$   rU  c                   2    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
S )TextModez:Values described in PDF spec section 'Text Rendering Mode'r   r   r      rr            N)r   r   r    r<   rW  STROKEFILL_STROKE	INVISIBLE	FILL_CLIPSTROKE_CLIPFILL_STROKE_CLIPCLIPr#   r$   r%   rg  rg  S  s=        @@DFKIIKDDDr$   rg  c                       e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z		  ed          Z
	  ed          Z	  ed	          Zd
S )XPoszFPositional values in horizontal direction for use after printing text.rW   rX   STARTENDWCONTrU   LMARGINRMARGINN)r   r   r    r<   r   rW   rX   ru  rv  rw  rU   rx  ry  r#   r$   r%   rt  rt  `  s        LL6&>>DF7OOE%F7OOE
&--CF7OOE9VHFfYG0fYG//r$   rt  c                       e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z	dS )YPoszCPositional values in vertical direction for use after printing textrj   LASTNEXTTMARGINBMARGINN)
r   r   r    r<   r   rj   r|  r}  r~  r  r#   r$   r%   r{  r{  |  sg        II
&--C%6&>>D=6&>>D/fYG/fYG00r$   r{  c                   2    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
S )AnglezTDirection values used for mirror transformations specifying the angle of mirror lineZ   r   i     -   i;        N)r   r   r    r<   NORTHEASTSOUTHWEST	NORTHEAST	SOUTHEAST	SOUTHWEST	NORTHWESTr#   r$   r%   r  r    s<        ZZEDEDIIIIIIr$   r  c                       e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z		  ed          Z
dS )	
PageLayoutzASpecify the page layout shall be used when the document is opened
SinglePage	OneColumnTwoColumnLeftTwoColumnRightTwoPageLeftTwoPageRightN)r   r   r    r<   r   SINGLE_PAGE
ONE_COLUMNTWO_COLUMN_LEFTTWO_COLUMN_RIGHTTWO_PAGE_LEFTTWO_PAGE_RIGHTr#   r$   r%   r  r    s        GG$|$$K k""J%d?++OKt,--LD''MJT.))NKKr$   r  c                       e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z		  ed          Z
dS )	PageModezBSpecifying how to display the document on exiting full-screen modeUseNoneUseOutlines	UseThumbs
FullScreenUseOCUseAttachmentsN)r   r   r    r<   r   USE_NONEUSE_OUTLINES
USE_THUMBSFULL_SCREENUSE_OCUSE_ATTACHMENTSr#   r$   r%   r  r    s|        HHtIH;4&&Lk""J$|$$KVT']]F*d+,,Or$   r  c                   j    e Zd ZdZ ed          Z ed          Z ed          Z ed          ZdS )TextMarkupTypez#Subtype of a text markup annotation	Highlight	UnderlineSquiggly	StrikeOutN)	r   r   r    r<   r   	HIGHLIGHTr   SQUIGGLY
STRIKE_OUTr#   r$   r%   r  r    sP        ))[!!I[!!ItJHk""JJJr$   r  c                      e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z		  ed          Z
	  ed          Z	  ed	          Z	  ed
          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          ZdS )	BlendModezLAn enumeration of the named standard named blend functions supported by PDF.NormalMultiplyScreenOverlayDarkenLighten
ColorDodge	ColorBurn	HardLight	SoftLight
Difference	ExclusionHue
Saturationr   
LuminosityN)r   r   r    r<   r   NORMALMULTIPLYSCREENOVERLAYDARKENLIGHTENCOLOR_DODGE
COLOR_BURN
HARD_LIGHT
SOFT_LIGHT
DIFFERENCE	EXCLUSIONHUE
SATURATIONCOLOR
LUMINOSITYr#   r$   r%   r  r    sQ       RRT(^^F<tJH<T(^^F d9ooG T(^^FAd9ooGB$|$$K k""J k""J k""J l##JV[!!I
 $u++C l##J
 DMME
 l##J r$   r  c                   0   e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z		  ed          Z
	  ed          Z	  ed	          Z	  ed
          Z	  ed          Z	  ed          Z	  ed          ZdS )CompositingOperationz5An enumeration of Porter-Duff compositing operations.ClearSourceDestination
SourceOverDestinationOverSourceInDestinationIn	SourceOutDestinationOut
SourceAtopDestinationAtopXORN)r   r   r    r<   r   CLEARSOURCEDESTINATIONSOURCE_OVERDESTINATION_OVER	SOURCE_INDESTINATION_IN
SOURCE_OUTDESTINATION_OUTSOURCE_ATOPDESTINATION_ATOPr  r#   r$   r%   r  r    s        ;;DMMET(^^F $}%%K%$|$$K>t-..>Z  IiT/**Nik""JUd+,,OU$|$$K Ct-.. C
$u++CUUr$   r  c                   H    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S )AnnotationFlagr   r   rr   rs   r       @            N)r   r   r    rn  HIDDENPRINTNO_ZOOM	NO_ROTATENO_VIEW	READ_ONLYLOCKEDTOGGLE_NO_VIEWLOCKED_CONTENTSr#   r$   r%   r  r  G  si        I FZE<G`I\G_I F NNOUUr$   r  c                       e Zd ZdZ ed          Z ed          Z ed          Z ed          Z ed          Z	 ed          Z
dS )	AnnotationNameCThe name of an icon that shall be used in displaying the annotationNoteCommentHelp	ParagraphNewParagraphInsertN)r   r   r    r<   r   NOTECOMMENTHELP	PARAGRAPHNEW_PARAGRAPHINSERTr#   r$   r%   r  r  g  sf        II4<<Dd9ooG4<<D[!!ID((MT(^^FFFr$   r  c                   T    e Zd ZdZ ed          Z ed          Z ed          ZdS )FileAttachmentAnnotationNamer   PushPinGraphPushPinPaperclipTagN)r   r   r    r<   r   PUSH_PINGRAPH_PUSH_PINPAPERCLIP_TAGr#   r$   r%   r  r  r  s?        IItIHT.))ND((MMMr$   r  c                       e Zd ZdZdZ	 dZdS )IntersectionRulea)  
    An enumeration representing the two possible PDF intersection rules.

    The intersection rule is used by the renderer to determine which points are
    considered to be inside the path and which points are outside the path. This
    primarily affects fill rendering and clipping paths.
    nonzeroevenoddNr   r   r    r<   NONZEROEVENODDr#   r$   r%   r  r  z  s1          G G r$   r  c                   :    e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZ	 dZ		 dZ
d	S )
PathPaintRulezu
    An enumeration of the PDF drawing directives that determine how the renderer should
    paint a given path.
    r   rZ  zf*ro   zB*nautoN)r   r   r    r<   rl  FILL_NONZEROFILL_EVENODDSTROKE_FILL_NONZEROSTROKE_FILL_EVENODD
DONT_PAINTAUTOr#   r$   r%   r  r    sk          FL
 L
   J D r$   r  c                       e Zd ZdZdZ	 dZdS )ClippingPathIntersectionRulezSAn enumeration of the PDF drawing directives that define a path as a clipping path.WzW*Nr  r#   r$   r%   r'  r'    s+        YYG G r$   r'  c                   "    e Zd ZdZdZ	 dZ	 dZdS )StrokeCapStylez
    An enumeration of values defining how the end of a stroke should be rendered.

    This affects the ends of the segments of dashed strokes, as well.
    r   r   r   N)r   r   r    r<   BUTTROUNDSQUAREr#   r$   r%   r*  r*    s=          D E F r$   r*  c                   "    e Zd ZdZdZ	 dZ	 dZdS )StrokeJoinStylezn
    An enumeration of values defining how the corner joining two path components should
    be rendered.
    r   r   r   N)r   r   r    r<   MITERr,  BEVELr#   r$   r%   r/  r/    s=         
 E
 E E r$   r/  c                       e Zd ZdZ ed          Z ed          Z ed          Z ed          Z ed          Z	 ed          Z
 ed          Z ed	          Z ed
          Z ed          ZdS )PDFStyleKeysz?An enumeration of the graphics state parameter dictionary keys.caBMCASALWLCLJMLr[  SMaskN)r   r   r    r<   r   
FILL_ALPHA
BLEND_MODESTROKE_ALPHASTROKE_ADJUSTMENTSTROKE_WIDTHSTROKE_CAP_STYLESTROKE_JOIN_STYLESTROKE_MITER_LIMITSTROKE_DASH_PATTERN	SOFT_MASKr#   r$   r%   r3  r3    s        EEdJdJ4::LT

4::LtDzzT

d$s))WIIIr$   r3  c                       e Zd ZdZdZdZdZdS )Corner	TOP_RIGHTTOP_LEFTBOTTOM_RIGHTBOTTOM_LEFTN)r   r   r    rI  rJ  rK  rL  r#   r$   r%   rH  rH  (  s"        IH!LKKKr$   rH  c                   (    e Zd ZdZdZ	 dZ	 dZ	 dZdS )FontDescriptorFlagszAn enumeration of the flags for the unsigned 32-bit integer entry in the font descriptor specifying various
    characteristics of the font. Bit positions are numbered from 1 (low-order) to 32 (high-order).
    r   rr   r  i   N)r   r   r    r<   FIXED_PITCHSYMBOLICITALIC
FORCE_BOLDr#   r$   r%   rN  rN  /  sI          K
 H
 F J r$   rN  c                   z    e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZ	 dZ		 dZ
	 d	Z	 ed
efd            Zed
efd            ZdS )AccessPermissionzJPermission flags will translate as an integer on the encryption dictionaryrr   rs   r   r  r  r  i   i   r1   c                 P    d}t          t                    D ]}|}||j        z  }|S )zAll flags enabledr   )r   rT  r/   )r.   result
permissionaccess_permissions       r%   r   zAccessPermission.allh  s<     /00 	6 	6J */55FFr$   c                     dS )zAll flags disabledr   r#   )r.   s    r%   nonezAccessPermission.noneq  s	     qr$   N)r   r   r    r<   PRINT_LOW_RESMODIFYCOPY
ANNOTATION
FILL_FORMSCOPY_FOR_ACCESSIBILITYASSEMBLEPRINT_HIGH_RESr=   rC   r   rZ  r#   r$   r%   rT  rT  M  s        PP"MF)D9J$J.+VHM#N.C    [ S    [  r$   rT  c                   "    e Zd ZdZdZdZdZdZdS )EncryptionMethodz,Algorithm to be used to encrypt the documentr   r   r   rh  N)r   r   r    r<   NO_ENCRYPTIONRC4AES_128AES_256r#   r$   r%   rd  rd  w  s(        22M
CGGGGr$   rd  c                   p    e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          ZdS )TextDirectionz)Text rendering direction for text shapingLTRRTLTTBBTTN)	r   r   r    r<   r   rk  rl  rm  rn  r#   r$   r%   rj  rj    sR        //
&--C
&--C
&--C
&--COr$   rj  c                   X    e Zd ZdZ ed          Z	  ed          Z	  ed          ZdS )OutputIntentSubTypez%Definition for Output Intent SubtypesGTS_PDFX	GTS_PDFA1	ISO_PDFE1N)r   r   r    r<   r   PDFXPDFAISOPDFr#   r$   r%   rp  rp    sI        ++4
D24D6T+F66r$   rp  c                       e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z		 dZ
dS )PageLabelStylezStyle of the page labelr[  rc   rAaN)r   r   r    r<   r   NUMBERUPPER_ROMANLOWER_ROMANUPPER_LETTERLOWER_LETTERr   r#   r$   r%   rx  rx    sj        VC[[F&++K&++K6#;;L>6#;;L>DJr$   rx  c                   X    e Zd ZdZ ed          Z	  ed          Z	  ed          ZdS )DuplexzZThe paper handling option that shall be used when printing the file from the print dialog.SimplexDuplexFlipShortEdgeDuplexFlipLongEdgeN)r   r   r    r<   r   SIMPLEXDUPLEX_FLIP_SHORT_EDGEDUPLEX_FLIP_LONG_EDGEr#   r$   r%   r  r    sK        ``d9ooG!T"7884 D!56633r$   r  c                   |    e Zd Z ed          Z ed          Z ed          Z ed          Z ed          ZdS )PageBoundariesArtBoxBleedBoxCropBoxMediaBoxTrimBoxN)	r   r   r    r   ART_BOX	BLEED_BOXCROP_BOX	MEDIA_BOXTRIM_BOXr#   r$   r%   r  r    sS        d8nnGZ  ItIHZ  ItIHHHr$   r  c                   |     e Zd Z ed          Z ed          Ze	 dded ef         de	dd f fd            Z
 xZS )	PageOrientationPr]   Fr/   r0   r1   c                     t          |t                    r|                                }t          | |                               ||          S rv   )r4   r5   r7   r^   r:   r_   s      r%   r:   zPageOrientation.coerce  sI     eS!! 	"KKMMES#%%>
 
 	
r$   r;   )r   r   r    r   PORTRAIT	LANDSCAPEr=   r   r5   r>   r:   re   rf   s   @r%   r  r    s        vc{{HsIJO
 
+S01
CG
	
 
 
 
 
 [
 
 
 
 
r$   r  c                       e Zd Z ed          Z ed          Z ed          Z ed          Z ed          Z ed          Z	 ed          Z
 ed          Zd	S )
PDFResourceType	ExtGState
ColorSpacePatternShadingXObjectFontProcSet
PropertiesN)r   r   r    r   EXT_G_STATECOLOR_SPACEPATTERNSHADINGX_OBJECTFONTPROC_SET
PROPERTIESr#   r$   r%   r  r    s        &%%K&&&KfYGfYGvi  H6&>>Dvi  H%%JJJr$   r  c                       e Zd ZdZdZ	 dZdS )GradientUnitsz.Specifies the coordinate system for gradients.objectBoundingBoxuserSpaceOnUseN)r   r   r    r<   OBJECT_BOUNDING_BOXUSER_SPACE_ON_USEr#   r$   r%   r  r    s%        44-g(11r$   r  c                   "    e Zd ZdZdZ	 dZ	 dZdS )GradientSpreadMethodzKSpecifies how to fill the area outside the gradient's start and end points.padreflectrepeatN)r   r   r    r<   PADREFLECTREPEATr#   r$   r%   r  r    s+        QQ
CoGrFhhr$   r  c                       e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zed
efd            Zed
efd            Zed
ee         fd            Zed
efd            Zd
efdZeded ef         d
d fd            ZdS )DocumentCompliancea  
    Type of compliance enforcement that can be applied to a document.
    Limited to PDF/A at the moment, but extendable to other standards like:
        - PDF/E (Engineering PDFs)
        - PDF/UA (PDF Universal Accessibility)
        - PDF/X (Graphics Exchange PDFs)
    )ru  r   ro   )ru  r   ro   )ru  r   r   )ru  rh  ro   )ru  rh  r   )ru  rr   N)ru  rr   r&   )ru  rr   r\  r1   c                 6    t          | j        d                   S )Nr   )r5   r/   r~   s    r%   profilezDocumentCompliance.profile      4:a=!!!r$   c                 6    t          | j        d                   S )Nr   )rC   r/   r~   s    r%   partzDocumentCompliance.part  r  r$   c                 T    | j         d         t          | j         d                   nd S )Nr   )r/   r5   r~   s    r%   conformancezDocumentCompliance.conformance  s&    %)Z]%>s4:a=!!!DHr$   c                 b    | j         dk    rdn| j         }| d| j         | j        r| j        nd S )Nru  zPDF/A-r\   r  r  r  )ry   r  s     r%   labelzDocumentCompliance.label  sE    !\V33''UUDIU4;K'St'7'7QSUUUr$   c                 D    | j          d| j         | j        r| j        nd S )N_r\   r  r~   s    r%   r   zDocumentCompliance.__str__  s2    |WWdiWT=M)U)9)9SUWW	
r$   r/   c                 :   t          ||           r|S t          |t                    r[|                                }| D ]D}|j                                        |k    r|c S |j                                        |k    r|c S Et          d|d| j                   )NzCannot coerce z to )r4   r5   r7   rx   r  r6   r   )r.   r/   keyms       r%   r:   zDocumentCompliance.coerce!  s    eS!! 	LeS!! 	++--C  6<<>>S((HHH7==??c))HHH *E%EEs|EEFFFr$   N)r   r   r    r<   PDFA_1BPDFA_2BPDFA_2UPDFA_3BPDFA_3UPDFA_4PDFA_4EPDFA_4Fr   r5   r  rC   r  r   r  r  r   r=   r   r:   r#   r$   r%   r  r    sM         GGGGGFGG" " " " X" "c " " " X" IXc] I I I XI Vs V V V XV
 
 
 
 

 
G5!5s!:; 
G@T 
G 
G 
G [
G 
G 
Gr$   r  c                       e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z		  ed          Z
	  ed          Z	  ed	          Zd
S )AssociatedFileRelationshipzNRepresents the association between an embedded file and the content on the PDFr  DataAlternative
SupplementEncryptedPayloadFormDataSchemaUnspecifiedN)r   r   r    r<   r   r  DATAALTERNATIVE
SUPPLEMENTENCRYPTED_PAYLOAD	FORM_DATASCHEMAUNSPECIFIEDr#   r$   r%   r  r  /  s        XXVHF=6&>>D
 &''K?%%J
 122 z""IQVHF?&''K r$   r  )gr"  dataclassesr   enumr   r   r   r   sysr   typingr	   r
   r   r   r   r   r   r   r   drawing_primitivesr   syntaxr   r   r   r   r   r   fpdfr   r   r&   r)   r+   r'   r*   r,   rI   rM   rT   rh   rq   r   r   r   r   ABCr  r%  r   r*  r   r-  r  r1  r  r4  r  r7  r  r:  r  r=  rC  r   rE  rN  rR  rU  rg  rt  r{  r  r  r  r  r  r  r  r  r  r  r  r'  r*  r/  r3  rH  rN  rT  rd  rj  rp  rx  r  r  r  r  r  r  r  r  r#   r$   r%   <module>r     s   




 ! ! ! ! ! ! - - - - - - - - - - - -      
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 8 7 7 7 7 7 / / / / / / / / LLLLLLLLLLLL    G    GC~&&&WT*+++WT*+++'L 'L 'L 'L 'L4 'L 'L 'LT'G 'G 'G 'G 'Gg 'G 'G 'GT-G -G -G -G -Gg -G -G -G`    |       |   &
 
 
 
 
L 
 
 
>
 
 
 
 
\ 
 
 
02- 2- 2- 2- 2-? 2- 2- 2-j> > > > > > > >$A= A= A= A= A= A= A= A=H {5 {5 {5 {5 {5 {5 {5 {5| F
 F
 F
 F
 F
 F
 F
 F
RaC aC aC aC aC aC aC aCHL L L L L. L L L" /.00  P P P P P/ P P P" 1022  
 
 
 
 
!3 
 
 
, 98::  
 
 
 
 
 2 
 
 
0 7688  
 
 
 
 
(: 
 
 
, 'H&G&I&I  #
 
 
 
 
*< 
 
 
, *M)L)N)N  &
 
 
 
 
&8 
 
 
& &E%D%F%F  "< < < < <x < < < $J y I I I," ," ," ," ," ," ," ,"^> > > > > > > >` ` ` ` `? ` ` `)
 )
 )
 )
 )
, )
 )
 )
X
 
 
 
 
 
 
 
0 0 0 0 0< 0 0 081 1 1 1 1< 1 1 1&
 
 
 
 
O 
 
 
L L L L L L L L,         |      ,	# 	# 	# 	# 	#\ 	# 	# 	#H H H H H H H HV%V %V %V %V %V< %V %V %VPV V V V V_ V V V@    \   ) ) ) ) )< ) ) )    |   >3 3 3 3 3L 3 3 3l    <   0    _   0    o   4    4            \          $   <' ' ' ' 'w ' ' 'T    t       L    
7 
7 
7 
7 
7, 
7 
7 
7    \   ,
4 
4 
4 
4 
4\ 
4 
4 
4    \   
 
 
 
 
l 
 
 
& & & & &d & & &2 2 2 2 2L 2 2 2
i 
i 
i 
i 
i< 
i 
i 
i3G 3G 3G 3G 3G 3G 3G 3Gl& & & & & & & & & &r$   