Ë
    ÖÉ�jß  ã            	       óh   — d dl Z d dlZd dlmZ dedededefd„Z	 ddeded	edefd
„Z G d„ d«      Zy)é    N)ÚOptionalÚcandidate_typeÚcandidate_transportÚbase_addressÚreturnc                 óz   — | ›d|›d|›�}t        j                  |j                  d«      «      j                  «       S )z7
    See RFC 5245 - 4.1.1.3. Computing Foundations
    ú|Úascii)ÚhashlibÚmd5ÚencodeÚ	hexdigest)r   r   r   Úkeys       úQ/home/uftp/webrtc-recorder/.venv/lib/python3.12/site-packages/aioice/candidate.pyÚcandidate_foundationr      s2   € ò 'Ò(;¹\Ð
J€CÜ�;‰;�s—z‘z 'Ó*Ó+×5Ñ5Ó7Ð7ó    Úcandidate_componentÚ
local_prefc                 óX   — |dk(  rd}n|dk(  rd}n
|dk(  rd}nd}d|z  d	|z  z   d	| z
  z   S )
z5
    See RFC 5245 - 4.1.2.1. Recommended Formula
    Úhosté~   Úprflxén   Úsrflxéd   r   i   é   © )r   r   r   Ú	type_prefs       r   Úcandidate_priorityr      sP   € ð ˜ÒØ‰	Ø	˜7Ò	"Ø‰	Ø	˜7Ò	"Ø‰	àˆ	à�yÑ  F¨jÑ#8Ñ8¸CÐBUÑ<UÑVÐVr   c                   ó¬   — e Zd ZdZ	 	 	 	 ddedededededed	ed
ee   dee   dee   dee   ddfd„Zededd fd„«       Z	defd„Z
dd defd„Zdefd„Zy)Ú	Candidatez
    An ICE candidate.
    NÚ
foundationÚ	componentÚ	transportÚpriorityr   ÚportÚtypeÚrelated_addressÚrelated_portÚtcptypeÚ
generationr   c                 óž   — || _         || _        || _        || _        || _        || _        || _        || _        |	| _        |
| _	        || _
        y )N©r"   r#   r$   r%   r   r&   r'   r(   r)   r*   r+   )Úselfr"   r#   r$   r%   r   r&   r'   r(   r)   r*   r+   s               r   Ú__init__zCandidate.__init__'   sS   € ð %ˆŒØ"ˆŒØ"ˆŒØ ˆŒØˆŒ	ØˆŒ	ØˆŒ	Ø.ˆÔØ(ˆÔØˆŒØ$ˆ�r   Úsdpc                 óØ  — |j                  «       }t        |«      dk  rt        d«      ‚d}d}d}d}t        dt        |«      dz
  d«      D ]X  }||   dk(  r	||dz      }Œ||   dk(  rt	        ||dz      «      }Œ.||   dk(  r	||dz      }Œ?||   d	k(  sŒHt	        ||dz      «      }ŒZ t        |d
   t	        |d   «      |d   t	        |d   «      |d   t	        |d   «      |d   ||||¬«      S )zÁ
        Parse a :class:`Candidate` from SDP.

        .. code-block:: python

           Candidate.from_sdp(
            '6815297761 1 udp 659136 1.2.3.4 31102 typ host generation 0')
        é   z#SDP does not have enough propertiesNé   é   ÚraddrÚrportr*   r+   r   é   é   é   é   r-   )ÚsplitÚlenÚ
ValueErrorÚrangeÚintr!   )Úclsr0   Úbitsr(   r)   r*   r+   Úis           r   Úfrom_sdpzCandidate.from_sdpA   s   € ð �y‰y‹{ˆÜˆt‹9�qŠ=ÜÐBÓCÐCà)-ˆØ&*ˆØ!%ˆØ$(ˆ
Ü�qœ#˜d›) a™-¨Ó+ò 	.ˆAØ�A‰w˜'Ò!Ø"& q¨1¡u¡+‘Ø�a‘˜GÒ#Ü" 4¨¨A©¡;Ó/‘Ø�a‘˜IÒ%Ø˜q 1™u™+‘Ø�a‘˜LÓ(Ü   a¨!¡e¡Ó-‘
ð	.ô Ø˜A‘wÜ˜$˜q™'“lØ˜1‘gÜ˜˜a™“\Ø�a‘Ü�T˜!‘W“Ø�a‘Ø+Ø%ØØ!ô
ð 	
r   c                 óš  — d| j                   | j                  | j                  | j                  | j                  | j
                  | j                  fz  }| j                  �|d| j                  z  z  }| j                  �|d| j                  z  z  }| j                  �|d| j                  z  z  }| j                  �|d| j                  z  z  }|S )zB
        Return a string representation suitable for SDP.
        z%s %d %s %d %s %d typ %sz	 raddr %sz	 rport %sz tcptype %sz generation %dr-   )r.   r0   s     r   Úto_sdpzCandidate.to_sdpk   sÈ   € ð )Ø�O‰OØ�N‰NØ�N‰NØ�M‰MØ�I‰IØ�I‰IØ�I‰Ið,
ñ 
ˆð ×ÑÐ+Ø�; ×!5Ñ!5Ñ5Ñ5ˆCØ×ÑÐ(Ø�; ×!2Ñ!2Ñ2Ñ2ˆCØ�<‰<Ð#Ø�= 4§<¡<Ñ/Ñ/ˆCØ�?‰?Ð&ØÐ# d§o¡oÑ5Ñ5ˆCØˆ
r   Úotherc                 óT  — t        j                  | j                  «      }t        j                  |j                  «      }| j                  |j                  k(  xrP | j                  j                  «       |j                  j                  «       k(  xr |j                  |j                  k(  S )z¸
        A local candidate is paired with a remote candidate if and only if
        the two candidates have the same component ID and have the same IP
        address version.
        )Ú	ipaddressÚ
ip_addressr   r#   r$   ÚlowerÚversion)r.   rF   ÚaÚbs       r   Úcan_pair_withzCandidate.can_pair_with‚   s}   € ô × Ñ  §¡Ó+ˆÜ× Ñ  §¡Ó,ˆà�N‰N˜eŸo™oÑ-ò 'Ø—‘×$Ñ$Ó&¨%¯/©/×*?Ñ*?Ó*AÑAò'à—	‘	˜QŸY™YÑ&ð	
r   c                 ó(   — d| j                  «       z  S )NzCandidate(%s))rE   )r.   s    r   Ú__repr__zCandidate.__repr__�   s   € Ø §¡£Ñ.Ð.r   )NNNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr?   r   r/   ÚclassmethodrC   rE   ÚboolrN   rP   r   r   r   r!   r!   "   sî   „ ñð *.Ø&*Ø!%Ø$(ñ%àð%ð ð%ð ð	%ð
 ð%ð ð%ð ð%ð ð%ð " #™ð%ð ˜s‘mð%ð ˜#‘ð%ð ˜S‘Mð%ð 
ó%ð4 ð'
˜3ð '
 ;ò '
ó ð'
ðR˜ó ð.
 ;ð 
°4ó 
ð/˜#ô /r   r!   )iÿÿ  )	r   rH   Útypingr   rU   r   r?   r   r!   r   r   r   ú<module>rY      sp   ðÛ Û Ý ð8Øð8Ø.1ð8ØADð8àó8ð FKñWØðWØ.1ðWØ?BðWàóW÷$o/ò o/r   