o
    M,h                     @  s  d dl mZ ddlmZmZ d dlmZ d dlZd dlZddl	m
Z
 ddl	mZ ddl	mZ eG d	d
 d
ZeG dd dZeG dd dZeG dd dZeG dd dZG dd dejZeG dd dZeG dd dZG dd dejZeG dd dZeG dd dZeG dd  d ZeG d!d" d"ZeG d#d$ d$ZG d%d& d&ejZG d'd( d(ejZeG d)d* d*ZG d+d, d,ejZdd/d0Z dd2d3Z!dd4d5Z"dd6d7Z#dd:d;Z$	ddd=d>Z%ddAdBZ&	dddEdFZ'ddHdIZ(										ddd_d`Z)ddbdcZ*ddddeZ+ddhdiZ,ddjdkZ-ddmdnZ.ddpdqZ/	dddtduZ0		dddxdyZ1dd|d}Z2	ddd~dZ3							ddddZ4dddZ5	ddddZ6dddZ7	ddddZ8dddZ9	ddddZ:dddZ;dddZ<dddZ=dddZ>dddZ?	ddddZ@			ddddZA	ddddZBdddZCdddZDdddZEdddĄZF			ddddʄZGddd̄ZHdddτZIedЃeG dd҄ d҃ZJdS )    )annotations   )event_classT_JSON_DICT)	dataclassN)dom)network)pagec                   @  s   e Zd ZU dZded< dZded< dZded< dZded< dZded< dZ	ded< dZ
ded	< dZded
< dd Zedd ZdS )SafeAreaInsetsNtyping.Optional[int]toptop_maxleftleft_maxbottom
bottom_maxright	right_maxc                 C  s   t  }| jd ur| j|d< | jd ur| j|d< | jd ur!| j|d< | jd ur+| j|d< | jd ur5| j|d< | jd ur?| j|d< | jd urI| j|d< | jd urS| j|d< |S )	Nr   topMaxr   leftMaxr   	bottomMaxr   rightMax)	dictr   r   r   r   r   r   r   r   selfjson r   }/var/www/www-root/data/www/bot.pdev.uz/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v139/emulation.pyto_json+   s$   















zSafeAreaInsets.to_jsonc                 C  s   | d|v rt |d nd d|v rt |d nd d|v r!t |d nd d|v r,t |d nd d|v r7t |d nd d|v rBt |d nd d|v rMt |d nd d|v rZt |d d	S d d	S )
Nr   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )intclsr   r   r   r   	from_json?   s   zSafeAreaInsets.from_json)__name__
__module____qualname__r   __annotations__r   r   r   r   r   r   r   r   classmethodr"   r   r   r   r   r
      s   
 r
   c                   @  s6   e Zd ZU dZded< ded< dd Zedd	 Zd
S )ScreenOrientationz
    Screen orientation.
    strtype_r   anglec                 C     t  }| j|d< | j|d< |S )Ntyper+   )r   r*   r+   r   r   r   r   r   X      

zScreenOrientation.to_jsonc                 C  s   | t |d t|d dS )Nr-   r+   )r*   r+   r)   r   r    r   r   r   r"   ^      

zScreenOrientation.from_jsonNr#   r$   r%   __doc__r&   r   r'   r"   r   r   r   r   r(   M   s   
 r(   c                   @  s:   e Zd ZU ded< ded< ded< dd Zedd	 Zd
S )DisplayFeaturer)   orientationr   offsetmask_lengthc                 C  (   t  }| j|d< | j|d< | j|d< |S )Nr4   r5   
maskLength)r   r4   r5   r6   r   r   r   r   r   t   
   


zDisplayFeature.to_jsonc                 C  s&   | t |d t|d t|d dS )Nr4   r5   r8   )r4   r5   r6   r/   r    r   r   r   r"   {   
   


zDisplayFeature.from_jsonNr#   r$   r%   r&   r   r'   r"   r   r   r   r   r3   f   s   
 r3   c                   @  *   e Zd ZU ded< dd Zedd ZdS )DevicePosturer)   r*   c                 C     t  }| j|d< |S )Nr-   )r   r*   r   r   r   r   r         
