
    Z?iv                     ,   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 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jR                  dejT                        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%e/d&ej                  fd(Z0d%ej                  d&e/fd)Z1e.fd*ed+d,d-e/d.eegef   d&e	e2e/      f
d/Z3 G d0 d1e      Z4 G d2 d,ee       Z5y)3z~
Anything related to Extensible Metadata Platform (XMP) metadata.

https://en.wikipedia.org/wiki/Extensible_Metadata_Platform
    N)Iterator)AnyCallableOptionalTypeVarUnion)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    ?/var/www/html/qr/venv/lib/python3.12/site-packages/pypdf/xmp.py	_identityr%   j   s    L    c           	      0   t         j                  |       }|t        d|        t        |j	                  d            }t        |j	                  d      xs d      }t        |j	                  d      xs d      }t        |j	                  d      xs d      }t        |j	                  d      xs d      }t        j                  |j	                  d	      xs d      }|j                  t
        j                        }||z
  d
z  }	t        |      }
t        |	      }|j	                  d      xs d}t        j                  ||||||
|      }|dk7  rDd |j                  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   2   K   | ]  }t        |        y wr!   )int).0xs     r$   	<genexpr>z"_converter_date.<locals>.<genexpr>   s     !AQ#a&!As   :r   )hoursminutes)iso8601match
ValueErrorr3   groupdecimalDecimalto_integralROUND_FLOORdatetimesplit	timedelta)r   matchesr(   r)   r+   r,   r.   r/   seconds_decmilliseconds_decsecondsmillisecondsr0   dt	tzd_hourstzd_minutess                   r$   _converter_daterN   n   su   mmE"G0899w}}V$%Dg&-#.E
gmmE")c
*Cw}}V$+,Dx(/C0F__W]]84;<F$$W%8%89K,	9+G'(L
--

%#C			4T67L	QB
cz!A#))C.!A	;R	q=2K($$9kJJIr&   c                     | j                   9| j                         )| j                  t        j                  j
                        } | j                  d      } | j                  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)rP   	utcoffset
astimezonerC   timezoneutcreplacestrftimer#   s    r$   _format_datetime_utcrW      sV     ||EOO$5$A  !2!2!6!67MMM&E>>122r&   elementselfXmpInformation	list_type	converterc                     | j                  t        |      }g }t        |      rN|D ]G  }|j                  t        d      D ],  }|j                  |      } ||      }|j	                  |       . I |S y )Nli)getElementsByTagNameNSRDF_NAMESPACElen	_get_textappend)	rX   rY   r[   r\   
containersretval	containeritemr   s	            r$   _generic_getrh      s{     //yIJF
:# 	%I!88M %t,!%(e$%	%
 r&   c                   l     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   )rY   rk   rl   r   rm   rn   ro   rp   s           r$   !custom_entity_declaration_handlerz-_XmpBuilder.custom_entity_declaration_handler   s     /?@@r&   parserc                 F    t         |   |       | j                  |_        y r!   )superinstallrr   EntityDeclHandler)rY   rs   	__class__s     r$   rv   z_XmpBuilder.install   s    #'#I#I r&   )__name__
__module____qualname____doc__strboolr   rr   r   rv   __classcell__)rx   s   @r$   rj   rj      s    
A
A "&
A C=	
A
 3-
A 
A  }
A $C=
A 

AJm J J Jr&   rj   c                      e Zd ZdZdeddfdZedTd       Z	 dUd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!jB                        fd       Z"e"j<                  deee	e
e!jB                  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!jB                     fd;       Z1e1j<                  dee!jB                     ddfd<       Z1edee!jB                     fd=       Z2e2j<                  dee!jB                     ddfd>       Z2edee!jB                     fd?       Z3e3j<                  dee!jB                     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       Z9dVd	e
defdLZ:d
e
de
ddfdMZ;d
e
de
dee
   ddfdNZ<d
