
    gY&                     B    d  Z d Zd Zd Zd ZddZd Zd Zd Zd	 Z	y
)c                 t    t        |       dk(  rt        d      t        t        |             t        |       z  S )N    zx must have positive length)len
ValueErrorfloatsumxs    S/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/plotly/shapeannotation.py_meanr      s0    
1v{677Q=3q6!!    c                 <    t        t        |       d       d   d   S )Nc                     | d   S N    ts    r
   <lambda>z_argmin.<locals>.<lambda>   
    ad r   )keyr   sorted	enumerater   s    r
   _argminr   
   s    )A,N3A6q99r   c                 >    t        t        |       d d      d   d   S )Nc                     | d   S r   r   r   s    r
   r   z_argmax.<locals>.<lambda>   r   r   T)r   reverser   r   r   s    r
   _argmaxr      s    )A,NDA!DQGGr   c                 "    t        | |||d      S )zDefault annotation parametersF)xanchoryanchorr	   y	showarrow)dict)r    r!   r	   r"   s       r
   _df_annor%      s    AeLLr   c                 8    d| v sd| v s| j                  d       | S )Ninsideoutside)add)poss    r
   _add_inside_to_positionr+      s!    OyC/Jr   c                 d    | d} | }t        | j                  d            } |rt        |       } | |fS )Nz	top right )setsplitr+   )positionprepend_insidepos_strs      r
   _prepare_positionr3      s=    G8>>#&'H*84Wr   c                 v   |d   }|d   }|d   }|d   }||g}||g}d}	d}