zDevicePosture.to_jsonc                 C     | t |d dS )Nr-   )r*   r)   r    r   r   r   r"         
zDevicePosture.from_jsonNr;   r   r   r   r   r=      s
   
 r=   c                   @  s2   e Zd ZU ded< ded< dd Zedd ZdS )	MediaFeaturer)   namevaluec                 C  r,   )NrD   rE   )r   rD   rE   r   r   r   r   r      r.   zMediaFeature.to_jsonc                 C     | t |d t |d dS )NrD   rE   )rD   rE   rA   r    r   r   r   r"      r0   zMediaFeature.from_jsonNr;   r   r   r   r   rC      s   
 rC   c                   @  0   e Zd ZdZdZdZdZdd Zedd Z	d	S )
VirtualTimePolicya?  
    advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to
    allow the next delayed task (if any) to run; pause: The virtual time base may not advance;
    pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending
    resource fetches.
    advancepausepauseIfNetworkFetchesPendingc                 C     | j S NrE   r   r   r   r   r         zVirtualTimePolicy.to_jsonc                 C     | |S rM   r   r    r   r   r   r"         zVirtualTimePolicy.from_jsonN)
r#   r$   r%   r2   ADVANCEPAUSE PAUSE_IF_NETWORK_FETCHES_PENDINGr   r'   r"   r   r   r   r   rH      s    rH   c                   @  s6   e Zd ZU dZded< ded< dd Zedd Zd	S )
UserAgentBrandVersionzh
    Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
    r)   brandversionc                 C  r,   )NrW   rX   )r   rW   rX   r   r   r   r   r      r.   zUserAgentBrandVersion.to_jsonc                 C  rF   )NrW   rX   )rW   rX   rA   r    r   r   r   r"      r0   zUserAgentBrandVersion.from_jsonNr1   r   r   r   r   rV      s   
 rV   c                   @  s   e Zd ZU dZded< ded< ded< ded< ded< d	Zd
ed< d	Zd
ed< d	Zded< d	Zded< d	Z	ded< d	Z
ded< dd Zedd Zd	S )UserAgentMetadataz
    Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
    Missing optional values will be filled in by the target with what it would normally use.
    r)   platformplatform_versionarchitecturemodelboolmobileNz3typing.Optional[typing.List[UserAgentBrandVersion]]brandsfull_version_listtyping.Optional[str]full_versionbitnesstyping.Optional[bool]wow64z!typing.Optional[typing.List[str]]form_factorsc                 C  s   t  }| j|d< | j|d< | j|d< | j|d< | j|d< | jd ur+dd | jD |d< | jd ur:d	d | jD |d
< | jd urD| j|d< | j	d urN| j	|d< | j
d urX| j
|d< | jd urgdd | jD |d< |S )NrZ   platformVersionr\   r]   r_   c                 S     g | ]}|  qS r   r   .0ir   r   r   
<listcomp>       z-UserAgentMetadata.to_json.<locals>.<listcomp>r`   c                 S  ri   r   rj   rk   r   r   r   rn      ro   fullVersionListfullVersionrd   rf   c                 S  s   g | ]}|qS r   r   rk   r   r   r   rn     s    formFactors)r   rZ   r[   r\   r]   r_   r`   ra   rc   rd   rf   rg   r   r   r   r   r      s&   













zUserAgentMetadata.to_jsonc                 C  s   | t |d t |d t |d t |d t|d d|v r'dd |d D nd d	|v r5d
d |d	 D nd d|v r@t |d nd d|v rKt |d nd d|v rVt|d nd d|v rfdd |d D dS d dS )NrZ   rh   r\   r]   r_   r`   c                 S     g | ]}t |qS r   rV   r"   rk   r   r   r   rn         z/UserAgentMetadata.from_json.<locals>.<listcomp>rp   c                 S  rs   r   rt   rk   r   r   r   rn     ru   rq   rd   rf   rr   c                 S  s   g | ]}t |qS r   rA   rk   r   r   r   rn     ro   )rZ   r[   r\   r]   r_   r`   ra   rc   rd   rf   rg   )r)   r^   r    r   r   r   r"     s   




zUserAgentMetadata.from_json)r#   r$   r%   r2   r&   r`   ra   rc   rd   rf   rg   r   r'   r"   r   r   r   r   rY      s    
 rY   c                   @  sD   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
