o
    %hE
                     @   sR   d dl Z d dlmZmZ d dlmZ d dlmZ er d dlm	Z	 G dd dZ
dS )    N)TYPE_CHECKINGUnion)Artifact)Error)Pagec                   @   sv   e Zd ZdddZdefddZdd	d
ZdeddfddZde	j
fddZdeee	j
f ddfddZdddZdS )Videopager   returnNc                    sN   |j  _ |j _| _|j   _| r   d S |d fdd d S )Nclosec                    s      S N)_page_closed)r   self K/var/www/html/myenv/lib/python3.10/site-packages/playwright/_impl/_video.py<lambda>"   s    z Video.__init__.<locals>.<lambda>)_loop_dispatcher_fiber_pagecreate_future_artifact_future	is_closedr   on)r   r   r   r   r   __init__   s   zVideo.__init__c                 C   s   d| j  dS )Nz<Video page=>)r   r   r   r   r   __repr__$   s   zVideo.__repr__c                 C   s"   | j  s| j td d S d S )NzPage closed)r   doneset_exceptionr   r   r   r   r   r   '   s   
zVideo._page_closedartifactc                 C   s   | j  s| j | d S d S r   )r   r   
set_resultr   r   r   r   r   _artifact_ready+   s   
zVideo._artifact_readyc                    s2   | j jjr
td| jI d H }|std|jS )Nz[Path is not available when using browserType.connect(). Use save_as() to save a local copy.%Page did not produce any video frames)r   _connection	is_remoter   r   absolute_pathr    r   r   r   path/   s   
z
Video.pathr&   c                    sH   | j jjr| j jstd| jI d H }|std||I d H  d S )Nz?Page is not yet closed. Close the page prior to calling save_asr"   )r   r#   _is_sync
_is_closedr   r   save_as)r   r&   r   r   r   r   r)   9   s   zVideo.save_asc                    s,   | j I d H }|std| I d H  d S )Nr"   )r   r   deleter    r   r   r   r*   C   s
   zVideo.delete)r   r   r	   N)r	   N)__name__
__module____qualname__r   strr   r   r   r!   pathlibPathr&   r   r)   r*   r   r   r   r   r      s    




r   )r/   typingr   r   playwright._impl._artifactr   playwright._impl._helperr   playwright._impl._pager   r   r   r   r   r   <module>   s   