
    Be                       d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
mZmZmZmZmZmZ ddlZddlmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZm Z  ddl!m"Z"m#Z#m$Z$m%Z% ddl&m'Z'm(Z( ddl)m*Z* ddl+m,Z,m-Z-m.Z. ddl/m0Z0m1Z1 ddl2m3Z3 e
rddl4m5Z5 ddl6m7Z7 ddl8m9Z9  G d de,          Z: G d de,          Z;d Z<d Z=d Z>d Z?e(j@        A                    e?           e(j@        A                    e>           d  ZB eeB           dS )!zv
HoloViews integration for Panel including a Pane to render HoloViews
objects and their widgets and support for Links
    )annotationsN)OrderedDictdefaultdict)partial)TYPE_CHECKINGAnyClassVarMappingOptionalTupleType)Range1dSpacer)Theme)Version)register_reference_transform)bind   )stateunlocked)ColumnHSpacerRow	WidgetBox)
LayoutableViewable)Player   )PaneBaseRerenderErrorpanel)Bokeh
Matplotlib)Plotly)Document)Model)Commc                      e Zd ZU dZ ej        dg dd          Z ej        dd          Z ej        d	d
          Z	 ej
        dd          Z ej        deefd	d          Z ej        dg dd          Z ej        eeegd	ed          Z ej        dddgd          Z ej        i d          ZdZded<   edd	feddfedd	feddfedd	fedd	fed dfed!dfedd	fed d	feddfed!dfd"Zeeed#Zd$ed%<   dddddddddd&	Zd'ed(<   d)d*gZ d+Z!dV fd,	Z"dW fd1Z# ej$        d*d	d	2          d3             Z%e&d4             Z' ej$        d5d6d	7          d8             Z( ej$        d9d	7          d:             Z) ej$        d)d	7          d;             Z* ej$        d<d=d	7          d>             Z+d? Z,d@ Z-dA Z.dB Z/	 	 dXdYdKZ0dL Z1dM Z2dVdZ fdOZ3e4d[dS            Z5d\dTZ6e7j6        j        e6_        e4d]dU            Z8 xZ9S )^	HoloViewsal  
    `HoloViews` panes render any `HoloViews` object using the
    currently selected backend ('bokeh' (default), 'matplotlib' or 'plotly').

    To be able to use the `plotly` backend you must add `plotly` to
    `pn.extension`.

    Reference: https://panel.holoviz.org/reference/panes/HoloViews.html

    :Example:

    >>> HoloViews(some_holoviews_object)
    N)bokehplotly
matplotlibzu
        The HoloViews backend used to render the plot (if None defaults
        to the currently selected renderer).)defaultobjectsdocFz$
        Whether to center the plot.)r-   r/   Tz`
        Whether to link the axes of bokeh plots inside this pane
        across a panel layout.zk
        Explicit renderer instance to use for rendering the HoloViews
        plot. Overrides the backend.z4
        Bokeh theme to apply to the HoloViews plot.)r-   class_
allow_Noner/   	right_top)leftbottomrighttoptop_left	top_rightbottom_leftbottom_rightleft_topleft_bottomr2   right_bottomz~
        The layout of the plot and the widgets. The value refers to the
        position of the widgets relative to the plot.z5
        The layout object to display the widgets in.)r.   constantr-   r/   
individualscrubberzb)
        Whether to generate individual widgets for each dimension or
        on global scrubber.zw
        A mapping from dimension name to a widget instance which will
        be used to override the default widgets.皙?ClassVar[float | bool | None]priority)startcenter)endrE   )rE   rD   )rE   rF   rD   )rF   rD   )rD   rF   rF   )r3   r5   r6   r4   r7   r8   r9   r:   r;   r<   r2   r=   )r*   r,   r+   z&ClassVar[Mapping[str, Type[PaneBase]]]_panes)	backendrE   linked_axesrendererthemewidgetswidget_layoutwidget_locationwidget_typez"ClassVar[Mapping[str, str | None]]_renameobjectrH   )	
backgroundcss_classesmarginnamesizing_modewidthheight	max_width
max_heightc                    d _         d  _        d  _        d  _         t	                      j        |fi |                                   _        g  _        i  _	        d _
         fd|                                D              _         j                             j         j                  } j                            |                                                                               d _         d S )NFc                b    g | ]+\  }}|t           j        v |j        |         j        k    )|,S  )r   paramr-   ).0pvselfs      4lib/python3.11/site-packages/panel/pane/holoviews.py
<listcomp>z&HoloViews.__init__.<locals>.<listcomp>   sH     
 
 
!QJ$$$djm.C)C)C )C)C)C    T)_initialized_height_responsive_width_responsive_restore_plotsuper__init__rM   
widget_box_widget_container_plots_syncing_propsitems
_overridesr^   watch_update_widgets_rerender_params_internal_callbacksappend_update_responsive)rb   rQ   paramswatcher	__class__s   `   rc   rk   zHoloViews.__init__   s   !"&!%!**6***,,..!##
 
 
 
 ,,..
 
 
 *""4#79NOO ''000!!! re   eventsparam.parameterized.EventreturnNonec                      j         rd S   j        d |D                t                      j         fd|D               d S )Nc              3  @   K   | ]}|j         t          j        v |V  d S N)rU   r   r^   r_   es     rc   	<genexpr>z*HoloViews._param_change.<locals>.<genexpr>   s1      PPaQVz?O5O5O5O5O5O5OPPre   c              3  @   K   | ]}|j         j        d gz   v |V  dS )rS   N)rU   rq   )r_   r   rb   s     rc   r   z*HoloViews._param_change.<locals>.<genexpr>   s9      __aQVtP]?^5^5^5^5^5^5^__re   )_object_changing_track_overridesrj   _param_change)rb   r{   rz   s   ` rc   r   zHoloViews._param_change   sb      	FPP6PPPQQ____6___````re   )rr   on_initc                    ddl m}m} | j        r4| j        |j        vr(|j        | j                 }t          d|            d S d S d S )Nr   )Store	extensionzholoviews.plotting.)	holoviewsr   r   rH   	renderers	_backends
