o
    i5
                     @  s   d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
mZmZ e Zeej dddZddddddZdS )    )annotationsN)HTML)display)as_filefilesurlstrtokenwidthheightreturnr   c          
      C  s   d}d}t dd d }tt|}| }|||}||| }dtjv }|s=tj	|dd}	d	| d
| d|	 d}t
|S )ac  
    Generate the HTML needed to embed a LiveKit room.

    Args:
        url (str): The LiveKit room URL.
        token (str): The LiveKit join token.

    Important:
        The returned HTML contains the provided `url` and `token` values directly.
        Avoid using sensitive tokens in public notebooks (e.g., tokens with long expiration times).
    z##livekit-token-placeholder##z##livekit-url-placeholder##zlivekit.rtc.resourceszjupyter-htmlz
index.htmlzgoogle.colabT)quotez <iframe width="z
" height="z" frameborder="0" srcdoc="z"></iframe>)r   _resource_stackenter_contextr   	read_textreplacesysmoduleshtmlescaper   )
r   r	   r
   r   token_placeholderurl_placeholder
index_path	html_textIN_COLABescaped_content r   U/var/www/html/livekit_bhavya/venv/lib/python3.10/site-packages/livekit/rtc/jupyter.py	room_html   s   
r   z100%110pxr
   r   Nonec                C  s   t t| |||d dS )aq  
    Display a LiveKit room in a Jupyter notebook or Google Colab.

    Args:
        url (str): The LiveKit room URL.
        token (str): The LiveKit join token.

    Important:
        The rendered HTML will include the provided `url` and `token` in plain text.
        Avoid using sensitive tokens in public notebooks (e.g., tokens with long expiration times).
    r    N)r   r   )r   r	   r
   r   r   r   r   display_room8   s   r"   )
r   r   r	   r   r
   r   r   r   r   r   )
r   r   r	   r   r
   r   r   r   r   r!   )
__future__r   r   atexit
contextlibr   IPython.core.displayr   IPython.displayr   importlib.resourcesr   r   	ExitStackr   registercloser   r"   r   r   r   r   <module>   s    
)