
    MfA             	       ^   d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZ d dl	Z	d dl
Z
d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlm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 d d	lmZ d
dlmZm Z  d
dl!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,m-Z- d
dl.m/Z/ d
dl0m1Z1m2Z2m3Z3 d
dl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z? d
dl@mAZA d
dl@mBZB d
dl@mCZC d
dl@mDZD d
dl@mEZE d
dl@mFZF d
dlGmHZHmIZImJZJ d
dl@mKZK d
dlKmLZLmMZMmNZN  ejO        ddd           dZPd ZQd!ZRd"ZSd#ZTd$ZUd%ZVd&ZWd'ZXd(ZYd)ZZd*Z[d+Z\	  ej]         ej^        eZd,-           ej]        eYd.           ej_        e[/           ej]        e\d.          g          Z`n	#  dZ`Y nxY wd0eafd1Zb eAjc                    Zd G d2 d3          ZedS )4    N)copy_context)
ModuleSpec)urlparse)dedent)get_distributionparse_version)dcc)html)
dash_table   )build_fingerprintcheck_fingerprint)ScriptsCss)OutputInput)ComponentRegistry)PreventUpdateInvalidResourceError
ProxyErrorDuplicateCallback)__version__)get_combined_configpathname_configspages_folder_config)AttributeDict
format_taggenerate_hashinputs_to_dictinputs_to_valsinterpolate_strpatch_collections_abcsplit_callback_idto_jsonconvert_to_AttributeDictgen_salt)	_callback)
_get_paths)_dash_renderer)	_validate)_watch)_get_app)map_groupinggrouping_lenupdate_args_group)_pages)_infer_module_name_parse_path_variables_parse_query_stringapplication/jsonz.mapTa  <!DOCTYPE html>
<html>
    <head>
        {%metas%}
        <title>{%title%}</title>
        {%favicon%}
        {%css%}
    </head>
    <body>
        <!--[if IE]><script>
        alert("Dash v2.7+ does not support Internet Explorer. Please use a newer browser.");
        </script><![endif]-->
        {%app_entry%}
        <footer>
            {%config%}
            {%scripts%}
            {%renderer%}
        </footer>
    </body>
</html>zc
<div id="react-entry-point">
    <div class="_dash-loading">
        Loading...
    </div>
</div>
){%app_entry%}r5   )
{%config%}r6   ){%scripts%}r7   )zid="react-entry-point"z#react-entry-point)zid="_dash-config"z#_dash-config)z src="[^"]*dash[-_]renderer[^"]*"zdash-renderer)zid="_dash-rendererznew DashRenderer_pages_content_pages_location_pages_store_pages_dummyzcallback-nav)idrefresh)r<   disable_n_clicksr<   errorc                    	 ddl m} n# t          $ r d }Y nw xY wdd}t          |d          r^|                                } ||j                                                  }|                    |                                          S t          |d          rp|                    |          } ||	                                                                          }|                    ||          
                    d| d          S t          j        t          |          ||j                  } ||d	          }|d         d
                    ||d                    z   S )Nr   )tbtools   c                 j    d}t          |           D ] \  }}d|v rt          |dz   |z            } n!|S )Nr   z%% callback invoked %%r   )	enumerateint)textdividerskipilines        H/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/dash/dash.py	_get_skipz!_get_traceback.<locals>._get_skip   sR      	 	GAt'4//AEW,-- 0     get_current_traceback)rI   DebugTracebackTr    )rC   )werkzeug.debugrB   ImportErrorhasattrrO   	plaintext
splitlinesrender_fullrP   render_traceback_textrender_debugger_html	tracebackformat_exceptiontype__traceback__join)secretr@   rB   rM   tbrI   s         rL   _get_tracebackra      s   *******       w/00 F**,,y002233,,$,77CCEEEw()) 
##E**y1133>>@@AA %%e$%77LL&$
 
 	
 
	#DKK8K	L	LB9RDa52772dee9%%%%s   	 c                      e Zd ZdZddddddddddddddddedddddddd ddddfd	Zd=d
Zd>dZed             Z	d Z
e	j        d             Z	ed             Zej        d             Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z	 	 	 	 	 	 	 	 d?dZd Zd  Zd! Zdd"dddddd#d$Zd% Zd& Zd' Z d( Z!e"d)             Z#e"d*             Z$d@d,Z%d- Z&d. Z'd/ Z(d0 Z)	 	 	 	 	 	 	 	 	 	 dAd1Z*d2 Z+ e,j-        d3d4           e,j-        d5d6           e,j-        d7d          ddddddddddfd8Z.d9 Z/e"d:             Z0d; Z1d< Z2dS )BDashaH  Dash is a framework for building analytical web applications.
    No JavaScript required.

    If a parameter can be set by an environment variable, that is listed as:
        env: ``DASH_****``
    Values provided here take precedence over environment variables.

    :param name: The name Flask should use for your app. Even if you provide
        your own ``server``, ``name`` will be used to help find assets.
        Typically ``__name__`` (the magic global var, not a string) is the
        best value to use. Default ``'__main__'``, env: ``DASH_APP_NAME``
    :type name: string

    :param server: Sets the Flask server for your app. There are three options:
        ``True`` (default): Dash will create a new server
        ``False``: The server will be added later via ``app.init_app(server)``
            where ``server`` is a ``flask.Flask`` instance.
        ``flask.Flask``: use this pre-existing Flask server.
    :type server: boolean or flask.Flask

    :param assets_folder: a path, relative to the current working directory,
        for extra files to be used in the browser. Default ``'assets'``.
        All .js and .css files will be loaded immediately unless excluded by
        ``assets_ignore``, and other files such as images will be served if
        requested.
    :type assets_folder: string

    :param pages_folder: a path, relative to the current working directory,
        for pages of a multi-page app. Default ``'pages'``.
    :type pages_folder: string

    :param use_pages: When True, the ``pages`` feature for multi-page apps is
        enabled. If you set a non-default ``pages_folder`` this will be inferred
        to be True. Default `None`.
    :type use_pages: boolean

    :param assets_url_path: The local urls for assets will be:
        ``requests_pathname_prefix + assets_url_path + '/' + asset_path``
        where ``asset_path`` is the path to a file inside ``assets_folder``.
        Default ``'assets'``.
    :type asset_url_path: string

    :param assets_ignore: A regex, as a string to pass to ``re.compile``, for
        assets to omit from immediate loading. Ignored files will still be
        served if specifically requested. You cannot use this to prevent access
        to sensitive files.
    :type assets_ignore: string

    :param assets_external_path: an absolute URL from which to load assets.
        Use with ``serve_locally=False``. assets_external_path is joined
        with assets_url_path to determine the absolute url to the
        asset folder. Dash can still find js and css to automatically load
        if you also keep local copies in your assets folder that Dash can index,
        but external serving can improve performance and reduce load on
        the Dash server.
        env: ``DASH_ASSETS_EXTERNAL_PATH``
    :type assets_external_path: string

    :param include_assets_files: Default ``True``, set to ``False`` to prevent
        immediate loading of any assets. Assets will still be served if
        specifically requested. You cannot use this to prevent access
        to sensitive files. env: ``DASH_INCLUDE_ASSETS_FILES``
    :type include_assets_files: boolean

    :param url_base_pathname: A local URL prefix to use app-wide.
        Default ``'/'``. Both `requests_pathname_prefix` and
        `routes_pathname_prefix` default to `url_base_pathname`.
        env: ``DASH_URL_BASE_PATHNAME``
    :type url_base_pathname: string

    :param requests_pathname_prefix: A local URL prefix for file requests.
        Defaults to `url_base_pathname`, and must end with
        `routes_pathname_prefix`. env: ``DASH_REQUESTS_PATHNAME_PREFIX``
    :type requests_pathname_prefix: string

    :param routes_pathname_prefix: A local URL prefix for JSON requests.
        Defaults to ``url_base_pathname``, and must start and end
        with ``'/'``. env: ``DASH_ROUTES_PATHNAME_PREFIX``
    :type routes_pathname_prefix: string

    :param serve_locally: If ``True`` (default), assets and dependencies
        (Dash and Component js and css) will be served from local URLs.
        If ``False`` we will use CDN links where available.
    :type serve_locally: boolean

    :param compress: Use gzip to compress files and data served by Flask.
        To use this option, you need to install dash[compress]
        Default ``False``
    :type compress: boolean

    :param meta_tags: html <meta> tags to be added to the index page.
        Each dict should have the attributes and values for one tag, eg:
        ``{'name': 'description', 'content': 'My App'}``
    :type meta_tags: list of dicts

    :param index_string: Override the standard Dash index page.
        Must contain the correct insertion markers to interpolate various
        content into it depending on the app config and components used.
        See https://dash.plotly.com/external-resources for details.
    :type index_string: string

    :param external_scripts: Additional JS files to load with the page.
        Each entry can be a string (the URL) or a dict with ``src`` (the URL)
        and optionally other ``<script>`` tag attributes such as ``integrity``
        and ``crossorigin``.
    :type external_scripts: list of strings or dicts

    :param external_stylesheets: Additional CSS files to load with the page.
        Each entry can be a string (the URL) or a dict with ``href`` (the URL)
        and optionally other ``<link>`` tag attributes such as ``rel``,
        ``integrity`` and ``crossorigin``.
    :type external_stylesheets: list of strings or dicts

    :param suppress_callback_exceptions: Default ``False``: check callbacks to
        ensure referenced IDs exist and props are valid. Set to ``True``
        if your layout is dynamic, to bypass these checks.
        env: ``DASH_SUPPRESS_CALLBACK_EXCEPTIONS``
    :type suppress_callback_exceptions: boolean

    :param prevent_initial_callbacks: Default ``False``: Sets the default value
        of ``prevent_initial_call`` for all callbacks added to the app.
        Normally all callbacks are fired when the associated outputs are first
        added to the page. You can disable this for individual callbacks by
        setting ``prevent_initial_call`` in their definitions, or set it
        ``True`` here in which case you must explicitly set it ``False`` for
        those callbacks you wish to have an initial call. This setting has no
        effect on triggering callbacks when their inputs change later on.

    :param show_undo_redo: Default ``False``, set to ``True`` to enable undo
        and redo buttons for stepping through the history of the app state.
    :type show_undo_redo: boolean

    :param extra_hot_reload_paths: A list of paths to watch for changes, in
        addition to assets and known Python and JS code, if hot reloading is
        enabled.
    :type extra_hot_reload_paths: list of strings

    :param plugins: Extend Dash functionality by passing a list of objects
        with a ``plug`` method, taking a single argument: this app, which will
        be called after the Flask server is attached.
    :type plugins: list of objects

    :param title: Default ``Dash``. Configures the document.title
    (the text that appears in a browser tab).

    :param update_title: Default ``Updating...``. Configures the document.title
    (the text that appears in a browser tab) text when a callback is being run.
    Set to None or '' if you don't want the document.title to change or if you
    want to control the document.title through a separate component or
    clientside callback.

    :param long_callback_manager: Deprecated, use ``background_callback_manager``
        instead.

    :param background_callback_manager: Background callback manager instance
        to support the ``@callback(..., background=True)`` decorator.
        One of ``DiskcacheManager`` or ``CeleryManager`` currently supported.

    :param add_log_handler: Automatically add a StreamHandler to the app logger
        if not added previously.
    NTassetspagesrQ   FzUpdating...c           
         t          j        |           t          |t          j                  r|| _        |t          |dd          }nHt          |t                    r$|r|nd}|rt          j        |          nd | _        nt          d          t          |||          \  }} }!t          d&i d|dt          j                            t          j                            |          |          d|d|dt!          d|d          d	t#          |||          d
