ó
    ˆ*£h¬0  ã                  ó  • % S r SSKJr  SSKJrJrJrJr  SSKJ	r	J
r
  \(       a   SSKJr  SSKJrJrJrJrJr  SSKJr  SSKJr  S	rS
\S'   SrS
\S'    " S S\\   5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      rg)z3Objects related to construction of freeform shapes.é    )Úannotations)ÚTYPE_CHECKINGÚIterableÚIteratorÚSequence)ÚEmuÚlazyproperty)Ú	TypeAlias)Ú	CT_Path2DÚCT_Path2DCloseÚCT_Path2DLineToÚCT_Path2DMoveToÚCT_Shape)Ú_BaseGroupShapes)ÚLengthz2CT_Path2DClose | CT_Path2DLineTo | CT_Path2DMoveTor
   ÚCT_DrawingOperationz_LineSegment | _MoveTo | _CloseÚDrawingOperationc                  ó¢  ^ • \ rS rSrSr          SU 4S jjr    SS jrSS jrS r\	          SS j5       r
SS S jjr\" S	5      \" S	5      4S!S
 jjrS"S jr\S#S j5       r\S#S j5       rS rS!S jrS$S jr\S%S j5       r\S#S j5       r\S#S j5       r\S 5       r\S 5       rS&S jrS'S jr\S 5       r\S 5       rSrU =r $ )(ÚFreeformBuilderé   a0  Allows a freeform shape to be specified and created.

The initial pen position is provided on construction. From there, drawing proceeds using
successive calls to draw line segments. The freeform shape may be closed by calling the
:meth:`close` method.

A shape may have more than one contour, in which case overlapping areas are "subtracted". A
contour is a sequence of line segments beginning with a "move-to" operation. A move-to
operation is automatically inserted in each new freeform; additional move-to ops can be
inserted with the `.move_to()` method.
c                óf   >• [         [        U ]  5         Xl        X l        X0l        X@l        XPl        g ©N)Úsuperr   Ú__init__Ú_shapesÚ_start_xÚ_start_yÚ_x_scaleÚ_y_scale)ÚselfÚshapesÚstart_xÚstart_yÚx_scaleÚy_scaleÚ	__class__s         €ÚQ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pptx/shapes/freeform.pyr   ÚFreeformBuilder.__init__'   s+   ø€ ô 	Œo˜tÑ-Ô/ØŒØŒØŒØŒØ�ó    c                ó8   • U R                   R                  U5      $ r   )Ú_drawing_operationsÚ__getitem__)r    Úidxs     r'   r,   ÚFreeformBuilder.__getitem__6   s   € ð ×'Ñ'×3Ñ3°CÓ8Ð8r)   c                ó6   • U R                   R                  5       $ r   )r+   Ú__iter__©r    s    r'   r0   ÚFreeformBuilder.__iter__;   s   € Ø×'Ñ'×0Ñ0Ó2Ð2r)   c                ó6   • U R                   R                  5       $ r   )r+   Ú__len__r1   s    r'   r4   ÚFreeformBuilder.__len__>   s   € Ø×'Ñ'×/Ñ/Ó1Ð1r)   c                ó„   • U " U[        [        [        U5      5      5      [        [        [        U5      5      5      XE5      $ )z€Return a new |FreeformBuilder| object.

The initial pen location is specified (in local coordinates) by
(`start_x`, `start_y`).
©r   ÚintÚround)Úclsr!   r"   r#   r$   r%   s         r'   ÚnewÚFreeformBuilder.newA   s1   € ñ �6œ3œs¤5¨£>Ó2Ó3´S¼¼UÀ7»^Ó9LÓ5MÈwÓ`Ð`r)   c                ól   • U H  u  p4U R                  X45        M     U(       a  U R                  5         U $ )ae  Add a straight line segment to each point in `vertices`.

`vertices` must be an iterable of (x, y) pairs (2-tuples). Each x and y value is rounded
to the nearest integer before use. The optional `close` parameter determines whether the
resulting contour is `closed` or left `open`.

