Ë
    ò¦1h�1  ã                  óê   — U d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
mZ ddlZddlmZ erddlmZ ddlmZ dd	lmZmZ d
ed<   	 ddlZ G d„ de«      Zy# e$ r dZ ej0                  d«       Y Œ'w xY w)a,  Integration code for CSS selectors using `Soup Sieve <https://facelessuser.github.io/soupsieve/>`_ (pypi: ``soupsieve``).

Acquire a `CSS` object through the `element.Tag.css` attribute of
the starting point of your CSS selector, or (if you want to run a
selector against the entire document) of the `BeautifulSoup` object
itself.

The main advantage of doing this instead of using ``soupsieve``
functions is that you don't need to keep passing the `element.Tag` to be
selected against, since the `CSS` object is permanently scoped to that
`element.Tag`.

é    )Úannotations)Ú
ModuleType)ÚAnyÚcastÚIterableÚIteratorÚOptionalÚTYPE_CHECKINGN)Ú_NamespaceMapping)Ú	SoupSieve)Úelement)Ú	ResultSetÚTagúOptional[ModuleType]Ú	soupsievezEThe soupsieve package is not installed. CSS selectors cannot be used.c                  ó*  — e Zd ZdZddd„Zdd„Z	 	 	 	 	 	 dd„Zdd„Z	 	 d	 	 	 	 	 	 	 	 	 dd„Z	 	 d	 	 	 	 	 	 	 	 	 dd„Z		 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd	„Z
	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd
„Z	 	 d	 	 	 	 	 	 	 	 	 dd„Z	 	 d	 	 	 	 	 	 	 	 	 dd„Z	 	 d	 	 	 	 	 	 	 	 	 dd„Zy)ÚCSSa”  A proxy object against the ``soupsieve`` library, to simplify its
    CSS selector API.

    You don't need to instantiate this class yourself; instead, use
    `element.Tag.css`.

    :param tag: All CSS selectors run by this object will use this as
        their starting point.

    :param api: An optional drop-in replacement for the ``soupsieve`` module,
        intended for use in unit tests.
    Nc                óJ   — |€t         }|€t        d«      ‚|| _        || _        y )NzLCannot execute CSS selectors because the soupsieve package is not installed.)r   ÚNotImplementedErrorÚapiÚtag)Úselfr   r   s      úE/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/bs4/css.pyÚ__init__zCSS.__init__:   s1   € Øˆ;ÜˆCØˆ;Ü%Ø^óð ð ˆŒØˆ�ó    c                óv   — t         €t        d«      ‚t        t        | j                  j                  |«      «      S )zçEscape a CSS identifier.

        This is a simple wrapper around `soupsieve.escape() <https://facelessuser.github.io/soupsieve/api/#soupsieveescape>`_. See the
        documentation for that function for more information.
        zMCannot escape CSS identifiers because the soupsieve package is not installed.)r   r   r   Ústrr   Úescape)r   Úidents     r   r   z
CSS.escapeD   s6   € ô ÐÜ%Ø_óð ô ”C˜Ÿ™Ÿ™¨Ó/Ó0Ð0r   c                óv   — t        || j                  j                  «      s|€| j                  j                  }|S )z%Normalize a dictionary of namespaces.)Ú
isinstancer   r   r   Ú_namespaces)r   ÚnsÚselects      r   Ú_nszCSS._nsP   s2   € ô ˜& $§(¡(×"4Ñ"4Ô5¸"¸*ð —‘×%Ñ%ˆBØˆ	r   c                ó    — ddl m}  |d|«      S )a?  Normalize a list of results to a py:class:`ResultSet`.

        A py:class:`ResultSet` is more consistent with the rest of
        Beautiful Soup's API, and :py:meth:`ResultSet.__getattr__` has
        a helpful error message if you try to treat a list of results
        as a single result (a common mistake).
        r   )r   N)Úbs4r   )r   Úresultsr   s      r   Ú_rszCSS._rs[   s   € õ 	"á˜˜wÓ'Ð'r   c                ó`   —  | j                   j                  || j                  ||«      |fi |¤ŽS )a  Pre-compile a selector and return the compiled object.

        :param selector: A CSS selector.

        :param namespaces: A dictionary mapping namespace prefixes
           used in the CSS selector to namespace URIs. By default,
           Beautiful Soup will use the prefixes it encountered while
           parsing the document.

        :param flags: Flags to be passed into Soup Sieve's
            `soupsieve.compile() <https://facelessuser.github.io/soupsieve/api/#soupsievecompile>`_ method.

        :param kwargs: Keyword arguments to be passed into Soup Sieve's
           `soupsieve.compile() <https://facelessuser.github.io/soupsieve/api/#soupsievecompile>`_ method.

        :return: A precompiled selector object.
        :rtype: soupsieve.SoupSieve
        )r   Úcompiler%   ©r   r$   Ú