|	dt!          d|
d          d|d| d|!d|dt!          d|d          d|pg d|pg d|pg dt!          d|d          d|d|d|pg d|d|| _        | j                            g dd           | j                            d           | j        t*          _        | j        t.          _        t1          |          | _        ||dk    n|| _        || _        i | _        g | _        g | _        d| _        || _         d | _!        d | _"        tG          |          | _$        tK          ||	          | _&        tO          j(        tR                    | _*        g | _+        d | _,        d| _-        d | _.        g | _/        | 0                                 t          d dtc          j2                    d g !          | _3        g | _4        d"| _5        |p|| _6        to          j8        tr                    | _:        | j:        j;        s9|r7| j:        <                    to          j=        t|          j?        #                     t          |t          d$                    r|D ]}"|"A                    |            ddd%| _B        | j        | C                                 | j:        D                    tn          jE                   d S )'Nname__main__z'server must be a Flask app or a booleanassets_folderassets_url_pathassets_ignoreassets_external_pathrQ   pages_foldereager_loadinginclude_assets_filesTurl_base_pathnameroutes_pathname_prefixrequests_pathname_prefixserve_locallycompressF	meta_tagsexternal_scriptsexternal_stylesheetssuppress_callback_exceptionsprevent_initial_callbacksshow_undo_redoextra_hot_reload_pathstitleupdate_title)rg   ri   rj   rn   rs   rt   rm   z2Read-only: can only be set in the Dash constructorzMInvalid config key. Some settings are only available via the Dash constructorre   z"var renderer = new DashRenderer();)hashhardlockwatch_threadchanged_assetsr   )streamIterable)re   setup_server )Fr*   check_obsolete
isinstanceflaskFlaskservergetattrbool
ValueErrorr   r   ospathr^   helpersget_root_pathr   r   configset_read_onlyfinalizer(   CONFIGr0   strrm   	use_pagesr|   callback_map_callback_list_inline_scripts_index_stringindex_string_faviconrendererr   cssr   scriptscollectionsdefaultdictsetregistered_pathsroutes_layout_layout_is_functionvalidation_layout_extra_components_setup_dev_tools	threadingRLock_hot_reload_assets_files_long_callback_count_background_managerlogging	getLogger__name__loggerhandlers
addHandlerStreamHandlersysstdoutr"   plug_got_first_requestinit_appsetLevelINFO)#selfrg   r   ri   rm   r   rj   rk   rl   rn   ro   rp   rr   rq   rs   rt   ru   r   rv   rw   rx   ry   rz   r{   pluginsr|   r}   long_callback_managerbackground_callback_manageradd_log_handlerobsoletebase_prefixroutes_prefixrequests_prefixplugins#                                      rL   __init__zDash.__init__S  s   B 	 *** fek** 	H DK|vvz::%% 	H/44ZD/5?%+d+++4DKKFGGG6F57O7
 7
3]O $ 
 
 

',,++D11=  

 ,O
 (-
 "5&(<b" " "
 -T<KKK
 (-
 "5&(<d" " "
 *k
  $1=!
" &5_#
$ (-%
& )XuEEE'
(  o2)
* .3+
, "6!;-
. *=.0Le* * */
4 '@&?5
6 *>7
8 $:#?R9
: %;
< &=
@ 	!!   A	
 	
 	
 	'	
 	
 	

 !K
--6?6G,'11Y 
    "  ( = }%%}m<< + 7 < < #( !%!#(""
 
 
  $%!#>#WBW '11{# 	M 	MK""7#8
#K#K#KLLLg4Z@@AA 	"! " "D!!!! -25"I"I;"MMOOOW\*****rN   c                    | j         }|                    |           |                    g dd           ||| _        |j                            dd                              dd          }| d}| j                            t          j        ||j	        | j         j
        |j        | j         j                            d          z                        |j        r	 d	d
lm}  || j                   t!          t#          d          j                  }t'          | j        j         d          s#|t!          d          k    rdg| j        j         d<   n"# t(          $ r}t)          d          |d}~ww xY w| j                            t,                    d             }	| j                            | j                    | j                            t2                    | j                   |                     d| j                   |                     d| j                   |                     d| j                   |                     d| j        dg           |                     d| j                    |                     d| j!                   |                     d| j"                   |                     d| j"                   | tF          _$        | %                                 dS )z6Initialize the parts of Dash that require a flask app.)rp   rq   rr   zGRead-only: can only be set in the Dash constructor or during init_app()N/_.dash_assets)static_folderstatic_url_pathr   )Compresszflask-compressCOMPRESS_ALGORITHMz1.6.0gzipz>To use the compress option, you need to install dash[compress]c                     dS )z:Handle a halted callback and return an empty 204 response.)rQ      r   )r   s    rL   _handle_errorz$Dash.init_app.<locals>._handle_error3  s	     7rN   zF_dash-component-suites/<string:package_name>/<path:fingerprinted_path>z_dash-layoutz_dash-dependenciesz_dash-update-componentPOSTz_reload-hashz_favicon.icorQ   z<path:path>)&r   updater   r   rq   replaceregister_blueprintr   	Blueprintrg   ri   rj   lstriprt   flask_compressr   r   r   versionrT   rS   errorhandlerr   before_request_setup_serverr   _invalid_resources_handler_add_urlserve_component_suitesserve_layoutdependenciesdispatchserve_reload_hash_serve_default_faviconindexr,   APPenable_pages)
r   appkwargsr   	bp_prefixassets_blueprint_namer   _flask_compress_versionr@   r   s
             rL   r   zDash.init_app  s    f  
 V	
 	
 	
 ?DK199#sCCKKCQTUU	#, 9 9 9&&O%"k7 & =+-44S99!:	  	
 	
 	
 ? 	333333 %%%*7$%566>+ +' K&(<  H-w1G1GGG AGxDK&';<   !T 
 
	!	!-	0	0	 	 
1	0	 	""4#5666 	7  !566t7VWWWT'	
 	
 	
 	nd&7888*D,=>>>.xHHHnd&<===nd&ABBBb$*%%% 	mTZ000s   A4E 
E2E--E2GETc                     | j         j        |z   }| j                            |||t	          |                     | j                            |           d S )N)	view_funcendpointmethods)r   rq   r   add_url_rulelistr   append)r   rg   r   r   	full_names        rL   r   zDash._add_urlN  s]    K6=	  YW 	! 	
 	
 	
 	9%%%%%rN   c                     | j         S N)r   r   s    rL   layoutzDash.layoutY  s
    |rN   c                     | j         r|                                 n| j        }| j        rt          j        |g| j        z             }|S )Nchildren)r   r   r   r
   Divr   r   s     rL   _layout_valuezDash._layout_value]  sL    #'#;M ! 	JXx$2H'HIIIFrN   c                 ^   t          j        |           t          |          | _        || _        | j        rq| j        sl| j        j        sbdd|                                 }t          j	        ||            |fd|
                                D                       | _        d S d S d S d S )Nc                      t                     }t          |j        dd            fd j        D             }|                    d|          r|pg |d<    |di |S )N__signature__c                     i | ]F}t          |          r4|d k    srj        |         j        j        k    5|t	          |          GS r?   )rT   
