
    p"h)                     F   S r SSKJr  SSKJrJrJr  SSKJr  SSK	J
r
JrJr  SSK	JrJr  SSKJr   " S S	\\\5      r " S
 S\5      r " S S\\
\\5      r " S S\\
\5      rSr " S S\5      r " S S\\\\5      r " S S\\\5      r " S S\5      r " S S\5      rg)a  
The **container** module provides following structural objects:

* :class:`svgwrite.Group`
* :class:`svgwrite.SVG`
* :class:`svgwrite.Defs`
* :class:`svgwrite.Symbol`
* :class:`svgwrite.Marker`
* :class:`svgwrite.Use`
* :class:`svgwrite.Hyperlink`
* :class:`svgwrite.Script`
* :class:`svgwrite.Style`

set/get SVG attributes::

    element['attribute'] = value
    value = element['attribute']

    )urlopen)font_mimetypebase64_datafind_first_url)BaseElement)ViewBox	TransformXLink)PresentationClipping)CDATAc                       \ rS rSrSrSrSrg)Group"   a7  The **Group** (SVG **g**) element is a container element for grouping
together related graphics elements.

Grouping constructs, when used in conjunction with the **desc** and **title**
elements, provide information about document structure and semantics.
Documents that are rich in structure may be rendered graphically, as speech,
or as braille, and thus promote accessibility.

A group of elements, as well as individual objects, can be given a name using
the **id** attribute. Named groups are needed for several purposes such as
animation and re-usable objects.

g N__name__
__module____qualname____firstlineno____doc__elementname__static_attributes__r       D/var/www/html/env/lib/python3.13/site-packages/svgwrite/container.pyr   r   "   s     Kr   r   c                       \ rS rSrSrSrSrg)Defs3   zThe **defs** element is a container element for referenced elements. For
understandability and accessibility reasons, it is recommended that, whenever
possible, referenced elements be defined inside of a **defs**.
defsr   Nr   r   r   r   r   r   3   s     Kr   r   c                       \ rS rSrSrSrSrg)Symbol;   al  The **symbol** element is used to define graphical template objects which
can be instantiated by a **use** element. The use of **symbol** elements for
graphics that are used multiple times in the same document adds structure and
semantics. Documents that are rich in structure may be rendered graphically,
as speech, or as braille, and thus promote accessibility.
symbolr   Nr   r   r   r   r"   r"   ;   s     Kr   r"   c                   4   ^  \ rS rSrSrSrSU 4S jjrSrU =r$ )MarkerF   a  The **marker** element defines the graphics that is to be used for
drawing arrowheads or polymarkers on a given **path**, **line**, **polyline**
or **polygon** element.

Add Marker definitions to a **defs** section, preferred to the **defs** section
of the **main drawing**.

markerc                    > [         [        U ]
  " S
0 UD6  Ub  US   U S'   US   U S'   Ub  US   U S'   US   U S'   Ub  X0S'   S	U R                  ;  a  U R	                  5       U S	'   gg)z
:param 2-tuple insert: reference point (**refX**, **refY**)
:param 2-tuple size: (**markerWidth**, **markerHeight**)
:param orient: ``'auto'`` | `angle`
:param extra: additional SVG attributes as keyword-arguments
Nr   refX   refYmarkerWidthmarkerHeightorientidr   )superr&   __init__attribsnext_id)selfinsertsizer/   extra	__class__s        r   r2   Marker.__init__Q   s     	fd$-u-!!9DL!!9DL"&q'D#'7D #Nt||#DJ $r   r   )NNN	r   r   r   r   r   r   r2   r   __classcell__r9   s   @r   r&   r&   F   s     K( (r   r&   zF@font-face{{ 
    font-family: "{name}"; 
    src: url("{data}"); 
}}
c                   L   ^  \ rS rSrSrSrS
U 4S jjrS rS rS r	S r
S	rU =r$ )SVGl   a  A SVG document fragment consists of any number of SVG elements contained
within an **svg** element.

