
    %h7              	          % S r 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  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   SS
KJr  SSKJrJrJr  \\\\\4   \\\\4   \\\\4   4   r \\!S'   \\\\\\\4   r"\\!S'   \r#\\$\#4   r%Sr&Sr'Sr(Sr)S\*S\*S\*4S jr+SQS\#S\\,   S\*4S jjr-S\#S\*4S jr.S\#S\/4S jr0S\#SS4S jr1 SRS\#S\\*   S\/S\*4S jjr2S\#S \,S\*4S! jr3S\#S\*4S" jr4S#\ S$\ S\ 4S% jr5S\#SS4S& jr60 r7\\\$\*4   \*4   \!S''   S(\\$\*4   S\*4S) jr8\S$\$S\$4S* j5       r9\S$\*S\$4S+ j5       r9S$\\$\*4   S\$4S, jr9\S$\$S\,4S- j5       r:\S$\*S\*4S. j5       r:\S$\,S\,4S/ j5       r:S$\\,\$\*4   S\\,\*4   4S0 jr:S$\*S\*4S1 jr;S2\,S\$4S3 jr<S4r=S5\,S6\,S7\,S\,4S8 jr>SSS9\$S:\,SS4S; jjr?S9\$SS4S< jr@ STS=\$S>\$S?\$SS4S@ jjrA STS=\$S>\$S?\$SS4SA jjrBSTSB\$S?\$SS4SC jjrCSTSB\$S?\$SS4SD jjrDS9\$SE\$SS4SF jrESG\$S\4SH jrF SRSI\$SJ\\$\4   SG\\$\$4   SK\/4SL jjrGSM\,S\$4SN jrH\	 " SO SP5      5       rIg! \ a
    SS
KJr   GN	f = f)Uz"Utility functions for PDF library.zMathieu Fenniakzbiziqe@mathieu.fenniak.net    N
getencoder)	dataclass)DEFAULT_BUFFER_SIZE)SEEK_CUR)	IOAnyCallableDictOptionalPatternTupleUnionoverload)	TypeAlias   )STREAM_TRUNCATED_PREMATURELYDeprecationErrorPdfStreamErrorTransformationMatrixTypeCompressedTransformationMatrixz2{} is deprecated and will be removed in PyPDF2 {}.z.{} is deprecated and was removed in PyPDF2 {}.zE{} is deprecated and will be removed in PyPDF2 3.0.0. Use {} instead.z>{} is deprecated and was removed in PyPDF2 {}. Use {} instead.header1header2returnc                     Sn/ nX;   a   UR                  UR                  U 5      5        X;   a   UR                  UR                  U5      5        [        U5      S:X  a  [        SU < SU< S35      eU[	        U5         $ )N)s   %PDF-1.3s   %PDF-1.4s   %PDF-1.5s   %PDF-1.6s   %PDF-1.7s   %PDF-2.0r   zneither z nor z are proper headers)appendindexlen
ValueErrormax)r   r   versionspdf_header_indicess       E/var/www/auris/envauris/lib/python3.13/site-packages/PyPDF2/_utils.py_get_max_pdf_version_headerr$   O   s    H !!(.."9:!!(.."9:
!#8G;eG;>QRSSC*+,,    streammaxcharsc                     Sn U R                  S5      nUR                  5       (       d  U(       d   U$ X#-  n[        U5      U:X  a   U$ MH  )zr
Read non-whitespace characters and return them.

Stops upon encountering whitespace or when maxchars is reached.
r%   r   )readisspacer   )r&   r'   txttoks       r#   read_until_whitespacer-   b   sR     C
kk!n;;== J 	
s8xJ r%   c                 v    U R                  S5      nU[        ;   a  U R                  S5      nU[        ;   a  M  U$ )zEFind and read the next non-whitespace character (ignores whitespace).r   )r)   WHITESPACESr&   r,   s     r#   read_non_whitespacer1   s   s3    
++a.C

