§
    �’j"  ã                   óÂ   — d dl mZ d dlmZ d dlmZmZmZmZm	Z	m
Z
mZmZmZmZmZ eZ G d„ de¦  «        Z G d„ de¦  «        Z ede¬	¦  «        Z G d
„ d¦  «        ZdS )é    )ÚOrderedDict)ÚLock)ÚAnyÚCallableÚDictÚListÚMappingÚOptionalÚoverloadÚSetÚTupleÚTypeVarÚUnionc                   ó   — e Zd ZdZdS )ÚPyeeExceptionz@An exception internal to pyee. Deprecated in favor of PyeeError.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    ú7C:\Projects\DSCons\.venv\Lib\site-packages\pyee\base.pyr   r      s   € € € € € ØJÐJÐJÐJr   r   c                   ó   — e Zd ZdZdS )Ú	PyeeErrorzAn error internal to pyee.Nr   r   r   r   r   r      s   € € € € € Ø$Ð$Ð$Ð$r   r   ÚHandler)Úboundc                   óÆ  — e Zd ZdZdeddfd„Zdedeeef         fd„Z	dedeeef         ddfd„Z
eded	edeegef         fd
„¦   «         Zeded	ededefd„¦   «         Z	 d!ded	edee         deeeegef         f         fd„Zded	edeegef         fd„Zded	ededefd„Zded	ededefd„Zdededeedf         deeef         ddf
d„Zdedee         fd„Zded	ededdfd„Zded	edeedf         deeef         def
d„Zded	edededef
d„Z	 d!ded	edee         defd„Zded	ededdfd„Zded	ededdfd„Zd!ded	ee         ddfd„Z ded	ede!e         fd „Z"dS )"ÚEventEmitteraŽ  The base event emitter class. All other event emitters inherit from
    this class.

    Most events are registered with an emitter via the `on` and `once`
    methods, and fired with the `emit` method. However, pyee event emitters
    have two *special* events:

    - `new_listener`: Fires whenever a new listener is created. Listeners for
      this event do not fire upon their own creation.

    - `error`: When emitted raises an Exception by default, behavior can be
      overridden by attaching callback to the event.

      For example:

    ```py
    @ee.on('error')
    def on_error(message):
        logging.err(message)

    ee.emit('error', Exception('something blew up'))
    ```

    All callbacks are handled in a synchronous, blocking manner. As in node.js,
    raised exceptions are not automatically handled for you---you must catch
    your own exceptions, and treat them accordingly.
    ÚselfÚreturnNc                 óR   — t          ¦   «         | _        t          ¦   «         | _        d S ©N)ÚdictÚ_eventsr   Ú_lock©r    s    r   Ú__init__zEventEmitter.__init__>   s#   € õ ‰FŒFð 	Œõ  ™6œ6ˆŒ
ˆ
ˆ
r   c                 ó>   — | j                              ¦   «         }|d= |S )Nr&   )Ú__dict__Úcopy©r    Ústates     r   Ú__getstate__zEventEmitter.__getstate__E   s!   € Ø”×"Ò"Ñ$Ô$ˆØ�'ˆNØˆr   r-   c                 ó`   — | j                              |¦  «         t          ¦   «         | _        d S r#   )r*   Úupdater   r&   r,   s     r   Ú__setstate__zEventEmitter.__setstate__J   s'   € ØŒ×Ò˜UÑ#Ô#Ð#Ý‘V”VˆŒ
ˆ
ˆ
r   Úeventc                 ó   — d S r#   r   ©r    r2   s     r   ÚonzEventEmitter.onN   s   € ØDGÀCr   Úfc                 ó   — d S r#   r   ©r    r2   r6   s      r   r5   zEventEmitter.onP   s   € Ø;>¸3r   c                 ó\   — |€|                       |¦  «        S |                      ||¦  «        S )au  Registers the function `f` to the event name `event`, if provided.

        If `f` isn't provided, this method calls `EventEmitter#listens_to`, and
        otherwise calls `EventEmitter#add_listener`. In other words, you may either
        use it as a decorator:

        ```py
        @ee.on('data')
        def data_handler(data):
            print(data)
        ```

        Or directly:

        ```py
        ee.on('data', data_handler)
        ```

        In both the decorated and undecorated forms, the event handler is
        returned. The upshot of this is that you can call decorated handlers
        directly, as well as use them in remove_listener calls.

        Note that this method's return type is a union type. If you are using
        mypy or pyright, you will probably want to use either
        `EventEmitter#listens_to` or `EventEmitter#add_listener`.
        )Ú