d Zedd ZdS )
SensorTypezz
    Used to specify sensor types to emulate.
    See https://w3c.github.io/sensors/#automation for more information.
    zabsolute-orientationaccelerometerzambient-lightgravity	gyroscopezlinear-accelerationmagnetometerzrelative-orientationc                 C  rL   rM   rN   rO   r   r   r   r   '  rP   zSensorType.to_jsonc                 C  rQ   rM   r   r    r   r   r   r"   *  rR   zSensorType.from_jsonN)r#   r$   r%   r2   ABSOLUTE_ORIENTATIONACCELEROMETERAMBIENT_LIGHTGRAVITY	GYROSCOPELINEAR_ACCELERATIONMAGNETOMETERRELATIVE_ORIENTATIONr   r'   r"   r   r   r   r   rv     s    rv   c                   @  sF   e Zd ZU dZded< dZded< dZded< dd Zed	d
 Z	dS )SensorMetadataNre   	availabletyping.Optional[float]minimum_frequencymaximum_frequencyc                 C  sF   t  }| jd ur| j|d< | jd ur| j|d< | jd ur!| j|d< |S )Nr   minimumFrequencymaximumFrequency)r   r   r   r   r   r   r   r   r   7  s   





zSensorMetadata.to_jsonc                 C  sN   | d|v rt |d nd d|v rt|d nd d|v r#t|d dS d dS )Nr   r   r   )r   r   r   )r^   floatr    r   r   r   r"   A  s   zSensorMetadata.from_json)
r#   r$   r%   r   r&   r   r   r   r'   r"   r   r   r   r   r   /     
 
r   c                   @  r<   )SensorReadingSingler   rE   c                 C  r>   )NrE   )r   rE   r   r   r   r   r   N  r?   zSensorReadingSingle.to_jsonc                 C  r@   )NrE   rN   r   r    r   r   r   r"   S  rB   zSensorReadingSingle.from_jsonNr;   r   r   r   r   r   J  s
   
 r   c                   @  s:   e Zd ZU ded< ded< ded< dd Zedd Zd	S )
SensorReadingXYZr   xyzc                 C  r7   )Nr   r   r   )r   r   r   r   r   r   r   r   r   b  r9   zSensorReadingXYZ.to_jsonc                 C  s&   | t |d t |d t |d dS )Nr   r   r   )r   r   r   r   r    r   r   r   r"   i  r:   zSensorReadingXYZ.from_jsonNr;   r   r   r   r   r   Z  s   
 r   c                   @  sB   e Zd ZU ded< ded< ded< ded< dd Zedd	 Zd
S )SensorReadingQuaternionr   r   r   r   wc                 C  s2   t  }| j|d< | j|d< | j|d< | j|d< |S )Nr   r   r   r   )r   r   r   r   r   r   r   r   r   r   |  s   



zSensorReadingQuaternion.to_jsonc                 C  s0   | t |d t |d t |d t |d dS )Nr   r   r   r   )r   r   r   r   r   r    r   r   r   r"     s   



z!SensorReadingQuaternion.from_jsonNr;   r   r   r   r   r   r  s   
 r   c                   @  sF   e Zd ZU dZded< dZded< dZded< dd	 Zed
d Z	dS )SensorReadingNz$typing.Optional[SensorReadingSingle]singlez!typing.Optional[SensorReadingXYZ]xyzz(typing.Optional[SensorReadingQuaternion]
quaternionc                 C  sR   t  }| jd ur| j |d< | jd ur| j |d< | jd ur'| j |d< |S )Nr   r   r   )r   r   r   r   r   r   r   r   r   r     s   


zSensorReading.to_jsonc                 C  sT   | d|v rt |d nd d|v rt|d nd d|v r&t|d dS d dS )Nr   r   r   )r   r   r   )r   r"   r   r   r    r   r   r   r"     s   zSensorReading.from_json)
r#   r$   r%   r   r&   r   r   r   r'   r"   r   r   r   r   r     r   r   c                   @  s$   e Zd ZdZdd Zedd ZdS )PressureSourcecpuc                 C  rL   rM   rN   rO   r   r   r   r     rP   zPressureSource.to_jsonc                 C  rQ   rM   r   r    r   r   r   r"     rR   zPressureSource.from_jsonN)r#   r$   r%   CPUr   r'   r"   r   r   r   r   r     s
    r   c                   @  rG   )
