
    /_i3<                         d dl mZ d dlmZ d dlmZ  G d de      Z G d de      Zd Z G d	 d
      Z	 G d d      Z
 G d d      Z G d d      Zy)    )Enum)Any)command_builderc                       e Zd ZdZdZdZy)ScreenOrientationNaturalzNatural screen orientation.portrait	landscapeN)__name__
__module____qualname____doc__PORTRAIT	LANDSCAPE     g/var/www/html/land_sniper/venv/lib/python3.12/site-packages/selenium/webdriver/common/bidi/emulation.pyr   r      s    %HIr   r   c                        e Zd ZdZdZdZdZdZy)ScreenOrientationTypezScreen orientation type.zportrait-primaryzportrait-secondaryzlandscape-primaryzlandscape-secondaryN)r
   r   r   r   PORTRAIT_PRIMARYPORTRAIT_SECONDARYLANDSCAPE_PRIMARYLANDSCAPE_SECONDARYr   r   r   r   r      s    ")-+/r   r   c                     t        | |      r| S 	  || j                               S # t        $ r t        d|        w xY w)NzInvalid orientation: )
isinstancelower
ValueError)value
enum_classs     r   _convert_to_enumr   (   sI    %$:%++-(( :0899:s   & >c                   B    e Zd ZdZdeez  deez  fdZdeeef   fdZ	y)ScreenOrientationz,Represents screen orientation configuration.naturaltypec                 X    t        |t              | _        t        |t              | _        y)ag  Initialize ScreenOrientation.

        Args:
            natural: Natural screen orientation ("portrait" or "landscape").
            type: Screen orientation type ("portrait-primary", "portrait-secondary",
                "landscape-primary", or "landscape-secondary").

        Raises:
            ValueError: If natural or type values are invalid.
        N)r   r   r"   r   r#   )selfr"   r#   s      r   __init__zScreenOrientation.__init__4   s"      (1IJ$T+@A	r   returnc                 \    | j                   j                  | j                  j                  dS )N)r"   r#   )r"   r   r#   r%   s    r   to_dictzScreenOrientation.to_dictG   s$    ||))IIOO
 	
r   N)
r
   r   r   r   r   strr   r&   dictr*   r   r   r   r!   r!   1   s=    6B)C/B $c)B&
c3h 
r   r!   c                      e Zd ZdZ	 	 	 	 	 ddededededz  dedz  dedz  d	edz  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dz  f   fdZy)GeolocationCoordinatesz#Represents geolocation coordinates.Nlatitude	longitudeaccuracyaltitudealtitude_accuracyheadingspeedc                 f    || _         || _        || _        || _        || _        || _        || _        y)a  Initialize GeolocationCoordinates.

        Args:
            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/   r0   r1   r2   r3   r4   r5   )r%   r/   r0   r1   r2   r3   r4   r5   s           r   r&   zGeolocationCoordinates.__init__Q   s6    0 !"  !2
r   c                     | j                   S N)	_latituder)   s    r   r/   zGeolocationCoordinates.latitudeq       ~~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)r   r:   r%   r   s     r   r/   zGeolocationCoordinates.latitudeu   s3    &$&FGG 'FGGr   c                     | j                   S r9   )
_longituder)   s    r   r0   z GeolocationCoordinates.longitude{   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   r0   z GeolocationCoordinates.longitude   s3    %(5(IJJ )IJJr   c                     | j                   S r9   )	_accuracyr)   s    r   r1   zGeolocationCoordinates.accuracy   r;   r   c                 2    |dk  rt        d      || _        y )N        zaccuracy must be >= 0.0)r   rB   r=   s     r   r1   zGeolocationCoordinates.accuracy   s    3;677r   c                     | j                   S r9   	_altituder)   s    r   r2   zGeolocationCoordinates.altitude   r;   r   c                     || _         y r9   rF   r=   s     r   r2   zGeolocationCoordinates.altitude   s	    r   c                     | j                   S r9   )_altitude_accuracyr)   s    r   r3   z(GeolocationCoordinates.altitude_accuracy   s    &&&r   c                 h    || j                   t        d      ||dk  rt        d      || _        y )Nz0altitude_accuracy cannot be set without altituderD   z altitude_accuracy must be >= 0.0)r2   r   rJ   r=   s     r   r3   z(GeolocationCoordinates.altitude_accuracy   s=    !6OPP?@@"'r   c                     | j                   S r9   )_headingr)   s    r   r4   zGeolocationCoordinates.heading   s    }}r   c                 Z    |"d|cxk  rdk  st        d       t        d      || _        y )NrD   g     v@z%heading must be between 0.0 and 360.0)r   rM   r=   s     r   r4   zGeolocationCoordinates.heading   s8    cU&:U&:DEE ';DEEr   c                     | j                   S r9   )_speedr)   s    r   r5   zGeolocationCoordinates.speed   s    {{r   c                 6    ||dk  rt        d      || _        y )NrD   zspeed must be >= 0.0)r   rP   r=   s     r   r5   zGeolocationCoordinates.speed   s!    344r   r'   c                 &   | j                   | j                  | j                  d}| j                  | j                  |d<   | j                  | j                  |d<   | j
                  | j
                  |d<   | j                  | j                  |d<   |S )N)r/   r0   r1   r2   altitudeAccuracyr4   r5   r7   )r%   results     r   r*   zGeolocationCoordinates.to_dict   s    +
 ==$!%F:!!-)-)?)?F%&<<# $F9::!"jjF7Or   )g      ?NNNN)r
   r   r   r   floatr&   propertyr/   setterr0   r1   r2   r3   r4   r5   r,   r+   r*   r   r   r   r.   r.   N   s   - !%*. $"  	
 $, !4<  t|@   __ 
      
   __ 
   __  ' ' ( (   ^^ 
   \\ 
c54</0 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.positionUnavailabler#   c                 b    || j                   k7  rt        d| j                    d      || _        y )Nztype must be "")TYPE_POSITION_UNAVAILABLEr   r#   )r%   r#   s     r   r&   z!GeolocationPositionError.__init__   s2    4111~d.L.L-MQOPP	r   r'   c                     d| j                   iS )Nr#   )r#   r)   s    r   r*   z GeolocationPositionError.to_dict   s    		""r   N)	r
   r   r   r   r]   r+   r&   r,   r*   r   r   r   rY   rY      s.    2 5#< S 
#c3h #r   rY   c                      e Zd ZdZd Z	 	 	 	 ddedz  dedz  dee   dz  dee   dz  ddf
d	Z		 	 	 dd
edz  dee   dz  dee   dz  ddfdZ
	 	 	 ddedz  dee   dz  dee   dz  ddfdZ	 	 	 ddedz  dee   dz  dee   dz  ddfdZ	 	 	 ddedz  dee   dz  dee   dz  ddfdZ	 	 	 ddedz  dee   dz  dee   dz  ddfdZy)	Emulationz,BiDi implementation of the emulation module.c                     || _         y r9   )conn)r%   rb   s     r   r&   zEmulation.__init__   s	    	r   Ncoordinateserrorcontextsuser_contextsr'   c                     ||t        d      ||t        d      ||t        d      i }||j                         |d<   n||j                         |d<   |||d<   n|||d<   | j                  j                  t	        d	|             y)