listens_toÚadd_listenerr8   s      r   r5   zEventEmitter.onS   s1   € ð: ˆ9Ø—?’? 5Ñ)Ô)Ð)à×$Ò$ U¨AÑ.Ô.Ð.r   c                 ó4   ‡ ‡— dt           dt           fˆˆ fd„}|S )aV  Returns a decorator which will register the decorated function to
        the event name `event`:

        ```py
        @ee.listens_to("event")
        def data_handler(data):
            print(data)
        ```

        By only supporting the decorator use case, this method has improved
        type safety over `EventEmitter#on`.
        r6   r!   c                 ó6   •— ‰                      ‰| | ¦  «         | S r#   ©Ú_add_event_handler)r6   r2   r    s    €€r   r5   z#EventEmitter.listens_to.<locals>.onƒ   s    ø€ Ø×#Ò# E¨1¨aÑ0Ô0Ð0ØˆHr   )r   )r    r2   r5   s   `` r   r:   zEventEmitter.listens_tou   s<   øø€ ð	•'ð 	�gð 	ð 	ð 	ð 	ð 	ð 	ð 	ð ˆ	r   c                 ó4   — |                       |||¦  «         |S )a:  Register the function `f` to the event name `event`:

        ```
        def data_handler(data):
            print(data)

        h = ee.add_listener("event", data_handler)
        ```

        By not supporting the decorator use case, this method has improved
        type safety over `EventEmitter#on`.
        r>   r8   s      r   r;   zEventEmitter.add_listener‰   s!   € ð 	×Ò  q¨!Ñ,Ô,Ð,Øˆr   ÚkÚvc                 óÒ   — |                       d||¦  «         | j        5  || j        vrt          ¦   «         | j        |<   || j        |         |<   d d d ¦  «         d S # 1 swxY w Y   d S )NÚnew_listener)Úemitr&   r%   r   )r    r2   rA   rB   s       r   r?   zEventEmitter._add_event_handler™   s´   € à�	Š	�. %¨Ñ+Ô+Ð+ð ŒZð 	'ð 	'Ø˜DœLÐ(Ð(Ý&1¡m¤m�”˜UÑ#Ø%&ˆDŒL˜Ô Ñ"ð	'ð 	'ð 	'ñ 	'ô 	'ð 	'ð 	'ð 	'ð 	'ð 	'ð 	'ð 	'øøøð 	'ð 	'ð 	'ð 	'ð 	'ð 	's   Ÿ0AÁA Á#A Úargs.Úkwargsc                 ó   —  ||i |¤Ž d S r#   r   )r    r6   rF   rG   s       r   Ú	_emit_runzEventEmitter._emit_run¦   s   € ð 	