PressureStatenominalfairseriouscriticalc                 C  rL   rM   rN   rO   r   r   r   r     rP   zPressureState.to_jsonc                 C  rQ   rM   r   r    r   r   r   r"     rR   zPressureState.from_jsonN)
r#   r$   r%   NOMINALFAIRSERIOUSCRITICALr   r'   r"   r   r   r   r   r     s    r   c                   @  s.   e Zd ZU dZded< dd Zedd ZdS )PressureMetadataNre   r   c                 C  s   t  }| jd ur| j|d< |S )Nr   )r   r   r   r   r   r   r     r.   zPressureMetadata.to_jsonc                 C  s"   | d|v rt |d dS d dS )Nr   )r   r^   r    r   r   r   r"     s
   zPressureMetadata.from_json)r#   r$   r%   r   r&   r   r'   r"   r   r   r   r   r     s
   
 r   c                   @  s,   e Zd ZdZdZdZdd Zedd ZdS )	DisabledImageTypez3
    Enum of image types that can be disabled.
    avifwebpc                 C  rL   rM   rN   rO   r   r   r   r     rP   zDisabledImageType.to_jsonc                 C  rQ   rM   r   r    r   r   r   r"     rR   zDisabledImageType.from_jsonN)	r#   r$   r%   r2   AVIFWEBPr   r'   r"   r   r   r   r   r     s    r   return0typing.Generator[T_JSON_DICT, T_JSON_DICT, bool]c                  c  s    ddi} | V }t |d S )z^
    Tells whether emulation is supported.

    :returns: True if emulation is supported.
    methodzEmulation.canEmulateresultr   cmd_dictr   r   r   r   can_emulate  s
   r   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c                  c      ddi} | V }dS )z/
    Clears the overridden device metrics.
    r   z$Emulation.clearDeviceMetricsOverrideNr   r   r   r   r   clear_device_metrics_override     
r   c                  c  r   )z?
    Clears the overridden Geolocation Position and Error.
    r   z"Emulation.clearGeolocationOverrideNr   r   r   r   r   clear_geolocation_override  r   r   c                  c  r   )z[
    Requests that page scale factor is reset to initial values.

    **EXPERIMENTAL**
    r   zEmulation.resetPageScaleFactorNr   r   r   r   r   reset_page_scale_factor  s   
r   enabledr^   c                 c  $    t  }| |d< d|d}|V }dS )z
    Enables or disables simulating a focused and active page.

    **EXPERIMENTAL**

    :param enabled: Whether to enable to disable focus emulation.
    r   z"Emulation.setFocusEmulationEnabledr   paramsNr   r   r   r   r   r   r   r   set_focus_emulation_enabled     

r   re   c                 c  ,    t  }| dur| |d< d|d}|V }dS )z
    Automatically render all web contents using a dark theme.

    **EXPERIMENTAL**

    :param enabled: *(Optional)* Whether to enable or disable automatic dark mode. If not specified, any existing override will be cleared.
    Nr   z!Emulation.setAutoDarkModeOverrider   r   r   r   r   r   set_auto_dark_mode_override"     

r   rater   c                 c  r   )z
    Enables CPU throttling to emulate slow CPUs.

    :param rate: Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
    r   zEmulation.setCPUThrottlingRater   Nr   )r   r   r   r   r   r   r   set_cpu_throttling_rate6     
r   colortyping.Optional[dom.RGBA]c                 c  s0    t  }| dur|  |d< d|d}|V }dS )a  
    Sets or clears an override of the default background color of the frame. This override is used
    if the content does not specify one.

    :param color: *(Optional)* RGBA of the default background color. If not specified, any existing override will be cleared.
    Nr   z+Emulation.setDefaultBackgroundColorOverrider   r   r   )r   r   r   r   r   r   r   %set_default_background_color_overrideG  s   	
r   insetsc                 c  (    t  }|  |d< d|d}|V }dS )z
    Overrides the values for env(safe-area-inset-*) and env(safe-area-max-inset-*). Unset values will cause the
    respective variables to be undefined, even if previously overridden.

    **EXPERIMENTAL**

    :param insets:
    r   z#Emulation.setSafeAreaInsetsOverrider   Nr   )r   r   r   r   r   r   r   set_safe_area_insets_overrideZ     