Returns this |FreeformBuilder| object so it can be used in chained calls.
)Ú_add_line_segmentÚ
_add_close)r    ÚverticesÚcloseÚxÚys        r'   Úadd_line_segmentsÚ!FreeformBuilder.add_line_segmentsQ   s0   € ó ‰DˆAØ×"Ñ" 1Ö(ñ æØ�O‰OÔØˆr)   r   c                ó°   • U R                  X5      nU R                  U5      nU  H  nUR                  U5        M     U R                  R	                  U5      $ )ag  Return new freeform shape positioned relative to specified offset.

`origin_x` and `origin_y` locate the origin of the local coordinate system in slide
coordinates (EMU), perhaps most conveniently by use of a |Length| object.

Note that this method may be called more than once to add multiple shapes of the same
geometry in different locations on the slide.
)Ú_add_freeform_spÚ_start_pathÚapply_operation_tor   Ú_shape_factory)r    Úorigin_xÚorigin_yÚspÚpathÚdrawing_operations         r'   Úconvert_to_shapeÚ FreeformBuilder.convert_to_shape`   sR   € ð ×"Ñ" 8Ó6ˆØ×Ñ Ó#ˆÛ!%ÐØ×0Ñ0°Ö6ñ "&à�|‰|×*Ñ*¨2Ó.Ð.r)   c                ód   • U R                   R                  [        R                  XU5      5        U $ )zˆMove pen to (x, y) (local coordinates) without drawing line.

Returns this |FreeformBuilder| object so it can be used in chained calls.
)r+   ÚappendÚ_MoveTor;   ©r    rB   rC   s      r'   Úmove_toÚFreeformBuilder.move_too   s(   € ð
 	× Ñ ×'Ñ'¬¯©°D¸QÓ(?Ô@Øˆr)   c                óš   • U R                   nU  H/  n[        U[        5      (       a  M  [        XR                  5      nM1     [        U5      $ )zîReturn x distance of shape origin from local coordinate origin.

The returned integer represents the leftmost extent of the freeform shape, in local
coordinates. Note that the bounding box of the shape need not start at the local origin.
)r   Ú
isinstanceÚ_CloseÚminrB   r   )r    Úmin_xrO   s      r'   Úshape_offset_xÚFreeformBuilder.shape_offset_xw   óE   € ð —‘ˆÛ!%ÐÜÐ+¬V×4Ñ4ÙÜ˜×2Ñ2Ó3ŠEñ "&ô �5‹zÐr)   c                óš   • U R                   nU  H/  n[        U[        5      (       a  M  [        XR                  5      nM1     [        U5      $ )zíReturn y distance of shape origin from local coordinate origin.

The returned integer represents the topmost extent of the freeform shape, in local
coordinates. Note that the bounding box of the shape need not start at the local origin.
)r   rY   rZ   r[   rC   r   )r    Úmin_yrO   s      r'   Úshape_offset_yÚFreeformBuilder.shape_offset_y…   r_   r)   c                ó^   • U R                   R                  [        R                  5       5        g)z7Add a close |_Close| operation to the drawing sequence.N)r+   rS   rZ   r;   r1   s    r'   r?   ÚFreeformBuilder._add_close“   s   € à× Ñ ×'Ñ'¬¯
©
«Õ5r)   c                ó®   • U R                   R                  nUR                  XR                  -   X R                  -   U R
                  U R                  5      $ )zÂAdd a freeform `p:sp` element having no drawing elements.

