
    HAiT                     0   S r SrSSKrSSKrSSKrSSKJr  SSKJr  SSK	J
r
JrJrJrJrJrJrJrJrJrJr  SSKJrJrJr  SS	KJrJrJrJrJrJrJ r J!r!J"r"  SS
K#J$r$J%r%J&r&  SSK#J'r(  SSK#J)r*  SSK#J+r,  SSK#J-r.  SSK/J0r0J1r1J2r2  SSK3J4r4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=  SSK>J?r?  SSK@JArAJBrBJCrCJDrDJErE  SSKJFrFJGrG  \R                  S:  a  SSK	JIrI  OSSKJJIrI  \R                  " \L5      rM\R                  " S5      rO " S S\\
   \;5      rP " S S\\
\
4   \;5      rQ " S S\Q5      rRS\
SS4S  jrS " S! S"\Q5      rT " S# S$\T5      rU " S% S&\T5      rV " S' S(\U5      rW S1S)\S*\\   S+\S\X\\X   \\Y\X4   4   S\\;\Y\X\W4   4S, jjrZ " S- S.\R5      r[ " S/ S0\R5      r\g)2zMathieu Fenniakzbiziqe@mathieu.fenniak.net    N)BytesIO)ceil)AnyCallableDictIterableListOptionalSequenceSetTupleUnioncast   )PdfReaderProtocolPdfWriterProtocolXmpInformationProtocol)	WHITESPACES
StreamTypedeprecation_no_replacementdeprecation_with_replacementlogger_warningread_non_whitespaceread_until_regexread_until_whitespaceskip_over_comment)CheckboxRadioButtonAttributesFieldDictionaryAttributesOutlineFontFlag)FilterTypes)StreamAttributes)TypArguments)TypFitArguments)STREAM_TRUNCATED_PREMATURELYPdfReadErrorPdfStreamError   )
BooleanObjectByteStringObjectFloatObjectIndirectObject
NameObject
NullObjectNumberObject	PdfObjectTextStringObjectis_null_or_none)Fit)extract_inline_A85extract_inline_AHxextract_inline_DCTextract_inline_defaultextract_inline_RL)read_hex_string_from_streamread_string_from_stream)      )Selfs   [+-]?(\d+)\s+(\d+)\s+R[^a-zA-Z]c                   D   \ rS rSrS\SS 4S jr  SS\S\S\\\	\
\4         SS 4S jjrS\4S	 jrS\\   4S
 jrS\S\\   4S jrS\SS 4S jrS\S\4S jrS\S\4S jr SS\S\	S\
\4   SS4S jjr\ SS\S\\   S\	S\
\\
   \\\