parametersdefaultREQUIREDr   ).0pcsigs     rL   
<dictcomp>z5Dash.layout.<locals>.simple_clone.<locals>.<dictcomp>z  se       q!}}
 T			q0A0IQZ0W0W	 wq!}} 1X0W0WrN   r  r   )r\   r   r   _prop_namesget)r  r  clspropsr  s   `   @rL   simple_clonez!Dash.layout.<locals>.simple_clonet  s    1gg clOTBB    ]   99Z22 7(0BE*%s||U||#rN   c                 &    g | ]} |          S r   r   )r  r  r  s     rL   
<listcomp>zDash.layout.<locals>.<listcomp>  s!    GGGQaGGGrN   r   )r*   validate_layout_typecallabler   r   r   r   rx   r  validate_layout_traverse_ids)r   valuelayout_valuer  s      @rL   r   zDash.layoutf  s    &u---#+E?? 
 $	*	 K<	$ $ $ $$  --//L%e\:::%1\GGGG,*D*D*F*FGGG& &D"""5	 	 	 	 	 	rN   c                     | j         S r   )r   r   s    rL   r   zDash.index_string  s    !!rN   c                 h    t           t          t          f}t          j        d||           || _        d S )Nzindex string)_re_index_entry_re_index_config_re_index_scriptsr*   validate_indexr   )r   r  checkss      rL   r   zDash.index_string  s3    !#35FG ???"rN   c                 p    |                                  }t          j        t          |          d          S )Nr4   mimetype)r  r   Responser$   r  s     rL   r   zDash.serve_layout  s:    ##%% ~FOO'
 
 
 	
rN   c           	         | j         j        | j         j        | j        j        | j        j        | j         j        | j         j        | j         j        t          j
        d}| j        j        r,t          | j        j        dz            | j        j        d|d<   | j        r=| j         j        s1| j        }| j        rt#          j        |g| j        z             }||d<   |S )N)rp   rr   uiprops_checkrz   rx   r}   children_props  )interval	max_retry
hot_reloadr  r   )r   rp   rr   
_dev_toolsr,  r-  rz   rx   r}   r   r.  r2  rF   hot_reload_intervalhot_reload_max_retryr   r   r
   r  )r   r   r   s      rL   _configzDash._config  s     "&!>(,(L/$?6"k8,0K,T K4/>	
 	
 ?% 	   Cd JKK!_A$ $F< 
 ! 		<$+*R 		< $ 6 % $(H/043II% % %! +<F&'rN   c                 (   | j         }|j        5  |j        }|j        }|j        }d|_        g |_        d d d            n# 1 swxY w Y   t          j        ||t          | j        	                                          t          |          d          S )NF)
reloadHashr   packagesfiles)
r   r   r   r   r~   r   jsonifyr   r   keys)r   _reloadr   changed_hashs        rL   r   zDash.serve_reload_hash  s    "\ 	( 	(<D,GLE GL%'G"	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( }# !6!;!;!=!=>>g	 
 
 	
s   $?AAc           	          d fd	}g }|D ]d}|                     dd          }d|v r|d         }t          |t                    r|gn|}|D ]t          fddD                       r                    dd           j        |d	                                                 |s&|                     ||d	         
                     d|v rG|sCt          |d         t                    r|                    |d                    ||d         z  }d|v rt          d          d|v r> 	                    |d                   }|d|d          z  }|                    |           f|S )NrQ   c                 X    t           fddD                       rX                     dd           t          j        | dt          j                                       d                    j        }nt          j        |          j        }t          j                            t          j        	                    t          j        |         j                             }t          t	          j        |          j                  }t!           ||          }j        j         d| d| S )	Nc              3   H   K   | ]}                     |d z             V  dS )r   N
startswith)r  xrelative_package_paths     rL   	<genexpr>zSDash._collect_and_register_resources.<locals>._relative_url_path.<locals>.<genexpr>  sI         &00S99     rN   r	   r
   r   dash.rQ   r   r   z_dash-component-suites/r   )anyr   	importlibimport_moduler   r   splitr   r^   dirnamer   modules__file__rF   statst_mtimer   r   rr   )rF  	namespacer   module_pathmodifiedfingerprintr   s   `     rL   _relative_url_pathz@Dash._collect_and_register_resources.<locals>._relative_url_path  s-       6     	I )>(E(Egr(R(R%#1 LL27==1F#G#G#JLL   $1)<<H',,I 6 ?@@BW K 27;//899H+,A7HUUKk:llS\ll_jlllrN   dynamicFrF  c              3       K   | ]}|v V  	d S r   r   )r  rE  rel_paths     rL   rG  z7Dash._collect_and_register_resources.<locals>.<genexpr>  s'      PPQ1=PPPPPPrN   rH  rI  rS  )rF  rS  external_urlabsolute_pathz4Serving files from absolute_path isn't supported yet
asset_path?m=ts)rQ   rQ   )
r  r   r   rJ  r   r   addr   	Exceptionget_asset_url)	r   	resourcesrW  srcsresourceis_dynamic_resourcepaths
static_urlrZ  s	   `       @rL   _collect_and_register_resourcesz$Dash._collect_and_register_resources  s   
	m 	m 	m 	m 	m 	m* !  	(  	(H"*,,y%"@"@&(22 !89#-eS#9#9Du %  HPPPP2OPPPPP A#+#3#3GR#@#@)(;*?@DDXNNN. ..6>*2;*?      8++* 9!(>":C@@ 9H^$<==== 88 H,, VWWW))!//0FGG
4HTN444
J'''rN   c                     | j         j        }|                     | j                                                  }d                    d ||z   D                       S )N
c                 h    g | ]/}t          |t                    rt          d |d          nd| d0S )linkTopenedz<link rel="stylesheet" href="z">r   dictr   )r  rm  s     rL   r  z0Dash._generate_css_dist_html.<locals>.<listcomp>  s[         dD))>
645555=T===  rN   )r   rw   ri  r   get_all_cssr^   )r   external_linkslinkss      rL   _generate_css_dist_htmlzDash._generate_css_dist_html  sf    944TX5I5I5K5KLLyy  ,e3	  
 
 	
rN   c                    | j         d         du rdndfdt          j        D             }| j         j        }|                     | j        j                            ||                    | j        j	        z   |                     | j        
                    |          | j        j                            t          j        |          z   | j        j                            t          j        |          z   | j        j                            t          j        |          z   | j        j                            t          j        |          z             z   }| j                            t"          j                   t"          j                                         d                    d |D             d	 | j        D             z             S )
Nr-  Tdevprodc                 P    g | ]"}fd |                                 D             #S )c                 V    i | ]%\  }}|t          |t                    r|         n|&S r   )r   rq  )r  keyr  modes      rL   r  z:Dash._generate_scripts_html.<locals>.<listcomp>.<dictcomp>)  sF       C Jud$;$;FU4[[  rN   )items)r  js_dist_dependencyr|  s     rL   r  z/Dash._generate_scripts_html.<locals>.<listcomp>(  sX     
 
 

 #	   "4":":"<"<  
 
 
rN   )dev_bundlesrk  c                 d    g | ]-}t          |t                    rt          d |          nd| d.S )scriptz<script src="z"></script>rp  r  srcs     rL   r  z/Dash._generate_scripts_html.<locals>.<listcomp>J  sV         c4((6
8S)))5S555  rN   c                     g | ]}d | d	S )z<script>	</script>r   r  s     rL   r  z/Dash._generate_scripts_html.<locals>.<listcomp>P  s$    IIIS(#(((IIIrN   )r3  r)   _js_dist_dependenciesserve_dev_bundlesri  r   
_resources_filter_resourcesr   rv   get_all_scripts_js_distr	   r
   r   r   extendr'   GLOBAL_INLINE_SCRIPTSclearr^   )r   depsrw  rd  r|  s       @rL   _generate_scripts_htmlzDash._generate_scripts_html  s    6$>>uuF
 
 
 

 '5&J
 
 
 o/00'99$C9PP  k*+ 22,,,==,);;"+ <   ,);;Lc <  	 ,);;Ms <  	 ,);;'S <   	 	, 	##I$CDDD'--///yy   	   JID4HIIIJ
 
 	
rN   c                 L    dt          |                                            dS )Nz2<script id="_dash-config" type="application/json">r  )r$   r6  r   s    rL   _generate_config_htmlzDash._generate_config_htmlS  s#    fGDLLNND[D[ffffrN   c                     d| j          dS )Nz:<script id="_dash-renderer" type="application/javascript">r  )r   r   s    rL   _generate_rendererzDash._generate_rendererV  s    dDMddddrN   c                    | j         j        }t          d |D                       }t          d |D                       }t          d |D                       }g }|s|                    d           |s|                    d           |s|                    d           |d |D             z  }d                    |          S )	Nc              3   J   K   | ]}|                     d d          dk    V  dS )z
http-equivrQ   zX-UA-CompatibleNr  r  rE  s     rL   rG  z+Dash._generate_meta_html.<locals>.<genexpr>[  sG       
 
=>AEE,##'88
 
 
 
 
 
rN   c              3      K   | ]}d |v V  	dS )charsetNr   r  s     rL   rG  z+Dash._generate_meta_html.<locals>.<genexpr>^  s&      <<Q)q.<<<<<<rN   c              3   H   K   | ]}|                     d           dk    V  dS )rg   viewportNr  r  s     rL   rG  z+Dash._generate_meta_html.<locals>.<genexpr>_  s1      JJ1155==J6JJJJJJrN   z5<meta http-equiv="X-UA-Compatible" content="IE=edge">z<meta charset="UTF-8">zD<meta name="viewport" content="width=device-width, initial-scale=1">c                 2    g | ]}t          d |d          S )metaTrn  )r   r  s     rL   r  z,Dash._generate_meta_html.<locals>.<listcomp>k  s'    GGGFAd333GGGrN   z
      )r   ru   rJ  r   r^   )r   ru   has_ie_compathas_charsethas_viewporttagss         rL   _generate_meta_htmlzDash._generate_meta_htmlY  s    K)	 
 
BK
 
 
 
 
 <<)<<<<<JJ	JJJJJ 	QKKOPPP 	2KK0111 	KKV   	GGYGGGGt$$$rN   c                    |                      t          j        j                            d                    \  }}|                    dd          }|r|                     |          }|r9d                    t          j        j        |	                    d          g          nd }|                    d          }|r|n|}|                    d| j
                  }t          |          r|r |di |n	 |            }|                    dd          }t          |          r|r |di |n	 |            }t          d| dt          j        j         d	| d
| d| d| d| d| d          S )Nr   imagerQ   	image_urlr|   descriptionz/
            <meta name="description" content="z" />
            <!-- Twitter Card data -->
            <meta property="twitter:card" content="summary_large_image">
            <meta property="twitter:url" content="z7">
            <meta property="twitter:title" content="z=">
            <meta property="twitter:description" content="z7">
            <meta property="twitter:image" content="zW">
            <!-- Open Graph data -->
            <meta property="og:title" content="zt" />
            <meta property="og:type" content="website" />
            <meta property="og:description" content="z4" />
            <meta property="og:image" content="z">
            r   )_path_to_pager   requestr   stripr  rb  r^   url_rootr   r|   r  r   url)	r   
start_pagepath_variablesr  assets_image_urlsupplied_image_urlr  r|   r  s	            rL   _pages_meta_tagszDash._pages_meta_tagso  s   %)%7%78J8P8PQT8U8U%V%V"
N w++ 	.&&u--EDISBGGU]+U\\#->->?@@@t 	 (^^K88*<R&&BR	w
33E?? 	K/=JEE++N+++5577E nn]B77K   	1?R--n---[[]]  /:  49=3D	 
 6;  <G  6?  16  7B  1:  
 
 	
rN   c                    t          |          \  }}t          j        | j        ||           d|                    d          d         z   }t
          j                            |d          }t          j	        |         }| j
                            d||j        ||j                   t          j        t!          j        ||          |          }|rd|j        _        nr|                                 |                                d         }	t          j        j                            d          }
d	|	 d	|
k    rt          j        d d
          }|S )Nr   zapplication/octet-streamz7serving -- package: %s[%s] resource: %s => location: %sr(  i3r   zIf-None-Match"i0  )status)r   r*   validate_js_pathr   rM  	mimetypes	types_mapr  r   rO  r   debugr   __path__r   r*  pkgutilget_datacache_controlmax_ageadd_etagget_etagr  headers)r   package_namefingerprinted_pathpath_in_pkghas_fingerprint	extensionr)  packageresponsetagrequest_etags              rL   r   zDash.serve_component_suites  sP   '89K'L'L$_"4#8,TTT+++C0044	&**96PQQ+l+E	
 	
 	
 >\;77(
 
 
  	< .6H"** ##%%a(C =044_EEL3zzz\)) >$s;;;rN   c           
         |                                  }|                                 }|                                 }|                                 }|                                 }| j        }d}	| j        r|                                 }	| j        rlt          j
                            t          j
                            | j        j        | j                            }
|                     | j                   d|
 }n| j        j        }| dt"           }t%          ddd|dd	          }|                     |	|z   ||||t(          ||
          }t*          t,          t.          t0          f}t3          j        d||           |S )NrQ   r^  z_favicon.ico?v=rm  iconimage/x-icon)relr\   hrefTrn  )metasr|   r   r   r   	app_entryfaviconr   r   )r  ru  r  r  r  r|   r   r  r   r   r   getmtimer^   r   ri   rb  rr   r   r   interpolate_index
_app_entry_re_index_entry_id_re_index_config_id_re_index_scripts_id_re_renderer_scripts_idr*   r%  )r   argsr   r   r   r   r  r   r|   pages_metasfavicon_mod_timefavicon_urlprefixr  r   r&  s                   rL   r   z
Dash.index  s   --//**,,++--((****,, 
> 	2//11K= 	B!w//T[6FF    "//>>UUCSUUKK[9F#AAKAAKNKHH
 
 
 &&%  ' 	
 	
  #	
 	 &%888rN   c	                 <    t          | j        ||||||||	  	        S )a^  Called to create the initial HTML string that is loaded on page.
        Override this method to provide you own custom HTML.

        :Example:

            class MyDash(dash.Dash):
                def interpolate_index(self, **kwargs):
                    return '''<!DOCTYPE html>
                    <html>
                        <head>
                            <title>My App</title>
                        </head>
                        <body>
                            <div id="custom-header">My custom header</div>
                            {app_entry}
                            {config}
                            {scripts}
                            {renderer}
                            <div id="custom-footer">My custom footer</div>
                        </body>
                    </html>'''.format(app_entry=kwargs.get('app_entry'),
                                      config=kwargs.get('config'),
                                      scripts=kwargs.get('scripts'),
                                      renderer=kwargs.get('renderer'))

        :param metas: Collected & formatted meta tags.
        :param title: The title of the app.
        :param css: Collected & formatted css dependencies as <link> tags.
        :param config: Configs needed by dash-renderer.
        :param scripts: Collected & formatted scripts tags.
        :param renderer: A script tag that instantiates the DashRenderer.
        :param app_entry: Where the app will render.
        :param favicon: A favicon <link> tag if found in assets folder.
        :return: The interpolated HTML string for the index.
        )r  r|   r   r   r   r  r   r  )r!   r   )	r   r  r|   r   r   r   r  r  r   s	            rL   r  zDash.interpolate_index  s:    \ 

 

 

 
	
rN   c                 4    t          j        | j                  S r   )r   r;  r   r   s    rL   r   zDash.dependencies(  s    }T0111rN   c                 f    t          j        | j        | j        | j        j        | j        |g|R i |S )aY
  Create a callback that updates the output by calling a clientside
        (JavaScript) function instead of a Python function.

        Unlike `@app.callback`, `clientside_callback` is not a decorator:
        it takes either a
        `dash.dependencies.ClientsideFunction(namespace, function_name)`
        argument that describes which JavaScript function to call
        (Dash will look for the JavaScript function at
        `window.dash_clientside[namespace][function_name]`), or it may take
        a string argument that contains the clientside function source.

        For example, when using a `dash.dependencies.ClientsideFunction`:
        ```
        app.clientside_callback(
            ClientsideFunction('my_clientside_library', 'my_function'),
            Output('my-div' 'children'),
            [Input('my-input', 'value'),
             Input('another-input', 'value')]
        )
        ```

        With this signature, Dash's front-end will call
        `window.dash_clientside.my_clientside_library.my_function` with the
        current values of the `value` properties of the components `my-input`
        and `another-input` whenever those values change.

        Include a JavaScript file by including it your `assets/` folder. The
        file can be named anything but you'll need to assign the function's
        namespace to the `window.dash_clientside` namespace. For example,
        this file might look:
        ```
        window.dash_clientside = window.dash_clientside || {};
        window.dash_clientside.my_clientside_library = {
            my_function: function(input_value_1, input_value_2) {
                return (
                    parseFloat(input_value_1, 10) +
                    parseFloat(input_value_2, 10)
                );
            }
        }
        ```

        Alternatively, you can pass the JavaScript source directly to
        `clientside_callback`. In this case, the same example would look like:
        ```
        app.clientside_callback(
            '''
            function(input_value_1, input_value_2) {
                return (
                    parseFloat(input_value_1, 10) +
                    parseFloat(input_value_2, 10)
                );
            }
            ''',
            Output('my-div' 'children'),
            [Input('my-input', 'value'),
             Input('another-input', 'value')]
        )
        ```

        The last, optional argument `prevent_initial_call` causes the callback
        not to fire when its outputs are first added to the page. Defaults to
        `False` unless `prevent_initial_callbacks=True` at the app level.
        )r'   register_clientside_callbackr   r   r   ry   r   )r   clientside_functionr  r   s       rL   clientside_callbackzDash.clientside_callback+  sU    B 5K1 
 
 
 
 
 
 	
rN   c                 T    t          j        || j        j        | j        | j        d|S )aV  
        Normally used as a decorator, `@app.callback` provides a server-side
        callback relating the values of one or more `Output` items to one or
        more `Input` items which will trigger the callback when they change,
        and optionally `State` items which provide additional information but
        do not trigger the callback directly.

        The last, optional argument `prevent_initial_call` causes the callback
        not to fire when its outputs are first added to the page. Defaults to
        `False` unless `prevent_initial_callbacks=True` at the app level.


        ) config_prevent_initial_callbackscallback_listr   )r'   callbackr   ry   r   r   )r   _args_kwargss      rL   r  zDash.callbackv  s?     !-1[-R-*	
 

 
 
 	
rN   r/  )managerr0  runningcancelprogressprogress_defaultcache_args_to_ignorec                d    t          j        |d|||||||| j        | j        | j        j        d|	S )z
        Deprecated: long callbacks are now supported natively with regular callbacks,
        use `background=True` with `dash.callback` or `app.callback` instead.
        T)
backgroundr  r0  r  r  r  r  r  r   r  r  )r'   r  r   r   r   ry   )
r   r  r0  r  r  r  r  r  r  r  s
             rL   long_callbackzDash.long_callback  sW      !-!5*--1[-R
 
 
 
 	
rN   c                 2   t           j                                        }t          i           }|                    dg           x|_        }|                    dg           x|_        }|d         }|                    d          pt          |          }||_        t          |          x|_
        t          |          |_        | j        |_        |                    dg           }fd|D             |_        t          j        d          x}|_        t#          ||z             }		 | j        |         }
|
d	         }|
                    d
d          |_        |
d         }||z   t)                    D ]<}t+          |t,                    r|D ]}t/          ||           t/          ||           =t1          fd|          }||_        t+          |t4                     o,|t-          t7          t9          |                              k    |_        |
d         }t+          |t,                    s|gn|t1          fd|          }||_        t+          |t4                     o,|t-          t7          t9          |                              k    |_        n(# t@          $ r}d| d}tA          |          |d }~ww xY wtC                      }|"                    |#                    tI          j%        |g|	R || j        |d                     |S )NinputsstateoutputoutputschangedPropIdsc                 @    g | ]}|                     |          d S ))prop_idr  r  )r  rE  input_valuess     rL   r  z!Dash.dispatch.<locals>.<listcomp>  s<     
 
 
=>L$4$4Q$7$788
 
 
rN   r4   r(  r  longFinputs_state_indicesc                     |          S r   r   )indinputs_states    rL   <lambda>zDash.dispatch.<locals>.<lambda>      L- rN   outputs_indicesc                     |          S r   r   )r   flat_outputss    rL   r  zDash.dispatch.<locals>.<lambda>  r  rN   z(Callback function not found for output 'z)', perhaps you forgot to prepend the '@'?)outputs_listr   callback_context)&r   r  get_jsonr   r  inputs_liststates_listr#   r  r   r  state_valuesr   r   triggered_inputsr*  dash_responser    r   ignore_register_pager%   r   r   r/   r-   args_groupingrF   ranger.   using_args_groupingoutputs_groupingusing_outputs_groupingKeyErrorr   set_datarun	functoolspartial)r   bodygr  r  r  r  changed_propsr  r  cbfuncr  spattern_match_gr  r  r  missing_callback_functionmsgctxr  r  r  s                        @@@rL   r   zDash.dispatch  s   }%%''"!%b"
 "
 	
 !%R!
 !
 	
 hxx	**G.?.G.G% 6""	#'..$ 	
% !1266
 
 
 
BO
 
 
 N$6777	8O fun--2	?"6*Bj>D%'VVFE%:%:A" $&&<#= !E>L3LAAL " 4 4a&& J+, J J)/=IIII!!]3333(----/C M ,AO3S999 (E,/C"D"DEEFFG ! !!23OlD11 , ,~++----    "2A444 R#tE,2O2O,P,P'Q'QQ $$
  	? 	? 	?nVnnnC3--%>>	? nnGG!  ".*.*B%&   
	
 
	
 
	
 s   ,E2J 
K)J??Kc                 n   | j         d         rd S d| j         d<   | j        j        }t          j        D ])}t
          j        |         }t          |dd          }|p|}*|| j        j        _        | j        j	        r| 
                                 | j        s| j        rt          | _        t          j        | j        |                                            |                                  |                                  t'          t(          j                  D ]E}|| j        v rt/          d| d          t(          j                            |          | j        |<   F| j                            t(          j                   t(          j                                         t          j        | j                   d S )Nr   T_force_eager_loadingFzThe callback `zI` provided with `dash.callback` was already assigned with `app.callback`.)r   r   rn   r   registryr   rO  r   r   ro   _walk_assets_directoryr   r   page_containerr*   r  r  r  ru  r   r'   GLOBAL_CALLBACK_MAPr   r   popr   r  GLOBAL_CALLBACK_LISTr  validate_long_callbacks)r   rn   module_namemoduleeagerks         rL   r   zDash._setup_server  s   ">2 	F26/ 1,5 	3 	3K[-FF$:EBBE)2UMM -:);+ 	*''))){ 	)t~ 	)(DK!$+t/A/A/C/CDDD##%%%$$&&& i344 	H 	HAD%%%'4Q 4 4 4  
 $-#@#D#DQ#G#GDa  ""9#ABBB&,,...)$*;<<<<<rN   c                     ||d}| j         j        r+|                     |                    d                    |d<   | j                            |           |S )N)r]  filepathr   r[  )r   rl   rb  r   r   r   )r   url_path	file_pathress       rL   _add_assets_resourcezDash._add_assets_resource9  s]    %9==;+ 	K"&"4"4X__S5I5I"J"JC!!),,,
rN   c                 
   | j         j        }t          j        d          }| j         j        }|rt          j        |          nd t          t          j        |                    D ]\  }}}||k    rd}n|                    |d          	                    d          	                    d          }|
                    |          }	t          |	          dk    r)d                    |
                    |                    }n|	d         }rfd|D             }
n|}
t          |
          D ]}|rd                    ||g          n|}t          j                            ||          }|                    d          r/| j                            |                     ||                     |                    d	          r/| j                            |                     ||                     |d
k    r|| _        Ӑd S )Nz[\\/]+rQ   \r   r   r   c              3   F   K   | ]}                     |          |V  d S r   )search)r  rE  ignore_filters     rL   rG  z.Dash._walk_assets_directory.<locals>.<genexpr>R  s6      MM1]5I5I!5L5LMQMMMMMMrN   jsr   favicon.ico)r   ri   recompilerk   sortedr   walkr   r   rM  lenr^   r   endswithr   append_scriptr6  r   
append_cssr   )r   walk_dirslash_splitter
ignore_strcurrentr   r:  baser  splitted	files_genfr   fullr;  s                 @rL   r'  zDash._walk_assets_directory@  s   ;,I..[.
2<F
:...$!'(9(9!:!: 	) 	)GQ(""OOHb1188>>EEcJJ)//22x==1$$88N$8$8$;$;<<DD#A;D "MMMMMMM		!	I&& 
) 
).29sxxq	***w||GQ//::d## )L..t/H/Ht/T/TUUUUZZ&& )H''(A(A$(M(MNNNN-''$(DM
)!	) 	)rN   c                      | j         d         dfS )Nr   i  )r  )errs    rL   r   zDash._invalid_resources_handlerb  s    x{CrN   c                  T    t          j        t          j        dd          d          S )Ndashr=  r  )content_type)r   r*  r  r  r   rN   rL   r   zDash._serve_default_faviconf  s-    ~V]33.
 
 
 	
rN   sha256c                 T   g d}|vr%t          dd                    |          z             t          t                    fd| j                            t          j                   t          j                                         fd| j        | j	        gz   D             S )a  Calculates CSP hashes (sha + base64) of all inline scripts, such that
        one of the biggest benefits of CSP (disallowing general inline scripts)
        can be utilized together with Dash clientside callbacks (inline scripts).

        Calculate these hashes after all inline callbacks are defined,
        and add them to your CSP headers before starting the server, for example
        with the flask-talisman package from PyPI:

        flask_talisman.Talisman(app.server, content_security_policy={
            "default-src": "'self'",
            "script-src": ["'self'"] + app.csp_hashes()
        })

        :param hash_algorithm: One of the recognized CSP hash algorithms ('sha256', 'sha384', 'sha512').
        :return: List of CSP hash strings of all inline scripts.
        )rT  sha384sha512zPossible CSP hash algorithms: z, c                     t          j         |                     d                                                                                  d          S )Nutf-8)base64	b64encodeencodedigestdecode)r  methods    rL   r?  zDash.csp_hashes.<locals>._hash  sK    #FF6==+A+A$B$B$I$I$K$KLLSS  rN   c                 4    g | ]}d  d |           d S )'-r   )r  r  r?  hash_algorithms     rL   r  z#Dash.csp_hashes.<locals>.<listcomp>  sD     
 
 
 211v111
 
 
rN   )
r   r^   r   hashlibr   r  r'   r  r  r   )r   rc  HASH_ALGORITHMSr?  r_  s    ` @@rL   
csp_hasheszDash.csp_hashesl  s    $ 988000499_3M3MM   .11	 	 	 	 	
 	##I$CDDD'--///
 
 
 
 
/4=/A
 
 
 	
rN   c                 6    t          j        | j        |          S r   )r(   app_get_asset_urlr   r   r   s     rL   rb  zDash.get_asset_url  s    +DK>>>rN   c                 @    t          j        | j        j        |          S )a  
        Return a path with `requests_pathname_prefix` prefixed before it.
        Use this function when specifying local URL paths that will work
        in environments regardless of what `requests_pathname_prefix` is.
        In some deployment environments, like Dash Enterprise,
        `requests_pathname_prefix` is set to the application name,
        e.g. `my-dash-app`.
        When working locally, `requests_pathname_prefix` might be unset and
        so a relative URL like `/page-2` can just be `/page-2`.
        However, when the app is deployed to a URL like `/my-dash-app`, then
        `app.get_relative_path('/page-2')` will return `/my-dash-app/page-2`.
        This can be used as an alternative to `get_asset_url` as well with
        `app.get_relative_path('/assets/logo.png')`

        Use this function with `app.strip_relative_path` in callbacks that
        deal with `dcc.Location` `pathname` routing.
        That is, your usage may look like:
        ```
        app.layout = html.Div([
            dcc.Location(id='url'),
            html.Div(id='content')
        ])
        @app.callback(Output('content', 'children'), [Input('url', 'pathname')])
        def display_content(path):
            page_name = app.strip_relative_path(path)
            if not page_name:  # None or ''
                return html.Div([
                    dcc.Link(href=app.get_relative_path('/page-1')),
                    dcc.Link(href=app.get_relative_path('/page-2')),
                ])
            elif page_name == 'page-1':
                return chapters.page_1
            if page_name == "page-2":
                return chapters.page_2
        ```
        )r(   app_get_relative_pathr   rr   ri  s     rL   get_relative_pathzDash.get_relative_path  s$    J /K0$
 
 	
rN   c                 @    t          j        | j        j        |          S )ap  
        Return a path with `requests_pathname_prefix` and leading and trailing
        slashes stripped from it. Also, if None is passed in, None is returned.
        Use this function with `get_relative_path` in callbacks that deal
        with `dcc.Location` `pathname` routing.
        That is, your usage may look like:
        ```
        app.layout = html.Div([
            dcc.Location(id='url'),
            html.Div(id='content')
        ])
        @app.callback(Output('content', 'children'), [Input('url', 'pathname')])
        def display_content(path):
            page_name = app.strip_relative_path(path)
            if not page_name:  # None or ''
                return html.Div([
                    dcc.Link(href=app.get_relative_path('/page-1')),
                    dcc.Link(href=app.get_relative_path('/page-2')),
                ])
            elif page_name == 'page-1':
                return chapters.page_1
            if page_name == "page-2":
                return chapters.page_2
        ```
        Note that `chapters.page_1` will be served if the user visits `/page-1`
        _or_ `/page-1/` since `strip_relative_path` removes the trailing slash.

        Also note that `strip_relative_path` is compatible with
        `get_relative_path` in environments where `requests_pathname_prefix` set.
        In some deployment environments, like Dash Enterprise,
        `requests_pathname_prefix` is set to the application name, e.g. `my-dash-app`.
        When working locally, `requests_pathname_prefix` might be unset and
        so a relative URL like `/page-2` can just be `/page-2`.
        However, when the app is deployed to a URL like `/my-dash-app`, then
        `app.get_relative_path('/page-2')` will return `/my-dash-app/page-2`

        The `pathname` property of `dcc.Location` will return '`/my-dash-app/page-2`'
        to the callback.
        In this case, `app.strip_relative_path('/my-dash-app/page-2')`
        will return `'page-2'`

        For nested URLs, slashes are still included:
        `app.strip_relative_path('/page-1/sub-page-1/')` will return
        `page-1/sub-page-1`
        ```
        )r(   app_strip_relative_pathr   rr   ri  s     rL   strip_relative_pathzDash.strip_relative_path  s$    ^ 1K0$
 
 	
rN   c           
      d   |                     dd          }t                      x}| _        dD ]+}t          ||                     |d           |          ||<   ,dt          dfdt          dfd	t
          d
ffD ]8\  }}} |t          ||                     |d           |                    ||<   9|S )Nr  F)r,  r-  r  r2  silence_routes_loggingprune_errors)r  r4     hot_reload_watch_intervalg      ?r5     )r  r   r3  r   floatrF   )r   r   r  	dev_toolsattr_typer  s          rL   r   zDash._setup_dev_tools  s    

7E**&3oo5	DO
 
	 
	D 2fjjt,,e  IdOO
 #E1-(%5#S!,%
 	 	 D%
 $e#D&**T4*@*@'RRR IdOO rN   c                 J    |t          ddd          }                     |||||||||	|

  
        j        r1t          j        d                              t          j                   j        rk j        }t                      |_
        d t          t          j                  D             }dt          j        v rmdd	lm} t%          |          D ]W\  }t'          |          rBt(          j                            d
          }|j        d         t1          |d           |||<   Xfd|D             t%          |          D ]Q\  }t3          d          r<dt4          j                            j                  v rfddD             ||dz   <   Rt;          j         fd          |_        d|j        _         |j        !                                 |r@j"        r9tG          d           j$        %                    tL                    fd            }|rAj'        r:d }d } j$        (                    |            j$        )                    |           |r8j*        r1 j+        j,        j-        s d j+        j,        _-        t]          d           |S )a[  Activate the dev tools, called by `run`. If your application
        is served by wsgi and you want to activate the dev tools, you can call
        this method out of `__main__`.

        All parameters can be set by environment variables as listed.
        Values provided here take precedence over environment variables.

        Available dev_tools environment variables:

            - DASH_DEBUG
            - DASH_UI
            - DASH_PROPS_CHECK
            - DASH_SERVE_DEV_BUNDLES
            - DASH_HOT_RELOAD
            - DASH_HOT_RELOAD_INTERVAL
            - DASH_HOT_RELOAD_WATCH_INTERVAL
            - DASH_HOT_RELOAD_MAX_RETRY
            - DASH_SILENCE_ROUTES_LOGGING
            - DASH_PRUNE_ERRORS

        :param debug: Enable/disable all the dev tools unless overridden by the
            arguments or environment variables. Default is ``True`` when
            ``enable_dev_tools`` is called directly, and ``False`` when called
            via ``run``. env: ``DASH_DEBUG``
        :type debug: bool

        :param dev_tools_ui: Show the dev tools UI. env: ``DASH_UI``
        :type dev_tools_ui: bool

        :param dev_tools_props_check: Validate the types and values of Dash
            component props. env: ``DASH_PROPS_CHECK``
        :type dev_tools_props_check: bool

        :param dev_tools_serve_dev_bundles: Serve the dev bundles. Production
            bundles do not necessarily include all the dev tools code.
            env: ``DASH_SERVE_DEV_BUNDLES``
        :type dev_tools_serve_dev_bundles: bool

        :param dev_tools_hot_reload: Activate hot reloading when app, assets,
            and component files change. env: ``DASH_HOT_RELOAD``
        :type dev_tools_hot_reload: bool

        :param dev_tools_hot_reload_interval: Interval in seconds for the
            client to request the reload hash. Default 3.
            env: ``DASH_HOT_RELOAD_INTERVAL``
        :type dev_tools_hot_reload_interval: float

        :param dev_tools_hot_reload_watch_interval: Interval in seconds for the
            server to check asset and component folders for changes.
            Default 0.5. env: ``DASH_HOT_RELOAD_WATCH_INTERVAL``
        :type dev_tools_hot_reload_watch_interval: float

        :param dev_tools_hot_reload_max_retry: Maximum number of failed reload
            hash requests before failing and displaying a pop up. Default 8.
            env: ``DASH_HOT_RELOAD_MAX_RETRY``
        :type dev_tools_hot_reload_max_retry: int

        :param dev_tools_silence_routes_logging: Silence the `werkzeug` logger,
            will remove all routes logging. Enabled with debugging by default
            because hot reload hash checks generate a lot of requests.
            env: ``DASH_SILENCE_ROUTES_LOGGING``
        :type dev_tools_silence_routes_logging: bool

        :param dev_tools_prune_errors: Reduce tracebacks to just user code,
            stripping out Flask and Dash pieces. Only available with debugging.
            `True` by default, set to `False` to see the complete traceback.
            env: ``DASH_PRUNE_ERRORS``
        :type dev_tools_prune_errors: bool

        :return: debug
        Nr  T)
r  r,  r-  r  r2  r4  rt  r5  rq  rr  werkzeugc                 B    g | ]}|d k    t          j        |          S )rh   )r  find_loaderr  s     rL   r  z)Dash.enable_dev_tools.<locals>.<listcomp>z  s4       
?? #A&&"??rN   _pytestr   )AssertionRewritingHookrR  r   c                 (   g | ]}t          |t                    rntt          |d           r$t          j                            |j                  n@t          |d          r*t          j                            |j        d                   n|j        S )r   _pathr   )r   r   rT   r   r   rN  r  filename)r  r  dash_test_paths     rL   r  z)Dash.enable_dev_tools.<locals>.<listcomp>  s     ' ' '  gz22& 7F++&RW__W\222
 7G,,&RW__M!$   %' ' 'rN   z	dash/dashc                     g | ]D}t           j                            t           j                            j                  |          ES r   )r   r   r^   rN  )r  rE  r  s     rL   r  z)Dash.enable_dev_tools.<locals>.<listcomp>  sI     : : : RW__W\%B%BAFF: : :rN   rH  r   c                  b    t          j        j        j        g z   j        j                  S )N)
sleep_time)r+   watchr   ri   _on_assets_changert  )component_packages_distrw  r   s   rL   r  z'Dash.enable_dev_tools.<locals>.<lambda>  s5    v|[./2II*(B      rN   )target   c                 ,    t          |           }|dfS )Ni  )ra   )r@   r`   r_   s     rL   _wrap_errorsz+Dash.enable_dev_tools.<locals>._wrap_errors  s     $FE223wrN   c                  T    dt          j                     d dit          j        _        d S )N__dash_server)durdesc)timer   r  timing_informationr   rN   rL   _before_requestz.Dash.enable_dev_tools.<locals>._before_request  s'    #TY[[$%G%G.***rN   c                    t           j                            dd           }|| S |                    dd           }|/t          t	          j                    |d         z
  dz            |d<   |                                D ]i\  }}|}|                    d          |d|d          dz  }|                    d          |d|d          z  }| j                            d	|           j| S )