`origin_x` and `origin_y` are specified in slide coordinates, and represent the location
of the local coordinates origin on the slide.
)r   Ú_spTreeÚadd_freeform_spÚ_leftÚ_topÚ_widthÚ_height)r    rK   rL   ÚspTrees       r'   rG   Ú FreeformBuilder._add_freeform_sp—   sE   € ð —‘×%Ñ%ˆØ×%Ñ%Ø—z‘zÑ! 8¯i©iÑ#7¸¿¹ÀdÇlÁló
ð 	
r)   c                ób   • U R                   R                  [        R                  XU5      5        g)z7Add a |_LineSegment| operation to the drawing sequence.N)r+   rS   Ú_LineSegmentr;   rU   s      r'   r>   Ú!FreeformBuilder._add_line_segment¢   s#   € à× Ñ ×'Ñ'¬×(8Ñ(8¸À!Ó(DÕEr)   c                ó   • / $ )z>Return the sequence of drawing operation objects for freeform.© r1   s    r'   r+   Ú#FreeformBuilder._drawing_operations¦   s	   € ð ˆ	r)   c                óÊ   • U R                   =pU  HD  n[        U[        5      (       a  M  [        XR                  5      n[        X#R                  5      nMF     [        X!-
  5      $ )z1Return width of this shape's path in local units.)r   rY   rZ   r[   rB   Úmaxr   )r    r\   Úmax_xrO   s       r'   Ú_dxÚFreeformBuilder._dx«   ó[   € ð Ÿ™Ð%ˆÛ!%ÐÜÐ+¬V×4Ñ4ÙÜ˜×2Ñ2Ó3ˆEÜ˜×2Ñ2Ó3ŠEñ	 "&ô
 �5‘=Ó!Ð!r)   c                óÊ   • U R                   =pU  HD  n[        U[        5      (       a  M  [        XR                  5      n[        X#R                  5      nMF     [        X!-
  5      $ )z:Return integer height of this shape's path in local units.)r   rY   rZ   r[   rC   rv   r   )r    ra   Úmax_yrO   s       r'   Ú_dyÚFreeformBuilder._dy¶   rz   r)   c                óX   • [        [        U R                  U R                  -  5      5      $ )z¥Return vertical size of this shape's path in slide coordinates.

This value is based on the actual extents of the shape and does not include any
positioning offset.
)r8   r9   r}   r   r1   s    r'   rl   ÚFreeformBuilder._heightÁ   ó!   € ô ”5˜Ÿ™ D§M¡MÑ1Ó2Ó3Ð3r)   c                óX   • [        [        U R                  U R                  -  5      5      $ )zÍReturn leftmost extent of this shape's path in slide coordinates.

Note that this value does not include any positioning offset; it assumes the drawing
(local) coordinate origin is at (0, 0) on the slide.
)r8   r9   r]   r   r1   s    r'   ri   ÚFreeformBuilder._leftÊ   s#   € ô ”5˜×,Ñ,¨t¯}©}Ñ<Ó=Ó>Ð>r)   c                ó^   • [        XR                  -
  5      [        X R                  -
  5      4$ )zûTranslate local coordinates point to shape coordinates.

Shape coordinates have the same unit as local coordinates, but are offset such that the
origin of the shape coordinate system (0, 0) is located at the top-left corner of the
shape bounding box.
)r   r]   rb   )r    Úlocal_xÚlocal_ys      r'   Ú_local_to_shapeÚFreeformBuilder._local_to_shapeÓ   s+   € ô �7×0Ñ0Ñ0Ó1´3°w×ATÑATÑ7TÓ3UÐUÐUr)   c                ó´   • UR                  U R                  U R                  S9nUR                  " U R	                  U R
                  U R                  5      6   U$ )z©Return a newly created `a:path` element added to `sp`.

The returned `a:path` element has an `a:moveTo` element representing the shape starting
point as its only child.
)ÚwÚh)Úadd_pathrx   r}   Ú
add_moveTor‡   r   r   )r    rM   rN   s      r'   rH   ÚFreeformBuilder._start_pathÜ   sD   € ð �{‰{˜TŸX™X¨¯©ˆ{Ð2ˆØ�Š˜×-Ñ-¨d¯m©m¸T¿]¹]ÓKÑLØˆr)   c                óX   • [        [        U R                  U R                  -  5      5      $ )zôReturn topmost extent of this shape's path in slide coordinates.