aT  Set geolocation override for the given contexts or user contexts.

        Args:
            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 error-Cannot specify both contexts and userContexts,Must specify either contexts or userContextsrc   rd   re   userContextsz emulation.setGeolocationOverrider   r*   rb   executer   )r%   rc   rd   re   rf   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)a   Set timezone override for the given contexts or user contexts.

        Args:
            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.
        N.Cannot specify both contexts and user_contexts-Must specify either contexts or user_contextsro   re   rj   zemulation.setTimezoneOverrider   rb   rl   r   )r%   ro   re   rf   rm   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   localec                     ||t        d      ||t        d      d|i}|||d<   n|||d<   | j                  j                  t        d|             y)a  Set locale override for the given contexts or user contexts.

        Args:
            locale: Locale string as per BCP 47, or None to clear 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, or if locale is invalid.
        Nrh   ri   ru   re   rj   zemulation.setLocaleOverriders   )r%   ru   re   rf   rm   s        r   set_locale_overridezEmulation.set_locale_override-  sv    " M$=LMM 5KLL"*F!3!)F:&%2F>"		/*GPQr   enabledc                     |rt        d      ||t        d      ||t        d      d|i}|||d<   n|||d<   | j                  j                  t        d|             y)	aI  Set scripting enabled override for the given contexts or user contexts.

        Args:
            enabled: False to disable scripting, None to clear the override.
                Note: Only emulation of disabled JavaScript is supported.
            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, or if enabled is True.
        zROnly emulation of disabled JavaScript is supported (enabled must be False or None)Nrh   ri   rx   re   rj   zemulation.setScriptingEnabledrs   )r%   rx   re   rf   rm   s        r   set_scripting_enabledzEmulation.set_scripting_enabledM  s    $ qrrM$=LMM 5KLL"+W!5!)F:&%2F>"		/*I6RSr   screen_orientationc                     ||t        d      ||t        d      d||j                         ndi}|||d<   n|||d<   | j                  j                  t	        d|             y)a   Set screen orientation override for the given contexts or user contexts.

        Args:
            screen_orientation: ScreenOrientation object to emulate, 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.
        Nrh   ri   screenOrientationre   rj   z&emulation.setScreenOrientationOverriderk   )r%   r{   re   rf   rm   s        r   set_screen_orientation_overridez)Emulation.set_screen_orientation_overrideq  s    " M$=LMM 5KLL  ASA_!3!;!;!=ei"
 !)F:&%2F>"		/*RTZ[\r   
user_agentc                     ||t        d      ||t        d      d|i}|||d<   n|||d<   | j                  j                  t        d|             y)a  Set user agent override for the given contexts or user contexts.

        Args:
            user_agent: User agent string to emulate, 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.
        Nrq   rr   	userAgentre   rj   zemulation.setUserAgentOverriders   )r%   r   re   rf   rm   s        r   set_user_agent_overridez!Emulation.set_user_agent_override  sv    " M$=MNN 5LMM"-z!:!)F:&%2F>"		/*JFSTr   )NNNN)NNN)FNN)r
   r   r   r   r&   r.   rY   listr+   rn   rt   rw   boolrz   r!   r~   r   r   r   r   r`   r`      s
   6
 6:15%)*.)W+d2)W ($.)W s)d"	)W
 Cy4')W 
)WZ  $%)*.	T*T s)d"T Cy4'	T
 
TF "%)*.	Rd
R s)d"R Cy4'	R
 
RD  %%)*.	"T"T s)d""T Cy4'	"T
 
"TL 8<%)*.	 ]-4 ] s)d" ] Cy4'	 ]
 
 ]H "&%)*.	U$JU s)d"U Cy4'	U
 
Ur   r`   N)enumr   typingr   %selenium.webdriver.common.bidi.commonr   r   r   r   r!   r.   rY   r`   r   r   r   <module>r      s\   $   At 0D 0:
 
:| |~# #VU VUr   