Nr  r  r  r/  r  z;desc="r  z;dur=zServer-Timing)r   r  r  roundr  r}  r  r`  )r  r  
dash_totalrg   infor  s         rL   _after_requestz-Dash.enable_dev_tools.<locals>._after_request  s   %*W[[1Et%L%L"%-#O/33OTJJ
)(-ty{{Z=N/NRV.V(W(WJu%"4":":"<"< 	A 	AJD$ Exx''3!:4<!:!:!::xx2!6e!6!66$((%@@@@rN   zoWARNING: dev bundles requested with serve_locally=False.
This is not supported, switching to serve_locally=True)/r   r   rq  r   r   r   ERRORr2  r   r   r~   r   r   r&  r   rO  _pytest.assertion.rewriter  rE   r   rK  util	find_specsubmodule_search_locationssetattrrT   r   r   rN  r   Threadr   daemonstartrr  r&   r   r   ra  r,  r   after_requestr  r   r   rs   print)r   r  dev_tools_uidev_tools_props_checkdev_tools_serve_dev_bundlesdev_tools_hot_reloaddev_tools_hot_reload_interval#dev_tools_hot_reload_watch_intervaldev_tools_hot_reload_max_retry dev_tools_silence_routes_loggingdev_tools_prune_errorsr=  r9  r  r   	dash_specrJ   r  r  r  r  r  rw  r  r_   s   `                   @@@@@rL   enable_dev_toolszDash.enable_dev_tools  s   h ='t<<E))-9+ =&I!?#C/ * 
 
	 + 	Bj))227=AAA 9	)&G(??GL /899  H CK''      '0&9&9 4 4NE7!'+ABB 4$-N$<$<V$D$D	)2)Ma)P	6>BBB*3' ' ' '  (' ' '# (11  
77F++ rwL@ @ 1 1: : : :!>: : :+AAI6
 $-#3     $ $ $G  +/G ' &&((( 	Y+ 	b\\F[%%i00    10  	6Y\ 	6  
     , K&&777K%%n555 
	+
	 L'5
	 15DL-I  
 rN   c                 <   | j         }|j        5  d|_        t                      |_        | j        j        |v rt          j        	                    |t          j        
                    | j        j        |g                                        dd                              d          |j                            |                               t!          |          |                    d          d           || j        vrw|su|                     |          }|                    d          r| j                            |           n/|                    d          r| j                            |           |r|| j        v r| j                            |           fd}|                    d          r || j        j        j                   n/|                    d          r || j        j        j                   d d d            d S # 1 swxY w Y   d S )NTr8  r   r   )r  rU  is_cssr<  c                     d }| D ]}|                     d          k    r|} n |r|                     |           d S d S )Nr]  )r  remove)rc  	to_deleterr]  s      rL   delete_resourcez/Dash._on_assets_change.<locals>.delete_resource  sl    $(	!* & &A uu\22j@@,-	 %  A % 8%,,Y777778 8rN   )r   r   r   r   r~   r   ri   r   r   relpathcommonprefixr   r   r   r   rb  rF   rC  r   r6  r   rD  r   rE  r  r  )r   r  rU  deletedr=  r5  r  r]  s          @rL   r  zDash._on_assets_change  s   "\ /	H /	HGL(??GL{(H44GOO ,,dk.G-RSS  WT3''VC[[  &--#11*==$'MM"*"3"3E":":    4#555g533JIIC((.. 12237777!**511 1++C000 H4#555*11(;;;8 8 8 8 8  ((.. H'(?(JKKKK!**511 H'(;(FGGG_/	H /	H /	H /	H /	H /	H /	H /	H /	H /	H /	H /	H /	H /	H /	H /	H /	H /	Hs   G4HHHHOSTz	127.0.0.1PORT8050