__import__)rb   r   r   exts       rc   _load_backendzHoloViews._load_backend   sn    ........< 	4DL??%dl3C2S2233333	4 	4??re   c                T    | j         r
| j        rd}n| j         rd}n| j        rd}nd }|S )Nstretch_bothstretch_widthstretch_height)rh   rg   )rb   smodes     rc   _layout_sizing_modezHoloViews._layout_sizing_mode   sL    ! 	d&= 	"EE# 	#EE$ 	$EEEre   rE   rN   )rr   c                    | j         }| j        o| j         }| j        |         \  }}}|| j        _        | j        | _        | j        }|s|rdn|}t          | j                  s=|rt                      | t                      g}n| g}|| j
        d d <   || j
        _        d S |r	| j        | fn| | j        f}	d|i}
|s#| j        |u rt          |	          }n ||	i |
g}n|t          u r$t                       ||	i |
t                      g}n\|                    d          r$| j        t                      | t                      g}n#t                      | t                      | j        g}|| j
        d d <   || j
        _        d S )Nr   rV   r3   )rN   rE   rh   _alignmentsrl   alignrm   r   lenr   layoutrV   default_layoutlistr   
startswith)rb   locrE   r   r   widget_firstr   layout_smode
componentsrp   kwargss              rc   _update_layoutzHoloViews._update_layout   s   ";T%;!;&*&6s&;#| %!%(.3IIE4?## 	 $%iiwyy9

"V
'DKN&2DK#F+7T$''dDO=T' 
	G"f,,!%[[

$fe6v667

v!))VVU%=f%=%=wyyIJJ^^F## 	G/799dGIIFJJ!))T799doFJ#AAA".re   rK   c                    | j         d S | j                                        D ]\  }}|j        r| j         |j        _         d S r   )rK   _modelsvaluesdocument)rb   r{   model_s       rc   _update_themezHoloViews._update_theme   sQ    :F,--// 	2 	2JUA~ 2'+z$	2 	2re   c                   ddl m}m} ddlm} | j        }t          ||          rdd|j        v r|j        o|j	         }|j        o|j
         }n,d|j        v r|j        }|rd|v pd|v }d|v pd|v }n	d	x}}nd	x}}|| _        || _        d S t          ||          r|j        n|}||j        sd S | j        p|j        }| j        p|j        |         }	|j                            d
|          j        }
|	                    |          }|dk    rd	x| _        | _        d S |dk    rX|
                    dd           }|
                    dd           }|
                    dd           }|o| | _        |o| | _        d S d|j        v rC|
                    d          }|rd|v pd|v | _        d|v pd|v | _        d S d	| _        d	| _        d S |
                    dd           }|
                    dd           }|
                    dd           }|
                    dd           }|
                    dd           }|o| o| | _        |o| o| | _        d S )Nr   )HoloMapr   Plot
