§
    èƒñjß  ã                  ó�   — U d Z ddlmZ ddlmZmZmZ erddlmZ ddl	m
Z
mZ ed         Zi Zded	<   d
Zded<   dd„Zdd„Zdd„ZdS )að   Drawing Stack

    This module tracks the active drawing and element for use in context
    managers, enabling of adding elements to a drawing without explicitly
    calling `d.add` or `d +=`. The stack is a dictionary (relying on being
    ordered) of drawing: element pairs. The last item in the dictionary
    is the last drawing or container to be opened by `with` block, and
    the element is the last element instantiated.
    
    Typical order of operations:

    1) A drawing is added to the stack when the `with` block is opened
    2) When an element is instantiated inside the block, it is set as
        the value of the drawing's dictionary item.
    3) When a different element is instantiated, the element in the
        stack will then be added to its drawing if it hasn't been added already.
        This allows the chained methods (such as `.up`, `.down`) to affect
        the element before it is placed.
    4) When the `with` block exits, the last element to be instantiated
        is added to the drawing, if it hasn't been already. The drawing
        is then popped from the stack.

    A `pause` attribute may be set True to prevent any stack operations.
    This may be used, for example, when adding elements to an ElementCompound.
é    )Úannotations)ÚUnionÚOptionalÚTYPE_CHECKINGé   )ÚDrawing)ÚElementÚ	Container)r   r
   z&dict[DrawingType, Optional['Element']]Údrawing_stackFÚboolÚpauseÚdrawingÚDrawingTypeÚreturnÚNonec                ó   — dt           | <   dS )z Add a drawing to the stack N)r   ©r   s    úV/data/share/cad/hardware/.venv/lib/python3.11/site-packages/schemdraw/drawing_stack.pyÚpush_drawingr   '   s   € à!…M�'ÑÐÐó    c                ó:   — t                                | ¦  «         dS )z# Remove the drawing from the stack N)r   Úpopr   s    r   Úpop_drawingr   +   s   € å×Ò�gÑÔÐÐÐr   ÚelementúOptional['Element']c                óô   — t           snt          t          ¦  «        dk    rXt          t                               ¦   «         ¦  «        d         \  }}|�||vr|                     |¦  «         | t          |<   dS dS dS )zh Add a new element to the stack, placing the existing
        one if not already placed by the user
    r   éÿÿÿÿN)r   Úlenr   ÚlistÚitemsÚadd)r   r   Úprev_elms      r   Úpush_elementr#   /   sƒ   € õ ð )•S�Ñ'Ô'¨!Ò+Ð+Ý ¥×!4Ò!4Ñ!6Ô!6Ñ7Ô7¸Ô;Ñˆ�ØÐ H°GÐ$;Ð$;Ø�KŠK˜Ñ!Ô!Ð!Ø!(��gÑÐÐð	)ð )Ð+Ð+r   N)r   r   r   r   )r   r   r   r   )Ú__doc__Ú
__future__r   Útypingr   r   r   Ú	schemdrawr   Úelementsr	   r
   r   r   Ú__annotations__r   r   r   r#   © r   r   ú<module>r+      së   ððð ð ð2 #Ð "Ð "Ð "Ð "Ð "Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1àð -Ø"Ð"Ð"Ð"Ð"Ð"Ø,Ð,Ð,Ð,Ð,Ð,Ð,Ð,àÐ*Ô+€à8:€Ð :Ð :Ð :Ñ :Ø€Ð Ð Ð Ñ ð"ð "ð "ð "ðð ð ð ð)ð )ð )ð )ð )ð )r   