o
    vh$*                     @   s   d dl mZ ddlZedZedZedZedZedZ	ed	Z
ed
Zdd Zde	fde	fde	fde
fde
fde	fde	ffZdd ZdefddZdS )   )EllipticalArc    NMmZzLlHhVvCcSsQqTtAaAa
MZLHVCSQTAz([MmZzLlHhVvCcSsQqTtAa])z\[-+]?(?:(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][-+]?[0-9]+)?|(?:\.[0-9]+(?:[eE][-+]?[0-9]+)?))z^[01]z[, 	]c                 c   s    d }t | D ]@}|tv r|tv r|nd }|V  q|r=z	t|E d H  W q ty< } ztd| | d|d }~ww t|D ]}|V  qBqd S )NzInvalid arc command: '')
COMMAND_REsplitCOMMANDSARC_COMMANDS_tokenize_arc_arguments
ValueErrorFLOAT_REfindall)pathdefarc_cmdxetoken r   Z/var/www/html/hyperkenya/venv/lib/python3.10/site-packages/fontTools/svgLib/path/parser.py_tokenize_path"   s$   r   rxryzx-axis-rotationzlarge-arc-flagz
sweep-flagr   yc           	      c   s    dd t | D }|std|  d|  d}|r_| }t| \}}||}|s8td| d|| \}}||| V  ||d  }|rR|| |dkrYd}n|d	7 }|s|dkrktd|  dd S )
Nc                 S   s   g | ]}|r|qS r   r   ).0sr   r   r   
<listcomp>@   s    z+_tokenize_arc_arguments.<locals>.<listcomp>zNot enough arguments: 'r   r   zInvalid argument for 'z' parameter:    r   )	SEPARATOR_REr	   r   reversepopARC_ARGUMENT_TYPESsearchspanappend)	arcdefraw_argsiargnamepatternmatchjkr   r   r   r   ?   s0   

r   )r   r   c              	   C   sL  t | }tt| }|  d}d}d}t|d}|r|d tv r1|}	| }|tv }
| }n|du rEt	d| t
|  t
| f |}	|dkr}| }| }t|t|d  }|
rb|}n||7 }|durn|  ||j|jf |}d}n|dkr||kr||j|jf |  |}d}d}n|dkr| }| }t|t|d  }|
s||7 }||j|jf |}n|d	kr| }t||jd  }|
s||j7 }||j|jf |}n|d
kr| }|jt|d  }|
s||jd 7 }||j|jf |}n|dkrht| t| d  }t| t| d  }t| t| d  }|
sO||7 }||7 }||7 }||j|jf|j|jf|j|jf |}|}n/|dkr|	dvru|}n|| | }t| t| d  }t| t| d  }|
s||7 }||7 }||j|jf|j|jf|j|jf |}|}n|dkrt| t| d  }t| t| d  }|
s||7 }||7 }||j|jf|j|jf |}|}n|dkr4|	dvr|}n|| | }t| t| d  }|
s!||7 }||j|jf|j|jf |}|}nc|dkrtt| }tt| }t| }tt| }tt| }t| t| d  }|
st||7 }|r|||||||j|jf n||||||||}|| |}|s|dur|  dS dS )a_  Parse SVG path definition (i.e. "d" attribute of <path> elements)
    and call a 'pen' object's moveTo, lineTo, curveTo, qCurveTo and closePath
    methods.

    If 'current_pos' (2-float tuple) is provided, the initial moveTo will
    be relative to that instead being absolute.

    If the pen has an "arcTo" method, it is called with the original values
    of the elliptical arc curve commands:

    .. code-block::

        pen.arcTo(rx, ry, rotation, arc_large, arc_sweep, (x, y))

    Otherwise, the arcs are approximated by series of cubic Bezier segments
    ("curveTo"), one every 90 degrees.
    NarcToz-Unallowed implicit command in %s, position %sMy              ?LZHVCSCSQTQTA)complexlistr   r    hasattrr
   r!   	UPPERCASEupperr   lenr	   floatendPathmoveTorealimaglineTo	closePathcurveToqCurveToabsboolintr/   draw)r   pencurrent_pos	arc_classelements	start_poscommandlast_control
have_arcTolast_commandabsoluter   r   poscontrol1control2endcontrolr   r   rotation	arc_large	arc_sweeparcr   r   r   
parse_path_   s  

















	
  
Arc   )rb   r   resetr
   r   r@   compiler   r   BOOL_REr   r   r"   r   rc   r   r   r   r   <module>   s,   	


 