e
de
de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
e
f      ddfdQZ?d
e
de
fdRZ@dWdSZAy)XrZ   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                   j                         }t               j                  |      }|j                  t        d      d   | _	        i | _
        y # t        t
        f$ r}t        d|       d }~ww xY w)Nz#XML in XmpInformation was invalid: RDFr   )r   get_datarj   parseStringAttributeErrorr   r   r_   r`   rdf_rootcache)rY   r   datadoc_rootes        r$   __init__zXmpInformation.__init__   s    	J;;'')D!,!:!:4!@H %-$C$C5%

% &(
 
+ 	J!DQCHII	Js   3A" "B1A??Bc                 r    t        dd      }|j                  t        j                  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   s1     tT*++G456{r&   encryption_keyc                 p    t        ddd       |t        dd       | j                  j                  |       y )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)rY   r   r   s      r$   r   zXmpInformation.write_to_stream   s>     	#,$	

 %&A7 	##F+r&   	about_uri	namespacenamec              #      K   | j                   j                  t        d      D ]N  }|j                  t        d      |k(  s|j	                  ||      }|| |j                  ||      E d {    P y 7 wNDescriptionabout)r   r_   r`   getAttributeNSgetAttributeNodeNS)rY   r   r   r   descattrs         r$   get_elementzXmpInformation.get_element   sv     MM88V 	HD""=':iG..y$?#J66y$GGG	H
 Hs   =A7 -A7-A5.A7c              #     K   | j                   j                  t        d      D ]  }|j                  t        d      |k(  st	        |j
                  j                        D ]4  }|j
                  j                  |      }|s!|j                  |k(  s1| 6 |j                  D ]  }|j                  |k(  s|   y wr   )
r   r_   r`   r   range
attributeslengthrg   namespaceURI
childNodes)rY   r   r   r   ir   childs          r$   get_nodes_in_namespacez%XmpInformation.get_nodes_in_namespace   s     MM88V 	$D""=':iGt556 #A??//2D 1 1Y >"
# "__ $E))Y6#$	$s   =B> ?B> B>$B>5	B>rX   c                 ~    d}|j                   D ]+  }|j                  |j                  k(  s||j                  z  }- |S N )r   nodeType	TEXT_NODEr   )rY   rX   textr   s       r$   rb   zXmpInformation._get_text  sA    '' 	#E~~0

"	# r&   r\   c                 ^   | j                   j                  |i       j                  |      }|r|S d }| j                  d||      D ]:  }|j                  |j                  k(  r|j
                  }n| j                  |      } n | ||      }| j                   j                  |i       }|||<   |S r   )r   getr   r   ATTRIBUTE_NODE	nodeValuerb   
setdefault)rY   r   r   r\   cachedr   rX   ns_caches           r$   _get_single_valuez XmpInformation._get_single_value  s     	2.2248M''It< 	G7#9#99))w/	 e$E::((B7r&   c                 b   | j                   j                  |i       j                  |      }|r|S g }| j                  d||      D ]F  }t        || d      x}|j	                  |       %| j                  |      }|j                  |       H | j                   j                  |i       }|||<   |S )Nr   Bagr[   r   r   r   rh   extendrb   rc   r   )	rY   r   r   r   re   rX   bagsr   r   s	            r$   _getter_bagzXmpInformation._getter_bag!  s    	2.2248M''It< 	%G$WdeDDQd#w/e$	% ::((B7r&   c                    | j                   j                  |i       j                  |      }|r|S g }| j                  d||      D ]o  }t        || d|      x}|j	                  |       &t        || d      x}|j	                  |       H || j                  |            }	|j                  |	       q | j                   j                  |i       }
||
|<   |S )Nr   Seq)r[   r\   r   r   r   )rY   r   r   r\   r   re   rX   seqsr   r   r   s              r$   _get_seq_valueszXmpInformation._get_seq_values0  s     	2.2248M''It< 	%G$WdeyYYfd#&wFF$S d#!$.."9:e$	% ::((B7r&   c                    | j                   j                  |i       j                  |      }|r|S i }| j                  d||      D ]  }|j                  t        d      }t        |      rH|D ]B  }|j                  t        d      D ]'  }| j                  |      }	|	||j                  d      <   ) D l| j                  |      |d<    | j                   j                  |i       }
||
|<   |S )Nr   Altr^   xml:langz	x-default)	r   r   r   r_   r`   ra   rb   getAttributer   )rY   r   r   r   re   rX   altsaltrg   r   r   s              r$   _get_langalt_valuesz"XmpInformation._get_langalt_valuesM  s    	2.2248M!#''It< 	>G11-GD4y FC # : :=$ O F $t 4@Et00<=FF
 '+nnW&={#	> ::((B7r&   c                 .    | j                  t        d      S )z6Contributors to the resource (other than the authors).contributorr   DC_NAMESPACErY   s    r$   dc_contributorzXmpInformation.dc_contributor_  s     m<<r&   valuesc                 2    | j                  t        d|       y )Nr   _set_bag_valuesr   rY   r   s     r$   r   zXmpInformation.dc_contributord  s    \=&Ar&   c                 .    | j                  t        d      S )z4Text describing the extent or scope of the resource.coverager   r   r   s    r$   dc_coveragezXmpInformation.dc_coverageh  s     %%lJ??r&   r   c                 2    | j                  t        d|       y )Nr   _set_single_valuer   rY   r   s     r$   r   zXmpInformation.dc_coveragem  s    |Z?r&   c                 .    | j                  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_creatorq  s     ##L)<<r&   c                 2    | j                  t        d|       y )Nr   )_set_seq_valuesr   r   s     r$   r   zXmpInformation.dc_creatorv      \9f=r&   c                 8    | j                  t        dt              S )zXA sorted array of dates of significance to the resource. The dates and times are in UTC.date)r   r   rN   r   s    r$   dc_datezXmpInformation.dc_datez  s     ##L&/JJr&   c                    || j                  t        dd        y g }|D ]Q  }t        |t        j                        r|j	                  t        |             8|j	                  t        |             S | j                  t        d|       y )Nr   )r   r   
