Ë
    F<kV1  ã                   ó¢  — U d Z ddlZddlZddlZddlmZ ddlmZ ddlm	Z	 ddl
mZmZ ej                  dedz  fd„«       Z ej                   d	¬
«       G d„ d«      «       Z e«       Z e	de¬«      Ze	e   ed<   defd„Zdedz  deeef   defd„Z	 d&dedz  dedefd„Ze	 d&dedz  dedee   fd„«       Zddddddddddd d!d"d#d$œZdefd%„Zy)'zConfiguration value handling.é    N)ÚIterator)Úcontextmanager)Ú
ContextVar)ÚAnyÚLiteralÚreturnc                  ó,   — t        j                  d«      S )z•
    Small utility function to determine the `jbig2dec` binary path only once.

    Returns:
        The corresponding binary path if available.
    Újbig2dec)ÚshutilÚwhich© ó    úW/var/www/tapir-food/flask_app/venv/lib/python3.12/site-packages/pypdf/_configuration.pyÚ_determine_jbig2dec_binaryr      s   € ô �<‰<˜
Ó#Ð#r   T)Úfrozenc                   ó€  — e Zd ZU dZdZeed<   	 dZeed<   	 dZeed<   	 dZ	eed<   	 dZ
eed<   	 dZeed	<   	 dZeed
<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed<   	 dZeed <   	 dZeed!<   	 dZeed"<   	 dZeed#<   	 dZeed$<   	 dZ eed%<   	 dZ!eed&<   	 d'Z"eed(<   	 d)Z#eed*<   	 d+Z$eed,<   	 dZ%eed-<   	  e&jN                  e(¬.«      Z)e*d/z  ed0<   	 d1Z+e,d2   ed3<   	 d4Z-e.ed5<   	 d6e/d7d fd8„Z0y/)9ÚConfigurationaÂ  
    Configuration used while processing PDF files.

    These limits mostly protect against excessive resource consumption caused by malformed or malicious PDF files.

    .. note::

        Avoid relying on specific implementation details of this class. The main public API consists of the values
        being considered read-only for each instance with the overwrite method to create a new instance with the
        specified values changed.
    iÀhxÚmaximum_declared_stream_lengthÚ(array_based_stream_maximum_output_lengthi † Úarray_maximum_element_countÚ dictionary_maximum_element_countÚjbig2_maximum_output_lengthÚlzw_maximum_output_lengthÚ run_length_maximum_output_lengthÚzlib_maximum_output_lengthi@KL Ú"zlib_maximum_recovery_input_lengthÚbrotli_maximum_output_lengthi�Ð Úflate_maximum_columnsi 	= Úflate_maximum_row_lengthÚimage_maximum_buffer_sizeé   Ústream_filters_maximum_lengthi £áÚ#stream_decoding_work_maximum_lengthi€„ Ú!stream_parsing_work_maximum_countÚxmp_maximum_input_lengthÚxmp_maximum_element_countÚoutline_maximum_entrieséd   Úoutline_maximum_depthÚpage_tree_maximum_entriesÚpage_tree_maximum_depthÚpage_tree_maximum_page_entriesÚform_fields_maximum_entriesÚform_fields_maximum_depthÚ"named_destinations_maximum_entriesÚ named_destinations_maximum_depthÚannotations_maximum_per_pageiè  Úembedded_files_maximum_counti€²æÚ$embedded_files_maximum_output_lengthiˆ  Ú(xform_maximum_invocations_per_extractionÚ xfa_decoding_work_maximum_length)Údefault_factoryNÚjbig2dec_binaryÚcropbox)r8   ÚtrimboxÚpage_merge_boxFÚdisable_legacy_handlingÚkwargsr   c                 ó.   — t        j                  | fi |¤ŽS )a  
        Creates a new configuration with the specified values overwritten.

        Args:
            **kwargs: Configuration field names and their new values.

        Returns:
            A new configuration with the specified values overwritten.
        )ÚdataclassesÚreplace)Úselfr<   s     r   Úwith_overwriteszConfiguration.with_overwrites¦   s   € ô ×"Ñ" 4Ñ2¨6Ñ2Ð2r   )1Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚintÚ__annotations__r   r   r   r   r   r   r   r   r   r   r   r    r"   r#   r$   r%   r&   r'   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r>   Úfieldr   r7   Ústrr:   r   r;   Úboolr   rA   r   r   r   r   r      sF  … ñ