r   widthr   heightdevice_scale_factorr_   scaler   screen_widthr   screen_height
position_x
position_ydont_set_visible_sizescreen_orientation"typing.Optional[ScreenOrientation]viewporttyping.Optional[page.Viewport]display_featuretyping.Optional[DisplayFeature]device_posturetyping.Optional[DevicePosture]c                 c  s    t  }| |d< ||d< ||d< ||d< |dur||d< |dur$||d< |dur,||d< |dur4||d	< |dur<||d
< |	durD|	|d< |
durN|
 |d< |durX| |d< |durb| |d< |durl| |d< d|d}|V }dS )aW  
    Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
    window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
    query results).

    :param width: Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
    :param height: Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
    :param device_scale_factor: Overriding device scale factor value. 0 disables the override.
    :param mobile: Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
    :param scale: **(EXPERIMENTAL)** *(Optional)* Scale to apply to resulting view image.
    :param screen_width: **(EXPERIMENTAL)** *(Optional)* Overriding screen width value in pixels (minimum 0, maximum 10000000).
    :param screen_height: **(EXPERIMENTAL)** *(Optional)* Overriding screen height value in pixels (minimum 0, maximum 10000000).
    :param position_x: **(EXPERIMENTAL)** *(Optional)* Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
    :param position_y: **(EXPERIMENTAL)** *(Optional)* Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
    :param dont_set_visible_size: **(EXPERIMENTAL)** *(Optional)* Do not set visible view size, rely upon explicit setVisibleSize call.
    :param screen_orientation: *(Optional)* Screen orientation override.
    :param viewport: **(EXPERIMENTAL)** *(Optional)* If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions.
    :param display_feature: **(EXPERIMENTAL)** *(Optional)* If set, the display feature of a multi-segment screen. If not set, multi-segment support is turned-off. Deprecated, use Emulation.setDisplayFeaturesOverride.
    :param device_posture: **(EXPERIMENTAL)** *(Optional)* If set, the posture of a foldable device. If not set the posture is set to continuous. Deprecated, use Emulation.setDevicePostureOverride.
    r   r   deviceScaleFactorr_   Nr   screenWidthscreenHeight	positionX	positionYdontSetVisibleSizescreenOrientationr   displayFeaturedevicePosturez"Emulation.setDeviceMetricsOverrider   r   )r   r   r   r_   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   set_device_metrics_overriden  s<   $
r   posturec                 c  r   )z
    Start reporting the given posture value to the Device Posture API.
    This override can also be set in setDeviceMetricsOverride().

    **EXPERIMENTAL**

    :param posture:
    r   z"Emulation.setDevicePostureOverrider   Nr   )r   r   r   r   r   r   r   set_device_posture_override  r   r   c                  c  r   )z
    Clears a device posture override set with either setDeviceMetricsOverride()
    or setDevicePostureOverride() and starts using posture information from the
    platform again.
    Does nothing if no override is set.

    **EXPERIMENTAL**
    r   z$Emulation.clearDevicePostureOverrideNr   r   r   r   r   clear_device_posture_override     

r   featurestyping.List[DisplayFeature]c                 c  .    t  }dd | D |d< d|d}|V }dS )z
    Start using the given display features to pupulate the Viewport Segments API.
    This override can also be set in setDeviceMetricsOverride().

    **EXPERIMENTAL**

    :param features:
    c                 S  ri   r   rj   rk   r   r   r   rn     ro   z1set_display_features_override.<locals>.<listcomp>r   z$Emulation.setDisplayFeaturesOverrider   Nr   )r   r   r   r   r   r   r   set_display_features_override  s   
r   c                  c  r   )z
    Clears the display features override set with either setDeviceMetricsOverride()
    or setDisplayFeaturesOverride() and starts using display features from the
    platform again.
    Does nothing if no override is set.

    **EXPERIMENTAL**
    r   z&Emulation.clearDisplayFeaturesOverrideNr   r   r   r   r   clear_display_features_override  r   r   hiddenc                 c  r   )z\


    **EXPERIMENTAL**

    :param hidden: Whether scrollbars should be always hidden.
    r   zEmulation.setScrollbarsHiddenr   Nr   )r   r   r   r   r   r   r   set_scrollbars_hidden  r   r   disabledc                 c  r   )zc


    **EXPERIMENTAL**

    :param disabled: Whether document.coookie API should be disabled.
    r   z#Emulation.setDocumentCookieDisabledr   Nr   )r   r   r   r   r   r   r   set_document_cookie_disabled  r   r   configurationrb   c                 c  4    t  }| |d< |dur||d< d|d}|V }dS )z


    **EXPERIMENTAL**

    :param enabled: Whether touch emulation based on mouse input should be enabled.
    :param configuration: *(Optional)* Touch/gesture events configuration. Default: current platform.
    r   Nr   z$Emulation.setEmitTouchEventsForMouser   r   )r   r   r   r   r   r   r   r   set_emit_touch_events_for_mouse  s   
r   media*typing.Optional[typing.List[MediaFeature]]c                 c  sF    t  }| dur| |d< |durdd |D |d< d|d}|V }dS )z
    Emulates the given media type or media feature for CSS media queries.

    :param media: *(Optional)* Media type to emulate. Empty string disables the override.
    :param features: *(Optional)* Media features to emulate.
    Nr   c                 S  ri   r   rj   rk   r   r   r   rn   C  ro   z&set_emulated_media.<locals>.<listcomp>r   zEmulation.setEmulatedMediar   r   )r   r   r   r   r   r   r   r   set_emulated_media5  s   