DASH_PROXYc                    |t          ddd          }|                     ||||||	|
|||
  
        }	 t          |          }|t          dd          v sJ n+# t          $ r}dt          |           g|_         d}~ww xY wt          j        d          dk    r|	                    d	          }|rd
nd}| j
        j        }rt          t                              d                    \  }fd} ||j        |d            ||j        |d            ||j        |d           j        j        j        r
dj         nd|f}n	||d| |f} | j        j        dg|R   | j
        j        rg x}|d<   | j
        j        D ]}t          j                            |          rTt          j        |          D ]>\  }}}|D ]5}|                    t          j                            ||                     6?ut          j                            |          r|                    |            | j        j        d|||d| dS )a  Start the flask server in local mode, you should not run this on a
        production server, use gunicorn/waitress instead.

        If a parameter can be set by an environment variable, that is listed
        too. Values provided here take precedence over environment variables.

        :param host: Host IP used to serve the application
            env: ``HOST``
        :type host: string

        :param port: Port used to serve the application
            env: ``PORT``
        :type port: int

        :param proxy: If this application will be served to a different URL
            via a proxy configured outside of Python, you can list it here
            as a string of the form ``"{input}::{output}"``, for example:
            ``"http://0.0.0.0:8050::https://my.domain.com"``
            so that the startup message will display an accurate URL.
            env: ``DASH_PROXY``
        :type proxy: string

        :param debug: Set Flask debug mode and enable dev tools.
            env: ``DASH_DEBUG``
        :type debug: bool

        :param debug: Enable/disable all the dev tools unless overridden by the
            arguments or environment variables. Default is ``True`` when
            ``enable_dev_tools`` is called directly, and ``False`` when called
            via ``run``. env: ``DASH_DEBUG``
        :type debug: bool

        :param dev_tools_ui: Show the dev tools UI. env: ``DASH_UI``
        :type dev_tools_ui: bool

        :param dev_tools_props_check: Validate the types and values of Dash
            component props. env: ``DASH_PROPS_CHECK``
        :type dev_tools_props_check: bool

        :param dev_tools_serve_dev_bundles: Serve the dev bundles. Production
            bundles do not necessarily include all the dev tools code.
            env: ``DASH_SERVE_DEV_BUNDLES``
        :type dev_tools_serve_dev_bundles: bool

        :param dev_tools_hot_reload: Activate hot reloading when app, assets,
            and component files change. env: ``DASH_HOT_RELOAD``
        :type dev_tools_hot_reload: bool

        :param dev_tools_hot_reload_interval: Interval in seconds for the
            client to request the reload hash. Default 3.
            env: ``DASH_HOT_RELOAD_INTERVAL``
        :type dev_tools_hot_reload_interval: float

        :param dev_tools_hot_reload_watch_interval: Interval in seconds for the
            server to check asset and component folders for changes.
            Default 0.5. env: ``DASH_HOT_RELOAD_WATCH_INTERVAL``
        :type dev_tools_hot_reload_watch_interval: float

        :param dev_tools_hot_reload_max_retry: Maximum number of failed reload
            hash requests before failing and displaying a pop up. Default 8.
            env: ``DASH_HOT_RELOAD_MAX_RETRY``
        :type dev_tools_hot_reload_max_retry: int

        :param dev_tools_silence_routes_logging: Silence the `werkzeug` logger,
            will remove all routes logging. Enabled with debugging by default
            because hot reload hash checks generate a lot of requests.
            env: ``DASH_SILENCE_ROUTES_LOGGING``
        :type dev_tools_silence_routes_logging: bool

        :param dev_tools_prune_errors: Reduce tracebacks to just user code,
            stripping out Flask and Dash pieces. Only available with debugging.
            `True` by default, set to `False` to see the complete traceback.
            env: ``DASH_PRUNE_ERRORS``
        :type dev_tools_prune_errors: bool

        :param flask_run_options: Given to `Flask.run`

        :return:
        Nr  Fr   i   z1Expecting an integer from 1 to 65535, found port=WERKZEUG_RUN_MAINtruessl_contexthttpshttpz::c                 |    | |k    r4t          d| d| d d                                 d| d|  d          d S )Nz
                            z: zA is incompatible with the proxy:
                                z0
                            To see your app at z+,
                            you must use )r   geturl)served_parturl_part	part_nameproxied_urlproxys      rL   verify_url_partz!Dash.run.<locals>.verify_url_part  s    "h..( &   *2   !&    1<0B0B0D0D    +4	    8C	        /.rN   protocolhostport:rQ   zDash is running on %s://%s%s%s