responsiverV   _width_both_heightFplot)rH   r,   r+   rW   rX   frame_widthframe_height)r   r   r   holoviews.plottingr   rQ   
isinstancer^   r   rW   rX   rV   rh   rg   lastr   rH   current_backendrJ   optsgetr   plotting_class)rb   r   r   r   objwresponsivehresponsivemoderH   rJ   r   plot_clsr   rW   rX   r   r   s                    rc   rw   zHoloViews._update_responsive   s   ,,,,,,,,++++++kc4   	sy((!n>SY!n?SZ#)++ 6"*d"2"EgoK"+t"3"Fw$KK055K++,11k%0D"&1D#F$S'22;chh;eo;F,7%"7=<EOG$<x||FG|44;**3//l""?DDD"T%<%<%<  ,55JHHWd++EXXh--F%/%=ID"&0&?ZD###hn,,88M**D 0)1T)9)LW_&*3t*;*Nw$''').&*/''',55JHHWd++E((=$77KXXh--F88ND99L%/%QI%Qk/D"&0&TZ&TDTD###re   rO   rL   c                T   | j         g g }}n)|                     | j         | j        | j                  \  }}|| _        t          | j                  D ]N}|j        | j        j	        v r9|j        j
                            |           | j                            |           O|D ]<}|j
                            | j        d          }| j                            |           =|| j        d d <   |r| j        | j        vs|s| j        | j        v s| j        s|                                  d S d S )Nvalue)rQ   widgets_from_dimensionsrL   rO   _valuesr   ru   instrl   r.   r^   unwatchremoverr   _widget_callbackrv   rm   rf   r   )rb   r{   rL   r   cbwidgetry   s          rc   rs   zHoloViews._update_widgets  sS   ; "VGG"::T\4+;= =OGV t/00 	4 	4Bw$/111%%b)))(//333  	5 	5Fl(()>HHG$++G4444$ 	"0FFF G!_0FFF! G!!!!! GFre   c                   ddl m}m} | j        j        }|sd S | j        dk    r9 |d | j                                        D             |d         j                  ndt          d |D                       |j
        rDd |D             fd|j        D              |t                    |j        |j                  |j        dk    r|j        st          j        |j                  rjt%                      5  |                               d d d            n# 1 swxY w Y   |j        r$d	|j        j        vr|                                 d S d S d S |j        j        r/|j                            t3          |j                             d S |                               d S |                               t5          |j        d
          r!|j                            |          |_        d S |j        |_        d S )Nr   )cross_indexwrap_tuple_streamsr@   c                    g | ]}|S r]   r]   r_   ra   s     rc   rd   z*HoloViews._update_plot.<locals>.<listcomp>3  s    @@@Qq@@@re   c              3  $   K   | ]}|j         V  d S r   )r   r_   ws     rc   r   z)HoloViews._update_plot.<locals>.<genexpr>5  s$      11A111111re   c                    g | ]	}|j         
S r]   rU   r   s     rc   rd   z*HoloViews._update_plot.<locals>.<listcomp>7  s    777!qv777re   c                R    g | ]#}|v r                     |                   nd $S r   )index)r_   kdimkeywidget_dimss     rc   rd   z*HoloViews._update_plot.<locals>.<listcomp>8  sL     4 4 4 8<{7J7Js;,,T2233PT 4 4 4re   r*   embeddedget_plot_state)holoviews.core.utilr   r   rl   r.   rO   r   r   r   tupledynamic
dimensionsstreamsrH   commr   
_unblockedr   r   updateroottagspushsession_contextadd_next_tick_callbackr   hasattrrJ   r   rQ   )rb   r   paner   r   rL   r   r   s         @@rc   _update_plotzHoloViews._update_plot,  su   GGGGGGGG/) 
	TF+++@@$,*=*=*?*?@@@'!*BRSSCC1111111C| T77w7774 4 4 4 4#'?4 4 4((sT_dlSS<7""y 	%E,T];; 	%ZZ % %KK$$$% % % % % % % % % % % % % % %9  49>!A!AIIKKKKK   !A!A =0 %M88c9R9RSSSSSKK$$$$$KKt}&677 )"m::4@@ #js   <DD"%D"c                v    | j                                         D ]\  }\  }}|                     ||           d S r   )rn   rp   r   )rb   eventr   r   r   s        rc   r   zHoloViews._widget_callbackO  sJ    #{0022 	* 	*OA|ddD))))	* 	*re   c                   | j         rd S t          | j                  }|D ]`}|j        |v r;| j        |j                 j        |j        k    r|                    |j                   F|                    |j                   a|| _        d S r   )	ro   r   rq   rU   r^   r-   newr   rv   )rb   r{   	overridesr   s       rc   r   zHoloViews._track_overridesS  s     	F))	 	) 	)Av""tz!&'9'AQU'J'J  ((((  ((((#re   c                4    |j         }|j        j        }|dk    r|j        |j        |j        d}nB|dk    rd d d d}n5|dk    r/ |j        di                               d          rd}nd }|d d d}d _        	  j        	                     fd	|
                                D                        |dk    r
	 d
 _        d S |j                                          fd j        D             }|r |j         j	        di | d
 _        d S # d
 _        w xY w)Nr*   )rV   rW   rX   r,   r+   configr   r   Tc                .    i | ]\  }}|j         v||S r]   )rq   )r_   kra   rb   s      rc   
