§
    Ìtºf‘5  ã            	       ó&  — d dl Z d dlmZmZ d dlmZ d dlmZmZ dZ	de
fd„Ze G d„ d	e¦  «        ¦   «         Zeddee
         d
ee         dee         fd„¦   «         Zeddee
         d
ee         dee         fd„¦   «         Zede
fd„¦   «         ZdS )é    N)ÚOptionalÚUnion)Úpublic)ÚRegisterOptionsÚSubscribeOptions)ÚPatternÚregisterÚ	subscribeÚerrorÚconvert_starred_uriÚuric                 óè   — t          | ¦  «        t          k    sJ ‚|                      d¦  «        }|dk    rd}n7|dk    r| d         dk    rd}| dd…         } nd}|                      dd	¦  «        } | |fS )
aŽ  
    Convert a starred URI to a standard WAMP URI and a detected matching
    policy. A starred URI is one that may contain the character '*' used
    to mark URI wildcard components or URI prefixes. Starred URIs are
    more comfortable / intuitive to use at the user/API level, but need
    to be converted for use on the wire (WAMP protocol level).

    This function takes a possibly starred URI, detects the matching policy
    implied by stars, and returns a pair (uri, match) with any stars
    removed from the URI and the detected matching policy.

    An URI like 'com.example.topic1' (without any stars in it) is
    detected as an exact-matching URI.

    An URI like 'com.example.*' (with exactly one star at the very end)
    is detected as a prefix-matching URI on 'com.example.'.

    An URI like 'com.*.foobar.*' (with more than one star anywhere) is
    detected as a wildcard-matching URI on 'com..foobar.' (in this example,
    there are two wildcard URI components).

    Note that an URI like 'com.example.*' is always detected as
    a prefix-matching URI 'com.example.'. You cannot express a wildcard-matching
    URI 'com.example.' using the starred URI notation! A wildcard matching on
    'com.example.' is different from prefix-matching on 'com.example.' (which
    matches a strict superset of the former!). This is one reason we don't use
    starred URIs for WAMP at the protocol level.
    Ú*r   Úexacté   éÿÿÿÿÚprefixNÚwildcardÚ )ÚtypeÚstrÚcountÚreplace)r   Ú	cnt_starsÚmatchs      úP/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/autobahn/wamp/uri.pyr   r   +   s‡   € õ: �‰9Œ9�ÒÐÐÐà—	’	˜#‘”€Ià�A‚~€~Øˆˆà	�aŠˆ˜C œG sšN˜NØˆØ�#�2�#Œhˆˆð ˆØ�kŠk˜#˜rÑ"Ô"ˆà�ˆ:Ðó    c            
       ó€  — e Zd ZdZdZdZdZdZdZdZ	 e
j        d¦  «        Z	  e
j        d¦  «        Z	  e
j        d¦  «        Z	 	 	 dd	ed
edeeeef                  dee         fd„Zeed„ ¦   «         ¦   «         Zeed„ ¦   «         ¦   «         Zed„ ¦   «         Zd„ Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         ZdS )r   z×
    A WAMP URI Pattern.

    .. todo::

       * suffix matches
       * args + kwargs
       * uuid converter
       * multiple URI patterns per decorated object
       * classes: Pattern, EndpointPattern, ..
    r   é   é   z^[a-z0-9][a-z0-9_\-]*$z^<([a-z][a-z0-9_]*)>$z^<([a-z][a-z0-9_]*):([a-z]*)>$Nr   ÚtargetÚoptionsÚcheck_typesc                 óð  — t          |¦  «        t          k    sJ ‚t          |¦  «        dk    sJ ‚|t          j        t          j        t          j        fv sJ ‚|t          j        k    r|�t          |¦  «        t          k    sJ ‚n/|t          j        k    r|�t          |¦  «        t          k    sJ ‚nd}| 	                    d¦  «        }d}g }i }d}	t          t          |¦  «        ¦  «        D �]þ}
||
         }t          j                             |¦  «        }|rÆ|                     ¦   «         \  }}|dvrt          d¦  «        ‚|dk    r%|
t          |¦  «        dz
  k    rt          d¦  «        ‚||v rt          d¦  «        ‚|d	v rt          ||<   n |d
