
    EhQ                        S SK r S SKJr  S SKrS SKJr  S SKJr  S SKrSSK	J
r
Jr  SSKJr  SSKJr  SS	KJrJrJrJrJr  S
 rS rS rS rS rS rS rS rS rS rS r S r!S r"S r#S r$S r%S r&S r'S r(S r)S r*g)    N)MutableSequence)dedent)	iskeyword   )grouping_lenmap_grouping)	Component)
exceptions)patch_collections_abcstringify_idto_jsoncoerce_to_listclean_property_namec           	      J   Uu  pVnU(       ax  [        US   XeU45      (       d/  [        R                  " [        S[	        US   5       S35      5      e[        R                  " [        SX-   U-   S   < SUS   < S35      5      eXU4 H  nU H  n	[        U	5        M     M     g )Nr   z
                    Callback arguments must be `Output`, `Input`, or `State` objects,
                    optionally wrapped in a list or tuple. We found (possibly after
                    unwrapping a list or tuple):
                    
                    z
                In a callback definition, you must provide all Outputs first,
                then all Inputs, then all States. After this item:
                z:
                we found this item next:
                
                )
isinstancer
   IncorrectTypeExceptionr   reprvalidate_callback_arg)
outputsinputsstate
extra_argstypesInputOutputStateargsargs
             aC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\dash/_validate.pyvalidate_callbackr#      s     E5*Q-&)?@@33 *Q-() *		 	 // "U*B/2 3A! "

 
	
 %(C!#&  )    c                    [        [        U SS 5      [        5      (       d.  [        R                  " [        SU R                  < S35      5      e[        U S5      (       a  [        R                  " S5      e[        U R                  [        5      (       a  [        U 5        g [        U R                  [        5      (       a  [        U 5        g [        R                  " [        SU R                  < S35      5      e)Ncomponent_propertyz<
                component_property must be a string, found r   component_eventzd
            Events have been removed.
            Use the associated property instead.
            z>
                component_id must be a string or dict, found )r   getattrstrr
   r   r   r&   hasattrNonExistentEventExceptioncomponent_iddictvalidate_id_dictvalidate_id_string)r!   s    r"   r   r   4   s    gc#7>DD//<<?<R<R;U V
 	
 s%&&22
 	
 #""D))	C$$c	*	*3 //>>A>N>N=Q R
 	
r$   c           
          U R                   nU H@  n[        U[        5      (       a  M  [        R                  " [        SU< SU< S35      5      e   g )Nz[
                    Wildcard ID keys must be non-empty strings,
                    found z in id r   )r,   r   r)   r
   r   r   )r!   arg_idks      r"   r.   r.   V   s[    F !S!!33%wvj 1  r$   c           
          U R                   nSnU Vs/ s H  o3U;   d  M
  UPM     nnU(       a>  [        R                  " SU SSR                  U5       SSR                  U5       S35      eg s  snf )Nz.{z
            The element `z` contains `z`, `z%` in its ID.
            Characters `z&` are not allowed in IDs.
            )r,   r
   InvalidComponentIdErrorjoin)r!   r1   invalid_charsxinvalid_founds        r"   r/   r/   h   s    FM -=1fQM=00 fkk-.H-I J]34 5
 	
  >s
   	A.A.c           	         [        U [        [        45      (       d  U /U/pO.[        U 5      [        U5      :w  a  [        R
                  " S5      e[        X5       H`  u  p4[        U[        [        45      (       a  UOU/nU H5  nU" US   [        US   5      5      U:X  a  M!  [        R
                  " S5      e   Mb     g)z
This validation is for security and internal debugging, not for users,
so the messages are not intended to be clear.
`output` comes from the callback definition, `output_spec` from the request.
zWrong length output_specidpropertyz)Output does not match callback definitionN)r   listtuplelenr
   CallbackExceptionzipr   )outputoutput_specr   outispeci
speci_listspecijs          r"   validate_output_specrG   v   s     ftUm,,%h	VK(	(**+EFF6/(u>>UUG
 F6$<)<VJ=O)PQ !22?  ! 0r$   c                   ^  [        U5      [        T 5      :w  a  [        R                  " S5      e[	        U 4S jU5      n[        U[        5      (       a>  / nUnU H1  nUR                  5       (       a  M  [        R                  " U S35      e   X44$ [        U[        [        45      (       a  [        U5      n0 nX44$ U/n0 nX44$ )Nz'Inputs do not match callback definitionc                    > TU    $ N )ind	flat_argss    r"   <lambda>/validate_and_group_input_args.<locals>.<lambda>   s	    Ys^r$   z$ is not a valid Python variable name)
r   r>   r
   r?   r   r   r-   isidentifierr=   r<   )rM   arg_index_groupingargs_grouping	func_argsfunc_kwargskeys   `     r"   validate_and_group_input_argsrV      s    &'3y>9**+TUU !;=OPM$d++	#C##%% 22e?@   !! 
&	6	6'	 !! #O	!!r$   c                    [        U[        [        45      (       d'  [        R                  " [        SU SU< S35      5      e[        U5      [        U 5      :w  a2  [        R                  " SU S[        U 5       S[        U5       S35      e[        U 5       H  u  p4[        U[        5      (       d  M  X   n[        U[        [        45      (       d.  [        R                  " [        SU S	U S
U< SU< S3	5      5      e[        U5      [        U5      :w  d  M  [        R                  " [        SU SU S[        U5       S[        U5       SU< SU< S35      5      e   g )Nz
                The callback zl is a multi-output.
                Expected the output type to be a list or tuple but got:
                z.
                z1
            Invalid number of output values for z.
            Expected z, got 
            z&
                        The callback z output z is a wildcard multi-output.
                        Expected the output type to be a list or tuple but got:
                        z'.
                        output spec: z
                        z=
                        Invalid number of output values for z item z#.
                        Expected z&
                        output spec: z'
                        output value: )r   r<   r=   r
   InvalidCallbackReturnValuer   r>   	enumerate)output_listsoutput_valuescallback_idirB   output_values         r"   validate_multi_returnr`      s   mdE]3333)] +! "
 	
 =S..3311< >,'(s=/A.B C
 	
 $L1k4(((+LlT5M:: ;;&&1](1# >%( )&&1_ 5		 	 < C$44 ;;==HMPQs S""%k"2!36#l:K9L M&&1_ 5''3&6 7		 	! 2r$   c                   ^^^^^^	^
 [         [        [        [        S 5      [        4m	[         [        [        [        S 5      [
        [        4m
S	U4S jjmU	4S jmU
4S jmUU4S jmS
UUU4S jjn[        U [        5      (       a  [        U 5       H  u  p4U" XCS9  M     OU" U 5        [        R                  " ST< S35      e)Nc                   > [        U 5      R                  n[        USS5      (       a  SUR                  S S3OSn[        U5      R                  nU(       a  [	        S5      nO$Uc  SOS	US
 S3n	[	        SU	 SU SU SU S3	5      nU(       d  SOSn
[
        R                  " [	        ST< SU
S SU SU SU  S35      5      e)Nr:   Fz(id=s) z
                The value in question is either the only value returned,
                or is in the top level of the returned list,
                z[*][d]zE
                The value in question is located at
                 r   z,
                ztree with one valuevaluez#
                The callback for `z`
                returned a z having type `zC`
                which is not JSON serializable.

                z@
                and has string representation
                `z`

                In general, Dash properties can only be
                dash components, strings, dictionaries, numbers, None,
                or lists of those.
                )type__name__r(   r:   r   r
   rY   )bad_val	outer_valpathindextoplevelbad_typeouter_id
outer_typelocationindex_stringobjrA   s              r"   _raise_invalid,fail_callback_output.<locals>._raise_invalid   s   =))/6y$/N/NT),,q)+TV)_--
H %*M55)1~La
|1XJ 7 H ,4#33##)* -7.
 ; 
  
 	
r$   c                    > [        U T5      $ rJ   r   )valvalid_childrens    r"   _valid_child*fail_callback_output.<locals>._valid_child  s    #~..r$   c                    > [        U T5      $ rJ   r{   )r|   valid_propss    r"   _valid_prop)fail_callback_output.<locals>._valid_prop  s    #{++r$   c                 t   > T" U 5      (       d  T" U 5      (       d  g [        U 5        g! [         a     gf = f)NFT)r   	TypeError)r|   r~   r   s    r"   _can_serialize,fail_callback_output.<locals>._can_serialize  s@    S!![%5%5	CL   		s   * 
77c           	        >^ [        U [        5      (       Gaw  / nU R                  5        H  u  mnT	" U5      (       d  T" X0TUS9  T" U5      (       dc  U Vs/ s H   nTR                  US   5      (       a  M  UPM"     nnU(       a    O[	        U4S jU 5       5      (       a  UR                  TU45        [        USS 5      n[        U[        [        45      (       a  M  U(       d  M  T" U5      (       a  M  T" UU TS-   S-   [        U5      R                  -   US9  M     U(       a  US   u  mnT" X0TUS9  [        U SS 5      n[        U[        [        45      (       d0  U(       a)  T" U 5      (       d  T" UU [        U5      R                  US9  T" U 5      (       d  T" U [        U 5      R                  SUSS	9  g g s  snf )
N)rm   rn   ro   rp   r   c              3   T   >#    U  H  oS    R                  T5      (       + v   M     g7f)r   N)
startswith).0r^   ps     r"   	<genexpr>@fail_callback_output.<locals>._validate_value.<locals>.<genexpr>%  s$     P;Oatq111;Os   %(children
z[*] re   T)rm   rn   ro   rp   rq   )r   r	   _traverse_with_pathsr   allappendr(   r=   r   rk   rl   )
r|   rp   unserializable_itemsjr^   childr   r   rx   r~   s
         @r"   _validate_value-fail_callback_output.<locals>._validate_value  s   c9%%#% 0021#A"1!5Q%a((
 $8,#7aq||AaD?Q#7 ) , , P;OPPP,33QF;  :t4!%%)ABBu^E%:%:&$)&)!"TF!2T%[5I5I!I"'	1 3< $+A.1 qauM CT2Eee_%=>>!4!4" %"%!%[11#	 c""s),, #M,s   F<8F<)rp   z"
        The callback for output `z`
        returned a value which is not JSON serializable.

        In general, Dash properties can only be dash components, strings,
        dictionaries, numbers, None, or lists of those.
        )NFrJ   )r)   intfloatrk   r	   r=   r   r   r<   rZ   r
   rY   )r_   rA   r   r^   r|   r   rx   r~   r   r}   r   s    `   @@@@@@r"   fail_callback_outputr      s    3tDz9=NUDJGK&
P/,; ;z ,%%-FAC) . 	% 
/
/""( ,		 r$   c                     U  Ho  nUS;   a  [         R                  " SU S35      eUS;   a  [        U S3[        R                  S9  MF  US;   a  [         R                  " S5      e[        S	U S
35      e   g )N)components_cache_max_agestatic_folderr   z is no longer a valid keyword argument in Dash since v1.0.
                See https://dash.plotly.com for details.
                )dynamic_loadingpreloaded_librarieszA has been removed and no longer a valid keyword argument in Dash.)file)long_callback_managerzJlong_callback_manager is obsolete, use background_callback_manager insteadz+Dash() got an unexpected keyword argument '')r
   ObsoleteKwargExceptionprintsysstderrr   )kwargsrU   s     r"   check_obsoleter   _  s    ??33   <<%XYZZ ++33\  EcU!LMM) r$   c           	          X;  a4  [         R                  " SU S[        U R                  5       5       S35      eX U   ;  a   [         R                  " SU SU SU  S35      eg )Nz(
            Error loading dependency. "zQ" is not a registered library.
            Registered libraries are:
            rX   z
            "zV" is registered but the path requested is not valid.
            The path requested: "z("
            List of registered paths: )r
   DependencyExceptionr<   keys)registered_pathspackage_namepath_in_package_dists      r"   validate_js_pathr   w  s    +,,((4~ 6"'')*+ ,
 	
 L#AA,,^ ""6!7 8''7&8 9
 	
 Br$   c           	      &   U VVs/ s H3  u  p4[         R                  " U5      R                  U5      (       a  M1  UPM5     nnnU(       aB  [        U5      S:  a  SOSn[        R
                  " SU SSR                  U5       SU  S35      eg s  snnf )	Nr   rc   re   zMissing itemri   z, z in .)recompilesearchr>   r
   InvalidIndexExceptionr5   )namechecksrp   checkr^   missingplurals          r"   validate_indexr     s    !'OXUrzz%/@/G/G/NqGOGq(b..6(!DIIg$6#7tD6C
 	
  Ps
   0BBc                     [        U [        [        S5      [        [        45      (       d  [
        R                  " S5      eg )NCallablez
            Layout must be a single dash component, a list of dash components,
            or a function that returns a dash component.
            )r   r	   r   r<   r=   r
   NoLayoutException)rj   s    r"   validate_layout_typer     sB    	0<dEJ  **
 	
r$   c                 J  ^ U c  [         R                  " S5      e[        5       mU4S jn[        U[        [
        45      (       aV  U HO  n[        U[        45      (       a  M  [        U[        45      (       a
  U" U5        M;  [         R                  " S5      e   g U" U5        g )Nz
            The layout was `None` at the time that `run` was called.
            Make sure to set the `layout` attribute of your application
            before running the server.
            c                 `   > U4S jnU" U 5        U R                  5        H  nU" U5        M     g )Nc                    > [        [        U SS 5      5      nU(       a   UT;   a  [        R                  " SU S35      eTR	                  U5        g )Nr:   zJ
                    Duplicate component id found in the initial layout: `z`
                    )r   r(   r
   DuplicateIdErroradd)compr,   component_idss     r"   _validate_id8validate_layout.<locals>._validate.<locals>._validate_id  sY    'dD(ABL = 11JJV X 
 l+r$   )	_traverse)rj   r   	componentr   s      r"   	_validate"validate_layout.<locals>._validate  s+    	, 	U*I# +r$   z9Only strings and components are allowed in a list layout.)r
   r   setr   r<   r=   r)   r	   )layoutlayout_valuer   r   r   s       @r"   validate_layoutr     s    ~**
 	
 EM$  ,u..%I)cV,,)i\22)$ 22O  & 	,r$   c                     [         R                  " SU 5      nU H:  nUR                  5       (       a  [        U5      (       d  M*  [	        SU SU  S35      e   g )Nz<(.*?)>`z;` is not a valid Python variable name in `path_template`: "z".)r   findallrP   r   	Exception)templatevariable_namesr   s      r"   validate_templater     sV    ZZ	84N  ""iooD6TU]T^^`a  r$   c                     0 nU R                  5        H2  nUS   U;  a  US   /XS   '   M  XS      R                  US   5        M4     UR                  5        H!  n[        U5      S:  d  M  [        SU S35      e   g )Nro   moduler   zmodules z have duplicate paths)valuesr   r>   r   )registrypath_to_modulepagemoduless       r"   check_for_duplicate_pathnamesr     s    N!<~-,0N+;N<(<(//X?	 " "((*w<!hwi/DEFF +r$   c                     U R                  5        H:  nSU;  a  [        R                  " SUS    S35      eUS   S:X  d  M1  [        S5      e   g )Nr   zNo layout in module `r   z` in dash.page_registry__main__z
                When registering pages from app.py, `__name__` is not a valid module name.  Use a string instead.
                For example, `dash.register_page("my_module_name")`, rather than `dash.register_page(__name__)`
                )r   r
   r   r   )r   r   s     r"   validate_registryr     s`    !4..'X'77NO  >Z'  "r$   c                 Z    [        US5      (       d  [        R                  " SU  S35      eg )Nr   z'
            No layout found in module zN
            A variable or a function named "layout" is required.
            )r*   r
   r   )r   r   s     r"   validate_pages_layoutr     s;    4""**''-h /
 	
 #r$   c                     U R                  SS 5      (       d  [        R                  " S5      e[        R                  " 5       (       a  [        R                  " S5      eg )Nassets_folderz=`dash.register_page()` must be called after app instantiationu  
            dash.register_page() can’t be called within a callback as it updates dash.page_registry, which is a global variable.
             For more details, see https://dash.plotly.com/sharing-data-between-callbacks#why-global-variables-will-break-your-app
            )getr
   	PageErrorflaskhas_request_context)configs    r"   validate_use_pagesr     sW    ::ot,,""K
 	
   """"
 	
 #r$   c                 \    [        U [        5      (       d  [        R                  " S5      eU $ )NzJThe first attribute of dash.register_page() must be a string or '__name__')r   r)   r
   r   )r   s    r"   validate_module_namer   	  s,    fc""""X
 	
 Mr$   c                   ^ [        5       n0 nU R                  5        Hd  n[        US   5      nUR                  U5        U H<  nUR	                  U[        5       5        X%   R                  [        US   5      5        M>     Mf     S U R                  5        5        H  nUS   nUR                  S/ 5      nUR                  S/ 5      n[        US   5      n	[        U V
s/ s H  oS   PM	     sn
U-   5      m[        U4S jUR                  5        5       5       V
s/ s H  n
X;   d  M
  U
PM     nn
U(       d  M  [        R                  " S	U S
35      e   g s  sn
f s  sn
f )NrA   
raw_inputsc              3   T   #    U  H  oR                  S 5      (       d  M  Uv   M      g7f)
backgroundN)r   )r   r7   s     r"   r   0validate_background_callbacks.<locals>.<genexpr>  s     M 51|9LQQ 5s   (	(r   progressrunningr   c              3   \   >#    U  H!  u  pUR                  T5      (       d  M  Uv   M#     g 7frJ   )intersection)r   r2   vr   s      r"   r   r   &  s"     X'<tqw@W'<s   ,	,z$Background callback circular error!
z is used as input for a background callback but also used as output from an input that is updated with progress or running argument.)	r   r   r   update
setdefaultr   itemsr
   BackgroundCallbackError)callback_mapall_outputsinput_indexedcallbackoutobg_infor   r   	bg_inputsr7   circularr   s               @r"   validate_background_callbacksr    s`    %KM '')Xh/03A$$Q.##N8L3I$JK  * N 3 3 5M<(;;z2.++i,"8L#9:	W-WtW-89 X}':':'<XX
X~ X 	 
 8447z Bl m  N .
s    E
	E*Ec                    ^^ STT4;   a  g UU4S jn[        U [        [        45      (       a  U  H  nU" U5        M     g U" U 5        g )Ninitial_duplicatec                 t   > U R                   (       a&  T(       d  T(       d  [        R                  " S5      eg g g )Na*  allow_duplicate requires prevent_initial_call to be True. The order of the call is not guaranteed to be the same on every page load. To enable duplicate callback with initial call, set prevent_initial_call='initial_duplicate'  or globally in the config prevent_initial_callbacks='initial_duplicate')allow_duplicater
   DuplicateCallback)r  config_prevent_initial_callprevent_initial_calls    r"   _valid)validate_duplicate_output.<locals>._valid7  s:    (/..[  0 )  r$   )r   r<   r=   )rA   r  r  r  r  s    ``  r"   validate_duplicate_outputr  1  sL     35PQQ &4-((A1I  	
6Nr$   )+r   collections.abcr   r   textwrapr   keywordr   r   	_groupingr   r   development.base_componentr	   re   r
   _utilsr   r   r   r   r   r#   r   r.   r/   rG   rV   r`   r   r   r   r   r   r   r   r   r   r   r   r   r  r  rK   r$   r"   <module>r     s    
 + 	    1 1  '@
D$
."0-`GTN0
(
	
' T
G

@r$   