
    є jav                     4   d Z ddlZddlZddlZddlmZ ddlmZmZm	Z	m
Z
mZmZ ddlmZ ddlmZ ddlmZ ddlmZmZ d	d
lmZ d	dlmZmZmZ d	dlmZmZ d	dlm Z m!Z! dZ"dZ#dZ$dZ%dZ&dZ'dZ(e#de$de%de&de(de'diZ) ej*        dej+                  Z, e
d          Z-de" de# de$ d e% d!e& d"e( d#e' d$Z.d%e-d&e-fd'Z/d%e0d&ej        fd(Z1d%ej        d&e0fd)Z2e/fd*ed+d,d-e0d.eegef         d&e	e3e0                  f
d/Z4 G d0 d1e          Z5 G d2 d,ee!          Z6dS )3z~
Anything related to Extensible Metadata Platform (XMP) metadata.

https://en.wikipedia.org/wiki/Extensible_Metadata_Platform
    N)Iterator)AnyCallableOptionalTypeVarUnioncast)ExpatBuilderNS)Document)Element)
ExpatErrorXMLParserType   )XmpInformationProtocol)
StreamTypedeprecate_with_replacementdeprecation_no_replacement)PdfReadErrorXmpDocumentError)ContentStream	PdfObjectz+http://www.w3.org/1999/02/22-rdf-syntax-ns#z http://purl.org/dc/elements/1.1/zhttp://ns.adobe.com/xap/1.0/zhttp://ns.adobe.com/pdf/1.3/zhttp://ns.adobe.com/xap/1.0/mm/zhttp://ns.adobe.com/pdfx/1.3/zhttp://www.aiim.org/pdfa/ns/id/dcxmppdfxmpMMpdfaidpdfxa{  
        (?P<year>[0-9]{4})
        (-
            (?P<month>[0-9]{2})
            (-
                (?P<day>[0-9]+)
                (T
                    (?P<hour>[0-9]{2}):
                    (?P<minute>[0-9]{2})
                    (:(?P<second>[0-9]{2}(.[0-9]+)?))?
                    (?P<tzd>Z|[-+][0-9]{2}:[0-9]{2})
                )?
            )?
        )?
        Ku   <?xpacket begin="﻿" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="pypdf">
    <rdf:RDF xmlns:rdf="z?">
        <rdf:Description rdf:about=""
            xmlns:dc="z"
            xmlns:xmp="z"
            xmlns:pdf="z"
            xmlns:xmpMM="z"
            xmlns:pdfaid="z"
            xmlns:pdfx="zM">
        </rdf:Description>
    </rdf:RDF>
</x:xmpmeta>
<?xpacket end="r"?>valuereturnc                     | S N r   s    ]C:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\pypdf/xmp.py	_identityr&   k   s    L    c           	         t                               |           }|t          d|            t          |                    d                    }t          |                    d          pd          }t          |                    d          pd          }t          |                    d          pd          }t          |                    d          pd          }t          j        |                    d	          pd          }|                    t
          j                  }||z
  d
z  }	t          |          }
t          |	          }|                    d          pd}t          j	        ||||||
|          }|dk    rKd |
                    d          D             \  }}|dz  }|dk     r|dz  }|t          j        ||          z   }|S )NzInvalid date format: yearmonth1dayhour0minutesecondi@B tzdZc              3   4   K   | ]}t          |          V  d S r"   )int).0xs     r%   	<genexpr>z"_converter_date.<locals>.<genexpr>   s(      !A!AQ#a&&!A!A!A!A!A!Ar'   :r   )hoursminutes)iso8601match
ValueErrorr4   groupdecimalDecimalto_integralROUND_FLOORdatetimesplit	timedelta)r   matchesr)   r*   r,   r-   r/   r0   seconds_decmilliseconds_decsecondsmillisecondsr1   dt	tzd_hourstzd_minutess                   r%   _converter_daterO   o   s   mmE""G :888999w}}V$$%%Dg&&-#..E
gmmE"")c
*
*Cw}}V$$+,,Dx((/C00F_W]]844;<<F$$W%899K,	9+G'((L
--


