
    gX                        d dl mZ d dlmZ d dlmZmZ  edeee	ef            Z
 edd       G d d             Z edd       G d	 d
             Z edd       G d d             Zy)    )annotations)	dataclass)AnyNewTypeStoreT)frozeneqc                  B    e Zd ZU dZded<   ded<   ded<   ed
d       Zy	)IndexSelectionaP  
    Represents the state of an alt.selection_point() when neither the fields nor encodings arguments are specified.

    The value field is a list of zero-based indices into the
    selected dataset.

    Note: These indices only apply to the input DataFrame
    for charts that do not include aggregations (e.g. a scatter chart).
    strnamez	list[int]valuer   storec                    |g }n7|j                  di       j                  dg       }|D cg c]
  }|d   dz
   }}t        | ||      S c c}w )a  
        Construct an IndexSelection from the raw Vega signal and dataset values.

        Parameters
        ----------
        name: str
            The selection's name
        signal: dict or None
            The value of the Vega signal corresponding to the selection
        store: list
            The value of the Vega dataset corresponding to the selection.
            This dataset is named "{name}_store" in the Vega view.

        Returns
        -------
        IndexSelection
        vlPointor_vgsid_   r   r   r   )getr   )r   signalr   indicespointsps         K/var/www/openai/venv/lib/python3.12/site-packages/altair/utils/selection.py	from_vegazIndexSelection.from_vega   s\    & >GZZ	2.224<F178Aq|a'G84weDD 9s   ANr   r   r   zdict[str, dict] | Noner   r   __name__
__module____qualname____doc____annotations__staticmethodr        r   r   r      s-     ILE Er&   r   c                  B    e Zd ZU dZded<   ded<   ded<   ed
d       Zy	)PointSelectionaX  
    Represents the state of an alt.selection_point() when the fields or encodings arguments are specified.

    The value field is a list of dicts of the form:
        [{"dim1": 1, "dim2": "A"}, {"dim1": 2, "dim2": "BB"}]

    where "dim1" and "dim2" are dataset columns and the dict values
    correspond to the specific selected values.
    r   r   zlist[dict[str, Any]]r   r   r   c                j    |g n!|j                  di       j                  dg       }t        | ||      S )a  
        Construct a PointSelection from the raw Vega signal and dataset values.

        Parameters
        ----------
        name: str
            The selection's name
        signal: dict or None
            The value of the Vega signal corresponding to the selection
        store: list
            The value of the Vega dataset corresponding to the selection.
            This dataset is named "{name}_store" in the Vega view.

        Returns
        -------
        PointSelection
        r   r   r   )r   r(   )r   r   r   r   s       r   r   zPointSelection.from_vegaF   s6    & ~6::i+D+H+Hr+R4vUCCr&   Nr   r   r%   r&   r   r(   r(   6   s-     ILD Dr&   r(   c                  B    e Zd ZU dZded<   ded<   ded<   ed
d       Zy	)IntervalSelectiona  
    Represents the state of an alt.selection_interval().

    The value field is a dict of the form:
        {"dim1": [0, 10], "dim2": ["A", "BB", "CCC"]}

    where "dim1" and "dim2" are dataset columns and the dict values
    correspond to the selected range.
    r   r   zdict[str, list]r   r   r   c                &    |i }t        | ||      S )a  
        Construct an IntervalSelection from the raw Vega signal and dataset values.

        Parameters
        ----------
        name: str
            The selection's name
        signal: dict or None
            The value of the Vega signal corresponding to the selection
        store: list
            The value of the Vega dataset corresponding to the selection.
            This dataset is named "{name}_store" in the Vega view.

        Returns
        -------
        PointSelection
        r   )r+   )r   r   r   s      r   r   zIntervalSelection.from_vegam   s    & >F d&FFr&   N)r   r   r   zdict[str, list] | Noner   r   r   r%   r&   r   r+   r+   ]   s-     ILG Gr&   r+   N)
__future__r   dataclassesr   typingr   r   listdictr   r   r   r(   r+   r%   r&   r   <module>r2      s    " !  	d38n-. $4 'E 'E !'ET $4 #D #D !#DL $4 $G $G !$Gr&   