<dictcomp>z/HoloViews._sync_sizing_mode.<locals>.<dictcomp>y  s+    [[[1!4?BZBZq!BZBZBZre   Fc                :    i | ]}|v |t          |          S r]   getattr)r_   o
plot_propsrb   s     rc   r   z/HoloViews._sync_sizing_mode.<locals>.<dictcomp>}  s6       ()
?? 74##"??re   r]   )r   rJ   rH   rV   rW   rX   r   ro   r^   r   rp   
propertiesrq   )rb   r   r   rH   rx   rV   propsr   s   `      @rc   _sync_sizing_modezHoloViews._sync_sizing_mode^  s   
-'g$0, FF
 $$# FF
   uy2&&**<88 #,"* F
 #	(J[[[[[[[\\\'!! #(D ..00J    -1_  E  +!
!**E***"'D%D''''s   <>D AD 	Dr/   r%   r   Optional[Model]parentr   Optional[Comm]r&   c                   ddl m} ||                     ||          S |j        d         }| j        t                      }||f| j        |<   |S | j        | j        }d | _        n4t          | j        |          r| j        }n| 	                    |||          }| |_
        |j        j        }	|j                            |          }
|                     |           | j        dvo| j         }| j        o	|o| j         }|rK|                                  d| _        |                                  || _        t+          | j                  | j        |                                  | j        }| j        o| j         }| j        |         \  }}}| j        }|s|rdn|}|| j        _        t7          | j                  rQ|s| j        |ur|| j        d         _        n3|t<          u r*t7          | j                  dk    r|| j        d	         _        d
 | j                                         !                                D             }| j        r7| j        "                    d          s| j        "                    d          r|d= | j        r7| j        "                    d          s| j        "                    d          r|d=  | j#        |	|
fi |}| $                    ||           |%                    ||||          }|| j&        v r+| j&        |         \  }}d |_'        |(                                 ||f| j&        |<   ||f| j        |<   |S )Nr   r   id)fixedNT)r   r      r   c                B    i | ]\  }}|t           j        v |d k    ||S r   )r   r^   )r_   r`   ra   s      rc   r   z(HoloViews._get_model.<locals>.<dictcomp>  s;     < < <41a****qF{{ Q/:{{re   rW   bothrX   ))holoviews.plotting.plotr   get_rootrefrQ   	_BkSpacerr   ri   r   _renderr   rJ   rH   r   r  rV   rW   rE   rh   rw   r   r    r   rg   rN   r   r   r   rl   r   r   r^   r   rp   endswith	_get_paner   
_get_modelrn   r   cleanup)rb   r/   r   r  r   r   r  r   r   rH   r   r   force_widthr   rE   r   r   r   r   r   
child_paneold_plotold_panes                          rc   r  zHoloViews._get_model  s    	100000<==d+++htn;KKE!&DLL)%D!%DT** 	1;DD<<T400D	-',,T22
 	t$$$%_<OTZ
{PzP$:P6P 	7##%%%%)D"!!!!%Dt{3333$,##%%%&C[?)?%?F+C0LFAq,E27MFM??L&2DK#4?## 7 7*&885:A2v%%#dk*:*:a*?*?16DKN.< <4:#4#4#6#6#<#<#>#> < < < 	 !1!:!:7!C!C 	 tGWG`G`agGhGh 	 w 	!!1!:!:8!D!D 	!HXHaHabhHiHi 	!x #T^GU==f==
$
+++%%c4>>$+!%S!1Hh HM *-C"FOSre   c                    | j                             |t                    }t          |t                    r4t          |t                    rd|d<   t          |t                    rd|d<    ||fi |S )NTtightFautodispatch)rG   r   r!   r   type
issubclassr#   r"   )rb   rH   r   r   	pane_types        rc   r  zHoloViews._get_pane  sx    KOOGU33	i&& 	/)Z00 '"&w)U++ /).~&y))&)))re   c                   dd l }ddl m}m} | j        r| j        }|j        }n=|j        s| j        pd}	 ||	           |	|_        | j        p|j        }|j        |         }|dnd}
|dk    ri }| j        | j        |d<   nR|j        r&t          |j        d          di ik    r|j        |d<   n%| j        j        j	        r| j        j        j	        |d<   |
|j
        k    r|
|d	<   |r |j        di |}d
| j        i}|dk    s2t          t          |j                            t          d          k    r||d<   ||d<   |r||d<    |j        | j        fi |S )Nr   )r   rJ   r*   serverr-   rK   _jsonattrsr   rT   z1.13.0r/   r   r   r]   )r   r   rJ   rH   r   r   rK   r   _designbokeh_themer   instancerT   r   str__version__get_plotrQ   )rb   r/   r   r   hvr   load_rendererrJ   rH   loaded_backendr   rx   r   s                rc   r  zHoloViews._render  s   >>>>>>>>= 		0}H&GG? 7"&,"9'n---(6%l;e&;Gw/H<xxYgFz%"&*w Awsy'::wmKK"%)w#/ A"&,"4"@wx}$$!%v 7,8,66v66DK(gR^)<)<!=!=ARAR!R!RF5M!F6N &!%v x 77777re   Model | Nonec                    |rV| j                             |j        d         d          \  }}|r|                                 |r|                    |           t                                          |           dS )zr
        Traverses HoloViews object to find and clean up any streams
        connected to existing plots.
        r  NNN)rn   popr  r  _cleanuprj   )rb   r   r  r  rz   s       rc   r/  zHoloViews._cleanup  s    
  	(!%$!N!NHh #  """ (!!$'''re   r   r   float | bool | Nonec                ^    dt           j        vrdS ddlm} ddlm} t          |||f          S )Nr   Fr   )Dimensionedr   )sysmodulesholoviews.core.dimensionr2  r  r   r   )clsr   r2  r   s       rc   applieszHoloViews.applies  sM    ck))5888888000000#T2333re   c                    |r|rt          d          |s|st          d          |i }ddlm}  || |||||          S )Nz^Either supply a set of properties to link as keywords or a set of JS code callbacks, not both.zFDeclare parameters to link or a set of callbacks, neither was defined.r   Link)r   codeargsbidirectional)
ValueErrorlinksr:  )rb   targetr;  r<  r=  r?  r:  s          rc   jslinkzHoloViews.jslink  s     	@T 	@ 4 5 5 5  	@t 	@ ? @ @ @<D      tD&UD"/1 1 1 	1re   c           
     	  ()*+ ddl m}m} ddlm} ddlm} ddlm(m	*m
} ddlm}	m}
 ddlm} dd	lm}m}m}m}m}m} |i }t/          ||	          r|j        }nt/          ||
          r|j        }t/          ||          rL|j        rEd
                    d |j        D                       }d} ||                    |                     ||          \  }} ||          \  }}| |d          gk    r|dgk    s|st;          |          dk    rg i fS d}|ri n#t=          t?          |t?          |                     +tA                      }g }+fd|D             }tC          |          D ][\  })d d i }}}|dk    rI|dk    r|t;          |          dz
  k    rd}n$|dk    rd}n|t;          |          dz
  k    rd}nd}|dd}ni })j"        p+#                    )d           } | tI           ||                     } | |)j%        <   |dk    r$| stM          d          |t;          |           z  }nۉ)j%        |v r|)j%                 }t/          ||          r< |j'        j(        d(i | |j%        s)j)        |_%        |*                    |           *t/          |t<                    r&|#                    d|          }t=          |          }n>t/          |tV                    rtY          ||          r|}ntM          d)d|d          |(                    |           | rt[          (*fd| D                       rRt;          |           dk    r?t]          |           } )fd | D             }!tA          t?          |!|                     }"|p|}ntI          |           }"|p|})j/        | d         n)j/        }#)j0        }$t=          t=          |$|"|#!          fi |} |d(i |}nƉ)j1        d"k    r)j1        \  }%}&|%|&k    r)j/        |%n)j/        }#|nTt[          d# |%|&|#fD                       r|})j2        dn)j2        }'n%t/          |#(          r|}n|})j2        d$n)j2        }'t=          t=          |')j)        )j1        d         )j1        d         |#%          fi |} |d(i |}||*                    |           ]|dk    rtg          |d&'          g}||fS ))Nr   )	Dimension