namespacesÚflagsÚkwargss        r   r+   zCSS.compileh   s/   € ð2  ˆt�x‰x×Ñ ¨¯©°¸VÓ(DÀeÑVÈvÑVÐVr   c                óv   —  | j                   j                  || j                  | j                  ||«      |fi |¤ŽS )aÁ  Perform a CSS selection operation on the current Tag and return the
        first result, if any.

        This uses the Soup Sieve library. For more information, see
        that library's documentation for the `soupsieve.select_one() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect_one>`_ method.

        :param selector: A CSS selector.

        :param namespaces: A dictionary mapping namespace prefixes
           used in the CSS selector to namespace URIs. By default,
           Beautiful Soup will use the prefixes it encountered while
           parsing the document.

        :param flags: Flags to be passed into Soup Sieve's
            `soupsieve.select_one() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect_one>`_ method.

        :param kwargs: Keyword arguments to be passed into Soup Sieve's
           `soupsieve.select_one() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect_one>`_ method.
        )r   Ú
select_oner   r%   r,   s        r   r1   zCSS.select_oneƒ   s=   € ð4 #ˆt�x‰x×"Ñ"Ø�D—H‘H˜dŸh™h z°6Ó:¸Eñ
ØEKñ
ð 	
r   c           
     óž   — |€d}| j                   | j                  j                  || j                  | j	                  ||«      ||fi |¤Ž«      S )aÙ  Perform a CSS selection operation on the current `element.Tag`.

        This uses the Soup Sieve library. For more information, see
        that library's documentation for the `soupsieve.select() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect>`_ method.

        :param selector: A CSS selector.

        :param namespaces: A dictionary mapping namespace prefixes
            used in the CSS selector to namespace URIs. By default,
            Beautiful Soup will pass in the prefixes it encountered while
            parsing the document.

        :param limit: After finding this number of results, stop looking.

        :param flags: Flags to be passed into Soup Sieve's
            `soupsieve.select() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect>`_ method.

        :param kwargs: Keyword arguments to be passed into Soup Sieve's
           `soupsieve.select() <https://facelessuser.github.io/soupsieve/api/#soupsieveselect>`_ method.
        r   )r)   r   r$   r   r%   ©r   r$   r-   Úlimitr.   r/   s         r   r$   z
CSS.select¡   sS   € ð8 ˆ=ØˆEà�x‰xØˆD�H‰H�O‰OØ˜Ÿ™ $§(¡(¨:°vÓ">ÀÀuñØPVñó
ð 	
r   c                óx   —  | j                   j                  || j                  | j                  ||«      ||fi |¤ŽS )aU  Perform a CSS selection operation on the current `element.Tag`.

        This uses the Soup Sieve library. For more information, see
        that library's documentation for the `soupsieve.iselect()
        <https://facelessuser.github.io/soupsieve/api/#soupsieveiselect>`_
        method. It is the same as select(), but it returns a generator
        instead of a list.

        :param selector: A string containing a CSS selector.

        :param namespaces: A dictionary mapping namespace prefixes
            used in the CSS selector to namespace URIs. By default,
            Beautiful Soup will pass in the prefixes it encountered while
            parsing the document.

        :param limit: After finding this number of results, stop looking.

        :param flags: Flags to be passed into Soup Sieve's
            `soupsieve.iselect() <https://facelessuser.github.io/soupsieve/api/#soupsieveiselect>`_ method.

        :param kwargs: Keyword arguments to be passed into Soup Sieve's
           `soupsieve.iselect() <https://facelessuser.github.io/soupsieve/api/#soupsieveiselect>`_ method.
        )r   Úiselectr   r%   r3   s         r   r6   zCSS.iselectÆ   s?   € ð>  ˆt�x‰x×ÑØ�D—H‘H˜dŸh™h z°6Ó:¸EÀ5ñ
ØLRñ
ð 	
r   c                óv   —  | j                   j                  || j                  | j                  ||«      |fi |¤ŽS )aÅ  Find the `element.Tag` closest to this one that matches the given selector.

        This uses the Soup Sieve library. For more information, see
        that library's documentation for the `soupsieve.closest()
        <https://facelessuser.github.io/soupsieve/api/#soupsieveclosest>`_
        method.

        :param selector: A string containing a CSS selector.

        :param namespaces: A dictionary mapping namespace prefixes
            used in the CSS selector to namespace URIs. By default,
            Beautiful Soup will pass in the prefixes it encountered while
            parsing the document.

        :param flags: Flags to be passed into Soup Sieve's
            `soupsieve.closest() <https://facelessuser.github.io/soupsieve/api/#soupsieveclosest>`_ method.

        :param kwargs: Keyword arguments to be passed into Soup Sieve's
           `soupsieve.closest() <https://facelessuser.github.io/soupsieve/api/#soupsieveclosest>`_ method.

        )r   Úclosestr   r%   r,   s        r   r8   zCSS.closesté   s=   € ð8  ˆt�x‰x×ÑØ�D—H‘H˜dŸh™h z°6Ó:¸Eñ