k    rt          ||<   nt          d¦  «        ‚|                     d                     ||¦  «        ¦  «         |	dz  }	Œòt          j                             |¦  «        }|rg|                     ¦   «         d         }||v rt          d¦  «        ‚t          ||<   |                     d                     ||¦  «        ¦  «         |	dz  }	�Œzt          j                             |¦  «        }|r|                     |¦  «         �Œ²|dk    r9|	dz  }	|                     d                     |¦  «        ¦  «         t          ||	<   �Œñt          d¦  «        ‚|rMt          j        | _        dd                     |¦  «        z   dz   }t/          j        |¦  «        | _        || _        nt          j        | _        d| _        d| _        || _        || _        || _        || _        dS )a  

        :param uri: The URI or URI pattern, e.g. ``"com.myapp.product.<product:int>.update"``.
        :type uri: str

        :param target: The target for this pattern: a procedure endpoint (a callable),
           an event handler (a callable) or an exception (a class).
        :type target: callable or obj

        :param options: An optional options object
        :type options: None or RegisterOptions or SubscribeOptions

        :param check_types: Enable automatic type checking against (Python 3.5+) type hints
            specified on the ``endpoint`` callable. Types are checked at run-time on each
            invocation of the ``endpoint`` callable. When a type mismatch occurs, the error
            is forwarded to the callee code in ``onUserError`` override method of
            :class:`autobahn.wamp.protocol.ApplicationSession`. An error
            of type :class:`autobahn.wamp.exception.TypeCheckError` is also raised and
            returned to the caller (via the router).
        :type check_types: bool

        r   Nú.z	[^\s\.#]+)r   ÚstringÚintÚsuffixzinvalid URIr(   r   )r   r&   r(   r'   zlogic errorz
(?P<{}>{})r   z({})ú^z\.ú$) r   r   Úlenr   ÚURI_TARGET_ENDPOINTÚURI_TARGET_HANDLERÚURI_TARGET_EXCEPTIONr   r   ÚsplitÚrangeÚ_URI_NAMED_CONVERTED_COMPONENTr   ÚgroupsÚ	TypeErrorr'   ÚappendÚformatÚ_URI_NAMED_COMPONENTÚ_URI_COMPONENTÚURI_TYPE_WILDCARDÚ_typeÚjoinÚreÚcompileÚ_patternÚ_namesÚURI_TYPE_EXACTÚ_uriÚ_targetÚ_optionsÚ_check_types)Úselfr   r!   r"   r#   Ú
componentsÚ_URI_COMP_CHARSÚplÚncÚgroup_countÚiÚ	componentr   ÚnameÚ	comp_typeÚps                   r   Ú__init__zPattern.__init__…   sy  € õ0 �S‘	”	�SÒ Ð Ð Ð Ý�C‘”˜1’���Ø�7Ô6Ý"Ô5Ý"Ô7ð9ð 9ð 9ð 9ð 9ð •WÔ0Ò0Ð0Ø�O¥t¨G¡}¤}½Ò'GÐ'GÐ'GÐ'GøØ•wÔ1Ò1Ð1Ø�O¥t¨G¡}¤}Õ8HÒ'HÐ'HÐ'HÐ'HøàˆGà—Y’Y˜s‘^”^ˆ
à&ˆð ˆØˆØˆÝ•s˜:‘”Ñ'Ô'ð 1	+ñ 1	+ˆAØ" 1œˆIåÔ:×@Ò@ÀÑKÔKˆEØð Ø"'§,¢,¡.¤.‘��iØÐ$FÐFÐFÝ# MÑ2Ô2Ð2à Ò(Ð(¨Qµ#°j±/´/ÀAÑ2EÒ-EÐ-EÝ# MÑ2Ô2Ð2à˜2�:�:Ý# MÑ2Ô2Ð2àÐ ;Ð;Ð;Ý"�B�t‘H�HØ %Ò'Ð'Ý"�B�t‘H�Hõ $ MÑ2Ô2Ð2à—	’	˜,×-Ò-¨d°OÑDÔDÑEÔEÐEØ˜qÑ �ØåÔ0×6Ò6°yÑAÔAˆEØð Ø—|’|‘~”~ aÔ(�Ø˜2�:�:Ý# MÑ2Ô2Ð2å��4‘Ø—	’	˜,×-Ò-¨d°OÑDÔDÑEÔEÐEØ˜qÑ �ÙåÔ*×0Ò0°Ñ;Ô;ˆEØð Ø—	’	˜)Ñ$Ô$Ð$Ùà˜BŠˆØ˜qÑ �Ø—	’	˜'Ÿ.š.¨Ñ9Ô9Ñ:Ô:Ð:Ý"%��;‘Ùå˜MÑ*Ô*Ð*àð 
	å Ô2ˆDŒJØ�e—j’j ‘n”nÑ$ sÑ*ˆAÝœJ q™MœMˆDŒMØˆDŒKˆKõ !Ô/ˆDŒJØ ˆDŒMØˆDŒKØˆŒ	ØˆŒØˆŒØ'ˆÔÐÐr   c                 ó   — | j         S )z¸
        Returns the Options instance (if present) for this pattern.

        :return: None or the Options instance
        :rtype: None or RegisterOptions or SubscribeOptions
        )rB   ©rD   s    r   r"   zPattern.optionsõ   s   € ð Œ}Ðr   c                 ó   — | j         S )z¥
        Returns the URI type of this pattern

        :return:
        :rtype: Pattern.URI_TYPE_EXACT, Pattern.URI_TYPE_PREFIX or Pattern.URI_TYPE_WILDCARD
        )r9   rQ   s    r   Úuri_typezPattern.uri_type   s   € ð ŒzÐr   c                 ó   — | j         S )z³
        Returns the original URI (pattern) for this pattern.

        :returns: The URI (pattern), e.g. ``"com.myapp.product.<product:int>.update"``.
        :rtype: str
        )r@   rQ   s    r   r   zPattern.uri  s   € ð ŒyÐr   c                 ó<  — g }i }| j         t          j        k    r||fS | j         t          j        k    ri| j                             |¦  «        }|r>| j        D ]2}|                     |¦  «        } | j        |         |¦  «        }|||<   Œ3||fS t          d¦  «        ‚dS )a-  
        Match the given (fully qualified) URI according to this pattern
        and return extracted args and kwargs.

        :param uri: The URI to match, e.g. ``"com.myapp.product.123456.update"``.
        :type uri: str

        :returns: A tuple ``(args, kwargs)``
        :rtype: tuple
        zno matchN)	r9   r   r?   r8   r=   r   r>   ÚgroupÚ