%#C		4T67L	Q	QB
cz K!A!A#))C..!A!A!A	;R	q= 	2K($9kJJJJIr'   c                     | j         8|                                 $|                     t          j        j                  } |                     d          } |                     d          S )zFormat a datetime as UTC with trailing 'Z'.

    - If the input is timezone-aware, convert to UTC first.
    - If naive, assume UTC.
    N)tzinfoz%Y-%m-%dT%H:%M:%S.%fZ)rQ   	utcoffset
astimezonerD   timezoneutcreplacestrftimer$   s    r%   _format_datetime_utcrX      s^     | 8EOO$5$5 8  !2!677MMM&&E>>1222r'   elementselfXmpInformation	list_type	converterc                    |                      t          |          }g }t          |          rZ|D ]U}|                     t          d          D ]7}|                    |          } ||          }|                    |           8V|S d S )Nli)getElementsByTagNameNSRDF_NAMESPACElen	_get_textappend)	rY   rZ   r\   r]   
containersretval	containeritemr   s	            r%   _generic_getri      s     //yIIJF
: # 	% 	%I!88MM % %t,,!	%((e$$$$% 4r'   c                        e Zd ZdZdededee         dee         dedee         dee         d	d
fdZded	d
f fdZ	 xZ
S )_XmpBuilderac  
    Custom XML parser denying all entity declarations.

    This is a stripped down and typed version inspired by what *defusedxml* does.

    Why do we need this? The default limits of *libexpat* used by Python only block exponential entity expansion,
    but not cases like quadratic entity expansion which can still cause quite some memory usage.
    entity_nameis_parameter_entityr   base	system_id	public_idnotation_namer    Nc                 &    t          d|          )NzForbidden entities: )r   )rZ   rl   rm   r   rn   ro   rp   rq   s           r%   !custom_entity_declaration_handlerz-_XmpBuilder.custom_entity_declaration_handler   s     ???@@@r'   parserc                 b    t                                          |           | j        |_        d S r"   )superinstallrs   EntityDeclHandler)rZ   rt   	__class__s     r%   rw   z_XmpBuilder.install   s*    #'#I   r'   )__name__
__module____qualname____doc__strboolr   rs   r   rw   __classcell__)ry   s   @r%   rk   rk      s         
A
A "&
A C=	
A
 3-
A 
A  }
A $C=
A 

A 
A 
A 
AJm J J J J J J J J J J Jr'   rk   c                      e Zd ZdZdeddfdZedUd            Z	 dVdede	de
ef         ddfdZd	e
d
e
de
dee         fdZd	e
d
e
dee         fdZdede
fdZefd
e
de
dee
gef         dee         fdZd
e
de
deee
                  fdZefd
e
de
deegef         deee                  fdZd
e
de
deeeef                  fdZedeee
                  fd            Zej        deee
                  ddfd            Zedee
         fd            Zej        dee
         ddfd            Zedeee
                  fd            Z e j        deee
                  ddfd            Z edeee!j!                          fd            Z"e"j        deee	e
e!j!        f                           ddfd            Z"edeee
e
f                  fd            Z#e#j        deee
e
f                  ddfd             Z#edee
         fd!            Z$e$j        dee
         ddfd"            Z$edee
         fd#            Z%e%j        dee
         ddfd$            Z%edeee
                  fd%            Z&e&j        deee
                  ddfd&            Z&edeee
                  fd'            Z'e'j        deee
                  ddfd(            Z'edeee
                  fd)            Z(e(j        deee
                  ddfd*            Z(edeee
e
f                  fd+            Z)e)j        deee
e
f                  ddfd,            Z)edee
         fd-            Z*e*j        dee
         ddfd.            Z*edeee
                  fd/            Z+e+j        deee
                  ddfd0            Z+edeee
e
f                  fd1            Z,e,j        deee
e
f                  ddfd2            Z,edeee
                  fd3            Z-e-j        deee
                  ddfd4            Z-edee
         fd5            Z.e.j        dee
         ddfd6            Z.edee
         fd7            Z/e/j        dee
         ddfd8            Z/edee
         fd9            Z0e0j        dee
         ddfd:            Z0edee!j!                 fd;            Z1e1j        dee!j!                 ddfd<            Z1edee!j!                 fd=            Z2e2j        dee!j!                 ddfd>            Z2edee!j!                 fd?            Z3e3j        dee!j!                 ddfd@            Z3edee
         fdA            Z4e4j        dee
         ddfdB            Z4edee
         fdC            Z5e5j        dee
         ddfdD            Z5edee
         fdE            Z6e6j        dee
         ddfdF            Z6edee
         fdG            Z7e7j        dee
         ddfdH            Z7edee
         fdI            Z8e8j        dee
         ddfdJ            Z8edeeef         fdK            Z9dWd	e