extra_files)r  r  r  r   )r   r  rF   r  ra  reprr  r   getenvr  r   rr   mapr   rM  schemehostnamer  r   r  r{   r   isdirrA  r   r^   isfiler   r  )r   r  r  r  r  r  r  r  r  r  r  r  r  r  flask_run_optionser  r  r   
served_urlr  display_urlr  dirpathr   	filenamesfnr  s      `                       @rL   r  zDash.run  s   @ ='u==E%%!' )/*,"
 
	t99D5E??***** 	 	 	V$t**VVWAF	 9())V33+//>>K"-9ww6H;7D A*-hD8I8I*J*J'
K	 	 	 	 	 	  
 18ZHHH
 3T6BBB
v>>>  &(.9.>F*(***B	  (z4zz4@DK?N+NNNN;- 	-=??K+M:: - -7==&& -13 J J-I"+ J JB'..rw||GR/H/HIIIIJJ W^^D)) -&&t,,,OTEOO=NOOOOOs   #A 
B#A<<Bc                    t          j        | j        j                  D ]\  }}}d |D             |d d <   |D ]}|                    d          s*|                    d          s|                    d          sCt           j                            ||          }t          |d          5 }|	                                }d|vr	 d d d            	 d d d            n# 1 swxY w Y   t          |          }t          j                            ||          }	t          j                            |	          }
|	j                            |
           |
t"          j        |<   |t&          j        v rPt&          j        |         d         s8t+          j        ||
           t/          |
d	          t&          j        |         d	<   d S )
Nc                 f    g | ].}|                     d           |                     d          ,|/S )r   r   rC  )r  ds     rL   r  z3Dash._import_layouts_from_pages.<locals>.<listcomp>  sM       q||C'8'8ABcARAR  rN   r   r   z.pyrY  )encodingregister_pagesupplied_layoutr   )r   rA  r   rm   rD  rC  r   r^   openreadr1   rK  r  spec_from_file_locationmodule_from_specloaderexec_moduler   rO  r0   PAGE_REGISTRYr*   validate_pages_layoutr   )r   rootdirsr:  file	page_pathrM  contentr-  specpage_modules              rL   _import_layouts_from_pageszDash._import_layouts_from_pages  s'   !#)A!B!B 	 	D$   DG   OOC((s++  ==//
 GLLt44	)g666 !!ffhhG&g55 ! ! ! ! ! ! !5! ! ! ! ! ! ! ! ! ! ! ! ! ! !
 1;; ~==k9UU'n==dCC''444+6K(  6#777"0=>OP 8 3KMMMBI#XC CF(5h?1		 	s   -C  C$'C$c                    d }t           j                                        D ]b}|d         r3|d                             d          }t	          | |          }|r||fc S | |d                             d          k    r||fc S ci d fS )Npath_templater   r   )r0   r  valuesr  r2   )path_idr  pagetemplate_ids       rL   r  zDash._path_to_page  s    (//11 	, 	,DO$ 0"?399#>>!6w!L!L! 0////$v,,,S1111^++++ 24xrN   c                 ~      j         sd S  j        r                                   j        j         fd            }d S )Nc            	      @   j         d         rd S dj         d<                       t          t          d          t          t          d          t          t          d          t          t          d          d          fd            } t          j        t          j
                   t          j        t          j
                   j        j        st          j        d	 t          j
                                        D             t#          j                  r                                nj        gz             _        t          j        vrt)          d
                              dt          t,          d          t          t          d                     d S )Nre   Tr  datapathnamer:  )prevent_initial_callc                 :   t          |          }                                        |                     \  }}|i k    rqt          j                                        D ]6\  }}|                    d          d         dk    r|d         }|d         } n7t          j        d          }j	        }n|
                    dd          }|d         }t          |          r|r
 |di ||n |di |}t          |          r|r |di |n	 |            }|d|ifS )	z
                Updates dash.page_container layout on page navigation.
                Updates the stored page title which will trigger the clientside callback to update the app title
                r   r  not_found_404r   r|   z404 - Page not foundrQ   r   )r3   r  ro  r0   r  r}  rM  r
   H1r|   r  r  )	r  r:  query_parametersr  r  r.  r   r|   r   s	           rL   r   z1Dash.enable_pages.<locals>.router.<locals>.update  sn    $7v#>#> '+'9'9,,X66( ($n
 2::(.(<(B(B(D(D + +!<<,,R0OCC%)(^F$(ME!E D
 "&)?!@!@ $
!XXh33F MEF##  *8DDD3CDDD#V77&677 
 E?? S7EREE33N3335577E///rN   c                 h    g | ]/}t          |d                    r |d                      n|d          0S )r   )r  )r  r  s     rL   r  z5Dash.enable_pages.<locals>.router.<locals>.<listcomp>2  sN         -5T(^,D,DXX((($x.  rN   z-`dash.page_container` not found in the layoutzv
                function(data) {{
                    document.title = data.title
                }}
                )r   r  r   _ID_CONTENT	_ID_STOREr   _ID_LOCATIONr*   check_for_duplicate_pathnamesr0   r  validate_registryr   rx   r
   r  r  r  r   r   ra  r  	_ID_DUMMY)r   r   s    rL   routerz!Dash.enable_pages.<locals>.router  s   &w/ /3D#G,]]{J//y&))lJ//lH--%)   "0 "0 "0 "0 "0H 3F4HIII'(<=== ;; U)- $*$8$?$?$A$A   $DK00)![			* *& d&<<<#$STTT $$
 y*--i((    rN   )r   rm   r  r   r   )r   r  s   ` rL   r   zDash.enable_pages  si    ~ 	F 	.++---		#M	 M	 M	 M	 