ValueError)rD   r   ÚargsÚkwargsr   ÚkeyÚvals          r   r   zPattern.match  s¸   € ð ˆØˆØŒ:�Ô/Ò/Ð/Ø˜�<ÐØŒZ�7Ô4Ò4Ð4Ø”M×'Ò'¨Ñ,Ô,ˆEØð -Øœ;ð &ð &�CØŸ+š+ cÑ*Ô*�CØ*˜$œ+ cÔ*¨3Ñ/Ô/�CØ"%�F˜3‘K�KØ˜V�|Ð#å  Ñ,Ô,Ð,ð 5Ð4r   c                 ó,   — | j         t          j        k    S )z¤
        Check if this pattern is for a procedure endpoint.

        :returns: ``True``, iff this pattern is for a procedure endpoint.
        :rtype: bool
        )rA   r   r,   rQ   s    r   Úis_endpointzPattern.is_endpoint/  s   € ð Œ|�wÔ:Ò:Ð:r   c                 ó,   — | j         t          j        k    S )zœ
        Check if this pattern is for an event handler.

        :returns: ``True``, iff this pattern is for an event handler.
        :rtype: bool
        )rA   r   r-   rQ   s    r   Ú
is_handlerzPattern.is_handler9  s   € ð Œ|�wÔ9Ò9Ð9r   c                 ó,   — | j         t          j        k    S )z”
        Check if this pattern is for an exception.

        :returns: ``True``, iff this pattern is for an exception.
        :rtype: bool
        )rA   r   r.   rQ   s    r   Úis_exceptionzPattern.is_exceptionC  s   € ð Œ|�wÔ;Ò;Ð;r   ©NN) Ú__name__Ú
