
    g=`                    X   d dl mZ d dlZd dlZd dlmZ d dlmZ ddl	mZ
 ddlmZ dd	lmZ dd
lmZ ddlmZ ej                   rddlmZ ej&                  dgdf   Z ej*                  de
j,                  ej.                           Z ej*                  de
j2                        Z ej*                  de
j6                        Z ej*                  de
j:                        Z ej*                  de
j>                        Z  ej*                  de
jB                        Z" ej*                  de
jF                        Z$ ej*                  de
jJ                        Z& ej*                  de
jN                        Z( ej*                  de
jR                        Z* G d d      Z+ G d de      Z,y)    )annotationsN)defaultdict)update_wrapper   )typing   )_endpoint_from_view_func)	_sentinel)Scaffold)setupmethod)AppBlueprintSetupStateT_after_request)boundT_before_requestT_error_handler
T_teardownT_template_context_processorT_template_filterT_template_globalT_template_testT_url_defaultsT_url_value_preprocessorc                  L    e Zd ZdZ	 	 	 	 	 	 	 	 	 	 ddZ	 	 d	 	 	 	 	 	 	 	 	 ddZy)r   zTemporary holder object for registering a blueprint with the
    application.  An instance of this class is created by the
    :meth:`~flask.Blueprint.make_setup_state` method and later passed
    to all register callback functions.
    c                n   || _         || _        || _        || _        | j                  j	                  d      }|| j                  j
                  }|| _        | j                  j	                  d      }|| j                  j                  }|| _        | j                  j	                  d|j                        | _        | j                  j	                  dd      | _        t        | j                  j                        | _        | j                  j                  | j                  j	                  dd             y )N	subdomain
url_prefixnamename_prefix url_defaults )app	blueprintoptionsfirst_registrationgetr   r   r   r   dicturl_values_defaultsr!   update)selfr$   r#   r%   r&   r   r   s          t/var/www/html/FastMealFinder_FlaskServer-InitialRelease/venv/lib/python3.12/site-packages/flask/sansio/blueprints.py__init__zBlueprintSetupState.__init__)   s      #  #5LL$$[1	00I #\\%%l3
22J %LL$$VY^^<	<<++M2> !!C!CD  !1!1."!EF    Nc                   | j                   J|r<dj                  | j                   j                  d      |j                  d      f      }n| j                   }|j	                  d| j
                         |t        |      }| j                  }d|v rt        |fi |j                  d      } | j                  j                  || j                   d| j                   d| j                  d      |fd|i| y)zA helper method to register a rule (and optionally a view function)
        to the application.  The endpoint is automatically prefixed with the
        blueprint's name.
        N/r   defaults.)r   joinrstriplstrip
setdefaultr   r	   r!   r(   popr#   add_url_ruler   r   )r+   ruleendpoint	view_funcr%   r1   s         r,   r8   z BlueprintSetupState.add_url_ruleW   s     ??&xx!7!7!<dkk#>N OP;7/	:H$$ H@J(?@H $))AhZ8??D	
 		

 	
r.   )
r$   	Blueprintr#   r   r%   t.Anyr&   boolreturnNone)NN)
r9   strr:   
str | Noner;   ft.RouteCallable | Noner%   r=   r?   r@   )__name__
__module____qualname____doc__r-   r8   r"   r.   r,   r   r   "   s    ,G,G ,G 	,G
 !,G 
,Gb  $-1	

 
 +	

 
 

r.   c                  B    e Zd ZdZdZdddddddef	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d fdZddZedd       Z	edd       Z
	 d	 	 	 	 	 	 	 ddZedd	       Zd d
Zd!dZe	 	 	 d"	 	 	 	 	 	 	 	 	 	 	 d#d       Ze	 d$	 	 	 d%d       Ze	 d$	 	 	 	 	 d&d       Ze	 d$	 	 	 d'd       Ze	 d$	 	 	 	 	 d(d       Ze	 d$	 	 	 d)d       Ze	 d$	 	 	 	 	 d*d       Zed+d       Zed,d       Zed-d       Ze	 	 	 	 d.d       Ze	 	 	 	 d/d       Ze	 	 	 	 d0d       Zed1d       Z xZS )2r<   a	  Represents a blueprint, a collection of routes and other
    app-related functions that can be registered on a real application
    later.

    A blueprint is an object that allows defining application functions
    without requiring an application object ahead of time. It uses the
    same decorators as :class:`~flask.Flask`, but defers the need for an
    application by recording them for later registration.

    Decorating a function with a blueprint creates a deferred function
    that is called with :class:`~flask.blueprints.BlueprintSetupState`
    when the blueprint is registered on an application.

    See :doc:`/blueprints` for more information.

    :param name: The name of the blueprint. Will be prepended to each
        endpoint name.
    :param import_name: The name of the blueprint package, usually
        ``__name__``. This helps locate the ``root_path`` for the
        blueprint.
    :param static_folder: A folder with static files that should be
        served by the blueprint's static route. The path is relative to
        the blueprint's root path. Blueprint static files are disabled
        by default.
    :param static_url_path: The url to serve static files from.
        Defaults to ``static_folder``. If the blueprint does not have
        a ``url_prefix``, the app's static route will take precedence,
        and the blueprint's static files won't be accessible.
    :param template_folder: A folder with templates that should be added
        to the app's template search path. The path is relative to the
        blueprint's root path. Blueprint templates are disabled by
        default. Blueprint templates have a lower precedence than those
        in the app's templates folder.
    :param url_prefix: A path to prepend to all of the blueprint's URLs,
        to make them distinct from the rest of the app's routes.
    :param subdomain: A subdomain that blueprint routes will match on by
        default.
    :param url_defaults: A dict of default values that blueprint routes
        will receive by default.
    :param root_path: By default, the blueprint will automatically set
        this based on ``import_name``. In certain situations this
        automatic detection can fail, so the path can be specified
        manually instead.

    .. versionchanged:: 1.1.0
        Blueprints have a ``cli`` group to register nested CLI commands.
        The ``cli_group`` parameter controls the name of the group under
        the ``flask`` command.

    .. versionadded:: 0.7
    FNc                    t         |   |||||	       |st        d      d|v rt        d      || _        || _        || _        g | _        |i }|| _        |
| _        g | _	        y )N)import_namestatic_folderstatic_url_pathtemplate_folder	root_pathz'name' may not be empty.r2   z+'name' may not contain a dot '.' character.)
superr-   
ValueErrorr   r   r   deferred_functionsr)   	cli_group_blueprints)r+   r   rJ   rK   rL   rM   r   r   r!   rN   rR   	__class__s              r,   r-   zBlueprint.__init__   s     	#'++ 	 	
 788$;JKK	$"?AL#/ "EGr.   c                T    | j                   rt        d| d| j                   d      y )NzThe setup method 'z,' can no longer be called on the blueprint 'z'. It has already been registered at least once, any changes will not be applied consistently.
Make sure all imports, decorators, functions, etc. needed to set up the blueprint are done before registering it.)_got_registered_onceAssertionErrorr   )r+   f_names     r,   _check_setup_finishedzBlueprint._check_setup_finished   s>    $$ $VH -YYK  AA  %r.   c                :    | j                   j                  |       y)zRegisters a function that is called when the blueprint is
        registered on the application.  This function is called with the
        state as argument as returned by the :meth:`make_setup_state`
        method.
        N)rQ   append)r+   funcs     r,   recordzBlueprint.record   s     	&&t,r.   c                H    dfd}| j                  t        |             y)zWorks like :meth:`record` but wraps the function in another
        function that will ensure the function is only called once.  If the
        blueprint is registered a second time on the application, the
        function passed is not called.
        c                0    | j                   r	 |        y y N)r&   )stater\   s    r,   wrapperz&Blueprint.record_once.<locals>.wrapper   s    ''U (r.   Nra   r   r?   r@   )r]   r   )r+   r\   rb   s    ` r,   record_oncezBlueprint.record_once   s    	 	N7D12r.   c                    t        | |||      S )zCreates an instance of :meth:`~flask.blueprints.BlueprintSetupState`
        object that is later passed to the register callback functions.
        Subclasses can override this to return a subclass of the setup state.
        )r   )r+   r#   r%   r&   s       r,   make_setup_statezBlueprint.make_setup_state   s     #4g7IJJr.   c                \    || u rt        d      | j                  j                  ||f       y)a  Register a :class:`~flask.Blueprint` on this blueprint. Keyword
        arguments passed to this method will override the defaults set
        on the blueprint.

        .. versionchanged:: 2.0.1
            The ``name`` option can be used to change the (pre-dotted)
            name the blueprint is registered with. This allows the same
            blueprint to be registered multiple times with unique names
            for ``url_for``.

        .. versionadded:: 2.0
        z%Cannot register a blueprint on itselfN)rP   rS   r[   )r+   r$   r%   s      r,   register_blueprintzBlueprint.register_blueprint   s1     DEEG 45r.   c           	         |j                  dd      }|j                  d j                        }| d| j                  d      }||j                  v r7|j                  |    u rdnd}||k7  rd| dnd}t	        d	| d