d}d}d	}d
}t        |      }t        |      }t        |      }t        |      }t	        |      }t        |      }t        |      }t        |      }t        |      }t	        |      }t        |      \  }}| dk(  r|t        ddg      k(  rt        |	|
||   |      S |t        ddg      k(  rt        ||
||   |      S |t        dg      k(  rt        ||||   |      S |t        d	dg      k(  rt        |	|||   |      S |t        d	dg      k(  rt        ||||   |      S |t        d	g      k(  rt        ||
||   |      S |t        dg      k(  rt        |	|||      S |t        dg      k(  rt        ||||      S | dk(  r|t        ddg      k(  rt        |||||         S |t        ddg      k(  rt        |	||||         S |t        dg      k(  rt        ||||      S |t        d	dg      k(  rt        ||
|||         S |t        d	dg      k(  rt        |	|
|||         S |t        d	g      k(  rt        ||
||      S |t        dg      k(  rt        |	||||         S |t        dg      k(  rt        |||||         S t        d|d      )Nx0x1y0y1righttopleftcenterbottommiddlevlinehlinezInvalid annotation position "")	maxminr   r   r   r3   r.   r%   r   )
shape_type
shape_argsr0   r5   r6   r7   r8   XYRTLCBMaYiYeYaaYaiYaXiXeXaaXaiXr2   s                             r
   annotation_params_for_linerX   '   s!   
 
D	B	D	B	D	B	D	B	RA	RAAAAAAA	QB	QB	qB
!*C
!*C	QB	QB	qB
!*C
!*C)(3HgWsE6?++Aq!C&"--sE7+,,Aq!C&"--sE7|#Aq!C&"--sHf-..Aq!C&"--sHg.//Aq!C&"--sH:&Aq!C&"--sF8}$Aq"b))sG9~%Aq"b))	w	sE6?++Aq"af--sE7+,,Aq"af--sE7|#Aq"b))sHf-..Aq"af--sHg.//Aq"af--sH:&Aq"b))sF8}$Aq"af--sG9~%Aq"af--
7D
EEr   c           	         |d   }|d   }|d   }|d   }t        |d      \  }}|t        g d      k(  r$t        dd	t        ||g      t	        ||g            S |t        g d
      k(  r$t        dd	t	        ||g      t	        ||g            S |t        dd	g      k(  r$t        dd	t        ||g      t	        ||g            S |t        g d      k(  r$t        ddt        ||g      t        ||g            S |t        g d      k(  r$t        ddt	        ||g      t        ||g            S |t        ddg      k(  r$t        ddt        ||g      t        ||g            S |t        ddg      k(  r$t        ddt        ||g      t        ||g            S |t        ddg      k(  r$t        ddt	        ||g      t        ||g            S |t        dg      k(  r$t        ddt        ||g      t        ||g            S |t        g d      k(  r2t        | dk(  rdnd| dk(  rdnd	t        ||g      t	        ||g            S |t        g d      k(  r2t        | dk(  rdnd| dk(  rdnd	t	        ||g      t	        ||g            S |t        dd	g      k(  r$t        ddt        ||g      t	        ||g            S |t        g d      k(  r2t        | dk(  rdnd| dk(  rd	ndt        ||g      t        ||g            S |t        g d      k(  r2t        | dk(  rdnd| dk(  rd	ndt	        ||g      t        ||g            S |t        ddg      k(  r$t        dd	t        ||g      t        ||g            S |t        ddg      k(  r$t        ddt        ||g      t        ||g            S |t        ddg      k(  r$t        ddt	        ||g      t        ||g            S t        d|      )Nr5   r6   r7   r8   T)r1   )r'   r:   r;   r;   r:   )r'   r:   r9   r9   r'   r<   )r'   r=   r;   r=   )r'   r=   r9   r>   )r(   r:   r;   vrecthrect)r(   r:   r9   r(   )r(   r=   r;   )r(   r=   r9   zInvalid annotation position )r3   r.   r%   rC   rB   r   r   )rD   rE   r0   r5   r6   r7   r8   r2   s           r
   annotation_params_for_rectr\   h   s   	D	B	D	B	D	B	D	B)(4HHg3011sB8}c2r(mDD3122RHsB8}EE3%())%Bx#r2h-HH3344#r2h-b"XGG34553Bx=#r2h-HH3(+,,(E2r(OS"b]KK3&)**#r2h-BxII3'*++3Bx=%R/JJ3z?"(E2r(OUB8_MM3122!W,G&"g-H5RMRM	
 	
 3233 G+F"g-H5RMRM	
 	
 3	5)**(E2r(OS"b]KK3455!W,G&7*ERMRM	
 	
 3566 G+F7*ERMRM	
 	
 3	8,--%Bx#r2h-HH3	6*++3Bx=%R/JJ3	7+,,#r2h-BxII
B
CCr   c                   
 d
t        
      }t        t        
fd|j                                     }| t        |      dk(  ry| 
t	               } |D ]  }|dk(  r	||d }||   | |<    d}d|j                         v r|d   }|j                  d      rt        |||      }	n|j                  d      rt        |||      }		j                         D ]  }|| vs| |   |	|   | |<    | S )a8  
    annotation: a go.layout.Annotation object, a dict describing an annotation, or None
    shape_type: one of 'vline', 'hline', 'vrect', 'hrect' and determines how the
                x, y, xanchor, and yanchor values are set.
    shape_args: the parameters used to draw the shape, which are used to place the annotation
    kwargs:     a dictionary that was the kwargs of a
                _process_multiple_axis_spanning_shapes spanning shapes call. Items in this
                dict whose keys start with 'annotation_' will be extracted and the keys with
                the 'annotation_' part stripped off will be used to assign properties of the
                new annotation.

    Property precedence:
    The annotation's x, y, xanchor, and yanchor properties are set based on the
    shape_type argument. Each property already specified in the annotation or
    through kwargs will be left as is (not replaced by the value computed using
    shape_type). Note that the xref and yref properties will in general get
    overwritten if the result of this function is passed to an add_annotation
    called with the row and col parameters specified.

    Returns an annotation populated with fields based on the
    annotation_position, annotation_ prefixed kwargs or the original annotation
    passed in to this function.
    annotation_c                 &    | j                        S )N)
startswith)kprefixs    r
   r   z0axis_spanning_shape_annotation.<locals>.<lambda>   s    ALL,@ r   Nr   annotation_positionlinerect)r   listfilterkeysr$   endswithrX   r\   )
annotationrD   rE   kwargs
len_prefixannotation_keysra   subkrc   
shape_dictrb   s             @r
   axis_spanning_shape_annotationrp      s)   2 FVJ6"@&++-PQO c/2a7 V
 %%%~!!9
4% -$%:;6"/
$7

 
		V	$/
$7

 __ *
 ZZ]%:&qMJqM* r   c                     t               }t               }| j                         D ]$  }|j                  |      r	| |   ||<   | |   ||<   & ||fS )z
    Returns two dictionaries, one containing all the items whose keys do not
    start with a prefix and another containing all the items whose keys do start
    with the prefix. Note that the prefix is not removed from the keys.
    )r$   rh   r`   )drb   	no_prefixwith_prefixra   s        r
   split_dict_by_key_prefixru      sZ     I&KVVX  <<qTKNQ4IaL	 
 {##r   N)F)
r   r   r   r%   r+   r3   rX   r\   rp   ru   r   r   r
   <module>rv      s>   ":HM
>FB>DB=@$r   