r   r*   r)   c                 c  r   )z
    Emulates the given vision deficiency.

    :param type_: Vision deficiency to emulate. Order: best-effort emulations come first, followed by any physiologically accurate emulations for medically recognized color vision deficiencies.
    r-   z%Emulation.setEmulatedVisionDeficiencyr   Nr   r*   r   r   r   r   r   r   set_emulated_vision_deficiencyK  r   r   c                 c  r   )zK
    Emulates the given OS text scale.

    :param scale: *(Optional)*
    Nr   z Emulation.setEmulatedOSTextScaler   r   )r   r   r   r   r   r   r   set_emulated_os_text_scale\  s   
r   latitude	longitudeaccuracyaltitudealtitude_accuracyheadingspeedc           
      c  s    t  }| dur| |d< |dur||d< |dur||d< |dur$||d< |dur,||d< |dur4||d< |dur<||d< d	|d
}|V }	dS )a  
    Overrides the Geolocation Position or Error. Omitting latitude, longitude or
    accuracy emulates position unavailable.

    :param latitude: *(Optional)* Mock latitude
    :param longitude: *(Optional)* Mock longitude
    :param accuracy: *(Optional)* Mock accuracy
    :param altitude: *(Optional)* Mock altitude
    :param altitude_accuracy: *(Optional)* Mock altitudeAccuracy
    :param heading: *(Optional)* Mock heading
    :param speed: *(Optional)* Mock speed
    Nr   r   r  r  altitudeAccuracyr  r  z Emulation.setGeolocationOverrider   r   )
r   r   r  r  r  r  r  r   r   r   r   r   r   set_geolocation_overriden  s(   
r  1typing.Generator[T_JSON_DICT, T_JSON_DICT, float]c                 c  s0    t  }|  |d< d|d}|V }t|d S )z>


    **EXPERIMENTAL**

    :param type_:
    :returns: 
    r-   z(Emulation.getOverriddenSensorInformationr   requestedSamplingFrequencyr   r   r   r   r   r   r   !get_overridden_sensor_information  s   r  metadatatyping.Optional[SensorMetadata]c                 c  D    t  }| |d< | |d< |dur| |d< d|d}|V }dS )a  
    Overrides a platform sensor of a given type. If ``enabled`` is true, calls to
    Sensor.start() will use a virtual sensor as backend rather than fetching
    data from a real hardware sensor. Otherwise, existing virtual
    sensor-backend Sensor objects will fire an error event and new calls to
    Sensor.start() will attempt to use a real sensor instead.

    **EXPERIMENTAL**

    :param enabled:
    :param type_:
    :param metadata: *(Optional)*
    r   r-   Nr  z"Emulation.setSensorOverrideEnabledr   r   )r   r*   r  r   r   r   r   r   r   set_sensor_override_enabled  s   
r  readingc                 c  4    t  }|  |d< | |d< d|d}|V }dS )z
    Updates the sensor readings reported by a sensor type previously overridden
    by setSensorOverrideEnabled.

    **EXPERIMENTAL**

    :param type_:
    :param reading:
    r-   r  z#Emulation.setSensorOverrideReadingsr   Nr   )r*   r  r   r   r   r   r   r   set_sensor_override_readings  s   
r  source!typing.Optional[PressureMetadata]c                 c  r  )aa  
    Overrides a pressure source of a given type, as used by the Compute
    Pressure API, so that updates to PressureObserver.observe() are provided
    via setPressureStateOverride instead of being retrieved from
    platform-provided telemetry data.

    **EXPERIMENTAL**

    :param enabled:
    :param source:
    :param metadata: *(Optional)*
    r   r  Nr  z*Emulation.setPressureSourceOverrideEnabledr   r   )r   r  r  r   r   r   r   r   r   $set_pressure_source_override_enabled  s   
r  statec                 c  r  )aV  
    TODO: OBSOLETE: To remove when setPressureDataOverride is merged.
    Provides a given pressure state that will be processed and eventually be
    delivered to PressureObserver users. ``source`` must have been previously
    overridden by setPressureSourceOverrideEnabled.

    **EXPERIMENTAL**

    :param source:
    :param state:
    r  r  z"Emulation.setPressureStateOverrider   Nr   )r  r  r   r   r   r   r   r   set_pressure_state_override   s   