ð +5Ð" CÓ4ØEØ4>Ð,¨cÓ>ØDØ'.Ð Ó.ØAØ,3Ð$ cÓ3ØLà'1Ð Ó1ðð &0Ð˜sÓ/ðð -7Ð$ cÓ6ðð '1Ð Ó0ðð /8Ð&¨Ó7ðð )3Ð  #Ó2ðð
 ")Ð˜3Ó(ØWØ$-Ð˜cÓ-ØPà%/Ð˜sÓ/ØEà)+Ð! 3Ó+Ø;Ø/:Ð'¨Ó:ØLØ-6Ð% sÓ6ðð
 %.Ð˜cÓ-ØVØ%,Ð˜sÓ,Ø>à#*Ð˜SÓ*Ø8Ø!$Ð˜3Ó$Ø8à%,Ð˜sÓ,ØAØ#&Ð˜SÓ&Ø5Ø*3Ð" CÓ3ðð
 (/Ð Ó.Ø4Ø%(Ð˜sÓ(Ø4à.5Ð&¨Ó5ØJØ,/Ð$ cÓ/ØFà(/Ð  #Ó/ðð
 )-Ð  #Ó,Ø7Ø0;Ð(¨#Ó;Øià49Ð,¨cÓ9Ø[à,7Ð$ cÓ7ØRà"3 +×"3Ñ"3ÐD^Ô"_€O�S˜4‘ZÓ_ðð 5>€N�GÐ0Ñ1Ó=Ø+à$)Ð˜TÓ)ðð
3¨ð 
3°ô 
3r   r   Úpypdf_configuration)ÚdefaultÚCURRENT_CONFIGURATIONc                  ó*   — t         j                  «       S )zY
    Get the current configuration.

    Returns:
        The current configuration.
    )rM   Úgetr   r   r   Úget_configurationrP   ½   s   € ô !×$Ñ$Ó&Ð&r   ÚconfigurationÚ
