§
    Étºfè  ã                   ó:  — U d Z ddlmZmZmZ ddlmZmZmZ  G d„ de	¦  «        Z
dedeeedf         eeedf         f         fd	„Zd
eedf         dedeedf         deeedf         eeedf         f         fd„Zi Zeedf         ed<   d„ Z G d„ d¦  «        ZdS )a$  
Jabber Identifier support.

This module provides an object to represent Jabber Identifiers (JIDs) and
parse string representations into them with proper checking for illegal
characters, case folding and canonicalisation through
L{stringprep<twisted.words.protocols.jabber.xmpp_stringprep>}.
é    )ÚDictÚTupleÚUnion)ÚnameprepÚnodeprepÚresourceprepc                   ó   — e Zd ZdZdS )ÚInvalidFormatzT
    The given string could not be parsed into a valid Jabber Identifier (JID).
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úa/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/words/protocols/jabber/jid.pyr
   r
      s   € € € € € ðð ð ð r   r
   Ú	jidstringÚreturnNc                 ó²  — d}d}d}|                       d¦  «        }|                       d¦  «        }|dk    r#|dk    r| }nˆ| d|…         }| |dz   d…         pd}nn|dk    r| d|…         pd}| |dz   d…         }nN||k     r/| d|…         pd}| |dz   |||z
  z   …         }| |dz   d…         pd}n| d|…         }| |dz   d…         pd}t          |||¦  «        S )aÇ  
    Parse given JID string into its respective parts and apply stringprep.

    @param jidstring: string representation of a JID.
    @type jidstring: L{str}
    @return: tuple of (user, host, resource), each of type L{str} as
             the parsed and stringprep'd parts of the given JID. If the
             given string did not have a user or resource part, the respective
             field in the tuple will hold L{None}.
    @rtype: L{tuple}
    Nú@ú/éÿÿÿÿr   é   )ÚfindÚprep)r   ÚuserÚhostÚresourceÚuser_sepÚres_seps         r   Úparser       s6  € ð €DØ€DØ€Hð �~Š~˜cÑ"Ô"€HØ�nŠn˜SÑ!Ô!€Gà�2‚~€~Ø�bŠ=ˆ=àˆDˆDð ˜Q˜w˜YÔ'ˆDØ  ¨1¡  Ô/Ð7°4ˆHˆHà�bŠ=ˆ=à˜Q˜x˜ZÔ(Ð0¨DˆDØ˜X¨™\˜^˜^Ô,ˆDˆDà˜'Ò!Ð!à   8 Ô,Ð4°�Ø  ¨A¡°¸GÀhÑ<NÑ0OÐ!OÔP�Ø$ W¨q¡[ ] ]Ô3Ð;°t��ð !  7 Ô+�Ø$ W¨q¡[ ] ]Ô3Ð;°t�å��d˜HÑ%Ô%Ð%r   r   r   r   c                 ó¾  — | r@	 t          j        t          | ¦  «        ¦  «        } n# t          $ r t	          d¦  «        ‚w xY wd} |st	          d¦  «        ‚	 t          j        t          |¦  «        ¦  «        }n# t          $ r t	          d¦  «        ‚w xY w|r@	 t          j        t          |¦  «        ¦  «        }n# t          $ r t	          d¦  «        ‚w xY wd}| ||fS )aP  
    Perform stringprep on all JID fragments.

    @param user: The user part of the JID.
    @type user: L{str}
    @param host: The host part of the JID.
    @type host: L{str}
    @param resource: The resource part of the JID.
    @type resource: L{str}
    @return: The given parts with stringprep applied.
    @rtype: L{tuple}
    zInvalid character in usernameNzServer address required.zInvalid character in hostnamezInvalid character in resource)r   ÚprepareÚstrÚUnicodeErrorr
   r   r   )r   r   r   s      r   r   r   M   s-  € ð  ð ð	AÝÔ#¥C¨¡I¤IÑ.Ô.ˆDˆDøÝð 	Að 	Að 	AÝÐ ?Ñ@Ô@Ð@ð	Aøøøð ˆàð AÝÐ6Ñ7Ô7Ð7ð	AÝÔ#¥C¨¡I¤IÑ.Ô.ˆDˆDøÝð 	Að 	Að 	AÝÐ ?Ñ@Ô@Ð@ð	Aøøøð ð ð	AÝ#Ô+­C°©M¬MÑ:Ô:ˆHˆHøÝð 	Að 	Að 	AÝÐ ?Ñ@Ô@Ð@ð	Aøøøð ˆà�$˜Ð!Ð!s!   „!& ¦A Á!A9 Á9BÂ!B; Â;CÚJIDÚ__internJIDsc                 ód   — | t           v rt           |          S t          | ¦  «        }|t           | <   |S )z2
    Return interned JID.

    @rtype: L{JID}
    )r&   r%   )r   Újs     r   Ú	internJIDr)   {   s4   € ð •LÐ Ð Ý˜IÔ&Ð&å�	‰NŒNˆØ"#��YÑØˆr   c                   ó¸   — e Zd ZdZ	 	 ddeedf         deeeedf         eeedf         f         df         fd„Zd„ Zd„ Z	d„ Z
d	ed
efd„Zd„ Zd„ ZeZd
efd„ZdS )r%   z‰
    Represents a stringprep'd Jabber ID.

    JID objects are hashable so they can be used in sets and as keys in
    dictionaries.
    Nr#   Útuplec                 óš   — |rt          |¦  «        \  }}}n|rt          |Ž \  }}}nt          d¦  «        ‚|| _        || _        || _        d S )Nz?You must provide a value for either 'str' or 'tuple' arguments.)r    r   ÚRuntimeErrorr   r   r   )Úselfr#   r+   r   r   Úress         r   Ú__init__zJID.__init__’   sh   € ð
 ð 	Ý# C™jœj‰OˆD�$˜˜Øð 	Ý" E˜l‰OˆD�$˜˜åØQñô ð ð ˆŒ	ØˆŒ	ØˆŒˆˆr   c                 ó@   — | j         r| j         › d| j        › �S | j        S )zÃ
        Extract the bare JID as a unicode string.

        A bare JID does not have a resource part, so this returns either
        C{user@host} or just C{host}.

        @rtype: L{str}
        r   )r   r   ©r.   s    r   ÚuserhostzJID.userhost¤   s.   € ð Œ9ð 	Ø”iÐ-Ð- $¤)Ð-Ð-Ð-à”9Ðr   c                 óV   — | j         r!t          |                      ¦   «         ¦  «        S | S )a�  
        Extract the bare JID.

        A bare JID does not have a resource part, so this returns a
        L{JID} object representing either C{user@host} or just C{host}.

        If the object this method is called upon doesn't have a resource
        set, it will return itself. Otherwise, the bare JID object will
        be created, interned using L{internJID}.

        @rtype: L{JID}
        )r   r)   r3   r2   s    r   ÚuserhostJIDzJID.userhostJID²   s)   € ð Œ=ð 	Ý˜TŸ]š]™_œ_Ñ-Ô-Ð-àˆKr   c                 ó°   — | j         r1| j        r| j         › d| j        › d| j        › �S | j         › d| j        › �S | j        r| j        › d| j        › �S | j        S )zW
        Return the string representation of this JID.

        @rtype: L{str}
        r   r   )r   r   r   r2   s    r   ÚfullzJID.fullÄ   s|   € ð Œ9ð 		!ØŒ}ð 2Øœ)ÐAÐA d¤iÐAÐA°$´-ÐAÐAÐAàœ)Ð1Ð1 d¤iÐ1Ð1Ð1àŒ}ð !Øœ)Ð5Ð5 d¤mÐ5Ð5Ð5à”yÐ r   Úotherr   c                 óš   — t          |t          ¦  «        r0| j        |j        k    o| j        |j        k    o| j        |j        k    S t
          S )zá
        Equality comparison.

        L{JID}s compare equal if their user, host and resource parts all
        compare equal.  When comparing against instances of other types, it
        uses the default comparison.
        )Ú