r  own_contribution_estimatec                 c  sD    t  }|  |d< | |d< |dur||d< d|d}|V }dS )aF  
    Provides a given pressure data set that will be processed and eventually be
    delivered to PressureObserver users. ``source`` must have been previously
    overridden by setPressureSourceOverrideEnabled.

    **EXPERIMENTAL**

    :param source:
    :param state:
    :param own_contribution_estimate: *(Optional)*
    r  r  NownContributionEstimatez!Emulation.setPressureDataOverrider   r   )r  r  r  r   r   r   r   r   r   set_pressure_data_override  s   
r  is_user_activeis_screen_unlockedc                 c  ,    t  }| |d< ||d< d|d}|V }dS )z
    Overrides the Idle state.

    :param is_user_active: Mock isUserActive
    :param is_screen_unlocked: Mock isScreenUnlocked
    isUserActiveisScreenUnlockedzEmulation.setIdleOverrider   Nr   )r  r  r   r   r   r   r   r   set_idle_override5  r   r   c                  c  r   )z&
    Clears Idle state overrides.
    r   zEmulation.clearIdleOverrideNr   r   r   r   r   clear_idle_overrideI  r   r!  rZ   c                 c  r   )z
    Overrides value returned by the javascript navigator object.

    **EXPERIMENTAL**

    :param platform: The platform navigator.platform should return.
    rZ   zEmulation.setNavigatorOverridesr   Nr   )rZ   r   r   r   r   r   r   set_navigator_overridesS  r   r"  page_scale_factorc                 c  r   )zu
    Sets a specified page scale factor.

    **EXPERIMENTAL**

    :param page_scale_factor: Page scale factor.
    pageScaleFactorzEmulation.setPageScaleFactorr   Nr   )r#  r   r   r   r   r   r   set_page_scale_factorf  r   r%  rE   c                 c  r   )z|
    Switches script execution in the page.

    :param value: Whether script execution should be disabled in the page.
    rE   z$Emulation.setScriptExecutionDisabledr   Nr   )rE   r   r   r   r   r   r   set_script_execution_disabledy  r   r&  max_touch_pointsc                 c  r   )z
    Enables touch on platforms which do not support them.

    :param enabled: Whether the touch event emulation should be enabled.
    :param max_touch_points: *(Optional)* Maximum touch points supported. Defaults to one.
    r   NmaxTouchPointsz"Emulation.setTouchEmulationEnabledr   r   )r   r'  r   r   r   r   r   r   set_touch_emulation_enabled  s   

r)  policybudget&max_virtual_time_task_starvation_countinitial_virtual_time'typing.Optional[network.TimeSinceEpoch]c                 c  sd    t  }|  |d< |dur||d< |dur||d< |dur$| |d< d|d}|V }t|d S )	a#  
    Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets
    the current virtual time policy.  Note this supersedes any previous time budget.

    **EXPERIMENTAL**

    :param policy:
    :param budget: *(Optional)* If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.
    :param max_virtual_time_task_starvation_count: *(Optional)* If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.
    :param initial_virtual_time: *(Optional)* If set, base::Time::Now will be overridden to initially return this value.
    :returns: Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
    r*  Nr+  !maxVirtualTimeTaskStarvationCountinitialVirtualTimezEmulation.setVirtualTimePolicyr   virtualTimeTicksBaser
  )r*  r+  r,  r-  r   r   r   r   r   r   set_virtual_time_policy  s   r2  localec                 c  r   )z
    Overrides default host system locale with the specified one.

    **EXPERIMENTAL**

    :param locale: *(Optional)* ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and restores default host system locale.
    Nr3  zEmulation.setLocaleOverrider   r   )r3  r   r   r   r   r   r   set_locale_override  r   r4  timezone_idc                 c  r   )ag  
    Overrides default host system timezone with the specified one.

    :param timezone_id: The timezone identifier. List of supported timezones: https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt If empty, disables the override and restores default host system timezone.
    
timezoneIdzEmulation.setTimezoneOverrider   Nr   )r5  r   r   r   r   r   r   set_timezone_override  r   r7  c                 c  r  )a<  
    Resizes the frame/viewport of the page. Note that this does not affect the frame's container
    (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported
    on Android.

    **EXPERIMENTAL**

    :param width: Frame width (DIP).
    :param height: Frame height (DIP).
    r   r   zEmulation.setVisibleSizer   Nr   )r   r   r   r   r   r   r   r   set_visible_size  s   
