o
    M,h6                     @  sz  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 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dBddZdBddZdCddZdDddZdEd!d"ZdFd%d&ZdGd)d*ZdHd-d.ZdId0d1ZdJd4d5Zed6eG d7d8 d8Zed9eG d:d; d;Zed<eG d=d> d>Zed?eG d@dA dAZdS )K    )annotations   )event_classT_JSON_DICT)	dataclassN)dom)runtimec                   @  s   e Zd ZU dZded< ded< ded< 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d Ze	dd Z
dS )	Animationz
    Animation instance.
    strid_nameboolpaused_state
play_statefloatplayback_rate
start_timecurrent_timetype_Nz typing.Optional[AnimationEffect]sourcetyping.Optional[str]css_idz%typing.Optional[ViewOrScrollTimeline]view_or_scroll_timelinec                 C  s   t  }| j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j	d ur7| j	
 |d	< | jd urA| j|d
< | jd urM| j
 |d< |S )Nidr   pausedState	playStateplaybackRate	startTimecurrentTimetyper   cssIdviewOrScrollTimeline)dictr   r   r   r   r   r   r   r   r   to_jsonr   r   selfjson r'   }/var/www/www-root/data/www/bot.pdev.uz/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v141/animation.pyr#   :   s    











zAnimation.to_jsonc                 C  s   | t |d t |d t|d t |d t|d t|d t|d t |d d	|v r4t|d	 nd d
|v r?t |d
 nd d|v rMt|d dS d dS )Nr   r   r   r   r   r   r   r   r   r    r!   )r   r   r   r   r   r   r   r   r   r   r   )r
   r   r   AnimationEffect	from_jsonViewOrScrollTimelineclsr&   r'   r'   r(   r*   L   s   







zAnimation.from_json)__name__
__module____qualname____doc____annotations__r   r   r   r#   classmethodr*   r'   r'   r'   r(   r	      s    
 r	   c                   @  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d Z	e
dd ZdS )r+   z
    Timeline instance
    zdom.ScrollOrientationaxisN"typing.Optional[dom.BackendNodeId]source_node_idztyping.Optional[float]start_offset
end_offsetsubject_node_idc                 C  sp   t  }| j |d< | jd ur| j |d< | jd ur | j|d< | jd ur*| j|d< | jd ur6| j |d< |S )Nr4   sourceNodeIdstartOffset	endOffsetsubjectNodeId)r"   r4   r#   r6   r7   r8   r9   r$   r'   r'   r(   r#   u   s   





zViewOrScrollTimeline.to_jsonc              	   C  sz   | t j|d d|v rt j|d nd d|v rt|d nd d|v r*t|d nd d|v r9t j|d dS d dS )Nr4   r:   r;   r<   r=   )r4   r6   r7   r8   r9   )r   ScrollOrientationr*   BackendNodeIdr   r,   r'   r'   r(   r*      s   zViewOrScrollTimeline.from_json)r.   r/   r0   r1   r2   r6   r7   r8   r9   r#   r3   r*   r'   r'   r'   r(   r+   ]   s   
 r+   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ed	< ded
< ded< dZded< dZded< dd Zedd Z	dS )r)   z"
    AnimationEffect instance
    r   delay	end_delayiteration_start
iterationsdurationr
   	directionfilleasingNr5   backend_node_idztyping.Optional[KeyframesRule]keyframes_rulec                 C  s   t  }| j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j	d ur7| j	
 |d	< | jd urC| j
 |d
< |S )Nr@   endDelayiterationStartrC   rD   rE   rF   rG   backendNodeIdkeyframesRule)r"   r@   rA   rB   rC   rD   rE   rF   rG   rH   r#   rI   r$   r'   r'   r(   r#      s   









zAnimationEffect.to_jsonc                 C  s   | t |d t |d t |d t |d t |d t|d t|d t|d d	|v r5tj|d	 nd d
|v rCt|d
 d
