
    ag;                         d dl Zd dlZd dlZ ej
                  d      Zej                  Z	 ddZddZ G d dej                        Z
y)	    Nbokehc           	      *   t        | t        j                  j                        rt        j                  | |f|||||d| yt        | t
        j                  j                        r | j                  |f||d| yt        dt        |             )aM  
    Saves the supplied object to file.

    This function delegates saving to `holoviews.util.save` when the
    object is a HoloViews element, which is the type of object mostly
    created by hvPlot. This function inherits the same signature and
    docstring below. However, in some cases hvPlot creates Panel objects,
    in which case saving is delegated to the method `panel.io.Viewable.save`.
    It shares a few common parameters with `holoviews.util.save`, and extra
    parameters can be passed as kwargs.

    The available output formats depend on the backend being used. By
    default and if the filename is a string the output format will be
    inferred from the file extension. Otherwise an explicit format
    will need to be specified. For ambiguous file extensions such as
    html it may be necessary to specify an explicit fmt to override
    the default, e.g. in the case of 'html' output the widgets will
    default to fmt='widgets', which may be changed to scrubber widgets
    using fmt='scrubber'.

    Arguments
    ---------
    obj: HoloViews object
        The HoloViews object to save to file
    filename: string or IO object
        The filename or BytesIO/StringIO object to save to
    fmt: string
        The format to save the object as, e.g. png, svg, html, or gif
        and if widgets are desired either 'widgets' or 'scrubber'
    backend: string
        A valid HoloViews rendering backend, e.g. bokeh or matplotlib
    resources: string or bokeh.resource.Resources
        Bokeh resources used to load bokehJS components. Defaults to
        CDN, to embed resources inline for offline usage use 'inline'
        or bokeh.resources.INLINE.
    toolbar: bool or None
        Whether to include toolbars in the exported plot. If None,
        display the toolbar unless fmt is `png` and backend is `bokeh`.
        If `True`, always include the toolbar.  If `False`, do not include the
        toolbar.
    title: string
        Custom title for exported HTML file
    **kwargs: dict
        Additional keyword arguments passed to the renderer,
        e.g. fps for animations
    )fmtbackend	resourcestoolbartitle)r   r	   z)Saving not supported for objects of type N)

isinstance_hvcoreDimensionedsave_pnlayoutPanel	TypeErrortype)objfilenamer   r   r   r   r	   kwargss           0lib/python3.12/site-packages/hvplot/utilities.pyr   r   
   s    b #sxx++,		
 		
 		
 
C))	*FYeFvFCDI=QRR    c                 0   t        | t        j                  j                        r0t	        j
                  j                  |       j                  ||fi |S t        | t        j                  j                        r | j                  ||fi |S t        d      )a  
    Displays hvplot plots in and outside the notebook

    Parameters
    ----------
    obj : HoloViews/Panel object
        HoloViews/Panel object to show
    title : str
        A string title to give the Document (if served as an app)
    port: int (optional, default=0)
        Allows specifying a specific port
    **kwargs: dict
        Additional keyword arguments passed to Panel show method.
    Returns
    -------
    a panel.io.server.Server | panel.io.server.StoppableThread (if threaded=true)
    zD{type(obj).__name__} type object not recognized and cannot be shown.)r
   r   r   r   r   pane	HoloViewsshowviewableViewable
ValueError)r   r	   portr   s       r   r   r   L   sw    $ #sxx++,xx!!#&++E4B6BB	C..	/sxxt.v.._``r   c                   r     e Zd Z ej                  dg dd      Z ej                  d      Z fdZ xZ	S )hvplot_extensionT)r   
matplotlibplotlyzF
            Plotting library used to process extra keyword arguments.)
allow_NoneobjectsdocF)defaultc                    |j                  dd       }t        |   |i | t        j                  j
                  }|dv r5||k7  r0t        j                  j                  j                  d| d| d       |t        _
        ddlm}  |        y )Ncompatibility)r#   r$   zCompatibility from z to z( not yet implemented. Defaults to bokeh.   )_patch_hvplot_docstrings)popsuper__call__r   Storecurrent_backendparammainwarningr"   r*    r,   )selfargsparamsr*   r   r,   	__class__s         r   r/   zhvplot_extension.__call__p   s     

?D9$)&)))++44M9QJJ$$%m_D	 B: : *7& 	/ "r   )
__name__
__module____qualname__r2   ObjectSelectorr*   Booleanlogor/   __classcell__)r9   s   @r   r"   r"   f   s=    (E((1IM 5=='D# #r   r"   )autoNcdnNN)Nr   )panelr   r2   	holoviewsr   rendereroutputr   r   	extensionr"    r   r   <module>rI      sK      3<< 	 SW?SDa4#s}} #r   