
    ,i~!                     `    d dl mZmZmZ d dlmZ  G d d      Z G d d      Z G d d      Zy	)
    )AnyOptionalUnion)command_builderc                      e Zd ZdZ	 	 	 	 	 ddedededee   dee   dee   d	ee   fd
Zed        Zej                  d        Zed        Z
e
j                  d        Z
ed        Zej                  d        Zed        Zej                  d        Zed        Zej                  d        Zed        Zej                  d        Zed        Zej                  d        Zdeeeedf   f   fdZy)GeolocationCoordinatesz#Represents geolocation coordinates.Nlatitude	longitudeaccuracyaltitudealtitude_accuracyheadingspeedc                 f    || _         || _        || _        || _        || _        || _        || _        y)a  Initialize GeolocationCoordinates.

        Parameters:
        -----------
            latitude: Latitude coordinate (-90.0 to 90.0).
            longitude: Longitude coordinate (-180.0 to 180.0).
            accuracy: Accuracy in meters (>= 0.0), defaults to 1.0.
            altitude: Altitude in meters or None, defaults to None.
            altitude_accuracy: Altitude accuracy in meters (>= 0.0) or None, defaults to None.
            heading: Heading in degrees (0.0 to 360.0) or None, defaults to None.
            speed: Speed in meters per second (>= 0.0) or None, defaults to None.

        Raises:
        ------
            ValueError: If coordinates are out of valid range or if altitude_accuracy is provided without altitude.
        Nr	   r
   r   r   r   r   r   )selfr	   r
   r   r   r   r   r   s           w/var/www/system.tvplus.app.br/jogos/scrap/venv/lib/python3.12/site-packages/selenium/webdriver/common/bidi/emulation.py__init__zGeolocationCoordinates.__init__   s6    4 !"  !2
    c                     | j                   S N)	_latituder   s    r   r	   zGeolocationCoordinates.latitude<       ~~r   c                 V    d|cxk  rdk  st        d       t        d      || _        y )Ng     Vg     V@z'latitude must be between -90.0 and 90.0)
ValueErrorr   r   values     r   r	   zGeolocationCoordinates.latitude@   s3    &$&FGG 'FGGr   c                     | j                   S r   )
_longituder   s    r   r
   z GeolocationCoordinates.longitudeF   s    r   c                 V    d|cxk  rdk  st        d       t        d      || _        y )Ng     fg     f@z*longitude must be between -180.0 and 180.0)r   r    r   s     r   r
   z GeolocationCoordinates.longitudeJ   s3    %(5(IJJ )IJJr   c                     | j                   S r   )	_accuracyr   s    r   r   zGeolocationCoordinates.accuracyP   r   r   c                 2    |dk  rt        d      || _        y )N        zaccuracy must be >= 0.0)r   r#   r   s     r   r   zGeolocationCoordinates.accuracyT   s    3;677r   c                     | j                   S r   	_altituder   s    r   r   zGeolocationCoordinates.altitudeZ   r   r   c                     || _         y r   r'   r   s     r   r   zGeolocationCoordinates.altitude^   s	    r   c                     | j                   S r   )_altitude_accuracyr   s    r   r   z(GeolocationCoordinates.altitude_accuracyb   s    &&&r   c                 h    || j                   t        d      ||dk  rt        d      || _        y )Nz0altitude_accuracy cannot be set without altituder%   z altitude_accuracy must be >= 0.0)r   r   r+   r   s     r   r   z(GeolocationCoordinates.altitude_accuracyf   s=    !6OPP?@@"'r   c                     | j                   S r   )_headingr   s    r   r   zGeolocationCoordinates.headingn   s    }}r   c                 Z    |"d|cxk  rdk  st        d       t        d      || _        y )Nr%   g     v@z%heading must be between 0.0 and 360.0)r   r.   r   s     r   r   zGeolocationCoordinates.headingr   s8    cU&:U&:DEE ';DEEr   c                     | j                   S r   )_speedr   s    r   r   zGeolocationCoordinates.speedx   s    {{r   c                 6    ||dk  rt        d      || _        y )Nr%   zspeed must be >= 0.0)r   r1   r   s     r   r   zGeolocationCoordinates.speed|   s!    344r   returnc                 &   | j                   | j                  | j                  d}| j                  | j                  |d<   | j                  | j                  |d<   | j
                  | j
                  |d<   | j                  | j                  |d<   |S )N)r	   r
   r   r   altitudeAccuracyr   r   r   )r   results     r   to_dictzGeolocationCoordinates.to_dict   s    1
 ==$!%F:!!-)-)?)?F%&<<# $F9::!"jjF7Or   )g      ?NNNN)__name__
__module____qualname____doc__floatr   r   propertyr	   setterr
   r   r   r   r   r   dictstrr   r7    r   r   r   r      s   - $(-1#'!%     	 
 5/  $E?  %   D   __ 
      
   __ 
   __  ' ' ( (   ^^ 
   \\ 
c5#556 r   r   c                   :    e Zd ZdZdZefdefdZdeeef   fdZy)GeolocationPositionErrorz(Represents a geolocation position error.positionUnavailabletypec                 b    || j                   k7  rt        d| j                    d      || _        y )Nztype must be "")TYPE_POSITION_UNAVAILABLEr   rE   )r   rE   s     r   r   z!GeolocationPositionError.__init__   s2    4111~d.L.L-MQOPP	r   r3   c                     d| j                   iS )NrE   )rE   r   s    r   r7   z GeolocationPositionError.to_dict   s    		""r   N)	r8   r9   r:   r;   rH   r@   r   r?   r7   rA   r   r   rC   rC      s.    2 5#< S 
#c3h #r   rC   c                       e Zd ZdZd Z	 	 	 	 ddee   dee   deee	      deee	      ddf
d	Z
	 	 	 dd
ee	   deee	      deee	      ddfdZy)	Emulationz6
    BiDi implementation of the emulation module.
    c                     || _         y r   )conn)r   rM   s     r   r   zEmulation.__init__   s	    	r   Ncoordinateserrorcontextsuser_contextsr3   c                     ||t        d      ||t        d      ||t        d      i }||j                         |d<   n||j                         |d<   |||d<   n|||d<   | j                  j                  t	        d	|             y)
a  Set geolocation override for the given contexts or user contexts.

        Parameters:
        -----------
            coordinates: Geolocation coordinates to emulate, or None.
            error: Geolocation error to emulate, or None.
            contexts: List of browsing context IDs to apply the override to.
            user_contexts: List of user context IDs to apply the override to.

        Raises:
        ------
            ValueError: If both coordinates and error are provided, or if both contexts
                       and user_contexts are provided, or if neither contexts nor
                       user_contexts are provided.
        Nz)Cannot specify both coordinates and errorz-Cannot specify both contexts and userContextsz,Must specify either contexts or userContextsrN   rO   rP   userContextsz emulation.setGeolocationOverride)r   r7   rM   executer   )r   rN   rO   rP   rQ   paramss         r   set_geolocation_overridez"Emulation.set_geolocation_override   s    , "u'8HIIM$=LMM 5KLL!#"$/$7$7$9F=!#mmoF7O!)F:&%2F>"		/*LfUVr   timezonec                     ||t        d      ||t        d      d|i}|||d<   n|||d<   | j                  j                  t        d|             y)aU  Set timezone override for the given contexts or user contexts.

        Parameters:
        -----------
            timezone: Timezone identifier (IANA timezone name or offset string like '+01:00'),
                     or None to clear the override.
            contexts: List of browsing context IDs to apply the override to.
            user_contexts: List of user context IDs to apply the override to.

        Raises:
        ------
            ValueError: If both contexts and user_contexts are provided, or if neither
                       contexts nor user_contexts are provided.
        Nz.Cannot specify both contexts and user_contextsz-Must specify either contexts or user_contextsrW   rP   rS   zemulation.setTimezoneOverride)r   rM   rT   r   )r   rW   rP   rQ   rU   s        r   set_timezone_overridezEmulation.set_timezone_override   sv    ( M$=MNN 5LMM",h!7!)F:&%2F>"		/*I6RSr   )NNNN)NNN)r8   r9   r:   r;   r   r   r   rC   listr@   rV   rY   rA   r   r   rK   rK      s    
 9=48(,-1+W45+W 01+W 49%	+W
  S	*+W 
+W^ #'(,-1	!T3-!T 49%!T  S	*	!T
 
!Tr   rK   N)	typingr   r   r   %selenium.webdriver.common.bidi.commonr   r   rC   rK   rA   r   r   <module>r]      s5   $ ( ' A~ ~B# #VT VTr   