4   4   SS 4S jj5       rSrg)ArrayObjecth   pdf_destreturnc                     [        SU R                  [        5       US5      5      nU  HG  n[        US5      (       a"  UR	                  UR                  U5      5        M6  UR	                  U5        MI     U$ )Nr>   F	replicate)r   _reference_cloner>   hasattrappendrC   )selfr@   arrdatas       Z/var/www/html/land-ocr/venv/lib/python3.13/site-packages/pypdf/generic/_data_structures.pyrC   ArrayObject.replicatei   sf     !!+-5A
 Dt[))

4>>(34

4 	 
 
     force_duplicateignore_fieldsc                     U R                   R                  U:X  a	  U(       d  U $ [        SU R	                  [        5       X5      5      nU  H  n[        U[        5      (       a@  UR	                  UR                  XU5      UU5      nUR                  UR                   5        MX  [        US5      (       a#  UR                  UR                  XU5      5        M  UR                  U5        M     U$ ! [         a     Nf = f)Clone object into pdf_dest.r>   clone)indirect_referencepdf	Exceptionr   rD   r>   
isinstanceStreamObjectrR   rF   rE   )rG   r@   rN   rO   rH   rI   dups          rJ   rR   ArrayObject.clonex   s    	&&**h6 !!+-K
 D$--++JJx-H#
 

3112w''

4::hOP

4   
%  		s   "C. .
C;:C;c                 P    [        U R                  [        S U  5       5      45      $ )Q
Used to detect modified object.

Returns:
    Hash considering type and value.

c              3   @   #    U  H  oR                  5       v   M     g 7fNhash_bin).0xs     rJ   	<genexpr>'ArrayObject.hash_bin.<locals>.<genexpr>   s     *FA::<<s   )hash	__class__tuplerG   s    rJ   r_   ArrayObject.hash_bin   s#     T^^U*F*F%FGHHrL   c                     [        U 5      $ )z:Emulate DictionaryObject.items for a list (index, object).)	enumeraterg   s    rJ   itemsArrayObject.items   s    rL   lstc                 B   [        U[        [        [        45      (       a   U$ [        U[        5      (       a  U/nU$ [        U[
        5      (       a&  US   S:X  a  [        U5      /nU$ [        U5      /n U$ [        U[        5      (       a  [        U5      /nU$ U/nU$ )Nr   /)
rV   listrf   setr/   strr,   r0   bytesr)   rG   rm   s     rJ   _to_lstArrayObject._to_lst   s    cD%-.. 
 Y''%C 
 S!!1v}!#' 
 (,-
 
	 U###C()C 
 %C
rL   c                 \    [        U 5      nUR                  U R                  U5      5        U$ )aw  
Allow extension by adding list or add one element only

Args:
    lst: any list, tuples are extended the list.
    other types(numbers,...) will be appended.
    if str is passed it will be converted into TextStringObject
    or NameObject (if starting with "/")
    if bytes is passed it will be converted into ByteStringObject

Returns:
    ArrayObject with all elements

)r>   extendru   )rG   rm   temps      rJ   __add__ArrayObject.__add__   s(     4 DLL%&rL   c                 F    U R                  U R                  U5      5        U $ )aL  
 Allow extension by adding list or add one element only

Args:
    lst: any list, tuples are extended the list.
    other types(numbers,...) will be appended.
    if str is passed it will be converted into TextStringObject
    or NameObject (if starting with "/")
    if bytes is passed it will be converted into ByteStringObject

)rx   ru   rt   s     rJ   __iadd__ArrayObject.__iadd__   s     	DLL%&rL   c                     U R                  U5       H  n U R                  U5      nX	 M     U $ ! [         a     M*  f = f)zAllow to remove items)ru   index
ValueError)rG   rm   ra   s      rJ   __isub__ArrayObject.__isub__   sG    c"AJJqMG #   s   /
==Nstreamencryption_keyc                     Ub  [        SS5        UR                  S5        U  H%  nUR                  S5        UR                  U5        M'     UR                  S5        g )N/the encryption_key parameter of write_to_stream5.0.0   [    s    ])r   writewrite_to_stream)rG   r   r   rI   s       rJ   r   ArrayObject.write_to_stream   sW     %&A7 	TDLL  (  	UrL   rT   forced_encodingc                 
   [        5       nU R                  S5      nUS:w  a  [        S5      e U R                  S5      nUR                  5       (       a(  U R                  S5      nUR                  5       (       a  M(  US:X  a   U$ US:X  a  U R	                  SS5        [        U 5        M}  U R	                  SS5        U R                  S5      nUS:X  a   U$ U R	                  SS5        UR                  [        XU5      5        M  )Nr'   r   zCould not read arrayrL      %   ])r>   readr%   isspaceseekr   rF   read_object)r   rT   r   rH   tmptok
peek_aheads          rJ   read_from_streamArrayObject.read_from_stream   s     mkk!n$;566++a.C++--kk!n ++--cz 
 d{B"!&)KKAQJT! 
 KKAJJ{6@A% rL   FrM   r]   )__name__
__module____qualname____firstlineno__r   rC   boolr
   r   r   rr   intrR   r_   r   r   rk   r	   ru   rz   r<   r}   r   r   rs   r   staticmethodr   r   r   __static_attributes__rM   rL   rJ   r>   r>   h   s[   # 
$ !&=?	#   sCx 9:	
 
<I# Ix} 3 49 "3 = &C D C D  MQ 27c58H2I	  HL'( tS$s)T#s(^CD 
	 rL   r>   c                      \ rS rSrS\SS 4S jr  SS\S\S\\\	\
\4         SS 4S jjrS	S S\S\S\\\	\
\4         S
\\\\4      SS4S jrS\4S jrS\S\4S jrSS\
S\S\4S jjrS\S\S\4S jrSS\S\\   S\4S jjrS\S\4S jr\S\\   4S j5       r SS\S\	S\
\4   SS4S jjr\ SS\S\\   S\	S\
\ \
   \!\\
4   4   SS 4S jj5       r"Sr#g)DictionaryObjecti  r@   rA   c                     [        SU R                  U R                  5       US5      5      nU R                  5        H:  u  p4[	        US5      (       a  UR                  U5      OUX#R                  U5      '   M<     U$ )Nr   FrC   )r   rD   re   rk   rE   rC   )rG   r@   d__kvs        rJ   rC   DictionaryObject.replicate  sp     !!$.."2HeD
 JJLDA)0K)@)@H%a H%& ! 
rL   rM   rN   rO   c                 @    U R                   R                  U:X  a	  U(       d  U $ [        5       n[	        SU R                  U R                  5       X5      5      nUc  / n[        UR                  5       5      S:X  a  UR                  XX#U5        U$ ! [         a     Nwf = f)rQ   r   r   )
rS   rT   rU   rq   r   rD   re   lenkeys_clonerG   r@   rN   rO   visitedr   s         rJ   rR   DictionaryObject.clone  s    	&&**h6 ),!!$.."2HN
  Msxxz?aJJtwO
  		s   "B 
BBsrcr   Nc           
        ^^ SnTc   e[        T5      mU[        T5      :  aZ  [        TU   [        5      (       a,  [	        [        TU   5      S::  a  TU	 TU	 MF  TU==   S-  ss'   US-  nU[        T5      :  a  MZ  [        UU4S jS 5       5      (       Ga  [        T5      mS GH  nU GH  n/ n	UT;   d  M  X;  d  M  [        TR                  U5      [        5      (       d  M;  [        TU   [        5      (       d  MU  TR                  SS5      b]  [	        [        TU   5      R                  SS5      b9  TR                  SS5      [	        [        TU   5      R                  SS5      :X  d  M  [	        STU   5      n
U nU
b  [	        SU
R                  U
R                  5       X#5      5      nUR                  bH  UR                  R                  nUR                  R                  nX4U;   a  Sn
OaUR                  X45        U	R!                  X45        Uc   eUR                  U[#        U5      '   Un U
T:X  a  Sn
O[	        SX   5      n
 U
b  M  U	 H  u  nnUR'                  XUTU5        M     GM     GM     TR)                  5        H  u  nnUT;  d  M  [        U[*        5      (       aX  [-        US	5      (       d  SUl        UR/                  X#T5      nUR                  c   eUR                  XR/                  U5      '   M{  X;  d  M  [-        US
5      (       a  UR/                  X#T5      OUU [#        U5      '   M     g! [$         a    Sn
 GNf = f)zx
Update the object from src.

Args:
    src: "DictionaryObject":
    pdf_dest:
    force_duplicate:
    ignore_fields:

r   Nr'   c              3     >#    U  H  nUT;  =(       a    UT;   =(       a    [        TR                  U5      [        5      =(       a    [        TU   [        5      =(       a}    TR	                  S S5      SL =(       db    [        [        TU   5      R	                  S S5      SL =(       d6    TR	                  S S5      [        [        TU   5      R	                  S S5      :H  v   M     g7f)/TypeN)rV   raw_getr+   r   getr   )r`   fieldrO   r   s     rJ   rb   *DictionaryObject._clone.<locals>.<genexpr>U  s      
 8 & 		3;;u-~>	 3u:'78	
 &$. I(#e*599'4HDPI777D)(#e*599'4HI	 8s   C"C%)/Next/Prev/N/V))r   r   )r   r   r   r   rS   rR   )rp   r   rV   r   r   anyr   r+   r   r   rD   re   rS   idnum
generationaddrF   r,   rU   r   rk   rW   rE   rR   )rG   r   r@   rN   rO   r   ra   rm   r   objscur_objprev_objclonr   r   scr   vvs    `  `              rJ   r   DictionaryObject._clone5  sM   ( (((]+#m$$-*C00]1-.!3%a(%a(a A% FA #m$$  
 8
 
 
 !/M9ADSM&s{{1~~FF&s1v/?@@  GGGT2:#$4c!f=AA'4PX"www5#$4c!f=AA'4P Q ?C.A? @D%1#' 2 ' 8 8$+$5$5$7!"$D  $66B(,(?(?(E(E-1-D-D-O-O
$)#6'#A.2G$) 'U,? @ KK8#+#77#76:6M6MHZ]3'+H/#*c>.2G.23Ewz.RG/ &14 %)DAqHH !_mW %)]  :h IIKDAq%a.."1&:;;/3,MJB00<<<.0.C.CD*+] #1g.. =I A'   $- /*./s   7M MMMc                 l    [        U R                  [        S U R                  5        5       5      45      $ )r[   c              3   H   #    U  H  u  pXR                  5       4v   M     g 7fr]   r^   )r`   r   r   s      rJ   rb   ,DictionaryObject.hash_bin.<locals>.<genexpr>  s     #O,$!Q

$5,s    ")rd   re   rf   rk   rg   s    rJ   r_   DictionaryObject.hash_bin  s.     ^^U#O$**,#OPQ
 	
rL   keyc                 ,    [         R                  X5      $ r]   )dict__getitem__rG   r   s     rJ   r   DictionaryObject.raw_get  s    **rL   defaultc                     X;   a  X   $  SU ;  a  U$ [        S5      e! [          a/    [        SU S   R                  5       5      R                  X5      s $ f = f)z
Returns the value of a key or from the parent if not found.
If not found returns default.

Args:
    key: string identifying the field to return

    default: default value to return

Returns:
    Current key or inherited one, otherwise default value.

/ParentzNot presentr   )KeyErrorr   
get_objectget_inherited)rG   r   r   s      rJ   r   DictionaryObject.get_inherited  sh     ;9	$=)) 	*DO,F,F,HIWW 	s     6AAvaluec                     [        U[        5      (       d  [        S5      e[        U[        5      (       d  [        S5      e[        R	                  XU5      $ NzKey must be a PdfObjectzValue must be a PdfObject)rV   r/   r   r   __setitem__rG   r   r   s      rJ   r   DictionaryObject.__setitem__  sG    #y))677%++899511rL   c                     [        U[        5      (       d  [        S5      e[        U[        5      (       d  [        S5      e[        R	                  XU5      $ r   )rV   r/   r   r   
setdefaultr   s      rJ   r   DictionaryObject.setdefault  sE    #y))677%++899t%00rL   c                 H    [         R                  X5      R                  5       $ r]   )r   r   r   r   s     rJ   r   DictionaryObject.__getitem__  s    *5577rL   c                     SSK Jn  U R                  SS5      n[        U5      (       a  gUc   S5       eUR	                  5       nU" U5      $ )uf  
Retrieve XMP (Extensible Metadata Platform) data relevant to this
object, if available.

See Table 347 — Additional entries in a metadata stream dictionary.

Returns:
  Returns a :class:`~pypdf.xmp.XmpInformation` instance
  that can be used to access XMP metadata from the document. Can also
  return None if no metadata was found on the document root.

r   )XmpInformationz	/MetadataNmypy)xmpr   r   r1   r   )rG   r   metadatas      rJ   xmp_metadataDictionaryObject.xmp_metadata  sO     	)88K.8$$#+V+#&&(h''rL   r   r   c                 f   Ub  [        SS5        UR                  S5        U R                  5        Hl  u  p4[        U5      S:  a  US   S:X  a  US   S:X  a  M(  UR	                  X5        UR                  S5        UR	                  U5        UR                  S	5        Mn     UR                  S
5        g )Nr   r      <<
r   r'   %r   r      
   >>)r   r   rk   r   r   )rG   r   r   r   r   s        rJ   r    DictionaryObject.write_to_stream  s     %&A7 	W**,JC3x!|A##b'S.7LL!!&)LL ' 	UrL   rT   r   c           
      h  ^ S[         S[         S[        [            S[        S[         4
S jmS[        S[        S[        4U4S jjnU R                  S	5      nUS
:w  a&  [        S[        U R                  5       5       S35      e0 n [        U 5      nUS:X  a  M  US:X  a  U R                  SS5        [        U 5        M9  U(       d  [        [        5      eUS:X  a  U R                  S5        OU R                  SS5          [        X5      n[        U[         5      (       a  O[        U["        5      (       d  [        SU< 35      e [        U 5      nU R                  SS5        [        XU5      n	UR3                  U5      (       d  XU'   ONS[        U R                  5       5       SU 3nUb  UR$                  (       a  [        U5      e['        U[*        5        GMU  U R                  5       n[        U 5      nUS:X  Ga  U R                  S5      S:X  Ga  U R                  S5      nUS:X  a  U R                  S5      nUS:X  a  M  US;  a  [        S5      eUS:X  a'  U R                  S5      S:w  a  U R                  SS5        [4        R6                  U;  ae  Ub  UR$                  (       a  [        S5      e['        SU R                  5        3[*        5        [9        S5      U[#        [4        R6                  5      '   U[4        R6                     n[        U[:        5      (       a=  U R                  5       nUc   S5       eUR=                  U5      nU R                  US 5        Uc  SnU R                  5       nUS :  a  U R                  U5      US!'   O#[?        U [@        RB                  " S"5      5      US!'   [        U 5      nU R                  S#5      nUU-   S":w  a  U R                  5       nU R                  S$S5        U R                  S%5      nUS":X  a  US!   S S US!'   OUb?  UR$                  (       d.  U R                  US 5        U" X5      US!'   U R                  5       nOSU R                  US 5        [        S&[        U R                  5       5       S'U< S(U< S)35      eOU R                  US 5        S!U;   a  [D        RG                  U5      $ [/        5       n
U
R1                  U5        U
$ ! [         a?  nUb  UR$                  (       a  e ['        UR)                  5       [*        5         S nAGM  S nAff = f! [,         ar  nUb*  UR$                  (       a  [        UR)                  5       5      e['        UR)                  5       [*        5        [/        5       n
U
R1                  U5        U
s S nA$ S nAff = f)*Npp1rem_gensrT   rA   c                     UnU HZ  nUR                   U   n UR                  5        Vs/ s H  opUs=:  a  U::  d  M  O  M  UPM     nnU(       a  [        U/UQ76 nMZ  M\     U$ s  snf ! [         a     Mr  f = fr]   )xrefvaluesminr   )	r   r   r   rT   outgenlocra   r   s	            rJ   get_next_obj_pos;DictionaryObject.read_from_stream.<locals>.get_next_obj_pos  s     Chhsm),EAQ"aaFE!#// 	   J F " s-   A*A%A%A%A*%A**
A87A8r   c                 L  > T" U R                  5       S[        UR                  5      U5      S-
  nU R                  5       nU R                  X R                  5       -
  5      nUR	                  S5      nUS:  a  [        SU S35      eU R                  X5-   S-   5        US US-
   $ )Nl        r'   	   endstreamr   z6Unable to find 'endstream' marker for obj starting at .	   )tellrp   r   r   findr%   r   )r   rT   eoncurrrwr   r   s         rJ   read_unsized_from_streamCDictionaryObject.read_from_stream.<locals>.read_unsized_from_stream  s     #6;;=%chhMPQQC;;=DS;;=01B%A1u"LTFRST  KK1%gA;rL   r      <<zDictionary read error at byte z: stream must begin with '<<'    r   r   r'      >z)Expecting a NameObject for key but found z+Multiple definitions in dictionary at byte z	 for key    s   s   treamr   )r      z)Stream data must be followed by a newliner  r   zStream length not definedzStream length not defined @pos=r   r   __streamdata__r     ir  z7Unable to find 'endstream' marker after stream at byte z (nd='z', end='z').)$r   r	   r   r   rs   r   r%   hexr  r   r   r   r&   r$   r   rV   r-   r,   strictr   __repr__r   rU   r   updater   SALENGTHr.   r+   r   r   recompilerW   initialize_from_dictionary)r   rT   r   r
  r   rI   r   r   excr   retvalmsgposr   eollengthtpstartendstreamendr   s                        @rJ   r   !DictionaryObject.read_from_stream  s   			'+Cy	7H				%6		 kk!n%<0V[[]1C0D E. .   "%f-Cg~d{B"!&)$%ABBd{AKKA%f2C!#z22%c:66*GwO  7 *&1B"#FA 88C==!S	 B6;;=)*)C5:  ?szz&s++sH-e h kkm'9Q83++a.C +kk!n +.($%PQQe|A% 7B"yy$?szz()DEE5fkkm_Ex /;2.>Z		*+"))_F&.11KKM../Aq!~[[]Fz)/V)<%&)9BJJ|4*%& $F+A{{1~HH- kkmC#kk!n,&-12B-CCR-HD)*_SZZKK*-Ef-RD)* ++-CKKQ'&Qv{{}-.fXLsT ' .0 KKQt#::4@@!#d} $ 3::"3<<>8<	  ?szz&s||~66s||~x8)+d#sI     S) !$S) *T5 )
T233T-&T5 -T22T5 5
V1?A'V,&V1,V1r   r]   )$r   r   r   r   r   rC   r   r
   r   r   rr   r   rR   r   r   r   r_   r   r   r   r   r   r/   r   propertyr   r   r   rs   r   r   r   r	   r   r   r   rM   rL   rJ   r   r     s   # 
" !&=?	#   sCx 9:	
 
0oo $o 	o
  sCx 9:o U38_%o 
ob

# 

+3 +3 + s c 22s 23 23 21c 1(3- 13 18s 8y 8 (h'=> ( (. MQ 27c58H2I	"  HL__'(_ tS$s)T#s(^CD_ 
	_ _rL   r   c                   2   \ rS rSrSS\\   SS4S jjrS\4S jrS\	4S jr
S\\	   4S jrS	\	S
\SS4S jrS\S\S 4   S\SS4S jrS\S\S 4   S\SS4S jr SS	\	S\	S
\S\\S\	4      S\4
S jjrS\	S\	S\	S\	SS4
S jrS	\	SS4S jrSS jrSS jrSrg)
TreeObjecti  NdctrA   c                 `    [         R                  U 5        U(       a  U R                  U5        g g r]   )r   __init__r  )rG   r,  s     rJ   r.  TreeObject.__init__  s$    !!$'KK rL   c                     SU ;   $ )N/FirstrM   rg   s    rJ   has_childrenTreeObject.has_children  s    4rL   c                 "    U R                  5       $ r]   )childrenrg   s    rJ   __iter__TreeObject.__iter__  s    }}rL   c              #     #    U R                  5       (       d  g U [        S5         nUR                  5       n Uv   X [        S5         :X  a  g UR                  [        S5      5      n[	        U5      (       a  g UR                  5       nMS  7f)Nr1  /Lastr   )r2  r,   r   r   r1   )rG   	child_refchilds      rJ   r5  TreeObject.children  s       ""H-.	$$&KZ011		*W"56Iy))((*E s   B	Br;  rT   c                 *    U R                  US U5        g r]   )insert_child)rG   r;  rT   s      rJ   	add_childTreeObject.add_child  s    %s+rL   parentnc                 <   [        U5      (       a  g Uc   S5       e[        SUR                  5       5      nSU;   aa  [        [	        S[        [
        U[        S5         5      U-   5      5      U[        S5      '   U R                  UR                  SS 5      U5        g g )Nr   r+  /Countr   r   )	r1   r   r   r.   maxr   r,   inc_parent_counter_defaultr   )rG   rA  rB  s      rJ   rF  %TreeObject.inc_parent_counter_default  s     6""!)6)!lF$5$5$78v+7AtC
8(<!=>BC,F:h'( ++FJJy$,GK	 rL   c                    [        U5      (       a  g Uc   S5       e[        SUR                  5       5      nUR                  SS5      S:H  n[        [        UR                  SS5      5      nUS:  a  [        U5      n[        XB-   U(       a  SOS-  5      U[        S5      '   U(       d  g U R                  UR                  S	S 5      U5        g )
Nr   r+  z
/%is_open%TrD  r   r'   r   r   )	r1   r   r   r   r   absr.   r,   inc_parent_counter_outline)rG   rA  rB  opnr   s        rJ   rJ  %TreeObject.inc_parent_counter_outline  s     6""!)6)!lF$5$5$78jjt,4fjj1-.q5AA'3QUCqR4P'Qz(#$''

9d(CQGrL   beforeinc_parent_counter.c                    Uc  U R                   nUR                  5       nUR                  nSU ;  au  X[        S5      '   [	        S5      U [        S5      '   X[        S5      '   U R                  U[        S5      '   U" XR                  SS5      5        SU;   a  US	 SU;   a  US	 U$ [        S	U S   5      nUR                  U:w  a  SU;   a  [        S
US   5      nOx[        S
U5      U[        S5      '   UR                  U[        S5      '   U R                  U[        S5      '   SU;   a  US	 X[        S5      '   U" XR                  SS5      5        U$ UR                  U:w  a  M   [        US   [        5      (       d   eXS   [        S5      '   US   U[        S5      '   Xe[        S5      '   X[        S5      '   U R                  U[        S5      '   U" XR                  SS5      5        U$ ! [         a    US	  N[f = f)Nr1  r   rD  r9  r   r'   r   r   r   r+  )
rF  r   rS   r,   r.   r   r   rV   r   rU   )rG   r;  rM  rT   rN  	child_objprevs          rJ   r>  TreeObject.insert_child  s    %!%!@!@$$&	(( 4).H%&)5aDH%&(-G$%/3/F/FIj+,t]]8Q%?@)#g&)#g&L&W6%%/$L$w-8,0u,EZ()151H1H	*W-.373J3J	*Y/0i'!'*,1Z()"4x)CD %%/	#d7m-=>>>>16M*W-.-1']Ij)* *.*W%&$)Z !+/+B+B	*Y'(4x!;<  	#'"	#s   ';G. .G>=G>rQ  prev_refcurlastc                 ^   UR                  [        S5      S5      nUc  U(       aP  UR                  5       nU[        S5      	 XP[        S5      '   [        U [        S5         S-
  5      U [        S5      '   g[        S5      U [        S5      '   U [        S5      	 [        S5      U ;   a  U [        S5      	 ggU(       a+  UR                  5       nX&[        S5      '   XQ[        S5      '   O X4:X  d   eU[        S5      	 X [        S5      '   [        U [        S5         S-
  5      U [        S5      '   g)	zp
Adjust the pointers of the linked list and tree node count.

Args:
    prev:
    prev_ref:
    cur:
    last:

r   Nr   r1  rD  r'   r   r9  )r   r,   r   r.   )rG   rQ  rS  rT  rU  next_refnext_objs          rJ   _remove_node_from_tree!TreeObject._remove_node_from_tree  s'    77:g.5<#..0Z01-5Z)*-9H-.2.Z)* .:!_Z)*H-.g&$.Z01 / #..008G,-,4Z() {"{G,-,4Z())5d:h;O6PST6T)UDH%&rL   c                    UR                  5       nUR                  n[        S5      U;  a  [        S5      eU[        S5         U :w  a  [        S5      eSnS nS nU [        S5         nUR                  5       nU [        S5         nUR                  5       n	UbU  Xr:X  a  U R	                  XTXy5        SnO;UnUn[        S5      U;   a  U[        S5         nUR                  5       nOS nS nUb  MU  U(       d  [        S	5      e[        U5        g )
Nr   /Removed child does not appear to be a tree itemz*Removed child is not a member of this treeFr1  r9  Tr   z"Removal couldn't find item in tree)r   rS   r,   r   rY  _reset_node_tree_relationship)
rG   r;  rP  foundrS  rQ  cur_refrT  last_refrU  s
             rJ   remove_childTreeObject.remove_childC  s   $$&	,,i 	1NOOZ	*+t3IJJ!%j&:!;(/(:(:(<
7+,""$o++DCF HD'"c)j12((* o  ABB%i0rL   c                 t    [        S5      U ;  a  [        S5      e[        SU S   5      R                  U 5        g)z)Remove the object from the tree it is in.r   r\  r+  N)r,   r   r   ra  rg   s    rJ   remove_from_treeTreeObject.remove_from_treeh  s4    i ,NOO\4	?+88>rL   c                     U  H  nUR                  5       n[        U5        M      [        S5      U ;   a  U [        S5      	 [        S5      U ;   a  U [        S5      	 [        S5      U ;   a  U [        S5      	 g g )NrD  r1  r9  )r   r]  r,   )rG   r;  rP  s      rJ   
empty_treeTreeObject.empty_treen  sw    E((*I))4  h4'Z)*h4'Z)*g$&Z() 'rL   rM   r]   rA   N)r   r   r   r   r
   r   r.  r   r2  r   r6  r   r5  r   r?  r   r+   r   rF  rJ  r   r>  rY  ra  rd  rg  r   rM   rL   rJ   r+  r+    sT   H%56 $ 
 d  # +(3- +,s ,): ,t ,LD.,>?LDGL	LHD.,>?HDGH	H, <@00 0 	0
 %Xc3h%780 
0d)V)V#&)V-0)V8;)V	)VV#1# #1$ #1J?
*rL   r+  rP  rA   c                     U [        S5      	 [        S5      U ;   a  U [        S5      	 [        S5      U ;   a  U [        S5      	 gg)z
Call this after a node has been removed from a tree.

This resets the nodes attributes in respect to that tree.

Args:
    child_obj:

r   r   r   N)r,   )rP  s    rJ   r]  r]  {  sJ     	*Y'('i'j)*'i'j)* (rL   c                   l  ^  \ rS rSrSS jrS\SS 4S jrS\S\S\S	\	\
\\\4         S
\\\\4      SS4U 4S jjrS\4U 4S jjrS\4S jrS\SS4S jrS\4U 4S jjr SS\S\S\\4   SS4S jjr\S\\\4   SS4S j5       r\S\\\4   S\S   4S j5       rSS\SS4S jjrS\4S jrSrU =r $ )rW   i  rA   Nc                      SU l         S U l        g NrL   _datadecoded_selfrg   s    rJ   r.  StreamObject.__init__  s    
;?rL   r@   c                    [        SU R                  U R                  5       US5      5      nU R                  Ul         U R                  nUc  S U l        O![        SUR                  U5      5      U l         U R                  5        H:  u  pE[        US5      (       a  UR                  U5      OUX$R                  U5      '   M<     U$ ! [         a     N\f = f)NrW   FDecodedStreamObjectrC   )	r   rD   re   ro  rp  rC   rU   rk   rE   rG   r@   r   rp  r   r   s         rJ   rC   StreamObject.replicate  s     !!$.."2HeD
 JJ			,,L#$(!$()<+A+A(+K%!
 JJLDA)0K)@)@H%a H%& ! 
  		s   C  C 
CCr   rN   rO   r   c                   > [        SU5      R                  U l         [        SU5      R                  nUc  SU l        O"[        SUR                  X#U5      5      U l         [
        TU ]  XX4U5        g! [         a     Nf = f)d
Update the object from src.

Args:
    src:
    pdf_dest:
    force_duplicate:
    ignore_fields:

rW   Nrs  )r   ro  rp  rR   rU   superr   )rG   r   r@   rN   rO   r   rp  re   s          rJ   r   StreamObject._clone  s    $ .#.44

	4AAL#$(!$() &&x-P%! 	sogN  		s    A3 !A3 3
B ?B c                 J   > [        [        TU ]	  5       U R                  45      $ )r[   )rd   rx  r_   ro  )rG   re   s    rJ   r_   StreamObject.hash_bin  s!     UW%'455rL   c                     U R                   $ r]   ro  rg   s    rJ   get_dataStreamObject.get_data  s    zzrL   rI   c                     Xl         g r]   r}  )rG   rI   s     rJ   set_dataStreamObject.set_data  s    
rL   c                 H   > [         TU ]  5       nXR                  5       -  nU$ r]   )rx  hash_value_datar~  rG   rI   re   s     rJ   r  StreamObject.hash_value_data  s#    w&(rL   r   r   c                 X   Ub  [        SS5        [        [        U R                  5      5      U [	        [
        R                  5      '   [        R                  X5        U [
        R                  	 UR                  S5        UR                  U R                  5        UR                  S5        g )Nr   r   s   
stream
s
   
endstream)
r   r.   r   ro  r,   r  r  r   r   r   )rG   r   r   s      rJ   r   StreamObject.write_to_stream  sz     %&A7 '33tzz?&CZ		"#((6O]#TZZ ^$rL   c                     [        SSS5        g )NinitializeFromDictionaryr  r   )r   )rI   s    rJ   r  %StreamObject.initializeFromDictionary  s    $&(Dg	
rL   )EncodedStreamObjectrs  c                     [         R                  U ;   a  [        5       nO
[        5       nU S   Ul        U S	 [         R
                  U ;   a  U [         R
                  	 UR                  U 5        U$ )Nr  )r  FILTERr  rs  ro  r  r  )rI   r  s     rJ   r  'StreamObject.initialize_from_dictionary  s^    
 99(*F(*F,-!"99RYYdrL   levelr  c           	         SSK Jn  [        R                  U ;   a  U [        R                     n[	        U[
        5      (       ac  [        [        [        R                  5      /UQ5      n [        [        5       /U R                  [        R                  [        5       5      Q5      nO{[        [        [        R                  5      U/5      n[        [        5       U R                  [        R                  [        5       5      /5      nO[        [        R                  5      nS n[        5       nUR                  U 5        X5[        [        R                  5      '   Ub  XE[        [        R                  5      '   UR                  U R                   U5      Ul        U$ ! [         a>    [        [        5       U R                  [        R                  [        5       5      /5      n Nf = f)Nr   FlateDecode)filtersr  r  r  rV   r>   r,   FTFLATE_DECODEr-   r   DECODE_PARMS	TypeErrorr  r  encodero  )rG   r  r  fparamsr  s         rJ   flate_encodeStreamObject.flate_encode  sV   )99RYYA![))BOO!< Aq AB(#Q+-(PQF  BOO!<a @A$\488BOOZ\#JK 2??+AF$&d()z"))$%28:boo./"))$**e<' ! (#txx'OPFs   )<F AG G c                     SSK Jn  U R                  SS5      S:w  a    U R                   S3n[        U[        5        U" U 5      u  p4nUc  gU$ ! [         a    U R                  5        S3n N@f = f)	a6  
Try to decode the stream object as an image

Returns:
    a PIL image if proper decoding has been found
Raises:
    Exception: (any)during decoding to to invalid object or
        errors during decoding will be reported
        It is recommended to catch exceptions to prevent
        stops in your program.

r   )_xobj_to_imagez/Subtype z/Imagez does not seem to be an Imagez$ object does not seem to be an ImageN)r  r  r   rS   AttributeErrorr  r   r   )rG   r  r  	extensionbyte_streamimgs         rJ   decode_as_imageStreamObject.decode_as_image$  s     	-88J#x/O0011NO 3)&4T&:#	
 " O))MNOs   A A.-A.rn  ri  r]   )r   )!r   r   r   r   r.  r   rC   r   r   r
   r   r   rr   r   r   r   r   r_   rs   r~  r  r  r   r   r   r   r   r  r  r  r  r   __classcell__re   s   @rJ   rW   rW     so   @# 
2OO $O 	O
  sCx 9:O U38_%O 
O@	6# 	6% U t   MQ% %27c58H2I%	% 
tCH~ 
$ 
 

 38n	;	< # /D @  rL   rW   c                       \ rS rSrSrg)rs  i?  rM   N)r   r   r   r   r   rM   rL   rJ   rs  rs  ?  s    rL   rs  c                   L   ^  \ rS rSrS	S jrS\4S jrS\SS4U 4S jjrSrU =r	$ )
r  iC  rA   Nc                     S U l         g r]   rp  rg   s    rJ   r.  EncodedStreamObject.__init__D  s
    ;?rL   c                 n   SSK Jn  U R                  b  U R                  R                  5       $ [	        5       nUR                  U" U 5      5        U R                  5        H>  u  p4U[        R                  [        R                  [        R                  4;  d  M:  XBU'   M@     X l        UR                  5       $ )Nr   )decode_stream_data)r  r  rp  r~  rs  r  rk   r  r  r  r  )rG   r  decodedr   r   s        rJ   r~  EncodedStreamObject.get_dataH  s    0($$--// &'+D12**,JC299biiAA$ ' $!!rL   rI   c                   > SSK Jn  U R                  [        R                  S5      [
        R                  [
        R                  /4;   a  [        U[        5      (       d  [        S5      eU R                  c  U R                  5         U R                  c   S5       eU R                  R                  U5        [        TU ]1  UR                  U5      5        g [        S5      e)Nr   r  r  zData must be bytesr   zJStreams encoded with a filter different from FlateDecode are not supported)r  r  r   r  r  r  r  rV   rs   r  rp  r~  r  rx  r  r%   )rG   rI   r  re   s      rJ   r  EncodedStreamObject.set_dataY  s    )88BIIr"r8I&JJdE** 455  ($$08&80&&t,G[//56\ rL   r  ri  )
r   r   r   r   r.  rs   r~  r  r   r  r  s   @rJ   r  r  C  s-    @"% ""U t  rL   r  c                     ^  \ rS rSrSr SS\S\S\S\\\   \	\
\4   4   SS4U 4S jjjrS	\SS 4S
 jr  SS	\S\S\\\\\
4         SS 4S jjrS\S	\S\S\\\\\
4         S\\\
\
4      SS4U 4S jjrS\SS4S jrS\S\	\\4   4S jrS\4S jrS\SS4U 4S jjr\S\\\\4      4S j5       r\R<                  S\\\\4      SS4S j5       rSS jr SS\S\S\\4   SS4U 4S jjjr Sr!U =r"$ ) ContentStreamij  au  
In order to be fast, this data structure can contain either:

* raw data in ._data
* parsed stream operations in ._operations.

At any time, ContentStream object can either have both of those fields defined,
or one field defined and the other set to None.

These fields are "rebuilt" lazily, when accessed:

* when .get_data() is called, if ._data is None, it is rebuilt from ._operations.
* when .operations is called, if ._operations is None, it is rebuilt from ._data.

Conversely, these fields can be invalidated:

* when .set_data() is called, ._operations is set to None.
* when .operations is set, ._data is set to None.
Nr   rT   r   rA   c                 X  > X l         / U l        Uc  [        TU ]  S5        GOUR	                  5       n[        U[        5      (       a  SnU H  nUR	                  5       n[        U[        5      (       a  M*  [        U[        5      (       d(  [        S[        U5      R                   S3[        5        OXFR                  5       -  n[        U5      S:X  d  US   S:w  d  M  US-  nM     [        TU ]  [        U5      5        O$UR                  5       nUc   e[        TU ]  U5        X0l        g )NrL   zExpected StreamObject, got z instead. Data might be wrong.r   r   r   )rT   _operationsrx  r  r   rV   r>   r-   rW   r   typer   r~  r   rs   r   )	rG   r   rT   r   rI   r   
s_resolvedstream_datare   s	           rJ   r.  ContentStream.__init__  s    46 >GS!&&(F&+..A!"J!*j99 %j,?? '9$z:J:S:S9TTrs$
  3 3 554yA~bU):    t-$oo/"... -.rL   r@   c           	         [        SU R                  U R                  S S 5      US5      5      nU R                  Ul         U R                  nUc  S U l        O![        SUR                  U5      5      U l         U R                  5        H:  u  pE[        US5      (       a  UR                  U5      OUX$R                  U5      '   M<     U$ ! [         a     N\f = f)Nr  Frs  rC   )r   rD   re   ro  rp  rC   rU   rk   rE   r  rT   rp   r  r   rt  s         rJ   rC   ContentStream.replicate  s     !!$..t"<hN
 JJ			,,L#$(!$()<+A+A(+K%!
 JJLDA)0K)@)@H%a H%& ! 
  		s    C  C 
CCrN   rO   c           	      
    U R                   R                  U:X  a	  U(       d  U $ [        5       n[	        SU R                  U R                  SS5      X5      5      nUc  / nUR                  XX#U5        U$ ! [         a     N\f = f)z
Clone object into pdf_dest.

Args:
    pdf_dest:
    force_duplicate:
    ignore_fields:

Returns:
    The cloned ContentStream

r  N)rS   rT   rU   rq   r   rD   re   r   r   s         rJ   rR   ContentStream.clone  s    $	&&**h6 ),!!tT*H
  M

4?7K
  		s   "A5 5
BBr   r   c                    > [        SU5      n[        TU ]	  UR                  5        X l        [        UR                  5      U l        UR                  U l        g)rw  r  N)r   rx  r  ro  rT   rp   r  r   )rG   r   r@   rN   rO   r   src_csre   s          rJ   r   ContentStream._clone  sH    $ os+& 2 23%55rL   c                 4   UR                  SS5        / n [        U5      nUS;   a  g UR                  SS5        UR                  5       (       d  US;   av  [        U[        R
                  5      nUS:X  a7  U/ :X  d   eU R                  U5      nU R                  R                  US45        OkU R                  R                  X$45        / nOLUS:X  a   US	;  a  UR                  S5      nUS	;  a  M  O&UR                  [        US U R                  5      5        GM  )
Nr   )rL   r   r   r'   )   '   "   BI   INLINE IMAGEr   )r  r   rL   )r   r   isalphar   r,   delimiter_pattern_read_inline_imager  rF   r   r   r   )rG   r   operandspeekoperatoriis         rJ   _parse_content_stream#ContentStream._parse_content_stream  s   Aq57&v.DxKKA||~~!5+FJ4P4PQu$ $r>)>008B$$++R,AB$$++X,@A!H "55!;;q>D "55 FD$:N:N OP3 rL   c           	         [        5       n [        U5      nUR                  SS5        US:X  a  OM[        XR                  5      n[        U5      nUR                  SS5        [        XR                  5      nXRU'   Mq  UR                  S5      nUS S S:X  d   eUR                  SUR                  SS	5      5      nUR                  5       n[        U[        5      (       a  US
   nSU;   d  SU;   a  [        U5      n	GO2SU;   d  SU;   a  [        U5      n	GOSU;   d  SU;   a  [        U5      n	GO SU;   d  SU;   a  [        U5      n	OUS	:X  a  UR                  SS5      n
[        U
[        5      (       a  U
S
   n
SU
;   a  SnO<SU
;   a  SnO3UR                  SU
S;   a  SOS5      nUS
:  a  US-  nO[        U5      n	SnUS
:  aB  UR                  [        [!        ["        US   5      U-  5      [!        ["        US   5      -  5      n	[        U5      nUR                  SS5        O[        U5      n	UR                  S5      nUR                  SS5        US S S:w  d  USS [$        ;  ae  UR                  US
5        [        U5      n	UR                  S5      nUR                  SS5        US S S:w  d  USS [$        ;  a  ['        SU< 35      eUW	S .$ )!Nr   r'      Ir:   r   s   ID/Fz/Filterznot setr   AHxASCIIHexDecodeA85ASCII85DecodeRLRunLengthDecodeDCT	DCTDecodez/CSr  RGBCMYK   z/BPC>   /G/I/Indexed/DeviceGrayr  g       @z/Wz/H   EIzHCould not extract inline image, even using fallback. Expected 'EI', got )settingsrI   )r   r   r   r   rT   r   r   r  rV   rp   r4   r3   r7   r5   r6   r   r   r   r   r&   )rG   r   r  r   r   r   r   filtrsavposrI   cslcsbitseis                 rJ   r   ContentStream._read_inline_image!  s    $%%f-CKKAd{fhh/C%f-CKKA1E!SM  kk!n2Aw%T8<<	9#EFeT""!HEE>-6%f-De^%7%f-DU]/58$V,De^{e3%f-DieR(B"d##U{2||FFAB !8*C1&9DCQw{{c8D>2S89Dhtn<UU %V,BKKA)&1D[[^Bbq6U?b1g[8KK")&1DQBKKA"1v"Qq'"< %^_a^de  %d33rL   c                 \   U R                   (       Gd  [        5       nU R                   H  u  p#US:X  a  UR                  S5        [        5       nUS   R	                  U5        UR                  UR                  5       SS 5        UR                  S5        UR                  US   5        UR                  S5        O<U H%  nUR	                  U5        UR                  S	5        M'     UR                  U5        UR                  S
5        M     UR                  5       U l         U R                   $ )Nr  r  r  r   s   ID rI   r  r   r   )ro  r   r  r   r   getvalue)rG   new_datar  r  	dict_textops         rJ   r~  ContentStream.get_datam  s    zzzyH&*&6&6".NN5) '	IZ(88CNN9#5#5#7"#=>NN6*NN8F#34NN5)&**84 t, ' NN8,u% '7 "**,DJzzrL   rI   c                 2   > [         TU ]  U5        / U l        g r]   )rx  r  r  r  s     rJ   r  ContentStream.set_data  s    rL   c                     U R                   (       d<  U R                  (       a+  U R                  [        U R                  5      5        SU l        U R                   $ rm  )r  ro  r  r   rg   s    rJ   
operationsContentStream.operations  s;    DJJ&&wtzz':;DJrL   r  c                     Xl         SU l        g rm  )r  ro  )rG   r  s     rJ   r  r    s    %
rL   c                     U R                   (       a<  U R                   R                  S/ S45        U R                   R                  / S45        g U R                  (       a  SU R                  -   S-   U l        g g )Nr      q   Qs   q
s   
Q
)r  insertrF   ro  rg   s    rJ   isolate_graphics_state$ContentStream.isolate_graphics_state  s^    ##ADz2##RJ/ZZ$**,x7DJ rL   r   c                    > U R                   (       d!  U R                  (       a  U R                  5         [        TU ]  X5        g r]   )ro  r  r~  rx  r   )rG   r   r   re   s      rJ   r   ContentStream.write_to_stream  s*     zzd..MMO7rL   )ro  r  rp  r   rT   r]   r   ri  )#r   r   r   r   __doc__r   r   rr   r	   r   r   r.  r   rC   r   r
   r   rR   r   r   r   r   r   r  r  rs   r~  r  r)  r  setterr  r   r   r  r  s   @rJ   r  r  j  s   0 HL	%/%/ %/ tS$s)T#s(^CD	%/
 
%/ %/N# 
B !&=?	"" "  sCx 9:	"
 
"H66 $6 	6
  sCx 9:6 U38_%6 
64QJ Q4 Q>I4 I4S#X I4X% ,U t   DsEz!23     T%U
*;%<   8 MQ8 827c58H2I8	8 8rL   r  r   rT   r   c                 p   U R                  S5      nU R                  SS5        US:X  a  [        R                  " X5      $ US:X  aJ  U R                  S5      nU R                  SS5        US:X  a  [        R                  XU5      $ [        X5      $ US:X  a  [        R                  XU5      $ US	;   a  [        R                  " U 5      $ US
:X  a  [        X5      $ US:X  a  U R                  S5      S:X  a
  [        5       $ US:X  a  [        R                  " U 5      $ US:X  a4  [        U 5        [        U 5      nU R                  SS5        [        XU5      $ US;   ay  U R                  S5      nU R                  [        U5      * S5        [        R                  U5      b   Uc   S5       e[         R                  " X5      $ ["        R                  " U 5      $ U R%                  5       nU R                  SS5        U R                  S5      nU R                  U5        ['        U 5        [)        SU< SU SU< 35      e)Nr'   r      /   <r   r  r  r   )   t   f   (   e   s   endobj   nr   s   0123456789+-.   r   iP   z(Invalid Elementary Object starting with z @z: )r   r   r,   r   r   r8   r>   r(   r9   r-   r   r   r   r   IndirectPatternmatchr+   r.   r  r   r%   )r   rT   r   r   r  r   stream_extracts          rJ   r   r     s   
 ++a.C
KKA
d{**677
d{{{1~B5=#44V/RR*6CC
d{++FII
l--f55
d{&v??
d{v{{1~2|
d{**622
d{&!!&)B688
{{2SYJ"  &2?*F*?!226??,,V44
++-C
KKQ[[_N
KK&!

23'C5>BTU rL   c                   V   \ rS rSrSrS\SS4S jr\S\\	   4S j5       r
\S\\   4S j5       r\S\S	   4S
 j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       rSrg)Fieldi  z{
A class representing a field dictionary.

This class is accessed through
:meth:`get_fields()<pypdf.PdfReader.get_fields>`
rI   rA   Nc                 6   [         R                  U 5        [        R                  " 5       [        R                  " 5       -   nUR
                  U l        U H  n X   U [        U5      '   M     [        U R                  S5      [        5      (       ay  [        [        U [        S5         5      R                  5       n[        U[        5      (       a  UR                  5       nOUc  SnO[        S5      e[!        U5      U [        S5      '   g g ! [         a     M  f = f)Nr   r  zShould never happen)r   r.  r   
attributesr   rS   r,   r   rV   r   r  r   r~  rs   decoderU   r0   )rG   rI   field_attributesattrdd_strs         rJ   r.  Field.__init__  s    !!$'%002+6689 	 #'"9"9$D)-Z%& %
 dhhtn&9::($z$/?*@AJJLA!U##
 566%5e%<DD!" ;  s   D


DDc                 @    U R                  [        R                  5      $ )z4Read-only property accessing the type of this field.)r   r   r  rg   s    rJ   
field_typeField.field_type       xx14455rL   c                 @    U R                  [        R                  5      $ )z6Read-only property accessing the parent of this field.)r   r   Parentrg   s    rJ   rA  Field.parent  s     xx18899rL   r>   c                 @    U R                  [        R                  5      $ )z4Read-only property accessing the kids of this field.)r   r   Kidsrg   s    rJ   kids
Field.kids  s     xx16677rL   c                 @    U R                  [        R                  5      $ )z4Read-only property accessing the name of this field.)r   r   Trg   s    rJ   name
Field.name  s     xx13344rL   c                 @    U R                  [        R                  5      $ )z>Read-only property accessing the alternate name of this field.)r   r   TUrg   s    rJ   alternate_nameField.alternate_name  r  rL   c                 @    U R                  [        R                  5      $ )z
Read-only property accessing the mapping name of this field.

This name is used by pypdf as a key in the dictionary returned by
:meth:`get_fields()<pypdf.PdfReader.get_fields>`
)r   r   TMrg   s    rJ   mapping_nameField.mapping_name       xx14455rL   c                 @    U R                  [        R                  5      $ )z
Read-only property accessing the field flags, specifying various
characteristics of the field (see Table 8.70 of the PDF 1.7 reference).
)r   r   Ffrg   s    rJ   flagsField.flags  s     xx14455rL   c                 @    U R                  [        R                  5      $ )z[
Read-only property accessing the value of this field.

Format varies based on field type.
)r   r   Vrg   s    rJ   r   Field.value  s     xx13344rL   c                 @    U R                  [        R                  5      $ )z=Read-only property accessing the default value of this field.)r   r   DVrg   s    rJ   default_valueField.default_value(  r  rL   c                 @    U R                  [        R                  5      $ )z
Read-only property accessing the additional actions dictionary.

This dictionary defines the field's behavior in response to trigger
events. See Section 8.5.2 of the PDF 1.7 reference.
)r   r   AArg   s    rJ   additional_actionsField.additional_actions-  r2  rL   )rS   )r   r   r   r   r  r   r.  r)  r
   r,   r  rA  r$  rr   r(  r,  r0  r   r5  r   r   r<  r@  r   rM   rL   rJ   r  r    sW   =- =$ =. 6HZ0 6 6 :!12 : : 8h}- 8 8 5hsm 5 5 6 6 6 6hsm 6 6 6x} 6 6 5x} 5 5 6x} 6 6 6H-=$> 6 6rL   r  c                      \ rS rSr% SrSr\\   \S'   S\	S\
\\\\4   S\SS4S	 jr\SS j5       r SS\S\
S\	\4   SS4S jjr\S\\	   4S j5       r\S\\   4S j5       r\S\\	   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\\   4S j5       r\S\S
   4S j5       r\S\\    4S j5       r!\S\\   4S j5       r"Sr#g)Destinationi8  a  
A class representing a destination within a PDF file.

See section 12.3.2 of the PDF 2.0 reference.

Args:
    title: Title of this destination.
    page: Reference to the page of this destination. Should
        be an instance of :class:`IndirectObject<pypdf.generic.IndirectObject>`.
    fit: How the destination is displayed.

Raises:
    PdfReadError: If destination type is invalid.

NnodetitlepagefitrA   c                    / U l         UR                  nUR                  n[        R	                  U 5        [        U5      U [        S5      '   X [        S5      '   X@[        S5      '   US:X  a  [        U5      S:  a  UR                  [        S5      5        [        U5      S:  a  UR                  [        S5      5        [        U5      S:  a  UR                  [        S5      5        Uu  U [        [        R                  5      '   U [        [        R                  5      '   U [        S	5      '   g [        U5      S
:X  a  g U[        R                  :X  ap  Uu  U [        [        R                  5      '   U [        [        R                  5      '   U [        [        R                   5      '   U [        [        R                  5      '   g U[        R"                  [        R$                  4;   a    Uu  U [        [        R                  5      '   g U[        R*                  [        R,                  4;   a    Uu  U [        [        R                  5      '   g U[        R.                  [        R0                  4;   a  g [3        SU< 35      e! [&         a'    [)        5       U [        [        R                  5      '    g f = f! [&         a'    [)        5       U [        [        R                  5      '    g f = f)N/Title/Pager   z/XYZr'   g        r   r:   /Zoomr   zUnknown Destination Type: )_filtered_childrenfit_typefit_argsr   r.  r0   r,   r   rF   r.   TALEFTTOPTFFIT_RBOTTOMRIGHTFIT_HFIT_BHrU   r-   FIT_VFIT_BVFITFIT_Br%   )rG   rE  rF  rG  typargss         rJ   r.  Destination.__init__M  s1    .0ll||!!$'%5e%<Z!"$(Z !$'Z ! &=4y1}L-.4y1}L-.4y1}L-.
 	Z()Z'(Z()Y!^BHH_ Z()Z		*+Z)*Z'(RXXryy))>.2+j() RXXryy))?/3,j)* RVVRXX&&!;C7CDD  >/9|j()>
  ?0:j)*?s$   'I> +J2 >.J/.J/2.K#"K#r>   c                     [        U R                  S5      U S   /S Vs/ s H  nX;   d  M
  X   PM     sn-   5      $ s  snf )NrJ  r   )/Left/Bottom/Right/ToprK  )r>   r   )rG   ra   s     rJ   
dest_arrayDestination.dest_array  sU    \\'"DM2 IHA9 H
 	
s   	=
=
r   r   c                    Ub  [        SS5        UR                  S5        [        S5      nUR                  U5        UR                  S5        U R                  nUR                  U5        [        S5      nUR                  U5        UR                  S5        [        S5      nUR                  U5        UR                  S5        UR                  S	5        g )
Nr   r   r   z/Dr   z/Sz/GoTor   r   )r   r   r,   r   rd  )rG   r   r   r   r   value_ss         rJ   r   Destination.write_to_stream  s     %&A7 	WF#Tf%F#TW%'UUrL   c                 $    U R                  S5      $ )z3Read-only property accessing the destination title.rI  r   rg   s    rJ   rE  Destination.title  s     xx!!rL   c                 $    U R                  S5      $ )zHRead-only property accessing the IndirectObject of the destination page.rJ  rj  rg   s    rJ   rF  Destination.page       xx  rL   c                 $    U R                  S5      $ )z2Read-only property accessing the destination type.r   rj  rg   s    rJ   r\  Destination.typ  rn  rL   c                 &    U R                  SS5      $ )z-Read-only property accessing the zoom factor.rK  Nrj  rg   s    rJ   zoomDestination.zoom       xx&&rL   c                 &    U R                  SS5      $ )z<Read-only property accessing the left horizontal coordinate.r`  Nrj  rg   s    rJ   leftDestination.left  rt  rL   c                 &    U R                  SS5      $ )z=Read-only property accessing the right horizontal coordinate.rb  Nrj  rg   s    rJ   rightDestination.right  s     xx$''rL   c                 &    U R                  SS5      $ )z9Read-only property accessing the top vertical coordinate.rc  Nrj  rg   s    rJ   topDestination.top  s     xx%%rL   c                 &    U R                  SS5      $ )z<Read-only property accessing the bottom vertical coordinate.ra  Nrj  rg   s    rJ   bottomDestination.bottom  s     xx	4((rL   c           
      t    U R                  S[        [        S5      [        S5      [        S5      /5      5      $ )zHRead-only property accessing the color in (R, G, B) with values 0.0-1.0.z/Cr   )r   r>   r*   rg   s    rJ   colorDestination.color  s2     xx+{1~{1~{1~NO
 	
rL   c                 &    U R                  SS5      $ )zG
Read-only property accessing the font type.

1=italic, 2=bold, 3=both
r  r   rj  rg   s    rJ   font_formatDestination.font_format  s     xxa  rL   c                 &    U R                  SS5      $ )z
Read-only property accessing the outline count.

positive = expanded
negative = collapsed
absolute value = number of visible descendants at all levels
rD  Nrj  rg   s    rJ   outline_countDestination.outline_count  s     xx$''rL   )rL  )rA   r>   r]   )$r   r   r   r   r  rD  r
   r   __annotations__rr   r   r.   r+   r-   r2   r.  r)  rd  r   rs   r   rE  rF  r\  r   rr  r*   rv  ry  r|  r  r  r   r  r  r   rM   rL   rJ   rC  rC  8  s    $ 	 	( 3E3E L.*>NNO3E 	3E
 
3Ej 
 
 MQ 27c58H2I	. "x} " " !h~. ! ! !Xc] ! ! 'hsm ' ' 'h{+ ' ' (x, ( ( &Xk* & & )- ) ) 
x. 
 
 !Xo6 ! ! (x} ( (rL   rC  r]   )]
__author____author_email__loggingr  sysior   mathr   typingr   r   r   r   r	   r
   r   r   r   r   r   
_protocolsr   r   r   _utilsr   r   r   r   r   r   r   r   r   	constantsr   r   r   r    r  r!   r  r"   rO  r#   rR  errorsr$   r%   r&   _baser(   r)   r*   r+   r,   r-   r.   r/   r0   r1   _fitr2   _image_inliner3   r4   r5   r6   r7   r8   r9   version_infor<   typing_extensions	getLoggerr   loggerr  r  r>   r   r+  r]  rW   rs  r  r  rr   r   r   r  rC  rM   rL   rJ   <module>r     s  : 
/   	 
      V U
 
 
 
 * . * - O O     Iw&			8	$**@Ac$s)Y cLYtCH~y YxN*! N*b+S +T +"p# pf	, 	$, $Nv8' v8x	 DH//	#	$/ 4d3ic3h?@/ 9c3-.	/d`6J `6Fm(* m(rL   