isinstancerC   rc   rW   r}   )rY   r   date_stringsr   s       r$   r   zXmpInformation.dc_date  sw    >  vt<L 4eX%6%67 ''(<U(CD ''E
3	4
   v|Dr&   c                 .    | j                  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Dr&   c                 2    | j                  t        d|       y )Nr   _set_langalt_valuesr   r   s     r$   r   zXmpInformation.dc_description  s      }fEr&   c                 .    | j                  t        d      S )zThe mime-type of the resource.formatr   r   s    r$   	dc_formatzXmpInformation.dc_format       %%lH==r&   c                 2    | j                  t        d|       y )Nr   r   r   s     r$   r   zXmpInformation.dc_format      |Xu=r&   c                 .    | j                  t        d      S )z"Unique identifier of the resource.
identifierr   r   s    r$   dc_identifierzXmpInformation.dc_identifier  s     %%lLAAr&   c                 2    | j                  t        d|       y )Nr   r   r   s     r$   r   zXmpInformation.dc_identifier  s    |\5Ar&   c                 .    | j                  t        d      S )zAAn unordered array specifying the languages used in the resource.languager   r   s    r$   dc_languagezXmpInformation.dc_language       j99r&   c                 2    | j                  t        d|       y )Nr   r   r   s     r$   r   zXmpInformation.dc_language      \:v>r&   c                 .    | j                  t        d      S )z&An unordered array of publisher names.	publisherr   r   s    r$   dc_publisherzXmpInformation.dc_publisher  s     k::r&   c                 2    | j                  t        d|       y )Nr  r   r   s     r$   r  zXmpInformation.dc_publisher  s    \;?r&   c                 .    | j                  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                 2    | j                  t        d|       y )Nr  r   r   s     r$   r  zXmpInformation.dc_relation  r  r&   c                 .    | j                  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                 2    | j                  t        d|       y )Nr  r   r   s     r$   r  zXmpInformation.dc_rights  s      x@r&   c                 .    | j                  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                 2    | j                  t        d|       y )Nr  r   r   s     r$   r  zXmpInformation.dc_source  r   r&   c                 .    | j                  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8r&   c                 2    | j                  t        d|       y )Nr  r   r   s     r$   r  zXmpInformation.dc_subject  r   r&   c                 .    | j                  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                 2    | j                  t        d|       y )Nr  r   r   s     r$   r  zXmpInformation.dc_title  s      w?r&   c                 .    | j                  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5r&   c                 2    | j                  t        d|       y )Nr  r   r   s     r$   r  zXmpInformation.dc_type  s    \66:r&   c                 .    | j                  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                 2    | j                  t        d|       y )Nr  r   r!  r   s     r$   r"  zXmpInformation.pdf_keywords      }j%@r&   c                 .    | j                  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Br&   c                 2    | j                  t        d|       y )Nr(  r%  r   s     r$   r)  zXmpInformation.pdf_pdfversion  s    }lEBr&   c                 .    | j                  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                 2    | j                  t        d|       y )Nr,  r%  r   s     r$   r-  zXmpInformation.pdf_producer  r&  r&   c                 8    | j                  t        dt              S )zYThe date and time the resource was originally created. Returned as a UTC datetime object.
CreateDater   XMP_NAMESPACErN   r   s    r$   xmp_create_datezXmpInformation.xmp_create_date
       %%m\?SSr&   c                 |    |r#t        |      }| j                  t        d|       y | j                  t        dd        y )Nr0  rW   r   r2  rY   r   date_strs      r$   r3  zXmpInformation.xmp_create_date  3    +E2H""=,I""=,Er&   c                 8    | j                  t        dt              S )zTThe date and time the resource was last modified. Returned as a UTC datetime object.