S d d
S )Nr@   rJ   rK   rC   rD   rE   rF   rG   rL   rM   )
r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   )r   r
   r   r?   r*   KeyframesRuler,   r'   r'   r(   r*      s   








zAnimationEffect.from_json)
r.   r/   r0   r1   r2   rH   rI   r#   r3   r*   r'   r'   r'   r(   r)      s   
 r)   c                   @  s:   e Zd ZU dZded< dZded< dd Zed	d
 ZdS )rN   z
    Keyframes Rule
    ztyping.List[KeyframeStyle]	keyframesNr   r   c                 C  s2   t  }dd | jD |d< | jd ur| j|d< |S )Nc                 S  s   g | ]}|  qS r'   )r#   .0ir'   r'   r(   
<listcomp>   s    z)KeyframesRule.to_json.<locals>.<listcomp>rO   r   )r"   rO   r   r$   r'   r'   r(   r#      s
   

zKeyframesRule.to_jsonc                 C  s2   | dd |d D d|v rt |d dS d dS )Nc                 S  s   g | ]}t |qS r'   )KeyframeStyler*   rP   r'   r'   r(   rS      s    z+KeyframesRule.from_json.<locals>.<listcomp>rO   r   )rO   r   r
   r,   r'   r'   r(   r*      s   zKeyframesRule.from_json)	r.   r/   r0   r1   r2   r   r#   r3   r*   r'   r'   r'   r(   rN      s   
 rN   c                   @  s6   e Zd ZU dZded< ded< dd Zedd Zd	S )
rT   z
    Keyframe Style
    r
   offsetrG   c                 C  s   t  }| j|d< | j|d< |S )NrV   rG   )r"   rV   rG   r$   r'   r'   r(   r#      s   

zKeyframeStyle.to_jsonc                 C  s   | t |d t |d dS )NrV   rG   )rV   rG   rU   r,   r'   r'   r(   r*      s   

zKeyframeStyle.from_jsonN)r.   r/   r0   r1   r2   r#   r3   r*   r'   r'   r'   r(   rT      s   
 rT   return0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c                  c      ddi} | V }dS )z2
    Disables animation domain notifications.
    methodzAnimation.disableNr'   cmd_dictr&   r'   r'   r(   disable     