r8  image_typestyping.List[DisabledImageType]c                 c  r   )zM


    **EXPERIMENTAL**

    :param image_types: Image types to disable.
    c                 S  ri   r   rj   rk   r   r   r   rn   	  ro   z,set_disabled_image_types.<locals>.<listcomp>
imageTypeszEmulation.setDisabledImageTypesr   Nr   )r9  r   r   r   r   r   r   set_disabled_image_types  s   

r<  hardware_concurrencyc                 c  r   )z]


    **EXPERIMENTAL**

    :param hardware_concurrency: Hardware concurrency to report
    hardwareConcurrencyz(Emulation.setHardwareConcurrencyOverrider   Nr   )r=  r   r   r   r   r   r   !set_hardware_concurrency_override  r   r?  
user_agentaccept_languageuser_agent_metadata"typing.Optional[UserAgentMetadata]c                 c  sX    t  }| |d< |dur||d< |dur||d< |dur"| |d< d|d}|V }dS )a  
    Allows overriding user agent with the given string.
    ``userAgentMetadata`` must be set for Client Hint headers to be sent.

    :param user_agent: User agent to use.
    :param accept_language: *(Optional)* Browser language to emulate.
    :param platform: *(Optional)* The platform navigator.platform should return.
    :param user_agent_metadata: **(EXPERIMENTAL)** *(Optional)* To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
    	userAgentNacceptLanguagerZ   userAgentMetadatazEmulation.setUserAgentOverrider   r   )r@  rA  rZ   rB  r   r   r   r   r   r   set_user_agent_override$  s   
rG  c                 c  r   )z
    Allows overriding the automation flag.

    **EXPERIMENTAL**

    :param enabled: Whether the override should be enabled.
    r   zEmulation.setAutomationOverrider   Nr   r   r   r   r   set_automation_overrideB  r   rH  
differencec                 c  r   )af  
    Allows overriding the difference between the small and large viewport sizes, which determine the
    value of the ``svh`` and ``lvh`` unit, respectively. Only supported for top-level frames.

    **EXPERIMENTAL**

    :param difference: This will cause an element of size 100svh to be ```difference``` pixels smaller than an element of size 100lvh.
    rI  z2Emulation.setSmallViewportHeightDifferenceOverrider   Nr   )rI  r   r   r   r   r   r   -set_small_viewport_height_difference_overrideU  s   
rJ  z"Emulation.virtualTimeBudgetExpiredc                   @  s   e Zd ZdZedddZdS )	VirtualTimeBudgetExpiredz~
    **EXPERIMENTAL**

    Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
    r   r   r   c                 C  s   |  S rM   r   r    r   r   r   r"   s  s   z"VirtualTimeBudgetExpired.from_jsonN)r   r   r   rK  )r#   r$   r%   r2   r'   r"   r   r   r   r   rK  i  s    rK  )r   r   )r   r   )r   r^   r   r   rM   )r   re   r   r   )r   r   r   r   )r   r   r   r   )r   r
   r   r   )
NNNNNNNNNN)r   r   r   r   r   r   r_   r^   r   r   r   r   r   r   r   r   r   r   r   re   r   r   r   r   r   r   r   r   r   r   )r   r=   r   r   )r   r   r   r   )r   r^   r   r   )r   r^   r   r   )r   r^   r   rb   r   r   )NN)r   rb   r   r   r   r   )r*   r)   r   r   )r   r   r   r   )NNNNNNN)r   r   r   r   r  r   r  r   r  r   r  r   r  r   r   r   )r*   rv   r   r  )r   r^   r*   rv   r  r  r   r   )r*   rv   r  r   r   r   )r   r^   r  r   r  r  r   r   )r  r   r  r   r   r   )r  r   r  r   r  r   r   r   )r  r^   r  r^   r   r   )rZ   r)   r   r   )r#  r   r   r   )rE   r^   r   r   )r   r^   r'  r   r   r   )NNN)
r*  rH   r+  r   r,  r   r-  r.  r   r  )r3  rb   r   r   )r5  r)   r   r   )r   r   r   r   r   r   )r9  r:  r   r   )r=  r   r   r   )
r@  r)   rA  rb   rZ   rb   rB  rC  r   r   )rI  r   r   r   )K
__future__r   utilr   r   dataclassesr   enumtyping r   r   r	   r
   r(   r3   r=   rC   EnumrH   rV   rY   rv   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r   r!  r"  r%  r&  r)  r2  r4  r7  r8  r<  r?  rG  rH  rJ  rK  r   r   r   r   <module>   s   ;E









D






+







#





