o
    ҷhh+                     @  sN  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d=ddZd=ddZd>ddZd?ddZd@dd ZdAd#d$ZdBd'd(ZdCd+d,ZdDd.d/ZdEd2d3Zed4eG d5d6 d6Zed7eG d8d9 d9Zed:eG d;d< d<ZdS )F    )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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_idc                 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
< |S )Nidr   pausedState	playStateplaybackRate	startTimecurrentTimetyper   cssId)dictr   r   r   r   r   r   r   r   r   to_jsonr   selfjson r%   d/var/www/html/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v117/animation.pyr!   4   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 rAt |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   AnimationEffect	from_jsonclsr$   r%   r%   r&   r(   D   s   








zAnimation.from_json)
__name__
__module____qualname____doc____annotations__r   r   r!   classmethodr(   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easingNz"typing.Optional[dom.BackendNodeId]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 )Nr1   endDelayiterationStartr4   r5   r6   r7   r8   backendNodeIdkeyframesRule)r    r1   r2   r3   r4   r5   r6   r7   r8   r9   r!   r:   r"   r%   r%   r&   r!   w   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 )Nr1   r;   r<   r4   r5   r6   r7   r8   r=   r>   )
r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   )r   r
   r   BackendNodeIdr(   KeyframesRuler)   r%   r%   r&   r(      s   








zAnimationEffect.from_json)
r+   r,   r-   r.   r/   r9   r:   r!   r0   r(   r%   r%   r%   r&   r'   T   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 )r@   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>rA   r   )r    rA   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(   rB   r%   r%   r&   rE      s    z+KeyframesRule.from_json.<locals>.<listcomp>rA   r   )rA   r   r
   r)   r%   r%   r&   r(      s   zKeyframesRule.from_json)	r+   r,   r-   r.   r/   r   r!   r0   r(   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 )
rF   z
    Keyframe Style
    r
   offsetr8   c                 C  s   t  }| j|d< | j|d< |S )NrH   r8   )r    rH   r8   r"   r%   r%   r&   r!      s   

zKeyframeStyle.to_jsonc                 C  s   | t |d t |d dS )NrH   r8   )rH   r8   rG   r)   r%   r%   r&   r(      s   

zKeyframeStyle.from_jsonN)r+   r,   r-   r.   r/   r!   r0   r(   r%   r%   r%   r&   rF      s   
 rF   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      
rO   c                  c  rK   )z1
    Enables animation domain notifications.
    rL   zAnimation.enableNr%   rM   r%   r%   r&   enable   rP   rQ   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rL   paramsr   )r    r   )r   rT   rN   r$   r%   r%   r&   get_current_time   s   	rU   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.
    rL   zAnimation.getPlaybackRater   )r   rM   r%   r%   r&   get_playback_rate   s
   rV   
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%   rB   r%   r%   r&   rE         z&release_animations.<locals>.<listcomp>rW   zAnimation.releaseAnimationsrS   Nr    )rW   rT   rN   r$   r%   r%   r&   release_animations   s   
r\   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.resolveAnimationrS   remoteObject)r    r   RemoteObjectr(   )r]   rT   rN   r$   r%   r%   r&   resolve_animation  s   	rb   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  rY   r%   r%   rB   r%   r%   r&   rE   -  rZ   z#seek_animations.<locals>.<listcomp>rW   r   zAnimation.seekAnimationsrS   Nr[   )rW   r   rT   rN   r$   r%   r%   r&   seek_animations"     

rd   pausedr   c                 c  rc   )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  rY   r%   r%   rB   r%   r%   r&   rE   A  rZ   zset_paused.<locals>.<listcomp>rW   rf   zAnimation.setPausedrS   Nr[   )rW   rf   rT   rN   r$   r%   r%   r&   
set_paused6  re   rg   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.setPlaybackRaterS   Nr[   )r   rT   rN   r$   r%   r%   r&   set_playback_rateJ  s   
rh   r5   r1   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.
    r_   r5   r1   zAnimation.setTimingrS   Nr[   )r]   r5   r1   rT   rN   r$   r%   r%   r&   
set_timing[  s   
ri   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   rI   c                 C     | t |d dS Nr   )r   rG   r)   r%   r%   r&   r(   {     
zAnimationCanceled.from_jsonN)r$   r   rI   rk   r+   r,   r-   r.   r/   r0   r(   r%   r%   r%   r&   rk   r  
   
 rk   zAnimation.animationCreatedc                   @  rj   )AnimationCreatedz9
    Event for each animation that has been created.
    r
   r   r$   r   rI   c                 C  rl   rm   rG   r)   r%   r%   r&   r(     rn   zAnimationCreated.from_jsonN)r$   r   rI   rq   ro   r%   r%   r%   r&   rq     rp   rq   zAnimation.animationStartedc                   @  rj   )AnimationStartedz4
    Event for animation that has been started.
    r	   	animationr$   r   rI   c                 C  s   | t |d dS )Nrs   )rs   )r	   r(   r)   r%   r%   r&   r(     s   zAnimationStarted.from_jsonN)r$   r   rI   rr   ro   r%   r%   r%   r&   rr     rp   rr   )rI   rJ   )r   r
   rI   rR   )rI   rR   )rW   rX   rI   rJ   )r]   r
   rI   r^   )rW   rX   r   r   rI   rJ   )rW   rX   rf   r   rI   rJ   )r   r   rI   rJ   )r]   r
   r5   r   r1   r   rI   rJ   )
__future__r   utilr   r   dataclassesr   enumtyping r   r   r	   r'   r@   rF   rO   rQ   rU   rV   r\   rb   rd   rg   rh   ri   rk   rq   rr   r%   r%   r%   r&   <module>   sD   CB





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