kk!n 
Jr%   c                 z    [         S   nSnU[         ;   a"  U R                  S5      nUS-  nU[         ;   a  M"  US:  $ )zf
Similar to read_non_whitespace, but return a Boolean if more than
one whitespace character was read.
r   r   )r/   r)   )r&   r,   cnts      r#   skip_over_whitespacer4   {   sE    
 a.C
C

kk!nq 
 7Nr%   c                     U R                  S5      nU R                  SS5        US:X  a!  US;  a  U R                  S5      nUS;  a  M  g g g )Nr      %)   
   )r)   seekr0   s     r#   skip_over_commentr;      sH    
++a.C
KKA
d{'++a.C ' r%   regex
ignore_eofc                 $   Sn U R                  S5      nU(       d  U(       a  U$ [        [        5      eUR                  U5      nUbD  X4SUR	                  5        -  nU R                  UR	                  5       [        U5      -
  S5         U$ X4-  nM  )z
Read until the regular expression pattern matched (ignore the match).

:raises PdfStreamError: on premature end-of-file
:param bool ignore_eof: If true, ignore end-of-line and return immediately
:param regex: re.Pattern
r%      Nr   )r)   r   r   searchstartr:   r   )r&   r<   r=   namer,   ms         r#   read_until_regexrD      s     D
kk"o !=>>LL=!'')$$DKK	CH,a0K 	 r%   to_readc                     U R                  5       U:  a  [        S5      eU R                  U* [        5        U R	                  U5      nU R                  U* [        5        U$ )z
Given a stream at position X, read a block of size to_read ending at position X.

This changes the stream's position to the beginning of where the block was
read.
z!Could not read malformed PDF file)tellr   r:   r   r)   )r&   rE   r)   s      r#   read_block_backwardsrH      sQ     {{}w@AA
KK(#;;wD
KK(#Kr%   c                 H   / nSnU R                  5       S:X  a  [        [        5      e [        [        U R                  5       5      nUS:X  a  O[        X5      n[        U5      S-
  nU(       d+  US:  a  XE   S;  a  US-  nUS:  a
  XE   S;  a  M  US:  a  SnU(       a:  UR                  XES-   S 5        US:  a  XE   S;   a  US-  nUS:  a
  XE   S;   a  M  OUR                  U5        US:  a  U R                  US-   [        5        OM  SR                  USSS2   5      $ )	a  
Given a byte stream with current position X, return the previous line.

All characters between the first CR/LF byte found before X
(or, the start of the file, if no such byte is found) and position X
After this call, the stream will be positioned one byte after the
first non-CRLF character found beyond the first CR/LF byte before X,
or, if no such byte is found, at the beginning of the stream.
Fr   Tr   s   
Nr%   r6   )rG   r   r   minr   rH   r   r   r:   r   join)r&   line_content
found_crlfrE   blockidxs         r#   read_previous_linerP      s4    LJ{{}9::
)6;;=9a< %V5%j1n (uz8q (uz8ax!

 Agi 01(uzW4q (uzW4
 &!8 KKa*A D 88L2&''r%   abc                 .   ^ [        U4S jU  5       5      $ )Nc              3   \   >^#    U  H   m[        U4S  j[        T6  5       5      v   M"     g7f)c              3   \   >#    U  H!  n[        S  [        TU5       5       5      v   M#     g7f)c              3   T   #    U  H  u  p[        U5      [        U5      -  v   M      g 7fN)float).0ijs      r#   	<genexpr>6matrix_multiply.<locals>.<genexpr>.<genexpr>.<genexpr>   s     @-$!%(U1X%-s   &(N)sumzip)rY   colrows     r#   r\   ,matrix_multiply.<locals>.<genexpr>.<genexpr>   s%     TGSc@#c3-@@@Gs   ),N)tupler_   )rY   ra   rR   s    @r#   r\   "matrix_multiply.<locals>.<genexpr>   s+      C 	TCQRGTTTs   (,)rc   )rQ   rR   s    `r#   matrix_multiplyre      s        r%   c                 B   SnU R                  U* S5        [        SS5       nUR                  U R                  U5      5        UR                  S5        UR                  U R                  U5      5        SSS5        U R                  U* S5        g! , (       d  f       N"= f)z5Create text file showing current location in context.i  r   zPyPDF2_pdfLocation.txtwbs   HEREN)r:   openwriter)   )r&   radius	output_fhs      r#   mark_locationrl      s|     F
KK	&	-F+, F+, 
. KK	 
.	-s   AB
BB_CACHEsc                    [         nX;   a  X   $ [        U [        5      (       a  U $  U R                  S5      n[	        U 5      S:  a  X!U '   U$ ! [
         a)    U R                  S5      n[	        U 5      S:  a  X!U '   Us $ f = f)Nlatin-1   zutf-8)rm   
isinstancebytesencoder   	Exception)rn   bcrs      r#   b_rx     s    	Bwu!U	HHYq6A:qE HHWq6A:qE	s   %A 0B Bc                     g rW    rR   s    r#   str_r|         r%   c                     g rW   rz   r{   s    r#   r|   r|     r}   r%   c                 R    [        U [        5      (       a  U R                  S5      $ U $ )Nrp   )rr   rs   decoder{   s    r#   r|   r|   "  s#    !Uxx	""r%   c                     g rW   rz   r{   s    r#   ord_r   )  r}   r%   c                     g rW   rz   r{   s    r#   r   r   .  r}   r%   c                     g rW   rz   r{   s    r#   r   r   3  r}   r%   c                 F    [        U [        5      (       a  [        U 5      $ U $ rW   )rr   strordr{   s    r#   r   r   8  s    !S1vHr%   c                 2    [        S5      nU" U 5      nUS   $ )N	hex_codecr   r   )rR   codercodeds      r#   	hexencoder   >  s    {#E!HE8Or%   numc                 8    [        U 5      R                  SS5      $ )NL )hexreplace)r   s    r#   hex_strr   E  s    s8C$$r%   )    r8   r9      	    leftupup_leftc                     X-   U-
  n[        X0-
  5      n[        X1-
  5      n[        X2-
  5      nXE::  a  XF::  a  U $ XV::  a  U$ U$ rW   )abs)r   r   r   p	dist_leftdist_updist_up_lefts          r#   paeth_predictorr   L  sP    	GAAHI!&kGq{#L	 9		 	r%   msg
stacklevelc                 8    [         R                  " U [        US9  g )N)r   )warningswarnDeprecationWarning)r   r   s     r#   	deprecater   Z  s    MM#)jAr%   c                     [        U 5      erW   )r   )r   s    r#   deprecationr   ^  s    
3
r%   old_namenew_name
removed_inc                 D    [        [        R                  XU5      S5        g)zK
Raise an exception that a feature will be removed, but has a replacement.
   N)r   DEPR_MSGformatr   r   r   s      r#   deprecate_with_replacementr   b  s     hooh*=qAr%   c                 B    [        [        R                  XU5      5        g)zO
Raise an exception that a feature was already removed, but has a replacement.
N)r   DEPR_MSG_HAPPENEDr   r   s      r#   deprecation_with_replacementr   k  s     !((xHIr%   rB   c                 B    [        [        R                  X5      S5        g)zH
Raise an exception that a feature will be removed without replacement.
r   N)r   DEPR_MSG_NO_REPLACEMENTr   rB   r   s     r#   deprecate_no_replacementr   t  s     %,,T>Br%   c                 @    [        [        R                  X5      5        g)zL
Raise an exception that a feature was already removed without replacement.
N)r    DEPR_MSG_NO_REPLACEMENT_HAPPENEDr   r   s     r#   deprecation_no_replacementr   {  s     077IJr%   srcc                 N    [         R                  " U5      R                  U 5        g)ac  
Use this instead of logger.warning directly.

That allows people to overwrite it more easily.

## Exception, warnings.warn, logger_warning
- Exceptions should be used if the user should write code that deals with
  an error case, e.g. the PDF being completely broken.
- warnings.warn should be used if the user needs to fix their code, e.g.
  DeprecationWarnings
- logger_warning should be used if the user needs to know that an issue was
  handled by PyPDF2, e.g. a non-compliant PDF being read in a way that
  PyPDF2 could apply a robustness fix to still read it. This applies mainly
  to strict=False mode.
N)logging	getLoggerwarning)r   r   s     r#   logger_warningr     s      c""3'r%   aliasesc                  $   ^  S[         4U 4S jjnU$ )z
Decorator for deprecated term "bookmark"
To be used for methods and function arguments
    outline_item = a bookmark
    outline = a collection of outline items
funcc                 J   >^  [         R                  " T 5      UU 4S j5       nU$ )Nc                  @   > [        TR                  UTSS9  T" U 0 UD6$ )NT)fail)rename_kwargs__name__)argskwargsr   r   s     r#   wrapper9deprecation_bookmark.<locals>.decoration.<locals>.wrapper  s%    $--tD(((r%   )	functoolswraps)r   r   r   s   ` r#   
decoration(deprecation_bookmark.<locals>.decoration  s%    			) 
	) r%   )r
   )r   r   s   ` r#   deprecation_bookmarkr     s      r%   	func_namer   r   c                    UR                  5        Hu  u  pEXA;   d  M  U(       a  [        U SU S35      eXQ;   a  [        U  SU SU SU SU S3
5      eUR                  U5      X'   [        R
                  " U SU S3[        S9  Mw     g	)
z)
Helper function to deprecate arguments.
z# is deprecated as an argument. Use z insteadz received both z and z as an argument. z is deprecated. Use z	 instead.)messagecategoryN)itemsr   	TypeErrorpopr   r   r   )r   r   r   r   old_termnew_terms         r#   r   r     s     &mmo&j CH:XV  ! k
%zIZj 4XJiI   &zz(3FMMj CH:XV+	 .r%   rs   c                 f    U S:  a  U  S3$ U S:  a	  U S-  S S3$ U S:  a	  U S-  S S3$ U S-  S S3$ )	Ni  z Bytei@B z.1fz kBi ʚ;z MBz GBrz   )rs   s    r#   _human_readable_bytesr     s_    u}	%-$C((	%-$C((%-$C((r%   c                   F    \ rS rSr% \\S'   \\S'   S\4S jrS\4S jrSr	g)	Filei  rB   datar   c                 `    SU R                    S[        [        U R                  5      5       S3$ )N
File(name=, data: ))rB   r   r   r   selfs    r#   __str__File.__str__  s+    DII;h/DS^/T.UUVWWr%   c                     SU R                    S[        [        U R                  5      5       S[	        U R                  5       S3$ )Nr   r   z, hash: r   )rB   r   r   r   hashr   s    r#   __repr__File.__repr__  s@    DII;h/DS^/T.UU]^bcgclcl^m]nnoppr%   rz   N)
r   
__module____qualname____firstlineno__r   __annotations__rs   r   r   __static_attributes__rz   r%   r#   r   r     s(    
I
KX Xq# qr%   r   rW   )F)   )z3.0.0)J__doc__
__author____author_email__r   r   r   codecsr   dataclassesr   ior   osr   typingr   r	   r
   r   r   r   r   r   r   r   ImportErrortyping_extensionserrorsr   r   r   rX   r   r   r   
StreamTyper   StrByteTyper   r   r   r   rs   r$   intr-   r1   boolr4   r;   rD   rH   rP   re   rl   rm   rx   r|   r   r   r   r/   r   r   r   r   r   r   r   r   r   r   r   r   rz   r%   r#   <module>r     s  8 )
/      ! " 
 
 
,   ',	%
eUE&9 :E%PUBU<VV' )  -2	5%u,- 	  
CO$N #S  RT - - -5 -&*  QV "
 u 
 
 
!j !T ! CH&u~;?
4 c e "0(z 0(e 0(f$<	* 	 	 +-eCJ&	' ,%U

  $ 
C C  
 
E c  
E#u* #  
C C  
 
E e  
 
C C  
E#sE/" uS%Z'8  5 % % % 3# 3   B3 BC B B S  T  
 5<BB B.1B	B 5<JJ J.1J	JC3 CC Cd CKS Kc K K( (# ($ (&C H ( SX cN59#s(^KO6) ) ) q q qs  ,++,s   I II