defdMZ:d
e
de
ddfdNZ;d
e
de
dee
         ddfdOZ<d
e
de
deee
                  ddfdPZ=d
e
de
deee
                  ddfdQZ>d
e
de
deee
e
f                  ddfdRZ?d
e
de
fdSZ@dXdTZAdS )Yr[   z
    An object that represents Extensible Metadata Platform (XMP) metadata.
    Usually accessed by :py:attr:`xmp_metadata()<pypdf.PdfReader.xmp_metadata>`.

    Raises:
      PdfReadError: if XML is invalid

    streamr    Nc                 <   || _         	 | j                                         }t                                          |          }n+# t          t
          f$ r}t          d|           d }~ww xY w|                    t          d          d         | _	        i | _
        d S )Nz#XML in XmpInformation was invalid: RDFr   )r   get_datark   parseStringAttributeErrorr   r   r`   ra   rdf_rootcache)rZ   r   datadoc_rootes        r%   __init__zXmpInformation.__init__   s    	J;''))D!,!:!:4!@!@HH
+ 	J 	J 	JHQHHIII	J$,$C$C5%
 %

% &(


s   :A A,A''A,c                     t          dd          }|                    t                              d                      | |          S )z
        Create a new XmpInformation object with minimal structure.

        Returns:
            A new XmpInformation instance with empty metadata fields.
        Nutf-8)r   set_data_MINIMAL_XMPencode)clsr   s     r%   createzXmpInformation.create   sA     tT**++G44555s6{{r'   encryption_keyc                     t          ddd           |t          dd           | j                            |           d S )NzXmpInformation.write_to_streamzPdfWriter.xmp_metadataz6.0.0z/the encryption_key parameter of write_to_streamz5.0.0)r   r   r   write_to_stream)rZ   r   r   s      r%   r   zXmpInformation.write_to_stream   s^     	#,$	
 	
 	

  	&A7   	##F+++++r'   	about_uri	namespacenamec              #      K   | j                             t          d          D ]Y}|                    t          d          |k    r8|                    ||          }||V  |                    ||          E d {V  Zd S NDescriptionabout)r   r`   ra   getAttributeNSgetAttributeNodeNS)rZ   r   r   r   descattrs         r%   get_elementzXmpInformation.get_element   s      M88VV 	H 	HD""='::iG H..y$?? JJJ66y$GGGGGGGGG	H 	Hr'   c              #   N  K   | j                             t          d          D ]}|                    t          d          |k    r`t	          |j        j                  D ]-}|j                            |          }|r|j        |k    r|V  .|j	        D ]}|j        |k    r|V  d S r   )
r   r`   ra   r   range
attributeslengthrh   namespaceURI
childNodes)rZ   r   r   r   ir   childs          r%   get_nodes_in_namespacez%XmpInformation.get_nodes_in_namespace   s      M88VV 	$ 	$D""='::iG $t566 # #A?//22D # 1Y > #"


!_ $ $E)Y6 $#	$ 	$r'   rY   c                 R    d}|j         D ]}|j        |j        k    r
||j        z  }|S N )r   nodeType	TEXT_NODEr   )rZ   rY   textr   s       r%   rc   zXmpInformation._get_text  s<    ' 	# 	#E~0 #
"r'   r]   c                 V   | j                             |i                               |          }|r|S d }|                     d||          D ]/}|j        |j        k    r|j        }n|                     |          } | ||          }| j                             |i           }|||<   |S r   )r   getr   r   ATTRIBUTE_NODE	nodeValuerc   
setdefault)rZ   r   r   r]   cachedr   rY   ns_caches           r%   _get_single_valuez XmpInformation._get_single_value  s     	2..22488 	M''It<< 	 	G7#99 0)w// 	%Ie$$E:((B77r'   c                    | j                             |i                               |          }|r t          t          t                   |          S g }|                     d||          D ]V}t          || d          x}|                    |           ,|                     |          }|	                    |           W| j         
                    |i           }|||<   |S )Nr   Bagr\   )r   r   r	   listr~   r   ri   extendrc   rd   r   )	rZ   r   r   r   rf   rY   bagsr   r   s	            r%   _getter_bagzXmpInformation._getter_bag"  s    	2..22488 	+S	6***''It<< 	% 	%G$WdeDDDD %d####w//e$$$$:((B77r'   c                 .   | j                             |i                               |          }|r t          t          t                   |          S g }|                     d||          D ]}t          || d|          x}|                    |           -t          || d          x}|                    |           W ||                     |                    }	|	                    |	           | j         
                    |i           }
||
|<   |S )Nr   Seq)r\   r]   r   r   )r   r   r	   r   r   r   ri   r   rc   rd   r   )rZ   r   r   r]   r   rf   rY   seqsr   r   r   s              r%   _get_seq_valueszXmpInformation._get_seq_values1  s$    	2..22488 	+S	6***''It<< 	% 	%G$WdeyYYYY %d####&wFFFF$ % d####!	$.."9"9::e$$$$:((B77r'   c                 R   | j                             |i                               |          }|r't          t          t          t          f         |          S i }|                     d||          D ]}|                    t          d          }t          |          rQ|D ]M}|                    t          d          D ]/}| 	                    |          }	|	||
                    d          <   0N}| 	                    |          |d<   | j                             |i           }
||
|<   |S )Nr   Altr_   xml:langz	x-default)r   r   r	   dictr   r   r`   ra   rb   rc   getAttributer   )rZ   r   r   r   rf   rY   altsaltrh   r   r   s              r%   _get_langalt_valuesz"XmpInformation._get_langalt_valuesN  s8   	2..22488 	0S#X///!#''It<< 	> 	>G11-GGD4yy > F FC # : :=$ O O F F $t 4 4@Et00<<==FF
 '+nnW&=&={##:((B77r'   c                 8    |                      t          d          S )z6Contributors to the resource (other than the authors).contributorr   DC_NAMESPACErZ   s    r%   dc_contributorzXmpInformation.dc_contributor`  s     m<<<r'   valuesc                 >    |                      t          d|           d S )Nr   _set_bag_valuesr   rZ   r   s     r%   r   zXmpInformation.dc_contributore  s     \=&AAAAAr'   c                 8    |                      t          d          S )z4Text describing the extent or scope of the resource.coverager   r   r   s    r%   dc_coveragezXmpInformation.dc_coveragei  s     %%lJ???r'   r   c                 >    |                      t          d|           d S )Nr   _set_single_valuer   rZ   r   s     r%   r   zXmpInformation.dc_coveragen  s     |Z?????r'   c                 8    |                      t          d          S )zVA sorted array of names of the authors of the resource, listed in order of precedence.creator)r   r   r   s    r%   
dc_creatorzXmpInformation.dc_creatorr  s     ##L)<<<r'   c                 >    |                      t          d|           d S )Nr   )_set_seq_valuesr   r   s     r%   r   zXmpInformation.dc_creatorw       \9f=====r'   c                 D    |                      t          dt                    S )zXA sorted array of dates of significance to the resource. The dates and times are in UTC.date)r   r   rO   r   s    r%   dc_datezXmpInformation.dc_date{  s     ##L&/JJJr'   c                 J   ||                      t          dd            d S g }|D ]a}t          |t          j                  r#|                    t          |                     ?|                    t          |                     b|                      t          d|           d S )Nr   )r   r   
isinstancerD   rd   rX   r~   )rZ   r   date_stringsr   s       r%   r   zXmpInformation.dc_date  s     		E  vt<<<<<L 4 4eX%677 4 ''(<U(C(CDDDD ''E

3333  v|DDDDDr'   c                 8    |                      t          d          S )zSA language-keyed dictionary of textual descriptions of the content of the resource.descriptionr   r   r   s    r%   dc_descriptionzXmpInformation.dc_description  s     ''mDDDr'   c                 >    |                      t          d|           d S )Nr   _set_langalt_valuesr   r   s     r%   r   zXmpInformation.dc_description  s       }fEEEEEr'   c                 8    |                      t          d          S )zThe mime-type of the resource.formatr   r   s    r%   	dc_formatzXmpInformation.dc_format       %%lH===r'   c                 >    |                      t          d|           d S )Nr   r   r   s     r%   r   zXmpInformation.dc_format       |Xu=====r'   c                 8    |                      t          d          S )z"Unique identifier of the resource.
identifierr   r   s    r%   dc_identifierzXmpInformation.dc_identifier  s     %%lLAAAr'   c                 >    |                      t          d|           d S )Nr   r   r   s     r%   r   zXmpInformation.dc_identifier  s     |\5AAAAAr'   c                 8    |                      t          d          S )zAAn unordered array specifying the languages used in the resource.languager   r   s    r%   dc_languagezXmpInformation.dc_language       j999r'   c                 >    |                      t          d|           d S )Nr   r   r   s     r%   r   zXmpInformation.dc_language       \:v>>>>>r'   c                 8    |                      t          d          S )z&An unordered array of publisher names.	publisherr   r   s    r%   dc_publisherzXmpInformation.dc_publisher  s     k:::r'   c                 >    |                      t          d|           d S )Nr  r   r   s     r%   r  zXmpInformation.dc_publisher  s     \;?????r'   c                 8    |                      t          d          S )zLAn unordered array of text descriptions of relationships to other documents.relationr   r   s    r%   dc_relationzXmpInformation.dc_relation  r  r'   c                 >    |                      t          d|           d S )Nr	  r   r   s     r%   r
  zXmpInformation.dc_relation  r  r'   c                 8    |                      t          d          S )z`A language-keyed dictionary of textual descriptions of the rights the user has to this resource.rightsr   r   s    r%   	dc_rightszXmpInformation.dc_rights  s     ''h???r'   c                 >    |                      t          d|           d S )Nr  r   r   s     r%   r  zXmpInformation.dc_rights  s       x@@@@@r'   c                 8    |                      t          d          S )zCUnique identifier of the work from which this resource was derived.sourcer   r   s    r%   	dc_sourcezXmpInformation.dc_source  r   r'   c                 >    |                      t          d|           d S )Nr  r   r   s     r%   r  zXmpInformation.dc_source  r   r'   c                 8    |                      t          d          S )z\An unordered array of descriptive phrases or keywords that specify the topic of the content.subjectr   r   s    r%   
