
    WhY                     f    d dl mZ d dlZd dlmZ d dlmZ d Zd Z	de
dee
   fdZ e       fd	Zy)
    )ListN)get_plotlyjs_versionc                 Z   ddl m} t        | |      r| j                         }|S t        | t              r5|r/t
        j                  j                  |       j                         }|S | }|S t        | d      r| j                         }|S t        dj                  t        |       |             )Nr   )
BaseFigureto_plotly_jsonzR
The fig parameter must be a dict or Figure.
    Received value of type {typ}: {v})typv)plotly.basedatatypesr   
isinstanceto_dictdictplotly
graph_objsFigurer   hasattr
ValueErrorformattype)figvalidater   fig_dicts       J/var/www/html/jupyter_env/lib/python3.12/site-packages/plotly/io/_utils.pyvalidate_coerce_fig_to_dictr      s    /#z";;= O 
C	((//4CCEH O H O 
&	'%%' O ))/DI)E
 	
    c                     | dk(  s| t         j                  k(  rt         j                  }|S | dk(  s#t        t         d      r%| t         j                  k(  rt         j                  }|S t	        d      )Nr   FigureWidgetzP
Invalid output type: {output_type}
    Must be one of: 'Figure', 'FigureWidget')gor   r   r   r   )output_typeclss     r   validate_coerce_output_typer       sh    h+":ii J 
	&N#r(Foo J 0
 	
r   kwargsreturnc                     t        | j                               D cg c]  }t        |t              st	        |        }}|r"t	        t        |            dkD  rt        d      |r|d   nd}| j                         D ci c]  \  }}|t        |t              s|g|z  n|  }}}t        |      D cg c])  }|j                         D ci c]  \  }}|||    c}}+ }}}}|S c c}w c c}}w c c}}w c c}}}w )a  
    Given one or more keyword arguments which may be either a single value or a list of values,
    return a list of keyword dictionaries by broadcasting the single valuesacross all the dicts.
    If more than one item in the input is a list, all lists must be the same length.

    Parameters
    ----------
    **kwargs: dict
        The keyword arguments

    Returns
    -------
    list of dicts
        A list of dictionaries

    Raises
    ------
    ValueError
        If any of the input lists are not the same length
       z-All list arguments must have the same length.r   )	tuplevaluesr   listlensetr   itemsrange)r!   r	   list_lengthslist_lengthkexpanded_kwargsilist_of_kwargss           r   broadcast_args_to_dictsr2   .   s   0 %*&--/$:RqjD>QCFRLRC-.2HII%1,q/qK
 LLNAq 	
Jq$$7A3Q>O  @E[?Q :;_2245TQAaD5N  ! S 	6s(   C*C*#C/6C;C5C;5C;c                 &    dj                  |       S )zReturn a valid plotly CDN url.z+https://cdn.plot.ly/plotly-{cdn_ver}.min.jscdn_ver)r   r4   s    r   plotly_cdn_urlr6   Y   s    8?? @  r   )typingr   r   plotly.graph_objsr   r   plotly.offliner   r   r    r   r2   r6    r   r   <module>r;      s@       /, (d (tDz (V 01 r   