
    h.                     ,   S r SSKJr  SSKJr  SSKJr  SSKJr	  SSKJ
r  \R                  " 5       r\R                  " SSS	9r\R!                  \5        \	R"                  \	R$                  \	R&                  S
.rS#S jrS rS$S jrS r " S S\R2                  5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r\RA                  \S   5      r!\\!S'   \\!S'   \\!S'   \RA                  \S   5      r"\\"S '   \\"S!'   g")%a  Temporary stand-in for main oxml module.

This module came across with the PackageReader transplant. Probably much will get
replaced with objects from the pptx.oxml.core and then this module will either get
deleted or only hold the package related custom element classes.
    )annotations)cast)etree)	NAMESPACE)RELATIONSHIP_TARGET_MODETF)remove_blank_textresolve_entities)ctprrc                8    [         R                  " U [        5      $ )z7`etree.fromstring()` replacement that uses oxml parser.)r   
fromstringoxml_parser)texts    ?/var/www/html/env/lib/python3.13/site-packages/docx/opc/oxml.py	parse_xmlr   $   s    D+..    c                N    U R                  S5      u  p[        U   nSU< SU< 3$ )zStands for "qualified name", a utility function to turn a namespace prefixed tag
name into a Clark-notation qualified tag name for lxml.

For
example, ``qn('p:cSld')`` returns ``'{http://schemas.../main}cSld'``.
:{})splitnsmap)tagprefixtagrooturis       r   qnr   )   s'     iinOF
-CG$$r   c                .    [         R                  " U SSS9$ )zSerialize `part_elm` etree element to XML suitable for storage as an XML part.

That is to say, no insignificant whitespace added for readability, and an
appropriate XML declaration added with UTF-8 encoding specified.
zUTF-8T)encoding
standaloner   tostring)part_elms    r   serialize_part_xmlr%   5   s     >>(WFFr   c                .    [         R                  " U SSS9$ )zSSerialize `element` to human-readable XML suitable for tests.

No XML declaration.
unicodeT)r    pretty_printr"   )elements    r   serialize_for_readingr*   >   s    
 >>'IDIIr   c                  (    \ rS rSrSr\S 5       rSrg)BaseOxmlElementK   zdBase class for all custom element classes, to add standardized behavior to all
classes in one place.c                    [        U 5      $ )zReturn XML string for this element, suitable for testing purposes.

Pretty printed for readability and without an XML declaration at the top.
)r*   selfs    r   xmlBaseOxmlElement.xmlO   s     %T**r    N)__name__
__module____qualname____firstlineno____doc__propertyr1   __static_attributes__r3   r   r   r,   r,   K   s     + +r   r,   c                  H    \ rS rSrSr\S 5       r\S 5       r\S 5       r	Sr
g)
CT_DefaultX   zp``<Default>`` element, specifying the default content type to be applied to a
part with the specified extension.c                $    U R                  S5      $ )zKString held in the ``ContentType`` attribute of this ``<Default>``
element.ContentTypegetr/   s    r   content_typeCT_Default.content_type\        xx&&r   c                $    U R                  S5      $ )zIString held in the ``Extension`` attribute of this ``<Default>`` element.	Extensionr@   r/   s    r   	extensionCT_Default.extensionb   s     xx$$r   c                |    S[         S   -  n[        U5      nUR                  SU 5        UR                  SU5        U$ )zKReturn a new ``<Default>`` element with attributes set to parameter
values.z<Default xmlns="%s"/>r
   rF   r?   r   r   set)extrB   r1   defaults       r   newCT_Default.newg   s<     &d3C.K%M<0r   r3   N)r4   r5   r6   r7   r8   r9   rB   rG   staticmethodrN   r:   r3   r   r   r<   r<   X   sC    * ' '
 % %  r   r<   c                  H    \ rS rSrSr\S 5       r\S 5       r\S 5       r	Sr
g)CT_Overrider   zi``<Override>`` element, specifying the content type to be applied for a part with
the specified partname.c                $    U R                  S5      $ )zLString held in the ``ContentType`` attribute of this ``<Override>``
element.r?   r@   r/   s    r   rB   CT_Override.content_typev   rD   r   c                |    S[         S   -  n[        U5      nUR                  SU 5        UR                  SU5        U$ )zLReturn a new ``<Override>`` element with attributes set to parameter
values.z<Override xmlns="%s"/>r
   PartNamer?   rJ   )partnamerB   r1   overrides       r   rN   CT_Override.new|   s<     't4S>Z*]L1r   c                $    U R                  S5      $ )zIString held in the ``PartName`` attribute of this ``<Override>`` element.rW   r@   r/   s    r   rX   CT_Override.partname   s     xx
##r   r3   N)r4   r5   r6   r7   r8   r9   rB   rP   rN   rX   r:   r3   r   r   rR   rR   r   sC     ' '
   $ $r   rR   c                      \ rS rSrSr\\R                  4S