overwritesc                 óB   — | �| n	t        «       } |j                  di |¤ŽS )a  
    Utility function to build a new configuration from the given values.

    Args:
        configuration: A possible explicit configuration to use instead of the current configuration.
        overwrites: Entries to overwrite.

    Returns:
        The generated configuration.
    r   )rP   rA   )rQ   rR   Úbases      r   Ú_build_configurationrU   Ç   s,   € ð *Ð5‰=Ô;LÓ;N€Dð  ˆ4×ÑÑ- *Ñ-Ð-r   c                 óH   — t        | |«      }t        j                  |«       |S )a"  
    Overwrite the configuration for the current execution context.

    Args:
        configuration: A direct configuration instance to use.
        **overwrites: Configuration parameters to overwrite in the current or given configuration.

    Returns:
        The new configuration.
    )rU   rM   Úset)rQ   rR   Únew_configurations      r   Úoverwrite_configurationrY   Ü   s&   € ô -¨]¸JÓGÐÜ×ÑÐ/Ô0ØÐr   c              +   ó¶   K  — t        | |«      }t        j                  |«      }	 |–— t        j                  |«       y# t        j                  |«       w xY w­w)a  
    Temporarily overwrite the configuration.

    Args:
        configuration: A direct configuration instance to use.
        **overwrites: Configuration parameters to overwrite in the current or given configuration.

    Returns:
        The new configuration.
    N)rU   rM   rW   Úreset)rQ   rR   rX   Útokens       r   Úapply_configurationr]   ï   sN   è ø€ ô -¨]¸JÓGÐÜ!×%Ñ%Ð&7Ó8€Eð+ØÒä×#Ñ# EÕ*øÔ×#Ñ# EÕ*üs   ‚"A¥? ©A¿AÁAÚMAX_DECLARED_STREAM_LENGTHÚ$MAX_ARRAY_BASED_STREAM_OUTPUT_LENGTHÚJBIG2_MAX_OUTPUT_LENGTHÚLZW_MAX_OUTPUT_LENGTHÚRUN_LENGTH_MAX_OUTPUT_LENGTHÚZLIB_MAX_OUTPUT_LENGTHÚZLIB_MAX_RECOVERY_INPUT_LENGTHÚFLATE_MAX_COLUMNSÚFLATE_MAX_ROW_LENGTHÚFLATE_MAX_BUFFER_SIZEÚXMP_MAX_INPUT_LENGTHÚXMP_MAX_ELEMENT_COUNTÚJBIG2DEC_BINARYÚMERGE_CROP_BOX)r   r   r   r   r   r   r   r   r   r    r%   r&   r7   r:   c                  ó:  — t        «       } | j                  r| S ddlm} ddlm}m}m}m}m	}m
}m}m}	m}
m}m} ddlm}m} |	||||
|||||||||dœ}t&        j)                  «       D ]2  \  }}||   }|t+        t,        |«      k7  sŒddlm}  ||d|› �d¬	«       Œ4 | S )
z§
    Overwrite the current configuration with the legacy configuration if it has been changed.

    Returns:
        The new configuration which has been applied.
    r   )rk   )rg   re   rf   r`   rj   ra   r_   r^   rb   rc   rd   )ri   rh   )r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   rj   rk   )Údeprecation_with_replacementzConfiguration.z7.0.0)Úold_nameÚnew_nameÚ
removed_in)rP   r;   Úpypdf._pagerk   Úpypdf.filtersrg   re   rf   r`   rj   ra   r_   r^   rb   rc   rd   Ú	pypdf.xmpri   rh   ÚLEGACY_NAME_MAPPINGÚitemsÚgetattrÚDEFAULT_CONFIGURATIONÚpypdf._utilsrm   )rQ   rk   rg   re   rf   r`   rj   ra   r_   r^   rb   rc   rd   ri   rh   Úlegacy_valuesÚ
field_nameÚlegacy_nameÚlegacy_valuerm   s                       r   Úapply_legacy_configurationr}     sÈ   € ô &Ó'€MØ×,Ò,ØÐå*÷÷ ÷ ñ ÷ Fð 'AØ0TØ#:Ø!6Ø(DØ"8Ø*HØ.Ø 4Ø!6Ø 4Ø!6Ø*Ø(ñ€Mô" $7×#<Ñ#<Ó#>ò 
Ñˆ
�KØ$ [Ñ1ˆàœ7Ô#8¸*ÓEÓEÝAá(Ø$Ø)¨*¨Ð6Ø"öð
ð Ðr   )N)rE   r>   Ú	functoolsr   Úcollections.abcr   Ú
contextlibr   Úcontextvarsr   Útypingr   r   ÚcacherI   r   Ú	dataclassr   rw   rM   rG   rP   ÚdictrU   rY   r]   rt   r}   r   r   r   ú<module>r†      sp  ðÚ #Û Û Û Ý $Ý %Ý "ß ð ‡�ð$ C¨$¡Jò $ó ð$ð €×Ñ˜dÔ#÷Y3ð Y3ó $ðY3ñz &›Ð ñ 4>ØØ!ô4Ð �z -Ñ0ó ð'˜=ó 'ð.Ø  4Ñ'ð.à�S˜#�X‘ð.ð ó.ð, +/ñØ  4Ñ'ðàðð óð& à*.ñ+Ø  4Ñ'ð+àð+ð ˆmÑò+ó ð+ð0 'CØ0VØ#<Ø!8Ø(FØ":Ø*JØ0Ø 6Ø!8Ø 6Ø!8Ø(Ø&ñÐ ð$8 Mô 8r   