
    $gN                     N    d dl mZ d dlmZ  e       Zd Zd Zd Zd Zd Z	d Z
y	)
   )AttributeDict)
exceptionsc                 "    t        t        |       S )N)app_get_asset_urlCONFIGpaths    L/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/dash/_get_paths.pyget_asset_urlr      s    VT**    c                     | j                   r| j                   }n| j                  }dj                  |j                  d      | j                  j                  d      |g      S )N/)assets_external_pathrequests_pathname_prefixjoinrstripassets_url_pathlstrip)configr	   prefixs      r
   r   r      s\    "",,0088 MM#""))#.		
 r   c                 6    t        t        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
    `dash.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
    `dash.get_relative_path('/assets/logo.png')`

    Use this function with `dash.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')
    ])
    @dash.callback(Output('content', 'children'), [Input('url', 'pathname')])
    def display_content(path):
        page_name = dash.strip_relative_path(path)
        if not page_name:  # None or ''
            return html.Div([
                dcc.Link(href=dash.get_relative_path('/page-1')),
                dcc.Link(href=dash.get_relative_path('/page-2')),
            ])
        elif page_name == 'page-1':
            return chapters.page_1
        if page_name == "page-2":
            return chapters.page_2
    ```
    )app_get_relative_pathr   r   r   s    r
   get_relative_pathr      s    J !!@!@$GGr   c                     | dk(  r|dk(  ry| dk7  r|dk(  r| S |j                  d      st        j                  d| d      dj                  | j	                  d      |j                  d      g      S )Nr    zf
            Paths that aren't prefixed with a leading / are not supported.
            You supplied: 
            )
startswithr   UnsupportedRelativePathr   r   r   requests_pathnamer	   s     r
   r   r   B   s    CDBJCDBJ  ??300& !
 	
 88&--c2DKK4DEFFr   c                 6    t        t        j                  |       S )a  
    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')
    ])
    @dash.callback(Output('content', 'children'), [Input('url', 'pathname')])
    def display_content(path):
        page_name = dash.strip_relative_path(path)
        if not page_name:  # None or ''
            return html.Div([
                dcc.Link(href=dash.get_relative_path('/page-1')),
                dcc.Link(href=dash.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
    `dash.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, `dash.strip_relative_path('/my-dash-app/page-2')`
    will return `'page-2'`

    For nested URLs, slashes are still included:
    `dash.strip_relative_path('/page-1/sub-page-1/')` will return
    `page-1/sub-page-1`
    ```
    )app_strip_relative_pathr   r   r   s    r
   strip_relative_pathr#   Q   s    ^ #6#B#BDIIr   c                 f   |y | dk7  r |j                  | j                  d            r| dk(  r-|j                  d      st        j                  d| d|  d      | dk7  rB|j                  | j                  d            r"|j	                  | j                  d      dd      }|j                  d      S )Nr   zs
            Paths that aren't prefixed with requests_pathname_prefix are not supported.
            You supplied: z" and requests_pathname_prefix was r   r   r   )r   r   r   r   replacestripr   s     r
   r"   r"      s    |S 9J9Q9QRU9V)W
s
"4??3+?00& BCTBU V
 	
 CDOO4E4L4LS4Q$R|| $$S)
 ::c?r   N)_utilsr   r   r   r   r   r   r   r   r#   r"    r   r
   <module>r)      s5    ! 	+%HPG/Jdr   