Ë
    ˜…j
  ã                   óŠ   — d Z ddlZddlZddlmZ ddlmZ ddl	m
Z
  ej                  d«      Z G d„ dej                  «      Zy))ÚPdfUnspHandleré    N)ÚPdfiumErrorÚ	pypdfium2c                   ó>   — e Zd ZdZdZd„ Zd„ Zed„ «       Zd„ Z	dd„Z
y)	r   am  
    Unsupported feature handler helper class.
    
    Attributes:
        raw (UNSUPPORT_INFO):
           The underlying pdfium ``UNSUPPORT_INFO`` struct.
        handlers (dict[str, typing.Callable]):
            A dictionary of named handler functions to be called with an unsupported code (:attr:`FPDF_UNSP_*`) when PDFium detects an unsupported feature.
    Nc                 óH   — i | _         t        j                  d¬«      | _        y )Né   )Úversion)ÚhandlersÚpdfium_cÚUNSUPPORT_INFOÚraw©Úselfs    ú_/root/aria/tools/markitdown-venv/lib/python3.12/site-packages/pypdfium2/_helpers/unsupported.pyÚ__init__zPdfUnspHandler.__init__   s   € ØˆŒÜ×*Ñ*°1Ô5ˆ�ó    c                 óR   — | j                   j                  «       D ]
  } ||«       Œ y ©N)r
   Úvalues)r   Ú_ÚtypeÚhandlers       r   Ú__call__zPdfUnspHandler.__call__    s%   € Ø—}‘}×+Ñ+Ó-ò 	ˆGÙ�D�Mñ	r   c                 ón   — t         j                  dt        j                  j	                  | «      › �«       y )NzUnsupported PDF feature: )Ú
lib_loggerÚwarningÚpdfium_iÚUnsupportedInfoToStrÚget)r   s    r   Ú_defaultzPdfUnspHandler._default$   s+   € ä×ÑÐ6´x×7TÑ7T×7XÑ7XÐY]Ó7^Ð6_Ð`Õar   c                 óX   — t        | j                  «       t        | j                  «       y r   )Úidr
   r   r   s    r   Ú_keepzPdfUnspHandler._keep(   s   € Ü
ˆ4�=‰=ÔÜ
ˆ4�8‰8�r   c                 óh  — t         j                  rt        d«      ‚t        j                  | j
                  d| «       t        j                  | j
                  «      }|st        d«      ‚| t         _        t        j                  | j                  «       |rt         j                  | j                  d<   yy)aŠ  
        Register the handler with PDFium, and install an exit function that will keep the object alive until the end of session.
        
        Once set up, a :class:`.PdfUnspHandler` cannot be removed. It stands and falls with the library.
        Thus, this function can only be called once in a session.
        However, you may change the wrapped :attr:`.handlers` callbacks.
        Call ``.handlers.clear()`` to remove all handlers, thereby effectively disabling the instance.
        
        Parameters:
            add_default (bool):
                If True, add a default callback that will log unsupported features as warning.
        zAOnly one PdfUnspHandler instance can be registered for a session.ÚFSDK_UnSupport_Handlerz)Failed to register PdfUnspHandler object.ÚdefaultN)r   Ú	SINGLETONÚRuntimeErrorr   Úset_callbackr   r   ÚFSDK_SetUnSpObjProcessHandlerr   ÚatexitÚregisterr#   r    r
   )r   Úadd_defaultÚoks      r   ÚsetupzPdfUnspHandler.setup,   s‰   € ô ×#Ò#ÜÐbÓcÐcä×Ñ˜dŸh™hÐ(@À$ÔGÜ×3Ñ3°D·H±HÓ=ˆÙÜÐIÓJÐJØ#'ŒÔ ô 	�‰˜Ÿ
™
Ô#ÙÜ'5×'>Ñ'>ˆD�M‰M˜)Ò$ð r   )T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r'   r   r   Ústaticmethodr    r#   r/   © r   r   r   r      s8   „ ñð €Iò6òð ñbó ðbòô?r   r   )Ú__all__r+   ÚloggingÚpypdfium2.rawr   r   Úpypdfium2.internalÚinternalr   Úpypdfium2._helpers.miscr   Ú	getLoggerr   ÚAutoCastabler   r5   r   r   ú<module>r>      s?   ðð €ã Û Ý  Ý %Ý /àˆW×Ñ˜{Ó+€
ô6?�h×+Ñ+õ 6?r   