r]   c                  c  rY   )z1
    Enables animation domain notifications.
    rZ   zAnimation.enableNr'   r[   r'   r'   r(   enable  r^   r_   r   r
   1typing.Generator[T_JSON_DICT, T_JSON_DICT, float]c                 c  s,    t  }| |d< d|d}|V }t|d S )z
    Returns the current time of the an animation.

    :param id_: Id of animation.
    :returns: Current time of the page.
    r   zAnimation.getCurrentTimerZ   paramsr   )r"   r   )r   rb   r\   r&   r'   r'   r(   get_current_time  s   	rc   c                  c  s    ddi} | V }t |d S )zo
    Gets the playback rate of the document timeline.

    :returns: Playback rate for animations on page.
    rZ   zAnimation.getPlaybackRater   )r   r[   r'   r'   r(   get_playback_rate-  s
   rd   
animationstyping.List[str]c                 c  s.    t  }dd | D |d< d|d}|V }dS )zz
    Releases a set of animations to no longer be manipulated.

    :param animations: List of animation ids to seek.
    c                 S     g | ]}|qS r'   r'   rP   r'   r'   r(   rS   C      z&release_animations.<locals>.<listcomp>re   zAnimation.releaseAnimationsra   Nr"   )re   rb   r\   r&   r'   r'   r(   release_animations:  s   
rj   animation_id@typing.Generator[T_JSON_DICT, T_JSON_DICT, runtime.RemoteObject]c                 c  s0    t  }| |d< d|d}|V }tj|d S )z
    Gets the remote object of the Animation.

    :param animation_id: Animation id.
    :returns: Corresponding remote object.
    animationIdzAnimation.resolveAnimationra   remoteObject)r"   r   RemoteObjectr*   )rk   rb   r\   r&   r'   r'   r(   resolve_animationK  s   	rp   r   r   c                 c  6    t  }dd | D |d< ||d< d|d}|V }dS )z
    Seek a set of animations to a particular time within each animation.

    :param animations: List of animation ids to seek.
    :param current_time: Set the current time of each animation.
    c                 S  rg   r'   r'   rP   r'   r'   r(   rS   i  rh   z#seek_animations.<locals>.<listcomp>re   r   zAnimation.seekAnimationsra   Nri   )re   r   rb   r\   r&   r'   r'   r(   seek_animations^     

rr   pausedr   c                 c  rq   )z
    Sets the paused state of a set of animations.

    :param animations: Animations to set the pause state of.
    :param paused: Paused state to set to.
    c                 S  rg   r'   r'   rP   r'   r'   r(   rS   }  rh   zset_paused.<locals>.<listcomp>re   rt   zAnimation.setPausedra   Nri   )re   rt   rb   r\   r&   r'   r'   r(   
set_pausedr  rs   ru   r   c                 c  s$    t  }| |d< d|d}|V }dS )zz
    Sets the playback rate of the document timeline.

    :param playback_rate: Playback rate for animations on page
    r   zAnimation.setPlaybackRatera   Nri   )r   rb   r\   r&   r'   r'   r(   set_playback_rate  s   
rv   rD   r@   c                 c  s4    t  }| |d< ||d< ||d< d|d}|V }dS )z
    Sets the timing of an animation node.

    :param animation_id: Animation id.
    :param duration: Duration of the animation.
    :param delay: Delay of the animation.
    rm   rD   r@   zAnimation.setTimingra   Nri   )rk   rD   r@   rb   r\   r&   r'   r'   r(   
set_timing  s   
rw   zAnimation.animationCanceledc                   @  (   e Zd ZU dZded< ed
ddZd	S )AnimationCanceledz9
    Event for when an animation has been cancelled.
    r
   r   r&   r   rW   c                 C     | t |d dS Nr   )r   rU   r,   r'   r'   r(   r*        
zAnimationCanceled.from_jsonN)r&   r   rW   ry   r.   r/   r0   r1   r2   r3   r*   r'   r'   r'   r(   ry     
   
 ry   zAnimation.animationCreatedc                   @  rx   )AnimationCreatedz9
    Event for each animation that has been created.
    r
   r   r&   r   rW   c                 C  rz   r{   rU   r,   r'   r'   r(   r*     r|   zAnimationCreated.from_jsonN)r&   r   rW   r   r}   r'   r'   r'   r(   r     r~   r   zAnimation.animationStartedc                   @  rx   )AnimationStartedz4
    Event for animation that has been started.
    r	   	animationr&   r   rW   c                 C     | t |d dS Nr   )r   r	   r*   r,   r'   r'   r(   r*        zAnimationStarted.from_jsonN)r&   r   rW   r   r}   r'   r'   r'   r(   r     r~   r   zAnimation.animationUpdatedc                   @  rx   )AnimationUpdatedz4
    Event for animation that has been updated.
    r	   r   r&   r   rW   c                 C  r   r   r   r,   r'   r'   r(   r*     r   zAnimationUpdated.from_jsonN)r&   r   rW   r   r}   r'   r'   r'   r(   r     r~   r   )rW   rX   )r   r
   rW   r`   )rW   r`   )re   rf   rW   rX   )rk   r
   rW   rl   )re   rf   r   r   rW   rX   )re   rf   rt   r   rW   rX   )r   r   rW   rX   )rk   r
   rD   r   r@   r   rW   rX   )
__future__r   utilr   r   dataclassesr   enumtyping r   r   r	   r+   r)   rN   rT   r]   r_   rc   rd   rj   rp   rr   ru   rv   rw   ry   r   r   r   r'   r'   r'   r(   <module>   sN   L/E