$	#M	 M	 M	rN   c                       | j         |i | dS )z`run_server` is a deprecated alias of `run` and may be removed in a
        future version. We recommend using `app.run` instead.

        See `app.run` for usage information.
        N)r  )r   r  r   s      rL   
run_serverzDash.run_serverK  s!     	$!&!!!!!rN   r   )r   )rQ   rQ   rQ   rQ   rQ   rQ   rQ   rQ   )rT  )
NNNNNNNNNN)3r   
__module____qualname____doc___default_indexr   r   r   propertyr   r  setterr   r   r6  r   ri  ru  r  r  r  r  r  r   r   r  r   r  r  r  r   r   r6  r'  staticmethodr   r   rf  rb  rl  ro  r   r  r  r   r  r  r  r  r   r  r   rN   rL   rc   rc      sf       ` `H  !!!%##!%)"'#""$(=g+ g+ g+ g+RP P P Pd	& 	& 	& 	&   X   ]% % ]%N " " X" # # #

 
 
  >
 
 
$< < <|
 
 
4
 4
 4
lg g ge e e% % %,&
 &
 &
R$ $ $L. . .d 8
 8
 8
 8
t2 2 2I
 I
 I
V
 
 
2 !
 
 
 
 
@a a aF(= (= (=T   )  )  )D     \  
 
 \