dc_subjectzXmpInformation.dc_subject  s     i888r'   c                 >    |                      t          d|           d S )Nr  r   r   s     r%   r  zXmpInformation.dc_subject  r   r'   c                 8    |                      t          d          S )z9A language-keyed dictionary of the title of the resource.titler   r   s    r%   dc_titlezXmpInformation.dc_title  s     ''g>>>r'   c                 >    |                      t          d|           d S )Nr  r   r   s     r%   r  zXmpInformation.dc_title  s       w?????r'   c                 8    |                      t          d          S )z@An unordered array of textual descriptions of the document type.typer   r   s    r%   dc_typezXmpInformation.dc_type  s     f555r'   c                 >    |                      t          d|           d S )Nr  r   r   s     r%   r  zXmpInformation.dc_type  s     \66:::::r'   c                 8    |                      t          d          S )z:An unformatted text string representing document keywords.Keywordsr   PDF_NAMESPACEr   s    r%   pdf_keywordszXmpInformation.pdf_keywords       %%mZ@@@r'   c                 >    |                      t          d|           d S )Nr!  r   r#  r   s     r%   r$  zXmpInformation.pdf_keywords       }j%@@@@@r'   c                 8    |                      t          d          S )z-The PDF file version, for example 1.0 or 1.3.
PDFVersionr"  r   s    r%   pdf_pdfversionzXmpInformation.pdf_pdfversion  s     %%m\BBBr'   c                 >    |                      t          d|           d S )Nr*  r'  r   s     r%   r+  zXmpInformation.pdf_pdfversion  s     }lEBBBBBr'   c                 8    |                      t          d          S )z6The name of the tool that saved the document as a PDF.Producerr"  r   s    r%   pdf_producerzXmpInformation.pdf_producer  r%  r'   c                 >    |                      t          d|           d S )Nr.  r'  r   s     r%   r/  zXmpInformation.pdf_producer  r(  r'   c                 D    |                      t          dt                    S )zYThe date and time the resource was originally created. Returned as a UTC datetime object.
CreateDater   XMP_NAMESPACErO   r   s    r%   xmp_create_datezXmpInformation.xmp_create_date       %%m\?SSSr'   c                     |r-t          |          }|                     t          d|           d S |                     t          dd            d S )Nr2  rX   r   r4  rZ   r   date_strs      r%   r5  zXmpInformation.xmp_create_date  T     	F+E22H""=,IIIII""=,EEEEEr'   c                 D    |                      t          dt                    S )zTThe date and time the resource was last modified. Returned as a UTC datetime object.
ModifyDater3  r   s    r%   xmp_modify_datezXmpInformation.xmp_modify_date  r6  r'   c                     |r-t          |          }|                     t          d|           d S |                     t          dd            d S )Nr=  r8  r9  s      r%   r>  zXmpInformation.xmp_modify_date  r;  r'   c                 D    |                      t          dt                    S )zjThe date and time that any metadata for this resource was last changed. Returned as a UTC datetime object.MetadataDater3  r   s    r%   xmp_metadata_datez XmpInformation.xmp_metadata_date%  s     %%m^_UUUr'   c                     |r-t          |          }|                     t          d|           d S |                     t          dd            d S )NrA  r8  r9  s      r%   rB  z XmpInformation.xmp_metadata_date*  sT     	H+E22H""=.(KKKKK""=.$GGGGGr'   c                 8    |                      t          d          S )z=The name of the first known tool used to create the resource.CreatorTool)r   r4  r   s    r%   xmp_creator_toolzXmpInformation.xmp_creator_tool2  s     %%m]CCCr'   c                 >    |                      t          d|           d S )NrE  )r   r4  r   s     r%   rF  zXmpInformation.xmp_creator_tool7  s     }mUCCCCCr'   c                 8    |                      t          d          S )zGThe common identifier for all versions and renditions of this resource.
DocumentIDr   XMPMM_NAMESPACEr   s    r%   xmpmm_document_idz XmpInformation.xmpmm_document_id;       %%o|DDDr'   c                 >    |                      t          d|           d S )NrI  r   rK  r   s     r%   rL  z XmpInformation.xmpmm_document_id@       eDDDDDr'   c                 8    |                      t          d          S )zZAn identifier for a specific incarnation of a document, updated each time a file is saved.
InstanceIDrJ  r   s    r%   xmpmm_instance_idz XmpInformation.xmpmm_instance_idD  rM  r'   c                 >    |                      t          d|           d S )NrR  rO  r   s     r%   rS  z XmpInformation.xmpmm_instance_idI  rP  r'   c                 8    |                      t          d          S )zMThe part of the PDF/A standard that the document conforms to (e.g., 1, 2, 3).partr   PDFAID_NAMESPACEr   s    r%   pdfaid_partzXmpInformation.pdfaid_partM  s     %%&6???r'   c                 >    |                      t          d|           d S )NrV  r   rX  r   s     r%   rY  zXmpInformation.pdfaid_partR  s!    /?????r'   c                 8    |                      t          d          S )zFThe conformance level within the PDF/A standard (e.g., 'A', 'B', 'U').conformancerW  r   s    r%   pdfaid_conformancez!XmpInformation.pdfaid_conformanceV  s     %%&6FFFr'   c                 >    |                      t          d|           d S )Nr]  r[  r   s     r%   r^  z!XmpInformation.pdfaid_conformance[  s!    /FFFFFr'   c           
         t          | d          si | _        |                     dt                    D ]}|j        }	 |                    d          }|dk    rnF|d|         t          t          ||dz   |dz            d	
                    z   ||dz   d         z   }b|j        |j	        k    r|j
        }n|                     |          }|| j        |<   | j        S )z
        Retrieve custom metadata properties defined in the undocumented pdfx
        metadata schema.

        Returns:
            A dictionary of key/value items for custom metadata properties.

        _custom_propertiesr   Tu   ↂr9   Nr         )rn   )hasattrra  r   PDFX_NAMESPACE	localNamefindchrr4   r   r   r   rc   )rZ   nodekeyidxr   s        r%   custom_propertiesz XmpInformation.custom_properties_  s
    t122 	5&(D#33BGG 5 5n	((8,,Cby DSD	c#cAga&7"8rBBBCCDcAgii.) 	 =D$77 1 NEE NN400E/4',,&&r'   r   c                 n   | j                             t          d          D ]%}|                    t          d          |k    r|c S &| j         j        }|t          d          |                    t          d          }|                    t          d|           | j                             |           |S )zBGet or create an rdf:Description element with the given about URI.r   r   NXMP Document is Nonezrdf:Descriptionz	rdf:about)	r   r`   ra   r   ownerDocumentr   createElementNSsetAttributeNSappendChild)rZ   r   r   docs       r%   _get_or_create_descriptionz)XmpInformation._get_or_create_description~  s    M88VV 	 	D""='::iG  m) 	;"#9:::""=2CDDM;	BBB!!$'''r'   c                 T    | j                             |          }|r	||v r||= dS dS dS )z<Remove a cached value for a given namespace/name if present.N)r   r   )rZ   r   r   r   s       r%   _clear_cache_entryz!XmpInformation._clear_cache_entry  sH    :>>),, 	( 		 	 	 	r'   c                    |                      ||           |                                 }t          |                    ||                    }|D ]}|                    |           |                    ||          x}r|                    |           || j        j        }|t          d          | 
                    |          }	|                    ||	 d|           }|                    t          |                    }