isinstancer%   r   r   r   ÚNotImplemented)r.   r8   s     r   Ú__eq__z
JID.__eq__Õ   sQ   € õ �e�SÑ!Ô!ð 	"à”	˜UœZÒ'ð 4Ø”I ¤Ò+ð4à”M U¤^Ò3ðõ "Ð!r   c                 óD   — t          | j        | j        | j        f¦  «        S )a  
        Calculate hash.

        L{JID}s with identical constituent user, host and resource parts have
        equal hash values.  In combination with the comparison defined on JIDs,
        this allows for using L{JID}s in sets and as dictionary keys.
        )Úhashr   r   r   r2   s    r   Ú__hash__zJID.__hash__æ   s   € õ �T”Y ¤	¨4¬=Ð9Ñ:Ô:Ð:r   c                 ó*   — |                       ¦   «         S )zŽ
        Get unicode representation.

        Return the string representation of this JID as a unicode string.
        @see: L{full}
        ©r7   r2   s    r   Ú__unicode__zJID.__unicode__ð   s   € ð �yŠy‰{Œ{Ðr   c                 ó0   — d|                       ¦   «         z  S )z’
        Get object representation.

        Returns a string that would create a new JID object that compares equal
        to this one.
        zJID(%r)rA   r2   s    r   Ú__repr__zJID.__repr__ü   s   € ð ˜4Ÿ9š9™;œ;Ñ&Ð&r   )NN)r   r   r   r   r   r#   r   r0   r3   r5   r7   ÚobjectÚboolr<   r?   rB   Ú__str__rD   r   r   r   r%   r%   Š   s  € € € € € ðð ð !%ØMQðð à�3˜�9Ôðð �U˜5  d Ô+¨S°%¸¸T¸	Ô2BÐBÔCÀTÐIÔJðð ð ð ð$ð ð ðð ð ð$!ð !ð !ð""˜Fð " tð "ð "ð "ð "ð";ð ;ð ;ðð ð ð €Gð'˜#ð 'ð 'ð 'ð 'ð 'ð 'r   )r   Útypingr   r   r   Ú.twisted.words.protocols.jabber.xmpp_stringprepr   r   r   Ú	Exceptionr
   r#   r    r   r&   Ú__annotations__r)   r%   r   r   r   ú<module>rL      sœ  ððð ð ð &Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ð %ðð ð ð ð ð ð ð ð ð ðð ð ð ð �Iñ ô ð ð,&�Sð ,&˜U 5¨¨d¨Ô#3°S¸%ÀÀTÀ	Ô:JÐ#JÔKð ,&ð ,&ð ,&ð ,&ð^("Ø
��T�	Ô
ð("Ø"%ð("Ø16°s¸D°yÔ1Að("à
ˆ5��d�Ô˜S %¨¨T¨	Ô"2Ð2Ô3ð("ð ("ð ("ð ("ðV "$€ˆd�3˜�:ÔÐ #Ð #Ñ #ðð ð ðy'ð y'ð y'ð y'ð y'ñ y'ô y'ð y'ð y'ð y'r   