%
 %
 %
 %
N? ? ?'
 '
 '
R1
 1
 1
f  : "$(!&*,0'+)-#\ \ \ \~1H 1H 1Hj RYv{++RYvv&&bid++"$(!&*,0'+)-#fP fP fP fPP  B 
 
 \
T T Tl" " " " "rN   rc   )fr  r   r   r   rK  contextvarsr   importlib.machineryr   r  r   r>  r   r  r  rd  rZ  rZ   urllib.parser   textwrapr   r   pkg_resourcesr   r   rR  r	   r
   r   rV  r   r   rc  r   r   r   r   r   development.base_componentr   
exceptionsr   r   r   r   r   r   _configsr   r   r   _utilsr   r   r   r   r    r!   r"   r#   r$   r%   r&   rQ   r'   r(   r)   r*   r+   r,   	_groupingr-   r.   r/   r0   r1   r2   r3   add_typer  r  r"  r#  r$  r  r  r  r  r  r  r  r
  r  LocationStorer(  ra  ra   NoUpdate	no_updaterc   r   rN   rL   <module>r$     s       				 



         $ $ $ $ $ $ * * * * * *      				             ! ! ! ! ! !        9 9 9 9 9 9 9 9                   = = = = = = = = # # # # # # # #        : 9 9 9 9 9            !           P P P P P P P P P P                                                              D D D D D D D D D D                	 %vt 4 4 4*
 3- 0 C : J B   		TXCLL.AAADHd;;;CI###DH	D999		
 NNNNN!&) !& !& !& !&J I  	
a" a" a" a" a" a" a" a" a" a"s   .AF F