Note that this value does not include any positioning offset; it assumes the drawing
(local) coordinate origin is located at slide coordinates (0, 0) (top-left corner of
slide).
)r8   r9   rb   r   r1   s    r'   rj   ÚFreeformBuilder._topæ   s#   € ô ”5˜×,Ñ,¨t¯}©}Ñ<Ó=Ó>Ð>r)   c                óX   • [        [        U R                  U R                  -  5      5      $ )z¢Return width of this shape's path in slide coordinates.

This value is based on the actual extents of the shape path and does not include any
positioning offset.
)r8   r9   rx   r   r1   s    r'   rk   ÚFreeformBuilder._widthð   r�   r)   )r   r   r   r   r   )
r!   r   r"   r   r#   r   r$   Úfloatr%   r“   )r-   r8   Úreturnr   )r”   zIterator[DrawingOperation])
r!   r   r"   r“   r#   r“   r$   r“   r%   r“   )T)r@   zIterable[tuple[float, float]]rA   Úbool)rK   r   rL   r   )rB   r“   rC   r“   ©r”   r   )rB   r“   rC   r“   r”   ÚNone)r”   zlist[DrawingOperation])r…   r   r†   r   r”   ztuple[Length, Length])rM   r   r”   r   )!Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r,   r0   r4   Úclassmethodr;   rD   r   rP   rV   Úpropertyr]   rb   r?   rG   r>   r	   r+   rx   r}   rl   ri   r‡   rH   rj   rk   Ú__static_attributes__Ú__classcell__©r&   s   @r'   r   r      s•  ø† ñ
ð à ð ð ð ð ð	 ð
 ð ð ÷ ð9Øð9à	ô9ô
3ò2ð ðaà ðað ðað ð	að
 ðað óaó ðaöñ 36°a³&ÉSÐQRËVö /ôð óó ðð óó ðò6ô	
ôFð óó ðð ó"ó ð"ð ó"ó ð"ð ñ4ó ð4ð ñ?ó ð?ôVôð ñ?ó ð?ð ñ4ó ö4r)   r   c                  ób   ^ • \ rS rSrSrSU 4S jjrS	S jr\S
S j5       r\S
S j5       r	Sr
U =r$ )Ú_BaseDrawingOperationéú   zxBase class for freeform drawing operations.

A drawing operation has at least one location (x, y) in local coordinates.
c                óN   >• [         [        U ]  5         Xl        X l        X0l        g r   )r   r£   r   Ú_freeform_builderÚ_xÚ_y)r    Úfreeform_builderrB   rC   r&   s       €r'   r   Ú_BaseDrawingOperation.__init__   s!   ø€ ÜÔ# TÑ3Ô5Ø!1ÔØŒØ�r)   c                ó   • [        S5      e)zeAdd the XML element(s) implementing this operation to `path`.

Must be implemented by each subclass.
z$must be implemented by each subclass)ÚNotImplementedError©r    rN   s     r'   rI   Ú(_BaseDrawingOperation.apply_operation_to  s   € ô
 "Ð"HÓIÐIr)   c                ó   • U R                   $ )zuReturn the horizontal (x) target location of this operation.

The returned value is an integer in local coordinates.
)r§   r1   s    r'   rB   Ú_BaseDrawingOperation.x  ó   € ð �w‰wˆr)   c                ó   • U R                   $ )zsReturn the vertical (y) target location of this operation.

