Ë
    µŒj  ã                   ó^   — d dl Z d dlZd dlmZmZ d dlmZ d dlm	Z	 d dl
mZ  G d„ de«      Zy)é    N)ÚAnyÚList)ÚDocument)Ústringify_dict)Ú
BaseLoaderc                   óN   — e Zd ZdZdededefd„Zdefd„Zdefd„Zde	e
   fd	„Zy
)ÚFigmaFileLoaderzLoad `Figma` file.Úaccess_tokenÚidsÚkeyc                 ó.   — || _         || _        || _        y)zÞInitialize with access token, ids, and key.

        Args:
            access_token: The access token for the Figma REST API.
            ids: The ids of the Figma file.
            key: The key for the Figma file
        N)r
   r   r   )Úselfr
   r   r   s       út/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/langchain_community/document_loaders/figma.pyÚ__init__zFigmaFileLoader.__init__   s   € ð )ˆÔØˆŒØˆ�ó    Úreturnc                 ó>   — d| j                   ›d| j                  ›�}|S )Nzhttps://api.figma.com/v1/files/z/nodes?ids=)r   r   )r   Úapi_urls     r   Ú_construct_figma_api_urlz(FigmaFileLoader._construct_figma_api_url   s   � à�H‹HØ�HŠHð
ˆð ˆr   c                 óL  — d| j                   i}t        j                  j                  | j	                  «       |¬«      }t        j                  j                  |«      5 }t        j                  |j                  «       j                  «       «      }|cddd«       S # 1 sw Y   yxY w)z#Get Figma file from Figma REST API.zX-Figma-Token)ÚheadersN)
r
   ÚurllibÚrequestÚRequestr   ÚurlopenÚjsonÚloadsÚreadÚdecode)r   r   r   ÚresponseÚ	json_datas        r   Ú_get_figma_filezFigmaFileLoader._get_figma_file!   s{   € à" D×$5Ñ$5Ð6ˆÜ—.‘.×(Ñ(Ø×)Ñ)Ó+°Wð )ó 
ˆô �^‰^×#Ñ# GÔ,°ÜŸ
™
 8§=¡=£?×#9Ñ#9Ó#;Ó<ˆIØ÷ -×,Ò,ús   Á3BÂB#c                 óx   — | j                  «       }t        |«      }d| j                  «       i}t        ||¬«      gS )z	Load fileÚsource)Úpage_contentÚmetadata)r"   r   r   r   )r   ÚdataÚtextr&   s       r   ÚloadzFigmaFileLoader.load+   s=   € à×#Ñ#Ó%ˆÜ˜dÓ#ˆØ˜d×;Ñ;Ó=Ð>ˆÜ d°XÔ>Ð?Ð?r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústrr   r   r   r"   r   r   r)   © r   r   r	   r	      sI   „ Ùð
 Sð 
¨sð 
¸ó 
ð¨#ó ð ó ð@�d˜8‘nô @r   r	   )r   Úurllib.requestr   Útypingr   r   Úlangchain_core.documentsr   Úlangchain_core.utilsr   Ú)langchain_community.document_loaders.baser   r	   r/   r   r   Ú<module>r5      s%   ðÛ Û ß å -Ý /å @ô%@�jõ %@r   