An SVG document fragment can range from an empty fragment (i.e., no content
inside of the **svg** element), to a very simple SVG document fragment containing
a single SVG graphics element such as a **rect**, to a complex, deeply nested
collection of container elements and graphics elements.
svgc                    > [         [        U ]
  " S	0 UD6  Ub  US   U S'   US   U S'   Ub  US   U S'   US   U S'   [        U S9U l        U R                  U R                  5        g)
z
:param 2-tuple insert: insert position (**x**, **y**)
:param 2-tuple size: (**width**, **height**)
:param extra: additional SVG attributes as keyword-arguments
Nr   xr+   ywidthheight)factoryr   )r1   r?   r2   r   r    add)r5   r6   r7   r8   r9   s       r   r2   SVG.__init__w   ss     	c4!*E*q	DIq	DI GDM!!WDN&	r   c                 J    U R                   R                  [        U5      5      $ )zAdd <style> tag to the defs section.

:param content: style sheet content as string
:return: :class:`~svgwrite.container.Style` object
)r    rH   Styler5   contents     r   embed_stylesheetSVG.embed_stylesheet   s     yy}}U7^,,r   c                 n    [        US5      R                  5       nU R                  X[        U5      5        g)zzEmbed font as base64 encoded data from font file.

:param name: font name
:param filename: file name of local stored font
rbN)openread_embed_font_datar   )r5   namefilenamedatas       r   
embed_fontSVG.embed_font   s.     Hd#((*d-*ABr   c                 
   [        U5      R                  5       n[        UR                  5       5      nUc  [	        SR                  U5      5      e[        U5      R                  5       nU R                  X[        U5      5        g)zEmbed font as base64 encoded data acquired from google fonts.

:param name: font name
:param uri: google fonts request uri like 'http://fonts.googleapis.com/css?family=Indie+Flower'
NzGot no font data from uri: '{}')r   rS   r   decode
ValueErrorformatrT   r   )r5   rU   uri	font_infofont_urlrW   s         r   embed_google_web_fontSVG.embed_google_web_font   sn     CL%%'	!)"2"2"45>EEcJKK8$))+D!!$mH.EFr   c                 `    [         R                  U[        X#5      S9nU R                  U5        g )N)rU   rW   )FONT_TEMPLATEr]   r   rN   )r5   rU   rW   mimetyperM   s        r   rT   SVG._embed_font_data   s*    &&D{47R&Sg&r   )r    NN)r   r   r   r   r   r   r2   rN   rX   ra   rT   r   r<   r=   s   @r   r?   r?   l   s/     K"-CG' 'r   r?   c                   @   ^  \ rS rSrSrSrSU 4S jjrU 4S jrSrU =r	$ )Use   aH  The **use** element references another element and indicates that the graphical
contents of that element is included/drawn at that given point in the document.

Link to objects by href = ``'#object-id'`` or use the object itself as
href-argument, if the given element has no **id** attribute it gets an
automatic generated id.

usec                    > [         [        U ]
  " S0 UD6  U R                  U5        Ub  US   U S'   US   U S'   Ub  US   U S'   US   U S'   gg)	z
:param string href: object link (id-string) or an object with an id-attribute
:param 2-tuple insert: insert point (**x**, **y**)
:param 2-tuple size: (**width**, **height**)
:param extra: additional SVG attributes as keyword-arguments
Nr   rC   r+   rD   rE   rF   r   )r1   ri   r2   set_href)r5   hrefr6   r7   r8   r9   s        r   r2   Use.__init__   sh     	c4!*E*dq	DIq	DI GDM!!WDN r   c                 H   > U R                  5         [        [        U ]  5       $ N)	update_idr1   ri   get_xml)r5   r9   s    r   rs   Use.get_xml   s    S$'))r   r   rg   )
r   r   r   r   r   r   r2   rs   r   r<   r=   s   @r   ri   ri      s     K% * *r   ri   c                   4   ^  \ rS rSrSrSrSU 4S jjrSrU =r$ )	Hyperlink   a  The **a** element indicate links (also known as Hyperlinks or Web links).