ModifyDater1  r   s    r$   xmp_modify_datezXmpInformation.xmp_modify_date  r4  r&   c                 |    |r#t        |      }| j                  t        d|       y | j                  t        dd        y )Nr;  r6  r7  s      r$   r<  zXmpInformation.xmp_modify_date  r9  r&   c                 8    | j                  t        dt              S )zjThe date and time that any metadata for this resource was last changed. Returned as a UTC datetime object.MetadataDater1  r   s    r$   xmp_metadata_datez XmpInformation.xmp_metadata_date$  s     %%m^_UUr&   c                 |    |r#t        |      }| j                  t        d|       y | j                  t        dd        y )Nr?  r6  r7  s      r$   r@  z XmpInformation.xmp_metadata_date)  s3    +E2H""=.(K""=.$Gr&   c                 .    | j                  t        d      S )z=The name of the first known tool used to create the resource.CreatorTool)r   r2  r   s    r$   xmp_creator_toolzXmpInformation.xmp_creator_tool1  s     %%m]CCr&   c                 2    | j                  t        d|       y )NrC  )r   r2  r   s     r$   rD  zXmpInformation.xmp_creator_tool6  s    }mUCr&   c                 .    | j                  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Dr&   c                 2    | j                  t        d|       y )NrG  r   rI  r   s     r$   rJ  z XmpInformation.xmpmm_document_id?      eDr&   c                 .    | j                  t        d      S )zZAn identifier for a specific incarnation of a document, updated each time a file is saved.
InstanceIDrH  r   s    r$   xmpmm_instance_idz XmpInformation.xmpmm_instance_idC  rK  r&   c                 2    | j                  t        d|       y )NrP  rM  r   s     r$   rQ  z XmpInformation.xmpmm_instance_idH  rN  r&   c                 .    | j                  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_partL  s     %%&6??r&   c                 2    | j                  t        d|       y )NrT  r   rV  r   s     r$   rW  zXmpInformation.pdfaid_partQ  s    /?r&   c                 .    | j                  t        d      S )zFThe conformance level within the PDF/A standard (e.g., 'A', 'B', 'U').conformancerU  r   s    r$   pdfaid_conformancez!XmpInformation.pdfaid_conformanceU  s     %%&6FFr&   c                 2    | j                  t        d|       y )Nr[  rY  r   s     r$   r\  z!XmpInformation.pdfaid_conformanceZ  s    /Fr&   c           
         t        | d      si | _        | j                  dt              D ]  }|j                  }	 |j                  d      }|dk(  rn/|d| t        t        ||dz   |dz    d	            z   ||dz   d z   }F|j                  |j                  k(  r|j                  }n| j                  |      }|| 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   u   ↂr8   Nr         )rm   )hasattrr_  r   PDFX_NAMESPACE	localNamefindchrr3   r   r   r   rb   )rY   nodekeyidxr   s        r$   custom_propertiesz XmpInformation.custom_properties^  s     t12&(D#33BG 5nn((8,CbyDS	c#cAga"8rBCDcAgi.)   ==D$7$77 NNE NN40E/4'',!5" &&&r&   c                 `   | j                   j                  t        d      D ]  }|j                  t        d      |k(  s|c S  | j                   j                  }|t        d      |j                  t        d      }|j                  t        d|       | j                   j                  |       |S )zBGet or create an rdf:Description element with the given about URI.r   r   XMP Document is Nonezrdf:Descriptionz	rdf:about)	r   r_   r`   r   ownerDocumentr   createElementNSsetAttributeNSappendChild)rY   r   r   docs       r$   _get_or_create_descriptionz)XmpInformation._get_or_create_description}  s    MM88V 	D""=':iG	 mm));"#9::""=2CDM;	B!!$'r&   c                 P    | j                   j                  |      }|r	||v r||= yyy)z<Remove a cached value for a given namespace/name if present.N)r   r   )rY   r   r   r   s       r$   _clear_cache_entryz!XmpInformation._clear_cache_entry  s,    ::>>),( )8r&   c                 *   | j                  ||       | j                         }t        |j                  ||            }|D ]  }|j	                  |        |j                  ||      x}r|j                  |       || j                  j                  }|t        d      | j                  |      }	|j                  ||	 d|       }|j                  t        |            }
|j                  |
       |j                  |       | j                          y)z&Set or remove a single metadata value.Nrl  r7   )rt  rr  listr_   removeChildr   removeAttributeNoder   rm  r   _get_namespace_prefixrn  createTextNoder}   rp  _update_stream)rY   r   r   r   r   existing_elementselemexisting_attrrq  prefix	text_nodes              r$   r   z XmpInformation._set_single_value  s   	40..0 !<!<Y!MN% 	#DT"	# !33ItDD=D$$]3----C{&'=>>//	:F&&yVHAdV2DED**3u:6IY'T"r&   c                    | j                  ||       | j                         }t        |j                  ||            }|D ]  }|j	                  |        |r| j
                  j                  }|t        d      | j                  |      }|j                  || d|       }|j                  t        d      }	|D ]T  }