DynamicMap)SkipRendering)unique_dimkeys)datetime_types	isnumericunique_iterator)GenericCompositePlotr   )get_dynamic_moder   )DatetimeInputDiscreteSliderFloatSlider	IntSliderSelectWidgetz, c              3      K   | ]	}d |z  V  
dS )z%rNr]   )r_   dims     rc   r   z4HoloViews.widgets_from_dimensions.<locals>.<genexpr>A  s&      DDCTCZDDDDDDre   zDynamicMap cannot be displayed without explicit indexing as {dims} dimension(s) are unbounded. 
Set dimensions bounds with the DynamicMap redim.range or redim.values methods.)dimsFramer   r   c                b    g | ]+}                     |          |j        s|j        dk    )|,S )Nr-  )r   r   range)r_   dr   s     rc   rd   z5HoloViews.widgets_from_dimensions.<locals>.<listcomp>R  sH     5 5 5a6::a==#< $=G|33 333re   r?   )   rZ  rZ  rZ  )rZ  rZ     rZ  )r[  rZ  rZ  rZ  )r   rZ  r[  rZ     )rT   rW   r@   zAScrubber widget may only be used if all dimensions define values.r  zFExplicit widget definitions expected to be a widget instance or type, z dimension widget declared as .c              3  N   K   | ]} |          pt          |          V   d S r   )r   )r_   ra   rG  rH  s     rc   r   z4HoloViews.widgets_from_dimensions.<locals>.<genexpr>  s:      SSyy||Dz!^'D'DSSSSSSre   c                T    g | ]$}t                              |                    %S r]   )r%  pprint_value)r_   ra   rS  s     rc   rd   z5HoloViews.widgets_from_dimensions.<locals>.<listcomp>  s/    EEE1c#"2"21"5"566EEEre   )rU   optionsr   r-  c              3  @   K   | ]}t          |t                    V  d S r   )r   intr   s     rc   r   z4HoloViews.widgets_from_dimensions.<locals>.<genexpr>  s,      KKAs++KKKKKKre   g?)steprU   rD   rF   r   i&  )lengthrW   r]   )4holoviews.corerC  rD  holoviews.core.optionsrE  holoviews.core.traversalrF  r   rG  rH  rI  r  rJ  r   holoviews.plotting.utilrK  rL   rL  rM  rN  rO  rP  rQ  r   r   hmap	unboundedjoinformatr   dictzipr   	enumerater   r   r   rU   r>  r^   r   labelrv   r  r  allsortedr-   pprint_labelrX  rd  r   ),r6  rQ   widget_typeswidgets_typerC  rD  rE  rF  rI  rJ  r   rK  rL  rM  rN  rO  rP  rQ  rT  msgr   boundedkeysnframes
dim_valuesrL   irO   r   widget_kwargsrT   r   valslabelsra  r-   widget_namerD   rF   rd  rG  rS  rH  r   s,                                           @@@@rc   r   z!HoloViews.widgets_from_dimensions(  s   88888888888888;;;;;;	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	GFFFFFFF<<<<<<	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	
 	

 Lf233 	!]FF%% 	![Ffj)) 	7f.> 	799DD63CDDDDDD.C  -


 5 5666++F33#^F++
