� J�gr��2�ddlZddlmZddlmZmZmZddlmZddlm Z m Z m Z ddl m Z mZmZmZmZmZmZddl mZdd l mZdd l mZe jfZGd �d ��ZGd �dee��ZGd�de��ZGd�de��ZGd�de��Z dS)�N)�datetime)� NamedTuple�Tuple�Union�)�Action)�AnnotationFlag�AnnotationName�FileAttachmentAnnotationName)�build_obj_dict� Destination�Name�PDFContentStream�PDFDate� PDFObject� PDFString)�create_dictionary_string)�create_list_string)�iobj_refc'���eZdZeddddddddddddddfdededededed eeeeefd ed e d e d e de dede dedee efdeedededef&d�ZdS)�AnnotationMixinNr��subtype�x�y�width�height�flags�contents�dest�action�color�modification_time�title� quad_points� border_width�name�ink_list� file_spec� field_type�default_appearancec ��td��|_t|��|_d|d�d||z d�d||zd�d|d�d� |_d|�d�|_|rt|��nd|_||_ttd�|D������|_ |rt|d� ��nd|_ | |_ ||_ | rd| d �d| d �d| d �d�nd|_| rt| d� ��nd|_| rt!| d� ��nd|_| rt%d �| D����nd|_d|_||_|rdt%d�|D����zdznd|_||_||_dS)N�Annot�[�.2f� �]z[0 0 c3�>K�|]}tj|��V��dS�N)r �coerce)�.0�flags �`/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/fpdf/annotations.py� <genexpr>z+AnnotationMixin.__init__.<locals>.<genexpr>7s-����I�I�4�>�0��6�6�I�I�I�I�I�I�T)�encryptrr�c3�K�|]}|d�V�� dS�r/Nr)r5� quad_points r7r8z+AnnotationMixin.__init__.<locals>.<genexpr>?s(����G�G�Z� �(�(�G�G�G�G�G�Gr9c3�K�|]}|d�V�� dSr=r)r5�coords r7r8z+AnnotationMixin.__init__.<locals>.<genexpr>Fs&����A�A�u�u�N�N�A�A�A�A�A�Ar9)r�typer�rect�border�f_t�v�sum�tuple�frr�ar �c�tr�m�pdf_listr%�pr'r(�f_s�d_a)�selfrrrrrrrr r!r"r#r$r%r&r'r(r)r*�valuer+s r7�__init__zAnnotationMixin.__init__s���.��M�M�� ��G�}�}�� �I��I�I�I��F� �I�I�I��U��I�I�I��I�I�I�I�� �-�l�-�-�-�� �'1�;�4� �#�#�#�t�������U�I�I�5�I�I�I�I�I�J�J���=E�O� �(�D�9�9�9�9�4�� ������ �:?�I�6�U�1�X�6�6��a��6�6�5��8�6�6�6�6�T���38�B��5�$�/�/�/�/�d���=N�X��*�D�9�9�9�9�TX���� �H�G�G�;�G�G�G� G� G� G�� �� ����� �� �S�8�A�A��A�A�A�A�A� A�C� G� G�� � � ���%����r9)�__name__� __module__� __qualname__�DEFAULT_ANNOT_FLAGS�str�intrrr r rrGrr r rSrr9r7rrs;������;N�� ���&*��!��DH�!����"&�+1&�1&��1&� �1&� � 1&� � 1&� � 1&��U�>�*�E�#�J�6�7�1&��1&��1&��1&��1&�$�1&��1&��1&��1&� �N�$@�@�A�!1&�"��*�#1&�$�%1&�&�'1&�* �+1&�1&�1&�1&�1&�1&r9rc�"��eZdZdZ�fd�Z�xZS)� PDFAnnotationz?A PDF annotation that get serialized as an obj<</>>endobj blockc�:��t��j|i|��dSr3)�superrS)rQ�args�kwargs� __class__s �r7rSzPDFAnnotation.__init__Qs%��������$�)�&�)�)�)�)�)r9)rTrUrV�__doc__rS� __classcell__�r`s@r7r[r[Ns>�������E�E�*�*�*�*�*�*�*�*�*r9r[c�$�eZdZdZdZdd�Zd�ZdS)�AnnotationDictzAA PDF annotation that get serialized as an inline <<dictionnary>>)rArrBrCrDrErHrrIr rJrKr%rNr'r(rOrPNc�x��t�fd�t���D��||���}t|��S)Nc�2��i|]}|t�|����Sr��getattr�r5�keyrQs �r7� <dictcomp>z,AnnotationDict.serialize.<locals>.<dictcomp>ns%��� :� :� :��S�'�$��$�$� :� :� :r9)�_security_handler�_obj_id)r �dir�pdf_dict�rQrmrn�obj_dicts` r7� serializezAnnotationDict.serializelsJ���!� :� :� :� :��D� � � :� :� :�/�� � � �� ��!�!�!r9c���d�t���D��}�fd�|D��}d�|���D��}d|�d�S)Nc�<�g|]}|�d���|��S)�__)� startswith)r5rks r7� <listcomp>z+AnnotationDict.__repr__.<locals>.<listcomp>us)��E�E�E�����t�0D�0D�E��E�E�Er9c�2��i|]}|t�|����Srrhrjs �r7rlz+AnnotationDict.__repr__.<locals>.<dictcomp>vs%��� 5� 5� 5��S�'�$��$�$� 5� 5� 5r9c�8�i|]\}}t|���||��Sr)�callable)r5rkrRs r7rlz+AnnotationDict.__repr__.<locals>.<dictcomp>ws)�� K� K� K�J�C��8�E�?�?� K�S�%� K� K� Kr9zAnnotationDict(**�))ro�items)rQ�keys�ds` r7�__repr__zAnnotationDict.__repr__tsa���E�E�s�4�y�y�E�E�E�� 5� 5� 5� 5�� 5� 5� 5�� K� K�!�'�'�)�)� K� K� K��'�1�'�'�'�'r9�NN)rTrUrVra� __slots__rsr�rr9r7rereUsD������G�G��I�*"�"�"�"�(�(�(�(�(r9rec�`��eZdZ ddededededed ed ef�fd � Zd �Zd �Z d�Z d�Z �xZ S)�PDFEmbeddedFile�NF�basenamer�desc� creation_date�modification_date�compress�checksumc�(��t���||���td��|_dt |��i}|r&t |d������|d<|r&t |d������|d<|rMtjdd � ��} | � |j ��| � ��} d | �d �|d <t|��|_ ||_||_d|_dS)N)rr�� EmbeddedFilez/SizeT)�with_tzz /CreationDatez/ModDate�md5F)�usedforsecurity�<�>z /CheckSum)r]rSrrA�lenrrs�hashlib�new�update� _contents� hexdigestrp�params� _basename�_desc�_globally_enclosed) rQr�rr�r�r�r�r�r�� file_hash�hash_hexr`s �r7rSzPDFEmbeddedFile.__init__|s��� �����(�X��>�>�>���(�(�� ��3�x�=�=�)�� � W�&-�m�T�&J�&J�&J�&T�&T�&V�&V�F�?� #� � V�!(�):�D�!I�!I�!I�!S�!S�!U�!U�F�:� � � 2�� �E�5�A�A�A�I� � � �T�^� ,� ,� ,� �*�*�,�,�H�"1�h�/�/�/�F�;� ��v�&�&�� �!����� �"&����r9c��|jSr3�r��rQs r7�globally_enclosedz!PDFEmbeddedFile.globally_enclosed�s ���&�&r9c��||_dSr3r�)rQrRs r7�set_globally_enclosedz%PDFEmbeddedFile.set_globally_enclosed�s��"'����r9c��|jSr3)r�r�s r7r�zPDFEmbeddedFile.basename�s ���~�r9c�8�t||j|j��Sr3)�FileSpecr�r�r�s r7r)zPDFEmbeddedFile.file_spec�s����d�n�d�j�9�9�9r9)r�NNFF) rTrUrVrX�bytesr�boolrSr�r�r�r)rbrcs@r7r�r�{s�������� �"&�&*���'�'��'��'�� '�  � '� $� '��'��'�'�'�'�'�'�6'�'�'�(�(�(����:�:�:�:�:�:�:r9r�c�6�eZdZUeed<eed<eed<dd�ZdS)r�� embedded_filer�r�Nc�$�dt|j�����tdt |jj��i��d�}|jr)t|j�����|d<t|d���S)Nz /Filespec�/F)z/Typer�z/EFz/Descr0)� field_join)rr�rsrp�pdf_refr��idr�rqs r7rszFileSpec.serialize�s��� ��D�M�*�*�4�4�6�6��T�7�4�+=�+@�#A�#A�B�C�C� � �� �9� A� )�$�)� 4� 4� >� >� @� @�H�W� ���S�1�1�1�1r9r�)rTrUrVr��__annotations__rXrsrr9r7r�r��sH�������"�"�"�"��M�M�M� �I�I�I�2�2�2�2�2�2r9r�)!r�r�typingrrr�actionsr�enumsr r r �syntaxr r rrrrrrrprrMrr��PRINTrWrr[rer�r�rr9r7�<module>r�s�������������+�+�+�+�+�+�+�+�+�+�������O�O�O�O�O�O�O�O�O�O�������������������9�8�8�8�8�8�2�2�2�2�2�2�'�'�'�'�'�'�&�+�-��2&�2&�2&�2&�2&�2&�2&�2&�j*�*�*�*�*�O�Y�*�*�*�#(�#(�#(�#(�#(�_�#(�#(�#(�L&:�&:�&:�&:�&:�&�&:�&:�&:�R 2� 2� 2� 2� 2�z� 2� 2� 2� 2� 2r9
Memory