S jj5       r\	S 5       r
\	S 5       r\	S 5       r\	S 5       rSrg	)CT_Relationship   z^``<Relationship>`` element, representing a single relationship from a source to a
target part.c                   S[         S   -  n[        U5      nUR                  SU 5        UR                  SU5        UR                  SU5        U[        R                  :X  a   UR                  S[        R                  5        U$ )z(Return a new ``<Relationship>`` element.z<Relationship xmlns="%s"/>r   IdTypeTarget
TargetMode)r   r   rK   RTMEXTERNAL)rIdreltypetargettarget_moder1   relationships         r   rN   CT_Relationship.new   sq     +U4[8 ~s#)6*#,,&\3<<8r   c                $    U R                  S5      $ )zGString held in the ``Id`` attribute of this ``<Relationship>`` element.ra   r@   r/   s    r   rg   CT_Relationship.rId   s     xx~r   c                $    U R                  S5      $ )zIString held in the ``Type`` attribute of this ``<Relationship>`` element.rb   r@   r/   s    r   rh   CT_Relationship.reltype   s     xxr   c                $    U R                  S5      $ )zKString held in the ``Target`` attribute of this ``<Relationship>``
element.rc   r@   r/   s    r   
target_refCT_Relationship.target_ref   s     xx!!r   c                B    U R                  S[        R                  5      $ )zString held in the ``TargetMode`` attribute of this ``<Relationship>``
element, either ``Internal`` or ``External``.

Defaults to ``Internal``.
rd   )rA   re   INTERNALr/   s    r   rj   CT_Relationship.target_mode   s     xxcll33r   r3   N)rg   strrh   rw   ri   rw   rj   rw   )r4   r5   r6   r7   r8   rP   re   ru   rN   r9   rg   rh   rr   rj   r:   r3   r   r   r^   r^      sr     DGLL 	 	       " "
 4 4r   r^   c                  Z    \ rS rSrSrS	S
S jjr\SS j5       r\S 5       r	\S 5       r
Srg)CT_Relationships   z>``<Relationships>`` element, the root element in a .rels file.c                    U(       a  [         R                  O[         R                  n[        R	                  XX55      nU R                  U5        g)zYAdd a child ``<Relationship>`` element with attributes set according to
parameter values.N)re   rf   ru   r^   rN   append)r0   rg   rh   ri   is_externalrj   rk   s          r   add_relCT_Relationships.add_rel   s3     '2clls||&**3ML!r   c                 L    S[         S   -  n [        [        [        U 5      5      $ )z)Return a new ``<Relationships>`` element.z<Relationships xmlns="%s"/>r   )r   r   ry   r   )r1   s    r   rN   CT_Relationships.new   s$     ,eDk9$in55r   c                6    U R                  [        S5      5      $ )zCReturn a list containing all the ``<Relationship>`` child elements.zpr:Relationshipfindallr   r/   s    r   Relationship_lst!CT_Relationships.Relationship_lst   s     ||B0122r   c                    [        U 5      $ )zReturn XML string for this element, suitable for saving in a .rels stream,
not pretty printed and with an XML declaration at the top.)r%   r/   s    r   r1   CT_Relationships.xml   s     "$''r   r3   N)F)rg   rw   rh   rw   ri   rw   r}   bool)returnry   )r4   r5   r6   r7   r8   r~   rP   rN   r9   r   r1   r:   r3   r   r   ry   ry      sF    H" 6 6
 3 3 ( (r   ry   c                  T    \ rS rSrSrS rS r\S 5       r\	S 5       r
\S 5       rSrg	)
CT_Types   zd``<Types>`` element, the container element for Default and Override elements in
[Content_Types].xml.c                P    [         R                  X5      nU R                  U5        g)zJAdd a child ``<Default>`` element with attributes set to parameter values.N)r<   rN   r|   )r0   rL   rB   rM   s       r   add_defaultCT_Types.add_default   s    ..3Gr   c                P    [         R                  X5      nU R                  U5        g)zKAdd a child ``<Override>`` element with attributes set to parameter
values.N)rR   rN   r|   )r0   rX   rB   rY   s       r   add_overrideCT_Types.add_override   s     ??8:Hr   c                6    U R                  [        S5      5      $ )Nz
ct:Defaultr   r/   s    r   defaultsCT_Types.defaults   s    ||B|,--r   c                 4    S[         S   -  n [        U 5      nU$ )z!Return a new ``<Types>`` element.z<Types xmlns="%s"/>r
   )r   r   )r1   typess     r   rN   CT_Types.new   s      $eDk1#r   c                6    U R                  [        S5      5      $ )Nzct:Overrider   r/   s    r   	overridesCT_Types.overrides   s    ||B}-..r   r3   N)r4   r5   r6   r7   r8   r   r   r9   r   rP   rN   r   r:   r3   r   r   r   r      sM    
 . .   / /r   r   r
   DefaultOverrideTypesr   RelationshipRelationshipsN)r   rw   r   etree._Element)r$   r   )#r8   
__future__r   typingr   lxmlr   docx.opc.constantsr   NSr   re   ElementNamespaceClassLookupelement_class_lookup	XMLParserr   set_element_class_lookupOPC_CONTENT_TYPESOPC_RELATIONSHIPSOFC_RELATIONSHIPSr   r   r   r%   r*   ElementBaser,   r<   rR   r^   ry   r   get_namespacect_namespacepr_namespacer3   r   r   <module>r      s0   #   . > 88: oouM  $ $%9 : 




				/
	%GJ
+e'' 
+ 4$/ $4'4o '4T( (8/ /> $11%+>$Y &Z  W #11%+>.^  0_ r   