dii(()))dtfnn /= YY!^^r6M?DT3:)>)>$?$? ]]
5 5 5 54 5 5 5  oo M	' M	'FAs15tRK|++66aCIIaK00-FF!VV,FF3t99Q;'',FF+F$*S99:6C!6!6DOOD1122#'Jsx z)) j$%hiii3t99$\))%ch/ff-- 4'FL'11&111!; 0&)iNN6***-- 	4"(**V["A"AK$(LLMM-- 4*VV2L2L 4"(KK$* '*cc666&3 4 4 4   ((( 6SSSSSdSSSSS 8X[\`XaXadeXeXe!$<<DEEEEEEEF)#fd*;*;<<G"-"?KK"4jjG"-"7K%([%8$q''ck!. $T{GSZ%[%[%[ m m_l m m$55}55l** Y
sC<<#&;#6%%CK*KKeS'5JKKKKK A"+K # 011chDD88 A"/KK"-K"%("233D $Tt#)39UV<.1il'&K &K &K !6 !6'4!6 !6 %55}55!v&&&:%%WC8889G
""re   r   )r{   r|   r}   r~   NNN
r/   r%   r   r  r  r  r   r  r}   r&   r   r+  r}   r~   )r   r   r}   r0  )NNF)Nr?   ):__name__
__module____qualname____doc__r^   ObjectSelectorrH   BooleanrE   rI   	ParameterrJ   ClassSelectorr   r%  rK   rN   r   r   r   rM   rO   DictrL   rC   __annotations__r   r"   r#   r$   rG   rP   rt   _skip_layoutablerk   r   dependsr   propertyr   r   r   rw   rs   r   r   r   r  r  r  r  r/  classmethodr7  rA  r   r   __classcell__rz   s   @rc   r)   r)   '   s          #e"??? F01 1 1G
 U]5 /' ( ( (F  %- 3" # # #K ut 2( ) ) )H  EeS\+/ 678 8 8E +e*; I% I% I%+9: : :O )E(C(4 Q89 9 9M '%&|0<j/I P     K
 ej *4 5 5 5G /2H1111 )40(%0+T2,e4Wd+.5 0%8.'4(-t4+U3eU+ K  jF6 6F    
 44D$	3 3G     !),