ˆˆ4Ð�6ÐÐÐÐÐr   c                 óN   — t          | j                             ¦   «         ¦  «        S )z6Get a set of events that this emitter is listening to.)Úsetr%   Úkeysr'   s    r   Úevent_nameszEventEmitter.event_names®   s   € å�4”<×$Ò$Ñ&Ô&Ñ'Ô'Ð'r   Úerrorc                 ód   — |dk    r)t          |t          ¦  «        r|‚t          d|› �¦  «        ‚d S )NrN   z%Uncaught, unspecified 'error' event: )Ú
isinstanceÚ	Exceptionr   )r    r2   rN   s      r   Ú_emit_handle_potential_errorz)EventEmitter._emit_handle_potential_error²   sD   € Ø�GÒÐÝ˜%¥Ñ+Ô+ð QØ�åÐ OÈÐ OÐ OÑPÔPÐPð	 Ðr   c                 ó  — d}| j         5  t          | j                             |t	          ¦   «         ¦  «                             ¦   «         ¦  «        }d d d ¦  «         n# 1 swxY w Y   |D ]}|                      |||¦  «         d}Œ|S )NFT)r&   Úlistr%   Úgetr   ÚvaluesrI   )r    r2   rF   rG   ÚhandledÚfuncsr6   s          r   Ú_call_handlerszEventEmitter._call_handlers¹   s×   € ð ˆàŒZð 	Jð 	JÝ˜œ×)Ò)¨%µ±´Ñ?Ô?×FÒFÑHÔHÑIÔIˆEð	Jð 	Jð 	Jñ 	Jô 	Jð 	Jð 	Jð 	Jð 	Jð 	Jð 	Jøøøð 	Jð 	Jð 	Jð 	Jàð 	ð 	ˆAØ�NŠN˜1˜d FÑ+Ô+Ð+ØˆGˆGàˆs   ŠAAÁA!Á$A!c                 óx   — |                       |||¦  «        }|s |                      ||r|d         nd¦  «         |S )ac  Emit `event`, passing `*args` and `**kwargs` to each attached
        function. Returns `True` if any functions are attached to `event`;
        otherwise returns `False`.

        Example:

        ```py
        ee.emit('data', '00101001')
        ```

        Assuming `data` is an attached function, this will call
        `data('00101001')'`.
        r   N)rY   rR   )r    r2   rF   rG   rW   s        r   rE   zEventEmitter.emitÉ   sL   € ð& ×%Ò% e¨T°6Ñ:Ô:ˆàð 	PØ×-Ò-¨eÀÐ5N°T¸!´W°WÈ$ÑOÔOÐOàˆr   c                 óN   ‡ ‡— dt           dt           fˆˆ fd„}|€|S  ||¦  «        S )zkThe same as `ee.on`, except that the listener is automatically
        removed after being called.
        r6   r!   c                 ór   •‡ — dt           dt           dt           fˆˆ ˆfd„}‰                     ‰‰ |¦  «         ‰ S )NrF   rG   r!   c                  óÎ   •— ‰j         5  ‰‰j        v r&‰‰j        ‰         v r‰                     ‰‰¦  «         n	 d d d ¦  «         d S 	 d d d ¦  «         n# 1 swxY w Y    ‰| i |¤ŽS r#   )r&   r%   Ú_remove_listener)rF   rG   r2   r6   r    s     €€€r   Úgz.EventEmitter.once.<locals>._wrapper.<locals>.gí   sâ   ø€ ð ”Zð $ð $ð  ¤Ð,Ð,°°d´lÀ5Ô6IÐ1IÐ1IØ×-Ò-¨e°QÑ7Ô7Ð7Ð7à#ð$ð $ð $ñ $ô $ð $ð $ð $ð 8ð	$ð $ð $ñ $ô $ð $ð $ð $ð $ð $ð $øøøð $ð $ð $ð $ð �q˜$Ð) &Ð)Ð)Ð)s   ‰1AÁAÁA)r   r?   )r6   r_   r2   r    s   ` €€r   Ú_wrapperz#EventEmitter.once.<locals>._wrapperì   se   øø€ ð*Ýð*åð*õ ð*ð *ð *ð *ð *ð *ð *ð *ð ×#Ò# E¨1¨aÑ0Ô0Ð0ØˆHr   )r   )r    r2   r6   r`   s   ``  r   ÚoncezEventEmitter.onceã   sO   øø€ ð	�ð 	¥Xð 	ð 	ð 	ð 	ð 	ð 	ð 	ð& ˆ9ØˆOà�8˜A‘;”;Ðr   c                 óŠ   — || j         v r7| j         |                              |¦  «         | j         |         s| j         |= dS dS dS )zNaked unprotected removal.N)r%   Úpopr8   s      r   r^   zEventEmitter._remove_listener  s[   € à�D”LÐ Ð ØŒL˜Ô×#Ò# AÑ&Ô&Ð&Ø”< Ô&ð (Ø”L Ð'Ð'Ð'ð !Ð ð(ð (r   c                 ór   — | j         5  |                      ||¦  «         ddd¦  «         dS # 1 swxY w Y   dS )z&Removes the function `f` from `event`.N)r&   r^   r8   s      r   Úremove_listenerzEventEmitter.remove_listener  s„   € àŒZð 	,ð 	,Ø×!Ò! %¨Ñ+Ô+Ð+ð	,ð 	,ð 	,ñ 	,ô 	,ð 	,ð 	,ð 	,ð 	,ð 	,ð 	,ð 	,øøøð 	,ð 	,ð 	,ð 	,ð 	,ð 	,s   ˆ,¬0³0c                 óž   — | j         5  |�t          ¦   «         | j        |<   nt          ¦   «         | _        ddd¦  «         dS # 1 swxY w Y   dS )ztRemove all listeners attached to `event`.
        If `event` is `None`, remove all listeners on all events.
        N)r&   r   r%   r$   r4   s     r   Úremove_all_listenersz!EventEmitter.remove_all_listeners  s”   € ð ŒZð 	&ð 	&ØÐ Ý&1¡m¤m�”˜UÑ#Ð#å#™vœv�”ð		&ð 	&ð 	&ñ 	&ô 	&ð 	&ð 	&ð 	&ð 	&ð 	&ð 	&ð 	&øøøð 	&ð 	&ð 	&ð 	&ð 	&ð 	&s   ˆ-AÁAÁ	Ac                 óŽ   — t          | j                             |t          ¦   «         ¦  «                             ¦   «         ¦  «        S )z:Returns a list of all listeners registered to the `event`.)rT   r%   rU   r   rL   r4   s     r   Ú	listenerszEventEmitter.listeners  s2   € å�D”L×$Ò$ U­K©M¬MÑ:Ô:×?Ò?ÑAÔAÑBÔBÐBr   r#   )#r   r   r   r   ÚSelfr(   r	   Ústrr   r.   r1   r   r   r   r5   r
   r   r:   r;   r?   r   r   rI   r   rM   rR   ÚboolrY   rE   ra   r^   re   rg   r   ri   r   r   r   r   r   !   s=  € € € € € ðð ð8"�tð " ð "ð "ð "ð "ð˜4ð  G¨C°¨HÔ$5ð ð ð ð ð