|                    |
           |                    |           |                                  dS )z&Set or remove a single metadata value.Nrn  r8   )rv  rt  r   r`   removeChildr   removeAttributeNoder   ro  r   _get_namespace_prefixrp  createTextNoder~   rr  _update_stream)rZ   r   r   r   r   existing_elementselemexisting_attrrs  prefix	text_nodes              r%   r   z XmpInformation._set_single_value  sV   	4000..00 !<!<Y!M!MNN% 	# 	#DT"""" 33ItDDD= 	4$$]333 	#--C ?&'=>>>//	::F&&yV2D2Dd2D2DEED**3u::66IY'''T"""r'   c                    |                      ||           |                                 }t          |                    ||                    }|D ]}|                    |           |r| j        j        }|t          d          |                     |          }|	                    || d|           }|	                    t          d          }	|D ]i}
|	                    t          d          }|                    t          |
                    }|                    |           |	                    |           j|                    |	           |                    |           |                                  dS )z+Set or remove bag values (unordered array).Nrn  r8   zrdf:Bagrdf:lirv  rt  r   r`   rx  r   ro  r   rz  rp  ra   r{  r~   rr  r|  )rZ   r   r   r   r   r}  r~  rs  r  bagr   r_   r  s                r%   r   zXmpInformation._set_bag_values     	4000..00 !<!<Y!M!MNN% 	# 	#DT"""" 	#--C ?&'=>>>//	::F&&yV2D2Dd2D2DEED%%mY??C $ $((AA..s5zz::	y)))####S!!!T"""r'   c                    |                      ||           |                                 }t          |                    ||                    }|D ]}|                    |           |r| j        j        }|t          d          |                     |          }|	                    || d|           }|	                    t          d          }	|D ]i}