! ! ! ! ! !(a a a a a a U]9D$7774 4 874 	 	 X	 U]8.d;;;/ / <;/J U]7$'''2 2 ('2 U]84(((3U 3U )(3Uj U]=)4888" " 98"2!) !) !)F* * *	$ 	$ 	$&( &( &(Z 6:?CC C C C CJ* * *$8 $8 $8L      " 4 4 4 [41 1 1 1 _,FN|# |# |# [|# |# |# |# |#re   r)   c                       e Zd ZU  ej        ddd          ZdZded<   dZded	<   d fd
	Z	e
dd            Z ej        d          d             Zd Z	 	 d d!dZdd" fdZ xZS )#InteractiveNFzT
        The object being wrapped, which will be converted to a
        Bokeh model.)r-   
allow_refsr/   rB   rC   )rQ   zClassVar[Tuple[str, ...]]_ignored_refsc                     t                      j        |fi | |                                  | j                            | j        t          t          j                             d S r   )rj   rk   r   r^   rr   _update_layout_propertiesr   r   )rb   rQ   rx   rz   s      rc   rk   zInteractive.__init__  s`    **6***
7j>N9O9OPPPPPre   rQ   r   r}   r0  c                V    dt           j        vrdS ddlm} t	          ||          rdndS )Nhvplot.interactiveFr   r  rA   )r3  r4  hvplot.interactiver  r   )r6  rQ   r  s      rc   r7  zInteractive.applies  s?    s{225222222 55@ss5@re   c                      j         	d  _        d S  j                                          _          j        j        j        di  fdt
          j        D              d S )Nc                >    i | ]}|d k    |t          |          S r   r   r_   r`   rb   s     rc   r   z.Interactive._update_layout.<locals>.<dictcomp>  s1     / / /()f74##re   r]   )rQ   _layout_panelr   r^   r   r   )rb   s   `rc   r   zInteractive._update_layout  s    ;!%D!%!3!3!5!5D+D$+   / / / /-7-=/ / /     re   c                Z    | j         d S  | j         j        j        di d |D              d S )Nc                (    i | ]}|j         |j        S r]   )rU   r   r   s     rc   r   z9Interactive._update_layout_properties.<locals>.<dictcomp>  s    *I*I*IQ1615*I*I*Ire   r]   )r  r^   r   )rb   r{   s     rc   r  z%Interactive._update_layout_properties  sD    %F' 'JJ*I*I&*I*I*IJJJJJre   r/   r%   r   r  r  r   r  r&   c                     |                      ||          S  j        #t          di  fdt          j        D             }n j                            ||||          }||f j        |j        d         <   |S )Nc                >    i | ]}|d k    |t          |          S r   r   r  s     rc   r   z*Interactive._get_model.<locals>.<dictcomp>  s1     ! ! !()f74##re   r  r]   )r  r  r  r   r^   r  r   r  )rb   r/   r   r  r   r   s   `     rc   r  zInteractive._get_model  s     <==d+++%   ! ! ! !-7-=! ! !  EE &11#tVTJJE(-vTXd^$re   r+  r~   c                    | j         | j                             |           t                                          |           d S r   )r  r/  rj   )rb   r   rz   s     rc   r/  zInteractive._cleanup  sA    )''---re   r   )rQ   r   r}   r0  r  r  r  )r  r  r  r^   r  rQ   rC   r  r  rk   r  r7  r  r   r  r  r/  r  r  s   @rc   r  r    s-        U_Te B   F /3H2222/:M::::Q Q Q Q Q Q
 A A A [A U]8  K K K 6:?C              re   r  c                    ddl m}m}m} t	          | |          sdS | j        j        dk    o t	          | |          ot	          | |           S )zj
    Checks whether plotting instance is a HoloViews ElementPlot rendered
    with the bokeh backend.
    r   )GenericElementPlotGenericOverlayPlotr   Fr*   )r  r  r  r   r   rJ   rH   )r   r  r  r   s       rc   is_bokeh_element_plotr    s    
          dD!! uM!W, 9DBT1U1U 9t%7888:re   c                J   t          t                    }| j        d         }|D ]~}| j        d         |j        v rh|j                            |d          \  }}|7|                    d t          g          }|D ]'}|j        D ]}||         	                    |           (|S )z4
    mapping panel elements to its bokeh models
    r  r-  Nc                    | S r   r]   xs    rc   <lambda>z*generate_panel_bokeh_map.<locals>.<lambda>  s    q re   )
r   r   r  r   rn   r   traverser  link_sourcesrv   )	
root_modelpanel_views
map_hve_bkr  r   r   subpanebk_plotshv_elems	            rc   generate_panel_bokeh_mapr    s     T""J
.
C 5 5>$4<// KOOC>>MD'|}}[[3H2IJJH  5 5#0 5 5Gw'..t44445re   c           	     P   |                      t                    }fd|D             }t          |          dk    sdS 	 	 ddlm n# t
          $ r	 ddlm Y nw xY wddlm} n# t
          $ r Y dS w xY wd |D             }fd|D             }d	 |D             }g }|D ]o\  \  }	}
|
D ]dj	        |
                    |	df           "fd
|D             }d |D             }|r$|
                    |	|d         d         f           ept          |          | j        z
  }g }|D ]]\  }}|j        d         t                             }|t          dd          r|<|
                     |||                     ^| j                            |           |S )zd
    Traverses the supplied Viewable searching for Links between any
    HoloViews based panes.
    c                x    g | ]6}|j                                         D ]\  }}t          |d d          u |7S )r   N)rn   r   r   )r_   viewr   r   r  s       rc   rd   zfind_links.<locals>.<listcomp>  sa     @ @ @44;;M;M;O;O @ @aT6400J>> >>>>re   r   Nr   )LinkCallbackr9  c                V    g | ]&}|                     d  t          g          D ]}||f'S )c                    | S r   r]   r  s    rc   r  z'find_links.<locals>.<listcomp>.<lambda>  s    a re   )r  r  )r_   	root_plotr   s      rc   rd   zfind_links.<locals>.<listcomp>  s`     S S S9"++KK:O9PQQS S I S S S Sre   c                D    g | ]\  }}                     |          |fS r]   	find_link)r_   r   r  r  s      rc   rd   zfind_links.<locals>.<listcomp>  s@     0 0 0%dI  ))$//; 0 0 0re   c                "    g | ]}|d          
|S rV  r]   r_   r`   s     rc   rd   zfind_links.<locals>.<listcomp>  s!    >>>!QqT-=A-=-=-=re   c                J    g | ]\  }}|u	                     |           S r]   r  )r_   r   
inner_rootr  linkr  s      rc   rd   zfind_links.<locals>.<listcomp>$  sB     : : :AQz'y88 '00t<<888re   c                    g | ]}||S r   r]   r  s     rc   rd   zfind_links.<locals>.<listcomp>&  s    @@@q!----re   r*   _requires_targetF)selectr)   r   holoviews.plotting.bokeh.linksr  	Exception"holoviews.plotting.bokeh.callbacksholoviews.plotting.linksr:  r@  rv   set_found_links
_callbacksr  r   r   )	root_viewr  hv_views
root_plotsr:  plots
potentialssource_linksfoundr   r?  	tgt_links	new_found	callbackssrc_plottgt_plotr   r  r  r  s    `               @@@rc   
find_linksr    s   
 	**H@ @ @ @8 @ @ @J z??Q	HCCCCCCC 	H 	H 	HGGGGGGGG	H1111111   S S
 S S SE0 0 0 0).0 0 0J ?>z>>>LE$0 
< 
< uy 		< 		<D{"dD$/000: : : : : :UZ : : :J@@J@@@I <dD)A,q/:;;;		< E

Y33II$- C C h_W%d4jj1.@% H H$,$4JhAABBBB!!),,,s0   A 
A( AA( A	A( (
A65A6c                   |                      t                    }|sdS ddlm} ddlm}m} ddlm} |j	        d         }t          t                    }|D ]z}	||	j        vr|	j        |         d         }
|	j        r!|
j        j        dk    st!          |
dd	          sI|
                    |g
          D ]}|j        |                    d|j        d          j                            d          }|j        r|rI|j        }|j        j        rXt5          d |j        j        d         D                       }||                             |||j        d         |j        f           |j        j        rXt5          d |j        j        d         D                       }||                             |||j        d         |j        f           ||                                D ]f\  }}|d         \  }}}}tA          |tB                    r: |d |D                       \  }}|j"        |j#        k    r||}}||_"        ||_#        |dd         D ]\  }}}}g }tI          |          tI          |          ur)||j        j        v rn||j        uretK          |d          r/t           ||j&        |j        j&        z                       |_&        ||_        ||j'        d<   |                    d           ||j        j        v rn||j        uretK          |d          r/t           ||j&        |j        j&        z                       |_&        ||_        ||j'        d<   |                    d           t!          |d          }|r|(                                }n|g}|D ]}|j)        D ]}|j*        tK          |d          r
|j+        z  tY          fd|D                       s?d|v r|j'        d         |j'        d<   d|v r|j'        d         |j'        d<   |-                                 |.                    |j/                   hdS )zU
    Pre-processing hook to allow linking axes across HoloViews bokeh
    plots.
    Nr   )r   )	max_rangerI  )ElementPlotr  r*   shared_axesF)specsnormaxiswisec              3  b   K   | ]*}t          |t                    rt          |          n|V  +d S r   r   r   r   r_   ts     rc   r   zlink_axes.<locals>.<genexpr>W  ;      ``q
1d(;(;BE!HHH``````re   c              3  b   K   | ]*}t          |t                    rt          |          n|V  +d S r   r  r  s     rc   r   zlink_axes.<locals>.<genexpr>Z  r  re   c                x    g | ]7}t          |d          t                    |d          j        |d          j        f8S ))r   r   rD   rF   )r_   axs     rc   rd   zlink_axes.<locals>.<listcomp>`  sM     $ $ $/1bfg..$Br"vz*$ $ $re   r   factorsx_rangey_rangesubplotsextra_modelsc              3      K   | ]}|v V  	d S r   r]   )r_   cmodelss     rc   r   zlink_axes.<locals>.<genexpr>  s'      <<qqF{<<<<<<re   )plot_id)0r  r)   rg  r   r   r  rI   holoviews.plotting.bokeh.elementr  r  r   r   rn   rI   rJ   rH   r   r  current_framelookup_optionsr   r   r  r   r  r   r   rv   xaxisr  yaxisrp   r   r   rD   rF   r  r   r  handlesr   r  r  r  anyreset
initializer  )r  r  panesr   r  rI  r  r  	range_mapr   r   r`   r  figtagaxesr  axisrD   rF   paxr   changedr  r  spcallbackr  s                              @rc   	link_axesr  6  s   
 Y''E ,,,,,,>>>>>>>><<<<<<
.
CD!!I K Kdk!!{3"  	DM$9W$D$D466 %Ek]33 	K 	KA&++GQ_fMMTXXYcddH= H 'C{ K``CKL\]^L_`````#%%sAsy|S[&IJJJ{ K``CKL\]^L_`````#%%sAsy|S[&IJJJ	K  !(( 06 06t7QDdG$$ 	" $ $59$ $ $  JE3 zDH$$"CUDJDH"122h %	6 %	6NCCGRS		))ck&&&4s{+B+B4++ [#'S[EX8X(Y(Y#Z#ZDL"'+	)$y)))ck&&&4s{+B+B4++ [#'S[EX8X(Y(Y#Z#ZDL"'+	)$y))) q*--H  )) 6 6 " 6 6H%_Fx88 8("77<<<<G<<<<< !  G++01	)0D
9- G++01	)0D
9-NN$$$'''5555661%	606 06re   c                ~     dt           j        vr S ddlm} t	           |          s S t           fdg j        R  S )Nr  r   r  c                 ,                                     S r   )eval)r   r   s    rc   r  z/_hvplot_interactive_transform.<locals>.<lambda>  s    388:: re   )r3  r4  r  r  r   r   _params)r   r  s   ` rc   _hvplot_interactive_transformr    s`    3;..
......c;'' 
%%%%44444re   )Cr  
__future__r   r3  collectionsr   r   	functoolsr   typingr   r   r	   r
   r   r   r   r^   bokeh.modelsr   r   r  bokeh.themes.themer   packaging.versionr   param.parameterizedr   param.reactiver   ior   r   r   r   r   r   r   viewabler   r   rL   r   baser   r    r!   r   r"   r#   r+   r$   bokeh.documentr%   bokeh.modelr&   pyviz_commsr'   r)   r  r  r  r  r  _preprocessing_hooksrv   r  r]   re   rc   <module>r!     s    # " " " " " 



 0 0 0 0 0 0 0 0                         5 5 5 5 5 5 5 5 $ $ $ $ $ $ % % % % % % < < < < < <                                  , + + + + + + +       0 0 0 0 0 0 0 0 0 0 # # # # # # # #       !''''''!!!!!!      ~	# ~	# ~	# ~	# ~	# ~	# ~	# ~	#B6 6 6 6 6( 6 6 6r: : :  $2 2 2jW6 W6 W6t 	  $ $Y / / /   $ $Z 0 0 05 5 5  : ; ; ; ; ;re   