˜4ð ¨°°S°Ô(9ð ¸dð ð ð ð ð ØG�ÐG˜cÐG h°¨y¸'Ð/AÔ&BÐGÐGÐGñ „XØGØØ>�Ð>˜cÐ> gÐ>°'Ð>Ð>Ð>ñ „XØ>ð 8<ð /ð  /Øð /Øð /Ø#+¨GÔ#4ð /à	ˆw˜ ' ¨GÐ!3Ô4Ð4Ô	5ð /ð  /ð  /ð  /ðD˜ð  cð ¨h¸°yÀ'Ð7IÔ.Jð ð ð ð ð(˜4ð ¨ð °ð ¸Gð ð ð ð ð ' ð '¨cð '°hð 'À8ð 'ð 'ð 'ð 'ðØðàðð �C˜�HŒoðð �S˜#�X”ð	ð
 
ðð ð ð ð(˜$ð ( 3 s¤8ð (ð (ð (ð (ðQ¨4ð Q¸ð QÀCð QÈDð Qð Qð Qð QðØðàðð �C˜�HŒoðð �S˜#�X”ð	ð
 
ðð ð ð ð Øðàðð ðð ð	ð
 
ðð ð ð ð: !%ðð Øðàðð �HÔðð 
ð	ð ð ð ðB(˜tð (¨Cð (°Hð (Àð (ð (ð (ð (ð,˜dð ,¨3ð ,°8ð ,Àð ,ð ,ð ,ð ,ð
&ð & 4ð &°¸´ð &Èð &ð &ð &ð &ðC˜ð C Sð C¨T°(¬^ð Cð Cð Cð Cð Cð Cr   r   N)Úcollectionsr   Ú	threadingr   Útypingr   r   r   r   r	   r
   r   r   r   r   r   rj   rQ   r   r   r   r   r   r   r   ú<module>rp      sl  ðð $Ð #Ð #Ð #Ð #Ð #Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð €ðKð Kð Kð Kð K�Iñ Kô Kð Kð%ð %ð %ð %ð %�ñ %ô %ð %ð ˆ'�) 8Ð
,Ñ
,Ô
,€ð{Cð {Cð {Cð {Cð {Cñ {Cô {Cð {Cð {Cð {Cr   