
    qi5
                        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j                         Z ej                  ej                          ddZddd	dd
Zy)    )annotationsN)HTML)display)as_filefilesc               T   d}d}t        d      dz  dz  }t        j                  t        |            }|j	                         }|j                  ||      }|j                  ||       }dt        j                  v }|s#t        j                  |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   )
urltokenwidthheighttoken_placeholderurl_placeholder
index_path	html_textIN_COLABescaped_contents
             E/opt/pipecat/venv/lib/python3.12/site-packages/livekit/rtc/jupyter.py	room_htmlr      s     83O./.@<OJ ..wz/BCJ
 $$&I!!"3U;I!!/37I,H ++it< ugZx 8&'{4 	
 	?    z100%110pxr   r   c               4    t        t        | |||             y)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   s       r   display_roomr"   8   s     Ic5f=>r   )
r   strr   r#   r   r#   r   r#   returnr   )
r   r#   r   r#   r   r#   r   r#   r$   None)
__future__r   r   atexit
contextlibr   IPython.core.displayr   IPython.displayr   importlib.resourcesr   r   	ExitStackr
   registercloser   r"    r   r   <module>r0      sS    " 
    % # .&*&&( %% &&R 8>W ?r   