|j                  t        d      }|j                  t        |
            }|j                  |       |	j                  |       V |j                  |	       |j                  |       | j                          y)z+Set or remove bag values (unordered array).Nrl  r7   zrdf:Bagrdf:lirt  rr  rv  r_   rw  r   rm  r   ry  rn  r`   rz  r}   rp  r{  )rY   r   r   r   r   r|  r}  rq  r  bagr   r^   r  s                r$   r   zXmpInformation._set_bag_values  0   	40..0 !<!<Y!MN% 	#DT"	# ----C{&'=>>//	:F&&yVHAdV2DED%%mY?C $((A..s5z:	y)#	$ S!T"r&   c                    | j                  ||       | j                         }t        |j                  ||            }|D ]  }|j	                  |        |r| j
                  j                  }|t        d      | j                  |      }|j                  || d|       }|j                  t        d      }	|D ]T  }
|j                  t        d      }|j                  t        |
            }|j                  |       |	j                  |       V |j                  |	       |j                  |       | j                          y)z.Set or remove sequence values (ordered array).Nrl  r7   zrdf:Seqr  r  )rY   r   r   r   r   r|  r}  rq  r  seqr   r^   r  s                r$   r   zXmpInformation._set_seq_values  r  r&   c                    | j                  ||       | j                         }t        |j                  ||            }|D ]  }|j	                  |        |r| j
                  j                  }|t        d      | j                  |      }|j                  || d|       }|j                  t        d      }	|j                         D ]i  \  }
}|j                  t        d      }|j                  d|
       |j                  t        |            }|j                  |       |	j                  |       k |j                  |	       |j                  |       | j!                          y)z*Set or remove language alternative values.Nrl  r7   zrdf:Altr  r   )rt  rr  rv  r_   rw  r   rm  r   ry  rn  r`   itemssetAttributerz  r}   rp  r{  )rY   r   r   r   r   r|  r}  rq  r  r   langr   r^   r  s                 r$   r   z"XmpInformation._set_langalt_values  sH   	40..0 !<!<Y!MN% 	#DT"	# ----C{&'=>>//	:F&&yVHAdV2DED%%mY?C%||~ $e((A
