
    Ng=                     &   d Z ddlZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZ ej        dk     rddlmZmZmZ n
ddlmZmZmZ ddlmZ ddlmZmZmZmZmZmZ g dZd	Zd
Z G d de          Z G d d          Zeefddddfde dee e f         de
ed                  de de
e!         de
ee ee ee e f         ge f         f                  de fdZ"	 d*de de#de#dee         fdZ$eefdddfde dee e f         de de
e!         de
ee ee ee e f         ge f         f                  de fdZ%	 	 d+de d!ee ee ee e f         ge f         f         de!de fd"Z&de de	e         fd#Z'de de	e          fd$Z(d,de d%e#de)fd&Z*de de#fd'Z+de de#fd(Z,de de!fd)Z-dS )-z4
emoji.core
~~~~~~~~~~

Core components for emoji.

    N)AnyCallableDictIteratorListOptionalTupleUnion)   	   )LiteralMatch	TypedDict)unicode_codes)Token
EmojiMatchEmojiMatchZWJEmojiMatchZWJNonRGItokenizefilter_tokens)emojizedemojizeanalyzeconfig
emoji_listdistinct_emoji_listemoji_countreplace_emojiis_emojipurely_emojiversionr   r   r   r   :uB   \w\-&.’”“()!#*+,/«»゙ًَُِ̧̀́̂̃̆̈̊ٓٔ・゚ٕc                   .    e Zd ZU eed<   eed<   eed<   dS )_EmojiListReturnemojimatch_start	match_endN)__name__
__module____qualname__str__annotations__int     F/var/www/html/ai-engine/env/lib/python3.11/site-packages/emoji/core.pyr$   r$   4   s.         JJJNNNNNr/   r$   c                   Z    e Zd ZdZdZ	 dZ	 eddeee	         e	df         fd            Z
dS )r   zModule-wide configurationTFNlanguagec                     t          | t                    r| gn| r| nt          j        }|D ]}t          j        |           dS )u  Load one or multiple languages into memory.
        If no language is specified, all languages will be loaded.

        This makes language data accessible in the :data:`EMOJI_DATA` dict.
        For example to access a French emoji name, first load French with

         ``emoji.config.load_language('fr')``

        and then access it with

         ``emoji.EMOJI_DATA['🏄']['fr']``

        Available languages are listed in :data:`LANGUAGES`N)
isinstancer+   r   	LANGUAGESload_from_json)r2   	languageslangs      r0   load_languagezconfig.load_language^   sd    $ (C(()XJJ )( 	  	/ 	/D(....	/ 	/r/   N)r(   r)   r*   __doc__demojize_keep_zwjreplace_emoji_keep_zwjstaticmethodr
   r   r+   r9   r.   r/   r0   r   r   :   sn        ##. # / /d3id&: ; / / / \/ / /r/   r   enstring
delimitersvariant)	text_type
emoji_typer2   r!   handle_versionreturnc                 L   t          j                   t          j        dt          j        d                   dt
          dt          j        d                   d          }dt          t                   dt          ffd	}|                    ||           S )