The returned value is an integer in local coordinates.
)r¨   r1   s    r'   rC   Ú_BaseDrawingOperation.y  r±   r)   )r¦   r§   r¨   )r©   r   rB   r   rC   r   )rN   r   r”   r   r–   )r˜   r™   rš   r›   rœ   r   rI   rž   rB   rC   rŸ   r    r¡   s   @r'   r£   r£   ú   s;   ø† ñ÷
ôJð óó ðð óó ör)   r£   c                  ó6   • \ rS rSrSr\SS j5       rSS jrSrg)	rZ   i  z?Specifies adding a `<a:close/>` element to the current contour.c                ó   • U " 5       $ )zReturn a new _Close object.rs   )r:   s    r'   r;   Ú
_Close.new!  s   € ñ ‹uˆr)   c                ó"   • UR                  5       $ )z Add `a:close` element to `path`.)Ú	add_closer­   s     r'   rI   Ú_Close.apply_operation_to&  s   € à�~‰~ÓÐr)   rs   N)r”   rZ   )rN   r   r”   r   ©	r˜   r™   rš   r›   rœ   r�   r;   rI   rŸ   rs   r)   r'   rZ   rZ     s   † ÙIàóó ð÷ r)   rZ   c                  ó6   • \ rS rSrSr\SS j5       rSS jrSrg)	rp   i+  z@Specifies a straight line segment ending at the specified point.c                ó‚   • U " U[        [        [        U5      5      5      [        [        [        U5      5      5      5      $ )z|Return a new _LineSegment object ending at point *(x, y)*.

Both `x` and `y` are rounded to the nearest integer before use.
r7   ©r:   r©   rB   rC   s       r'   r;   Ú_LineSegment.new.  ó.   € ñ Ð#¤S¬¬U°1«X«Ó%7¼¼SÄÀqÃ»]Ó9KÓLÐLr)   c                óÎ   • UR                  [        U R                  U R                  R                  -
  5      [        U R
                  U R                  R                  -
  5      5      $ )zmAdd `a:lnTo` element to `path` for this line segment.

Returns the `a:lnTo` element newly added to the path.
)Úadd_lnTor   r§   r¦   r]   r¨   rb   r­   s     r'   rI   Ú_LineSegment.apply_operation_to6  sO   € ð
 �}‰}Ü�—‘˜$×0Ñ0×?Ñ?Ñ?Ó@Ü�—‘˜$×0Ñ0×?Ñ?Ñ?Ó@ó
ð 	
r)   rs   N)r©   r   rB   r“   rC   r“   r”   rp   )rN   r   r”   r   rº   rs   r)   r'   rp   rp   +  s   † ÙJàóMó ðM÷
r)   rp   c                  ó6   • \ rS rSrSr\SS j5       rSS jrSrg)	rT   iA  zSpecifies a new pen position.c                ó‚   • U " U[        [        [        U5      5      5      [        [        [        U5      5      5      5      $ )zyReturn a new _MoveTo object for move to point `(x, y)`.

Both `x` and `y` are rounded to the nearest integer before use.
r7   r½   s       r'   r;   Ú_MoveTo.newD  r¿   r)   c                óÎ   • UR                  [        U R                  U R                  R                  -
  5      [        U R
                  U R                  R                  -
  5      5      $ )z7Add `a:moveTo` element to `path` for this line segment.)r�   r   r§   r¦   r]   r¨   rb   r­   s     r'   rI   Ú_MoveTo.apply_operation_toL  sM   € à�‰Ü�—‘˜$×0Ñ0×?Ñ?Ñ?Ó@Ü�—‘˜$×0Ñ0×?Ñ?Ñ?Ó@ó
ð 	
r)   rs   N)r©   r   rB   r“   rC   r“   r”   rT   )rN   r   r”   r   rº   rs   r)   r'   rT   rT   A  s   † Ù'àóMó ðM÷
r)   rT   N)rœ   Ú
__future__r   Útypingr   r   r   r   Ú	pptx.utilr   r	   Útyping_extensionsr
   Úpptx.oxml.shapes.autoshaper   r   r   r   r   Úpptx.shapes.shapetreer   r   r   Ú__annotations__r   r   Úobjectr£   rZ   rp   rT   rs   r)   r'   Ú<module>rÐ      sŠ   ðÚ 9å "ç >Ó >ç 'æÝ+÷õ õ 7Ý à!UÐ �YÓ UØ?Ð �)Ó ?ô]4�hÐ/Ñ0ô ]4ô@!˜Fô !ôH
 ˆVô 
 ô
Ð(ô 
ô,
Ð#õ 
r)   