|	                    t          d          }|                    t          |
                    }|                    |           |	                    |           j|                    |	           |                    |           |                                  dS )z.Set or remove sequence values (ordered array).Nrn  r8   zrdf:Seqr  r  )rZ   r   r   r   r   r}  r~  rs  r  seqr   r_   r  s                r%   r   zXmpInformation._set_seq_values  r  r'   c                 T   |                      ||           |                                 }t          |                    ||                    }|D ]}|                    |           |r)| j        j        }|t          d          |                     |          }|	                    || d|           }|	                    t          d          }	|                                D ]\  }
}|	                    t          d          }|                    d|
           |                    t          |                    }|                    |           |	                    |           |                    |	           |                    |           |                                  dS )z*Set or remove language alternative values.Nrn  r8   zrdf:Altr  r   )rv  rt  r   r`   rx  r   ro  r   rz  rp  ra   itemssetAttributer{  r~   rr  r|  )rZ   r   r   r   r   r}  r~  rs  r  r   langr   r_   r  s                 r%   r   z"XmpInformation._set_langalt_values  s   	4000..00 !<!<Y!M!MNN% 	# 	#DT"""" 	#--C ?&'=>>>//	::F&&yV2D2Dd2D2DEED%%mY??C%||~~ $ $e((AA
D111..s5zz::	y)))####S!!!T"""r'   c                 8    t                               |d          S )z?Get the appropriate namespace prefix for a given namespace URI.unknown)_NAMESPACE_PREFIX_MAPr   )rZ   r   s     r%   rz  z$XmpInformation._get_namespace_prefix  s    $((I>>>r'   c                     | j         j        }|t          d          |                    d          }| j                            |           dS )z/Update the stream with the current XML content.Nrn  r   )encoding)r   ro  r   toxmlr   r   )rZ   rs  xml_datas      r%   r|  zXmpInformation._update_stream  sR    m) 	;"#9:::99g9..X&&&&&r'   )r    r[   r"   )r   )r    N)Brz   r{   r|   r}   r   r   classmethodr   r   r   r~   bytesr   r   r   r   r   
XmlElementrc   r&   r   r   r   r   r   r   r   r   propertyr   setterr   r   rD   r   r   r   r   r   r  r
  r  r  r  r  r  r$  r+  r/  r5  r>  rB  rF  rL  rS  rY  r^  rl  rt  rv  r   r   r   r   rz  r|  r#   r'   r%   r[   r[      s+        
(} 
( 
( 
( 
( 
( 	 	 	 [	 MQ, , ,27c58H2I,	, , , ,HS HS H HQT H H H H	$ 	$ 	$QT 	$ 	$ 	$ 	$      +4	   SE3J'	
 
#   ,S  c8K    & +4	   SE3J'	
 
$s)	   :S  cSVh@X    $ =c 3 = = = X= BXd3i%8 BT B B B B @Xc] @ @ @ X@ @# @4 @ @ @ @ =HT#Y/ = = = X= >$s)!4 > > > > > K$x'8"9: K K K XK ^
EhtE#x7H2H,I'JK 
EPT 
E 
E 
E ^
E Ec3h 8 E E E XE FXd38n%= F$ F F F F >8C= > > > X> >x} > > > > > Bx} B B B XB B8C= BT B B B B :Xd3i0 : : : X: ?(49"5 ?$ ? ? ? ? ;htCy1 ; ; ; X; @8DI#6 @4 @ @ @ @ :Xd3i0 : : : X: ?(49"5 ?$ ? ? ? ? @8DcN3 @ @ @ X@ Ac3h 8 AT A A A A >8C= > > > X> >x} > > > > > 9HT#Y/ 9 9 9 X9 >$s)!4 > > > > > ?(4S>2 ? ? ? X? _@xS#X7 @D @ @ @ _@ 6$s), 6 6 6 X6 ^;htCy1 ;d ; ; ; ^; Ahsm A A A XA A(3- AD A A A A C C C C XC CHSM Cd C C C C Ahsm A A A XA A(3- AD A A A A T(*;!< T T T XT FXh.?%@ FT F F F F T(*;!< T T T XT FXh.?%@ FT F F F F V8H,=#> V V V XV Hx0A'B Ht H H H H D(3- D D D XD Dhsm D D D D D E8C= E E E XE Ex} E E E E E E8C= E E E XE Ex} E E E E E @Xc] @ @ @ X@ @# @4 @ @ @ @ GHSM G G G XG G G$ G G G G '4S> ' ' ' X'< C     C s t    3 c (3- TX    0 C $s)AT Y]    8 C $s)AT Y]    8S  XdSVX[S[nE] bf    :?s ?s ? ? ? ?' ' ' ' ' 'r'   )7r}   rD   r@   recollections.abcr   typingr   r   r   r   r   r	   xml.dom.expatbuilderr
   xml.dom.minidomr   r   r  xml.parsers.expatr   r   
_protocolsr   _utilsr   r   r   errorsr   r   genericr   r   ra   r   r4  r#  rK  re  rX  r  compileVERBOSEr<   r   r   r&   r~   rO   rX   r   ri   rk   r[   r#   r'   r%   <module>r     sp      				 $ $ $ $ $ $                0 / / / / / $ $ $ $ $ $ 1 1 1 1 1 1 7 7 7 7 7 7 7 7 . . . . . . V V V V V V V V V V 2 2 2 2 2 2 2 2 - - - - - - - -=1..3( 1 5  $55WhF  "* J! ( GCLL&  $	 
 &  &  *  ,  (   Q 1    3 8#4    6
3 1 
3c 
3 
3 
3 
3 hq #3@CPXZ]Y^`cYcPdd3i   J J J J J. J J J8H	' H	' H	' H	' H	'+Y H	' H	' H	' H	' H	'r'   