u/  
    Replace emoji names in a string with Unicode codes.
        >>> import emoji
        >>> print(emoji.emojize("Python is fun :thumbsup:", language='alias'))
        Python is fun 👍
        >>> print(emoji.emojize("Python is fun :thumbs_up:"))
        Python is fun 👍
        >>> print(emoji.emojize("Python is fun {thumbs_up}", delimiters = ("{", "}")))
        Python is fun 👍
        >>> print(emoji.emojize("Python is fun :red_heart:", variant="text_type"))
        Python is fun ❤
        >>> print(emoji.emojize("Python is fun :red_heart:", variant="emoji_type"))
        Python is fun ❤️ # red heart, not black heart

    :param string: String contains emoji names.
    :param delimiters: (optional) Use delimiters other than _DEFAULT_DELIMITER. Each delimiter
        should contain at least one character that is not part of a-zA-Z0-9 and ``_-&.()!?#*+,``.
        See ``emoji.core._EMOJI_NAME_PATTERN`` for the regular expression of unsafe characters.
    :param variant: (optional) Choose variation selector between "base"(None), VS-15 ("text_type") and VS-16 ("emoji_type")
    :param language: Choose language of emoji name: language code 'es', 'de', etc. or 'alias'
        to use English aliases
    :param version: (optional) Max version. If set to an Emoji Version,
        all emoji above this version will be ignored.
    :param handle_version: (optional) Replace the emoji above ``version``
        instead of ignoring it. handle_version can be either a string or a
        callable; If it is a callable, it's passed the Unicode emoji and the
        data dict from :data:`EMOJI_DATA` and must return a replacement string
        to be used::

            handle_version('\U0001F6EB', {
                'en' : ':airplane_departure:',
                'status' : fully_qualified,
                'E' : 1,
                'alias' : [':flight_departure:'],
                'de': ':abflug:',
                'es': ':avión_despegando:',
                ...
            })

    :raises ValueError: if ``variant`` is neither None, 'text_type' or 'emoji_type'

    (r   [z]+   )matchrF   c                 $   |                      d          t          d                   t          d                             }t          j        t          t          j        d|          z   t          z             }||                      d          S t          j        |         d         k    rt                    r^t          j        |         	                                }| 
                                |d<   |                                 |d<    ||          S t                    S dS dt          j        |         vr|S |d	         d
k    s|d	         dk    r
|dd	         }dk    r|d
z   S dk    r|dz   S t          d          )NrJ   r   NFKCEr&   r'    rB   u   ︎u   ️rC   rD   zDParameter 'variant' must be either None, 'text_type' or 'emoji_type')grouplenr   get_emoji_by_name_DEFAULT_DELIMITERunicodedata	normalize
EMOJI_DATAcallablecopystartendr+   
ValueError)	rL   nameemjemj_datarA   rE   r2   rB   r!   s	       r0   replacezemojize.<locals>.replace   s   {{1~~c*Q-00C
14F4F3FFG-#FD112 ! 	
 
 ;;;q>>!=#;C#@#E#O#O'' 	(3C8==??*/++--'(-		%%~c8444+>***r?i}/G/LLLJr7h#b'X"5"5ad)Ck!!>!$$>!V  r/   )	r   r6   recompileescape_EMOJI_NAME_PATTERNr   r+   sub)r@   rA   rB   r2   r!   rE   patternra   s    `````  r0   r   r   z   s    f  ***jj9Z]####%8%8%8")JqM:R:R:R:R	T G
%uSz %c % % % % % % % % % %N ;;w'''r/   FT	non_emoji
join_emojic                 F    t          t          | d          | |          S )a  
    Find unicode emoji in a string. Yield each emoji as a named tuple
    :class:`Token` ``(chars, EmojiMatch)`` or :class:`Token` ``(chars, EmojiMatchZWJNonRGI)``.
    If ``non_emoji`` is True, also yield all other characters as
    :class:`Token` ``(char, char)`` .

    :param string: String to analyze
    :param non_emoji: If True also yield all non-emoji characters as Token(char, char)
    :param join_emoji: If True, multiple EmojiMatch are merged into a single
        EmojiMatchZWJNonRGI if they are separated only by a ZWJ.
    Tkeep_zwj
emoji_onlyri   )r   r   )r@   rh   ri   s      r0   r   r      s1     $'''	Mj   r/   c                     dk    rddndt          j                   dt          dt          ffdt	          | t
          j                  }d	                    fd
|D                       S )u  
    Replace Unicode emoji in a string with emoji shortcodes. Useful for storage.
        >>> import emoji
        >>> print(emoji.emojize("Python is fun :thumbs_up:"))
        Python is fun 👍
        >>> print(emoji.demojize("Python is fun 👍"))
        Python is fun :thumbs_up:
        >>> print(emoji.demojize("icode is tricky 😯", delimiters=("__", "__")))
        Unicode is tricky __hushed_face__

    :param string: String contains Unicode characters. MUST BE UNICODE.
    :param delimiters: (optional) User delimiters other than ``_DEFAULT_DELIMITER``
    :param language: Choose language of emoji name: language code 'es', 'de', etc. or 'alias'
        to use English aliases
    :param version: (optional) Max version. If set to an Emoji Version,
        all emoji above this version will be removed.
    :param handle_version: (optional) Replace the emoji above ``version``
        instead of removing it. handle_version can be either a string or a
        callable ``handle_version(emj: str, data: dict) -> str``; If it is
        a callable, it's passed the Unicode emoji and the data dict from
        :data:`EMOJI_DATA` and must return a replacement string  to be used.
        The passed data is in the form of::

            handle_version('\U0001F6EB', {
                'en' : ':airplane_departure:',
                'status' : fully_qualified,
                'E' : 1,
                'alias' : [':flight_departure:'],
                'de': ':abflug:',
                'es': ':avión_despegando:',
                ...
            })

    aliasr?   TFemoji_matchrF   c                    | j         J I| j         d         k    r8t                    r# | j        |                                           S S dS | j         v r_r6d| j         v r-d         | j         d         d         dd         z   d         z   S d         | j                  dd         z   d         z   S | j        S )NrO   rP   rp   r   rJ   rQ   )datarY   r%   	data_copy)rq   _use_aliasesrA   rE   r2   r!   s    r0   handlezdemojize.<locals>.handle$  s    +++;#3C#87#B#B'' %~k&79N9N9P9PQQQ+%%r))) X;+; ; ;qMK$4W$=a$@2$FFTUV "!}{'7'A!B$'GG*UV-WW $$r/   rk   rP   c              3      K   | ]B}t          |j        t                    rt           |j                            n|j        V  Cd S r:   r4   valuer   r+   ).0tokenrv   s     r0   	<genexpr>zdemojize.<locals>.<genexpr>9  sc         %/u{J$G$GXFF5;   U[     r/   )r   r6   r   r+   r   r   r<   join)r@   rA   r2   r!   rE   matchesru   rv   s    ```` @@r0   r   r      s    T 7 ***%J %3 % % % % % % % % % %( v(@AAAG77         r/   rP   rQ   ra   c                     dt           dt          ffdt          | t          j                  }t          j        rt          |dd          }d                    fd	|D                       S )