| d| d      t         fd|j                  j                         D               }||j                  v}	 |j                  |<   d _         j                  |||      }
 j                  r+|
j                   j                   d j                  d       |s|	r j                  ||        j                  D ]
  } ||
        |j                  d j                        } j                   j"                  r|:|j                   j"                  j%                   j                   j"                         nu|t&        u r7| j                   _        |j                   j)                   j                          n6| j                   _        |j                   j)                   j                           j*                  D ]  \  }}|j-                         }|j                  d      }|j                  d      }||j.                  }|
j.                  ||dz   |
j.                  z   |d<   n#|||d<   n|
j.                  |
j.                  |d<   ||j0                  }|
j0                  6|4|
j0                  j3                  d      dz   |j                  d      z   |d<   n#|||d<   n|
j0                  |
j0                  |d<   ||d<   |j5                  ||        y)a  Called by :meth:`Flask.register_blueprint` to register all
        views and callbacks registered on the blueprint with the
        application. Creates a :class:`.BlueprintSetupState` and calls
        each :meth:`record` callback with it.

        :param app: The application this blueprint is being registered
            with.
        :param options: Keyword arguments forwarded from
            :meth:`~Flask.register_blueprint`.

        .. versionchanged:: 2.3
            Nested blueprints now correctly apply subdomains.

        .. versionchanged:: 2.1
            Registering the same blueprint with the same name multiple
            times is an error.

        .. versionchanged:: 2.0.1
            Nested blueprints are registered with their dotted name.
            This allows different blueprints with the same name to be
            nested at different locations.

        .. versionchanged:: 2.0.1
            The ``name`` option can be used to change the (pre-dotted)
            name the blueprint is registered with. This allows the same
            blueprint to be registered multiple times with unique names
            for ``url_for``.
        r   r    r   r2   thisza differentz ''z
