
    ɯei                     z   d Z ddlmZmZmZmZmZmZ ddlm	Z	 ddl
mZ ddlmZmZ ddlmZ ded	ed
dfdZded	ed
dfdZded	ed
dfdZded	ed
dfdZded	ed
dfdZded	ed
dfdZded	ed
dfdZded	ed
dfdZed   Zded	ed
e	fdZdeeeee   f      d
ee   fdZ	 	 	 	 d$deeeee   f      dedee   ded   d
df
dZ	 	 	 d%deeeee   f      dee   ded   d
ee	   fdZ	 d&deeeee   f      d
dfdZ ded
efdZ!	 d&deeeee   f      d
efd Z"d!ee	ee	   f   d
dfd"Z#d!ee	ee	   f   d
dfd#Z$y)'z<
Functional API for Streamlit Notify (For Streamlit Extras)
    )AnyIterableListLiteralOptionalUnion   )StatusElementNotification)NotificationQueue)STATUS_ELEMENTSNotificationType)get_status_elementargskwargsreturnNc                  @     t        t        j                        | i |S )zDisplay a toast notification.)r   r   TOASTr   r   s     ]/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/streamlit_notify/functional.py	toast_stnr      !    5.445tFvFF    c                  @     t        t        j                        | i |S )z Display a balloons notification.)r   r   BALLOONSr   s     r   balloons_stnr      s!    8.778$I&IIr   c                  @     t        t        j                        | i |S )zDisplay a snow notification.)r   r   SNOWr   s     r   snow_stnr      !    4.334dEfEEr   c                  @     t        t        j                        | i |S )zDisplay a success notification.)r   r   SUCCESSr   s     r   success_stnr"      !    7.667HHHr   c                  @     t        t        j                        | i |S )zDisplay an info notification.)r   r   INFOr   s     r   info_stnr&   !   r   r   c                  @     t        t        j                        | i |S )zDisplay an error notification.)r   r   ERRORr   s     r   	error_stnr)   &   r   r   c                  @     t        t        j                        | i |S )zDisplay a warning notification.)r   r   WARNINGr   s     r   warning_stnr,   +   r#   r   c                  @     t        t        j                        | i |S )z"Display an exception notification.)r   r   	EXCEPTIONr   s     r   exception_stnr/   0   s!    9.8894J6JJr   )toastballoonssnowsuccessinfoerrorwarning	exceptionc                  v    |j                  dd      }|t        d       t        |      j                  | i |S )z?
    Create a notification without adding it to the queue.
    notification_typeNz9notification_type must be provided as a keyword argument.)pop
ValueErrorr   create_notification)r   r   r9   s      r   r<   r<   :   sG     

#6= TUUD/0DDdUfUUr   r9   c                 |    | t        t        j                               S t        | t              r| gS t        |       S N)listr   keys
isinstancestrr9   s    r   _resolve_typesrD   I   s>    
  O((*++#S)!""!""r   removeprioritypriority_type)legeeqc                 b    t        |       }|D ]  }t        |      j                  |||       ! y)z'
    Display queued notifications.
    )rE   rF   rG   N)rD   r   notify)r9   rE   rF   rG   typesnts         r   rL   rL   U   s=     ,-E 
2%%HM 	& 	

r   c                     t        |       }g }|D ]7  }|j                  t        |      j                  j	                  ||             9 |S )zs
    Retrieve all notifications for a specific type.
    If no type is specified, retrieves all notifications.
    )rF   rG   )rD   extendr   notificationsget_all)r9   rF   rG   rM   rQ   rN   s         r   get_notificationsrS   g   s\     ,-E57M 
r"0088! 9 	

 r   c                 n    t        |       }|D ]%  }t        |      j                  j                          ' y)zi
    Clear notifications for a specific type.
    If no type is specified, clears all notifications.
    N)rD   r   rQ   clearr9   rM   rN   s      r   clear_notificationsrW   ~   s5     ,-E 52,,2245r   c                 ,    t        |       j                  S )z5
    Retrieve notifications for a specific type.
    )r   rQ   rC   s    r   get_notification_queuerY      s     /0>>>r   c                 r    t        |       }|D ]'  }t        |      j                  j                         r' y y)z}
    Check if there are any notifications of a specific type.
    If no type is specified, checks for any notifications.
    TF)rD   r   rQ   is_emptyrV   s      r   has_notificationsr\      s=     ,-E !"%33<<> r   rQ   c                     t        | t              r6| D ]0  }t        |j                        j                  j                  |       2 yt        | j                        j                  j                  |        y)z8
    Remove a specific notification from the queue.
    N)rA   r   r   namerQ   rE   rQ   ns     r   remove_notificationsra      \     -* 	?Aqvv&44;;A>	?}))*88??Nr   c                     t        | t              r6| D ]0  }t        |j                        j                  j                  |       2 yt        | j                        j                  j                  |        y)z*
    Add a notification to the queue.
    N)rA   r   r   r^   rQ   appendr_   s     r   add_notificationsre      rb   r   )NTNrI   )NNrI   r>   )%__doc__typingr   r   r   r   r   r   notification_dataclassr
   notification_queuer   status_element_typesr   r   utilsr   r   r   r   r"   r&   r)   r,   r/   NotificationStrTypesr<   rD   boolintrL   rS   rW   rY   r\   ra   re    r   r   <module>rp      s   A @ = 1 C %GS GC GD G
J Js Jt J
FC F3 F4 F
Is Ic Id I
FC F3 F4 F
GS GC GD G
Is Ic Id I
K K K K
 S 
VVV V	#"H-A$BBC	# 

		# 	"/3
"H-A$BBC
 	

 sm
 +,
 

* 	"/3"H-A$BBC sm	
 +, 

#$4 	5"H-A$BBC5 
	5?+?? 	"H-A$BBC 
	 O!8,E#FFO 
	OO!8,E#FFO 
	Or   