a  
    Replace Unicode emoji in a customizable string.

    :param string: String contains Unicode characters. MUST BE UNICODE.
    :param replace: (optional) replace can be either a string or a callable;
        If it is a callable, it's passed the Unicode emoji and the data dict from
        :data:`EMOJI_DATA` and must return a replacement string to be used.
        replace(str, dict) -> str
    :param version: (optional) Max version. If set to an Emoji Version,
        only emoji above this version will be replaced.
    rq   rF   c                 B   dk    r\| j         J | j         d         k    rAt                    r# | j        |                                           S t	                    S n6t                    r# | j        |                                           S S | j        S )NrQ   rO   )rs   rY   r%   rt   r+   )rq   ra   r!   s    r0   rv   zreplace_emoji.<locals>.handleP  s    R<<#///$w..G$$ ("7;#4k6K6K6M6MNNNw<<'	 /
 g 	7;,k.C.C.E.EFFF N  r/   rk   FTrm   rP   c              3      K   | ]B}t          |j        t                    rt           |j                            n|j        V  Cd S r:   rx   )rz   mrv   s     r0   r|   z replace_emoji.<locals>.<genexpr>a  sa         !+17J ? ?LFF17OOQW     r/   )r   r+   r   r   r=   r   r}   )r@   ra   r!   r~   rv   s    `` @r0   r   r   ?  s    "!J !3 ! ! ! ! ! ! ! v(EFFFG$ LEdKKK77         r/   c                 8    d t          | d          D             S )u   
    Returns the location and emoji in list of dict format.
        >>> emoji.emoji_list("Hi, I am fine. 😁")
        [{'match_start': 15, 'match_end': 16, 'emoji': '😁'}]
    c                     g | ]@}t          |j        t                    |j        j        |j        j        |j        j        d AS ))r&   r'   r%   )r4   ry   r   r[   r\   r%   rz   r   s     r0   
