o
    h                     @  s6   d dl mZ d dlZG dd deZG dd dZdS )    )annotationsNc                   @  s   e Zd ZdS )JSNumberBoundsExceptionN)__name__
__module____qualname__ r   r   T/var/www/vscode/kcb/lib/python3.10/site-packages/streamlit/elements/lib/js_number.pyr      s    r   c                   @  sD   e Zd ZdZdZdZdZdZe Ze	ddddZ
e	dddZdS )JSNumberz7Utility class for exposing JavaScript Number constants.l    l gg       Nvalueint
value_name
str | NonereturnNonec                 C  sL   |du rd}|| j k rt| d| d|| jkr$t| d| ddS )a  Validate that an int value can be represented with perfect precision
        by a JavaScript Number.

        Parameters
        ----------
        value : int
        value_name : str or None
            The name of the value parameter. If specified, this will be used
            in any exception that is thrown.

        Raises
        ------
        JSNumberBoundsException
            Raised with a human-readable explanation if the value falls outside
            JavaScript int bounds.

        Nr
    (z) must be >= -((1 << 53) - 1)z) must be <= (1 << 53) - 1)MIN_SAFE_INTEGERr   MAX_SAFE_INTEGERclsr
   r   r   r   r   validate_int_bounds,   s   

zJSNumber.validate_int_boundsint | floatc                 C  sp   |du rd}t |tjtfst| d| d|| jk r't| d| d|| jkr6t| d| ddS )a  Validate that a float value can be represented by a JavaScript Number.

        Parameters
        ----------
        value : float
        value_name : str or None
            The name of the value parameter. If specified, this will be used
            in any exception that is thrown.

        Raises
        ------
        JSNumberBoundsException
            Raised with a human-readable explanation if the value falls outside
            JavaScript float bounds.

        Nr
   r   z) is not a floatz) must be >= -1.797e+308z) must be <= 1.797e+308)
isinstancenumbersIntegralfloatr   MIN_NEGATIVE_VALUE	MAX_VALUEr   r   r   r   validate_float_boundsK   s   

zJSNumber.validate_float_bounds)N)r
   r   r   r   r   r   )r
   r   r   r   r   r   )r   r   r   __doc__r   r   r   	MIN_VALUEr   classmethodr   r   r   r   r   r   r	      s    r	   )
__future__r   r   	Exceptionr   r	   r   r   r   r   <module>   s   