ØEKñ
ð 	
r   c                ó’   — t        t         | j                  j                  || j                  | j                  ||«      |fi |¤Ž«      S )aÇ  Check whether or not this `element.Tag` matches the given CSS selector.

        This uses the Soup Sieve library. For more information, see
        that library's documentation for the `soupsieve.match()
        <https://facelessuser.github.io/soupsieve/api/#soupsievematch>`_
        method.

        :param: a CSS selector.

        :param namespaces: A dictionary mapping namespace prefixes
            used in the CSS selector to namespace URIs. By default,
            Beautiful Soup will pass in the prefixes it encountered while
            parsing the document.

        :param flags: Flags to be passed into Soup Sieve's
            `soupsieve.match()
            <https://facelessuser.github.io/soupsieve/api/#soupsievematch>`_
            method.

        :param kwargs: Keyword arguments to be passed into SoupSieve's
            `soupsieve.match()
            <https://facelessuser.github.io/soupsieve/api/#soupsievematch>`_
            method.
        )r   Úboolr   Úmatchr   r%   r,   s        r   r;   z	CSS.match	  sF   € ô> ÜØˆD�H‰H�N‰NØ˜Ÿ™ $§(¡(¨:°vÓ">ÀñØIOñó
ð 	
r   c           
     ó”   — | j                   | j                  j                  || j                  | j	                  ||«      |fi |¤Ž«      S )aN  Filter this `element.Tag`'s direct children based on the given CSS selector.

        This uses the Soup Sieve library. It works the same way as
        passing a `element.Tag` into that library's `soupsieve.filter()
        <https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_
        method. For more information, see the documentation for
        `soupsieve.filter()
        <https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_.

        :param namespaces: A dictionary mapping namespace prefixes
            used in the CSS selector to namespace URIs. By default,
            Beautiful Soup will pass in the prefixes it encountered while
            parsing the document.

        :param flags: Flags to be passed into Soup Sieve's
            `soupsieve.filter()
            <https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_
            method.

        :param kwargs: Keyword arguments to be passed into SoupSieve's
            `soupsieve.filter()
            <https://facelessuser.github.io/soupsieve/api/#soupsievefilter>`_
            method.
        )r)   r   Úfilterr   r%   r,   s        r   r=   z
CSS.filter/  sG   € ð> �x‰xØˆD�H‰H�O‰OØ˜Ÿ™ $§(¡(¨:°vÓ">ÀñØIOñó
ð 	
r   )N)r   zelement.Tagr   r   )r   r   Úreturnr   )r#   úOptional[_NamespaceMapping]r$   r   r>   r?   )r(   zIterable[Tag]r>   zResultSet[Tag])Nr   )
r$   r   r-   r?   r.   Úintr/   r   r>   r   )
r$   r   r-   r?   r.   r@   r/   r   r>   zelement.Tag | None)Nr   r   )r$   r   r-   r?   r4   r@   r.   r@   r/   r   r>   úResultSet[element.Tag])r$   r   r-   r?   r4   r@   r.   r@   r/   r   r>   zIterator[element.Tag])
r$   r   r-   r?   r.   r@   r/   r   r>   zOptional[element.Tag])
r$   r   r-   r?   r.   r@   r/   r   r>   r:   )
r$   r   r-   r?   r.   r@   r/   r   r>   rA   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r%   r)   r+   r1   r$   r6   r8   r;   r=   © r   r   r   r   ,   s  „ ñôó
1ð	Ø-ð	Ø7:ð	à	$ó	ó(ð  37Øð	WàðWð 0ðWð ð	Wð
 ðWð 
óWð< 37Øð	
àð
ð 0ð
ð ð	
ð
 ð
ð 
ó
ðB 37ØØð#
àð#
ð 0ð#
ð ð	#
ð
 ð#
ð ð#
ð 
 ó#
ðP 37ØØð!
àð!
ð 0ð!
ð ð	!
ð
 ð!
ð ð!
ð 
ó!
ðL 37Øð	
àð
ð 0ð
ð ð	
ð
 ð
ð 
ó
ðF 37Øð	$
àð$
ð 0ð$
ð ð	$
ð
 ð$
ð 
ó$
ðR 37Øð	#
àð#
ð 0ð#
ð ð	#
ð
 ð#
ð 
 ô#
r   r   )rE   Ú
__future__r   Útypesr   Útypingr   r   r   r   r	   r
   ÚwarningsÚbs4._typingr   r   r   r'   r   Úbs4.elementr   r   Ú__annotations__ÚImportErrorÚwarnÚobjectr   rF   r   r   ú<module>rQ      ss   ðòõ #å ÷÷ ó Ý )áÝ#Ýß*àÓ ðÛôf
ˆ&õ f
øð ò Ø€IØ€H‡M�MØOöðús   ÁA ÁA2Á1A2