The name 'z' is already registered for z
 blueprintz'. Use 'name=' to provide a unique name.c              3  &   K   | ]  }|u  
 y wr`   r"   ).0bpr+   s     r,   	<genexpr>z%Blueprint.register.<locals>.<genexpr><  s     'Urd
'Us   Tz/<path:filename>static)r;   r:   rR   Nr   r   r0   )r'   r   r5   
blueprintsrP   anyvaluesrV   rf   has_static_folderr8   rL   send_static_file_merge_blueprint_funcsrQ   rR   clicommandsr*   r
   add_commandrS   copyr   r   r4   register)r+   r#   r%   r   	self_namer   bp_descexisting_atfirst_bp_registrationfirst_name_registrationra   deferredcli_resolved_groupr$   
bp_optionsbp_url_prefixbp_subdomains   `                r,   r{   zBlueprint.register  sK   : kk-4KK		2	a	{+22373>>! #t 4 <f-G*3t*;BtfA,KYK (9J{m 4*+  %('US^^=R=R=T'U$U U"&cnn"<#t$(!%%c74IJ!!''((89//!   !$;''T2// 	HUO	 %[[dnnE88!)  ''(9(9:#y0 $##DHH- 2##DHH-%)%5%5 	0!Iz#*J&NN<8M%>>+6L#(22*|/G*6*<u*N
;')*6
;',*///
;'$ ) 4 4+0I$$++C0369M9Mc9RR <( *+8
<(!!-+0+;+;
<((,J}%sJ/9	0r.   c                    	 	 	 	 	 	 dfd}| j                   j                         D ]w  \  }}|n d| }t        t        |j                         D 	ci c]*  \  }}||j                         D 	ci c]  \  }}	||	
 c}	}, c}	}}}      }||j                   |<   y | j                  j                         D ]  \  }
}	|	|j                  |
<     || j
                  |j
                          || j                  |j                          || j                  |j                          || j                  |j                          || j                  |j                          || j                  |j                         y c c}	}w c c}	}}}w )Nc                t    | j                         D ]$  \  }}|n d| }||   j                  |       & y )Nr2   )itemsextend)bp_dictparent_dictkeyrs   r   s       r,   r   z0Blueprint._merge_blueprint_funcs.<locals>.extend|  sF      '}} 0V!kd$qC ''/0r.   r2   )r   'dict[ft.AppOrBlueprintKey, list[t.Any]]r   r   r?   r@   )error_handler_specr   r   r(   view_functionsbefore_request_funcsafter_request_funcsteardown_request_funcsurl_default_functionsurl_value_preprocessorstemplate_context_processors)r+   r#   r   r   r   valuecodecode_values	exc_classr\   r:   s     `        r,   rv   z Blueprint._merge_blueprint_funcs{  s   	0<	0@	0 	0 11779 		0JC+$dV1SE?C .3[[] )k +BSBSBUVy$9d?VVE +0C""3'		0 #11779 	0NHd+/Cx(	0 	t((#*B*BCt'')@)@A''&&	
 	t))3+D+DEt++S-H-HIt//1P1PQ# Ws   F4FFFc                    rdv rt        d      r%t        d      rdj                  v rt        d      | j                  fd       y)a  Register a URL rule with the blueprint. See :meth:`.Flask.add_url_rule` for
        full documentation.

        The URL rule is prefixed with the blueprint's URL prefix. The endpoint name,
        used with :func:`url_for`, is prefixed with the blueprint's name.
        r2   z/'endpoint' may not contain a dot '.' character.rD   z5'view_func' name may not contain a dot '.' character.c                2     | j                   fdiS )Nprovide_automatic_options)r8   )sr:   r%   r   r9   r;   s    r,   <lambda>z(Blueprint.add_url_rule.<locals>.<lambda>  s0    nann +D	
  r.   N)rP   hasattrrD   r]   )r+   r9   r:   r;   r   r%   s    `````r,   r8   zBlueprint.add_url_rule  sP     xNOOJ7C9CUCU<UTUU	
r.   c                     d fd}|S )a  Register a template filter, available in any template rendered by the
        application. Equivalent to :meth:`.Flask.template_filter`.

        :param name: the optional name of the filter, otherwise the
                     function name will be used.
        c                .    j                  |        | S N)r   )add_app_template_filterfr   r+   s    r,   	decoratorz0Blueprint.app_template_filter.<locals>.decorator      (((6Hr.   )r   r   r?   r   r"   r+   r   r   s   `` r,   app_template_filterzBlueprint.app_template_filter  s    	 r.   c                8    dfd}| j                  |       y)aI  Register a template filter, available in any template rendered by the
        application. Works like the :meth:`app_template_filter` decorator. Equivalent to
        :meth:`.Flask.add_template_filter`.

        :param name: the optional name of the filter, otherwise the
                     function name will be used.
        c                h    | j                   j                  j                  xs j                  <   y r`   )r#   	jinja_envfiltersrD   ra   r   r   s    r,   register_templatez<Blueprint.add_app_template_filter.<locals>.register_template  &    >?EII''(:

;r.   Nrc   rd   r+   r   r   r   s    `` r,   r   z!Blueprint.add_app_template_filter  s    	@ 	*+r.   c                     d fd}|S )a!  Register a template test, available in any template rendered by the
        application. Equivalent to :meth:`.Flask.template_test`.

        .. versionadded:: 0.10

        :param name: the optional name of the test, otherwise the
                     function name will be used.
        c                .    j                  |        | S r   )add_app_template_testr   s    r,   r   z.Blueprint.app_template_test.<locals>.decorator  s    &&qt&4Hr.   )r   r   r?   r   r"   r   s   `` r,   app_template_testzBlueprint.app_template_test      	 r.   c                8    dfd}| j                  |       y)aa  Register a template test, available in any template rendered by the
        application. Works like the :meth:`app_template_test` decorator. Equivalent to
        :meth:`.Flask.add_template_test`.

        .. versionadded:: 0.10

        :param name: the optional name of the test, otherwise the
                     function name will be used.
        c                h    | j                   j                  j                  xs j                  <   y r`   )r#   r   testsrD   r   s    r,   r   z:Blueprint.add_app_template_test.<locals>.register_template  s&    <=EII%%d&8ajj9r.   Nrc   r   r   s    `` r,   r   zBlueprint.add_app_template_test  s    	> 	*+r.   c                     d fd}|S )a'  Register a template global, available in any template rendered by the
        application. Equivalent to :meth:`.Flask.template_global`.

        .. versionadded:: 0.10

        :param name: the optional name of the global, otherwise the
                     function name will be used.
        c                .    j                  |        | S r   )add_app_template_globalr   s    r,   r   z0Blueprint.app_template_global.<locals>.decorator  r   r.   )r   r   r?   r   r"   r   s   `` r,   app_template_globalzBlueprint.app_template_global  r   r.   c                8    dfd}| j                  |       y)ai  Register a template global, available in any template rendered by the
        application. Works like the :meth:`app_template_global` decorator. Equivalent to
        :meth:`.Flask.add_template_global`.

        .. versionadded:: 0.10

        :param name: the optional name of the global, otherwise the
                     function name will be used.
        c                h    | j                   j                  j                  xs j                  <   y r`   )r#   r   globalsrD   r   s    r,   r   z<Blueprint.add_app_template_global.<locals>.register_template$  r   r.   Nrc   r   r   s    `` r,   r   z!Blueprint.add_app_template_global  s    	@ 	*+r.   c                0    | j                  fd       S )zLike :meth:`before_request`, but before every request, not only those handled
        by the blueprint. Equivalent to :meth:`.Flask.before_request`.
        c                n    | j                   j                  j                  d g       j                        S r`   )r#   r   r6   r[   r   r   s    r,   r   z.Blueprint.before_app_request.<locals>.<lambda>/  s)    aee00;;D"ELLQO r.   r   r+   r   s    `r,   before_app_requestzBlueprint.before_app_request)  s    
 	O	
 r.   c                0    | j                  fd       S )zLike :meth:`after_request`, but after every request, not only those handled
        by the blueprint. Equivalent to :meth:`.Flask.after_request`.
        c                n    | j                   j                  j                  d g       j                        S r`   )r#   r   r6   r[   r   s    r,   r   z-Blueprint.after_app_request.<locals>.<lambda>9  s)    aee//::4DKKAN r.   r   r   s    `r,   after_app_requestzBlueprint.after_app_request3  s    
 	N	
 r.   c                0    | j                  fd       S )zLike :meth:`teardown_request`, but after every request, not only those
        handled by the blueprint. Equivalent to :meth:`.Flask.teardown_request`.
        c                n    | j                   j                  j                  d g       j                        S r`   )r#   r   r6   r[   r   s    r,   r   z0Blueprint.teardown_app_request.<locals>.<lambda>C  s)    aee22==dBGNNqQ r.   r   r   s    `r,   teardown_app_requestzBlueprint.teardown_app_request=  s    
 	Q	
 r.   c                0    | j                  fd       S )zLike :meth:`context_processor`, but for templates rendered by every view, not
        only by the blueprint. Equivalent to :meth:`.Flask.context_processor`.
        c                n    | j                   j                  j                  d g       j                        S r`   )r#   r   r6   r[   r   s    r,   r   z1Blueprint.app_context_processor.<locals>.<lambda>O  s*    aee77BB4LSSTUV r.   r   r   s    `r,   app_context_processorzBlueprint.app_context_processorG  s     	V	
 r.   c                     d fd}|S )zLike :meth:`errorhandler`, but for every request, not only those handled by
        the blueprint. Equivalent to :meth:`.Flask.errorhandler`.
        c                :     d fd}j                  |        S )Nc                H     | j                   j                               y r`   )r#   errorhandler)ra   r   r   s    r,   from_blueprintzEBlueprint.app_errorhandler.<locals>.decorator.<locals>.from_blueprint\  s    ,		&&t,Q/r.   rc   r   )r   r   r   r+   s   ` r,   r   z-Blueprint.app_errorhandler.<locals>.decorator[  s    0 ^,Hr.   )r   r   r?   r   r"   )r+   r   r   s   `` r,   app_errorhandlerzBlueprint.app_errorhandlerS  s    	 r.   c                0    | j                  fd       S )zLike :meth:`url_value_preprocessor`, but for every request, not only those
        handled by the blueprint. Equivalent to :meth:`.Flask.url_value_preprocessor`.
        c                n    | j                   j                  j                  d g       j                        S r`   )r#   r   r6   r[   r   s    r,   r   z6Blueprint.app_url_value_preprocessor.<locals>.<lambda>l  s*    aee33>>tRHOOPQR r.   r   r   s    `r,   app_url_value_preprocessorz$Blueprint.app_url_value_preprocessord  s     	R	
 r.   c                0    | j                  fd       S )zLike :meth:`url_defaults`, but for every request, not only those handled by
        the blueprint. Equivalent to :meth:`.Flask.url_defaults`.
        c                n    | j                   j                  j                  d g       j                        S r`   )r#   r   r6   r[   r   s    r,   r   z,Blueprint.app_url_defaults.<locals>.<lambda>v  s)    aee11<<T2FMMaP r.   r   r   s    `r,   app_url_defaultszBlueprint.app_url_defaultsp  s    
 	P	
 r.   )r   rA   rJ   rA   rK   str | os.PathLike[str] | NonerL   rB   rM   r   r   rB   r   rB   r!   zdict[str, t.Any] | NonerN   rB   rR   rB   )rX   rA   r?   r@   )r\   DeferredSetupFunctionr?   r@   )F)r#   r   r%   dict[str, t.Any]r&   r>   r?   r   )r$   r<   r%   r=   r?   r@   )r#   r   r%   r   r?   r@   )r#   r   r   rA   r?   r@   )NNN)r9   rA   r:   rB   r;   rC   r   zbool | Noner%   r=   r?   r@   r`   )r   rB   r?   z2t.Callable[[T_template_filter], T_template_filter])r   zft.TemplateFilterCallabler   rB   r?   r@   )r   rB   r?   z.t.Callable[[T_template_test], T_template_test])r   zft.TemplateTestCallabler   rB   r?   r@   )r   rB   r?   z2t.Callable[[T_template_global], T_template_global])r   zft.TemplateGlobalCallabler   rB   r?   r@   )r   r   r?   r   )r   r   r?   r   )r   r   r?   r   )r   r   r?   r   )r   ztype[Exception] | intr?   z.t.Callable[[T_error_handler], T_error_handler])r   r   r?   r   )r   r   r?   r   )rD   rE   rF   rG   rV   r
   r-   rY   r   r]   rd   rf   rh   r{   rv   r8   r   r   r   r   r   r   r   r   r   r   r   r   r   __classcell__)rT   s   @r,   r<   r<   w   s5   2h ! 8<&*9=!% $04 $ )%H%H %H 5	%H
 $%H 7%H %H %H .%H %H %HN - - 3 3 OTKK!1KGKK	K 6 6"h0TRB   $-115

 
 +	

 $/
 
 

 
< !%	;   ?C,*,2<,	, ,  !%	7 $ =A,(,0:,	, ,$ !%	; $ ?C,*,2<,	, ,$       	-		%	 	 )	7   	)		!	 	  r.   r<   )-
__future__r   osr   tcollectionsr   	functoolsr   r    ftscaffoldr	   r
   r   r   TYPE_CHECKINGr#   r   Callabler   TypeVarAfterRequestCallableAnyr   BeforeRequestCallabler   ErrorHandlerCallabler   TeardownCallabler    TemplateContextProcessorCallabler   TemplateFilterCallabler   TemplateGlobalCallabler   TemplateTestCallabler   URLDefaultCallabler   URLValuePreprocessorCallabler   r   r<   r"   r.   r,   <module>r      sm   " 	  # $  .   !??

$9#:D#@A !))-R5L5LQUU5ST199/r7O7OP !))-R5L5LMQYY|2+>+>?
(qyy""*M*M   AII19R9RS AII19R9RS !))-R5L5LM+23H3HI$199b&E&E 
R
 R
jA Ar.   