<listcomp>zemoji_list.<locals>.<listcomp>n  sX        agz**7=W]	
 	
  r/   Frk   )r   r@   s    r0   r   r   g  s2      &5111   r/   c                 R    t          d t          |           D                       }|S )z0Returns distinct list of emojis from the string.c                     h | ]
}|d          S )r%   r.   )rz   es     r0   	<setcomp>z&distinct_emoji_list.<locals>.<setcomp>{  s    AAA!G*AAAr/   )listr   )r@   distinct_lists     r0   r   r   y  s,    AAj.@.@AAABBMr/   uniquec                 v    |rt          t          |                     S t          t          |                     S )zr
    Returns the count of emojis in a string.

    :param unique: (optional) True if count only unique emojis
    )rS   r   r   )r@   r   s     r0   r   r     s9      0&v..///z&!!"""r/   c                     | t           j        v S )z{
    Returns True if the string is a single emoji, and it is "recommended for
    general interchange" by Unicode.org.
    )r   rX   r   s    r0   r   r     s    
 ]---r/   c                 R    t          d t          | d          D                       S )z
    Returns True if the string contains only emojis.
    This might not imply that `is_emoji` for all the characters, for example,
    if the string contains variation selectors.
    c              3   J   K   | ]}t          |j        t                    V  d S r:   )r4   ry   r   r   s     r0   r|   zpurely_emoji.<locals>.<genexpr>  s.      XX1z!':..XXXXXXr/   T)rh   )allr   r   s    r0   r    r      s/     XXRV8W8W8WXXXXXXr/   c                    | t           j        v rt           j        |          d         S t          j        | d          }|r&|t           j        v rt           j        |         d         S g dt          dt          t          t
          f         dt          ffd}t          | |d           rd	         S t          | d
d|           rd	         S t           j        D ]!}t          | |d|           r
d	         c S "t          d          )u]  
    Returns the Emoji Version of the emoji.

    See https://www.unicode.org/reports/tr51/#Versioning for more information.
        >>> emoji.version("😁")
        0.6
        >>> emoji.version(":butterfly:")
        3

    :param string: An emoji or a text containing an emoji
    :raises ValueError: if ``string`` does not contain an emoji
    rO   r?   r   
emoji_datarF   c                 >                         |d                    dS )NrO   rP   )append)r   r   r!   s     r0   fzversion.<locals>.f  s    z#'''rr/   rQ   )ra   r!   r   rp   )r2   r!   rE   zNo emoji found in string)
r   rX   rT   r+   r   r   r   r   r5   r]   )r@   emj_coder   	lang_coder!   s       @r0   r!   r!     sM    )))'/44 .vt<<H 7H 888'1#66 GS d38n        &!R0000 qzFWbCCCC qz",  	BqIIII 	1:	 /
0
00r/   )FT)rP   rQ   )F).r;   rb   rV   systypingr   r   r   r   r   r   r	   r
   version_infotyping_extensionsr   r   r   r%   r   emoji.tokenizerr   r   r   r   r   r   __all__rU   re   r$   r   r+   floatr   boolr   r   r   r   r   r-   r   r   r    r!   r.   r/   r0   <module>r      s    
			     



 N N N N N N N N N N N N N N N N N N N Nf;;;;;;;;;;;0000000000                       $   b     y   =/ =/ =/ =/ =/ =/ =/ =/D $67I"J<@#QUa( a(a(c3ha( g789a( 	a(
 e_a( U3#tCH~1F1K(L#LMNa( 	a( a( a( a(J >B  6:e_   , $67I"J#QUJ JJc3hJ J e_	J
 U3#tCH~1F1K(L#LMNJ 	J J J J^ AC% %%3#tCH~!6!;<<=% % 		% % % %Ps t$45    $ S	    # # #T #c # # # #.S .T . . . .Y Y Y Y Y Y(1C (1E (1 (1 (1 (1 (1 (1r/   