The remote resource (the destination for the link) is defined by a `<URI>`
specified by the XLink **xlink:href** attribute. The remote resource may be
any Web resource (e.g., an image, a video clip, a sound bite, a program,
another SVG document, an HTML document, an element within the current
document, an element within a different document, etc.). By activating
these links (by clicking with the mouse, through keyboard input, voice
commands, etc.), users may visit these resources.

A **Hyperlink** is defined for each separate rendered element
contained within the **Hyperlink** class; add sublements as usual with
the `add` method.

ac                 F   > [         [        U ]
  " S0 UD6  XS'   Ub  X S'   gg)z
:param string href: hyperlink to the target resource
:param string target: ``'_blank|_replace|_self|_parent|_top|<XML-name>'``
:param extra: additional SVG attributes as keyword-arguments

xlink:hrefNtargetr   )r1   rv   r2   )r5   rn   r{   r8   r9   s       r   r2   Hyperlink.__init__   s1     	i'0%0!\#N r   r   )_blankr;   r=   s   @r   rv   rv      s     K	$ 	$r   rv   c                   F   ^  \ rS rSrSrSrSU 4S jjrU 4S jrS rSr	U =r
$ )	Script   a  The **script** element indicate links to a client-side language.  This
is normally a  (also known as Hyperlinks or Web links).

The remote resource (the source of the script) is defined by a `<URI>`
specified by the XLink **xlink:href** attribute. The remote resource must
be a text-file that contains the script contents.  This script can be used
within the SVG file by catching events or adding the mouseover/mousedown/
mouseup elements to the markup.

scriptc                 H   > [         [        U ]
  " S0 UD6  Ub  XS'   X l        g)z
:param string href: hyperlink to the target resource or *None* if using *content*
:param string content: script content
:param extra: additional attributes as keyword-arguments

Use *href* **or** *content*, but not both at the same time.

Nrz   r   )r1   r   r2   _content)r5   rn   rM   r8   r9   s       r   r2   Script.__init__   s*     	fd$-u-!%r   c                    > [         [        U ]  5       nU R                  (       a$  UR	                  [        U R                  5      5        U$ rq   )r1   r   rs   r   appendr   )r5   xmlr9   s     r   rs   Script.get_xml  s3    FD)+==JJuT]]+,
r   c                 .    U =R                   U-  sl         g)z0Append content to the existing element-content. Nr   rL   s     r   r   Script.append  s     r   r   )N )r   r   r   r   r   r   r2   rs   r   r   r<   r=   s   @r   r   r      s#    	 K ! !r   r   c                   4   ^  \ rS rSrSrSrSU 4S jjrSrU =r$ )rK   i  zThe *style* element allows style sheets to be embedded directly within
SVG content. SVG's *style* element has the same attributes as the
corresponding element in HTML.

stylec                 <   > [         [        U ]
  " SSU0UD6  SU S'   g)z+
:param string content: stylesheet content
rM   ztext/csstypeNr   )r1   rK   r2   )r5   rM   r8   r9   s      r   r2   Style.__init__  s%     	eT#=G=u=!Vr   r   )r   r;   r=   s   @r   rK   rK     s    
 K" "r   rK   N)r   urllib.requestr   svgwrite.utilsr   r   r   svgwrite.baser   svgwrite.mixinsr   r	   r
   r   r   svgwrite.etreer   r   r   r"   r&   rd   r?   ri   rv   r   rK   r   r   r   <module>r      s   & # E E % 5 5 2  KL "5 ['< (['< (>='& ='@*+y% *@$Y $<$![ $!N"F "r   