__module__Ú__qualname__Ú__doc__r,   r-   r.   r?   ÚURI_TYPE_PREFIXr8   r;   r<   r7   r6   r1   r   r'   r   r   r   r   ÚboolrO   r   Úpropertyr"   rS   r   r   r]   r_   ra   © r   r   r   r   Z   s±  € € € € € ð
ð 
ð ÐØÐØÐà€NØ€OØÐà�R”ZÐ 9Ñ:Ô:€Nðð &˜2œ:Ð&>Ñ?Ô?Ððð &0 R¤ZÐ0QÑ%RÔ%RÐ"ðð mqØ/3ðn(ð n(˜Cð n(¨ð n(°xÀÐFVÐXgÐFgÔ@hÔ7ið n(Ø& tœnðn(ð n(ð n(ð n(ð` Øðð ñ „Xñ „Vðð Øðð ñ „Xñ „Vðð ðð ñ „Vðð-ð -ð -ð4 ð;ð ;ñ „Vð;ð ð:ð :ñ „Vð:ð ð<ð <ñ „Vð<ð <ð <r   r   r"   r#   c                 ó   ‡ ‡‡— ˆˆˆ fd„}|S )aÏ  
    Decorator for WAMP procedure endpoints.

    :param uri:
    :type uri: str

    :param options:
    :type options: None or RegisterOptions

    :param check_types: Enable automatic type checking against (Python 3.5+) type hints
        specified on the ``endpoint`` callable. Types are checked at run-time on each
        invocation of the ``endpoint`` callable. When a type mismatch occurs, the error
        is forwarded to the callee code in ``onUserError`` override method of
        :class:`autobahn.wamp.protocol.ApplicationSession`. An error
        of type :class:`autobahn.wamp.exception.TypeCheckError` is also raised and
        returned to the caller (via the router).
    :type check_types: bool
    c                 óþ   •— t          | ¦  «        sJ ‚‰€d                     | j        ¦  «        }n‰}t          | d¦  «        sg | _        | j                             t          |t          j        ‰‰¦  «        ¦  «         | S )Nz{}Ú	_wampuris)Úcallabler5   rc   Úhasattrrm   r4   r   r,   )ÚfÚreal_urir#   r"   r   s     €€€r   Údecoratezregister.<locals>.decorateb  sz   ø€ Ý˜‰{Œ{ÐÐÐØˆ;Ø—{’{ 1¤:Ñ.Ô.ˆHˆHàˆHÝ�q˜+Ñ&Ô&ð 	ØˆAŒKØ	Œ×Ò�7 8­WÔ-HÈ'ÐS^Ñ_Ô_Ñ`Ô`Ð`Øˆr   rj   ©r   r"   r#   rr   s   ``` r   r	   r	   N  s/   øøø€ ð(	ð 	ð 	ð 	ð 	ð 	ð 	ð €Or   c                 ó   ‡ ‡‡— ˆˆˆ fd„}|S )aË  
    Decorator for WAMP event handlers.

    :param uri:
    :type uri: str

    :param options:
    :type options: None or SubscribeOptions

    :param check_types: Enable automatic type checking against (Python 3.5+) type hints
        specified on the ``endpoint`` callable. Types are checked at run-time on each
        invocation of the ``endpoint`` callable. When a type mismatch occurs, the error
        is forwarded to the callee code in ``onUserError`` override method of
        :class:`autobahn.wamp.protocol.ApplicationSession`. An error
        of type :class:`autobahn.wamp.exception.TypeCheckError` is also raised and
        returned to the caller (via the router).
    :type check_types: bool
    c                 óÀ   •— t          | ¦  «        sJ ‚t          | d¦  «        sg | _        | j                             t	          ‰t          j        ‰‰¦  «        ¦  «         | S ©Nrm   )rn   ro   rm   r4   r   r-   )rp   r#   r"   r   s    €€€r   rr   zsubscribe.<locals>.decorateƒ  sZ   ø€ Ý˜‰{Œ{ÐÐÐÝ�q˜+Ñ&Ô&ð 	ØˆAŒKØ	Œ×Ò�7 3­Ô(BÀGÈ[ÑYÔYÑZÔZÐZØˆr   rj   rs   s   ``` r   r
   r
   o  s/   øøø€ ð(ð ð ð ð ð ð ð €Or   c                 ó   ‡ — ˆ fd„}|S )z+
    Decorator for WAMP error classes.
    c                 óÈ   •— t          | t          ¦  «        sJ ‚t          | d¦  «        sg | _        | j                             t          ‰t
          j        ¦  «        ¦  «         | S rv   )Ú
issubclassÚ	Exceptionro   rm   r4   r   r.   )Úclsr   s    €r   rr   zerror.<locals>.decorate‘  sZ   ø€ Ý˜#�yÑ)Ô)Ð*Ð*Ð*Ý�s˜KÑ(Ô(ð 	ØˆCŒMØŒ×Ò�W S­'Ô*FÑGÔGÑHÔHÐHØˆ
r   rj   )r   rr   s   ` r   r   r   Œ  s#   ø€ ð
ð ð ð ð ð €Or   rb   )r;   Útypingr   r   Úautobahn.utilr   Úautobahn.wamp.typesr   r   Ú__all__r   r   Úobjectr   rh   r	   r
   r   rj   r   r   ú<module>r�      s{  ðð8 
€	€	€	Ø "Ð "Ð "Ð "Ð "Ð "Ð "Ð "à  Ð  Ð  Ð  Ð  Ð  Ø AÐ AÐ AÐ AÐ AÐ AÐ AÐ Að€ð,˜Sð ,ð ,ð ,ð ,ð^ ðp<ð p<ð p<ð p<ð p<ˆfñ p<ô p<ñ „ðp<ðf ðð �(˜3”-ð ¨(°?Ô*Cð ÐYaÐbfÔYgð ð ð ñ „ðð@ ðð �8˜C”=ð ¨8Ð4DÔ+Eð Ð[cÐdhÔ[ið ð ð ñ „ðð8 ð
ˆsð 
ð 
ð 
ñ „ð
ð 
ð 
r   