D1..s5z:	y)#$ S!T"r&   c                 .    t         j                  |d      S )z?Get the appropriate namespace prefix for a given namespace URI.unknown)_NAMESPACE_PREFIX_MAPr   )rY   r   s     r$   ry  z$XmpInformation._get_namespace_prefix  s    $((I>>r&   c                     | j                   j                  }|t        d      |j                  d      }| j                  j                  |       y)z/Update the stream with the current XML content.Nrl  r   )encoding)r   rm  r   toxmlr   r   )rY   rq  xml_datas      r$   r{  zXmpInformation._update_stream  sD    mm));"#9::99g9.X&r&   )r   rZ   r!   )r   )r   N)Bry   rz   r{   r|   r   r   classmethodr   r   r   r}   bytesr   r   r   r   r   
XmlElementrb   r%   r   r   r   rv  r   r   dictr   propertyr   setterr   r   rC   r   r   r   r   r   r  r  r  r  r  r  r  r"  r)  r-  r3  r<  r@  rD  rJ  rQ  rW  r\  rj  rr  rt  r   r   r   r   ry  r{  r"   r&   r$   rZ   rZ      s|   
(} 
( 
( 	 	 MQ, ,27c58H2I,	,HS HS H HQT H	$ 	$ 	$QT 	$   +4	  SE3J'	
 
#,S  c8K & +4	  SE3J'	
 
$s)	:S  cSVh@X $ =c 3 = = BXd3i%8 BT B B @Xc] @ @ @# @4 @ @ =HT#Y/ = = >$s)!4 > > > K$x'8'8"9: K K ^^
EhtE#x7H7H2H,I'JK 
EPT 
E 
E Ec3h 8 E E FXd38n%= F$ F F >8C= > > >x} > > > Bx} B B B8C= BT B B :Xd3i0 : : ?(49"5 ?$ ? ? ;htCy1 ; ; @8DI#6 @4 @ @ :Xd3i0 : : ?(49"5 ?$ ? ? @8DcN3 @ @ Ac3h 8 AT A A >8C= > > >x} > > > 9HT#Y/ 9 9 >$s)!4 > > > ?(4S>2 ? ? __@xS#X7 @D @ @ 6$s), 6 6 ^^;htCy1 ;d ; ; Ahsm A A A(3- AD A A C C C CHSM Cd C C Ahsm A A A(3- AD A A T(*;*;!< T T FXh.?.?%@ FT F F T(*;*;!< T T FXh.?.?%@ FT F F V8H,=,=#> V V Hx0A0A'B Ht H H D(3- D D Dhsm D D D E8C= E E Ex} E E E E8C= E E Ex} E E E @Xc] @ @ @# @4 @ @ GHSM G G G G$ G G '4S> ' '<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&   )6r|   rC   r?   recollections.abcr   typingr   r   r   r   r   xml.dom.expatbuilderr	   xml.dom.minidomr
   r   r  xml.parsers.expatr   r   
_protocolsr   _utilsr   r   r   errorsr   r   genericr   r   r`   r   r2  r!  rI  rc  rV  r  compileVERBOSEr;   r   r   r%   r}   rN   rW   rv  rh   rj   rZ   r"   r&   r$   <module>r     s     	 $  0 $ 1 7 . V V 2 -=1..3( 1 5  $55WhF  "** JJ!( CL& (#n %% '% ')* ++, -'( ) Q 1 3 8#4#4 6
3 1 1 
3c 
3 hq#3@CPXZ]Y^`cYcPdd3iJ. J8H	'+Y H	'r&   