From 52372dcbe97e718ac9a0ed20c09383f2c0342d80 Mon Sep 17 00:00:00 2001 From: Luis Gallego Ledesma Date: Wed, 28 Jan 2026 15:35:35 +0100 Subject: [PATCH 001/182] fix(langfuse_otel): prevent empty proxy request spans from being sent to Langfuse When using langfuse_otel callback, empty traces were being sent to Langfuse for requests that didn't result in actual LLM calls (e.g., auth operations, health checks, failed requests). These traces contained only internal proxy operations (auth, postgres, proxy_pre_call) with no useful LLM data. Root cause: LangfuseOtelLogger extends OpenTelemetry, which sets itself as the proxy's open_telemetry_logger. This caused create_litellm_proxy_request_started_span to be called for every request, creating a parent span that was sent to Langfuse even when no LLM call occurred. Fix: Override create_litellm_proxy_request_started_span in LangfuseOtelLogger to return None, preventing the creation of empty parent spans. This is consistent with the existing overrides for async_service_success_hook and async_service_failure_hook which already prevent service-level logs from being sent to Langfuse. Fixes: Empty traces in Langfuse v3 when using langfuse_otel callback --- .../integrations/langfuse/langfuse_otel.py | 17 +++++++++++ tests/test_service_logger_otel.py | 28 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/litellm/integrations/langfuse/langfuse_otel.py b/litellm/integrations/langfuse/langfuse_otel.py index 08493a0e8ec..20206f73b0f 100644 --- a/litellm/integrations/langfuse/langfuse_otel.py +++ b/litellm/integrations/langfuse/langfuse_otel.py @@ -1,6 +1,7 @@ import base64 import json # <--- NEW import os +from datetime import datetime from typing import TYPE_CHECKING, Any, Optional, Union from litellm._logging import verbose_logger @@ -353,6 +354,22 @@ class LangfuseOtelLogger(OpenTelemetry): return dynamic_headers + def create_litellm_proxy_request_started_span( + self, + start_time: datetime, + headers: dict, + ) -> Optional[Span]: + """ + Override to prevent creating empty proxy request spans. + + Langfuse should only receive spans for actual LLM calls, not for + internal proxy operations (auth, postgres, proxy_pre_call, etc.). + + By returning None, we prevent the parent span from being created, + which in turn prevents empty traces from being sent to Langfuse. + """ + return None + async def async_service_success_hook(self, *args, **kwargs): """ Langfuse should not receive service success logs. diff --git a/tests/test_service_logger_otel.py b/tests/test_service_logger_otel.py index 5cb21dadeae..35070d55546 100644 --- a/tests/test_service_logger_otel.py +++ b/tests/test_service_logger_otel.py @@ -1,6 +1,7 @@ import os import sys import unittest +from datetime import datetime from unittest.mock import patch, AsyncMock, MagicMock # Add the project root to sys.path @@ -41,6 +42,33 @@ class TestServiceLoggerOTEL(unittest.IsolatedAsyncioTestCase): "LangfuseOtelLogger.async_service_failure_hook", ) + @patch("litellm.integrations.opentelemetry.OpenTelemetry._init_tracing") + @patch("litellm.integrations.opentelemetry.OpenTelemetry._init_metrics") + @patch("litellm.integrations.opentelemetry.OpenTelemetry._init_logs") + async def test_langfuse_otel_does_not_create_proxy_request_span( + self, mock_logs, mock_metrics, mock_tracing + ): + """ + Test that LangfuseOtelLogger returns None for create_litellm_proxy_request_started_span. + + This prevents empty proxy request spans from being sent to Langfuse when + requests don't result in actual LLM calls (e.g., auth failures, health checks). + """ + logger = LangfuseOtelLogger() + + # Verify the method is overridden + self.assertEqual( + logger.create_litellm_proxy_request_started_span.__qualname__, + "LangfuseOtelLogger.create_litellm_proxy_request_started_span", + ) + + # Verify it returns None + result = logger.create_litellm_proxy_request_started_span( + start_time=datetime.now(), + headers={"Authorization": "Bearer test"}, + ) + self.assertIsNone(result) + @patch("litellm.integrations.opentelemetry.OpenTelemetry._init_tracing") @patch("litellm.integrations.opentelemetry.OpenTelemetry._init_metrics") @patch("litellm.integrations.opentelemetry.OpenTelemetry._init_logs") From aac04d5665374d9369701d892ad156c5f1987d87 Mon Sep 17 00:00:00 2001 From: Harshit Jain Date: Tue, 3 Feb 2026 07:37:19 +0530 Subject: [PATCH 002/182] fix: SSO PKCE support fails in multi-pod Kubernetes deployments --- litellm/proxy/management_endpoints/ui_sso.py | 92 ++-- .../proxy/management_endpoints/test_ui_sso.py | 467 ++++++++++++------ 2 files changed, 384 insertions(+), 175 deletions(-) diff --git a/litellm/proxy/management_endpoints/ui_sso.py b/litellm/proxy/management_endpoints/ui_sso.py index 2d248dc81f3..a2d7510c344 100644 --- a/litellm/proxy/management_endpoints/ui_sso.py +++ b/litellm/proxy/management_endpoints/ui_sso.py @@ -11,10 +11,11 @@ Has all /sso/* routes import asyncio import base64 import hashlib +import json import os import secrets from copy import deepcopy -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union, cast +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Tuple, Union, cast from fastapi import APIRouter, Depends, HTTPException, Request, status from fastapi.responses import RedirectResponse @@ -82,7 +83,15 @@ from litellm.proxy.utils import ( get_server_root_path, ) from litellm.secret_managers.main import get_secret_bool, str_to_bool -from litellm.types.proxy.management_endpoints.ui_sso import * +from litellm.types.proxy.management_endpoints.ui_sso import ( + DefaultTeamSSOParams, + MicrosoftGraphAPIUserGroupDirectoryObject, + MicrosoftGraphAPIUserGroupResponse, + MicrosoftServicePrincipalTeam, + RoleMappings, + TeamMappings, +) +from litellm.types.proxy.management_endpoints.ui_sso import * # noqa: F403, F401 from litellm.types.proxy.ui_sso import ParsedOpenIDResult if TYPE_CHECKING: @@ -96,15 +105,15 @@ router = APIRouter() def normalize_email(email: Optional[str]) -> Optional[str]: """ Normalize email address to lowercase for consistent storage and comparison. - + Email addresses should be treated as case-insensitive for SSO purposes, even though RFC 5321 technically allows case-sensitive local parts. This prevents issues where SSO providers return emails with different casing than what's stored in the database. - + Args: email: Email address to normalize, can be None - + Returns: Lowercased email address, or None if input is None """ @@ -280,7 +289,7 @@ async def google_login( # check if user defined a custom auth sso sign in handler, if yes, use it if user_custom_ui_sso_sign_in_handler is not None: try: - from litellm_enterprise.proxy.auth.custom_sso_handler import ( + from litellm_enterprise.proxy.auth.custom_sso_handler import ( # type: ignore[import-untyped] EnterpriseCustomSSOHandler, ) @@ -428,7 +437,9 @@ def generic_response_convertor( display_name=get_nested_value( response, generic_user_display_name_attribute_name ), - email=normalize_email(get_nested_value(response, generic_user_email_attribute_name)), + email=normalize_email( + get_nested_value(response, generic_user_email_attribute_name) + ), first_name=get_nested_value(response, generic_user_first_name_attribute_name), last_name=get_nested_value(response, generic_user_last_name_attribute_name), provider=get_nested_value(response, generic_provider_attribute_name), @@ -517,6 +528,7 @@ async def _setup_team_mappings() -> Optional["TeamMappings"]: if team_mappings_data: from litellm.types.proxy.management_endpoints.ui_sso import TeamMappings + if isinstance(team_mappings_data, dict): team_mappings = TeamMappings(**team_mappings_data) elif isinstance(team_mappings_data, TeamMappings): @@ -554,6 +566,7 @@ async def _setup_role_mappings() -> Optional["RoleMappings"]: if role_mappings_data: from litellm.types.proxy.management_endpoints.ui_sso import RoleMappings + if isinstance(role_mappings_data, dict): role_mappings = RoleMappings(**role_mappings_data) elif isinstance(role_mappings_data, RoleMappings): @@ -567,7 +580,7 @@ async def _setup_role_mappings() -> Optional["RoleMappings"]: verbose_proxy_logger.debug( f"Could not load role_mappings from database: {e}. Continuing with existing role logic." ) - + generic_role_mappings = os.getenv("GENERIC_ROLE_MAPPINGS_ROLES", None) generic_role_mappings_group_claim = os.getenv( "GENERIC_ROLE_MAPPINGS_GROUP_CLAIM", None @@ -577,8 +590,8 @@ async def _setup_role_mappings() -> Optional["RoleMappings"]: ) if generic_role_mappings is not None: verbose_proxy_logger.debug( - "Found role_mappings for generic provider in environment variables" - ) + "Found role_mappings for generic provider in environment variables" + ) import ast try: @@ -603,7 +616,9 @@ async def _setup_role_mappings() -> Optional["RoleMappings"]: ) return role_mappings except TypeError as e: - verbose_proxy_logger.warning(f"Error decoding role mappings from environment variables: {e}. Continuing with existing role logic.") + verbose_proxy_logger.warning( + f"Error decoding role mappings from environment variables: {e}. Continuing with existing role logic." + ) return role_mappings @@ -875,7 +890,7 @@ def _build_sso_user_update_data( Returns: dict: Update data containing user_email and optionally user_role if valid - """ + """ update_data: dict = {"user_email": normalize_email(user_email)} # Get SSO role from result and include if valid @@ -1673,7 +1688,7 @@ class SSOAuthenticationHandler: """ from urllib.parse import parse_qs, urlencode, urlparse, urlunparse - from litellm.proxy.proxy_server import user_api_key_cache + from litellm.proxy.proxy_server import redis_usage_cache, user_api_key_cache with generic_sso: # TODO: state should be a random string and added to the user session with cookie @@ -1702,13 +1717,21 @@ class SSOAuthenticationHandler: # If PKCE is enabled, add PKCE parameters to the redirect URL if code_verifier and "state" in redirect_params: - # Store code_verifier in cache (10 min TTL) + # Store code_verifier in cache (10 min TTL). Use Redis when available + # so callbacks landing on another pod can retrieve it (multi-pod SSO). cache_key = f"pkce_verifier:{redirect_params['state']}" - user_api_key_cache.set_cache( - key=cache_key, - value=code_verifier, - ttl=600, - ) + if redis_usage_cache is not None: + redis_usage_cache.set_cache( + key=cache_key, + value=json.dumps(code_verifier), + ttl=600, + ) + else: + user_api_key_cache.set_cache( + key=cache_key, + value=code_verifier, + ttl=600, + ) # Add PKCE parameters to the authorization URL if pkce_params: @@ -2319,27 +2342,38 @@ class SSOAuthenticationHandler: Returns: dict: Token exchange parameters """ - # Prepare token exchange parameters - token_params = {"include_client_id": generic_include_client_id} + # Prepare token exchange parameters (may add code_verifier: str later) + token_params: Dict[str, Any] = {"include_client_id": generic_include_client_id} - # Retrieve PKCE code_verifier if PKCE was used in authorization + # Retrieve PKCE code_verifier if PKCE was used in authorization. + # Use same cache as store: Redis when available (multi-pod), else in-memory. query_params = dict(request.query_params) state = query_params.get("state") if state: - from litellm.proxy.proxy_server import user_api_key_cache + from litellm.proxy.proxy_server import redis_usage_cache, user_api_key_cache cache_key = f"pkce_verifier:{state}" - code_verifier = user_api_key_cache.get_cache(key=cache_key) + if redis_usage_cache is not None: + code_verifier = redis_usage_cache.get_cache(key=cache_key) + else: + code_verifier = user_api_key_cache.get_cache(key=cache_key) if code_verifier: - # Add code_verifier to token exchange parameters - token_params["code_verifier"] = code_verifier + # Add code_verifier to token exchange parameters (Redis returns decoded string) + token_params["code_verifier"] = ( + code_verifier + if isinstance(code_verifier, str) + else str(code_verifier) + ) verbose_proxy_logger.debug( "PKCE code_verifier retrieved and will be included in token exchange" ) # Clean up the cache entry (single-use verifier) - user_api_key_cache.delete_cache(key=cache_key) + if redis_usage_cache is not None: + redis_usage_cache.delete_cache(key=cache_key) + else: + user_api_key_cache.delete_cache(key=cache_key) return token_params @staticmethod @@ -2482,7 +2516,9 @@ class MicrosoftSSOHandler: response = response or {} verbose_proxy_logger.debug(f"Microsoft SSO Callback Response: {response}") openid_response = CustomOpenID( - email=normalize_email(response.get(MICROSOFT_USER_EMAIL_ATTRIBUTE) or response.get("mail")), + email=normalize_email( + response.get(MICROSOFT_USER_EMAIL_ATTRIBUTE) or response.get("mail") + ), display_name=response.get(MICROSOFT_USER_DISPLAY_NAME_ATTRIBUTE), provider="microsoft", id=response.get(MICROSOFT_USER_ID_ATTRIBUTE), diff --git a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py index 41096503a2e..3a5505cdbc5 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py +++ b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py @@ -2,12 +2,10 @@ import asyncio import json import os import sys -from typing import Optional, cast from unittest.mock import AsyncMock, MagicMock, patch import pytest from fastapi import Request -from fastapi.testclient import TestClient from litellm._uuid import uuid @@ -16,7 +14,7 @@ sys.path.insert( ) # Adds the parent directory to the system path import litellm -from litellm.proxy._types import LiteLLM_UserTable, NewTeamRequest, NewUserResponse +from litellm.proxy._types import LiteLLM_UserTable, NewUserResponse from litellm.proxy.auth.handle_jwt import JWTHandler from litellm.proxy.management_endpoints.sso import CustomMicrosoftSSO from litellm.proxy.management_endpoints.types import CustomOpenID @@ -134,16 +132,32 @@ def test_microsoft_sso_handler_openid_from_response_with_custom_attributes(): expected_team_ids = ["team1"] # Act - with patch("litellm.constants.MICROSOFT_USER_EMAIL_ATTRIBUTE", "custom_email_field"), \ - patch("litellm.constants.MICROSOFT_USER_DISPLAY_NAME_ATTRIBUTE", "custom_display_name"), \ - patch("litellm.constants.MICROSOFT_USER_ID_ATTRIBUTE", "custom_id_field"), \ - patch("litellm.constants.MICROSOFT_USER_FIRST_NAME_ATTRIBUTE", "custom_first_name"), \ - patch("litellm.constants.MICROSOFT_USER_LAST_NAME_ATTRIBUTE", "custom_last_name"), \ - patch("litellm.proxy.management_endpoints.ui_sso.MICROSOFT_USER_EMAIL_ATTRIBUTE", "custom_email_field"), \ - patch("litellm.proxy.management_endpoints.ui_sso.MICROSOFT_USER_DISPLAY_NAME_ATTRIBUTE", "custom_display_name"), \ - patch("litellm.proxy.management_endpoints.ui_sso.MICROSOFT_USER_ID_ATTRIBUTE", "custom_id_field"), \ - patch("litellm.proxy.management_endpoints.ui_sso.MICROSOFT_USER_FIRST_NAME_ATTRIBUTE", "custom_first_name"), \ - patch("litellm.proxy.management_endpoints.ui_sso.MICROSOFT_USER_LAST_NAME_ATTRIBUTE", "custom_last_name"): + with patch( + "litellm.constants.MICROSOFT_USER_EMAIL_ATTRIBUTE", "custom_email_field" + ), patch( + "litellm.constants.MICROSOFT_USER_DISPLAY_NAME_ATTRIBUTE", "custom_display_name" + ), patch( + "litellm.constants.MICROSOFT_USER_ID_ATTRIBUTE", "custom_id_field" + ), patch( + "litellm.constants.MICROSOFT_USER_FIRST_NAME_ATTRIBUTE", "custom_first_name" + ), patch( + "litellm.constants.MICROSOFT_USER_LAST_NAME_ATTRIBUTE", "custom_last_name" + ), patch( + "litellm.proxy.management_endpoints.ui_sso.MICROSOFT_USER_EMAIL_ATTRIBUTE", + "custom_email_field", + ), patch( + "litellm.proxy.management_endpoints.ui_sso.MICROSOFT_USER_DISPLAY_NAME_ATTRIBUTE", + "custom_display_name", + ), patch( + "litellm.proxy.management_endpoints.ui_sso.MICROSOFT_USER_ID_ATTRIBUTE", + "custom_id_field", + ), patch( + "litellm.proxy.management_endpoints.ui_sso.MICROSOFT_USER_FIRST_NAME_ATTRIBUTE", + "custom_first_name", + ), patch( + "litellm.proxy.management_endpoints.ui_sso.MICROSOFT_USER_LAST_NAME_ATTRIBUTE", + "custom_last_name", + ): result = MicrosoftSSOHandler.openid_from_response( response=mock_response, team_ids=expected_team_ids, user_role=None ) @@ -229,7 +243,6 @@ def test_get_microsoft_callback_response_raw_sso_response(): ) # Assert - print("result from verify_and_process", result) assert isinstance(result, dict) assert result["mail"] == "microsoft_user@example.com" assert result["displayName"] == "Microsoft User" @@ -453,10 +466,6 @@ async def test_default_team_params(team_params): # Assert # Verify team was created with correct parameters mock_prisma.db.litellm_teamtable.create.assert_called_once() - print( - "mock_prisma.db.litellm_teamtable.create.call_args", - mock_prisma.db.litellm_teamtable.create.call_args, - ) create_call_args = mock_prisma.db.litellm_teamtable.create.call_args.kwargs[ "data" ] @@ -581,7 +590,7 @@ def test_apply_user_info_values_to_sso_user_defined_values_with_models(): def test_apply_user_info_values_sso_role_takes_precedence(): """ Test that SSO role takes precedence over DB role. - + When Microsoft SSO returns a user_role, it should be used instead of the role stored in the database. This ensures SSO is the authoritative source for user roles. """ @@ -676,16 +685,16 @@ def test_normalize_email(): """ # Test with lowercase email assert normalize_email("test@example.com") == "test@example.com" - + # Test with uppercase email assert normalize_email("TEST@EXAMPLE.COM") == "test@example.com" - + # Test with mixed case email assert normalize_email("Test.User@Example.COM") == "test.user@example.com" - + # Test with None assert normalize_email(None) is None - + # Test with empty string assert normalize_email("") == "" @@ -898,7 +907,7 @@ async def test_upsert_sso_user_no_role_in_sso_response(): def test_get_user_email_and_id_extracts_microsoft_role(): """ Test that _get_user_email_and_id_from_result extracts user_role from Microsoft SSO. - + This ensures Microsoft SSO roles (from app_roles in id_token) are properly extracted and converted from enum to string. """ @@ -964,7 +973,7 @@ async def test_get_user_info_from_db_user_exists(): with patch( "litellm.proxy.management_endpoints.ui_sso.get_user_object" ) as mock_get_user_object: - user_info = await get_user_info_from_db(**args) + await get_user_info_from_db(**args) mock_get_user_object.assert_called_once() assert mock_get_user_object.call_args.kwargs["user_id"] == "krrishd" @@ -1006,7 +1015,7 @@ async def test_get_user_info_from_db_user_exists_alternate_user_id(): with patch( "litellm.proxy.management_endpoints.ui_sso.get_user_object" ) as mock_get_user_object: - user_info = await get_user_info_from_db(**args) + await get_user_info_from_db(**args) mock_get_user_object.assert_called_once() assert mock_get_user_object.call_args.kwargs["user_id"] == "krrishd-email1234" @@ -1015,7 +1024,7 @@ async def test_get_user_info_from_db_user_exists_alternate_user_id(): async def test_get_user_info_from_db_user_not_exists_creates_user(): """ Test that get_user_info_from_db creates a new user when user doesn't exist in DB. - + When get_existing_user_info_from_db returns None, get_user_info_from_db should: 1. Call upsert_sso_user with user_info=None 2. upsert_sso_user should call insert_sso_user to create the user @@ -1103,7 +1112,7 @@ async def test_get_user_info_from_db_user_not_exists_creates_user(): async def test_get_user_info_from_db_user_exists_updates_user(): """ Test that get_user_info_from_db updates existing user when user exists in DB. - + When get_existing_user_info_from_db returns a user, get_user_info_from_db should: 1. Call upsert_sso_user with the existing user_info 2. upsert_sso_user should update the user in the database @@ -1195,6 +1204,7 @@ async def test_get_user_info_from_db_user_exists_updates_user(): # Should return the updated user assert user_info == updated_user + @pytest.mark.asyncio async def test_check_and_update_if_proxy_admin_id(): """ @@ -1302,10 +1312,10 @@ async def test_get_generic_sso_response_with_additional_headers(): mock_sso_class = MagicMock(return_value=mock_sso_instance) with patch.dict(os.environ, test_env_vars): - with patch("fastapi_sso.sso.base.DiscoveryDocument") as mock_discovery: + with patch("fastapi_sso.sso.base.DiscoveryDocument"): with patch( "fastapi_sso.sso.generic.create_provider", return_value=mock_sso_class - ) as mock_create_provider: + ): # Act result, received_response = await get_generic_sso_response( request=mock_request, @@ -1363,10 +1373,10 @@ async def test_get_generic_sso_response_with_empty_headers(): mock_sso_class = MagicMock(return_value=mock_sso_instance) with patch.dict(os.environ, test_env_vars): - with patch("fastapi_sso.sso.base.DiscoveryDocument") as mock_discovery: + with patch("fastapi_sso.sso.base.DiscoveryDocument"): with patch( "fastapi_sso.sso.generic.create_provider", return_value=mock_sso_class - ) as mock_create_provider: + ): # Act result, received_response = await get_generic_sso_response( request=mock_request, @@ -1751,8 +1761,6 @@ class TestCustomUISSO: """Test that proper error is raised when enterprise module is not available""" from unittest.mock import MagicMock, patch - from litellm.proxy.management_endpoints.ui_sso import google_login - # Mock request mock_request = MagicMock() mock_request.base_url = "https://test.example.com/" @@ -1774,7 +1782,7 @@ class TestCustomUISSO: # This mimics the relevant part of google_login that would trigger the import error try: from enterprise.litellm_enterprise.proxy.auth.custom_sso_handler import ( - EnterpriseCustomSSOHandler, + EnterpriseCustomSSOHandler, # noqa: F401 ) return "success" @@ -1978,59 +1986,56 @@ class TestCLIKeyRegenerationFlow: # Test data session_key = "sk-session-456" - + # Mock user info mock_user_info = LiteLLM_UserTable( user_id="test-user-123", user_role="internal_user", teams=["team1", "team2"], - models=["gpt-4"] + models=["gpt-4"], ) # Mock SSO result - mock_sso_result = { - "user_email": "test@example.com", - "user_id": "test-user-123" - } + mock_sso_result = {"user_email": "test@example.com", "user_id": "test-user-123"} # Mock cache mock_cache = MagicMock() - + with patch( "litellm.proxy.management_endpoints.ui_sso.get_user_info_from_db", - return_value=mock_user_info - ), patch( - "litellm.proxy.proxy_server.prisma_client", MagicMock() - ), patch( + return_value=mock_user_info, + ), patch("litellm.proxy.proxy_server.prisma_client", MagicMock()), patch( "litellm.proxy.proxy_server.user_api_key_cache", mock_cache ), patch( "litellm.proxy.common_utils.html_forms.cli_sso_success.render_cli_sso_success_page", return_value="Success", ): - # Act result = await cli_sso_callback( - request=mock_request, key=session_key, existing_key=None, result=mock_sso_result + request=mock_request, + key=session_key, + existing_key=None, + result=mock_sso_result, ) # Assert - verify session was stored in cache mock_cache.set_cache.assert_called_once() call_args = mock_cache.set_cache.call_args - + # Verify cache key format assert "cli_sso_session:" in call_args.kwargs["key"] assert session_key in call_args.kwargs["key"] - + # Verify session data structure session_data = call_args.kwargs["value"] assert session_data["user_id"] == "test-user-123" assert session_data["user_role"] == "internal_user" assert session_data["teams"] == ["team1", "team2"] assert session_data["models"] == ["gpt-4"] - + # Verify TTL assert call_args.kwargs["ttl"] == 600 # 10 minutes - + assert result.status_code == 200 # Verify response contains success message (response is HTML) assert result.body is not None @@ -2046,17 +2051,14 @@ class TestCLIKeyRegenerationFlow: "user_id": "test-user-456", "user_role": "internal_user", "teams": ["team-a", "team-b", "team-c"], - "models": ["gpt-4"] + "models": ["gpt-4"], } # Mock cache mock_cache = MagicMock() mock_cache.get_cache.return_value = session_data - - with patch( - "litellm.proxy.proxy_server.user_api_key_cache", mock_cache - ): + with patch("litellm.proxy.proxy_server.user_api_key_cache", mock_cache): # Act - First poll without team_id result = await cli_poll_key(key_id=session_key, team_id=None) @@ -2066,7 +2068,7 @@ class TestCLIKeyRegenerationFlow: assert result["user_id"] == "test-user-456" assert result["teams"] == ["team-a", "team-b", "team-c"] assert "key" not in result # JWT should not be generated yet - + # Verify session was NOT deleted mock_cache.delete_cache.assert_not_called() @@ -2170,34 +2172,33 @@ class TestCLIKeyRegenerationFlow: "user_role": "internal_user", "teams": ["team-a", "team-b", "team-c"], "models": ["gpt-4"], - "user_email": "test@example.com" + "user_email": "test@example.com", } - + # Mock user info mock_user_info = LiteLLM_UserTable( user_id="test-user-789", user_role="internal_user", teams=["team-a", "team-b", "team-c"], - models=["gpt-4"] + models=["gpt-4"], ) # Mock cache mock_cache = MagicMock() mock_cache.get_cache.return_value = session_data - + mock_jwt_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.test.token" - - with patch( - "litellm.proxy.proxy_server.user_api_key_cache", mock_cache - ), patch( + + with patch("litellm.proxy.proxy_server.user_api_key_cache", mock_cache), patch( "litellm.proxy.proxy_server.prisma_client" ) as mock_prisma, patch( "litellm.proxy.auth.auth_checks.ExperimentalUIJWTToken.get_cli_jwt_auth_token", - return_value=mock_jwt_token + return_value=mock_jwt_token, ) as mock_get_jwt: - # Mock the user lookup - mock_prisma.db.litellm_usertable.find_unique = AsyncMock(return_value=mock_user_info) + mock_prisma.db.litellm_usertable.find_unique = AsyncMock( + return_value=mock_user_info + ) # Act - Second poll with team_id result = await cli_poll_key(key_id=session_key, team_id=selected_team) @@ -2208,12 +2209,12 @@ class TestCLIKeyRegenerationFlow: assert result["user_id"] == "test-user-789" assert result["team_id"] == selected_team assert result["teams"] == ["team-a", "team-b", "team-c"] - + # Verify JWT was generated with correct team mock_get_jwt.assert_called_once() jwt_call_args = mock_get_jwt.call_args assert jwt_call_args.kwargs["team_id"] == selected_team - + # Verify session was deleted after JWT generation mock_cache.delete_cache.assert_called_once() @@ -2223,7 +2224,6 @@ class TestGetAppRolesFromIdToken: def test_roles_picked_when_app_roles_not_exists(self): """Test that 'roles' is picked when 'app_roles' doesn't exist""" - import jwt # Create a token with only 'roles' claim token_payload = { @@ -2247,7 +2247,6 @@ class TestGetAppRolesFromIdToken: def test_app_roles_picked_when_both_exist(self): """Test that 'app_roles' takes precedence when both 'app_roles' and 'roles' exist""" - import jwt # Create a token with both 'app_roles' and 'roles' claims token_payload = { @@ -2268,7 +2267,6 @@ class TestGetAppRolesFromIdToken: def test_roles_picked_when_app_roles_is_empty(self): """Test that 'roles' is picked when 'app_roles' exists but is empty""" - import jwt # Create a token with empty 'app_roles' and populated 'roles' token_payload = { @@ -2289,7 +2287,6 @@ class TestGetAppRolesFromIdToken: def test_empty_list_when_neither_exists(self): """Test that empty list is returned when neither 'app_roles' nor 'roles' exist""" - import jwt # Create a token without roles claims token_payload = {"sub": "user123", "email": "test@example.com"} @@ -2313,7 +2310,6 @@ class TestGetAppRolesFromIdToken: def test_empty_list_when_roles_not_a_list(self): """Test that empty list is returned when roles is not a list""" - import jwt # Create a token with non-list roles token_payload = { @@ -2333,7 +2329,6 @@ class TestGetAppRolesFromIdToken: def test_error_handling_on_jwt_decode_exception(self): """Test that exceptions during JWT decode are handled gracefully""" - import jwt mock_token = "invalid.jwt.token" @@ -2726,12 +2721,6 @@ class TestGenericResponseConvertorNestedAttributes: # to handle dotted paths like "attributes.userId" # Current behavior: returns None for nested paths - print(f"User ID result: {result.id}") - print(f"Email result: {result.email}") - print(f"First name result: {result.first_name}") - print(f"Last name result: {result.last_name}") - print(f"Display name result: {result.display_name}") - # Expected behavior with current implementation (no nested path support): assert result.id == "nested-user-456" assert ( @@ -2821,14 +2810,15 @@ class TestGetGenericSSORedirectParams: # Arrange cli_state = "litellm-session-token:sk-test123" - + with patch.dict(os.environ, {"GENERIC_CLIENT_STATE": "env_state_value"}): # Act - redirect_params, code_verifier = ( - SSOAuthenticationHandler._get_generic_sso_redirect_params( - state=cli_state, - generic_authorization_endpoint="https://auth.example.com/authorize", - ) + ( + redirect_params, + code_verifier, + ) = SSOAuthenticationHandler._get_generic_sso_redirect_params( + state=cli_state, + generic_authorization_endpoint="https://auth.example.com/authorize", ) # Assert @@ -2843,14 +2833,15 @@ class TestGetGenericSSORedirectParams: # Arrange env_state = "custom_env_state_value" - + with patch.dict(os.environ, {"GENERIC_CLIENT_STATE": env_state}): # Act - redirect_params, code_verifier = ( - SSOAuthenticationHandler._get_generic_sso_redirect_params( - state=None, - generic_authorization_endpoint="https://auth.example.com/authorize", - ) + ( + redirect_params, + code_verifier, + ) = SSOAuthenticationHandler._get_generic_sso_redirect_params( + state=None, + generic_authorization_endpoint="https://auth.example.com/authorize", ) # Assert @@ -2867,13 +2858,14 @@ class TestGetGenericSSORedirectParams: with patch.dict(os.environ, {}, clear=False): # Remove GENERIC_CLIENT_STATE if it exists os.environ.pop("GENERIC_CLIENT_STATE", None) - + # Act - redirect_params, code_verifier = ( - SSOAuthenticationHandler._get_generic_sso_redirect_params( - state=None, - generic_authorization_endpoint="https://auth.example.com/authorize", - ) + ( + redirect_params, + code_verifier, + ) = SSOAuthenticationHandler._get_generic_sso_redirect_params( + state=None, + generic_authorization_endpoint="https://auth.example.com/authorize", ) # Assert @@ -2893,26 +2885,27 @@ class TestGetGenericSSORedirectParams: # Arrange test_state = "test_state_123" - + with patch.dict(os.environ, {"GENERIC_CLIENT_USE_PKCE": "true"}): # Act - redirect_params, code_verifier = ( - SSOAuthenticationHandler._get_generic_sso_redirect_params( - state=test_state, - generic_authorization_endpoint="https://auth.example.com/authorize", - ) + ( + redirect_params, + code_verifier, + ) = SSOAuthenticationHandler._get_generic_sso_redirect_params( + state=test_state, + generic_authorization_endpoint="https://auth.example.com/authorize", ) # Assert state assert redirect_params["state"] == test_state - + # Assert PKCE parameters assert code_verifier is not None assert len(code_verifier) == 43 # Standard PKCE verifier length assert "code_challenge" in redirect_params assert "code_challenge_method" in redirect_params assert redirect_params["code_challenge_method"] == "S256" - + # Verify code_challenge is correctly derived from code_verifier expected_challenge_bytes = hashlib.sha256( code_verifier.encode("utf-8") @@ -2932,14 +2925,15 @@ class TestGetGenericSSORedirectParams: # Arrange test_state = "test_state_456" - + with patch.dict(os.environ, {"GENERIC_CLIENT_USE_PKCE": "false"}): # Act - redirect_params, code_verifier = ( - SSOAuthenticationHandler._get_generic_sso_redirect_params( - state=test_state, - generic_authorization_endpoint="https://auth.example.com/authorize", - ) + ( + redirect_params, + code_verifier, + ) = SSOAuthenticationHandler._get_generic_sso_redirect_params( + state=test_state, + generic_authorization_endpoint="https://auth.example.com/authorize", ) # Assert @@ -2957,7 +2951,7 @@ class TestGetGenericSSORedirectParams: # Arrange cli_state = "cli_state_priority" env_state = "env_state_should_not_be_used" - + with patch.dict( os.environ, { @@ -2966,17 +2960,18 @@ class TestGetGenericSSORedirectParams: }, ): # Act - redirect_params, code_verifier = ( - SSOAuthenticationHandler._get_generic_sso_redirect_params( - state=cli_state, - generic_authorization_endpoint="https://auth.example.com/authorize", - ) + ( + redirect_params, + code_verifier, + ) = SSOAuthenticationHandler._get_generic_sso_redirect_params( + state=cli_state, + generic_authorization_endpoint="https://auth.example.com/authorize", ) # Assert assert redirect_params["state"] == cli_state # CLI state takes priority assert redirect_params["state"] != env_state - + # PKCE should still be generated assert code_verifier is not None assert "code_challenge" in redirect_params @@ -2990,14 +2985,15 @@ class TestGetGenericSSORedirectParams: # Arrange env_state = "env_state_for_empty_cli" - + with patch.dict(os.environ, {"GENERIC_CLIENT_STATE": env_state}): # Act - redirect_params, code_verifier = ( - SSOAuthenticationHandler._get_generic_sso_redirect_params( - state="", # Empty string - generic_authorization_endpoint="https://auth.example.com/authorize", - ) + ( + redirect_params, + code_verifier, + ) = SSOAuthenticationHandler._get_generic_sso_redirect_params( + state="", # Empty string + generic_authorization_endpoint="https://auth.example.com/authorize", ) # Assert - empty string is falsy, so env variable should be used @@ -3014,7 +3010,7 @@ class TestGetGenericSSORedirectParams: # Arrange - no state provided with patch.dict(os.environ, {}, clear=False): os.environ.pop("GENERIC_CLIENT_STATE", None) - + # Act params1, _ = SSOAuthenticationHandler._get_generic_sso_redirect_params( state=None, @@ -3145,6 +3141,176 @@ class TestPKCEFunctionality: assert "code_challenge_method=S256" in updated_location assert f"state={test_state}" in updated_location + @pytest.mark.asyncio + async def test_pkce_redis_multi_pod_verifier_roundtrip(self): + """ + Mock Redis to verify PKCE code_verifier round-trip across "pods": + Pod A stores verifier in Redis; Pod B retrieves it (no real IdP). + """ + from litellm.proxy.management_endpoints.ui_sso import SSOAuthenticationHandler + + # In-memory mock of Redis (shared between "pods") + class MockRedisCache: + def __init__(self): + self._store = {} + + def set_cache(self, key, value, **kwargs): + self._store[key] = value + + def get_cache(self, key, **kwargs): + val = self._store.get(key) + if val is None: + return None + # Simulate RedisCache._get_cache_logic: stored as JSON string, return decoded + if isinstance(val, str): + try: + return json.loads(val) + except (ValueError, TypeError): + return val + return val + + def delete_cache(self, key): + self._store.pop(key, None) + + mock_redis = MockRedisCache() + mock_in_memory = MagicMock() + + mock_sso = MagicMock() + mock_redirect_response = MagicMock() + mock_redirect_response.headers = { + "location": "https://auth.example.com/authorize?state=multi_pod_state_xyz&client_id=abc" + } + mock_sso.get_login_redirect = AsyncMock(return_value=mock_redirect_response) + mock_sso.__enter__ = MagicMock(return_value=mock_sso) + mock_sso.__exit__ = MagicMock(return_value=False) + + with patch.dict(os.environ, {"GENERIC_CLIENT_USE_PKCE": "true"}): + with patch("litellm.proxy.proxy_server.redis_usage_cache", mock_redis): + with patch( + "litellm.proxy.proxy_server.user_api_key_cache", mock_in_memory + ): + # Pod A: start login, store code_verifier in "Redis" + await SSOAuthenticationHandler.get_generic_sso_redirect_response( + generic_sso=mock_sso, + state="multi_pod_state_xyz", + generic_authorization_endpoint="https://auth.example.com/authorize", + ) + mock_in_memory.set_cache.assert_not_called() + # MockRedisCache is a real class; assert on state, not .assert_called_* + stored_key = "pkce_verifier:multi_pod_state_xyz" + assert stored_key in mock_redis._store + stored_value = mock_redis._store[stored_key] + assert json.loads(stored_value) # valid verifier string + + # Pod B: callback with same state, retrieve from "Redis" + mock_request = MagicMock(spec=Request) + mock_request.query_params = {"state": "multi_pod_state_xyz"} + token_params = ( + SSOAuthenticationHandler.prepare_token_exchange_parameters( + request=mock_request, generic_include_client_id=False + ) + ) + assert "code_verifier" in token_params + assert token_params["code_verifier"] == json.loads(stored_value) + mock_in_memory.get_cache.assert_not_called() + # delete_cache called; key removed (asserted below) + + # Verifier consumed (single-use); key removed from "Redis" + assert "pkce_verifier:multi_pod_state_xyz" not in mock_redis._store + + @pytest.mark.asyncio + async def test_pkce_fallback_in_memory_roundtrip_when_redis_none(self): + """ + Regression: When redis_usage_cache is None (no Redis configured), + code_verifier is stored and retrieved via user_api_key_cache. + Roundtrip works when callback hits same pod (same in-memory cache). + Single-pod or no-Redis deployments must continue to work. + """ + from litellm.proxy.management_endpoints.ui_sso import SSOAuthenticationHandler + + # In-memory store (simulates user_api_key_cache on one pod) + in_memory_store = {} + + def set_cache(key, value, **kwargs): + in_memory_store[key] = value + + def get_cache(key, **kwargs): + return in_memory_store.get(key) + + def delete_cache(key): + in_memory_store.pop(key, None) + + mock_in_memory = MagicMock() + mock_in_memory.set_cache.side_effect = set_cache + mock_in_memory.get_cache.side_effect = get_cache + mock_in_memory.delete_cache.side_effect = delete_cache + + mock_sso = MagicMock() + mock_redirect_response = MagicMock() + mock_redirect_response.headers = { + "location": "https://auth.example.com/authorize?state=fallback_state_xyz&client_id=abc" + } + mock_sso.get_login_redirect = AsyncMock(return_value=mock_redirect_response) + mock_sso.__enter__ = MagicMock(return_value=mock_sso) + mock_sso.__exit__ = MagicMock(return_value=False) + + with patch.dict(os.environ, {"GENERIC_CLIENT_USE_PKCE": "true"}): + with patch("litellm.proxy.proxy_server.redis_usage_cache", None): + with patch( + "litellm.proxy.proxy_server.user_api_key_cache", mock_in_memory + ): + # Pod A: start login, store code_verifier in in-memory cache + await SSOAuthenticationHandler.get_generic_sso_redirect_response( + generic_sso=mock_sso, + state="fallback_state_xyz", + generic_authorization_endpoint="https://auth.example.com/authorize", + ) + mock_in_memory.set_cache.assert_called_once() + stored_key = mock_in_memory.set_cache.call_args.kwargs["key"] + stored_value = mock_in_memory.set_cache.call_args.kwargs["value"] + assert stored_key == "pkce_verifier:fallback_state_xyz" + assert isinstance(stored_value, str) and len(stored_value) == 43 + + # Same pod: callback retrieves from in-memory cache + mock_request = MagicMock(spec=Request) + mock_request.query_params = {"state": "fallback_state_xyz"} + token_params = ( + SSOAuthenticationHandler.prepare_token_exchange_parameters( + request=mock_request, generic_include_client_id=False + ) + ) + assert "code_verifier" in token_params + assert token_params["code_verifier"] == stored_value + mock_in_memory.get_cache.assert_called_once_with(key=stored_key) + mock_in_memory.delete_cache.assert_called_once_with(key=stored_key) + + # Verifier consumed; key removed from in-memory + assert "pkce_verifier:fallback_state_xyz" not in in_memory_store + + @pytest.mark.asyncio + async def test_pkce_prepare_token_exchange_returns_nothing_when_no_state(self): + """ + Regression: prepare_token_exchange_parameters with no state in request + does not call cache and does not add code_verifier. + """ + from litellm.proxy.management_endpoints.ui_sso import SSOAuthenticationHandler + + mock_redis = MagicMock() + mock_in_memory = MagicMock() + + with patch("litellm.proxy.proxy_server.redis_usage_cache", mock_redis): + with patch("litellm.proxy.proxy_server.user_api_key_cache", mock_in_memory): + mock_request = MagicMock(spec=Request) + mock_request.query_params = {} + token_params = ( + SSOAuthenticationHandler.prepare_token_exchange_parameters( + request=mock_request, generic_include_client_id=False + ) + ) + assert "code_verifier" not in token_params + mock_redis.get_cache.assert_not_called() + mock_in_memory.get_cache.assert_not_called() + # Tests for SSO user team assignment bug (Issue: SSO Users Not Added to Entra-Synced Teams on First Login) class TestAddMissingTeamMember: @@ -3268,9 +3434,7 @@ class TestAddMissingTeamMember: team_member_calls = [] async def track_team_member_add(team_id, user_info): - team_member_calls.append( - {"team_id": team_id, "user_id": user_info.user_id} - ) + team_member_calls.append({"team_id": team_id, "user_id": user_info.user_id}) # New SSO user with Entra groups new_user = NewUserResponse( @@ -3331,7 +3495,6 @@ class TestAddMissingTeamMember: """ Parametrized test ensuring add_missing_team_member works for all user types. """ - from litellm.proxy._types import LiteLLM_UserTable from litellm.proxy.management_endpoints.ui_sso import add_missing_team_member user_info = user_info_factory("test-user-id") @@ -3421,7 +3584,7 @@ async def test_role_mappings_override_default_internal_user_params(): return_value=mock_new_user_response, ) as mock_new_user: # Act - result = await insert_sso_user( + _ = await insert_sso_user( result_openid=mock_result_openid, user_defined_values=user_defined_values, ) @@ -3443,7 +3606,7 @@ async def test_role_mappings_override_default_internal_user_params(): assert ( new_user_request.budget_duration == "30d" ), "budget_duration from default_internal_user_params should be applied" - + # Note: models are applied via _update_internal_new_user_params inside new_user, # not in insert_sso_user, so we verify user_defined_values was updated correctly # by checking that the function completed successfully and other defaults were applied @@ -3558,7 +3721,10 @@ class TestSSOReadinessEndpoint: assert data["sso_configured"] is True assert data["provider"] == "google" assert "GOOGLE_CLIENT_SECRET" in data["missing_environment_variables"] - assert "Google SSO is configured but missing required environment variables" in data["message"] + assert ( + "Google SSO is configured but missing required environment variables" + in data["message"] + ) finally: app.dependency_overrides.clear() @@ -3607,7 +3773,7 @@ class TestSSOReadinessEndpoint: response = client.get("/sso/readiness") assert response.status_code == expected_status - + if expected_status == 200: data = response.json() assert data["sso_configured"] is True @@ -3677,7 +3843,7 @@ class TestSSOReadinessEndpoint: response = client.get("/sso/readiness") assert response.status_code == expected_status - + if expected_status == 200: data = response.json() assert data["sso_configured"] is True @@ -3722,8 +3888,14 @@ class TestCustomMicrosoftSSO: discovery = await sso.get_discovery_document() - assert discovery["authorization_endpoint"] == "https://login.microsoftonline.com/test-tenant/oauth2/v2.0/authorize" - assert discovery["token_endpoint"] == "https://login.microsoftonline.com/test-tenant/oauth2/v2.0/token" + assert ( + discovery["authorization_endpoint"] + == "https://login.microsoftonline.com/test-tenant/oauth2/v2.0/authorize" + ) + assert ( + discovery["token_endpoint"] + == "https://login.microsoftonline.com/test-tenant/oauth2/v2.0/token" + ) assert discovery["userinfo_endpoint"] == "https://graph.microsoft.com/v1.0/me" @pytest.mark.asyncio @@ -3787,8 +3959,13 @@ class TestCustomMicrosoftSSO: # Custom auth endpoint assert discovery["authorization_endpoint"] == custom_auth_endpoint # Default token and userinfo endpoints - assert discovery["token_endpoint"] == "https://login.microsoftonline.com/test-tenant/oauth2/v2.0/token" - assert discovery["userinfo_endpoint"] == "https://graph.microsoft.com/v1.0/me" + assert ( + discovery["token_endpoint"] + == "https://login.microsoftonline.com/test-tenant/oauth2/v2.0/token" + ) + assert ( + discovery["userinfo_endpoint"] == "https://graph.microsoft.com/v1.0/me" + ) def test_custom_microsoft_sso_uses_common_tenant_when_none(self): """ @@ -3825,11 +4002,7 @@ async def test_setup_team_mappings(): # Arrange mock_prisma = MagicMock() mock_sso_config = MagicMock() - mock_sso_config.sso_settings = { - "team_mappings": { - "team_ids_jwt_field": "groups" - } - } + mock_sso_config.sso_settings = {"team_mappings": {"team_ids_jwt_field": "groups"}} mock_prisma.db.litellm_ssoconfig.find_unique = AsyncMock( return_value=mock_sso_config ) From 768f9a44b21a8af72cbeb44d9099697e540aa580 Mon Sep 17 00:00:00 2001 From: Harshit Jain Date: Tue, 3 Feb 2026 09:50:10 +0530 Subject: [PATCH 003/182] fix: virutal key grace period from env/UI --- docs/my-website/docs/proxy/config_settings.md | 1 + docs/my-website/docs/proxy/virtual_keys.md | 7 +- .../migration.sql | 19 ++ .../litellm_proxy_extras/schema.prisma | 13 + litellm/constants.py | 51 +++- litellm/proxy/_types.py | 4 +- .../common_utils/key_rotation_manager.py | 29 +- .../key_management_endpoints.py | 253 +++++++++++------- litellm/proxy/schema.prisma | 13 + litellm/proxy/utils.py | 65 +++++ schema.prisma | 13 + .../common_utils/test_key_rotation_manager.py | 193 +++++++++---- .../organisms/regenerate_key_modal.tsx | 12 + 13 files changed, 500 insertions(+), 173 deletions(-) create mode 100644 litellm-proxy-extras/litellm_proxy_extras/migrations/20260203120000_add_deprecated_verification_token_table/migration.sql diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md index 264c7d765b3..1a1bf975d2d 100644 --- a/docs/my-website/docs/proxy/config_settings.md +++ b/docs/my-website/docs/proxy/config_settings.md @@ -755,6 +755,7 @@ router_settings: | LITELM_ENVIRONMENT | Environment of LiteLLM Instance, used by logging services. Currently only used by DeepEval. | LITELLM_KEY_ROTATION_ENABLED | Enable auto-key rotation for LiteLLM (boolean). Default is false. | LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS | Interval in seconds for how often to run job that auto-rotates keys. Default is 86400 (24 hours). +| LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS | Hours to keep old key valid after rotation (e.g. 24, 48, 72). Default is 0 (immediate revoke). Used for scheduled rotations and as fallback when not specified in regenerate request. | LITELLM_LICENSE | License key for LiteLLM usage | LITELLM_LOCAL_MODEL_COST_MAP | Local configuration for model cost mapping in LiteLLM | LITELLM_LOG | Enable detailed logging for LiteLLM diff --git a/docs/my-website/docs/proxy/virtual_keys.md b/docs/my-website/docs/proxy/virtual_keys.md index 38ff4ede280..31506ea2611 100644 --- a/docs/my-website/docs/proxy/virtual_keys.md +++ b/docs/my-website/docs/proxy/virtual_keys.md @@ -549,11 +549,14 @@ curl 'http://localhost:4000/key/sk-1234/regenerate' \ "models": [ "gpt-4", "gpt-3.5-turbo" - ] + ], + "grace_period_hours": 48 }' ``` +**Grace period (optional)**: Set `grace_period_hours` (e.g. 24, 48, 72) to keep the old key valid for a transitional period. Both old and new keys work until the grace period elapses, enabling seamless cutover without production downtime. Default is 0 (immediate revoke). Can also be set via `LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS` for scheduled rotations. + **Read More** - [Write rotated keys to secrets manager](https://docs.litellm.ai/docs/secret#aws-secret-manager) @@ -640,11 +643,13 @@ Set these environment variables when starting the proxy: |----------|-------------|---------| | `LITELLM_KEY_ROTATION_ENABLED` | Enable the rotation worker | `false` | | `LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS` | How often to scan for keys to rotate (in seconds) | `86400` (24 hours) | +| `LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS` | Hours to keep old key valid after rotation (24–72 recommended) | `0` (immediate revoke) | **Example:** ```bash export LITELLM_KEY_ROTATION_ENABLED=true export LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS=3600 # Check every hour +export LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS=48 # Keep old key valid for 48h during cutover litellm --config config.yaml ``` diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260203120000_add_deprecated_verification_token_table/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260203120000_add_deprecated_verification_token_table/migration.sql new file mode 100644 index 00000000000..51d88444191 --- /dev/null +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260203120000_add_deprecated_verification_token_table/migration.sql @@ -0,0 +1,19 @@ +-- CreateTable +CREATE TABLE "LiteLLM_DeprecatedVerificationToken" ( + "id" TEXT NOT NULL, + "token" TEXT NOT NULL, + "active_token_id" TEXT NOT NULL, + "revoke_at" TIMESTAMP(3) NOT NULL, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "LiteLLM_DeprecatedVerificationToken_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "LiteLLM_DeprecatedVerificationToken_token_key" ON "LiteLLM_DeprecatedVerificationToken"("token"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeprecatedVerificationToken_token_revoke_at_idx" ON "LiteLLM_DeprecatedVerificationToken"("token", "revoke_at"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeprecatedVerificationToken_revoke_at_idx" ON "LiteLLM_DeprecatedVerificationToken"("revoke_at"); diff --git a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma index 3b81da10923..8992f4d8df6 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma +++ b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma @@ -317,6 +317,19 @@ model LiteLLM_VerificationToken { @@index([budget_reset_at, expires]) } +// Deprecated keys during grace period - allows old key to work until revoke_at +model LiteLLM_DeprecatedVerificationToken { + id String @id @default(uuid()) + token String // Hashed old key + active_token_id String // Current token hash in LiteLLM_VerificationToken + revoke_at DateTime // When the old key stops working + created_at DateTime @default(now()) @map("created_at") + + @@unique([token]) + @@index([token, revoke_at]) + @@index([revoke_at]) +} + // Audit table for deleted keys - preserves spend and key information for historical tracking model LiteLLM_DeletedVerificationToken { id String @id @default(uuid()) diff --git a/litellm/constants.py b/litellm/constants.py index 6427c367924..7625d55f003 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -125,15 +125,19 @@ _DEFAULT_TTL_FOR_HTTPX_CLIENTS = 3600 # 1 hour, re-use the same httpx client fo # Aiohttp connection pooling - prevents memory leaks from unbounded connection growth # Set to 0 for unlimited (not recommended for production) AIOHTTP_CONNECTOR_LIMIT = int(os.getenv("AIOHTTP_CONNECTOR_LIMIT", 300)) -AIOHTTP_CONNECTOR_LIMIT_PER_HOST = int(os.getenv("AIOHTTP_CONNECTOR_LIMIT_PER_HOST", 50)) +AIOHTTP_CONNECTOR_LIMIT_PER_HOST = int( + os.getenv("AIOHTTP_CONNECTOR_LIMIT_PER_HOST", 50) +) AIOHTTP_KEEPALIVE_TIMEOUT = int(os.getenv("AIOHTTP_KEEPALIVE_TIMEOUT", 120)) AIOHTTP_TTL_DNS_CACHE = int(os.getenv("AIOHTTP_TTL_DNS_CACHE", 300)) # enable_cleanup_closed is only needed for Python versions with the SSL leak bug # Fixed in Python 3.12.7+ and 3.13.1+ (see https://github.com/python/cpython/pull/118960) # Reference: https://github.com/aio-libs/aiohttp/blob/master/aiohttp/connector.py#L74-L78 -AIOHTTP_NEEDS_CLEANUP_CLOSED = ( - (3, 13, 0) <= sys.version_info < (3, 13, 1) or sys.version_info < (3, 12, 7) -) +AIOHTTP_NEEDS_CLEANUP_CLOSED = (3, 13, 0) <= sys.version_info < ( + 3, + 13, + 1, +) or sys.version_info < (3, 12, 7) # WebSocket constants # Default to None (unlimited) to match OpenAI's official agents SDK behavior @@ -171,7 +175,9 @@ REDIS_UPDATE_BUFFER_KEY = "litellm_spend_update_buffer" REDIS_DAILY_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_spend_update_buffer" REDIS_DAILY_TEAM_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_team_spend_update_buffer" REDIS_DAILY_ORG_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_org_spend_update_buffer" -REDIS_DAILY_END_USER_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_end_user_spend_update_buffer" +REDIS_DAILY_END_USER_SPEND_UPDATE_BUFFER_KEY = ( + "litellm_daily_end_user_spend_update_buffer" +) REDIS_DAILY_AGENT_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_agent_spend_update_buffer" REDIS_DAILY_TAG_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_tag_spend_update_buffer" MAX_REDIS_BUFFER_DEQUEUE_COUNT = int(os.getenv("MAX_REDIS_BUFFER_DEQUEUE_COUNT", 100)) @@ -297,7 +303,9 @@ MAX_SIZE_PER_ITEM_IN_MEMORY_CACHE_IN_KB = int( DEFAULT_MAX_TOKENS_FOR_TRITON = int(os.getenv("DEFAULT_MAX_TOKENS_FOR_TRITON", 2000)) #### Networking settings #### request_timeout: float = float(os.getenv("REQUEST_TIMEOUT", 6000)) # time in seconds -DEFAULT_A2A_AGENT_TIMEOUT: float = float(os.getenv("DEFAULT_A2A_AGENT_TIMEOUT", 6000)) # 10 minutes +DEFAULT_A2A_AGENT_TIMEOUT: float = float( + os.getenv("DEFAULT_A2A_AGENT_TIMEOUT", 6000) +) # 10 minutes STREAM_SSE_DONE_STRING: str = "[DONE]" STREAM_SSE_DATA_PREFIX: str = "data: " ### SPEND TRACKING ### @@ -333,8 +341,12 @@ DD_TRACER_STREAMING_CHUNK_YIELD_RESOURCE = os.getenv( "DD_TRACER_STREAMING_CHUNK_YIELD_RESOURCE", "streaming.chunk.yield" ) -EMAIL_BUDGET_ALERT_TTL = int(os.getenv("EMAIL_BUDGET_ALERT_TTL", 24 * 60 * 60)) # 24 hours in seconds -EMAIL_BUDGET_ALERT_MAX_SPEND_ALERT_PERCENTAGE = float(os.getenv("EMAIL_BUDGET_ALERT_MAX_SPEND_ALERT_PERCENTAGE", 0.8)) # 80% of max budget +EMAIL_BUDGET_ALERT_TTL = int( + os.getenv("EMAIL_BUDGET_ALERT_TTL", 24 * 60 * 60) +) # 24 hours in seconds +EMAIL_BUDGET_ALERT_MAX_SPEND_ALERT_PERCENTAGE = float( + os.getenv("EMAIL_BUDGET_ALERT_MAX_SPEND_ALERT_PERCENTAGE", 0.8) +) # 80% of max budget ############### LLM Provider Constants ############### ### ANTHROPIC CONSTANTS ### ANTHROPIC_TOKEN_COUNTING_BETA_VERSION = os.getenv( @@ -1082,7 +1094,17 @@ known_tokenizer_config = { } -OPENAI_FINISH_REASONS = ["stop", "length", "function_call", "content_filter", "null", "finish_reason_unspecified", "malformed_function_call", "guardrail_intervened", "eos"] +OPENAI_FINISH_REASONS = [ + "stop", + "length", + "function_call", + "content_filter", + "null", + "finish_reason_unspecified", + "malformed_function_call", + "guardrail_intervened", + "eos", +] HUMANLOOP_PROMPT_CACHE_TTL_SECONDS = int( os.getenv("HUMANLOOP_PROMPT_CACHE_TTL_SECONDS", 60) ) # 1 minute @@ -1172,6 +1194,9 @@ LITELLM_KEY_ROTATION_ENABLED = os.getenv("LITELLM_KEY_ROTATION_ENABLED", "false" LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS = int( os.getenv("LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS", 86400) ) # 24 hours default +LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS = int( + os.getenv("LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS", 0) +) # Hours to keep old key valid after rotation; 0 = immediate revoke (default) UI_SESSION_TOKEN_TEAM_ID = "litellm-dashboard" LITELLM_PROXY_ADMIN_NAME = "default_user_id" @@ -1182,8 +1207,8 @@ CLI_SSO_SESSION_CACHE_KEY_PREFIX = "cli_sso_session" CLI_JWT_TOKEN_NAME = "cli-jwt-token" # Support both CLI_JWT_EXPIRATION_HOURS and LITELLM_CLI_JWT_EXPIRATION_HOURS for backwards compatibility CLI_JWT_EXPIRATION_HOURS = int( - os.getenv("CLI_JWT_EXPIRATION_HOURS") - or os.getenv("LITELLM_CLI_JWT_EXPIRATION_HOURS") + os.getenv("CLI_JWT_EXPIRATION_HOURS") + or os.getenv("LITELLM_CLI_JWT_EXPIRATION_HOURS") or 24 ) @@ -1361,9 +1386,7 @@ MICROSOFT_USER_EMAIL_ATTRIBUTE = str( MICROSOFT_USER_DISPLAY_NAME_ATTRIBUTE = str( os.getenv("MICROSOFT_USER_DISPLAY_NAME_ATTRIBUTE", "displayName") ) -MICROSOFT_USER_ID_ATTRIBUTE = str( - os.getenv("MICROSOFT_USER_ID_ATTRIBUTE", "id") -) +MICROSOFT_USER_ID_ATTRIBUTE = str(os.getenv("MICROSOFT_USER_ID_ATTRIBUTE", "id")) MICROSOFT_USER_FIRST_NAME_ATTRIBUTE = str( os.getenv("MICROSOFT_USER_FIRST_NAME_ATTRIBUTE", "givenName") ) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 9ae95085f55..dd3f83713f8 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -359,7 +359,6 @@ class LiteLLMRoutes(enum.Enum): "/v1/vector_stores/{vector_store_id}/files/{file_id}/content", "/vector_store/list", "/v1/vector_store/list", - # search "/search", "/v1/search", @@ -986,6 +985,9 @@ class RegenerateKeyRequest(GenerateKeyRequest): spend: Optional[float] = None metadata: Optional[dict] = None new_master_key: Optional[str] = None + grace_period_hours: Optional[ + int + ] = None # Hours to keep old key valid; 0/None = immediate revoke class ResetSpendRequest(LiteLLMPydanticObjectBase): diff --git a/litellm/proxy/common_utils/key_rotation_manager.py b/litellm/proxy/common_utils/key_rotation_manager.py index 13bbf2272f7..7ef26bf07b9 100644 --- a/litellm/proxy/common_utils/key_rotation_manager.py +++ b/litellm/proxy/common_utils/key_rotation_manager.py @@ -8,7 +8,10 @@ from datetime import datetime, timezone from typing import List from litellm._logging import verbose_proxy_logger -from litellm.constants import LITELLM_INTERNAL_JOBS_SERVICE_ACCOUNT_NAME +from litellm.constants import ( + LITELLM_INTERNAL_JOBS_SERVICE_ACCOUNT_NAME, + LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS, +) from litellm.proxy._types import ( GenerateKeyResponse, LiteLLM_VerificationToken, @@ -37,6 +40,9 @@ class KeyRotationManager: try: verbose_proxy_logger.info("Starting scheduled key rotation check...") + # Clean up expired deprecated keys first + await self._cleanup_expired_deprecated_keys() + # Find keys that are due for rotation keys_to_rotate = await self._find_keys_needing_rotation() @@ -97,6 +103,24 @@ class KeyRotationManager: return keys_with_rotation + async def _cleanup_expired_deprecated_keys(self) -> None: + """ + Remove deprecated key entries whose revoke_at has passed. + """ + try: + now = datetime.now(timezone.utc) + result = await self.prisma_client.db.litellm_deprecatedverificationtoken.delete_many( + where={"revoke_at": {"lt": now}} + ) + if result.get("count", 0) > 0: + verbose_proxy_logger.debug( + "Cleaned up %s expired deprecated key(s)", result["count"] + ) + except Exception as e: + verbose_proxy_logger.debug( + "Deprecated key cleanup skipped (table may not exist): %s", e + ) + def _should_rotate_key(self, key: LiteLLM_VerificationToken, now: datetime) -> bool: """ Determine if a key should be rotated based on key_rotation_at timestamp. @@ -115,10 +139,11 @@ class KeyRotationManager: """ Rotate a single key using existing regenerate_key_fn and call the rotation hook """ - # Create regenerate request + # Create regenerate request with grace period for seamless cutover regenerate_request = RegenerateKeyRequest( key=key.token or "", key_alias=key.key_alias, # Pass key alias to ensure correct secret is updated in AWS Secrets Manager + grace_period_hours=LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS, ) # Create a system user for key rotation diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index d1840363009..dea1e55f7f9 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -12,6 +12,7 @@ All /key management endpoints import asyncio import copy import json +import os import secrets import traceback from datetime import datetime, timedelta, timezone @@ -518,7 +519,7 @@ async def _common_key_generation_helper( # noqa: PLR0915 ) # Handle special case where duration is "-1" (never expires) if value == "-1": - user_duration = float('inf') # Infinite duration + user_duration = float("inf") # Infinite duration else: user_duration = duration_in_seconds(duration=value) if user_duration > upperbound_duration: @@ -660,9 +661,9 @@ async def _common_key_generation_helper( # noqa: PLR0915 request_type="key", **data_json, table_name="key" ) - response["soft_budget"] = ( - data.soft_budget - ) # include the user-input soft budget in the response + response[ + "soft_budget" + ] = data.soft_budget # include the user-input soft budget in the response response = GenerateKeyResponse(**response) @@ -1083,12 +1084,16 @@ async def generate_key_fn( if data.max_budget is not None and data.max_budget < 0: raise HTTPException( status_code=400, - detail={"error": f"max_budget cannot be negative. Received: {data.max_budget}"} + detail={ + "error": f"max_budget cannot be negative. Received: {data.max_budget}" + }, ) if data.soft_budget is not None and data.soft_budget < 0: raise HTTPException( status_code=400, - detail={"error": f"soft_budget cannot be negative. Received: {data.soft_budget}"} + detail={ + "error": f"soft_budget cannot be negative. Received: {data.soft_budget}" + }, ) if user_custom_key_generate is not None: @@ -1336,6 +1341,7 @@ async def prepare_key_update_data( data_json: dict = data.model_dump(exclude_unset=True) data_json.pop("key", None) data_json.pop("new_key", None) + data_json.pop("grace_period_hours", None) # Request-only param, not a DB column if ( data.metadata is not None and data.metadata.get("service_account_id") is not None @@ -1399,8 +1405,13 @@ async def prepare_key_update_data( validate_model_max_budget(non_default_values["model_max_budget"]) # Serialize router_settings to JSON if present - if "router_settings" in non_default_values and non_default_values["router_settings"] is not None: - non_default_values["router_settings"] = safe_dumps(non_default_values["router_settings"]) + if ( + "router_settings" in non_default_values + and non_default_values["router_settings"] is not None + ): + non_default_values["router_settings"] = safe_dumps( + non_default_values["router_settings"] + ) non_default_values = prepare_metadata_fields( data=data, non_default_values=non_default_values, existing_metadata=_metadata @@ -1448,19 +1459,17 @@ def is_different_team( def _validate_max_budget(max_budget: Optional[float]) -> None: """ Validate that max_budget is not negative. - + Args: max_budget: The max_budget value to validate - + Raises: HTTPException: If max_budget is negative """ if max_budget is not None and max_budget < 0: raise HTTPException( status_code=400, - detail={ - "error": f"max_budget cannot be negative. Received: {max_budget}" - }, + detail={"error": f"max_budget cannot be negative. Received: {max_budget}"}, ) @@ -1469,14 +1478,14 @@ async def _get_and_validate_existing_key( ) -> LiteLLM_VerificationToken: """ Get existing key from database and validate it exists. - + Args: token: The key token to look up prisma_client: Prisma client instance - + Returns: LiteLLM_VerificationToken: The existing key row - + Raises: HTTPException: If key is not found """ @@ -1485,19 +1494,19 @@ async def _get_and_validate_existing_key( status_code=500, detail={"error": "Database not connected"}, ) - + existing_key_row = await prisma_client.get_data( token=token, table_name="key", query_type="find_unique", ) - + if existing_key_row is None: raise HTTPException( status_code=404, detail={"error": f"Key not found: {token}"}, ) - + return existing_key_row @@ -1512,10 +1521,10 @@ async def _process_single_key_update( ) -> Dict[str, Any]: """ Process a single key update with all validations and checks. - + This function encapsulates all the logic for updating a single key, including validation, permission checks, team checks, and database updates. - + Args: key_update_item: The key update request item user_api_key_dict: The authenticated user's API key info @@ -1524,22 +1533,22 @@ async def _process_single_key_update( user_api_key_cache: User API key cache proxy_logging_obj: Proxy logging object llm_router: LLM router instance - + Returns: Dict containing the updated key information - + Raises: HTTPException: For various validation and permission errors """ # Validate max_budget _validate_max_budget(key_update_item.max_budget) - + # Get and validate existing key existing_key_row = await _get_and_validate_existing_key( token=key_update_item.key, prisma_client=prisma_client, ) - + # Check team member permissions if prisma_client is not None: await TeamMemberPermissionChecks.can_team_member_execute_key_management_endpoint( @@ -1549,7 +1558,7 @@ async def _process_single_key_update( existing_key_row=existing_key_row, user_api_key_cache=user_api_key_cache, ) - + # Create UpdateKeyRequest from BulkUpdateKeyRequestItem update_key_request = UpdateKeyRequest( key=key_update_item.key, @@ -1558,7 +1567,7 @@ async def _process_single_key_update( team_id=key_update_item.team_id, tags=key_update_item.tags, ) - + # Get team object and check team limits if team_id is provided team_obj: Optional[LiteLLM_TeamTableCachedObj] = None if update_key_request.team_id is not None: @@ -1568,18 +1577,16 @@ async def _process_single_key_update( user_api_key_cache=user_api_key_cache, check_db_only=True, ) - + if team_obj is not None and prisma_client is not None: await _check_team_key_limits( team_table=team_obj, data=update_key_request, prisma_client=prisma_client, ) - + # Validate team change if team is being changed - if is_different_team( - data=update_key_request, existing_key_row=existing_key_row - ): + if is_different_team(data=update_key_request, existing_key_row=existing_key_row): if llm_router is None: raise HTTPException( status_code=400, @@ -1590,9 +1597,7 @@ async def _process_single_key_update( if team_obj is None: raise HTTPException( status_code=500, - detail={ - "error": "Team object not found for team change validation" - }, + detail={"error": "Team object not found for team change validation"}, ) validate_key_team_change( key=existing_key_row, @@ -1600,31 +1605,29 @@ async def _process_single_key_update( change_initiated_by=user_api_key_dict, llm_router=llm_router, ) - + # Prepare update data non_default_values = await prepare_key_update_data( data=update_key_request, existing_key_row=existing_key_row ) - + # Update key in database if prisma_client is None: raise HTTPException( status_code=500, detail={"error": "Database not connected"}, ) - + _data = {**non_default_values, "token": key_update_item.key} - response = await prisma_client.update_data( - token=key_update_item.key, data=_data - ) - + response = await prisma_client.update_data(token=key_update_item.key, data=_data) + # Delete cache await _delete_cache_key_object( hashed_token=hash_token(key_update_item.key), user_api_key_cache=user_api_key_cache, proxy_logging_obj=proxy_logging_obj, ) - + # Trigger async hook asyncio.create_task( KeyManagementEventHooks.async_key_updated_hook( @@ -1635,19 +1638,19 @@ async def _process_single_key_update( litellm_changed_by=litellm_changed_by, ) ) - + if response is None: raise ValueError("Failed to update key got response = None") - + # Extract and format updated key info updated_key_info = response.get("data", {}) if hasattr(updated_key_info, "model_dump"): updated_key_info = updated_key_info.model_dump() elif hasattr(updated_key_info, "dict"): updated_key_info = updated_key_info.dict() - + updated_key_info.pop("token", None) - + return updated_key_info @@ -1740,7 +1743,9 @@ async def update_key_fn( if data.max_budget is not None and data.max_budget < 0: raise HTTPException( status_code=400, - detail={"error": f"max_budget cannot be negative. Received: {data.max_budget}"} + detail={ + "error": f"max_budget cannot be negative. Received: {data.max_budget}" + }, ) data_json: dict = data.model_dump(exclude_unset=True, exclude_none=True) @@ -1959,13 +1964,11 @@ async def bulk_update_keys( proxy_logging_obj, user_api_key_cache, ) - + if user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN.value: raise HTTPException( status_code=403, - detail={ - "error": "Only proxy admins can perform bulk key updates" - }, + detail={"error": "Only proxy admins can perform bulk key updates"}, ) if prisma_client is None: @@ -2505,7 +2508,9 @@ async def generate_key_helper_fn( # noqa: PLR0915 aliases_json = json.dumps(aliases) config_json = json.dumps(config) permissions_json = json.dumps(permissions) - router_settings_json = safe_dumps(router_settings) if router_settings is not None else safe_dumps({}) + router_settings_json = ( + safe_dumps(router_settings) if router_settings is not None else safe_dumps({}) + ) # Add model_rpm_limit and model_tpm_limit to metadata if model_rpm_limit is not None: @@ -2672,10 +2677,12 @@ async def generate_key_helper_fn( # noqa: PLR0915 ) key_data["created_at"] = getattr(create_key_response, "created_at", None) key_data["updated_at"] = getattr(create_key_response, "updated_at", None) - + # Deserialize router_settings from JSON string to dict for response router_settings_value = key_data.get("router_settings") - if router_settings_value is not None and isinstance(router_settings_value, str): + if router_settings_value is not None and isinstance( + router_settings_value, str + ): try: key_data["router_settings"] = yaml.safe_load(router_settings_value) except yaml.YAMLError: @@ -2758,27 +2765,27 @@ async def can_modify_verification_token( ) -> bool: """ Check if user has permission to modify (delete/regenerate) a verification token. - + Rules: - Proxy admin can modify any key - For team keys: only team admin or key owner can modify - For personal keys: only key owner can modify - + Args: key_info: The verification token to check user_api_key_cache: Cache for user API keys user_api_key_dict: The user making the request prisma_client: Prisma client for database access - + Returns: True if user can modify the key, False otherwise """ is_team_key = _is_team_key(data=key_info) - + # 1. Proxy admin can modify any key if user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value: return True - + # 2. For team keys: only team admin or key owner can modify if is_team_key and key_info.team_id is not None: # Get team object to check if user is team admin @@ -2788,34 +2795,35 @@ async def can_modify_verification_token( user_api_key_cache=user_api_key_cache, check_db_only=True, ) - + if team_table is None: return False - + # Check if user is team admin if _is_user_team_admin( user_api_key_dict=user_api_key_dict, team_obj=team_table, ): return True - + # Check if the key belongs to the user (they own it) - if key_info.user_id is not None and key_info.user_id == user_api_key_dict.user_id: + if ( + key_info.user_id is not None + and key_info.user_id == user_api_key_dict.user_id + ): return True - + # Not team admin and doesn't own the key return False - + # 3. For personal keys: only key owner can modify if key_info.user_id is not None and key_info.user_id == user_api_key_dict.user_id: return True - + # Default: deny return False - - async def delete_verification_tokens( tokens: List, user_api_key_cache: DualCache, @@ -2845,10 +2853,10 @@ async def delete_verification_tokens( try: if prisma_client: tokens = [_hash_token_if_needed(token=key) for key in tokens] - _keys_being_deleted: List[LiteLLM_VerificationToken] = ( - await prisma_client.db.litellm_verificationtoken.find_many( - where={"token": {"in": tokens}} - ) + _keys_being_deleted: List[ + LiteLLM_VerificationToken + ] = await prisma_client.db.litellm_verificationtoken.find_many( + where={"token": {"in": tokens}} ) if len(_keys_being_deleted) == 0: @@ -2948,11 +2956,24 @@ def _transform_verification_tokens_to_deleted_records( if org_id_value is not None: record["organization_id"] = org_id_value - for json_field in ["aliases", "config", "permissions", "metadata", "model_spend", "model_max_budget", "router_settings"]: + for json_field in [ + "aliases", + "config", + "permissions", + "metadata", + "model_spend", + "model_max_budget", + "router_settings", + ]: if json_field in record and record[json_field] is not None: record[json_field] = json.dumps(record[json_field]) - for rel_key in ("litellm_budget_table", "litellm_organization_table", "object_permission", "id"): + for rel_key in ( + "litellm_budget_table", + "litellm_organization_table", + "object_permission", + "id", + ): record.pop(rel_key, None) records.append(record) @@ -2967,9 +2988,7 @@ async def _save_deleted_verification_token_records( """Save deleted verification token records to the database.""" if not records: return - await prisma_client.db.litellm_deletedverificationtoken.create_many( - data=records - ) + await prisma_client.db.litellm_deletedverificationtoken.create_many(data=records) async def _persist_deleted_verification_tokens( @@ -3032,9 +3051,9 @@ async def _rotate_master_key( from litellm.proxy.proxy_server import proxy_config try: - models: Optional[List] = ( - await prisma_client.db.litellm_proxymodeltable.find_many() - ) + models: Optional[ + List + ] = await prisma_client.db.litellm_proxymodeltable.find_many() except Exception: models = None # 2. process model table @@ -3111,7 +3130,9 @@ async def _rotate_master_key( updated_patch=decrypted_cred, new_encryption_key=new_master_key, ) - credential_object_jsonified = jsonify_object(encrypted_cred.model_dump()) + credential_object_jsonified = jsonify_object( + encrypted_cred.model_dump() + ) await prisma_client.db.litellm_credentialstable.update( where={"credential_name": cred.credential_name}, data={ @@ -3156,7 +3177,7 @@ def get_new_token(data: Optional[RegenerateKeyRequest]) -> str: dependencies=[Depends(user_api_key_auth)], ) @management_endpoint_wrapper -async def regenerate_key_fn( +async def regenerate_key_fn( # noqa: PLR0915 key: Optional[str] = None, data: Optional[RegenerateKeyRequest] = None, user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), @@ -3195,6 +3216,7 @@ async def regenerate_key_fn( - permissions: Optional[dict] - Key-specific permissions - guardrails: Optional[List[str]] - List of active guardrails for the key - blocked: Optional[bool] - Whether the key is blocked + - grace_period_hours: Optional[int] - Hours to keep old key valid after rotation (e.g. 24, 48, 72). 0 or omitted = immediate revoke. Env: LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS Returns: @@ -3330,6 +3352,37 @@ async def regenerate_key_fn( update_data.update(non_default_values) update_data = prisma_client.jsonify_object(data=update_data) + + # If grace period > 0, insert deprecated key so old key remains valid + if data is not None and data.grace_period_hours is not None: + grace_period_hours = data.grace_period_hours + else: + grace_period_hours = int( + os.getenv("LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS", "0") + ) + if grace_period_hours > 0: + try: + revoke_at = datetime.now(timezone.utc) + timedelta( + hours=grace_period_hours + ) + await prisma_client.db.litellm_deprecatedverificationtoken.create( + data={ + "token": hashed_api_key, + "active_token_id": new_token_hash, + "revoke_at": revoke_at, + } + ) + verbose_proxy_logger.debug( + "Deprecated key retained for %s hours (revoke_at: %s)", + grace_period_hours, + revoke_at, + ) + except Exception as deprecated_err: + verbose_proxy_logger.warning( + "Failed to insert deprecated key for grace period: %s", + deprecated_err, + ) + # Update the token in the database updated_token = await prisma_client.db.litellm_verificationtoken.update( where={"token": hashed_api_key}, @@ -3423,7 +3476,9 @@ def _validate_reset_spend_value( if reset_to > current_spend: raise HTTPException( status_code=status.HTTP_400_BAD_REQUEST, - detail={"error": f"reset_to ({reset_to}) must be <= current spend ({current_spend})"}, + detail={ + "error": f"reset_to ({reset_to}) must be <= current spend ({current_spend})" + }, ) max_budget = key_in_db.max_budget @@ -3549,11 +3604,11 @@ async def validate_key_list_check( param="user_id", code=status.HTTP_403_FORBIDDEN, ) - complete_user_info_db_obj: Optional[BaseModel] = ( - await prisma_client.db.litellm_usertable.find_unique( - where={"user_id": user_api_key_dict.user_id}, - include={"organization_memberships": True}, - ) + complete_user_info_db_obj: Optional[ + BaseModel + ] = await prisma_client.db.litellm_usertable.find_unique( + where={"user_id": user_api_key_dict.user_id}, + include={"organization_memberships": True}, ) if complete_user_info_db_obj is None: @@ -3639,10 +3694,10 @@ async def get_admin_team_ids( if complete_user_info is None: return [] # Get all teams that user is an admin of - teams: Optional[List[BaseModel]] = ( - await prisma_client.db.litellm_teamtable.find_many( - where={"team_id": {"in": complete_user_info.teams}} - ) + teams: Optional[ + List[BaseModel] + ] = await prisma_client.db.litellm_teamtable.find_many( + where={"team_id": {"in": complete_user_info.teams}} ) if teams is None: return [] @@ -3687,8 +3742,12 @@ async def list_keys( description="Column to sort by (e.g. 'user_id', 'created_at', 'spend')", ), sort_order: str = Query(default="desc", description="Sort order ('asc' or 'desc')"), - expand: Optional[List[str]] = Query(None, description="Expand related objects (e.g. 'user')"), - status: Optional[str] = Query(None, description="Filter by status (e.g. 'deleted')"), + expand: Optional[List[str]] = Query( + None, description="Expand related objects (e.g. 'user')" + ), + status: Optional[str] = Query( + None, description="Filter by status (e.g. 'deleted')" + ), ) -> KeyListResponseObject: """ List all keys for a given user / team / organization. @@ -3780,7 +3839,9 @@ async def list_keys( message=getattr(e, "detail", f"error({str(e)})"), type=ProxyErrorTypes.internal_server_error, param=getattr(e, "param", "None"), - code=getattr(e, "status_code", fastapi.status.HTTP_500_INTERNAL_SERVER_ERROR), + code=getattr( + e, "status_code", fastapi.status.HTTP_500_INTERNAL_SERVER_ERROR + ), ) elif isinstance(e, ProxyException): raise e diff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prisma index 3b81da10923..8992f4d8df6 100644 --- a/litellm/proxy/schema.prisma +++ b/litellm/proxy/schema.prisma @@ -317,6 +317,19 @@ model LiteLLM_VerificationToken { @@index([budget_reset_at, expires]) } +// Deprecated keys during grace period - allows old key to work until revoke_at +model LiteLLM_DeprecatedVerificationToken { + id String @id @default(uuid()) + token String // Hashed old key + active_token_id String // Current token hash in LiteLLM_VerificationToken + revoke_at DateTime // When the old key stops working + created_at DateTime @default(now()) @map("created_at") + + @@unique([token]) + @@index([token, revoke_at]) + @@index([revoke_at]) +} + // Audit table for deleted keys - preserves spend and key information for historical tracking model LiteLLM_DeletedVerificationToken { id String @id @default(uuid()) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 6bbf0df74de..c9b07ce447d 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -2644,6 +2644,71 @@ class PrismaClient: sql_query ) + # If not found in main table, check deprecated keys (grace period) + if response is None: + try: + deprecated_sql = f""" + SELECT active_token_id FROM "LiteLLM_DeprecatedVerificationToken" + WHERE token = '{hashed_token}' AND revoke_at > NOW() + LIMIT 1 + """ + deprecated_row = ( + await self._query_first_with_cached_plan_fallback( + deprecated_sql + ) + ) + if deprecated_row and deprecated_row.get("active_token_id"): + active_token_id = deprecated_row["active_token_id"] + sql_query_active = f""" + SELECT + v.*, + t.spend AS team_spend, + t.max_budget AS team_max_budget, + t.tpm_limit AS team_tpm_limit, + t.rpm_limit AS team_rpm_limit, + t.models AS team_models, + t.metadata AS team_metadata, + t.blocked AS team_blocked, + t.team_alias AS team_alias, + t.metadata AS team_metadata, + t.members_with_roles AS team_members_with_roles, + t.object_permission_id AS team_object_permission_id, + t.organization_id as org_id, + tm.spend AS team_member_spend, + m.aliases AS team_model_aliases, + b.max_budget AS litellm_budget_table_max_budget, + b.tpm_limit AS litellm_budget_table_tpm_limit, + b.rpm_limit AS litellm_budget_table_rpm_limit, + b.model_max_budget as litellm_budget_table_model_max_budget, + b.soft_budget as litellm_budget_table_soft_budget, + o.metadata as organization_metadata, + b2.max_budget as organization_max_budget, + b2.tpm_limit as organization_tpm_limit, + b2.rpm_limit as organization_rpm_limit + FROM "LiteLLM_VerificationToken" AS v + LEFT JOIN "LiteLLM_TeamTable" AS t ON v.team_id = t.team_id + LEFT JOIN "LiteLLM_TeamMembership" AS tm ON v.team_id = tm.team_id AND tm.user_id = v.user_id + LEFT JOIN "LiteLLM_ModelTable" m ON t.model_id = m.id + LEFT JOIN "LiteLLM_BudgetTable" AS b ON v.budget_id = b.budget_id + LEFT JOIN "LiteLLM_OrganizationTable" AS o ON v.organization_id = o.organization_id + LEFT JOIN "LiteLLM_BudgetTable" AS b2 ON o.budget_id = b2.budget_id + WHERE v.token = '{active_token_id}' + """ + response = ( + await self._query_first_with_cached_plan_fallback( + sql_query_active + ) + ) + if response is not None: + verbose_proxy_logger.debug( + "Deprecated key used during grace period" + ) + except Exception as deprecated_lookup_error: + verbose_proxy_logger.debug( + "Deprecated key lookup skipped: %s", + deprecated_lookup_error, + ) + if response is not None: if response["team_models"] is None: response["team_models"] = [] diff --git a/schema.prisma b/schema.prisma index 3b81da10923..8992f4d8df6 100644 --- a/schema.prisma +++ b/schema.prisma @@ -317,6 +317,19 @@ model LiteLLM_VerificationToken { @@index([budget_reset_at, expires]) } +// Deprecated keys during grace period - allows old key to work until revoke_at +model LiteLLM_DeprecatedVerificationToken { + id String @id @default(uuid()) + token String // Hashed old key + active_token_id String // Current token hash in LiteLLM_VerificationToken + revoke_at DateTime // When the old key stops working + created_at DateTime @default(now()) @map("created_at") + + @@unique([token]) + @@index([token, revoke_at]) + @@index([revoke_at]) +} + // Audit table for deleted keys - preserves spend and key information for historical tracking model LiteLLM_DeletedVerificationToken { id String @id @default(uuid()) diff --git a/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py b/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py index 6b3b4c92416..1f5fab71ef3 100644 --- a/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py +++ b/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py @@ -4,7 +4,7 @@ Test key rotation manager functionality import os import sys from datetime import datetime, timedelta, timezone -from unittest.mock import AsyncMock, MagicMock +from unittest.mock import AsyncMock import pytest @@ -24,7 +24,7 @@ class TestKeyRotationManager: async def test_should_rotate_key_logic(self): """ Test the core logic for determining when a key should be rotated. - + This tests: - Keys with null key_rotation_at should rotate immediately - Keys with future key_rotation_at should not rotate @@ -33,69 +33,69 @@ class TestKeyRotationManager: # Setup mock_prisma_client = AsyncMock() manager = KeyRotationManager(mock_prisma_client) - + now = datetime.now(timezone.utc) - + # Test Case 1: No rotation time set (key_rotation_at = None) - should rotate key_no_rotation_time = LiteLLM_VerificationToken( token="test-token-1", auto_rotate=True, rotation_interval="30s", key_rotation_at=None, - rotation_count=0 + rotation_count=0, ) - - assert manager._should_rotate_key(key_no_rotation_time, now) == True - + + assert manager._should_rotate_key(key_no_rotation_time, now) is True + # Test Case 2: Future rotation time - should NOT rotate key_future_rotation = LiteLLM_VerificationToken( token="test-token-2", auto_rotate=True, rotation_interval="30s", key_rotation_at=now + timedelta(seconds=10), - rotation_count=1 + rotation_count=1, ) - - assert manager._should_rotate_key(key_future_rotation, now) == False - + + assert manager._should_rotate_key(key_future_rotation, now) is False + # Test Case 3: Past rotation time - should rotate key_past_rotation = LiteLLM_VerificationToken( token="test-token-3", auto_rotate=True, rotation_interval="30s", key_rotation_at=now - timedelta(seconds=10), - rotation_count=2 + rotation_count=2, ) - - assert manager._should_rotate_key(key_past_rotation, now) == True - + + assert manager._should_rotate_key(key_past_rotation, now) is True + # Test Case 4: Exact rotation time - should rotate key_exact_rotation = LiteLLM_VerificationToken( token="test-token-4", auto_rotate=True, rotation_interval="30s", key_rotation_at=now, - rotation_count=1 + rotation_count=1, ) - - assert manager._should_rotate_key(key_exact_rotation, now) == True - + + assert manager._should_rotate_key(key_exact_rotation, now) is True + # Test Case 5: No rotation interval - should NOT rotate key_no_interval = LiteLLM_VerificationToken( token="test-token-5", auto_rotate=True, rotation_interval=None, key_rotation_at=None, - rotation_count=0 + rotation_count=0, ) - - assert manager._should_rotate_key(key_no_interval, now) == False + + assert manager._should_rotate_key(key_no_interval, now) is False @pytest.mark.asyncio async def test_find_keys_needing_rotation(self): """ Test finding keys that need rotation from database. - + This tests: - Only keys with auto_rotate=True are considered - Database query filters by key_rotation_at properly @@ -104,10 +104,10 @@ class TestKeyRotationManager: # Setup mock_prisma_client = AsyncMock() manager = KeyRotationManager(mock_prisma_client) - + # Use a fixed timestamp to avoid timing issues in tests now = datetime(2024, 1, 1, 12, 0, 0, tzinfo=timezone.utc) - + # Mock database response - these are the keys the database query would return mock_keys = [ LiteLLM_VerificationToken( @@ -115,42 +115,47 @@ class TestKeyRotationManager: auto_rotate=True, rotation_interval="30s", key_rotation_at=None, # Should rotate (null key_rotation_at) - rotation_count=0 + rotation_count=0, ), LiteLLM_VerificationToken( token="token-2", auto_rotate=True, rotation_interval="60s", - key_rotation_at=now - timedelta(seconds=10), # Should rotate (past time) - rotation_count=1 - ) + key_rotation_at=now + - timedelta(seconds=10), # Should rotate (past time) + rotation_count=1, + ), ] - - mock_prisma_client.db.litellm_verificationtoken.find_many.return_value = mock_keys - + + mock_prisma_client.db.litellm_verificationtoken.find_many.return_value = ( + mock_keys + ) + # Mock datetime.now to return our fixed timestamp from unittest.mock import patch - with patch('litellm.proxy.common_utils.key_rotation_manager.datetime') as mock_datetime: + + with patch( + "litellm.proxy.common_utils.key_rotation_manager.datetime" + ) as mock_datetime: mock_datetime.now.return_value = now - mock_datetime.side_effect = lambda *args, **kwargs: datetime(*args, **kwargs) - + mock_datetime.side_effect = lambda *args, **kwargs: datetime( + *args, **kwargs + ) + # Execute keys_needing_rotation = await manager._find_keys_needing_rotation() - + # Verify database query - should use OR condition for key_rotation_at mock_prisma_client.db.litellm_verificationtoken.find_many.assert_called_once_with( where={ "auto_rotate": True, - "OR": [ - {"key_rotation_at": None}, - {"key_rotation_at": {"lte": now}} - ] + "OR": [{"key_rotation_at": None}, {"key_rotation_at": {"lte": now}}], } ) - + # Verify all keys returned by database query are included (no additional filtering) assert len(keys_needing_rotation) == 2 - + tokens_needing_rotation = [key.token for key in keys_needing_rotation] assert "token-1" in tokens_needing_rotation # Null key_rotation_at assert "token-2" in tokens_needing_rotation # Past key_rotation_at @@ -159,7 +164,7 @@ class TestKeyRotationManager: async def test_rotate_key_updates_database(self): """ Test that key rotation properly updates the database with new rotation info. - + This tests: - Rotation count is incremented - last_rotation_at is set to current time @@ -169,7 +174,7 @@ class TestKeyRotationManager: # Setup mock_prisma_client = AsyncMock() manager = KeyRotationManager(mock_prisma_client) - + # Mock key to rotate key_to_rotate = LiteLLM_VerificationToken( token="old-token", @@ -177,31 +182,35 @@ class TestKeyRotationManager: rotation_interval="30s", last_rotation_at=None, key_rotation_at=None, - rotation_count=0 + rotation_count=0, ) - + # Mock regenerate_key_fn response mock_response = GenerateKeyResponse( - key="new-api-key", - token_id="new-token-id", - user_id="test-user" + key="new-api-key", token_id="new-token-id", user_id="test-user" ) - + # Mock the regenerate function from unittest.mock import patch - with patch('litellm.proxy.common_utils.key_rotation_manager.regenerate_key_fn', return_value=mock_response): - with patch('litellm.proxy.common_utils.key_rotation_manager.KeyManagementEventHooks.async_key_rotated_hook'): + + with patch( + "litellm.proxy.common_utils.key_rotation_manager.regenerate_key_fn", + return_value=mock_response, + ): + with patch( + "litellm.proxy.common_utils.key_rotation_manager.KeyManagementEventHooks.async_key_rotated_hook" + ): # Execute await manager._rotate_key(key_to_rotate) - + # Verify database update was called with correct data mock_prisma_client.db.litellm_verificationtoken.update.assert_called_once() - + call_args = mock_prisma_client.db.litellm_verificationtoken.update.call_args - + # Check the WHERE clause targets the new token assert call_args[1]["where"]["token"] == "new-token-id" - + # Check the data being updated update_data = call_args[1]["data"] assert update_data["rotation_count"] == 1 # Incremented from 0 @@ -209,9 +218,75 @@ class TestKeyRotationManager: assert isinstance(update_data["last_rotation_at"], datetime) assert "key_rotation_at" in update_data assert isinstance(update_data["key_rotation_at"], datetime) - + # Verify key_rotation_at is set to future time (30s from now) now = datetime.now(timezone.utc) next_rotation = update_data["key_rotation_at"] time_diff = (next_rotation - now).total_seconds() - assert 25 <= time_diff <= 35 # Should be around 30 seconds, allow some tolerance + assert ( + 25 <= time_diff <= 35 + ) # Should be around 30 seconds, allow some tolerance + + @pytest.mark.asyncio + async def test_cleanup_expired_deprecated_keys(self): + """ + Test that _cleanup_expired_deprecated_keys deletes expired deprecated keys. + """ + mock_prisma_client = AsyncMock() + mock_prisma_client.db.litellm_deprecatedverificationtoken.delete_many.return_value = { + "count": 3 + } + manager = KeyRotationManager(mock_prisma_client) + + await manager._cleanup_expired_deprecated_keys() + + mock_prisma_client.db.litellm_deprecatedverificationtoken.delete_many.assert_called_once() + call_args = ( + mock_prisma_client.db.litellm_deprecatedverificationtoken.delete_many.call_args + ) + assert "revoke_at" in call_args[1]["where"] + assert call_args[1]["where"]["revoke_at"]["lt"] is not None + + @pytest.mark.asyncio + async def test_rotate_key_passes_grace_period_hours(self): + """ + Test that _rotate_key passes grace_period_hours in RegenerateKeyRequest. + """ + mock_prisma_client = AsyncMock() + manager = KeyRotationManager(mock_prisma_client) + + key_to_rotate = LiteLLM_VerificationToken( + token="old-token", + auto_rotate=True, + rotation_interval="30s", + key_rotation_at=None, + rotation_count=0, + ) + + mock_response = GenerateKeyResponse( + key="new-api-key", + token_id="new-token-id", + user_id="test-user", + ) + + from unittest.mock import patch + + with patch( + "litellm.proxy.common_utils.key_rotation_manager.regenerate_key_fn", + new_callable=AsyncMock, + ) as mock_regenerate: + mock_regenerate.return_value = mock_response + with patch( + "litellm.proxy.common_utils.key_rotation_manager.KeyManagementEventHooks.async_key_rotated_hook", + new_callable=AsyncMock, + ): + with patch( + "litellm.proxy.common_utils.key_rotation_manager.LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS", + 48, + ): + await manager._rotate_key(key_to_rotate) + + mock_regenerate.assert_called_once() + call_args = mock_regenerate.call_args + regenerate_request = call_args[1]["data"] + assert regenerate_request.grace_period_hours == 48 diff --git a/ui/litellm-dashboard/src/components/organisms/regenerate_key_modal.tsx b/ui/litellm-dashboard/src/components/organisms/regenerate_key_modal.tsx index a4339e11920..3cea198c62a 100644 --- a/ui/litellm-dashboard/src/components/organisms/regenerate_key_modal.tsx +++ b/ui/litellm-dashboard/src/components/organisms/regenerate_key_modal.tsx @@ -37,6 +37,7 @@ export function RegenerateKeyModal({ selectedToken, visible, onClose, onKeyUpdat tpm_limit: selectedToken.tpm_limit, rpm_limit: selectedToken.rpm_limit, duration: selectedToken.duration || "", + grace_period_hours: 0, }); // Initialize the current access token @@ -223,6 +224,17 @@ export function RegenerateKeyModal({ selectedToken, visible, onClose, onKeyUpdat Current expiry: {selectedToken?.expires ? new Date(selectedToken.expires).toLocaleString() : "Never"} {newExpiryTime &&
New expiry: {newExpiryTime}
} + + + +
+ Recommended: 24-72 hours for production keys to allow seamless client migration. +
)} From 65401138b5856c095b83cb7f0011cdfc352d30a4 Mon Sep 17 00:00:00 2001 From: Harshit Jain Date: Tue, 3 Feb 2026 10:49:49 +0530 Subject: [PATCH 004/182] fix: refactor, race condition handle, fstring sql injection --- .../key_management_endpoints.py | 19 ++++-- litellm/proxy/utils.py | 65 ++++--------------- 2 files changed, 28 insertions(+), 56 deletions(-) diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index dea1e55f7f9..55f96e4189c 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -3365,12 +3365,21 @@ async def regenerate_key_fn( # noqa: PLR0915 revoke_at = datetime.now(timezone.utc) + timedelta( hours=grace_period_hours ) - await prisma_client.db.litellm_deprecatedverificationtoken.create( + # Use upsert to handle concurrent rotations gracefully; avoids + # unique constraint violation if same key is rotated simultaneously + await prisma_client.db.litellm_deprecatedverificationtoken.upsert( + where={"token": hashed_api_key}, data={ - "token": hashed_api_key, - "active_token_id": new_token_hash, - "revoke_at": revoke_at, - } + "create": { + "token": hashed_api_key, + "active_token_id": new_token_hash, + "revoke_at": revoke_at, + }, + "update": { + "active_token_id": new_token_hash, + "revoke_at": revoke_at, + }, + }, ) verbose_proxy_logger.debug( "Deprecated key retained for %s hours (revoke_at: %s)", diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index c9b07ce447d..5cc5507dd09 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -7,7 +7,7 @@ import smtplib import threading import time import traceback -from datetime import date, datetime, timedelta +from datetime import date, datetime, timedelta, timezone from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from typing import ( @@ -2647,57 +2647,20 @@ class PrismaClient: # If not found in main table, check deprecated keys (grace period) if response is None: try: - deprecated_sql = f""" - SELECT active_token_id FROM "LiteLLM_DeprecatedVerificationToken" - WHERE token = '{hashed_token}' AND revoke_at > NOW() - LIMIT 1 - """ - deprecated_row = ( - await self._query_first_with_cached_plan_fallback( - deprecated_sql - ) + deprecated_row = await self.db.litellm_deprecatedverificationtoken.find_first( + where={ + "token": hashed_token, + "revoke_at": {"gt": datetime.now(timezone.utc)}, + }, + select={"active_token_id": True}, ) - if deprecated_row and deprecated_row.get("active_token_id"): - active_token_id = deprecated_row["active_token_id"] - sql_query_active = f""" - SELECT - v.*, - t.spend AS team_spend, - t.max_budget AS team_max_budget, - t.tpm_limit AS team_tpm_limit, - t.rpm_limit AS team_rpm_limit, - t.models AS team_models, - t.metadata AS team_metadata, - t.blocked AS team_blocked, - t.team_alias AS team_alias, - t.metadata AS team_metadata, - t.members_with_roles AS team_members_with_roles, - t.object_permission_id AS team_object_permission_id, - t.organization_id as org_id, - tm.spend AS team_member_spend, - m.aliases AS team_model_aliases, - b.max_budget AS litellm_budget_table_max_budget, - b.tpm_limit AS litellm_budget_table_tpm_limit, - b.rpm_limit AS litellm_budget_table_rpm_limit, - b.model_max_budget as litellm_budget_table_model_max_budget, - b.soft_budget as litellm_budget_table_soft_budget, - o.metadata as organization_metadata, - b2.max_budget as organization_max_budget, - b2.tpm_limit as organization_tpm_limit, - b2.rpm_limit as organization_rpm_limit - FROM "LiteLLM_VerificationToken" AS v - LEFT JOIN "LiteLLM_TeamTable" AS t ON v.team_id = t.team_id - LEFT JOIN "LiteLLM_TeamMembership" AS tm ON v.team_id = tm.team_id AND tm.user_id = v.user_id - LEFT JOIN "LiteLLM_ModelTable" m ON t.model_id = m.id - LEFT JOIN "LiteLLM_BudgetTable" AS b ON v.budget_id = b.budget_id - LEFT JOIN "LiteLLM_OrganizationTable" AS o ON v.organization_id = o.organization_id - LEFT JOIN "LiteLLM_BudgetTable" AS b2 ON o.budget_id = b2.budget_id - WHERE v.token = '{active_token_id}' - """ - response = ( - await self._query_first_with_cached_plan_fallback( - sql_query_active - ) + if deprecated_row and deprecated_row.active_token_id: + response = await self.get_data( + token=deprecated_row.active_token_id, + table_name="combined_view", + query_type="find_unique", + parent_otel_span=parent_otel_span, + proxy_logging_obj=proxy_logging_obj, ) if response is not None: verbose_proxy_logger.debug( From fef5c5fd3ef3c6dc5376749fac226df59de55a87 Mon Sep 17 00:00:00 2001 From: shivam Date: Sat, 7 Feb 2026 17:08:01 -0800 Subject: [PATCH 005/182] fix: preserve key alias and team_id after key regeneration, deletion --- .../common_daily_activity.py | 35 ++- .../key_management_endpoints.py | 16 +- .../test_common_daily_activity.py | 254 ++++++++++++++++++ 3 files changed, 301 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/management_endpoints/common_daily_activity.py b/litellm/proxy/management_endpoints/common_daily_activity.py index 99a732f9efb..79d80abf272 100644 --- a/litellm/proxy/management_endpoints/common_daily_activity.py +++ b/litellm/proxy/management_endpoints/common_daily_activity.py @@ -327,14 +327,43 @@ async def get_api_key_metadata( prisma_client: PrismaClient, api_keys: Set[str], ) -> Dict[str, Dict[str, Any]]: - """Update api key metadata for a single record.""" + """Get api key metadata, falling back to deleted keys table for keys not found in active table. + + This ensures that key_alias and team_id are preserved in historical activity logs + even after a key is deleted or regenerated. + """ key_records = await prisma_client.db.litellm_verificationtoken.find_many( where={"token": {"in": list(api_keys)}} ) - return { - k.token: {"key_alias": k.key_alias, "team_id": k.team_id} for k in key_records + result = { + k.token: {"key_alias": k.key_alias, "team_id": k.team_id} + for k in key_records } + # For any keys not found in the active table, check the deleted keys table + missing_keys = api_keys - set(result.keys()) + if missing_keys: + try: + deleted_key_records = ( + await prisma_client.db.litellm_deletedverificationtoken.find_many( + where={"token": {"in": list(missing_keys)}}, + order={"deleted_at": "desc"}, + ) + ) + # Use the most recent deleted record for each token (ordered by deleted_at desc) + for k in deleted_key_records: + if k.token not in result: + result[k.token] = { + "key_alias": k.key_alias, + "team_id": k.team_id, + } + except Exception: + verbose_proxy_logger.debug( + "Failed to fetch deleted key metadata for missing keys" + ) + + return result + def _adjust_dates_for_timezone( start_date: str, diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index 2eb6cf65281..264dff5aa54 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -3313,6 +3313,20 @@ async def regenerate_key_fn( verbose_proxy_logger.debug("key_in_db: %s", _key_in_db) + # Save the old key record to deleted table before regeneration + # This preserves key_alias and team_id metadata for historical spend records + try: + await _persist_deleted_verification_tokens( + keys=[_key_in_db], + prisma_client=prisma_client, + user_api_key_dict=user_api_key_dict, + litellm_changed_by=litellm_changed_by, + ) + except Exception: + verbose_proxy_logger.debug( + "Failed to persist old key record to deleted table during regeneration" + ) + new_token = get_new_token(data=data) new_token_hash = hash_token(new_token) @@ -3749,7 +3763,7 @@ async def list_keys( else: admin_team_ids = None - if not user_id and user_api_key_dict.user_role not in [ + if user_id is None and user_api_key_dict.user_role not in [ LitellmUserRoles.PROXY_ADMIN.value, LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY.value, ]: diff --git a/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py b/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py index 93457631d2d..48869803b20 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py +++ b/tests/test_litellm/proxy/management_endpoints/test_common_daily_activity.py @@ -11,6 +11,7 @@ sys.path.insert( from litellm.proxy.management_endpoints.common_daily_activity import ( _is_user_agent_tag, compute_tag_metadata_totals, + get_api_key_metadata, get_daily_activity, get_daily_activity_aggregated, ) @@ -208,3 +209,256 @@ async def test_get_daily_activity_aggregated_with_endpoint_breakdown(): assert chat_endpoint.api_key_breakdown["key-1"].metrics.spend == 15.0 assert "key-2" in embeddings_endpoint.api_key_breakdown assert embeddings_endpoint.api_key_breakdown["key-2"].metrics.spend == 3.0 + + +@pytest.mark.asyncio +async def test_get_api_key_metadata_returns_active_key_metadata(): + """Test that get_api_key_metadata should return metadata for active keys.""" + mock_prisma = MagicMock() + + # Mock active key record + mock_active_key = MagicMock() + mock_active_key.token = "active-key-hash-123" + mock_active_key.key_alias = "my-active-key" + mock_active_key.team_id = "team-abc" + + mock_prisma.db.litellm_verificationtoken.find_many = AsyncMock( + return_value=[mock_active_key] + ) + + result = await get_api_key_metadata( + prisma_client=mock_prisma, + api_keys={"active-key-hash-123"}, + ) + + assert "active-key-hash-123" in result + assert result["active-key-hash-123"]["key_alias"] == "my-active-key" + assert result["active-key-hash-123"]["team_id"] == "team-abc" + + +@pytest.mark.asyncio +async def test_get_api_key_metadata_falls_back_to_deleted_keys(): + """Test that get_api_key_metadata should fall back to deleted keys table for missing keys.""" + mock_prisma = MagicMock() + + # No active keys found + mock_prisma.db.litellm_verificationtoken.find_many = AsyncMock(return_value=[]) + + # Deleted key record exists + mock_deleted_key = MagicMock() + mock_deleted_key.token = "deleted-key-hash-456" + mock_deleted_key.key_alias = "toto-test-2" + mock_deleted_key.team_id = "team-xyz" + + mock_prisma.db.litellm_deletedverificationtoken.find_many = AsyncMock( + return_value=[mock_deleted_key] + ) + + result = await get_api_key_metadata( + prisma_client=mock_prisma, + api_keys={"deleted-key-hash-456"}, + ) + + assert "deleted-key-hash-456" in result + assert result["deleted-key-hash-456"]["key_alias"] == "toto-test-2" + assert result["deleted-key-hash-456"]["team_id"] == "team-xyz" + + # Verify deleted table was queried with the missing key + mock_prisma.db.litellm_deletedverificationtoken.find_many.assert_called_once_with( + where={"token": {"in": ["deleted-key-hash-456"]}}, + order={"deleted_at": "desc"}, + ) + + +@pytest.mark.asyncio +async def test_get_api_key_metadata_mixed_active_and_deleted_keys(): + """Test that get_api_key_metadata should return metadata for both active and deleted keys.""" + mock_prisma = MagicMock() + + # One active key found + mock_active_key = MagicMock() + mock_active_key.token = "active-key-hash" + mock_active_key.key_alias = "active-alias" + mock_active_key.team_id = "team-active" + + mock_prisma.db.litellm_verificationtoken.find_many = AsyncMock( + return_value=[mock_active_key] + ) + + # One deleted key found + mock_deleted_key = MagicMock() + mock_deleted_key.token = "deleted-key-hash" + mock_deleted_key.key_alias = "deleted-alias" + mock_deleted_key.team_id = "team-deleted" + + mock_prisma.db.litellm_deletedverificationtoken.find_many = AsyncMock( + return_value=[mock_deleted_key] + ) + + result = await get_api_key_metadata( + prisma_client=mock_prisma, + api_keys={"active-key-hash", "deleted-key-hash"}, + ) + + # Both keys should have metadata + assert len(result) == 2 + assert result["active-key-hash"]["key_alias"] == "active-alias" + assert result["active-key-hash"]["team_id"] == "team-active" + assert result["deleted-key-hash"]["key_alias"] == "deleted-alias" + assert result["deleted-key-hash"]["team_id"] == "team-deleted" + + +@pytest.mark.asyncio +async def test_get_api_key_metadata_deleted_table_not_queried_when_all_keys_found(): + """Test that get_api_key_metadata should not query deleted table when all keys are active.""" + mock_prisma = MagicMock() + + mock_active_key = MagicMock() + mock_active_key.token = "key-hash-1" + mock_active_key.key_alias = "alias-1" + mock_active_key.team_id = "team-1" + + mock_prisma.db.litellm_verificationtoken.find_many = AsyncMock( + return_value=[mock_active_key] + ) + mock_prisma.db.litellm_deletedverificationtoken = MagicMock() + mock_prisma.db.litellm_deletedverificationtoken.find_many = AsyncMock( + return_value=[] + ) + + result = await get_api_key_metadata( + prisma_client=mock_prisma, + api_keys={"key-hash-1"}, + ) + + assert len(result) == 1 + assert result["key-hash-1"]["key_alias"] == "alias-1" + # Deleted table should NOT have been queried + mock_prisma.db.litellm_deletedverificationtoken.find_many.assert_not_called() + + +@pytest.mark.asyncio +async def test_get_api_key_metadata_deleted_table_error_handled_gracefully(): + """Test that get_api_key_metadata should handle errors from deleted table gracefully.""" + mock_prisma = MagicMock() + + # No active keys found + mock_prisma.db.litellm_verificationtoken.find_many = AsyncMock(return_value=[]) + + # Deleted table raises an error (e.g., table doesn't exist in older schema) + mock_prisma.db.litellm_deletedverificationtoken.find_many = AsyncMock( + side_effect=Exception("Table not found") + ) + + result = await get_api_key_metadata( + prisma_client=mock_prisma, + api_keys={"missing-key-hash"}, + ) + + # Should return empty dict without raising + assert result == {} + + +@pytest.mark.asyncio +async def test_get_api_key_metadata_regenerated_key_uses_most_recent_deleted_record(): + """Test that get_api_key_metadata should use the most recent deleted record for regenerated keys.""" + mock_prisma = MagicMock() + + # No active keys found (old hash no longer in active table after regeneration) + mock_prisma.db.litellm_verificationtoken.find_many = AsyncMock(return_value=[]) + + # Multiple deleted records for same token (e.g., regenerated multiple times) + mock_deleted_1 = MagicMock() + mock_deleted_1.token = "old-key-hash" + mock_deleted_1.key_alias = "latest-alias" + mock_deleted_1.team_id = "latest-team" + + mock_deleted_2 = MagicMock() + mock_deleted_2.token = "old-key-hash" + mock_deleted_2.key_alias = "older-alias" + mock_deleted_2.team_id = "older-team" + + # Ordered by deleted_at desc, so first record is the most recent + mock_prisma.db.litellm_deletedverificationtoken.find_many = AsyncMock( + return_value=[mock_deleted_1, mock_deleted_2] + ) + + result = await get_api_key_metadata( + prisma_client=mock_prisma, + api_keys={"old-key-hash"}, + ) + + # Should use the first (most recent) record + assert result["old-key-hash"]["key_alias"] == "latest-alias" + assert result["old-key-hash"]["team_id"] == "latest-team" + + +@pytest.mark.asyncio +async def test_aggregated_activity_preserves_metadata_for_deleted_keys(): + """Test that the full aggregation pipeline should preserve metadata for deleted keys.""" + mock_prisma = MagicMock() + mock_prisma.db = MagicMock() + + class MockRecord: + def __init__(self, date, endpoint, api_key, model, spend, prompt_tokens, completion_tokens): + self.date = date + self.endpoint = endpoint + self.api_key = api_key + self.model = model + self.model_group = None + self.custom_llm_provider = "openai" + self.mcp_namespaced_tool_name = None + self.spend = spend + self.prompt_tokens = prompt_tokens + self.completion_tokens = completion_tokens + self.total_tokens = prompt_tokens + completion_tokens + self.cache_read_input_tokens = 0 + self.cache_creation_input_tokens = 0 + self.api_requests = 1 + self.successful_requests = 1 + self.failed_requests = 0 + + # Records reference a deleted key + mock_records = [ + MockRecord("2024-01-01", "/v1/chat/completions", "deleted-key-hash", "gpt-4", 10.0, 100, 50), + ] + + mock_table = MagicMock() + mock_table.find_many = AsyncMock(return_value=mock_records) + mock_prisma.db.litellm_dailyuserspend = mock_table + + # Active table returns nothing for this key + mock_prisma.db.litellm_verificationtoken = MagicMock() + mock_prisma.db.litellm_verificationtoken.find_many = AsyncMock(return_value=[]) + + # Deleted table returns the metadata + mock_deleted_key = MagicMock() + mock_deleted_key.token = "deleted-key-hash" + mock_deleted_key.key_alias = "toto-test-2" + mock_deleted_key.team_id = "69cd4b77-b095-4489-8c46-4f2f31d840a2" + + mock_prisma.db.litellm_deletedverificationtoken = MagicMock() + mock_prisma.db.litellm_deletedverificationtoken.find_many = AsyncMock( + return_value=[mock_deleted_key] + ) + + result = await get_daily_activity_aggregated( + prisma_client=mock_prisma, + table_name="litellm_dailyuserspend", + entity_id_field="user_id", + entity_id=None, + entity_metadata_field=None, + start_date="2024-01-01", + end_date="2024-01-01", + model=None, + api_key=None, + ) + + # Verify the deleted key's metadata is preserved + daily_data = result.results[0] + chat_endpoint = daily_data.breakdown.endpoints["/v1/chat/completions"] + assert "deleted-key-hash" in chat_endpoint.api_key_breakdown + key_data = chat_endpoint.api_key_breakdown["deleted-key-hash"] + assert key_data.metadata.key_alias == "toto-test-2" + assert key_data.metadata.team_id == "69cd4b77-b095-4489-8c46-4f2f31d840a2" + assert key_data.metrics.spend == 10.0 From fa9585371890f485c8c83f672fed8179b945b103 Mon Sep 17 00:00:00 2001 From: shivam Date: Sat, 7 Feb 2026 17:17:23 -0800 Subject: [PATCH 006/182] resolved greptile issue related to regeneration persistence and exception handling --- .../common_daily_activity.py | 8 ++++--- .../key_management_endpoints.py | 23 ++++++++----------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/litellm/proxy/management_endpoints/common_daily_activity.py b/litellm/proxy/management_endpoints/common_daily_activity.py index 79d80abf272..e5df2f82f69 100644 --- a/litellm/proxy/management_endpoints/common_daily_activity.py +++ b/litellm/proxy/management_endpoints/common_daily_activity.py @@ -357,9 +357,11 @@ async def get_api_key_metadata( "key_alias": k.key_alias, "team_id": k.team_id, } - except Exception: - verbose_proxy_logger.debug( - "Failed to fetch deleted key metadata for missing keys" + except Exception as e: + verbose_proxy_logger.warning( + "Failed to fetch deleted key metadata for %d missing keys: %s", + len(missing_keys), + e, ) return result diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index 264dff5aa54..48e0c32880b 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -3313,19 +3313,16 @@ async def regenerate_key_fn( verbose_proxy_logger.debug("key_in_db: %s", _key_in_db) - # Save the old key record to deleted table before regeneration - # This preserves key_alias and team_id metadata for historical spend records - try: - await _persist_deleted_verification_tokens( - keys=[_key_in_db], - prisma_client=prisma_client, - user_api_key_dict=user_api_key_dict, - litellm_changed_by=litellm_changed_by, - ) - except Exception: - verbose_proxy_logger.debug( - "Failed to persist old key record to deleted table during regeneration" - ) + # Save the old key record to deleted table before regeneration. + # This preserves key_alias and team_id metadata for historical spend records. + # If this fails, abort the regeneration to avoid permanently losing the + # old hash→metadata mapping. + await _persist_deleted_verification_tokens( + keys=[_key_in_db], + prisma_client=prisma_client, + user_api_key_dict=user_api_key_dict, + litellm_changed_by=litellm_changed_by, + ) new_token = get_new_token(data=data) From ef25ecb68eaf1509b45e4a20e922498e9540df19 Mon Sep 17 00:00:00 2001 From: shivam Date: Sat, 7 Feb 2026 18:21:33 -0800 Subject: [PATCH 007/182] fixed user id --- litellm/proxy/management_endpoints/key_management_endpoints.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index 48e0c32880b..099c4543362 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -3760,7 +3760,7 @@ async def list_keys( else: admin_team_ids = None - if user_id is None and user_api_key_dict.user_role not in [ + if not user_id and user_api_key_dict.user_role not in [ LitellmUserRoles.PROXY_ADMIN.value, LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY.value, ]: From 1792b3c8e5b61f4e5a9951fb53e31542d40c5490 Mon Sep 17 00:00:00 2001 From: Harshit Jain Date: Fri, 13 Feb 2026 03:28:51 +0530 Subject: [PATCH 008/182] fix: add async call to avoid server pauses --- litellm/proxy/management_endpoints/ui_sso.py | 16 ++++++++-------- .../proxy/management_endpoints/test_ui_sso.py | 19 +++++++++++-------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/litellm/proxy/management_endpoints/ui_sso.py b/litellm/proxy/management_endpoints/ui_sso.py index a2d7510c344..2760197781b 100644 --- a/litellm/proxy/management_endpoints/ui_sso.py +++ b/litellm/proxy/management_endpoints/ui_sso.py @@ -695,7 +695,7 @@ async def get_generic_sso_response( try: result = await generic_sso.verify_and_process( request, - params=SSOAuthenticationHandler.prepare_token_exchange_parameters( + params=await SSOAuthenticationHandler.prepare_token_exchange_parameters( request=request, generic_include_client_id=generic_include_client_id, ), @@ -1721,13 +1721,13 @@ class SSOAuthenticationHandler: # so callbacks landing on another pod can retrieve it (multi-pod SSO). cache_key = f"pkce_verifier:{redirect_params['state']}" if redis_usage_cache is not None: - redis_usage_cache.set_cache( + await redis_usage_cache.async_set_cache( key=cache_key, value=json.dumps(code_verifier), ttl=600, ) else: - user_api_key_cache.set_cache( + await user_api_key_cache.async_set_cache( key=cache_key, value=code_verifier, ttl=600, @@ -2328,7 +2328,7 @@ class SSOAuthenticationHandler: return redirect_response @staticmethod - def prepare_token_exchange_parameters( + async def prepare_token_exchange_parameters( request: Request, generic_include_client_id: bool, ) -> dict: @@ -2354,9 +2354,9 @@ class SSOAuthenticationHandler: cache_key = f"pkce_verifier:{state}" if redis_usage_cache is not None: - code_verifier = redis_usage_cache.get_cache(key=cache_key) + code_verifier = await redis_usage_cache.async_get_cache(key=cache_key) else: - code_verifier = user_api_key_cache.get_cache(key=cache_key) + code_verifier = await user_api_key_cache.async_get_cache(key=cache_key) if code_verifier: # Add code_verifier to token exchange parameters (Redis returns decoded string) @@ -2371,9 +2371,9 @@ class SSOAuthenticationHandler: # Clean up the cache entry (single-use verifier) if redis_usage_cache is not None: - redis_usage_cache.delete_cache(key=cache_key) + await redis_usage_cache.async_delete_cache(key=cache_key) else: - user_api_key_cache.delete_cache(key=cache_key) + await user_api_key_cache.async_delete_cache(key=cache_key) return token_params @staticmethod diff --git a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py index 3a5505cdbc5..1a67f7f6b6f 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py +++ b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py @@ -3073,14 +3073,15 @@ class TestPKCEFunctionality: test_state = "test_oauth_state_123" mock_request.query_params = {"state": test_state} - # Mock cache + # Mock cache with async methods mock_cache = MagicMock() test_code_verifier = "test_code_verifier_abc123xyz" - mock_cache.get_cache.return_value = test_code_verifier + mock_cache.async_get_cache = AsyncMock(return_value=test_code_verifier) + mock_cache.async_delete_cache = AsyncMock() with patch("litellm.proxy.proxy_server.user_api_key_cache", mock_cache): # Act - token_params = SSOAuthenticationHandler.prepare_token_exchange_parameters( + token_params = await SSOAuthenticationHandler.prepare_token_exchange_parameters( request=mock_request, generic_include_client_id=False ) @@ -3089,10 +3090,10 @@ class TestPKCEFunctionality: assert token_params["code_verifier"] == test_code_verifier # Verify cache was accessed and deleted - mock_cache.get_cache.assert_called_once_with( + mock_cache.async_get_cache.assert_called_once_with( key=f"pkce_verifier:{test_state}" ) - mock_cache.delete_cache.assert_called_once_with( + mock_cache.async_delete_cache.assert_called_once_with( key=f"pkce_verifier:{test_state}" ) @@ -3117,6 +3118,8 @@ class TestPKCEFunctionality: test_state = "test456" mock_cache = MagicMock() + mock_cache.async_set_cache = AsyncMock() + with patch.dict(os.environ, {"GENERIC_CLIENT_USE_PKCE": "true"}): with patch("litellm.proxy.proxy_server.user_api_key_cache", mock_cache): # Act @@ -3127,9 +3130,9 @@ class TestPKCEFunctionality: ) # Assert - # Verify cache was called to store code_verifier - mock_cache.set_cache.assert_called_once() - cache_call = mock_cache.set_cache.call_args + # Verify async cache was called to store code_verifier + mock_cache.async_set_cache.assert_called_once() + cache_call = mock_cache.async_set_cache.call_args assert cache_call.kwargs["key"] == f"pkce_verifier:{test_state}" assert cache_call.kwargs["ttl"] == 600 assert len(cache_call.kwargs["value"]) == 43 From bc5543cfdcbe2dd3318dd3e126e478efd3e833ec Mon Sep 17 00:00:00 2001 From: Harshit Jain <48647625+Harshit28j@users.noreply.github.com> Date: Fri, 13 Feb 2026 03:39:57 +0530 Subject: [PATCH 009/182] Update tests/test_litellm/proxy/management_endpoints/test_ui_sso.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- tests/test_litellm/proxy/management_endpoints/test_ui_sso.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py index 1a67f7f6b6f..d3cbe6e1718 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py +++ b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py @@ -3209,7 +3209,7 @@ class TestPKCEFunctionality: mock_request = MagicMock(spec=Request) mock_request.query_params = {"state": "multi_pod_state_xyz"} token_params = ( - SSOAuthenticationHandler.prepare_token_exchange_parameters( + await SSOAuthenticationHandler.prepare_token_exchange_parameters( request=mock_request, generic_include_client_id=False ) ) From eb249b2f06a9c74a06874874838e3a0e97b5a5ea Mon Sep 17 00:00:00 2001 From: Harshit Jain Date: Fri, 13 Feb 2026 03:46:31 +0530 Subject: [PATCH 010/182] fix: add await in tests --- .../proxy/management_endpoints/test_ui_sso.py | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py index 1a67f7f6b6f..bd1470a6d65 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py +++ b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py @@ -3081,8 +3081,10 @@ class TestPKCEFunctionality: with patch("litellm.proxy.proxy_server.user_api_key_cache", mock_cache): # Act - token_params = await SSOAuthenticationHandler.prepare_token_exchange_parameters( - request=mock_request, generic_include_client_id=False + token_params = ( + await SSOAuthenticationHandler.prepare_token_exchange_parameters( + request=mock_request, generic_include_client_id=False + ) ) # Assert @@ -3208,10 +3210,8 @@ class TestPKCEFunctionality: # Pod B: callback with same state, retrieve from "Redis" mock_request = MagicMock(spec=Request) mock_request.query_params = {"state": "multi_pod_state_xyz"} - token_params = ( - SSOAuthenticationHandler.prepare_token_exchange_parameters( - request=mock_request, generic_include_client_id=False - ) + token_params = await SSOAuthenticationHandler.prepare_token_exchange_parameters( + request=mock_request, generic_include_client_id=False ) assert "code_verifier" in token_params assert token_params["code_verifier"] == json.loads(stored_value) @@ -3277,10 +3277,8 @@ class TestPKCEFunctionality: # Same pod: callback retrieves from in-memory cache mock_request = MagicMock(spec=Request) mock_request.query_params = {"state": "fallback_state_xyz"} - token_params = ( - SSOAuthenticationHandler.prepare_token_exchange_parameters( - request=mock_request, generic_include_client_id=False - ) + token_params = await SSOAuthenticationHandler.prepare_token_exchange_parameters( + request=mock_request, generic_include_client_id=False ) assert "code_verifier" in token_params assert token_params["code_verifier"] == stored_value @@ -3306,7 +3304,7 @@ class TestPKCEFunctionality: mock_request = MagicMock(spec=Request) mock_request.query_params = {} token_params = ( - SSOAuthenticationHandler.prepare_token_exchange_parameters( + await SSOAuthenticationHandler.prepare_token_exchange_parameters( request=mock_request, generic_include_client_id=False ) ) From e0846389e9ec249ffb257f6240370ad984356204 Mon Sep 17 00:00:00 2001 From: Harshit Jain Date: Fri, 13 Feb 2026 04:04:03 +0530 Subject: [PATCH 011/182] add modify test to perform async run --- litellm/proxy/management_endpoints/ui_sso.py | 3 +- .../proxy/management_endpoints/test_ui_sso.py | 42 +++++++++++-------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/litellm/proxy/management_endpoints/ui_sso.py b/litellm/proxy/management_endpoints/ui_sso.py index 2760197781b..1dc239e50a4 100644 --- a/litellm/proxy/management_endpoints/ui_sso.py +++ b/litellm/proxy/management_endpoints/ui_sso.py @@ -11,7 +11,6 @@ Has all /sso/* routes import asyncio import base64 import hashlib -import json import os import secrets from copy import deepcopy @@ -1723,7 +1722,7 @@ class SSOAuthenticationHandler: if redis_usage_cache is not None: await redis_usage_cache.async_set_cache( key=cache_key, - value=json.dumps(code_verifier), + value=code_verifier, ttl=600, ) else: diff --git a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py index bd1470a6d65..44aa04c0ad6 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py +++ b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py @@ -3159,10 +3159,10 @@ class TestPKCEFunctionality: def __init__(self): self._store = {} - def set_cache(self, key, value, **kwargs): + async def async_set_cache(self, key, value, **kwargs): self._store[key] = value - def get_cache(self, key, **kwargs): + async def async_get_cache(self, key, **kwargs): val = self._store.get(key) if val is None: return None @@ -3174,7 +3174,7 @@ class TestPKCEFunctionality: return val return val - def delete_cache(self, key): + async def async_delete_cache(self, key): self._store.pop(key, None) mock_redis = MockRedisCache() @@ -3200,7 +3200,7 @@ class TestPKCEFunctionality: state="multi_pod_state_xyz", generic_authorization_endpoint="https://auth.example.com/authorize", ) - mock_in_memory.set_cache.assert_not_called() + mock_in_memory.async_set_cache.assert_not_called() # MockRedisCache is a real class; assert on state, not .assert_called_* stored_key = "pkce_verifier:multi_pod_state_xyz" assert stored_key in mock_redis._store @@ -3215,7 +3215,7 @@ class TestPKCEFunctionality: ) assert "code_verifier" in token_params assert token_params["code_verifier"] == json.loads(stored_value) - mock_in_memory.get_cache.assert_not_called() + mock_in_memory.async_get_cache.assert_not_called() # delete_cache called; key removed (asserted below) # Verifier consumed (single-use); key removed from "Redis" @@ -3234,19 +3234,19 @@ class TestPKCEFunctionality: # In-memory store (simulates user_api_key_cache on one pod) in_memory_store = {} - def set_cache(key, value, **kwargs): + async def async_set_cache(key, value, **kwargs): in_memory_store[key] = value - def get_cache(key, **kwargs): + async def async_get_cache(key, **kwargs): return in_memory_store.get(key) - def delete_cache(key): + async def async_delete_cache(key): in_memory_store.pop(key, None) mock_in_memory = MagicMock() - mock_in_memory.set_cache.side_effect = set_cache - mock_in_memory.get_cache.side_effect = get_cache - mock_in_memory.delete_cache.side_effect = delete_cache + mock_in_memory.async_set_cache = AsyncMock(side_effect=async_set_cache) + mock_in_memory.async_get_cache = AsyncMock(side_effect=async_get_cache) + mock_in_memory.async_delete_cache = AsyncMock(side_effect=async_delete_cache) mock_sso = MagicMock() mock_redirect_response = MagicMock() @@ -3268,9 +3268,11 @@ class TestPKCEFunctionality: state="fallback_state_xyz", generic_authorization_endpoint="https://auth.example.com/authorize", ) - mock_in_memory.set_cache.assert_called_once() - stored_key = mock_in_memory.set_cache.call_args.kwargs["key"] - stored_value = mock_in_memory.set_cache.call_args.kwargs["value"] + mock_in_memory.async_set_cache.assert_called_once() + stored_key = mock_in_memory.async_set_cache.call_args.kwargs["key"] + stored_value = mock_in_memory.async_set_cache.call_args.kwargs[ + "value" + ] assert stored_key == "pkce_verifier:fallback_state_xyz" assert isinstance(stored_value, str) and len(stored_value) == 43 @@ -3282,8 +3284,12 @@ class TestPKCEFunctionality: ) assert "code_verifier" in token_params assert token_params["code_verifier"] == stored_value - mock_in_memory.get_cache.assert_called_once_with(key=stored_key) - mock_in_memory.delete_cache.assert_called_once_with(key=stored_key) + mock_in_memory.async_get_cache.assert_called_once_with( + key=stored_key + ) + mock_in_memory.async_delete_cache.assert_called_once_with( + key=stored_key + ) # Verifier consumed; key removed from in-memory assert "pkce_verifier:fallback_state_xyz" not in in_memory_store @@ -3309,8 +3315,8 @@ class TestPKCEFunctionality: ) ) assert "code_verifier" not in token_params - mock_redis.get_cache.assert_not_called() - mock_in_memory.get_cache.assert_not_called() + mock_redis.async_get_cache.assert_not_called() + mock_in_memory.async_get_cache.assert_not_called() # Tests for SSO user team assignment bug (Issue: SSO Users Not Added to Entra-Synced Teams on First Login) From a2b4728e749ada2c0d315fff03602ae69525cfd0 Mon Sep 17 00:00:00 2001 From: Harshit Jain <48647625+Harshit28j@users.noreply.github.com> Date: Fri, 13 Feb 2026 04:40:29 +0530 Subject: [PATCH 012/182] Update tests/test_litellm/proxy/management_endpoints/test_ui_sso.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- tests/test_litellm/proxy/management_endpoints/test_ui_sso.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py index 44aa04c0ad6..d519ce43eee 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py +++ b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py @@ -3205,7 +3205,7 @@ class TestPKCEFunctionality: stored_key = "pkce_verifier:multi_pod_state_xyz" assert stored_key in mock_redis._store stored_value = mock_redis._store[stored_key] - assert json.loads(stored_value) # valid verifier string + assert isinstance(stored_value, str) and len(stored_value) == 43 # Pod B: callback with same state, retrieve from "Redis" mock_request = MagicMock(spec=Request) From c56bbb906721b0a348e2cff295ec228d3462e5e8 Mon Sep 17 00:00:00 2001 From: Harshit Jain <48647625+Harshit28j@users.noreply.github.com> Date: Fri, 13 Feb 2026 04:48:36 +0530 Subject: [PATCH 013/182] Update tests/test_litellm/proxy/management_endpoints/test_ui_sso.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- tests/test_litellm/proxy/management_endpoints/test_ui_sso.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py index d519ce43eee..016131f24dc 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py +++ b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py @@ -3160,7 +3160,7 @@ class TestPKCEFunctionality: self._store = {} async def async_set_cache(self, key, value, **kwargs): - self._store[key] = value + self._store[key] = json.dumps(value) async def async_get_cache(self, key, **kwargs): val = self._store.get(key) From b880320ec6ad9a4294c7b58fb03d5c899806f16c Mon Sep 17 00:00:00 2001 From: Julio Quinteros Pro Date: Fri, 13 Feb 2026 05:57:44 -0300 Subject: [PATCH 014/182] chore: add .claude directory to gitignore Co-Authored-By: Claude Sonnet 4.5 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ddf5f6279b3..c43df98a9e5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .venv .venv_policy_test .env +.claude .newenv newenv/* litellm/proxy/myenv/* From 64424d00c1ad48d4d356b130f110c30ca9470896 Mon Sep 17 00:00:00 2001 From: Julio Quinteros Pro Date: Fri, 13 Feb 2026 05:48:16 -0300 Subject: [PATCH 015/182] fix: use None instead of Reasoning() for reasoning parameter The ResponsesAPIResponse.reasoning field expects Optional[Dict[str, Any]], not a Reasoning object. Passing an empty Reasoning() object causes a mypy type error. Fix: Pass None instead of Reasoning() since the field is optional and we're not providing any reasoning data. Fixes mypy error: Argument "reasoning" to "ResponsesAPIResponse" has incompatible type "Reasoning"; expected "dict[str, Any] | None" --- .../litellm_completion_transformation/transformation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py index 08e31c59662..fe9c83b688b 100644 --- a/litellm/responses/litellm_completion_transformation/transformation.py +++ b/litellm/responses/litellm_completion_transformation/transformation.py @@ -1500,7 +1500,7 @@ class LiteLLMCompletionResponsesConfig: previous_response_id=getattr( chat_completion_response, "previous_response_id", None ), - reasoning=Reasoning(), + reasoning=None, status=LiteLLMCompletionResponsesConfig._map_chat_completion_finish_reason_to_responses_status( finish_reason ), From e6385a6c836f045e295854af21e868d467a587d1 Mon Sep 17 00:00:00 2001 From: Julio Quinteros Pro Date: Thu, 12 Feb 2026 20:19:06 -0300 Subject: [PATCH 016/182] fix: make policy_resolve_endpoints importable without FastAPI Adds try/except around FastAPI imports with fallback mock classes. This allows the module to be imported in test environments where proxy dependencies (FastAPI) may not be installed. Fixes NameError when MCP tests try to import from proxy_server which imports from this module: - NameError: name 'APIRouter' is not defined - NameError: name 'Depends' is not defined - NameError: name 'HTTPException' is not defined - NameError: name 'Query' is not defined --- .../policy_engine/policy_resolve_endpoints.py | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/policy_engine/policy_resolve_endpoints.py b/litellm/proxy/policy_engine/policy_resolve_endpoints.py index 318e990ff12..428ab2b63b2 100644 --- a/litellm/proxy/policy_engine/policy_resolve_endpoints.py +++ b/litellm/proxy/policy_engine/policy_resolve_endpoints.py @@ -6,8 +6,26 @@ Policy resolve and attachment impact estimation endpoints. """ import json +from typing import TYPE_CHECKING -from fastapi import APIRouter, Depends, HTTPException, Query +# FastAPI imports - may not be available in all environments (e.g. during testing) +try: + from fastapi import APIRouter, Depends, HTTPException, Query +except ImportError: + # Provide stubs for type checking only + if TYPE_CHECKING: + from fastapi import APIRouter, Depends, HTTPException, Query + else: + # Create mock classes that won't be used + class APIRouter: # type: ignore[no-redef] + def post(self, *args, **kwargs): + def decorator(func): + return func + return decorator + + def Depends(func): return func # type: ignore[misc] + HTTPException = Exception # type: ignore[misc,assignment] + def Query(*args, **kwargs): return None # type: ignore[misc] from litellm._logging import verbose_proxy_logger from litellm.constants import MAX_POLICY_ESTIMATE_IMPACT_ROWS From ca9cdea8a7bed1a4ee682a6567415c5477da78d4 Mon Sep 17 00:00:00 2001 From: jquinter Date: Fri, 13 Feb 2026 00:40:08 -0300 Subject: [PATCH 017/182] Update litellm/proxy/policy_engine/policy_resolve_endpoints.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- litellm/proxy/policy_engine/policy_resolve_endpoints.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/litellm/proxy/policy_engine/policy_resolve_endpoints.py b/litellm/proxy/policy_engine/policy_resolve_endpoints.py index 428ab2b63b2..27ee896c719 100644 --- a/litellm/proxy/policy_engine/policy_resolve_endpoints.py +++ b/litellm/proxy/policy_engine/policy_resolve_endpoints.py @@ -12,9 +12,7 @@ from typing import TYPE_CHECKING try: from fastapi import APIRouter, Depends, HTTPException, Query except ImportError: - # Provide stubs for type checking only - if TYPE_CHECKING: - from fastapi import APIRouter, Depends, HTTPException, Query + # Provide stubs for environments without FastAPI else: # Create mock classes that won't be used class APIRouter: # type: ignore[no-redef] From 1fffeb953c60b5cbe6eb0f3d9e6d7b95815da4ce Mon Sep 17 00:00:00 2001 From: Julio Quinteros Pro Date: Fri, 13 Feb 2026 00:47:35 -0300 Subject: [PATCH 018/182] fix: restore if TYPE_CHECKING block for proper FastAPI import handling Greptile's previous suggestion accidentally removed the if TYPE_CHECKING block, leaving an orphan else statement that caused a syntax error. This commit restores the proper structure. --- .../policy_engine/policy_resolve_endpoints.py | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/litellm/proxy/policy_engine/policy_resolve_endpoints.py b/litellm/proxy/policy_engine/policy_resolve_endpoints.py index 27ee896c719..8f613694506 100644 --- a/litellm/proxy/policy_engine/policy_resolve_endpoints.py +++ b/litellm/proxy/policy_engine/policy_resolve_endpoints.py @@ -12,18 +12,26 @@ from typing import TYPE_CHECKING try: from fastapi import APIRouter, Depends, HTTPException, Query except ImportError: - # Provide stubs for environments without FastAPI + # Provide stubs for type checking only + if TYPE_CHECKING: + from fastapi import APIRouter, Depends, HTTPException, Query else: # Create mock classes that won't be used class APIRouter: # type: ignore[no-redef] def post(self, *args, **kwargs): def decorator(func): return func + return decorator - def Depends(func): return func # type: ignore[misc] + def Depends(func): + return func # type: ignore[misc] + HTTPException = Exception # type: ignore[misc,assignment] - def Query(*args, **kwargs): return None # type: ignore[misc] + + def Query(*args, **kwargs): + return None # type: ignore[misc] + from litellm._logging import verbose_proxy_logger from litellm.constants import MAX_POLICY_ESTIMATE_IMPACT_ROWS @@ -93,7 +101,9 @@ def _get_tags_from_metadata(metadata: object, json_metadata: object = None) -> l async def _fetch_all_teams(prisma_client: object) -> list: """Fetch teams from DB once. Reuse the result across tag and alias lookups.""" return await prisma_client.db.litellm_teamtable.find_many( # type: ignore - where={}, order={"created_at": "desc"}, take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, + where={}, + order={"created_at": "desc"}, + take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, ) @@ -175,7 +185,8 @@ async def _find_affected_by_team_patterns( if matched_team_ids: keys = await prisma_client.db.litellm_verificationtoken.find_many( # type: ignore where={"team_id": {"in": matched_team_ids}}, - order={"created_at": "desc"}, take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, + order={"created_at": "desc"}, + take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, ) for key in keys: key_alias = key.key_alias or "" @@ -197,7 +208,8 @@ async def _find_affected_keys_by_alias( keys = await prisma_client.db.litellm_verificationtoken.find_many( # type: ignore where=_build_alias_where("key_alias", key_patterns), - order={"created_at": "desc"}, take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, + order={"created_at": "desc"}, + take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, ) for key in keys: key_alias = key.key_alias or "" @@ -380,19 +392,24 @@ async def estimate_attachment_impact( # Tag-based impact if tag_patterns: keys = await prisma_client.db.litellm_verificationtoken.find_many( # type: ignore - where={}, order={"created_at": "desc"}, + where={}, + order={"created_at": "desc"}, take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, ) affected_keys, unnamed_keys = _filter_keys_by_tags(keys, tag_patterns) affected_teams, unnamed_teams = _filter_teams_by_tags( - all_teams, tag_patterns, + all_teams, + tag_patterns, ) # Team-based impact (alias matching + keys belonging to those teams) if team_patterns: new_teams, new_keys, new_unnamed = await _find_affected_by_team_patterns( - prisma_client, all_teams, team_patterns, - affected_teams, affected_keys, + prisma_client, + all_teams, + team_patterns, + affected_teams, + affected_keys, ) affected_teams.extend(new_teams) affected_keys.extend(new_keys) @@ -402,7 +419,9 @@ async def estimate_attachment_impact( key_patterns = request.keys or [] if key_patterns: new_keys = await _find_affected_keys_by_alias( - prisma_client, key_patterns, affected_keys, + prisma_client, + key_patterns, + affected_keys, ) affected_keys.extend(new_keys) From 5bcd3b53c94b44ca4eeabb9206140e2b9bcfbb98 Mon Sep 17 00:00:00 2001 From: Julio Quinteros Pro Date: Fri, 13 Feb 2026 05:25:33 -0300 Subject: [PATCH 019/182] fix: import LiteLLM_ObjectPermissionTable from _types instead of proxy_server Per maintainer feedback, FastAPI should always be available in proxy code. The issue was that MCP tests were importing from proxy_server unnecessarily, pulling in all proxy dependencies including policy_resolve_endpoints. Fix: - Revert policy_resolve_endpoints.py to use direct FastAPI imports - Update MCP tests to import LiteLLM_ObjectPermissionTable from litellm.proxy._types instead of litellm.proxy.proxy_server This avoids importing the entire proxy_server module with all its dependencies when tests only need specific types. Addresses: https://github.com/BerriAI/litellm/pull/21075/changes#r2802201174 --- .../policy_engine/policy_resolve_endpoints.py | 53 ++++--------------- tests/mcp_tests/test_mcp_logging.py | 3 +- tests/mcp_tests/test_mcp_server.py | 2 +- 3 files changed, 11 insertions(+), 47 deletions(-) diff --git a/litellm/proxy/policy_engine/policy_resolve_endpoints.py b/litellm/proxy/policy_engine/policy_resolve_endpoints.py index 8f613694506..318e990ff12 100644 --- a/litellm/proxy/policy_engine/policy_resolve_endpoints.py +++ b/litellm/proxy/policy_engine/policy_resolve_endpoints.py @@ -6,32 +6,8 @@ Policy resolve and attachment impact estimation endpoints. """ import json -from typing import TYPE_CHECKING - -# FastAPI imports - may not be available in all environments (e.g. during testing) -try: - from fastapi import APIRouter, Depends, HTTPException, Query -except ImportError: - # Provide stubs for type checking only - if TYPE_CHECKING: - from fastapi import APIRouter, Depends, HTTPException, Query - else: - # Create mock classes that won't be used - class APIRouter: # type: ignore[no-redef] - def post(self, *args, **kwargs): - def decorator(func): - return func - - return decorator - - def Depends(func): - return func # type: ignore[misc] - - HTTPException = Exception # type: ignore[misc,assignment] - - def Query(*args, **kwargs): - return None # type: ignore[misc] +from fastapi import APIRouter, Depends, HTTPException, Query from litellm._logging import verbose_proxy_logger from litellm.constants import MAX_POLICY_ESTIMATE_IMPACT_ROWS @@ -101,9 +77,7 @@ def _get_tags_from_metadata(metadata: object, json_metadata: object = None) -> l async def _fetch_all_teams(prisma_client: object) -> list: """Fetch teams from DB once. Reuse the result across tag and alias lookups.""" return await prisma_client.db.litellm_teamtable.find_many( # type: ignore - where={}, - order={"created_at": "desc"}, - take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, + where={}, order={"created_at": "desc"}, take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, ) @@ -185,8 +159,7 @@ async def _find_affected_by_team_patterns( if matched_team_ids: keys = await prisma_client.db.litellm_verificationtoken.find_many( # type: ignore where={"team_id": {"in": matched_team_ids}}, - order={"created_at": "desc"}, - take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, + order={"created_at": "desc"}, take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, ) for key in keys: key_alias = key.key_alias or "" @@ -208,8 +181,7 @@ async def _find_affected_keys_by_alias( keys = await prisma_client.db.litellm_verificationtoken.find_many( # type: ignore where=_build_alias_where("key_alias", key_patterns), - order={"created_at": "desc"}, - take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, + order={"created_at": "desc"}, take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, ) for key in keys: key_alias = key.key_alias or "" @@ -392,24 +364,19 @@ async def estimate_attachment_impact( # Tag-based impact if tag_patterns: keys = await prisma_client.db.litellm_verificationtoken.find_many( # type: ignore - where={}, - order={"created_at": "desc"}, + where={}, order={"created_at": "desc"}, take=MAX_POLICY_ESTIMATE_IMPACT_ROWS, ) affected_keys, unnamed_keys = _filter_keys_by_tags(keys, tag_patterns) affected_teams, unnamed_teams = _filter_teams_by_tags( - all_teams, - tag_patterns, + all_teams, tag_patterns, ) # Team-based impact (alias matching + keys belonging to those teams) if team_patterns: new_teams, new_keys, new_unnamed = await _find_affected_by_team_patterns( - prisma_client, - all_teams, - team_patterns, - affected_teams, - affected_keys, + prisma_client, all_teams, team_patterns, + affected_teams, affected_keys, ) affected_teams.extend(new_teams) affected_keys.extend(new_keys) @@ -419,9 +386,7 @@ async def estimate_attachment_impact( key_patterns = request.keys or [] if key_patterns: new_keys = await _find_affected_keys_by_alias( - prisma_client, - key_patterns, - affected_keys, + prisma_client, key_patterns, affected_keys, ) affected_keys.extend(new_keys) diff --git a/tests/mcp_tests/test_mcp_logging.py b/tests/mcp_tests/test_mcp_logging.py index aeebb2e913e..d9ecb594b7b 100644 --- a/tests/mcp_tests/test_mcp_logging.py +++ b/tests/mcp_tests/test_mcp_logging.py @@ -19,8 +19,7 @@ from litellm.proxy._experimental.mcp_server.server import ( from litellm.proxy._experimental.mcp_server.mcp_server_manager import ( MCPServerManager, ) -from litellm.proxy.proxy_server import LiteLLM_ObjectPermissionTable -from litellm.proxy._types import UserAPIKeyAuth +from litellm.proxy._types import LiteLLM_ObjectPermissionTable, UserAPIKeyAuth from litellm.types.mcp import MCPPostCallResponseObject from litellm.types.utils import HiddenParams from mcp.types import Tool as MCPTool, CallToolResult, TextContent diff --git a/tests/mcp_tests/test_mcp_server.py b/tests/mcp_tests/test_mcp_server.py index 9718d714cfe..98cf3c40c81 100644 --- a/tests/mcp_tests/test_mcp_server.py +++ b/tests/mcp_tests/test_mcp_server.py @@ -1,7 +1,6 @@ # Create server parameters for stdio connection import os import sys -from litellm.proxy.proxy_server import LiteLLM_ObjectPermissionTable import pytest from unittest.mock import AsyncMock, MagicMock, patch from contextlib import asynccontextmanager @@ -15,6 +14,7 @@ from litellm.proxy._experimental.mcp_server.mcp_server_manager import ( MCPServer, MCPTransport, ) +from litellm.proxy._types import LiteLLM_ObjectPermissionTable from mcp.types import Tool as MCPTool, CallToolResult, ListToolsResult from mcp.types import TextContent From f87b12a2f7d2596d8b85161b7157b55e0981513b Mon Sep 17 00:00:00 2001 From: Harshit Jain Date: Sat, 14 Feb 2026 04:18:08 +0530 Subject: [PATCH 020/182] fix grace period with better error handling on frontend and as per best practices --- docs/my-website/docs/proxy/config_settings.md | 2 +- docs/my-website/docs/proxy/virtual_keys.md | 8 +- litellm/constants.py | 18 ++- litellm/proxy/_types.py | 90 ++++++------- .../common_utils/key_rotation_manager.py | 4 +- .../key_management_endpoints.py | 118 ++++++++++++------ litellm/proxy/utils.py | 99 ++++++++++----- .../common_utils/test_key_rotation_manager.py | 10 +- .../organisms/regenerate_key_modal.tsx | 18 ++- 9 files changed, 222 insertions(+), 145 deletions(-) diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md index 5499e541335..03cf665b3c8 100644 --- a/docs/my-website/docs/proxy/config_settings.md +++ b/docs/my-website/docs/proxy/config_settings.md @@ -765,7 +765,7 @@ router_settings: | LITELM_ENVIRONMENT | Environment of LiteLLM Instance, used by logging services. Currently only used by DeepEval. | LITELLM_KEY_ROTATION_ENABLED | Enable auto-key rotation for LiteLLM (boolean). Default is false. | LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS | Interval in seconds for how often to run job that auto-rotates keys. Default is 86400 (24 hours). -| LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS | Hours to keep old key valid after rotation (e.g. 24, 48, 72). Default is 0 (immediate revoke). Used for scheduled rotations and as fallback when not specified in regenerate request. +| LITELLM_KEY_ROTATION_GRACE_PERIOD | Duration to keep old key valid after rotation (e.g. "24h", "2d"). Default is empty (immediate revoke). Used for scheduled rotations and as fallback when not specified in regenerate request. | LITELLM_LICENSE | License key for LiteLLM usage | LITELLM_LOCAL_MODEL_COST_MAP | Local configuration for model cost mapping in LiteLLM | LITELLM_LOG | Enable detailed logging for LiteLLM diff --git a/docs/my-website/docs/proxy/virtual_keys.md b/docs/my-website/docs/proxy/virtual_keys.md index 31506ea2611..c74aa75ff4a 100644 --- a/docs/my-website/docs/proxy/virtual_keys.md +++ b/docs/my-website/docs/proxy/virtual_keys.md @@ -550,12 +550,12 @@ curl 'http://localhost:4000/key/sk-1234/regenerate' \ "gpt-4", "gpt-3.5-turbo" ], - "grace_period_hours": 48 + "grace_period": "48h" }' ``` -**Grace period (optional)**: Set `grace_period_hours` (e.g. 24, 48, 72) to keep the old key valid for a transitional period. Both old and new keys work until the grace period elapses, enabling seamless cutover without production downtime. Default is 0 (immediate revoke). Can also be set via `LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS` for scheduled rotations. +**Grace period (optional)**: Set `grace_period` (e.g. `"24h"`, `"2d"`, `"1w"`) to keep the old key valid for a transitional period. Both old and new keys work until the grace period elapses, enabling seamless cutover without production downtime. Omitted or empty = immediate revoke. Can also be set via `LITELLM_KEY_ROTATION_GRACE_PERIOD` env var for scheduled rotations. **Read More** @@ -643,13 +643,13 @@ Set these environment variables when starting the proxy: |----------|-------------|---------| | `LITELLM_KEY_ROTATION_ENABLED` | Enable the rotation worker | `false` | | `LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS` | How often to scan for keys to rotate (in seconds) | `86400` (24 hours) | -| `LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS` | Hours to keep old key valid after rotation (24–72 recommended) | `0` (immediate revoke) | +| `LITELLM_KEY_ROTATION_GRACE_PERIOD` | Duration to keep old key valid after rotation (e.g. `24h`, `2d`) | `""` (immediate revoke) | **Example:** ```bash export LITELLM_KEY_ROTATION_ENABLED=true export LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS=3600 # Check every hour -export LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS=48 # Keep old key valid for 48h during cutover +export LITELLM_KEY_ROTATION_GRACE_PERIOD=48h # Keep old key valid for 48h during cutover litellm --config config.yaml ``` diff --git a/litellm/constants.py b/litellm/constants.py index 73713e6a05b..56349505299 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -106,9 +106,7 @@ MCP_OAUTH2_TOKEN_CACHE_DEFAULT_TTL = int( # npm/npx needs a writable cache dir; in containers the default (~/.npm) # may not exist or be read-only. /tmp is always writable. MCP_NPM_CACHE_DIR = os.getenv("MCP_NPM_CACHE_DIR", "/tmp/.npm_mcp_cache") -MCP_OAUTH2_TOKEN_CACHE_MIN_TTL = int( - os.getenv("MCP_OAUTH2_TOKEN_CACHE_MIN_TTL", "10") -) +MCP_OAUTH2_TOKEN_CACHE_MIN_TTL = int(os.getenv("MCP_OAUTH2_TOKEN_CACHE_MIN_TTL", "10")) LITELLM_UI_ALLOW_HEADERS = [ "x-litellm-semantic-filter", @@ -225,9 +223,7 @@ REDIS_DAILY_TAG_SPEND_UPDATE_BUFFER_KEY = "litellm_daily_tag_spend_update_buffer MAX_REDIS_BUFFER_DEQUEUE_COUNT = int(os.getenv("MAX_REDIS_BUFFER_DEQUEUE_COUNT", 100)) MAX_SIZE_IN_MEMORY_QUEUE = int(os.getenv("MAX_SIZE_IN_MEMORY_QUEUE", 2000)) # Bounds asyncio.Queue() instances (log queues, spend update queues, etc.) to prevent unbounded memory growth -LITELLM_ASYNCIO_QUEUE_MAXSIZE = int( - os.getenv("LITELLM_ASYNCIO_QUEUE_MAXSIZE", 1000) -) +LITELLM_ASYNCIO_QUEUE_MAXSIZE = int(os.getenv("LITELLM_ASYNCIO_QUEUE_MAXSIZE", 1000)) MAX_IN_MEMORY_QUEUE_FLUSH_COUNT = int( os.getenv("MAX_IN_MEMORY_QUEUE_FLUSH_COUNT", 1000) ) @@ -349,7 +345,9 @@ MAX_SIZE_PER_ITEM_IN_MEMORY_CACHE_IN_KB = int( DEFAULT_MAX_TOKENS_FOR_TRITON = int(os.getenv("DEFAULT_MAX_TOKENS_FOR_TRITON", 2000)) #### Networking settings #### request_timeout: float = float(os.getenv("REQUEST_TIMEOUT", 6000)) # time in seconds -DEFAULT_A2A_AGENT_TIMEOUT: float = float(os.getenv("DEFAULT_A2A_AGENT_TIMEOUT", 6000)) # 10 minutes +DEFAULT_A2A_AGENT_TIMEOUT: float = float( + os.getenv("DEFAULT_A2A_AGENT_TIMEOUT", 6000) +) # 10 minutes # Patterns that indicate a localhost/internal URL in A2A agent cards that should be # replaced with the original base_url. This is a common misconfiguration where # developers deploy agents with development URLs in their agent cards. @@ -1256,9 +1254,9 @@ LITELLM_KEY_ROTATION_ENABLED = os.getenv("LITELLM_KEY_ROTATION_ENABLED", "false" LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS = int( os.getenv("LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS", 86400) ) # 24 hours default -LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS = int( - os.getenv("LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS", 0) -) # Hours to keep old key valid after rotation; 0 = immediate revoke (default) +LITELLM_KEY_ROTATION_GRACE_PERIOD: str = os.getenv( + "LITELLM_KEY_ROTATION_GRACE_PERIOD", "" +) # Duration to keep old key valid after rotation (e.g. "24h", "2d"); empty = immediate revoke (default) UI_SESSION_TOKEN_TEAM_ID = "litellm-dashboard" LITELLM_PROXY_ADMIN_NAME = "default_user_id" diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index b8c84c7fa2d..fb632dd16d4 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -854,9 +854,9 @@ class GenerateRequestBase(LiteLLMPydanticObjectBase): allowed_cache_controls: Optional[list] = [] config: Optional[dict] = {} permissions: Optional[dict] = {} - model_max_budget: Optional[dict] = ( - {} - ) # {"gpt-4": 5.0, "gpt-3.5-turbo": 5.0}, defaults to {} + model_max_budget: Optional[ + dict + ] = {} # {"gpt-4": 5.0, "gpt-3.5-turbo": 5.0}, defaults to {} model_config = ConfigDict(protected_namespaces=()) model_rpm_limit: Optional[dict] = None @@ -995,9 +995,9 @@ class RegenerateKeyRequest(GenerateKeyRequest): spend: Optional[float] = None metadata: Optional[dict] = None new_master_key: Optional[str] = None - grace_period_hours: Optional[ - int - ] = None # Hours to keep old key valid; 0/None = immediate revoke + grace_period: Optional[ + str + ] = None # Duration to keep old key valid (e.g. "24h", "2d"); None = immediate revoke class ResetSpendRequest(LiteLLMPydanticObjectBase): @@ -1409,12 +1409,12 @@ class NewCustomerRequest(BudgetNewRequest): blocked: bool = False # allow/disallow requests for this end-user budget_id: Optional[str] = None # give either a budget_id or max_budget spend: Optional[float] = None - allowed_model_region: Optional[AllowedModelRegion] = ( - None # require all user requests to use models in this specific region - ) - default_model: Optional[str] = ( - None # if no equivalent model in allowed region - default all requests to this model - ) + allowed_model_region: Optional[ + AllowedModelRegion + ] = None # require all user requests to use models in this specific region + default_model: Optional[ + str + ] = None # if no equivalent model in allowed region - default all requests to this model @model_validator(mode="before") @classmethod @@ -1436,12 +1436,12 @@ class UpdateCustomerRequest(LiteLLMPydanticObjectBase): blocked: bool = False # allow/disallow requests for this end-user max_budget: Optional[float] = None budget_id: Optional[str] = None # give either a budget_id or max_budget - allowed_model_region: Optional[AllowedModelRegion] = ( - None # require all user requests to use models in this specific region - ) - default_model: Optional[str] = ( - None # if no equivalent model in allowed region - default all requests to this model - ) + allowed_model_region: Optional[ + AllowedModelRegion + ] = None # require all user requests to use models in this specific region + default_model: Optional[ + str + ] = None # if no equivalent model in allowed region - default all requests to this model class DeleteCustomerRequest(LiteLLMPydanticObjectBase): @@ -1530,15 +1530,15 @@ class NewTeamRequest(TeamBase): ] = None # raise an error if 'guaranteed_throughput' is set and we're overallocating tpm model_tpm_limit: Optional[Dict[str, int]] = None - team_member_budget: Optional[float] = ( - None # allow user to set a budget for all team members - ) - team_member_rpm_limit: Optional[int] = ( - None # allow user to set RPM limit for all team members - ) - team_member_tpm_limit: Optional[int] = ( - None # allow user to set TPM limit for all team members - ) + team_member_budget: Optional[ + float + ] = None # allow user to set a budget for all team members + team_member_rpm_limit: Optional[ + int + ] = None # allow user to set RPM limit for all team members + team_member_tpm_limit: Optional[ + int + ] = None # allow user to set TPM limit for all team members team_member_key_duration: Optional[str] = None # e.g. "1d", "1w", "1m" allowed_vector_store_indexes: Optional[List[AllowedVectorStoreIndexItem]] = None @@ -1630,9 +1630,9 @@ class BlockKeyRequest(LiteLLMPydanticObjectBase): class AddTeamCallback(LiteLLMPydanticObjectBase): callback_name: str - callback_type: Optional[Literal["success", "failure", "success_and_failure"]] = ( - "success_and_failure" - ) + callback_type: Optional[ + Literal["success", "failure", "success_and_failure"] + ] = "success_and_failure" callback_vars: Dict[str, str] @model_validator(mode="before") @@ -1964,9 +1964,9 @@ class ConfigList(LiteLLMPydanticObjectBase): stored_in_db: Optional[bool] field_default_value: Any premium_field: bool = False - nested_fields: Optional[List[FieldDetail]] = ( - None # For nested dictionary or Pydantic fields - ) + nested_fields: Optional[ + List[FieldDetail] + ] = None # For nested dictionary or Pydantic fields class UserHeaderMapping(LiteLLMPydanticObjectBase): @@ -2406,9 +2406,9 @@ class LiteLLM_OrganizationMembershipTable(LiteLLMPydanticObjectBase): budget_id: Optional[str] = None created_at: datetime updated_at: datetime - user: Optional[Any] = ( - None # You might want to replace 'Any' with a more specific type if available - ) + user: Optional[ + Any + ] = None # You might want to replace 'Any' with a more specific type if available litellm_budget_table: Optional[LiteLLM_BudgetTable] = None model_config = ConfigDict(protected_namespaces=()) @@ -3384,9 +3384,9 @@ class TeamModelDeleteRequest(BaseModel): # Organization Member Requests class OrganizationMemberAddRequest(OrgMemberAddRequest): organization_id: str - max_budget_in_organization: Optional[float] = ( - None # Users max budget within the organization - ) + max_budget_in_organization: Optional[ + float + ] = None # Users max budget within the organization class OrganizationMemberDeleteRequest(MemberDeleteRequest): @@ -3604,9 +3604,9 @@ class ProviderBudgetResponse(LiteLLMPydanticObjectBase): Maps provider names to their budget configs. """ - providers: Dict[str, ProviderBudgetResponseObject] = ( - {} - ) # Dictionary mapping provider names to their budget configurations + providers: Dict[ + str, ProviderBudgetResponseObject + ] = {} # Dictionary mapping provider names to their budget configurations class ProxyStateVariables(TypedDict): @@ -3749,9 +3749,9 @@ class LiteLLM_JWTAuth(LiteLLMPydanticObjectBase): enforce_rbac: bool = False roles_jwt_field: Optional[str] = None # v2 on role mappings role_mappings: Optional[List[RoleMapping]] = None - object_id_jwt_field: Optional[str] = ( - None # can be either user / team, inferred from the role mapping - ) + object_id_jwt_field: Optional[ + str + ] = None # can be either user / team, inferred from the role mapping scope_mappings: Optional[List[ScopeMapping]] = None enforce_scope_based_access: bool = False enforce_team_based_model_access: bool = False diff --git a/litellm/proxy/common_utils/key_rotation_manager.py b/litellm/proxy/common_utils/key_rotation_manager.py index 7ef26bf07b9..88fd08f6ab4 100644 --- a/litellm/proxy/common_utils/key_rotation_manager.py +++ b/litellm/proxy/common_utils/key_rotation_manager.py @@ -10,7 +10,7 @@ from typing import List from litellm._logging import verbose_proxy_logger from litellm.constants import ( LITELLM_INTERNAL_JOBS_SERVICE_ACCOUNT_NAME, - LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS, + LITELLM_KEY_ROTATION_GRACE_PERIOD, ) from litellm.proxy._types import ( GenerateKeyResponse, @@ -143,7 +143,7 @@ class KeyRotationManager: regenerate_request = RegenerateKeyRequest( key=key.token or "", key_alias=key.key_alias, # Pass key alias to ensure correct secret is updated in AWS Secrets Manager - grace_period_hours=LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS, + grace_period=LITELLM_KEY_ROTATION_GRACE_PERIOD or None, ) # Create a system user for key rotation diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index f7ad44879bd..e8a1af27978 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -629,7 +629,11 @@ async def _common_key_generation_helper( # noqa: PLR0915 # Validate user-provided key format if data.key is not None and not data.key.startswith("sk-"): - _masked = "{}****{}".format(data.key[:4], data.key[-4:]) if len(data.key) > 8 else "****" + _masked = ( + "{}****{}".format(data.key[:4], data.key[-4:]) + if len(data.key) > 8 + else "****" + ) raise HTTPException( status_code=400, detail={ @@ -1342,7 +1346,7 @@ async def prepare_key_update_data( data_json: dict = data.model_dump(exclude_unset=True) data_json.pop("key", None) data_json.pop("new_key", None) - data_json.pop("grace_period_hours", None) # Request-only param, not a DB column + data_json.pop("grace_period", None) # Request-only param, not a DB column if ( data.metadata is not None and data.metadata.get("service_account_id") is not None @@ -3178,6 +3182,69 @@ def get_new_token(data: Optional[RegenerateKeyRequest]) -> str: return new_token +async def _insert_deprecated_key( + prisma_client: "PrismaClient", + old_token_hash: str, + new_token_hash: str, + grace_period: Optional[str], +) -> None: + """ + Insert old key into deprecated table so it remains valid during grace period. + + Uses upsert to handle concurrent rotations gracefully. + + Parameters: + prisma_client: DB client + old_token_hash: Hash of the old key being rotated out + new_token_hash: Hash of the new replacement key + grace_period: Duration string (e.g. "24h", "2d") or None/empty for immediate revoke + """ + grace_period_value = grace_period or os.getenv( + "LITELLM_KEY_ROTATION_GRACE_PERIOD", "" + ) + if not grace_period_value: + return + + try: + grace_seconds = duration_in_seconds(grace_period_value) + except ValueError: + verbose_proxy_logger.warning( + "Invalid grace_period format: %s. Expected format like '24h', '2d'.", + grace_period_value, + ) + return + + if grace_seconds <= 0: + return + + try: + revoke_at = datetime.now(timezone.utc) + timedelta(seconds=grace_seconds) + await prisma_client.db.litellm_deprecatedverificationtoken.upsert( + where={"token": old_token_hash}, + data={ + "create": { + "token": old_token_hash, + "active_token_id": new_token_hash, + "revoke_at": revoke_at, + }, + "update": { + "active_token_id": new_token_hash, + "revoke_at": revoke_at, + }, + }, + ) + verbose_proxy_logger.debug( + "Deprecated key retained for %s (revoke_at: %s)", + grace_period_value, + revoke_at, + ) + except Exception as deprecated_err: + verbose_proxy_logger.warning( + "Failed to insert deprecated key for grace period: %s", + deprecated_err, + ) + + @router.post( "/key/{key:path}/regenerate", tags=["key management"], @@ -3228,7 +3295,7 @@ async def regenerate_key_fn( # noqa: PLR0915 - permissions: Optional[dict] - Key-specific permissions - guardrails: Optional[List[str]] - List of active guardrails for the key - blocked: Optional[bool] - Whether the key is blocked - - grace_period_hours: Optional[int] - Hours to keep old key valid after rotation (e.g. 24, 48, 72). 0 or omitted = immediate revoke. Env: LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS + - grace_period: Optional[str] - Duration to keep old key valid after rotation (e.g. "24h", "2d"). Omitted = immediate revoke. Env: LITELLM_KEY_ROTATION_GRACE_PERIOD Returns: @@ -3369,44 +3436,13 @@ async def regenerate_key_fn( # noqa: PLR0915 update_data.update(non_default_values) update_data = prisma_client.jsonify_object(data=update_data) - # If grace period > 0, insert deprecated key so old key remains valid - if data is not None and data.grace_period_hours is not None: - grace_period_hours = data.grace_period_hours - else: - grace_period_hours = int( - os.getenv("LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS", "0") - ) - if grace_period_hours > 0: - try: - revoke_at = datetime.now(timezone.utc) + timedelta( - hours=grace_period_hours - ) - # Use upsert to handle concurrent rotations gracefully; avoids - # unique constraint violation if same key is rotated simultaneously - await prisma_client.db.litellm_deprecatedverificationtoken.upsert( - where={"token": hashed_api_key}, - data={ - "create": { - "token": hashed_api_key, - "active_token_id": new_token_hash, - "revoke_at": revoke_at, - }, - "update": { - "active_token_id": new_token_hash, - "revoke_at": revoke_at, - }, - }, - ) - verbose_proxy_logger.debug( - "Deprecated key retained for %s hours (revoke_at: %s)", - grace_period_hours, - revoke_at, - ) - except Exception as deprecated_err: - verbose_proxy_logger.warning( - "Failed to insert deprecated key for grace period: %s", - deprecated_err, - ) + # If grace period set, insert deprecated key so old key remains valid + await _insert_deprecated_key( + prisma_client=prisma_client, + old_token_hash=hashed_api_key, + new_token_hash=new_token_hash, + grace_period=data.grace_period if data else None, + ) # Update the token in the database updated_token = await prisma_client.db.litellm_verificationtoken.update( diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 5fbc003ceb1..528415c891d 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -1375,11 +1375,11 @@ class ProxyLogging: # Note: user_info is a CallInfo that can represent user/team/org level info. For team budgets, # alert_emails is populated from team_object.metadata.soft_budget_alerting_emails (see auth_checks.py) is_soft_budget_with_alert_emails = ( - type == "soft_budget" - and user_info.alert_emails is not None + type == "soft_budget" + and user_info.alert_emails is not None and len(user_info.alert_emails) > 0 ) - + if self.alerting is None and not is_soft_budget_with_alert_emails: # do nothing if alerting is not switched on (unless it's a soft_budget alert with team-specific emails) return @@ -1395,10 +1395,9 @@ class ProxyLogging: # 1. "email" is in alerting config, OR # 2. It's a soft_budget alert with team-specific alert_emails (bypasses global alerting config) should_send_email = ( - (self.alerting is not None and "email" in self.alerting) - or is_soft_budget_with_alert_emails - ) - + self.alerting is not None and "email" in self.alerting + ) or is_soft_budget_with_alert_emails + if should_send_email and self.email_logging_instance is not None: await self.email_logging_instance.budget_alerts( type=type, @@ -2032,6 +2031,54 @@ def jsonify_object(data: dict) -> dict: return db_data +# In-memory cache for deprecated key lookups: maps old_token_hash -> (active_token_id, expires_at_ts) +# Avoids a DB query on every auth request for non-deprecated keys. +_deprecated_key_cache: Dict[str, tuple] = {} +_DEPRECATED_KEY_CACHE_TTL_SECONDS = 60 + + +async def _lookup_deprecated_key( + db: Any, + hashed_token: str, +) -> Optional[str]: + """ + Check if a token exists in the deprecated keys table and is still within its grace period. + + Returns the active_token_id if found and valid, otherwise None. + Uses an in-memory cache to avoid DB queries on every auth request. + """ + now = datetime.now(timezone.utc) + now_ts = now.timestamp() + + # Check cache first + cached = _deprecated_key_cache.get(hashed_token) + if cached is not None: + active_token_id, cache_expires_at_ts = cached + if now_ts < cache_expires_at_ts: + return active_token_id + else: + _deprecated_key_cache.pop(hashed_token, None) + + try: + deprecated_row = await db.litellm_deprecatedverificationtoken.find_first( + where={ + "token": hashed_token, + "revoke_at": {"gt": now}, + }, + select={"active_token_id": True}, + ) + if deprecated_row and deprecated_row.active_token_id: + _deprecated_key_cache[hashed_token] = ( + deprecated_row.active_token_id, + now_ts + _DEPRECATED_KEY_CACHE_TTL_SECONDS, + ) + return deprecated_row.active_token_id + except Exception as e: + verbose_proxy_logger.debug("Deprecated key lookup skipped: %s", e) + + return None + + class PrismaClient: spend_log_transactions: List = [] _spend_log_transactions_lock = asyncio.Lock() @@ -2665,32 +2712,22 @@ class PrismaClient: ) # If not found in main table, check deprecated keys (grace period) - if response is None: - try: - deprecated_row = await self.db.litellm_deprecatedverificationtoken.find_first( - where={ - "token": hashed_token, - "revoke_at": {"gt": datetime.now(timezone.utc)}, - }, - select={"active_token_id": True}, + if response is None and hashed_token is not None: + active_token_id = await _lookup_deprecated_key( + db=self.db, hashed_token=hashed_token + ) + if active_token_id: + response = await self.get_data( + token=active_token_id, + table_name="combined_view", + query_type="find_unique", + parent_otel_span=parent_otel_span, + proxy_logging_obj=proxy_logging_obj, ) - if deprecated_row and deprecated_row.active_token_id: - response = await self.get_data( - token=deprecated_row.active_token_id, - table_name="combined_view", - query_type="find_unique", - parent_otel_span=parent_otel_span, - proxy_logging_obj=proxy_logging_obj, + if response is not None: + verbose_proxy_logger.debug( + "Deprecated key used during grace period" ) - if response is not None: - verbose_proxy_logger.debug( - "Deprecated key used during grace period" - ) - except Exception as deprecated_lookup_error: - verbose_proxy_logger.debug( - "Deprecated key lookup skipped: %s", - deprecated_lookup_error, - ) if response is not None: if response["team_models"] is None: diff --git a/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py b/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py index 1f5fab71ef3..002b015d960 100644 --- a/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py +++ b/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py @@ -248,9 +248,9 @@ class TestKeyRotationManager: assert call_args[1]["where"]["revoke_at"]["lt"] is not None @pytest.mark.asyncio - async def test_rotate_key_passes_grace_period_hours(self): + async def test_rotate_key_passes_grace_period(self): """ - Test that _rotate_key passes grace_period_hours in RegenerateKeyRequest. + Test that _rotate_key passes grace_period in RegenerateKeyRequest. """ mock_prisma_client = AsyncMock() manager = KeyRotationManager(mock_prisma_client) @@ -281,12 +281,12 @@ class TestKeyRotationManager: new_callable=AsyncMock, ): with patch( - "litellm.proxy.common_utils.key_rotation_manager.LITELLM_KEY_ROTATION_GRACE_PERIOD_HOURS", - 48, + "litellm.proxy.common_utils.key_rotation_manager.LITELLM_KEY_ROTATION_GRACE_PERIOD", + "48h", ): await manager._rotate_key(key_to_rotate) mock_regenerate.assert_called_once() call_args = mock_regenerate.call_args regenerate_request = call_args[1]["data"] - assert regenerate_request.grace_period_hours == 48 + assert regenerate_request.grace_period == "48h" diff --git a/ui/litellm-dashboard/src/components/organisms/regenerate_key_modal.tsx b/ui/litellm-dashboard/src/components/organisms/regenerate_key_modal.tsx index 3cea198c62a..2fad101c20f 100644 --- a/ui/litellm-dashboard/src/components/organisms/regenerate_key_modal.tsx +++ b/ui/litellm-dashboard/src/components/organisms/regenerate_key_modal.tsx @@ -37,7 +37,7 @@ export function RegenerateKeyModal({ selectedToken, visible, onClose, onKeyUpdat tpm_limit: selectedToken.tpm_limit, rpm_limit: selectedToken.rpm_limit, duration: selectedToken.duration || "", - grace_period_hours: 0, + grace_period: "", }); // Initialize the current access token @@ -225,15 +225,21 @@ export function RegenerateKeyModal({ selectedToken, visible, onClose, onKeyUpdat {newExpiryTime &&
New expiry: {newExpiryTime}
} - +
- Recommended: 24-72 hours for production keys to allow seamless client migration. + Recommended: 24h to 72h for production keys to allow seamless client migration.
)} From 37fc4a35ff9b33babfcdd17bc6abe06fa4f508ca Mon Sep 17 00:00:00 2001 From: Harshit Jain <48647625+Harshit28j@users.noreply.github.com> Date: Sat, 14 Feb 2026 04:27:13 +0530 Subject: [PATCH 021/182] Update tests/test_litellm/proxy/management_endpoints/test_ui_sso.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- tests/test_litellm/proxy/management_endpoints/test_ui_sso.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py index 016131f24dc..097d5f34702 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py +++ b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py @@ -3205,7 +3205,7 @@ class TestPKCEFunctionality: stored_key = "pkce_verifier:multi_pod_state_xyz" assert stored_key in mock_redis._store stored_value = mock_redis._store[stored_key] - assert isinstance(stored_value, str) and len(stored_value) == 43 + assert isinstance(stored_value, str) and len(json.loads(stored_value)) == 43 # Pod B: callback with same state, retrieve from "Redis" mock_request = MagicMock(spec=Request) From f33a7ca7d6db05a0860dda17a352704ec88806e0 Mon Sep 17 00:00:00 2001 From: Harshit Jain Date: Sat, 14 Feb 2026 04:34:58 +0530 Subject: [PATCH 022/182] fix: as per request changes --- .../proxy/common_utils/key_rotation_manager.py | 4 ++-- litellm/proxy/utils.py | 18 ++++++++++++++++-- .../common_utils/test_key_rotation_manager.py | 6 +++--- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/litellm/proxy/common_utils/key_rotation_manager.py b/litellm/proxy/common_utils/key_rotation_manager.py index 88fd08f6ab4..5a0a1fabc7d 100644 --- a/litellm/proxy/common_utils/key_rotation_manager.py +++ b/litellm/proxy/common_utils/key_rotation_manager.py @@ -112,9 +112,9 @@ class KeyRotationManager: result = await self.prisma_client.db.litellm_deprecatedverificationtoken.delete_many( where={"revoke_at": {"lt": now}} ) - if result.get("count", 0) > 0: + if result > 0: verbose_proxy_logger.debug( - "Cleaned up %s expired deprecated key(s)", result["count"] + "Cleaned up %s expired deprecated key(s)", result ) except Exception as e: verbose_proxy_logger.debug( diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 528415c891d..4084284f7d0 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -76,6 +76,7 @@ from litellm import ( from litellm._logging import verbose_proxy_logger from litellm._service_logger import ServiceLogging, ServiceTypes from litellm.caching.caching import DualCache, RedisCache +from litellm.caching.dual_cache import LimitedSizeOrderedDict from litellm.exceptions import RejectedRequestError from litellm.integrations.custom_guardrail import CustomGuardrail from litellm.integrations.custom_logger import CustomLogger @@ -2033,7 +2034,8 @@ def jsonify_object(data: dict) -> dict: # In-memory cache for deprecated key lookups: maps old_token_hash -> (active_token_id, expires_at_ts) # Avoids a DB query on every auth request for non-deprecated keys. -_deprecated_key_cache: Dict[str, tuple] = {} +# Bounded to prevent memory leaks from accumulated rotations. +_deprecated_key_cache: LimitedSizeOrderedDict = LimitedSizeOrderedDict(max_size=1000) _DEPRECATED_KEY_CACHE_TTL_SECONDS = 60 @@ -2073,6 +2075,11 @@ async def _lookup_deprecated_key( now_ts + _DEPRECATED_KEY_CACHE_TTL_SECONDS, ) return deprecated_row.active_token_id + # Cache negative result to avoid repeated DB lookups for invalid tokens + _deprecated_key_cache[hashed_token] = ( + None, + now_ts + _DEPRECATED_KEY_CACHE_TTL_SECONDS, + ) except Exception as e: verbose_proxy_logger.debug("Deprecated key lookup skipped: %s", e) @@ -2414,6 +2421,7 @@ class PrismaClient: parent_otel_span: Optional[Span] = None, proxy_logging_obj: Optional[ProxyLogging] = None, budget_id_list: Optional[List[str]] = None, + check_deprecated: bool = True, ): args_passed_in = locals() start_time = time.time() @@ -2712,7 +2720,12 @@ class PrismaClient: ) # If not found in main table, check deprecated keys (grace period) - if response is None and hashed_token is not None: + # check_deprecated=False on the recursive call prevents unbounded chaining + if ( + response is None + and hashed_token is not None + and check_deprecated + ): active_token_id = await _lookup_deprecated_key( db=self.db, hashed_token=hashed_token ) @@ -2723,6 +2736,7 @@ class PrismaClient: query_type="find_unique", parent_otel_span=parent_otel_span, proxy_logging_obj=proxy_logging_obj, + check_deprecated=False, ) if response is not None: verbose_proxy_logger.debug( diff --git a/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py b/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py index 002b015d960..24828cdff36 100644 --- a/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py +++ b/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py @@ -233,9 +233,9 @@ class TestKeyRotationManager: Test that _cleanup_expired_deprecated_keys deletes expired deprecated keys. """ mock_prisma_client = AsyncMock() - mock_prisma_client.db.litellm_deprecatedverificationtoken.delete_many.return_value = { - "count": 3 - } + mock_prisma_client.db.litellm_deprecatedverificationtoken.delete_many.return_value = ( + 3 + ) manager = KeyRotationManager(mock_prisma_client) await manager._cleanup_expired_deprecated_keys() From d90f3d558ed7fd38df4912309b7803ca6641f475 Mon Sep 17 00:00:00 2001 From: Harshit Jain <48647625+Harshit28j@users.noreply.github.com> Date: Sat, 14 Feb 2026 08:46:07 +0530 Subject: [PATCH 023/182] Update litellm/proxy/utils.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- litellm/proxy/utils.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 4084284f7d0..f7e32869a23 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -2075,11 +2075,8 @@ async def _lookup_deprecated_key( now_ts + _DEPRECATED_KEY_CACHE_TTL_SECONDS, ) return deprecated_row.active_token_id - # Cache negative result to avoid repeated DB lookups for invalid tokens - _deprecated_key_cache[hashed_token] = ( - None, - now_ts + _DEPRECATED_KEY_CACHE_TTL_SECONDS, - ) + # Only cache positive results; negative lookups are fast on indexed columns + # and caching them risks evicting real deprecated key entries. except Exception as e: verbose_proxy_logger.debug("Deprecated key lookup skipped: %s", e) From bac6d1127c15f6a1246ee1536a62140c32d41697 Mon Sep 17 00:00:00 2001 From: Ephrim Stanley Date: Fri, 13 Feb 2026 22:18:19 -0500 Subject: [PATCH 024/182] Fix errors when callbacks are invoked for file delete operations: --- litellm/integrations/s3_v2.py | 6 ++- .../proxy/hooks/proxy_track_cost_callback.py | 6 +++ tests/test_litellm/integrations/test_s3_v2.py | 45 +++++++++++++++++++ .../hooks/test_proxy_track_cost_callback.py | 41 +++++++++++++++++ 4 files changed, 97 insertions(+), 1 deletion(-) diff --git a/litellm/integrations/s3_v2.py b/litellm/integrations/s3_v2.py index 534b85e4752..e847ce27476 100644 --- a/litellm/integrations/s3_v2.py +++ b/litellm/integrations/s3_v2.py @@ -248,7 +248,11 @@ class S3Logger(CustomBatchLogger, BaseAWSLLM): ) if s3_batch_logging_element is None: - raise ValueError("s3_batch_logging_element is None") + verbose_logger.debug( + "s3 Logging - skipping event, no standard_logging_object for call_type=%s", + kwargs.get("call_type", "unknown"), + ) + return verbose_logger.debug( "\ns3 Logger - Logging payload = %s", s3_batch_logging_element diff --git a/litellm/proxy/hooks/proxy_track_cost_callback.py b/litellm/proxy/hooks/proxy_track_cost_callback.py index 37b79e6d065..ffc9dbd2372 100644 --- a/litellm/proxy/hooks/proxy_track_cost_callback.py +++ b/litellm/proxy/hooks/proxy_track_cost_callback.py @@ -202,6 +202,12 @@ class _ProxyDBLogger(CustomLogger): max_budget=end_user_max_budget, ) else: + if sl_object is None and kwargs.get("model") is None: + verbose_proxy_logger.warning( + "Cost tracking - skipping, no standard_logging_object and no model for call_type=%s", + kwargs.get("call_type", "unknown"), + ) + return if kwargs.get("stream") is not True or ( kwargs.get("stream") is True and "complete_streaming_response" in kwargs ): diff --git a/tests/test_litellm/integrations/test_s3_v2.py b/tests/test_litellm/integrations/test_s3_v2.py index 0a3523699a9..51fec288f6e 100644 --- a/tests/test_litellm/integrations/test_s3_v2.py +++ b/tests/test_litellm/integrations/test_s3_v2.py @@ -157,6 +157,51 @@ class TestS3V2UnitTests: assert result == {"downloaded": "data"} +@pytest.mark.asyncio +async def test_async_log_event_skips_when_standard_logging_object_missing(): + """ + Reproduces the bug where _async_log_event_base raises ValueError when + kwargs has no standard_logging_object (e.g. call_type=afile_delete). + + The S3 logger should skip gracefully, not raise. + """ + logger = S3Logger( + s3_bucket_name="test-bucket", + s3_region_name="us-east-1", + s3_aws_access_key_id="fake", + s3_aws_secret_access_key="fake", + ) + + kwargs_without_slo = { + "call_type": "afile_delete", + "model": None, + "litellm_call_id": "test-call-id", + } + + start_time = datetime.utcnow() + end_time = datetime.utcnow() + + # Spy on handle_callback_failure — should NOT be called if we skip gracefully. + # Without the fix, the ValueError is caught by the except block which calls + # handle_callback_failure. With the fix, we return early and never hit except. + with patch.object(logger, "handle_callback_failure") as mock_failure: + await logger._async_log_event_base( + kwargs=kwargs_without_slo, + response_obj=None, + start_time=start_time, + end_time=end_time, + ) + + assert not mock_failure.called, ( + "handle_callback_failure should not be called — " + "missing standard_logging_object should be a graceful skip, not an error" + ) + + # Nothing should have been queued (catches the case where code falls + # through without returning and appends None to the queue) + assert len(logger.log_queue) == 0, "log_queue should be empty when standard_logging_object is missing" + + @pytest.mark.asyncio async def test_strip_base64_removes_file_and_nontext_entries(): logger = S3Logger(s3_strip_base64_files=True) diff --git a/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py b/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py index cb6d90103f7..46da6a89cb2 100644 --- a/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py +++ b/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py @@ -126,3 +126,44 @@ async def test_async_post_call_failure_hook_non_llm_route(): # Assert that update_database was NOT called for non-LLM routes mock_update_database.assert_not_called() + + +@pytest.mark.asyncio +async def test_track_cost_callback_skips_when_no_standard_logging_object(): + """ + Reproduces the bug where _PROXY_track_cost_callback raises + 'Cost tracking failed for model=None' when kwargs has no + standard_logging_object (e.g. call_type=afile_delete). + + File operations have no model and no standard_logging_object. + The callback should skip gracefully instead of raising. + """ + logger = _ProxyDBLogger() + + kwargs = { + "call_type": "afile_delete", + "model": None, + "litellm_call_id": "test-call-id", + "litellm_params": {}, + "stream": False, + } + + with patch( + "litellm.proxy.proxy_server.proxy_logging_obj", + ) as mock_proxy_logging: + mock_proxy_logging.failed_tracking_alert = AsyncMock() + mock_proxy_logging.db_spend_update_writer = MagicMock() + mock_proxy_logging.db_spend_update_writer.update_database = AsyncMock() + + await logger._PROXY_track_cost_callback( + kwargs=kwargs, + completion_response=None, + start_time=datetime.now(), + end_time=datetime.now(), + ) + + # update_database should NOT be called — nothing to track + mock_proxy_logging.db_spend_update_writer.update_database.assert_not_called() + + # failed_tracking_alert should NOT be called — this is not an error + mock_proxy_logging.failed_tracking_alert.assert_not_called() From cd148dcb82159bbe94e95892af039439e87974db Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 13 Feb 2026 20:01:25 -0800 Subject: [PATCH 025/182] added access groups permission checks --- litellm/constants.py | 3 + litellm/proxy/_types.py | 15 + .../auth/agent_permission_handler.py | 100 ++++-- litellm/proxy/auth/auth_checks.py | 305 ++++++++++++++++-- litellm/proxy/auth/handle_jwt.py | 2 +- .../access_group_endpoints.py | 62 +++- .../key_management_endpoints.py | 8 +- tests/proxy_unit_tests/test_auth_checks.py | 2 +- .../test_key_management_endpoints.py | 10 +- 9 files changed, 451 insertions(+), 56 deletions(-) diff --git a/litellm/constants.py b/litellm/constants.py index addd659be73..650896e7437 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -1342,6 +1342,9 @@ SPECIAL_LITELLM_AUTH_TOKEN = ["ui-token"] DEFAULT_MANAGEMENT_OBJECT_IN_MEMORY_CACHE_TTL = int( os.getenv("DEFAULT_MANAGEMENT_OBJECT_IN_MEMORY_CACHE_TTL", 60) ) +DEFAULT_ACCESS_GROUP_CACHE_TTL = int( + os.getenv("DEFAULT_ACCESS_GROUP_CACHE_TTL", 600) +) # Sentry Scrubbing Configuration SENTRY_DENYLIST = [ diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 45476900a26..aa8b67440cf 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -2563,6 +2563,21 @@ class LiteLLM_TagTable(LiteLLMPydanticObjectBase): model_config = ConfigDict(protected_namespaces=()) +class LiteLLM_AccessGroupTable(LiteLLMPydanticObjectBase): + access_group_id: str + access_group_name: str + description: Optional[str] = None + access_model_names: List[str] = [] + access_mcp_server_ids: List[str] = [] + access_agent_ids: List[str] = [] + assigned_team_ids: List[str] = [] + assigned_key_ids: List[str] = [] + created_at: Optional[datetime] = None + created_by: Optional[str] = None + updated_at: Optional[datetime] = None + updated_by: Optional[str] = None + + class LiteLLM_SpendLogs(LiteLLMPydanticObjectBase): request_id: str api_key: str diff --git a/litellm/proxy/agent_endpoints/auth/agent_permission_handler.py b/litellm/proxy/agent_endpoints/auth/agent_permission_handler.py index bf3256cf47b..5ffe598a065 100644 --- a/litellm/proxy/agent_endpoints/auth/agent_permission_handler.py +++ b/litellm/proxy/agent_endpoints/auth/agent_permission_handler.py @@ -145,7 +145,10 @@ class AgentRequestHandler: user_api_key_auth: Optional[UserAPIKeyAuth] = None, ) -> List[str]: """ - Get allowed agents for a key from its object_permission. + Get allowed agents for a key. + + 1. First checks native key-level agent permissions (object_permission) + 2. Also includes agents from key's access_group_ids (unified access groups) Note: object_permission is already loaded by get_key_object() in main auth flow. """ @@ -153,25 +156,37 @@ class AgentRequestHandler: return [] try: - # Get key object permission (already loaded in main auth flow) + all_agents: List[str] = [] + + # 1. Get agents from object_permission (native permissions) key_object_permission = AgentRequestHandler._get_key_object_permission( user_api_key_auth ) - if key_object_permission is None: - return [] + if key_object_permission is not None: + # Get direct agents + direct_agents = key_object_permission.agents or [] - # Get direct agents - direct_agents = key_object_permission.agents or [] - - # Get agents from access groups - access_group_agents = ( - await AgentRequestHandler._get_agents_from_access_groups( - key_object_permission.agent_access_groups or [] + # Get agents from access groups + access_group_agents = ( + await AgentRequestHandler._get_agents_from_access_groups( + key_object_permission.agent_access_groups or [] + ) ) - ) - # Combine both lists - all_agents = direct_agents + access_group_agents + all_agents = direct_agents + access_group_agents + + # 2. Fallback: get agent IDs from key's access_group_ids (unified access groups) + key_access_group_ids = user_api_key_auth.access_group_ids or [] + if key_access_group_ids: + from litellm.proxy.auth.auth_checks import ( + _get_agent_ids_from_access_groups, + ) + + unified_agents = await _get_agent_ids_from_access_groups( + access_group_ids=key_access_group_ids, + ) + all_agents.extend(unified_agents) + return list(set(all_agents)) except Exception as e: verbose_logger.warning(f"Failed to get allowed agents for key: {str(e)}") @@ -182,7 +197,10 @@ class AgentRequestHandler: user_api_key_auth: Optional[UserAPIKeyAuth] = None, ) -> List[str]: """ - Get allowed agents for a team from its object_permission. + Get allowed agents for a team. + + 1. First checks native team-level agent permissions (object_permission) + 2. Also includes agents from team's access_group_ids (unified access groups) Note: object_permission is already loaded by get_team_object() in main auth flow. """ @@ -193,26 +211,54 @@ class AgentRequestHandler: return [] try: - # Get team object permission (already loaded in main auth flow) + all_agents: List[str] = [] + + # 1. Get agents from object_permission (native permissions) object_permissions = await AgentRequestHandler._get_team_object_permission( user_api_key_auth ) - if object_permissions is None: - return [] + if object_permissions is not None: + # Get direct agents + direct_agents = object_permissions.agents or [] - # Get direct agents - direct_agents = object_permissions.agents or [] - - # Get agents from access groups - access_group_agents = ( - await AgentRequestHandler._get_agents_from_access_groups( - object_permissions.agent_access_groups or [] + # Get agents from access groups + access_group_agents = ( + await AgentRequestHandler._get_agents_from_access_groups( + object_permissions.agent_access_groups or [] + ) ) + + all_agents = direct_agents + access_group_agents + + # 2. Fallback: get agent IDs from team's access_group_ids (unified access groups) + from litellm.proxy.auth.auth_checks import get_team_object + from litellm.proxy.proxy_server import ( + prisma_client, + proxy_logging_obj, + user_api_key_cache, ) - # Combine both lists - all_agents = direct_agents + access_group_agents + if prisma_client is not None: + team_obj = await get_team_object( + team_id=user_api_key_auth.team_id, + prisma_client=prisma_client, + user_api_key_cache=user_api_key_cache, + parent_otel_span=user_api_key_auth.parent_otel_span, + proxy_logging_obj=proxy_logging_obj, + ) + if team_obj is not None: + team_access_group_ids = team_obj.access_group_ids or [] + if team_access_group_ids: + from litellm.proxy.auth.auth_checks import ( + _get_agent_ids_from_access_groups, + ) + + unified_agents = await _get_agent_ids_from_access_groups( + access_group_ids=team_access_group_ids, + ) + all_agents.extend(unified_agents) + return list(set(all_agents)) except Exception as e: verbose_logger.warning(f"Failed to get allowed agents for team: {str(e)}") diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.py index 76ec67ab10e..a4ec2b34c41 100644 --- a/litellm/proxy/auth/auth_checks.py +++ b/litellm/proxy/auth/auth_checks.py @@ -23,6 +23,7 @@ from litellm.caching.dual_cache import LimitedSizeOrderedDict from litellm.constants import ( CLI_JWT_EXPIRATION_HOURS, CLI_JWT_TOKEN_NAME, + DEFAULT_ACCESS_GROUP_CACHE_TTL, DEFAULT_IN_MEMORY_TTL, DEFAULT_MANAGEMENT_OBJECT_IN_MEMORY_CACHE_TTL, DEFAULT_MAX_RECURSE_DEPTH, @@ -32,6 +33,7 @@ from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider from litellm.proxy._types import ( RBAC_ROLES, CallInfo, + LiteLLM_AccessGroupTable, LiteLLM_BudgetTable, LiteLLM_EndUserTable, Litellm_EntityType, @@ -210,7 +212,7 @@ async def common_checks( # 2. If team can call model if _model and team_object: - if not can_team_access_model( + if not await can_team_access_model( model=_model, team_object=team_object, llm_router=llm_router, @@ -1499,6 +1501,110 @@ async def get_team_object( ) +async def _cache_access_object( + access_group_id: str, + access_group_table: LiteLLM_AccessGroupTable, + user_api_key_cache: DualCache, + proxy_logging_obj: Optional[ProxyLogging] = None, +): + key = "access_group_id:{}".format(access_group_id) + await user_api_key_cache.async_set_cache( + key=key, + value=access_group_table, + ttl=DEFAULT_ACCESS_GROUP_CACHE_TTL, + ) + + +async def _delete_cache_access_object( + access_group_id: str, + user_api_key_cache: DualCache, + proxy_logging_obj: Optional[ProxyLogging] = None, +): + key = "access_group_id:{}".format(access_group_id) + + user_api_key_cache.delete_cache(key=key) + + ## UPDATE REDIS CACHE ## + if proxy_logging_obj is not None: + await proxy_logging_obj.internal_usage_cache.dual_cache.async_delete_cache( + key=key + ) + + +@log_db_metrics +async def get_access_object( + access_group_id: str, + prisma_client: Optional[PrismaClient], + user_api_key_cache: DualCache, + proxy_logging_obj: Optional[ProxyLogging] = None, +) -> LiteLLM_AccessGroupTable: + """ + - Check if access_group_id in proxy AccessGroupTable + - Always checks cache first, then DB only when not found in cache + - if valid, return LiteLLM_AccessGroupTable object + - if not, then raise an error + + Unlike get_team_object, this has no check_cache_only or check_db_only flags; + it always follows cache-first-then-db semantics. + + Raises: + - HTTPException: If access group doesn't exist in db or cache (status_code=404) + """ + if prisma_client is None: + raise Exception( + "No DB Connected. See - https://docs.litellm.ai/docs/proxy/virtual_keys" + ) + + key = "access_group_id:{}".format(access_group_id) + + # Always check cache first + cached_access_obj = await user_api_key_cache.async_get_cache(key=key) + if cached_access_obj is not None: + if isinstance(cached_access_obj, dict): + return LiteLLM_AccessGroupTable(**cached_access_obj) + elif isinstance(cached_access_obj, LiteLLM_AccessGroupTable): + return cached_access_obj + + # Not in cache - fetch from DB + try: + response = await prisma_client.db.litellm_accessgrouptable.find_unique( + where={"access_group_id": access_group_id} + ) + + if response is None: + raise HTTPException( + status_code=404, + detail={ + "error": f"Access group doesn't exist in db. Access group={access_group_id}." + }, + ) + + _response = LiteLLM_AccessGroupTable(**response.dict()) + + # Save to cache + await _cache_access_object( + access_group_id=access_group_id, + access_group_table=_response, + user_api_key_cache=user_api_key_cache, + proxy_logging_obj=proxy_logging_obj, + ) + + return _response + except HTTPException: + raise + except Exception as e: + verbose_proxy_logger.exception( + "Error getting access group for access_group_id: %s", + access_group_id, + ) + raise HTTPException( + status_code=404, + detail={ + "error": f"Access group doesn't exist in db. Access group={access_group_id}. Error: {e}" + }, + ) + + @log_db_metrics async def get_team_object_by_alias( team_alias: str, @@ -2013,6 +2119,126 @@ async def get_org_object( ) +async def _get_resources_from_access_groups( + access_group_ids: List[str], + resource_field: Literal[ + "access_model_names", "access_mcp_server_ids", "access_agent_ids" + ], + prisma_client: Optional[PrismaClient] = None, + user_api_key_cache: Optional[DualCache] = None, + proxy_logging_obj: Optional[ProxyLogging] = None, +) -> List[str]: + """ + Fetch access groups by their IDs (from cache or DB) and collect + the specified resource field across all of them. + + Args: + access_group_ids: List of access group IDs to fetch + resource_field: Which resource list to extract from each access group + - "access_model_names": model names (for model access checks) + - "access_mcp_server_ids": MCP server IDs (for MCP access checks) + - "access_agent_ids": agent IDs (for agent access checks) + prisma_client: Optional PrismaClient (lazy-imported from proxy_server if None) + user_api_key_cache: Optional DualCache (lazy-imported from proxy_server if None) + proxy_logging_obj: Optional ProxyLogging (lazy-imported from proxy_server if None) + + Returns: + Deduplicated list of resource identifiers from all resolved access groups. + """ + if not access_group_ids: + return [] + + # Lazy import to avoid circular imports + if prisma_client is None or user_api_key_cache is None: + from litellm.proxy.proxy_server import ( + prisma_client as _prisma_client, + proxy_logging_obj as _proxy_logging_obj, + user_api_key_cache as _user_api_key_cache, + ) + + prisma_client = prisma_client or _prisma_client + user_api_key_cache = user_api_key_cache or _user_api_key_cache + proxy_logging_obj = proxy_logging_obj or _proxy_logging_obj + + if user_api_key_cache is None: + return [] + + resources: List[str] = [] + for ag_id in access_group_ids: + try: + ag = await get_access_object( + access_group_id=ag_id, + prisma_client=prisma_client, + user_api_key_cache=user_api_key_cache, + proxy_logging_obj=proxy_logging_obj, + ) + resources.extend(getattr(ag, resource_field, [])) + except Exception: + verbose_proxy_logger.debug( + "Could not fetch access group %s for resource field %s", + ag_id, + resource_field, + ) + return list(set(resources)) + + +async def _get_models_from_access_groups( + access_group_ids: List[str], + prisma_client: Optional[PrismaClient] = None, + user_api_key_cache: Optional[DualCache] = None, + proxy_logging_obj: Optional[ProxyLogging] = None, +) -> List[str]: + """ + Collect model names from unified access groups. + Models are matched by model name for backwards compatibility. + """ + return await _get_resources_from_access_groups( + access_group_ids=access_group_ids, + resource_field="access_model_names", + prisma_client=prisma_client, + user_api_key_cache=user_api_key_cache, + proxy_logging_obj=proxy_logging_obj, + ) + + +async def _get_mcp_server_ids_from_access_groups( + access_group_ids: List[str], + prisma_client: Optional[PrismaClient] = None, + user_api_key_cache: Optional[DualCache] = None, + proxy_logging_obj: Optional[ProxyLogging] = None, +) -> List[str]: + """ + Collect MCP server IDs from unified access groups. + MCPs are matched by server ID. + """ + return await _get_resources_from_access_groups( + access_group_ids=access_group_ids, + resource_field="access_mcp_server_ids", + prisma_client=prisma_client, + user_api_key_cache=user_api_key_cache, + proxy_logging_obj=proxy_logging_obj, + ) + + +async def _get_agent_ids_from_access_groups( + access_group_ids: List[str], + prisma_client: Optional[PrismaClient] = None, + user_api_key_cache: Optional[DualCache] = None, + proxy_logging_obj: Optional[ProxyLogging] = None, +) -> List[str]: + """ + Collect agent IDs from unified access groups. + Agents are matched by agent ID. + """ + return await _get_resources_from_access_groups( + access_group_ids=access_group_ids, + resource_field="access_agent_ids", + prisma_client=prisma_client, + user_api_key_cache=user_api_key_cache, + proxy_logging_obj=proxy_logging_obj, + ) + + def _check_model_access_helper( model: str, llm_router: Optional[Router], @@ -2165,20 +2391,41 @@ async def can_key_call_model( """ Checks if token can call a given model + 1. First checks native key-level model permissions (current implementation) + 2. If not allowed natively, falls back to access_group_ids on the key + Returns: - True: if token allowed to call model Raises: - Exception: If token not allowed to call model """ - return _can_object_call_model( - model=model, - llm_router=llm_router, - models=valid_token.models, - team_model_aliases=valid_token.team_model_aliases, - team_id=valid_token.team_id, - object_type="key", - ) + try: + return _can_object_call_model( + model=model, + llm_router=llm_router, + models=valid_token.models, + team_model_aliases=valid_token.team_model_aliases, + team_id=valid_token.team_id, + object_type="key", + ) + except ProxyException: + # Fallback: check key's access_group_ids + key_access_group_ids = valid_token.access_group_ids or [] + if key_access_group_ids: + models_from_groups = await _get_models_from_access_groups( + access_group_ids=key_access_group_ids, + ) + if models_from_groups: + return _can_object_call_model( + model=model, + llm_router=llm_router, + models=models_from_groups, + team_model_aliases=valid_token.team_model_aliases, + team_id=valid_token.team_id, + object_type="key", + ) + raise def can_org_access_model( @@ -2200,7 +2447,7 @@ def can_org_access_model( ) -def can_team_access_model( +async def can_team_access_model( model: Union[str, List[str]], team_object: Optional[LiteLLM_TeamTable], llm_router: Optional[Router], @@ -2209,15 +2456,37 @@ def can_team_access_model( """ Returns True if the team can access a specific model. + 1. First checks native team-level model permissions (current implementation) + 2. If not allowed natively, falls back to access_group_ids on the team """ - return _can_object_call_model( - model=model, - llm_router=llm_router, - models=team_object.models if team_object else [], - team_model_aliases=team_model_aliases, - team_id=team_object.team_id if team_object else None, - object_type="team", - ) + try: + return _can_object_call_model( + model=model, + llm_router=llm_router, + models=team_object.models if team_object else [], + team_model_aliases=team_model_aliases, + team_id=team_object.team_id if team_object else None, + object_type="team", + ) + except ProxyException: + # Fallback: check team's access_group_ids + team_access_group_ids = ( + team_object.access_group_ids or [] if team_object else [] + ) + if team_access_group_ids: + models_from_groups = await _get_models_from_access_groups( + access_group_ids=team_access_group_ids, + ) + if models_from_groups: + return _can_object_call_model( + model=model, + llm_router=llm_router, + models=models_from_groups, + team_model_aliases=team_model_aliases, + team_id=team_object.team_id if team_object else None, + object_type="team", + ) + raise async def can_user_call_model( diff --git a/litellm/proxy/auth/handle_jwt.py b/litellm/proxy/auth/handle_jwt.py index 15056cf64e6..9ae09842a0d 100644 --- a/litellm/proxy/auth/handle_jwt.py +++ b/litellm/proxy/auth/handle_jwt.py @@ -964,7 +964,7 @@ class JWTAuthManager: team_models = team_object.models if isinstance(team_models, list) and ( not requested_model - or can_team_access_model( + or await can_team_access_model( model=requested_model, team_object=team_object, llm_router=llm_router, diff --git a/litellm/proxy/management_endpoints/access_group_endpoints.py b/litellm/proxy/management_endpoints/access_group_endpoints.py index 100b1d2659b..737d54beb1c 100644 --- a/litellm/proxy/management_endpoints/access_group_endpoints.py +++ b/litellm/proxy/management_endpoints/access_group_endpoints.py @@ -3,7 +3,16 @@ from typing import List from fastapi import APIRouter, Depends, HTTPException, status from litellm._logging import verbose_proxy_logger -from litellm.proxy._types import CommonProxyErrors, LitellmUserRoles, UserAPIKeyAuth +from litellm.proxy._types import ( + CommonProxyErrors, + LiteLLM_AccessGroupTable, + LitellmUserRoles, + UserAPIKeyAuth, +) +from litellm.proxy.auth.auth_checks import ( + _cache_access_object, + _delete_cache_access_object, +) from litellm.proxy.auth.user_api_key_auth import user_api_key_auth from litellm.proxy.db.exception_handler import PrismaDBExceptionHandler from litellm.proxy.utils import get_prisma_client_or_throw @@ -43,6 +52,45 @@ def _record_to_response(record) -> AccessGroupResponse: ) +def _record_to_access_group_table(record) -> LiteLLM_AccessGroupTable: + """Convert a Prisma record to a LiteLLM_AccessGroupTable pydantic object for caching.""" + return LiteLLM_AccessGroupTable(**record.dict()) + + +async def _cache_access_group_record(record) -> None: + """ + Cache an access group Prisma record in the user_api_key_cache. + + Uses a lazy import of user_api_key_cache and proxy_logging_obj from proxy_server + to avoid circular imports, following the same pattern as key_management_endpoints. + """ + from litellm.proxy.proxy_server import proxy_logging_obj, user_api_key_cache + + access_group_table = _record_to_access_group_table(record) + await _cache_access_object( + access_group_id=record.access_group_id, + access_group_table=access_group_table, + user_api_key_cache=user_api_key_cache, + proxy_logging_obj=proxy_logging_obj, + ) + + +async def _invalidate_cache_access_group(access_group_id: str) -> None: + """ + Invalidate (delete) an access group entry from both in-memory and Redis caches. + + Uses a lazy import of user_api_key_cache and proxy_logging_obj from proxy_server + to avoid circular imports, following the same pattern as key_management_endpoints. + """ + from litellm.proxy.proxy_server import proxy_logging_obj, user_api_key_cache + + await _delete_cache_access_object( + access_group_id=access_group_id, + user_api_key_cache=user_api_key_cache, + proxy_logging_obj=proxy_logging_obj, + ) + + @router.post( "/v1/access_group", response_model=AccessGroupResponse, @@ -87,6 +135,10 @@ async def create_access_group( detail=f"Access group '{data.access_group_name}' already exists", ) raise + + # Cache the newly created access group for read-heavy access patterns + await _cache_access_group_record(record) + return _record_to_response(record) @@ -166,6 +218,10 @@ async def update_access_group( detail=f"Access group '{update_data.get('access_group_name', '')}' already exists", ) raise + + # Write the updated record into cache (same key, overwrites stale entry) + await _cache_access_group_record(record) + return _record_to_response(record) @@ -215,6 +271,10 @@ async def delete_access_group( await tx.litellm_accessgrouptable.delete( where={"access_group_id": access_group_id} ) + + # Invalidate the deleted access group from cache + await _invalidate_cache_access_group(access_group_id) + except HTTPException: raise except Exception as e: diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index d15c51afe7b..78cd7dcbf80 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -1598,7 +1598,7 @@ async def _process_single_key_update( status_code=500, detail={"error": "Team object not found for team change validation"}, ) - validate_key_team_change( + await validate_key_team_change( key=existing_key_row, team=team_obj, change_initiated_by=user_api_key_dict, @@ -1826,7 +1826,7 @@ async def update_key_fn( "error": "Team object not found for team change validation" }, ) - validate_key_team_change( + await validate_key_team_change( key=existing_key_row, team=team_obj, change_initiated_by=user_api_key_dict, @@ -2060,7 +2060,7 @@ async def bulk_update_keys( ) -def validate_key_team_change( +async def validate_key_team_change( key: LiteLLM_VerificationToken, team: LiteLLM_TeamTable, change_initiated_by: UserAPIKeyAuth, @@ -2077,7 +2077,7 @@ def validate_key_team_change( # Check if the team has access to the key's models if len(key.models) > 0: for model in key.models: - can_team_access_model( + await can_team_access_model( model=model, team_object=team, llm_router=llm_router, diff --git a/tests/proxy_unit_tests/test_auth_checks.py b/tests/proxy_unit_tests/test_auth_checks.py index 66dfc8d15d5..7adf3251f59 100644 --- a/tests/proxy_unit_tests/test_auth_checks.py +++ b/tests/proxy_unit_tests/test_auth_checks.py @@ -413,7 +413,7 @@ async def test_can_team_access_model(model, team_models, expect_to_work): team_id="test-team", models=team_models, ) - result = can_team_access_model( + result = await can_team_access_model( model=model, team_object=team_object, llm_router=None, diff --git a/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py index 39f8d1cccb0..ad5819df1c7 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py @@ -1356,14 +1356,15 @@ async def test_unblock_key_invalid_key_format(monkeypatch): assert "Invalid key format" in str(exc_info.value.message) -def test_validate_key_team_change_with_member_permissions(): +@pytest.mark.asyncio +async def test_validate_key_team_change_with_member_permissions(): """ Test validate_key_team_change function with team member permissions. This test covers the new logic that allows team members with specific permissions to update keys, not just team admins. """ - from unittest.mock import MagicMock, patch + from unittest.mock import AsyncMock, MagicMock, patch from litellm.proxy._types import KeyManagementRoutes @@ -1389,7 +1390,8 @@ def test_validate_key_team_change_with_member_permissions(): mock_member_object = MagicMock() with patch( - "litellm.proxy.management_endpoints.key_management_endpoints.can_team_access_model" + "litellm.proxy.management_endpoints.key_management_endpoints.can_team_access_model", + new_callable=AsyncMock, ): with patch( "litellm.proxy.management_endpoints.key_management_endpoints._get_user_in_team" @@ -1406,7 +1408,7 @@ def test_validate_key_team_change_with_member_permissions(): mock_has_perms.return_value = True # This should not raise an exception due to member permissions - validate_key_team_change( + await validate_key_team_change( key=mock_key, team=mock_team, change_initiated_by=mock_change_initiator, From 1b6a7ed6c1b20ce6119d2b7978b6a388dae23f01 Mon Sep 17 00:00:00 2001 From: Ephrim Stanley Date: Fri, 13 Feb 2026 23:30:22 -0500 Subject: [PATCH 026/182] Fix errors when callbacks are invoked for file operations --- litellm/_service_logger.py | 2 +- .../proxy/hooks/proxy_track_cost_callback.py | 2 +- .../hooks/test_proxy_track_cost_callback.py | 33 +++++++ tests/test_litellm/test_service_logger.py | 97 +++++++++++++++++++ 4 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 tests/test_litellm/test_service_logger.py diff --git a/litellm/_service_logger.py b/litellm/_service_logger.py index b67d0d86063..e2759e4fab3 100644 --- a/litellm/_service_logger.py +++ b/litellm/_service_logger.py @@ -315,7 +315,7 @@ class ServiceLogging(CustomLogger): await self.async_service_success_hook( service=ServiceTypes.LITELLM, duration=_duration, - call_type=kwargs["call_type"], + call_type=kwargs.get("call_type", "unknown") ) except Exception as e: raise e diff --git a/litellm/proxy/hooks/proxy_track_cost_callback.py b/litellm/proxy/hooks/proxy_track_cost_callback.py index ffc9dbd2372..94886293a08 100644 --- a/litellm/proxy/hooks/proxy_track_cost_callback.py +++ b/litellm/proxy/hooks/proxy_track_cost_callback.py @@ -202,7 +202,7 @@ class _ProxyDBLogger(CustomLogger): max_budget=end_user_max_budget, ) else: - if sl_object is None and kwargs.get("model") is None: + if sl_object is None and not kwargs.get("model"): verbose_proxy_logger.warning( "Cost tracking - skipping, no standard_logging_object and no model for call_type=%s", kwargs.get("call_type", "unknown"), diff --git a/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py b/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py index 46da6a89cb2..e8765cf78ca 100644 --- a/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py +++ b/tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py @@ -167,3 +167,36 @@ async def test_track_cost_callback_skips_when_no_standard_logging_object(): # failed_tracking_alert should NOT be called — this is not an error mock_proxy_logging.failed_tracking_alert.assert_not_called() + + +@pytest.mark.asyncio +@pytest.mark.parametrize("model_value", [None, ""]) +async def test_track_cost_callback_skips_for_falsy_model_and_no_slo(model_value): + """ + Same bug as above but model can also be empty string (e.g. health check callbacks). + The guard should catch all falsy model values when sl_object is missing. + """ + logger = _ProxyDBLogger() + + kwargs = { + "call_type": "acompletion", + "model": model_value, + "litellm_params": {}, + "stream": False, + } + + with patch( + "litellm.proxy.proxy_server.proxy_logging_obj", + ) as mock_proxy_logging: + mock_proxy_logging.failed_tracking_alert = AsyncMock() + mock_proxy_logging.db_spend_update_writer = MagicMock() + mock_proxy_logging.db_spend_update_writer.update_database = AsyncMock() + + await logger._PROXY_track_cost_callback( + kwargs=kwargs, + completion_response=None, + start_time=datetime.now(), + end_time=datetime.now(), + ) + + mock_proxy_logging.failed_tracking_alert.assert_not_called() diff --git a/tests/test_litellm/test_service_logger.py b/tests/test_litellm/test_service_logger.py new file mode 100644 index 00000000000..ed44fe9b9f2 --- /dev/null +++ b/tests/test_litellm/test_service_logger.py @@ -0,0 +1,97 @@ +""" +Tests for litellm/_service_logger.py + +Regression test for KeyError: 'call_type' when async_log_success_event +is called without call_type in kwargs (e.g. from batch polling callbacks). +""" + +import pytest +from datetime import datetime, timedelta +from unittest.mock import AsyncMock, patch + +from litellm._service_logger import ServiceLogging + + +@pytest.mark.asyncio +async def test_async_log_success_event_should_not_raise_when_call_type_missing(): + """ + When async_log_success_event is called with kwargs that omit 'call_type', + it should not raise a KeyError. This happens in the batch polling flow + where check_batch_cost.py creates a Logging object whose model_call_details + don't include call_type. + """ + service_logger = ServiceLogging(mock_testing=True) + + start_time = datetime(2026, 2, 13, 22, 35, 0) + end_time = datetime(2026, 2, 13, 22, 35, 1) + kwargs_without_call_type = {"model": "gpt-4", "stream": False} + + with patch.object( + service_logger, "async_service_success_hook", new_callable=AsyncMock + ) as mock_hook: + await service_logger.async_log_success_event( + kwargs=kwargs_without_call_type, + response_obj=None, + start_time=start_time, + end_time=end_time, + ) + + mock_hook.assert_called_once() + call_kwargs = mock_hook.call_args + assert call_kwargs.kwargs["call_type"] == "unknown" + + +@pytest.mark.asyncio +async def test_async_log_success_event_should_pass_call_type_when_present(): + """ + When call_type IS present in kwargs, it should be forwarded correctly. + """ + service_logger = ServiceLogging(mock_testing=True) + + start_time = datetime(2026, 2, 13, 22, 35, 0) + end_time = datetime(2026, 2, 13, 22, 35, 1) + kwargs_with_call_type = { + "model": "gpt-4", + "stream": False, + "call_type": "aretrieve_batch", + } + + with patch.object( + service_logger, "async_service_success_hook", new_callable=AsyncMock + ) as mock_hook: + await service_logger.async_log_success_event( + kwargs=kwargs_with_call_type, + response_obj=None, + start_time=start_time, + end_time=end_time, + ) + + mock_hook.assert_called_once() + call_kwargs = mock_hook.call_args + assert call_kwargs.kwargs["call_type"] == "aretrieve_batch" + + +@pytest.mark.asyncio +async def test_async_log_success_event_should_handle_float_duration(): + """ + When start_time and end_time produce a float duration (not timedelta), + it should still work correctly. + """ + service_logger = ServiceLogging(mock_testing=True) + + start_time = 1000.0 + end_time = 1001.5 + + with patch.object( + service_logger, "async_service_success_hook", new_callable=AsyncMock + ) as mock_hook: + await service_logger.async_log_success_event( + kwargs={"call_type": "completion"}, + response_obj=None, + start_time=start_time, + end_time=end_time, + ) + + mock_hook.assert_called_once() + call_kwargs = mock_hook.call_args + assert call_kwargs.kwargs["duration"] == 1.5 From 358180eb2d96a0116e55fc115089c5fc182448d3 Mon Sep 17 00:00:00 2001 From: Ephrim Stanley Date: Sat, 14 Feb 2026 00:16:34 -0500 Subject: [PATCH 027/182] Fix: pass deployment credentials to afile_retrieve in managed_files post-call hook --- .../proxy/hooks/managed_files.py | 18 +- .../proxy/test_managed_files_hook.py | 167 ++++++++++++++++++ 2 files changed, 179 insertions(+), 6 deletions(-) create mode 100644 tests/test_litellm/enterprise/proxy/test_managed_files_hook.py diff --git a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py index a41b3f3bf6f..e11e827d454 100644 --- a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py +++ b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py @@ -914,12 +914,18 @@ class _PROXY_LiteLLMManagedFiles(CustomLogger, BaseFileEndpoints): # Fetch the actual file object from the provider file_object = None try: - # Use litellm to retrieve the file object from the provider - from litellm import afile_retrieve - file_object = await afile_retrieve( - custom_llm_provider=model_name.split("/")[0] if model_name and "/" in model_name else "openai", - file_id=original_file_id - ) + from litellm.proxy.proxy_server import llm_router as _llm_router + if _llm_router is not None and model_id: + _creds = _llm_router.get_deployment_credentials_with_provider(model_id) or {} + file_object = await litellm.afile_retrieve( + file_id=original_file_id, + **_creds, + ) + else: + file_object = await litellm.afile_retrieve( + custom_llm_provider=model_name.split("/")[0] if model_name and "/" in model_name else "openai", + file_id=original_file_id, + ) verbose_logger.debug( f"Successfully retrieved file object for {file_attr}={original_file_id}" ) diff --git a/tests/test_litellm/enterprise/proxy/test_managed_files_hook.py b/tests/test_litellm/enterprise/proxy/test_managed_files_hook.py new file mode 100644 index 00000000000..9526304aff0 --- /dev/null +++ b/tests/test_litellm/enterprise/proxy/test_managed_files_hook.py @@ -0,0 +1,167 @@ +""" +Tests for enterprise/litellm_enterprise/proxy/hooks/managed_files.py + +Regression test for afile_retrieve called without credentials in +async_post_call_success_hook when processing completed batch responses. +""" + +import pytest +from typing import Optional +from unittest.mock import AsyncMock, MagicMock, patch + +from litellm.proxy._types import UserAPIKeyAuth +from litellm.types.llms.openai import OpenAIFileObject +from litellm.types.utils import LiteLLMBatch + + +def _make_file_object(file_id: str = "file-output-abc") -> OpenAIFileObject: + return OpenAIFileObject( + id=file_id, + bytes=100, + created_at=1700000000, + filename="output.jsonl", + object="file", + purpose="batch_output", + status="processed", + ) + + +def _make_batch_response( + batch_id: str = "batch-123", + output_file_id: Optional[str] = "file-output-abc", + status: str = "completed", + model_id: str = "model-deploy-xyz", + model_name: str = "azure/gpt-4", +) -> LiteLLMBatch: + """Create a LiteLLMBatch response with hidden params set as the router would.""" + batch = LiteLLMBatch( + id=batch_id, + completion_window="24h", + created_at=1700000000, + endpoint="/v1/chat/completions", + input_file_id="file-input-abc", + object="batch", + status=status, + output_file_id=output_file_id, + ) + batch._hidden_params = { + "unified_file_id": "some-unified-id", + "unified_batch_id": "some-unified-batch-id", + "model_id": model_id, + "model_name": model_name, + } + return batch + + +def _make_user_api_key_dict() -> UserAPIKeyAuth: + return UserAPIKeyAuth( + api_key="sk-test", + user_id="test-user", + parent_otel_span=None, + ) + + +def _make_managed_files_instance(): + """Create a _PROXY_LiteLLMManagedFiles with storage methods mocked out.""" + from litellm_enterprise.proxy.hooks.managed_files import ( + _PROXY_LiteLLMManagedFiles, + ) + + mock_cache = MagicMock() + mock_prisma = MagicMock() + + instance = _PROXY_LiteLLMManagedFiles( + internal_usage_cache=mock_cache, + prisma_client=mock_prisma, + ) + instance.store_unified_file_id = AsyncMock() + instance.store_unified_object_id = AsyncMock() + return instance + + +@pytest.mark.asyncio +async def test_should_pass_credentials_to_afile_retrieve(): + """ + When async_post_call_success_hook processes a completed batch with an output_file_id, + it calls afile_retrieve to fetch file metadata. It must pass credentials from the + router deployment, not just custom_llm_provider and file_id. + + Regression test for: managed_files.py:919 calling afile_retrieve without api_key/api_base. + """ + managed_files = _make_managed_files_instance() + batch_response = _make_batch_response( + model_id="model-deploy-xyz", + model_name="azure/gpt-4", + output_file_id="file-output-abc", + ) + user_api_key_dict = _make_user_api_key_dict() + + mock_credentials = { + "api_key": "test-azure-key", + "api_base": "https://my-azure.openai.azure.com/", + "api_version": "2025-03-01-preview", + "custom_llm_provider": "azure", + } + + mock_router = MagicMock() + mock_router.get_deployment_credentials_with_provider = MagicMock( + return_value=mock_credentials + ) + + mock_afile_retrieve = AsyncMock(return_value=_make_file_object("file-output-abc")) + + with patch( + "litellm.afile_retrieve", mock_afile_retrieve + ), patch( + "litellm.proxy.proxy_server.llm_router", mock_router + ): + await managed_files.async_post_call_success_hook( + data={}, + user_api_key_dict=user_api_key_dict, + response=batch_response, + ) + + mock_afile_retrieve.assert_called() + call_kwargs = mock_afile_retrieve.call_args + + assert call_kwargs.kwargs.get("api_key") == "test-azure-key", ( + f"afile_retrieve must receive api_key from router credentials. " + f"Got kwargs: {call_kwargs.kwargs}" + ) + assert call_kwargs.kwargs.get("api_base") == "https://my-azure.openai.azure.com/", ( + f"afile_retrieve must receive api_base from router credentials. " + f"Got kwargs: {call_kwargs.kwargs}" + ) + + +@pytest.mark.asyncio +async def test_should_fallback_when_no_router(): + """ + When llm_router is not available, afile_retrieve should still be called + with the fallback behavior (custom_llm_provider extracted from model_name). + """ + managed_files = _make_managed_files_instance() + batch_response = _make_batch_response( + model_id="model-deploy-xyz", + model_name="azure/gpt-4", + output_file_id="file-output-abc", + ) + user_api_key_dict = _make_user_api_key_dict() + + mock_afile_retrieve = AsyncMock(return_value=_make_file_object("file-output-abc")) + + with patch( + "litellm.afile_retrieve", mock_afile_retrieve + ), patch( + "litellm.proxy.proxy_server.llm_router", None + ): + await managed_files.async_post_call_success_hook( + data={}, + user_api_key_dict=user_api_key_dict, + response=batch_response, + ) + + mock_afile_retrieve.assert_called() + call_kwargs = mock_afile_retrieve.call_args + assert call_kwargs.kwargs.get("custom_llm_provider") == "azure" + assert call_kwargs.kwargs.get("file_id") == "file-output-abc" From 5433ae7e8caf725191bca6a579596b404f4acf72 Mon Sep 17 00:00:00 2001 From: Ephrim Stanley Date: Sat, 14 Feb 2026 00:30:35 -0500 Subject: [PATCH 028/182] Fix: bypass managed files access check in batch polling by calling afile_content directly --- .../proxy/common_utils/check_batch_cost.py | 39 ++-- .../proxy/test_managed_files_access_check.py | 200 ++++++++++++++++++ 2 files changed, 220 insertions(+), 19 deletions(-) create mode 100644 tests/test_litellm/enterprise/proxy/test_managed_files_access_check.py diff --git a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py index bb25e4f0626..807d237df5c 100644 --- a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py +++ b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py @@ -4,7 +4,7 @@ Polls LiteLLM_ManagedObjectTable to check if the batch job is complete, and if t from litellm._uuid import uuid from datetime import datetime -from typing import TYPE_CHECKING, Optional, cast +from typing import TYPE_CHECKING, Optional from litellm._logging import verbose_proxy_logger @@ -35,14 +35,11 @@ class CheckBatchCost: - if not, return False - if so, return True """ - from litellm_enterprise.proxy.hooks.managed_files import ( - _PROXY_LiteLLMManagedFiles, - ) - from litellm.batches.batch_utils import ( _get_file_content_as_dictionary, calculate_batch_cost_and_usage, ) + from litellm.files.main import afile_content from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLogging from litellm.proxy.openai_files_endpoints.common_utils import ( @@ -102,27 +99,31 @@ class CheckBatchCost: continue ## RETRIEVE THE BATCH JOB OUTPUT FILE - managed_files_obj = cast( - Optional[_PROXY_LiteLLMManagedFiles], - self.proxy_logging_obj.get_proxy_hook("managed_files"), - ) if ( response.status == "completed" and response.output_file_id is not None - and managed_files_obj is not None ): verbose_proxy_logger.info( f"Batch ID: {batch_id} is complete, tracking cost and usage" ) - # track cost - model_file_id_mapping = { - response.output_file_id: {model_id: response.output_file_id} - } - _file_content = await managed_files_obj.afile_content( - file_id=response.output_file_id, - litellm_parent_otel_span=None, - llm_router=self.llm_router, - model_file_id_mapping=model_file_id_mapping, + + # Extract raw provider file ID from the unified file ID + # (async_post_call_success_hook may have replaced output_file_id with a unified ID) + raw_output_file_id = response.output_file_id + decoded = _is_base64_encoded_unified_file_id(raw_output_file_id) + if decoded: + try: + raw_output_file_id = decoded.split("llm_output_file_id,")[1].split(";")[0] + except (IndexError, AttributeError): + pass + + # Call litellm.afile_content directly with deployment credentials, + # bypassing the managed files access-control hooks that would + # reject this background job's default_user_id identity + credentials = self.llm_router.get_deployment_credentials_with_provider(model_id) or {} + _file_content = await afile_content( + file_id=raw_output_file_id, + **credentials, ) file_content_as_dict = _get_file_content_as_dictionary( diff --git a/tests/test_litellm/enterprise/proxy/test_managed_files_access_check.py b/tests/test_litellm/enterprise/proxy/test_managed_files_access_check.py new file mode 100644 index 00000000000..2db5a2214cb --- /dev/null +++ b/tests/test_litellm/enterprise/proxy/test_managed_files_access_check.py @@ -0,0 +1,200 @@ +""" +Tests for managed files access control in batch polling context. + +Regression test for: batch polling job running as default_user_id gets 403 +when trying to access managed files created by a real user. + +The fix (Option C) makes check_batch_cost call litellm.afile_content directly +with deployment credentials, bypassing the managed files access-control hooks. +""" + +import base64 +import pytest +from unittest.mock import AsyncMock, MagicMock, patch + +from fastapi import HTTPException + +from litellm.proxy._types import UserAPIKeyAuth + + +def _make_user_api_key_dict(user_id: str) -> UserAPIKeyAuth: + return UserAPIKeyAuth( + api_key="sk-test", + user_id=user_id, + parent_otel_span=None, + ) + + +def _make_unified_file_id() -> str: + """Create a base64-encoded unified file ID that passes _is_base64_encoded_unified_file_id.""" + raw = "litellm_proxy:application/octet-stream;unified_id,test-123;target_model_names,azure-gpt-4" + return base64.b64encode(raw.encode()).decode() + + +def _make_managed_files_instance(file_created_by: str, unified_file_id: str): + """Create a _PROXY_LiteLLMManagedFiles with a mocked DB that returns a file owned by file_created_by.""" + from litellm_enterprise.proxy.hooks.managed_files import ( + _PROXY_LiteLLMManagedFiles, + ) + + mock_db_record = MagicMock() + mock_db_record.created_by = file_created_by + + mock_prisma = MagicMock() + mock_prisma.db.litellm_managedfiletable.find_first = AsyncMock( + return_value=mock_db_record + ) + + instance = _PROXY_LiteLLMManagedFiles( + internal_usage_cache=MagicMock(), + prisma_client=mock_prisma, + ) + return instance + + +# --- Access control unit tests (document existing behavior) --- + + +@pytest.mark.asyncio +async def test_should_allow_file_owner_access(): + """File owner can access their own file — baseline sanity check.""" + unified_file_id = _make_unified_file_id() + managed_files = _make_managed_files_instance( + file_created_by="user-A", + unified_file_id=unified_file_id, + ) + user = _make_user_api_key_dict("user-A") + data = {"file_id": unified_file_id} + + result = await managed_files.check_managed_file_id_access(data, user) + assert result is True + + +@pytest.mark.asyncio +async def test_should_block_different_user_access(): + """A different regular user cannot access another user's file — correct behavior.""" + unified_file_id = _make_unified_file_id() + managed_files = _make_managed_files_instance( + file_created_by="user-A", + unified_file_id=unified_file_id, + ) + user = _make_user_api_key_dict("user-B") + data = {"file_id": unified_file_id} + + with pytest.raises(HTTPException) as exc_info: + await managed_files.check_managed_file_id_access(data, user) + assert exc_info.value.status_code == 403 + + +@pytest.mark.asyncio +async def test_should_block_default_user_id_access(): + """ + default_user_id is correctly blocked by the access check. + This documents the existing behavior that the Option C fix works around. + """ + unified_file_id = _make_unified_file_id() + managed_files = _make_managed_files_instance( + file_created_by="user-A", + unified_file_id=unified_file_id, + ) + system_user = _make_user_api_key_dict("default_user_id") + data = {"file_id": unified_file_id} + + with pytest.raises(HTTPException) as exc_info: + await managed_files.check_managed_file_id_access(data, system_user) + assert exc_info.value.status_code == 403 + + +# --- Option C fix test: check_batch_cost bypasses managed files hook --- + + +@pytest.mark.asyncio +async def test_check_batch_cost_should_call_afile_content_directly_with_credentials(): + """ + check_batch_cost should call litellm.afile_content directly with deployment + credentials, bypassing managed_files_obj.afile_content and its access-control + hooks. This avoids the 403 that occurs when the background job runs as + default_user_id. + """ + from litellm_enterprise.proxy.common_utils.check_batch_cost import CheckBatchCost + + # Build a unified object ID in the expected format: + # litellm_proxy;model_id:{};llm_batch_id:{};llm_output_file_id:{} + unified_raw = "litellm_proxy;model_id:model-deploy-xyz;llm_batch_id:batch-123;llm_output_file_id:file-raw-output" + unified_object_id = base64.b64encode(unified_raw.encode()).decode() + + # Mock a pending job from the DB + mock_job = MagicMock() + mock_job.unified_object_id = unified_object_id + mock_job.created_by = "user-A" + mock_job.id = "job-1" + + # Mock prisma + mock_prisma = MagicMock() + mock_prisma.db.litellm_managedobjecttable.find_many = AsyncMock( + return_value=[mock_job] + ) + mock_prisma.db.litellm_managedobjecttable.update_many = AsyncMock() + + # Mock proxy_logging_obj — should NOT be called for file content + mock_proxy_logging = MagicMock() + mock_managed_files_hook = MagicMock() + mock_managed_files_hook.afile_content = AsyncMock() + mock_proxy_logging.get_proxy_hook = MagicMock(return_value=mock_managed_files_hook) + + # Mock the batch response (completed, with output file) + from litellm.types.utils import LiteLLMBatch + batch_response = LiteLLMBatch( + id="batch-123", + completion_window="24h", + created_at=1700000000, + endpoint="/v1/chat/completions", + input_file_id="file-input", + object="batch", + status="completed", + output_file_id="file-raw-output", + ) + + # Mock router + mock_router = MagicMock() + mock_router.aretrieve_batch = AsyncMock(return_value=batch_response) + mock_router.get_deployment_credentials_with_provider = MagicMock( + return_value={ + "api_key": "test-key", + "api_base": "https://test.azure.com/", + "custom_llm_provider": "azure", + } + ) + + mock_deployment = MagicMock() + mock_deployment.litellm_params.custom_llm_provider = "azure" + mock_deployment.litellm_params.model = "azure/gpt-4" + mock_router.get_deployment = MagicMock(return_value=mock_deployment) + + checker = CheckBatchCost( + proxy_logging_obj=mock_proxy_logging, + prisma_client=mock_prisma, + llm_router=mock_router, + ) + + mock_file_content = MagicMock() + mock_file_content.content = b'{"id":"req-1","response":{"status_code":200,"body":{"id":"cmpl-1","object":"chat.completion","created":1700000000,"model":"gpt-4","choices":[{"index":0,"message":{"role":"assistant","content":"hi"},"finish_reason":"stop"}],"usage":{"prompt_tokens":10,"completion_tokens":5,"total_tokens":15}}}}\n' + + with patch( + "litellm.files.main.afile_content", + new_callable=AsyncMock, + return_value=mock_file_content, + ) as mock_direct_afile_content: + await checker.check_batch_cost() + + # afile_content should be called directly (not through managed_files_obj) + mock_direct_afile_content.assert_called_once() + call_kwargs = mock_direct_afile_content.call_args.kwargs + + assert call_kwargs.get("api_key") == "test-key", ( + f"afile_content should receive api_key from deployment credentials. " + f"Got: {call_kwargs}" + ) + + # managed_files_obj.afile_content should NOT have been called + mock_managed_files_hook.afile_content.assert_not_called() From 3743513bb64bfcd5fe0321953f073c06565d5620 Mon Sep 17 00:00:00 2001 From: Harshit Jain <48647625+Harshit28j@users.noreply.github.com> Date: Sat, 14 Feb 2026 11:01:25 +0530 Subject: [PATCH 029/182] Update tests/test_litellm/proxy/management_endpoints/test_ui_sso.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- tests/test_litellm/proxy/management_endpoints/test_ui_sso.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py index 097d5f34702..938d4e8c871 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py +++ b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py @@ -3079,7 +3079,7 @@ class TestPKCEFunctionality: mock_cache.async_get_cache = AsyncMock(return_value=test_code_verifier) mock_cache.async_delete_cache = AsyncMock() - with patch("litellm.proxy.proxy_server.user_api_key_cache", mock_cache): + with patch("litellm.proxy.proxy_server.redis_usage_cache", None), patch("litellm.proxy.proxy_server.user_api_key_cache", mock_cache): # Act token_params = ( await SSOAuthenticationHandler.prepare_token_exchange_parameters( From 5525dd4f20cf758188becf93fc5c821e8375a2e4 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 13 Feb 2026 21:50:16 -0800 Subject: [PATCH 030/182] access groups pt 2 --- litellm/proxy/auth/user_api_key_auth.py | 33 ++++++++++++------- .../key_management_endpoints.py | 2 ++ ui/litellm-dashboard/package.json | 2 +- .../AccessGroups/AccessGroupsPage.tsx | 15 +++++---- ui/litellm-dashboard/tsconfig.json | 2 +- 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/litellm/proxy/auth/user_api_key_auth.py b/litellm/proxy/auth/user_api_key_auth.py index f643f7205bf..92f1b2e9c4c 100644 --- a/litellm/proxy/auth/user_api_key_auth.py +++ b/litellm/proxy/auth/user_api_key_auth.py @@ -1187,18 +1187,27 @@ async def _user_api_key_auth_builder( # noqa: PLR0915 # Check 6: Additional Common Checks across jwt + key auth if valid_token.team_id is not None: - _team_obj: Optional[LiteLLM_TeamTable] = LiteLLM_TeamTable( - team_id=valid_token.team_id, - max_budget=valid_token.team_max_budget, - soft_budget=valid_token.team_soft_budget, - spend=valid_token.team_spend, - tpm_limit=valid_token.team_tpm_limit, - rpm_limit=valid_token.team_rpm_limit, - blocked=valid_token.team_blocked, - models=valid_token.team_models, - metadata=valid_token.team_metadata, - object_permission_id=valid_token.team_object_permission_id, - ) + try: + _team_obj = await get_team_object( + team_id=valid_token.team_id, + prisma_client=prisma_client, + user_api_key_cache=user_api_key_cache, + parent_otel_span=parent_otel_span, + proxy_logging_obj=proxy_logging_obj, + ) + except HTTPException: + _team_obj = LiteLLM_TeamTable( + team_id=valid_token.team_id, + max_budget=valid_token.team_max_budget, + soft_budget=valid_token.team_soft_budget, + spend=valid_token.team_spend, + tpm_limit=valid_token.team_tpm_limit, + rpm_limit=valid_token.team_rpm_limit, + blocked=valid_token.team_blocked, + models=valid_token.team_models, + metadata=valid_token.team_metadata, + object_permission_id=valid_token.team_object_permission_id, + ) else: _team_obj = None diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index 78cd7dcbf80..5566d839b60 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -2477,6 +2477,7 @@ async def generate_key_helper_fn( # noqa: PLR0915 auto_rotate: Optional[bool] = None, rotation_interval: Optional[str] = None, router_settings: Optional[dict] = None, + access_group_ids: Optional[list] = None, ): from litellm.proxy.proxy_server import premium_user, prisma_client @@ -2593,6 +2594,7 @@ async def generate_key_helper_fn( # noqa: PLR0915 "allowed_routes": allowed_routes or [], "object_permission_id": object_permission_id, "router_settings": router_settings_json, + "access_group_ids": access_group_ids or [], } # Add rotation fields if auto_rotate is enabled diff --git a/ui/litellm-dashboard/package.json b/ui/litellm-dashboard/package.json index 164368eb6ba..42b90d27333 100644 --- a/ui/litellm-dashboard/package.json +++ b/ui/litellm-dashboard/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "next dev --webpack", "build": "next build", "start": "next start", "lint": "next lint", diff --git a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.tsx b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.tsx index 22f093b6faf..50bc2ddc407 100644 --- a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.tsx +++ b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.tsx @@ -199,29 +199,32 @@ export function AccessGroupsPage() { enableSorting: false, cell: ({ row }) => { const record = row.original; + const modelIds = record.modelIds ?? []; + const mcpServerIds = record.mcpServerIds ?? []; + const agentIds = record.agentIds ?? []; return ( - + - {record.modelIds.length} + {modelIds.length} - + - {record.mcpServerIds.length} + {mcpServerIds.length} - + - {record.agentIds.length} + {agentIds.length} diff --git a/ui/litellm-dashboard/tsconfig.json b/ui/litellm-dashboard/tsconfig.json index 5b0352feb98..d24bdd340f7 100644 --- a/ui/litellm-dashboard/tsconfig.json +++ b/ui/litellm-dashboard/tsconfig.json @@ -14,7 +14,7 @@ "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "preserve", + "jsx": "react-jsx", "incremental": true, "plugins": [ { From 5a78486a153e64dba29b893a25b84f78d7a1ade9 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 13 Feb 2026 22:01:28 -0800 Subject: [PATCH 031/182] tests --- tests/proxy_unit_tests/test_auth_checks.py | 222 ++++++++++++++++++ .../auth/test_agent_permission_handler.py | 56 ++++- .../test_access_group_endpoints.py | 68 +++++- .../test_key_management_endpoints.py | 45 ++++ 4 files changed, 378 insertions(+), 13 deletions(-) diff --git a/tests/proxy_unit_tests/test_auth_checks.py b/tests/proxy_unit_tests/test_auth_checks.py index 7adf3251f59..5d63742c106 100644 --- a/tests/proxy_unit_tests/test_auth_checks.py +++ b/tests/proxy_unit_tests/test_auth_checks.py @@ -754,3 +754,225 @@ async def test_can_key_call_model_with_aliases(model, alias_map, expect_to_work) valid_token=user_api_key_object, llm_router=router, ) + + +# --------------------------------------------------------------------------- +# Access group cache helpers (_cache_access_object, _delete_cache_access_object) +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_cache_access_object(): + """Test _cache_access_object stores access group in cache with correct key.""" + from litellm.proxy.auth.auth_checks import _cache_access_object + from litellm.proxy._types import LiteLLM_AccessGroupTable + + cache = DualCache() + ag_id = "ag-test-123" + ag_table = LiteLLM_AccessGroupTable( + access_group_id=ag_id, + access_group_name="test-group", + access_model_names=["gpt-4"], + ) + await _cache_access_object( + access_group_id=ag_id, + access_group_table=ag_table, + user_api_key_cache=cache, + ) + cached = await cache.async_get_cache(key=f"access_group_id:{ag_id}") + assert cached is not None + if isinstance(cached, dict): + assert cached.get("access_group_id") == ag_id + assert cached.get("access_group_name") == "test-group" + else: + assert cached.access_group_id == ag_id + assert cached.access_group_name == "test-group" + + +@pytest.mark.asyncio +async def test_delete_cache_access_object(): + """Test _delete_cache_access_object removes access group from in-memory cache.""" + from litellm.proxy.auth.auth_checks import _delete_cache_access_object + from litellm.proxy._types import LiteLLM_AccessGroupTable + + cache = DualCache() + ag_id = "ag-delete-test" + ag_table = LiteLLM_AccessGroupTable( + access_group_id=ag_id, + access_group_name="to-delete", + ) + await cache.async_set_cache(key=f"access_group_id:{ag_id}", value=ag_table, ttl=60) + await _delete_cache_access_object(access_group_id=ag_id, user_api_key_cache=cache) + cached = await cache.async_get_cache(key=f"access_group_id:{ag_id}") + assert cached is None + + +# --------------------------------------------------------------------------- +# Access group resource fetchers (_get_models_from_access_groups, _get_agent_ids_from_access_groups) +# --------------------------------------------------------------------------- + + +@pytest.mark.parametrize( + "resource_field, access_group_data, expected", + [ + ( + "access_model_names", + {"access_group_id": "ag-1", "access_model_names": ["gpt-4", "claude-3"]}, + ["gpt-4", "claude-3"], + ), + ( + "access_agent_ids", + {"access_group_id": "ag-2", "access_agent_ids": ["agent-a", "agent-b"]}, + ["agent-a", "agent-b"], + ), + ( + "access_model_names", + {"access_group_id": "ag-3", "access_model_names": []}, + [], + ), + ], +) +@pytest.mark.asyncio +async def test_get_resources_from_access_groups(resource_field, access_group_data, expected): + """Test _get_resources_from_access_groups returns correct resource list from access groups.""" + from unittest.mock import AsyncMock, MagicMock, patch + + from litellm.proxy._types import LiteLLM_AccessGroupTable + from litellm.proxy.auth.auth_checks import ( + _get_agent_ids_from_access_groups, + _get_models_from_access_groups, + ) + + ag_table = LiteLLM_AccessGroupTable( + access_group_id=access_group_data["access_group_id"], + access_group_name="test", + access_model_names=access_group_data.get("access_model_names", []), + access_agent_ids=access_group_data.get("access_agent_ids", []), + ) + + with patch( + "litellm.proxy.auth.auth_checks.get_access_object", + new_callable=AsyncMock, + return_value=ag_table, + ): + if resource_field == "access_model_names": + result = await _get_models_from_access_groups( + access_group_ids=[access_group_data["access_group_id"]], + prisma_client=MagicMock(), + user_api_key_cache=DualCache(), + ) + else: + result = await _get_agent_ids_from_access_groups( + access_group_ids=[access_group_data["access_group_id"]], + prisma_client=MagicMock(), + user_api_key_cache=DualCache(), + ) + assert sorted(result) == sorted(expected) + + +@pytest.mark.asyncio +async def test_get_models_from_access_groups_empty_ids(): + """Test _get_models_from_access_groups returns empty list when access_group_ids is empty.""" + from litellm.proxy.auth.auth_checks import _get_models_from_access_groups + + result = await _get_models_from_access_groups(access_group_ids=[]) + assert result == [] + + +# --------------------------------------------------------------------------- +# can_team_access_model with access_group_ids fallback +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_can_team_access_model_via_access_group_ids(): + """Test can_team_access_model allows access when team has access_group_ids granting model access.""" + from unittest.mock import AsyncMock, patch + + from litellm.proxy.auth.auth_checks import can_team_access_model + + team_object = LiteLLM_TeamTable( + team_id="test-team", + models=[], + access_group_ids=["ag-with-gpt4"], + ) + + with patch( + "litellm.proxy.auth.auth_checks._get_models_from_access_groups", + new_callable=AsyncMock, + return_value=["gpt-4"], + ): + result = await can_team_access_model( + model="gpt-4", + team_object=team_object, + llm_router=None, + team_model_aliases=None, + ) + assert result is True + + +@pytest.mark.asyncio +async def test_can_team_access_model_access_group_ids_denied(): + """Test can_team_access_model denies when neither team models nor access_group_ids grant access.""" + from unittest.mock import AsyncMock, patch + + from litellm.proxy.auth.auth_checks import can_team_access_model + from litellm.proxy._types import ProxyException + + team_object = LiteLLM_TeamTable( + team_id="test-team", + models=["gpt-3.5-turbo"], + access_group_ids=["ag-other"], + ) + + with patch( + "litellm.proxy.auth.auth_checks._get_models_from_access_groups", + new_callable=AsyncMock, + return_value=["claude-3"], + ): + with pytest.raises(ProxyException): + await can_team_access_model( + model="gpt-4", + team_object=team_object, + llm_router=None, + team_model_aliases=None, + ) + + +# --------------------------------------------------------------------------- +# can_key_call_model with access_group_ids fallback +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_can_key_call_model_via_access_group_ids(): + """Test can_key_call_model allows access when key has access_group_ids granting model access.""" + from unittest.mock import AsyncMock, patch + + from litellm.proxy.auth.auth_checks import can_key_call_model + + user_api_key_object = UserAPIKeyAuth( + token="test-token", + models=[], + access_group_ids=["ag-with-gpt4"], + ) + router = litellm.Router( + model_list=[ + { + "model_name": "gpt-4", + "litellm_params": {"model": "openai/gpt-4", "api_key": "test"}, + } + ] + ) + + with patch( + "litellm.proxy.auth.auth_checks._get_models_from_access_groups", + new_callable=AsyncMock, + return_value=["gpt-4"], + ): + await can_key_call_model( + model="gpt-4", + llm_model_list=[], + valid_token=user_api_key_object, + llm_router=router, + ) diff --git a/tests/test_litellm/proxy/agent_endpoints/auth/test_agent_permission_handler.py b/tests/test_litellm/proxy/agent_endpoints/auth/test_agent_permission_handler.py index 111dd7c0764..533dc0557b5 100644 --- a/tests/test_litellm/proxy/agent_endpoints/auth/test_agent_permission_handler.py +++ b/tests/test_litellm/proxy/agent_endpoints/auth/test_agent_permission_handler.py @@ -4,7 +4,7 @@ Unit tests for AgentRequestHandler - Agent permission management for keys and te import os import sys -from unittest.mock import patch +from unittest.mock import AsyncMock, patch import pytest @@ -111,3 +111,57 @@ class TestAgentRequestHandler: result = await AgentRequestHandler.get_allowed_agents(user_api_key_auth=mock_user_auth) assert result == [] + + async def test_get_allowed_agents_for_key_via_access_group_ids(self): + """ + Test that _get_allowed_agents_for_key includes agents from key's access_group_ids + (unified access groups) when key has no native object_permission. + """ + mock_user_auth = UserAPIKeyAuth( + api_key="test-key", + user_id="test-user", + access_group_ids=["ag-with-agents"], + ) + + with patch.object( + AgentRequestHandler, "_get_key_object_permission", return_value=None + ): + with patch( + "litellm.proxy.auth.auth_checks._get_agent_ids_from_access_groups", + new_callable=AsyncMock, + return_value=["agent-from-ag-1", "agent-from-ag-2"], + ): + result = await AgentRequestHandler._get_allowed_agents_for_key( + user_api_key_auth=mock_user_auth + ) + assert sorted(result) == ["agent-from-ag-1", "agent-from-ag-2"] + + async def test_get_allowed_agents_for_key_combines_native_and_access_groups(self): + """ + Test that _get_allowed_agents_for_key combines agents from native object_permission + and key's access_group_ids (unified access groups). + """ + from litellm.proxy._types import LiteLLM_ObjectPermissionTable + + mock_permission = LiteLLM_ObjectPermissionTable( + object_permission_id="obj-1", + agents=["native-agent-1"], + agent_access_groups=[], + ) + mock_user_auth = UserAPIKeyAuth( + api_key="test-key", + user_id="test-user", + access_group_ids=["ag-1"], + ) + # Attach object_permission so _get_key_object_permission returns it + mock_user_auth.object_permission = mock_permission + + with patch( + "litellm.proxy.auth.auth_checks._get_agent_ids_from_access_groups", + new_callable=AsyncMock, + return_value=["agent-from-ag"], + ): + result = await AgentRequestHandler._get_allowed_agents_for_key( + user_api_key_auth=mock_user_auth + ) + assert sorted(result) == ["agent-from-ag", "native-agent-1"] diff --git a/tests/test_litellm/proxy/management_endpoints/test_access_group_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_access_group_endpoints.py index 54df8941fa5..181ec8464ff 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_access_group_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_access_group_endpoints.py @@ -37,19 +37,27 @@ def _make_access_group_record( updated_by: str | None = "admin-user", created_at: datetime | None = None, ): + created_at_val = created_at or datetime.now() + updated_at_val = datetime.now() + data = { + "access_group_id": access_group_id, + "access_group_name": access_group_name, + "description": description, + "access_model_names": access_model_names or [], + "access_mcp_server_ids": access_mcp_server_ids or [], + "access_agent_ids": access_agent_ids or [], + "assigned_team_ids": assigned_team_ids or [], + "assigned_key_ids": assigned_key_ids or [], + "created_at": created_at_val, + "created_by": created_by, + "updated_at": updated_at_val, + "updated_by": updated_by, + } record = MagicMock() - record.access_group_id = access_group_id - record.access_group_name = access_group_name - record.description = description - record.access_model_names = access_model_names or [] - record.access_mcp_server_ids = access_mcp_server_ids or [] - record.access_agent_ids = access_agent_ids or [] - record.assigned_team_ids = assigned_team_ids or [] - record.assigned_key_ids = assigned_key_ids or [] - record.created_at = created_at or datetime.now() - record.created_by = created_by - record.updated_at = datetime.now() - record.updated_by = updated_by + for k, v in data.items(): + setattr(record, k, v) + record.dict = lambda: data + record.model_dump = lambda: data return record @@ -116,6 +124,20 @@ def client_and_mocks(monkeypatch): monkeypatch.setattr(ps, "prisma_client", mock_prisma) + # Mock user_api_key_cache and proxy_logging_obj for cache operations (create/update/delete) + mock_cache = MagicMock() + mock_cache.async_set_cache = AsyncMock(return_value=None) + mock_cache.delete_cache = MagicMock(return_value=None) + monkeypatch.setattr(ps, "user_api_key_cache", mock_cache) + + mock_proxy_logging = MagicMock() + mock_proxy_logging.internal_usage_cache = MagicMock() + mock_proxy_logging.internal_usage_cache.dual_cache = MagicMock() + mock_proxy_logging.internal_usage_cache.dual_cache.async_delete_cache = AsyncMock( + return_value=None + ) + monkeypatch.setattr(ps, "proxy_logging_obj", mock_proxy_logging) + admin_user = UserAPIKeyAuth( user_id="admin_user", user_role=LitellmUserRoles.PROXY_ADMIN, @@ -632,3 +654,25 @@ def test_access_group_endpoints_db_not_connected(client_and_mocks, monkeypatch, resp = getattr(client, method)(url, **factory()) assert resp.status_code == 500 assert resp.json()["detail"]["error"] == CommonProxyErrors.db_not_connected_error.value + + +# --------------------------------------------------------------------------- +# Unit tests for cache helpers (_record_to_access_group_table) +# --------------------------------------------------------------------------- + + +def test_record_to_access_group_table(): + """Test _record_to_access_group_table converts Prisma-like record to LiteLLM_AccessGroupTable.""" + from litellm.proxy.management_endpoints.access_group_endpoints import _record_to_access_group_table + + record = _make_access_group_record( + access_group_id="ag-unit-test", + access_group_name="unit-test-group", + access_model_names=["gpt-4", "claude-3"], + access_agent_ids=["agent-1"], + ) + result = _record_to_access_group_table(record) + assert result.access_group_id == "ag-unit-test" + assert result.access_group_name == "unit-test-group" + assert result.access_model_names == ["gpt-4", "claude-3"] + assert result.access_agent_ids == ["agent-1"] diff --git a/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py index ad5819df1c7..de2c940943b 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py @@ -520,6 +520,51 @@ async def test_key_generation_with_object_permission(monkeypatch): assert key_insert_calls[0]["data"].get("object_permission_id") == "objperm123" +@pytest.mark.asyncio +async def test_generate_key_helper_fn_with_access_group_ids(monkeypatch): + """Ensure generate_key_helper_fn passes access_group_ids into the key insert payload.""" + mock_prisma_client = AsyncMock() + mock_prisma_client.jsonify_object = lambda data: data # type: ignore + mock_prisma_client.db = MagicMock() + mock_prisma_client.db.litellm_objectpermissiontable = MagicMock() + mock_prisma_client.db.litellm_objectpermissiontable.create = AsyncMock( + return_value=MagicMock(object_permission_id=None) + ) + + captured_key_data = {} + + async def _insert_data_side_effect(*args, **kwargs): + table_name = kwargs.get("table_name") + if table_name == "user": + return MagicMock(models=[], spend=0) + elif table_name == "key": + captured_key_data.update(kwargs.get("data", {})) + return MagicMock( + token="hashed_token_789", + litellm_budget_table=None, + object_permission=None, + created_at=None, + updated_at=None, + ) + return MagicMock() + + mock_prisma_client.insert_data = AsyncMock(side_effect=_insert_data_side_effect) + monkeypatch.setattr("litellm.proxy.proxy_server.prisma_client", mock_prisma_client) + + from litellm.proxy.management_endpoints.key_management_endpoints import ( + generate_key_helper_fn, + ) + + await generate_key_helper_fn( + request_type="key", + table_name="key", + user_id="test-user", + access_group_ids=["ag-1", "ag-2"], + ) + + assert captured_key_data.get("access_group_ids") == ["ag-1", "ag-2"] + + @pytest.mark.asyncio async def test_key_generation_with_mcp_tool_permissions(monkeypatch): """ From 91226fb0bb26803648f66c36c7dd5b6f89c8a981 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Fri, 13 Feb 2026 22:07:24 -0800 Subject: [PATCH 032/182] adjusting UI for model name --- .../(dashboard)/hooks/accessGroups/useAccessGroups.test.ts | 2 +- .../src/app/(dashboard)/hooks/accessGroups/useAccessGroups.ts | 2 +- .../(dashboard)/hooks/accessGroups/useCreateAccessGroup.ts | 2 +- .../app/(dashboard)/hooks/accessGroups/useEditAccessGroup.ts | 2 +- .../components/AccessGroups/AccessGroupsDetailsPage.test.tsx | 4 ++-- .../src/components/AccessGroups/AccessGroupsDetailsPage.tsx | 2 +- .../AccessGroups/AccessGroupsModal/AccessGroupCreateModal.tsx | 2 +- .../AccessGroups/AccessGroupsModal/AccessGroupEditModal.tsx | 4 ++-- .../src/components/AccessGroups/AccessGroupsPage.test.tsx | 4 ++-- .../src/components/AccessGroups/AccessGroupsPage.tsx | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useAccessGroups.test.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useAccessGroups.test.ts index 587064353ac..b15ea4491e9 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useAccessGroups.test.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useAccessGroups.test.ts @@ -41,7 +41,7 @@ const mockAccessGroups: AccessGroupResponse[] = [ access_group_id: "ag-1", access_group_name: "Group One", description: "First group", - access_model_ids: [], + access_model_names: [], access_mcp_server_ids: [], access_agent_ids: [], assigned_team_ids: [], diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useAccessGroups.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useAccessGroups.ts index e5d8829278d..215b555fcf9 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useAccessGroups.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useAccessGroups.ts @@ -15,7 +15,7 @@ export interface AccessGroupResponse { access_group_id: string; access_group_name: string; description: string | null; - access_model_ids: string[]; + access_model_names: string[]; access_mcp_server_ids: string[]; access_agent_ids: string[]; assigned_team_ids: string[]; diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useCreateAccessGroup.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useCreateAccessGroup.ts index 4d71be94455..7ea5a813462 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useCreateAccessGroup.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useCreateAccessGroup.ts @@ -13,7 +13,7 @@ import { AccessGroupResponse, accessGroupKeys } from "./useAccessGroups"; export interface AccessGroupCreateParams { access_group_name: string; description?: string | null; - access_model_ids?: string[]; + access_model_names?: string[]; access_mcp_server_ids?: string[]; access_agent_ids?: string[]; assigned_team_ids?: string[]; diff --git a/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useEditAccessGroup.ts b/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useEditAccessGroup.ts index 1646458c63d..5dc2252f640 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useEditAccessGroup.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/hooks/accessGroups/useEditAccessGroup.ts @@ -13,7 +13,7 @@ import { AccessGroupResponse, accessGroupKeys } from "./useAccessGroups"; export interface AccessGroupUpdateParams { access_group_name?: string; description?: string | null; - access_model_ids?: string[]; + access_model_names?: string[]; access_mcp_server_ids?: string[]; access_agent_ids?: string[]; assigned_team_ids?: string[]; diff --git a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsDetailsPage.test.tsx b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsDetailsPage.test.tsx index db9d25d886f..0628c38d782 100644 --- a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsDetailsPage.test.tsx +++ b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsDetailsPage.test.tsx @@ -56,7 +56,7 @@ const createMockAccessGroup = ( access_group_id: "ag-1", access_group_name: "Test Group", description: "A test access group", - access_model_ids: ["model-1", "model-2"], + access_model_names: ["model-1", "model-2"], access_mcp_server_ids: ["mcp-1"], access_agent_ids: ["agent-1"], assigned_team_ids: ["team-1"], @@ -319,7 +319,7 @@ describe("AccessGroupDetail", () => { it("should show empty state in Models tab when no models assigned", () => { mockUseAccessGroupDetails.mockReturnValue({ ...baseMockReturnValue, - data: createMockAccessGroup({ access_model_ids: [] }), + data: createMockAccessGroup({ access_model_names: [] }), } as ReturnType); renderWithProviders( diff --git a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsDetailsPage.tsx b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsDetailsPage.tsx index 9b794959baa..7db2e338cf4 100644 --- a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsDetailsPage.tsx +++ b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsDetailsPage.tsx @@ -83,7 +83,7 @@ export function AccessGroupDetail({ ); } - const modelIds = accessGroup.access_model_ids ?? []; + const modelIds = accessGroup.access_model_names ?? []; const mcpServerIds = accessGroup.access_mcp_server_ids ?? []; const agentIds = accessGroup.access_agent_ids ?? []; const keyIds = accessGroup.assigned_key_ids ?? []; diff --git a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsModal/AccessGroupCreateModal.tsx b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsModal/AccessGroupCreateModal.tsx index 0f606d9972a..b51fbd5bd99 100644 --- a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsModal/AccessGroupCreateModal.tsx +++ b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsModal/AccessGroupCreateModal.tsx @@ -30,7 +30,7 @@ export function AccessGroupCreateModal({ const params: AccessGroupCreateParams = { access_group_name: values.name, description: values.description, - access_model_ids: values.modelIds, + access_model_names: values.modelIds, access_mcp_server_ids: values.mcpServerIds, access_agent_ids: values.agentIds, }; diff --git a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsModal/AccessGroupEditModal.tsx b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsModal/AccessGroupEditModal.tsx index c21b1351b57..919295b6f78 100644 --- a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsModal/AccessGroupEditModal.tsx +++ b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsModal/AccessGroupEditModal.tsx @@ -32,7 +32,7 @@ export function AccessGroupEditModal({ form.setFieldsValue({ name: accessGroup.access_group_name, description: accessGroup.description ?? "", - modelIds: accessGroup.access_model_ids ?? [], + modelIds: accessGroup.access_model_names ?? [], mcpServerIds: accessGroup.access_mcp_server_ids ?? [], agentIds: accessGroup.access_agent_ids ?? [], }); @@ -46,7 +46,7 @@ export function AccessGroupEditModal({ const params: AccessGroupUpdateParams = { access_group_name: values.name, description: values.description, - access_model_ids: values.modelIds, + access_model_names: values.modelIds, access_mcp_server_ids: values.mcpServerIds, access_agent_ids: values.agentIds, }; diff --git a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.test.tsx b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.test.tsx index dd38cd61d92..6aa35f349dd 100644 --- a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.test.tsx +++ b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.test.tsx @@ -9,7 +9,7 @@ const mockAccessGroups: AccessGroupResponse[] = [ access_group_id: "ag-1", access_group_name: "Admin Group", description: "Administrators with full access", - access_model_ids: ["m1", "m2"], + access_model_names: ["m1", "m2"], access_mcp_server_ids: ["s1"], access_agent_ids: ["a1"], assigned_team_ids: [], @@ -23,7 +23,7 @@ const mockAccessGroups: AccessGroupResponse[] = [ access_group_id: "ag-2", access_group_name: "Read Only", description: "Read-only access to models", - access_model_ids: ["m1"], + access_model_names: ["m1"], access_mcp_server_ids: [], access_agent_ids: [], assigned_team_ids: [], diff --git a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.tsx b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.tsx index 50bc2ddc407..8aca22bd369 100644 --- a/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.tsx +++ b/ui/litellm-dashboard/src/components/AccessGroups/AccessGroupsPage.tsx @@ -59,7 +59,7 @@ function mapResponseToAccessGroup(r: AccessGroupResponse): AccessGroup { id: r.access_group_id, name: r.access_group_name, description: r.description ?? "", - modelIds: r.access_model_ids, + modelIds: r.access_model_names, mcpServerIds: r.access_mcp_server_ids, agentIds: r.access_agent_ids, keyIds: r.assigned_key_ids, From e59c8d22afe9d1c2ec67fd4f070346e06c3461f2 Mon Sep 17 00:00:00 2001 From: Ephrim Stanley Date: Sat, 14 Feb 2026 10:07:12 -0500 Subject: [PATCH 033/182] fix: afile_retrieve returns unified ID for batch output files --- .../proxy/hooks/managed_files.py | 1 + fix_afile_retrieve_returns_unified_id.md | 47 +++++++++++++ .../test_afile_retrieve_returns_unified_id.py | 67 +++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 fix_afile_retrieve_returns_unified_id.md create mode 100644 tests/test_litellm/enterprise/proxy/test_afile_retrieve_returns_unified_id.py diff --git a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py index e11e827d454..32d7313aae4 100644 --- a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py +++ b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py @@ -1011,6 +1011,7 @@ class _PROXY_LiteLLMManagedFiles(CustomLogger, BaseFileEndpoints): # Case 2: Managed file and the file object exists in the database if stored_file_object and stored_file_object.file_object: + stored_file_object.file_object.id = file_id return stored_file_object.file_object # Case 3: Managed file exists in the database but not the file object (for. e.g the batch task might not have run) diff --git a/fix_afile_retrieve_returns_unified_id.md b/fix_afile_retrieve_returns_unified_id.md new file mode 100644 index 00000000000..c8cc72d6f99 --- /dev/null +++ b/fix_afile_retrieve_returns_unified_id.md @@ -0,0 +1,47 @@ +# Fix: afile_retrieve returns raw provider ID for batch output files + +## Bug + +`managed_files.afile_retrieve()` Case 2 (file_object already in DB) returned the stored `file_object` without replacing `.id` with the unified file ID. Case 3 (fetch from provider) did this correctly at line 1028. + +## Fix + +One-line change in `enterprise/litellm_enterprise/proxy/hooks/managed_files.py`: + +```python +# Before (line 1013-1014) +if stored_file_object and stored_file_object.file_object: + return stored_file_object.file_object + +# After +if stored_file_object and stored_file_object.file_object: + stored_file_object.file_object.id = file_id + return stored_file_object.file_object +``` + +## Test + +```bash +poetry run pytest tests/test_litellm/enterprise/proxy/test_afile_retrieve_returns_unified_id.py -s -vvvv +``` + +## Test failure (before fix) + +``` +FAILED tests/test_litellm/enterprise/proxy/test_afile_retrieve_returns_unified_id.py::test_should_return_unified_id_when_file_object_exists_in_db +AssertionError: afile_retrieve should return the unified ID 'bGl0ZWxsbV9wcm94eTp1bmlmaWVkX291dHB1dF9maWxl', but got raw provider ID 'batch_20260214-output-file-1' +assert 'batch_20260214-output-file-1' == 'bGl0ZWxsbV9wcm94eTp1bmlmaWVkX291dHB1dF9maWxl' +=================== 1 failed, 1 retried in 102.95s =================== +``` + +## Test pass (after fix) + +``` +tests/test_litellm/enterprise/proxy/test_afile_retrieve_returns_unified_id.py::test_should_return_unified_id_when_file_object_exists_in_db PASSED +============================== 1 passed in 0.11s =============================== +``` + +## Files changed + +- `enterprise/litellm_enterprise/proxy/hooks/managed_files.py` — one-line fix +- `tests/test_litellm/enterprise/proxy/test_afile_retrieve_returns_unified_id.py` — new test diff --git a/tests/test_litellm/enterprise/proxy/test_afile_retrieve_returns_unified_id.py b/tests/test_litellm/enterprise/proxy/test_afile_retrieve_returns_unified_id.py new file mode 100644 index 00000000000..7040aef73e5 --- /dev/null +++ b/tests/test_litellm/enterprise/proxy/test_afile_retrieve_returns_unified_id.py @@ -0,0 +1,67 @@ +""" +Test that managed_files.afile_retrieve returns the unified file ID, not the +raw provider file ID, when file_object is already stored in the database. + +Bug: managed_files.py Case 2 returns stored_file_object.file_object directly +without replacing .id with the unified ID. Case 3 (fetch from provider) does +it correctly at line 1028. +""" + +import pytest +from unittest.mock import AsyncMock, MagicMock + +from litellm.proxy._types import LiteLLM_ManagedFileTable +from litellm.types.llms.openai import OpenAIFileObject + + +def _make_managed_files_instance(): + from litellm_enterprise.proxy.hooks.managed_files import ( + _PROXY_LiteLLMManagedFiles, + ) + + instance = _PROXY_LiteLLMManagedFiles( + internal_usage_cache=MagicMock(), + prisma_client=MagicMock(), + ) + return instance + + +@pytest.mark.asyncio +async def test_should_return_unified_id_when_file_object_exists_in_db(): + """ + When get_unified_file_id returns a stored file_object (Case 2), + afile_retrieve must set .id to the unified file ID before returning. + """ + unified_id = "bGl0ZWxsbV9wcm94eTp1bmlmaWVkX291dHB1dF9maWxl" + raw_provider_id = "batch_20260214-output-file-1" + + stored = LiteLLM_ManagedFileTable( + unified_file_id=unified_id, + file_object=OpenAIFileObject( + id=raw_provider_id, + bytes=489, + created_at=1700000000, + filename="batch_output.jsonl", + object="file", + purpose="batch_output", + status="processed", + ), + model_mappings={"model-abc": raw_provider_id}, + flat_model_file_ids=[raw_provider_id], + created_by="test-user", + updated_by="test-user", + ) + + managed_files = _make_managed_files_instance() + managed_files.get_unified_file_id = AsyncMock(return_value=stored) + + result = await managed_files.afile_retrieve( + file_id=unified_id, + litellm_parent_otel_span=None, + llm_router=None, + ) + + assert result.id == unified_id, ( + f"afile_retrieve should return the unified ID '{unified_id}', " + f"but got raw provider ID '{result.id}'" + ) From cd0fed826bfd22b197dbfdc0763e0eaa3f43e5cc Mon Sep 17 00:00:00 2001 From: Ephrim Stanley Date: Sat, 14 Feb 2026 11:24:08 -0500 Subject: [PATCH 034/182] fix: batch retrieve returns unified input_file_id --- litellm/proxy/batches_endpoints/endpoints.py | 34 +++++ .../openai_files_endpoints/common_utils.py | 10 ++ .../test_batch_retrieve_input_file_id.py | 75 +++++++++++ ..._retrieve_returns_unified_input_file_id.py | 124 ++++++++++++++++++ 4 files changed, 243 insertions(+) create mode 100644 tests/test_litellm/enterprise/proxy/test_batch_retrieve_input_file_id.py create mode 100644 tests/test_litellm/enterprise/proxy/test_batch_retrieve_returns_unified_input_file_id.py diff --git a/litellm/proxy/batches_endpoints/endpoints.py b/litellm/proxy/batches_endpoints/endpoints.py index 06800cb4524..25680ab1220 100644 --- a/litellm/proxy/batches_endpoints/endpoints.py +++ b/litellm/proxy/batches_endpoints/endpoints.py @@ -377,6 +377,23 @@ async def retrieve_batch( response = await proxy_logging_obj.post_call_success_hook( data=data, user_api_key_dict=user_api_key_dict, response=response ) + + # Resolve raw input_file_id to unified ID + if ( + unified_batch_id + and hasattr(response, "input_file_id") + and response.input_file_id + and not _is_base64_encoded_unified_file_id(response.input_file_id) + and prisma_client + ): + try: + _managed_file = await prisma_client.db.litellm_managedfiletable.find_first( + where={"flat_model_file_ids": {"has": response.input_file_id}} + ) + if _managed_file: + response.input_file_id = _managed_file.unified_file_id + except Exception: + pass asyncio.create_task( proxy_logging_obj.update_request_status( @@ -479,6 +496,23 @@ async def retrieve_batch( data=data, user_api_key_dict=user_api_key_dict, response=response ) + # Resolve raw input_file_id to unified ID + if ( + unified_batch_id + and hasattr(response, "input_file_id") + and response.input_file_id + and not _is_base64_encoded_unified_file_id(response.input_file_id) + and prisma_client + ): + try: + _managed_file = await prisma_client.db.litellm_managedfiletable.find_first( + where={"flat_model_file_ids": {"has": response.input_file_id}} + ) + if _managed_file: + response.input_file_id = _managed_file.unified_file_id + except Exception: + pass + ### ALERTING ### asyncio.create_task( proxy_logging_obj.update_request_status( diff --git a/litellm/proxy/openai_files_endpoints/common_utils.py b/litellm/proxy/openai_files_endpoints/common_utils.py index f67dc5e2aaa..15c5bdfabb2 100644 --- a/litellm/proxy/openai_files_endpoints/common_utils.py +++ b/litellm/proxy/openai_files_endpoints/common_utils.py @@ -687,6 +687,16 @@ async def get_batch_from_database( batch_data = json.loads(db_batch_object.file_object) if isinstance(db_batch_object.file_object, str) else db_batch_object.file_object response = LiteLLMBatch(**batch_data) response.id = batch_id + + if response.input_file_id and not _is_base64_encoded_unified_file_id(response.input_file_id): + try: + managed_file = await prisma_client.db.litellm_managedfiletable.find_first( + where={"flat_model_file_ids": {"has": response.input_file_id}} + ) + if managed_file: + response.input_file_id = managed_file.unified_file_id + except Exception: + pass verbose_proxy_logger.debug( f"Retrieved batch {batch_id} from ManagedObjectTable with status={response.status}" diff --git a/tests/test_litellm/enterprise/proxy/test_batch_retrieve_input_file_id.py b/tests/test_litellm/enterprise/proxy/test_batch_retrieve_input_file_id.py new file mode 100644 index 00000000000..6e9c3c0354b --- /dev/null +++ b/tests/test_litellm/enterprise/proxy/test_batch_retrieve_input_file_id.py @@ -0,0 +1,75 @@ +""" +Test that batch retrieve endpoint resolves raw input_file_id to the +unified managed file ID before returning. + +Bug: After batch completion, batches.retrieve returns the raw provider +input_file_id instead of the LiteLLM unified ID. +""" + +import base64 +import json + +import pytest +from unittest.mock import AsyncMock, MagicMock, patch + +from litellm.proxy.openai_files_endpoints.common_utils import ( + _is_base64_encoded_unified_file_id, +) + + +DECODED_UNIFIED_INPUT_FILE_ID = "litellm_proxy:application/octet-stream;unified_id,test-uuid;target_model_names,azure-gpt-4" +B64_UNIFIED_INPUT_FILE_ID = base64.urlsafe_b64encode(DECODED_UNIFIED_INPUT_FILE_ID.encode()).decode().rstrip("=") +RAW_INPUT_FILE_ID = "file-raw-provider-abc123" + +DECODED_UNIFIED_BATCH_ID = "litellm_proxy;model_id:model-xyz;llm_batch_id:batch-123" +B64_UNIFIED_BATCH_ID = base64.urlsafe_b64encode(DECODED_UNIFIED_BATCH_ID.encode()).decode().rstrip("=") + + +@pytest.mark.asyncio +async def test_should_resolve_raw_input_file_id_to_unified(): + """ + When a completed batch has a raw input_file_id and the managed file table + contains a record for that raw ID, the retrieve endpoint should resolve + it to the unified file ID. + """ + unified_batch_id = _is_base64_encoded_unified_file_id(B64_UNIFIED_BATCH_ID) + assert unified_batch_id, "Test setup: batch_id should decode as unified" + + from litellm.types.utils import LiteLLMBatch + + batch_data = { + "id": B64_UNIFIED_BATCH_ID, + "completion_window": "24h", + "created_at": 1700000000, + "endpoint": "/v1/chat/completions", + "input_file_id": RAW_INPUT_FILE_ID, + "object": "batch", + "status": "completed", + "output_file_id": "file-output-xyz", + } + + mock_db_object = MagicMock() + mock_db_object.file_object = json.dumps(batch_data) + + mock_managed_file = MagicMock() + mock_managed_file.unified_file_id = B64_UNIFIED_INPUT_FILE_ID + + mock_prisma = MagicMock() + mock_prisma.db.litellm_managedobjecttable.find_first = AsyncMock(return_value=mock_db_object) + mock_prisma.db.litellm_managedfiletable.find_first = AsyncMock(return_value=mock_managed_file) + + from litellm.proxy.openai_files_endpoints.common_utils import get_batch_from_database + + _, response = await get_batch_from_database( + batch_id=B64_UNIFIED_BATCH_ID, + unified_batch_id=unified_batch_id, + managed_files_obj=MagicMock(), + prisma_client=mock_prisma, + verbose_proxy_logger=MagicMock(), + ) + + assert response is not None, "Batch should be found in DB" + assert response.input_file_id == B64_UNIFIED_INPUT_FILE_ID, ( + f"input_file_id should be unified '{B64_UNIFIED_INPUT_FILE_ID}', " + f"got raw '{response.input_file_id}'" + ) diff --git a/tests/test_litellm/enterprise/proxy/test_batch_retrieve_returns_unified_input_file_id.py b/tests/test_litellm/enterprise/proxy/test_batch_retrieve_returns_unified_input_file_id.py new file mode 100644 index 00000000000..420f5f9789c --- /dev/null +++ b/tests/test_litellm/enterprise/proxy/test_batch_retrieve_returns_unified_input_file_id.py @@ -0,0 +1,124 @@ +""" +Test that get_batch_from_database resolves raw input_file_id to the +unified/managed file ID when reading a batch from the database. + +Bug: The batch retrieve path stores the raw provider input_file_id in the +DB (via async_post_call_success_hook on the retrieve endpoint). When the +batch is later read from DB, get_batch_from_database returns the raw ID +without resolving it to the unified ID. +""" + +import json +import pytest +from typing import Optional +from unittest.mock import AsyncMock, MagicMock + +from litellm.proxy.openai_files_endpoints.common_utils import get_batch_from_database + + +def _mock_prisma(batch_json: str, managed_file_record=None): + """Create a mock prisma client with canned responses.""" + prisma = MagicMock() + + batch_db_record = MagicMock() + batch_db_record.file_object = batch_json + + prisma.db.litellm_managedobjecttable.find_first = AsyncMock( + return_value=batch_db_record + ) + + prisma.db.litellm_managedfiletable.find_first = AsyncMock( + return_value=managed_file_record + ) + + return prisma + + +@pytest.mark.asyncio +async def test_should_resolve_raw_input_file_id_to_unified_id(): + """ + When input_file_id in the stored batch is a raw provider ID, + get_batch_from_database must look up the unified ID from the + managed files table. + """ + unified_batch_id = "bGl0ZWxsbV9wcm94eTpiYXRjaF9pZA" + unified_input_file_id = "bGl0ZWxsbV9wcm94eTp1bmlmaWVkX2lucHV0" + raw_input_file_id = "file-abc123-raw" + + batch_data = { + "id": "batch-raw-123", + "completion_window": "24h", + "created_at": 1700000000, + "endpoint": "/v1/chat/completions", + "input_file_id": raw_input_file_id, + "object": "batch", + "status": "completed", + "output_file_id": "file-output-raw", + } + + managed_file_record = MagicMock() + managed_file_record.unified_file_id = unified_input_file_id + + prisma = _mock_prisma( + batch_json=json.dumps(batch_data), + managed_file_record=managed_file_record, + ) + + _, response = await get_batch_from_database( + batch_id=unified_batch_id, + unified_batch_id="decoded_unified_batch_id", + managed_files_obj=MagicMock(), + prisma_client=prisma, + verbose_proxy_logger=MagicMock(), + ) + + assert response is not None + assert response.input_file_id == unified_input_file_id, ( + f"input_file_id should be resolved to '{unified_input_file_id}', " + f"got raw: '{response.input_file_id}'" + ) + + prisma.db.litellm_managedfiletable.find_first.assert_called_once_with( + where={"flat_model_file_ids": {"has": raw_input_file_id}} + ) + + +@pytest.mark.asyncio +async def test_should_preserve_already_managed_input_file_id(): + """ + When input_file_id is already a managed/unified ID, it should + not be modified. + """ + import base64 + + unified_batch_id = "bGl0ZWxsbV9wcm94eTpiYXRjaF9pZA" + decoded_unified = "litellm_proxy:application/octet-stream;unified_id,test-123" + base64_input_file_id = base64.urlsafe_b64encode(decoded_unified.encode()).decode().rstrip("=") + + batch_data = { + "id": "batch-raw-123", + "completion_window": "24h", + "created_at": 1700000000, + "endpoint": "/v1/chat/completions", + "input_file_id": base64_input_file_id, + "object": "batch", + "status": "completed", + } + + prisma = _mock_prisma(batch_json=json.dumps(batch_data)) + + _, response = await get_batch_from_database( + batch_id=unified_batch_id, + unified_batch_id="decoded_unified_batch_id", + managed_files_obj=MagicMock(), + prisma_client=prisma, + verbose_proxy_logger=MagicMock(), + ) + + assert response is not None + assert response.input_file_id == base64_input_file_id, ( + f"input_file_id was already managed, should be preserved as '{base64_input_file_id}', " + f"got: '{response.input_file_id}'" + ) + + prisma.db.litellm_managedfiletable.find_first.assert_not_called() From b06d7166e59be3cfb9341aa68ced39ab1775e0f5 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Sat, 14 Feb 2026 09:17:19 -0800 Subject: [PATCH 035/182] addressing comments --- .../auth/agent_permission_handler.py | 63 ++++++++++--------- litellm/proxy/auth/auth_checks.py | 2 +- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/litellm/proxy/agent_endpoints/auth/agent_permission_handler.py b/litellm/proxy/agent_endpoints/auth/agent_permission_handler.py index 5ffe598a065..95564342500 100644 --- a/litellm/proxy/agent_endpoints/auth/agent_permission_handler.py +++ b/litellm/proxy/agent_endpoints/auth/agent_permission_handler.py @@ -202,7 +202,7 @@ class AgentRequestHandler: 1. First checks native team-level agent permissions (object_permission) 2. Also includes agents from team's access_group_ids (unified access groups) - Note: object_permission is already loaded by get_team_object() in main auth flow. + Fetches the team object once and reuses it for both permission sources. """ if user_api_key_auth is None: return [] @@ -211,13 +211,32 @@ class AgentRequestHandler: return [] try: + from litellm.proxy.auth.auth_checks import get_team_object + from litellm.proxy.proxy_server import ( + prisma_client, + proxy_logging_obj, + user_api_key_cache, + ) + + if not prisma_client: + return [] + + # Fetch the team object once for both permission sources + team_obj = await get_team_object( + team_id=user_api_key_auth.team_id, + prisma_client=prisma_client, + user_api_key_cache=user_api_key_cache, + parent_otel_span=user_api_key_auth.parent_otel_span, + proxy_logging_obj=proxy_logging_obj, + ) + + if team_obj is None: + return [] + all_agents: List[str] = [] # 1. Get agents from object_permission (native permissions) - object_permissions = await AgentRequestHandler._get_team_object_permission( - user_api_key_auth - ) - + object_permissions = team_obj.object_permission if object_permissions is not None: # Get direct agents direct_agents = object_permissions.agents or [] @@ -231,33 +250,17 @@ class AgentRequestHandler: all_agents = direct_agents + access_group_agents - # 2. Fallback: get agent IDs from team's access_group_ids (unified access groups) - from litellm.proxy.auth.auth_checks import get_team_object - from litellm.proxy.proxy_server import ( - prisma_client, - proxy_logging_obj, - user_api_key_cache, - ) - - if prisma_client is not None: - team_obj = await get_team_object( - team_id=user_api_key_auth.team_id, - prisma_client=prisma_client, - user_api_key_cache=user_api_key_cache, - parent_otel_span=user_api_key_auth.parent_otel_span, - proxy_logging_obj=proxy_logging_obj, + # 2. Also include agents from team's access_group_ids (unified access groups) + team_access_group_ids = team_obj.access_group_ids or [] + if team_access_group_ids: + from litellm.proxy.auth.auth_checks import ( + _get_agent_ids_from_access_groups, ) - if team_obj is not None: - team_access_group_ids = team_obj.access_group_ids or [] - if team_access_group_ids: - from litellm.proxy.auth.auth_checks import ( - _get_agent_ids_from_access_groups, - ) - unified_agents = await _get_agent_ids_from_access_groups( - access_group_ids=team_access_group_ids, - ) - all_agents.extend(unified_agents) + unified_agents = await _get_agent_ids_from_access_groups( + access_group_ids=team_access_group_ids, + ) + all_agents.extend(unified_agents) return list(set(all_agents)) except Exception as e: diff --git a/litellm/proxy/auth/auth_checks.py b/litellm/proxy/auth/auth_checks.py index a4ec2b34c41..3eb6f28ddfc 100644 --- a/litellm/proxy/auth/auth_checks.py +++ b/litellm/proxy/auth/auth_checks.py @@ -2471,7 +2471,7 @@ async def can_team_access_model( except ProxyException: # Fallback: check team's access_group_ids team_access_group_ids = ( - team_object.access_group_ids or [] if team_object else [] + (team_object.access_group_ids or []) if team_object else [] ) if team_access_group_ids: models_from_groups = await _get_models_from_access_groups( From c311033f48d6c8025bfd8c100f232914ed2ea10e Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Sat, 14 Feb 2026 09:28:02 -0800 Subject: [PATCH 036/182] cache adjustment for deleted teams and keys --- .../access_group_endpoints.py | 47 ++++ .../test_access_group_endpoints.py | 264 ++++++++++++++++-- 2 files changed, 282 insertions(+), 29 deletions(-) diff --git a/litellm/proxy/management_endpoints/access_group_endpoints.py b/litellm/proxy/management_endpoints/access_group_endpoints.py index 737d54beb1c..12aa748bbc3 100644 --- a/litellm/proxy/management_endpoints/access_group_endpoints.py +++ b/litellm/proxy/management_endpoints/access_group_endpoints.py @@ -11,7 +11,10 @@ from litellm.proxy._types import ( ) from litellm.proxy.auth.auth_checks import ( _cache_access_object, + _cache_key_object, + _cache_team_object, _delete_cache_access_object, + _get_team_object_from_cache, ) from litellm.proxy.auth.user_api_key_auth import user_api_key_auth from litellm.proxy.db.exception_handler import PrismaDBExceptionHandler @@ -237,6 +240,10 @@ async def delete_access_group( prisma_client = get_prisma_client_or_throw(CommonProxyErrors.db_not_connected_error.value) try: + # Track affected team IDs and key tokens for cache invalidation + affected_team_ids: list = [] + affected_key_tokens: list = [] + async with prisma_client.db.tx() as tx: existing = await tx.litellm_accessgrouptable.find_unique( where={"access_group_id": access_group_id} @@ -252,6 +259,7 @@ async def delete_access_group( where={"access_group_ids": {"hasSome": [access_group_id]}} ) for team in teams_with_group: + affected_team_ids.append(team.team_id) updated_ids = [tid for tid in (team.access_group_ids or []) if tid != access_group_id] await tx.litellm_teamtable.update( where={"team_id": team.team_id}, @@ -262,6 +270,7 @@ async def delete_access_group( where={"access_group_ids": {"hasSome": [access_group_id]}} ) for key in keys_with_group: + affected_key_tokens.append(key.token) updated_ids = [kid for kid in (key.access_group_ids or []) if kid != access_group_id] await tx.litellm_verificationtoken.update( where={"token": key.token}, @@ -275,6 +284,44 @@ async def delete_access_group( # Invalidate the deleted access group from cache await _invalidate_cache_access_group(access_group_id) + # Patch cached team and key objects to remove the deleted access_group_id + # instead of fully invalidating them (keeps cache warm, avoids DB re-fetch) + from litellm.proxy.proxy_server import proxy_logging_obj, user_api_key_cache + + for team_id in affected_team_ids: + cached_team = await _get_team_object_from_cache( + key="team_id:{}".format(team_id), + proxy_logging_obj=proxy_logging_obj, + user_api_key_cache=user_api_key_cache, + parent_otel_span=None, + ) + if cached_team is not None and cached_team.access_group_ids: + cached_team.access_group_ids = [ + ag_id for ag_id in cached_team.access_group_ids if ag_id != access_group_id + ] + await _cache_team_object( + team_id=team_id, + team_table=cached_team, + user_api_key_cache=user_api_key_cache, + proxy_logging_obj=proxy_logging_obj, + ) + + for token in affected_key_tokens: + cached_key = await user_api_key_cache.async_get_cache(key=token) + if cached_key is not None: + if isinstance(cached_key, dict): + cached_key = UserAPIKeyAuth(**cached_key) + if isinstance(cached_key, UserAPIKeyAuth) and cached_key.access_group_ids: + cached_key.access_group_ids = [ + ag_id for ag_id in cached_key.access_group_ids if ag_id != access_group_id + ] + await _cache_key_object( + hashed_token=token, + user_api_key_obj=cached_key, + user_api_key_cache=user_api_key_cache, + proxy_logging_obj=proxy_logging_obj, + ) + except HTTPException: raise except Exception as e: diff --git a/tests/test_litellm/proxy/management_endpoints/test_access_group_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_access_group_endpoints.py index 181ec8464ff..9b6e0631762 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_access_group_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_access_group_endpoints.py @@ -127,6 +127,7 @@ def client_and_mocks(monkeypatch): # Mock user_api_key_cache and proxy_logging_obj for cache operations (create/update/delete) mock_cache = MagicMock() mock_cache.async_set_cache = AsyncMock(return_value=None) + mock_cache.async_get_cache = AsyncMock(return_value=None) mock_cache.delete_cache = MagicMock(return_value=None) monkeypatch.setattr(ps, "user_api_key_cache", mock_cache) @@ -136,6 +137,12 @@ def client_and_mocks(monkeypatch): mock_proxy_logging.internal_usage_cache.dual_cache.async_delete_cache = AsyncMock( return_value=None ) + mock_proxy_logging.internal_usage_cache.dual_cache.async_get_cache = AsyncMock( + return_value=None + ) + mock_proxy_logging.internal_usage_cache.dual_cache.async_set_cache = AsyncMock( + return_value=None + ) monkeypatch.setattr(ps, "proxy_logging_obj", mock_proxy_logging) admin_user = UserAPIKeyAuth( @@ -146,7 +153,7 @@ def client_and_mocks(monkeypatch): client = TestClient(app) - yield client, mock_prisma, mock_access_group_table + yield client, mock_prisma, mock_access_group_table, mock_cache, mock_proxy_logging app.dependency_overrides.clear() monkeypatch.setattr(ps, "prisma_client", ps.prisma_client) @@ -177,7 +184,7 @@ ACCESS_GROUP_PATHS = ["/v1/access_group", "/v1/unified_access_group"] ) def test_create_access_group_success(client_and_mocks, base_path, payload): """Create access group with various payloads returns 201.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks resp = client.post(base_path, json=payload) assert resp.status_code == 201 @@ -189,7 +196,7 @@ def test_create_access_group_success(client_and_mocks, base_path, payload): def test_create_access_group_duplicate_name_conflict(client_and_mocks): """Create with duplicate name returns 409.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks existing = _make_access_group_record(access_group_name="existing-group") mock_table.find_unique = AsyncMock(return_value=existing) @@ -209,7 +216,7 @@ def test_create_access_group_duplicate_name_conflict(client_and_mocks): ) def test_create_access_group_race_condition_returns_409(client_and_mocks, error_message): """Create race condition: Prisma unique constraint surfaces as 409, not 500.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks mock_table.find_unique = AsyncMock(return_value=None) mock_table.create = AsyncMock(side_effect=Exception(error_message)) @@ -222,7 +229,7 @@ def test_create_access_group_race_condition_returns_409(client_and_mocks, error_ @pytest.mark.parametrize("user_role", [LitellmUserRoles.INTERNAL_USER, LitellmUserRoles.INTERNAL_USER_VIEW_ONLY]) def test_create_access_group_forbidden_non_admin(client_and_mocks, user_role): """Non-admin users cannot create access groups.""" - client, _, _ = client_and_mocks + client, *_ = client_and_mocks app.dependency_overrides[ps.user_api_key_auth] = lambda: UserAPIKeyAuth( user_id="regular_user", @@ -236,7 +243,7 @@ def test_create_access_group_forbidden_non_admin(client_and_mocks, user_role): def test_create_access_group_validation_missing_name(client_and_mocks): """Create with missing access_group_name returns 422.""" - client, _, _ = client_and_mocks + client, *_ = client_and_mocks resp = client.post("/v1/access_group", json={}) assert resp.status_code == 422 @@ -244,7 +251,7 @@ def test_create_access_group_validation_missing_name(client_and_mocks): def test_create_access_group_500_on_non_constraint_prisma_error(client_and_mocks): """Create with non-unique-constraint Prisma error returns 500.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks mock_table.find_unique = AsyncMock(return_value=None) mock_table.create = AsyncMock(side_effect=Exception("Some other database error")) @@ -263,7 +270,7 @@ def test_create_access_group_500_on_non_constraint_prisma_error(client_and_mocks @pytest.mark.parametrize("base_path", ACCESS_GROUP_PATHS) def test_list_access_groups_success_empty(client_and_mocks, base_path): """List access groups returns empty list when none exist.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks resp = client.get(base_path) assert resp.status_code == 200 @@ -274,7 +281,7 @@ def test_list_access_groups_success_empty(client_and_mocks, base_path): @pytest.mark.parametrize("base_path", ACCESS_GROUP_PATHS) def test_list_access_groups_success_with_items(client_and_mocks, base_path): """List access groups returns items when they exist.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks records = [ _make_access_group_record(access_group_id="ag-1", access_group_name="group-1"), @@ -293,7 +300,7 @@ def test_list_access_groups_success_with_items(client_and_mocks, base_path): @pytest.mark.parametrize("base_path", ACCESS_GROUP_PATHS) def test_list_access_groups_ordered_by_created_at_desc(client_and_mocks, base_path): """List access groups calls find_many with created_at desc order.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks older = datetime(2025, 1, 1, 12, 0, 0) newer = datetime(2025, 1, 2, 12, 0, 0) @@ -324,7 +331,7 @@ def test_list_access_groups_ordered_by_created_at_desc(client_and_mocks, base_pa @pytest.mark.parametrize("user_role", [LitellmUserRoles.INTERNAL_USER, LitellmUserRoles.INTERNAL_USER_VIEW_ONLY]) def test_list_access_groups_forbidden_non_admin(client_and_mocks, user_role): """Non-admin users cannot list access groups.""" - client, _, _ = client_and_mocks + client, *_ = client_and_mocks app.dependency_overrides[ps.user_api_key_auth] = lambda: UserAPIKeyAuth( user_id="regular_user", @@ -345,7 +352,7 @@ def test_list_access_groups_forbidden_non_admin(client_and_mocks, user_role): @pytest.mark.parametrize("access_group_id", ["ag-123", "ag-other-id"]) def test_get_access_group_success(client_and_mocks, base_path, access_group_id): """Get access group by id returns record when found.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks record = _make_access_group_record(access_group_id=access_group_id) mock_table.find_unique = AsyncMock(return_value=record) @@ -357,7 +364,7 @@ def test_get_access_group_success(client_and_mocks, base_path, access_group_id): def test_get_access_group_not_found(client_and_mocks): """Get access group returns 404 when not found.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks mock_table.find_unique = AsyncMock(return_value=None) @@ -369,7 +376,7 @@ def test_get_access_group_not_found(client_and_mocks): @pytest.mark.parametrize("user_role", [LitellmUserRoles.INTERNAL_USER, LitellmUserRoles.INTERNAL_USER_VIEW_ONLY]) def test_get_access_group_forbidden_non_admin(client_and_mocks, user_role): """Non-admin users cannot get access group.""" - client, _, _ = client_and_mocks + client, *_ = client_and_mocks app.dependency_overrides[ps.user_api_key_auth] = lambda: UserAPIKeyAuth( user_id="regular_user", @@ -397,7 +404,7 @@ def test_get_access_group_forbidden_non_admin(client_and_mocks, user_role): ) def test_update_access_group_success(client_and_mocks, base_path, update_payload): """Update access group with various payloads returns 200.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks existing = _make_access_group_record(access_group_id="ag-update") mock_table.find_unique = AsyncMock(return_value=existing) @@ -409,7 +416,7 @@ def test_update_access_group_success(client_and_mocks, base_path, update_payload def test_update_access_group_not_found(client_and_mocks): """Update access group returns 404 when not found.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks mock_table.find_unique = AsyncMock(return_value=None) @@ -425,7 +432,7 @@ def test_update_access_group_not_found(client_and_mocks): @pytest.mark.parametrize("user_role", [LitellmUserRoles.INTERNAL_USER, LitellmUserRoles.INTERNAL_USER_VIEW_ONLY]) def test_update_access_group_forbidden_non_admin(client_and_mocks, user_role): """Non-admin users cannot update access groups.""" - client, _, _ = client_and_mocks + client, *_ = client_and_mocks app.dependency_overrides[ps.user_api_key_auth] = lambda: UserAPIKeyAuth( user_id="regular_user", @@ -439,7 +446,7 @@ def test_update_access_group_forbidden_non_admin(client_and_mocks, user_role): def test_update_access_group_empty_body(client_and_mocks): """Update with empty body succeeds; only updated_by is set.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks existing = _make_access_group_record(access_group_id="ag-update", access_group_name="unchanged") mock_table.find_unique = AsyncMock(return_value=existing) @@ -455,7 +462,7 @@ def test_update_access_group_empty_body(client_and_mocks): def test_update_access_group_name_success(client_and_mocks): """Update access_group_name succeeds when new name is unique.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks existing = _make_access_group_record(access_group_id="ag-update", access_group_name="old-name") mock_table.find_unique = AsyncMock(return_value=existing) @@ -469,7 +476,7 @@ def test_update_access_group_name_success(client_and_mocks): def test_update_access_group_name_duplicate_conflict(client_and_mocks): """Update access_group_name to existing name returns 409 (unique constraint).""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks existing = _make_access_group_record(access_group_id="ag-update", access_group_name="old-name") mock_table.find_unique = AsyncMock(return_value=existing) @@ -493,7 +500,7 @@ def test_update_access_group_name_duplicate_conflict(client_and_mocks): ) def test_update_access_group_name_unique_constraint_returns_409(client_and_mocks, error_message): """Update access_group_name: Prisma unique constraint surfaces as 409.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks existing = _make_access_group_record(access_group_id="ag-update", access_group_name="old-name") mock_table.find_unique = AsyncMock(return_value=existing) @@ -513,7 +520,7 @@ def test_update_access_group_name_unique_constraint_returns_409(client_and_mocks @pytest.mark.parametrize("access_group_id", ["ag-123", "ag-delete-me"]) def test_delete_access_group_success(client_and_mocks, base_path, access_group_id): """Delete access group returns 204 when found.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks existing = _make_access_group_record(access_group_id=access_group_id) mock_table.find_unique = AsyncMock(return_value=existing) @@ -525,7 +532,7 @@ def test_delete_access_group_success(client_and_mocks, base_path, access_group_i def test_delete_access_group_not_found(client_and_mocks): """Delete access group returns 404 when not found.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks mock_table.find_unique = AsyncMock(return_value=None) @@ -538,7 +545,7 @@ def test_delete_access_group_not_found(client_and_mocks): @pytest.mark.parametrize("user_role", [LitellmUserRoles.INTERNAL_USER, LitellmUserRoles.INTERNAL_USER_VIEW_ONLY]) def test_delete_access_group_forbidden_non_admin(client_and_mocks, user_role): """Non-admin users cannot delete access groups.""" - client, _, _ = client_and_mocks + client, *_ = client_and_mocks app.dependency_overrides[ps.user_api_key_auth] = lambda: UserAPIKeyAuth( user_id="regular_user", @@ -552,7 +559,7 @@ def test_delete_access_group_forbidden_non_admin(client_and_mocks, user_role): def test_delete_access_group_cleans_up_teams_and_keys(client_and_mocks): """Delete removes access_group_id from teams and keys before deleting the group.""" - client, mock_prisma, mock_access_group_table = client_and_mocks + client, mock_prisma, mock_access_group_table, mock_cache, mock_proxy_logging = client_and_mocks mock_team_table = mock_prisma.db.litellm_teamtable mock_key_table = mock_prisma.db.litellm_verificationtoken @@ -585,9 +592,208 @@ def test_delete_access_group_cleans_up_teams_and_keys(client_and_mocks): ) +@pytest.mark.parametrize( + "team_cache_group_ids,key_cache_group_ids,expected_team_ids_after,expected_key_ids_after", + [ + # Team and key both cached with the deleted group + ( + ["ag-to-delete", "ag-keep"], + ["ag-to-delete", "ag-stay"], + ["ag-keep"], + ["ag-stay"], + ), + # Only team cached; key not in cache + ( + ["ag-to-delete"], + None, + [], + None, + ), + # Only key cached; team not in cache + ( + None, + ["ag-to-delete"], + None, + [], + ), + # Neither cached — nothing to patch + ( + None, + None, + None, + None, + ), + # Cached team has only the deleted group + ( + ["ag-to-delete"], + ["ag-to-delete"], + [], + [], + ), + # Cached objects have multiple groups, only the deleted one is removed + ( + ["ag-alpha", "ag-to-delete", "ag-beta"], + ["ag-to-delete", "ag-gamma"], + ["ag-alpha", "ag-beta"], + ["ag-gamma"], + ), + ], + ids=[ + "both_cached", + "only_team_cached", + "only_key_cached", + "neither_cached", + "single_group_removed", + "multi_group_partial_removal", + ], +) +def test_delete_access_group_patches_cached_team_and_key( + client_and_mocks, + team_cache_group_ids, + key_cache_group_ids, + expected_team_ids_after, + expected_key_ids_after, +): + """Delete patches cached team/key objects to remove the deleted access_group_id.""" + from litellm.proxy._types import LiteLLM_TeamTableCachedObj + + client, mock_prisma, mock_access_group_table, mock_cache, mock_proxy_logging = client_and_mocks + mock_team_table = mock_prisma.db.litellm_teamtable + mock_key_table = mock_prisma.db.litellm_verificationtoken + + existing = _make_access_group_record(access_group_id="ag-to-delete") + mock_access_group_table.find_unique = AsyncMock(return_value=existing) + + # Set up a team and key in the DB that reference the group + team_with_group = MagicMock() + team_with_group.team_id = "team-1" + team_with_group.access_group_ids = ["ag-to-delete", "ag-keep"] + mock_team_table.find_many = AsyncMock(return_value=[team_with_group]) + + key_with_group = MagicMock() + key_with_group.token = "hashed-key-1" + key_with_group.access_group_ids = ["ag-to-delete"] + mock_key_table.find_many = AsyncMock(return_value=[key_with_group]) + + # Build cached team object (returned from proxy_logging dual cache) + if team_cache_group_ids is not None: + cached_team = LiteLLM_TeamTableCachedObj( + team_id="team-1", + access_group_ids=list(team_cache_group_ids), + ) + mock_proxy_logging.internal_usage_cache.dual_cache.async_get_cache = AsyncMock( + return_value=cached_team + ) + else: + mock_proxy_logging.internal_usage_cache.dual_cache.async_get_cache = AsyncMock( + return_value=None + ) + + # Build cached key object (returned from user_api_key_cache) + if key_cache_group_ids is not None: + cached_key = UserAPIKeyAuth( + token="hashed-key-1", + access_group_ids=list(key_cache_group_ids), + ) + mock_cache.async_get_cache = AsyncMock(return_value=cached_key) + else: + mock_cache.async_get_cache = AsyncMock(return_value=None) + + resp = client.delete("/v1/access_group/ag-to-delete") + assert resp.status_code == 204 + + # Verify DB cleanup always happens + mock_team_table.update.assert_awaited_once() + mock_key_table.update.assert_awaited_once() + + # Verify cache patching + if expected_team_ids_after is not None: + # _cache_team_object writes via _cache_management_object -> async_set_cache + team_set_calls = [ + c for c in mock_cache.async_set_cache.call_args_list + if c.kwargs.get("key", "") == "team_id:team-1" + or (len(c.args) >= 1 and c.args[0] == "team_id:team-1") + ] + assert len(team_set_calls) >= 1, "Expected team cache to be patched" + # The cached team object should have the updated access_group_ids + written_team = team_set_calls[0].kwargs.get("value") or team_set_calls[0].args[1] + if isinstance(written_team, LiteLLM_TeamTableCachedObj): + assert written_team.access_group_ids == expected_team_ids_after + else: + # No team in cache — async_set_cache should not be called for team_id key + team_set_calls = [ + c for c in mock_cache.async_set_cache.call_args_list + if c.kwargs.get("key", "") == "team_id:team-1" + or (len(c.args) >= 1 and c.args[0] == "team_id:team-1") + ] + assert len(team_set_calls) == 0, "Should not patch team cache when not cached" + + if expected_key_ids_after is not None: + key_set_calls = [ + c for c in mock_cache.async_set_cache.call_args_list + if c.kwargs.get("key", "") == "hashed-key-1" + or (len(c.args) >= 1 and c.args[0] == "hashed-key-1") + ] + assert len(key_set_calls) >= 1, "Expected key cache to be patched" + written_key = key_set_calls[0].kwargs.get("value") or key_set_calls[0].args[1] + if isinstance(written_key, UserAPIKeyAuth): + assert written_key.access_group_ids == expected_key_ids_after + else: + key_set_calls = [ + c for c in mock_cache.async_set_cache.call_args_list + if c.kwargs.get("key", "") == "hashed-key-1" + or (len(c.args) >= 1 and c.args[0] == "hashed-key-1") + ] + assert len(key_set_calls) == 0, "Should not patch key cache when not cached" + + +def test_delete_access_group_patches_key_cached_as_dict(client_and_mocks): + """Delete correctly patches a key cached as a raw dict (not UserAPIKeyAuth).""" + client, mock_prisma, mock_access_group_table, mock_cache, mock_proxy_logging = client_and_mocks + mock_team_table = mock_prisma.db.litellm_teamtable + mock_key_table = mock_prisma.db.litellm_verificationtoken + + existing = _make_access_group_record(access_group_id="ag-to-delete") + mock_access_group_table.find_unique = AsyncMock(return_value=existing) + + mock_team_table.find_many = AsyncMock(return_value=[]) + + key_with_group = MagicMock() + key_with_group.token = "hashed-key-dict" + key_with_group.access_group_ids = ["ag-to-delete", "ag-other"] + mock_key_table.find_many = AsyncMock(return_value=[key_with_group]) + + # No team in cache + mock_proxy_logging.internal_usage_cache.dual_cache.async_get_cache = AsyncMock( + return_value=None + ) + + # Key cached as a plain dict (as can happen with Redis serialization) + mock_cache.async_get_cache = AsyncMock( + return_value={ + "token": "hashed-key-dict", + "access_group_ids": ["ag-to-delete", "ag-other"], + } + ) + + resp = client.delete("/v1/access_group/ag-to-delete") + assert resp.status_code == 204 + + # The key should have been re-cached with the deleted group removed + key_set_calls = [ + c for c in mock_cache.async_set_cache.call_args_list + if c.kwargs.get("key", "") == "hashed-key-dict" + or (len(c.args) >= 1 and c.args[0] == "hashed-key-dict") + ] + assert len(key_set_calls) >= 1, "Expected key cache to be patched" + written_key = key_set_calls[0].kwargs.get("value") or key_set_calls[0].args[1] + if isinstance(written_key, UserAPIKeyAuth): + assert written_key.access_group_ids == ["ag-other"] + + def test_delete_access_group_503_on_db_connection_error(client_and_mocks): """Delete returns 503 when DB connection error occurs during transaction.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks existing = _make_access_group_record(access_group_id="ag-to-delete") mock_table.find_unique = AsyncMock(return_value=existing) @@ -600,7 +806,7 @@ def test_delete_access_group_503_on_db_connection_error(client_and_mocks): def test_delete_access_group_404_on_p2025_or_record_not_found(client_and_mocks): """Delete returns 404 when Prisma raises P2025 or record-not-found error.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks existing = _make_access_group_record(access_group_id="ag-to-delete") mock_table.find_unique = AsyncMock(return_value=existing) @@ -613,7 +819,7 @@ def test_delete_access_group_404_on_p2025_or_record_not_found(client_and_mocks): def test_delete_access_group_500_on_generic_exception(client_and_mocks): """Delete returns 500 when generic exception occurs during transaction.""" - client, _, mock_table = client_and_mocks + client, _, mock_table, *_ = client_and_mocks existing = _make_access_group_record(access_group_id="ag-to-delete") mock_table.find_unique = AsyncMock(return_value=existing) @@ -647,7 +853,7 @@ def test_delete_access_group_500_on_generic_exception(client_and_mocks): ) def test_access_group_endpoints_db_not_connected(client_and_mocks, monkeypatch, method, url, factory): """All endpoints return 500 when DB is not connected.""" - client, _, _ = client_and_mocks + client, *_ = client_and_mocks monkeypatch.setattr(ps, "prisma_client", None) From 0f3494659ad909e8546a08a994aa185bf778429c Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Sat, 14 Feb 2026 09:29:42 -0800 Subject: [PATCH 037/182] chore: update Next.js build artifacts (2026-02-14 17:29 UTC, node v22.16.0) --- litellm/proxy/_experimental/out/404.html | 2 +- .../_experimental/out/__next.__PAGE__.txt | 31 + .../proxy/_experimental/out/__next._full.txt | 62 ++ .../proxy/_experimental/out/__next._head.txt | 6 + .../proxy/_experimental/out/__next._index.txt | 7 + .../proxy/_experimental/out/__next._tree.txt | 5 + .../-YcCp5y5G0wpTwGaCJTwX/_buildManifest.js | 1 - .../FNzcPugrMYo8KWdUvIcl9/_buildManifest.js | 16 + .../_clientMiddlewareManifest.json | 1 + .../_ssgManifest.js | 0 .../_next/static/chunks/00bcc8d30dd19793.js | 9 + .../_next/static/chunks/00ff280cdb7d7ee5.js | 1 + .../_next/static/chunks/01d33dac4f6576c1.js | 8 + .../_next/static/chunks/04b9c7b5c33ea26c.js | 14 + .../_next/static/chunks/06aaedbe7d27898c.js | 1 + .../_next/static/chunks/0a65da2cd24e2ab6.js | 3 + .../_next/static/chunks/0a671fedee641c02.js | 1 + .../_next/static/chunks/0a6c418370a8c183.js | 41 ++ .../_next/static/chunks/0aece5fc054ad66e.js | 1 + .../_next/static/chunks/0d1694151d7fdaec.js | 38 ++ .../_next/static/chunks/1067d2c077cd73d6.js | 4 + .../static/chunks/1088-c02fed07efa8e3b8.js | 1 - .../static/chunks/1098-f78fb04eeb42c4e0.js | 1 - .../static/chunks/1112-62aa5eef02a46309.js | 1 - .../static/chunks/1125-997dafd1c51527b8.js | 1 - .../_next/static/chunks/11383a8b78399079.js | 8 + .../static/chunks/115-9b3af056f550fde4.js | 1 - .../static/chunks/1208-c73262bafe09e8d7.js | 8 - .../_next/static/chunks/120d96e5e05ab994.js | 2 + .../static/chunks/1213-9a1179ea50cba754.js | 1 - .../_next/static/chunks/121a51d3bbb6f362.js | 7 + .../static/chunks/1236-c4d9ccb0f99a3b51.js | 1 - .../_next/static/chunks/1300460219810c10.js | 4 + .../_next/static/chunks/134f728fa7099e3e.js | 55 ++ .../_next/static/chunks/14096aec9021bf29.js | 1 + .../static/chunks/1512-a2667f307ad7c115.js | 1 - .../static/chunks/1632-4f95f33a116ba3b2.js | 1 - .../_next/static/chunks/16ddc23511fe16c0.js | 8 + .../static/chunks/1747-6538506d0a7865be.js | 1 - .../_next/static/chunks/179f4b987bc9083f.js | 9 + .../_next/static/chunks/193ac6435f936582.js | 1 + .../static/chunks/1953-4abaab16a291b91b.js | 1 - .../static/chunks/1994-39659d054539ed7e.js | 1 - .../_next/static/chunks/1a02bad0824510c9.js | 1 + .../_next/static/chunks/1ab4ccc7c0ba9eff.js | 14 + .../_next/static/chunks/1b20284f2d2f96a3.js | 1 + .../_next/static/chunks/1d3826d625e92c33.js | 2 + .../_next/static/chunks/1e0e6eb47fe60159.js | 1 + .../_next/static/chunks/1fe0596a309ad6cf.js | 12 + .../_next/static/chunks/20c32f4791dcb18b.js | 8 + .../static/chunks/2117-e455d1d5f3f70c13.js | 2 - .../_next/static/chunks/21ae464276343547.js | 84 +++ .../_next/static/chunks/22e715061d511345.js | 8 + .../_next/static/chunks/23f80b1de2d3b634.js | 1 + .../_next/static/chunks/25d1ef14bd591cf9.js | 8 + .../static/chunks/2618-e3b2304a0f9519ff.js | 1 - .../static/chunks/2652-b5e59300361a628d.js | 1 - .../static/chunks/2684-bf5f673f82c4ea4d.js | 1 - .../_next/static/chunks/26adfa4e8ffc85c7.js | 1 + .../_next/static/chunks/27195d3ec0cab1b4.js | 1 + .../static/chunks/2784-2ad5876fe92fda98.js | 1 - .../_next/static/chunks/27c7596aa0326b71.js | 4 + .../static/chunks/2829-0e5cc4beadf61932.js | 1 - .../static/chunks/2926-8969275129112ce3.js | 1 - .../_next/static/chunks/2971c4658f1bcd7d.js | 1 + .../_next/static/chunks/29f80447de6eef64.js | 1 + .../chunks/3014691f-3744547003ceb497.js | 1 - .../static/chunks/3092-058fbb7ae622a10e.js | 1 - .../static/chunks/3125-ebfbf54b5940a5f0.js | 1 - .../static/chunks/3331-ea7fa9112bc1f4ed.js | 1 - .../static/chunks/3367-c994bf9785fb130d.js | 1 - .../static/chunks/337-786f5154f8a6e761.js | 1 - .../static/chunks/3407-ef143b4b8627965b.js | 1 - .../_next/static/chunks/3454255bdea68dda.js | 1 + .../static/chunks/353-134ffd729cd05fa6.js | 1 - .../_next/static/chunks/36ccc2b555a26ad4.js | 4 + .../static/chunks/3709-06e05a2318097e5d.js | 1 - .../static/chunks/3711-9bcd66aa46b4451a.js | 1 - .../static/chunks/3729-2f31823fd505fab2.js | 1 - .../static/chunks/3792-9552eeef41f80194.js | 1 - .../static/chunks/3866-a7f4f033a7a018b5.js | 1 - .../static/chunks/3885-0ea2230667989a21.js | 1 - .../_next/static/chunks/391d3aca1957236a.js | 1 + .../_next/static/chunks/3afadb9a550fc886.js | 1 + .../_next/static/chunks/3b30ab8eaa03bc21.js | 4 + .../_next/static/chunks/3dad14bcec641ba8.js | 1 + .../_next/static/chunks/3f369c603677cd7a.js | 1 + .../_next/static/chunks/3f3fa56b5786d58c.css | 1 + .../_next/static/chunks/3f49d66311c27fe1.js | 105 +++ .../_next/static/chunks/403c4d96324c23a6.js | 3 + .../_next/static/chunks/40e89c053e10e01c.js | 1 + .../static/chunks/4114-fda9c53fcb013293.js | 1 - .../_next/static/chunks/4188d520ca4e5f2b.js | 1 + .../static/chunks/4221-9eb0cc777c84e269.js | 1 - .../_next/static/chunks/4262f254ec63c549.js | 1 + .../static/chunks/4341-250db613af0fba0e.js | 1 - .../_next/static/chunks/44edba5625a9a9b4.js | 68 ++ .../_next/static/chunks/450ebd094f4fa24d.js | 1 + .../_next/static/chunks/4537761df9dff7f0.js | 1 + .../_next/static/chunks/457923c551f21385.js | 598 ++++++++++++++++++ .../_next/static/chunks/4587f4ad9ebcbb4e.js | 12 + .../_next/static/chunks/464560f129260d42.js | 420 ++++++++++++ .../static/chunks/4752-9dab5f654a9a66f8.js | 1 - .../static/chunks/4776-9da324bc53b94c99.js | 1 - .../static/chunks/4804-aac05f01eb7e1eb1.js | 1 - .../static/chunks/4851-d557e58e9186f46c.js | 1 - .../static/chunks/4865-0bb410f43dfbdb9a.js | 1 - .../_next/static/chunks/49562ec1ef0389b3.js | 1 + .../_next/static/chunks/496b84010c33cf69.js | 1 + .../_next/static/chunks/4980372eaa37b78b.js | 8 + .../_next/static/chunks/4adf500a979e2522.js | 8 + .../_next/static/chunks/4af6a1c366381700.js | 8 + .../_next/static/chunks/4bacf5b9194c12f5.js | 8 + .../_next/static/chunks/4c241fdd65d8e95b.js | 1 + .../_next/static/chunks/4e20891f2fd03463.css | 1 + .../_next/static/chunks/4ed86d695abe3c87.js | 1 + .../static/chunks/5000-f969129bcd09ccf5.js | 1 - .../static/chunks/513-f09847b9a6be7fa0.js | 1 - .../static/chunks/5144-5a65ef42a1955496.js | 1 - .../static/chunks/515-664d2fa20fede776.js | 1 - .../static/chunks/5173-18600847c10ce0b1.js | 1 - .../_next/static/chunks/52ed5bc35d5e5133.js | 1 + .../static/chunks/5319-15e1927d37a73075.js | 1 - .../_next/static/chunks/53218dce8acb3bff.js | 1 + .../static/chunks/536-1ea971c1dbdcd002.js | 1 - .../_next/static/chunks/542a1a209eb732c6.js | 7 + .../static/chunks/5510-617647f4a77073d6.js | 1 - .../_next/static/chunks/5583bc893837fdf8.js | 4 + .../_next/static/chunks/55c4117d5fcd0aae.js | 8 + .../_next/static/chunks/55f7e1462ab93421.js | 8 + .../_next/static/chunks/565cdfe156dcb380.js | 1 + .../static/chunks/5706-38b9521b17a03c62.js | 1 - .../_next/static/chunks/570b2e10aa856e54.js | 1 + .../static/chunks/5733-66d7f9ff534fdc28.js | 1 - .../static/chunks/5744-d13762919295ecb1.js | 1 - .../_next/static/chunks/5818dc2df34f9efc.js | 1 + .../static/chunks/5869-3be7f5b7e252e375.js | 1 - .../_next/static/chunks/58b9eb1766fba8e0.js | 7 + .../static/chunks/5975-52620444a79ca76d.js | 1 - .../_next/static/chunks/5b2b7fd4dd9a44f3.js | 4 + .../_next/static/chunks/5b9c0b6d6c814e58.js | 1 + .../_next/static/chunks/5d1f33f9fa668633.js | 179 ++++++ .../_next/static/chunks/5d3e07ae5afa6fa6.js | 105 +++ .../_next/static/chunks/5d547ead001142ce.js | 7 + .../_next/static/chunks/5eb6648cefff2d8a.js | 1 + .../_next/static/chunks/5f9c3b92a016f382.js | 14 + .../_next/static/chunks/6008d176e68995d6.js | 1 + .../static/chunks/6121-2076fab213c11143.js | 1 - .../_next/static/chunks/617bc18095fe8025.js | 7 + .../static/chunks/6213-555e4b60e6aae409.js | 1 - .../static/chunks/6263-b38d68c675bce16a.js | 1 - .../_next/static/chunks/6367dd1d1cf7eeef.js | 1 + .../static/chunks/6399-caf000072c096fbc.js | 1 - .../_next/static/chunks/64f1a2ef9113d86f.js | 13 + .../static/chunks/6554-0673737425072d76.js | 1 - .../static/chunks/6600-3d7725da829062ce.js | 1 - .../static/chunks/6609-1fc2206fe2aede7e.js | 1 - .../static/chunks/665-0b6864635d780032.js | 1 - .../static/chunks/6697-dad1379b933195d0.js | 1 - .../_next/static/chunks/66a190706fc6c35a.js | 167 +++++ .../_next/static/chunks/67570d9401e62846.js | 3 + .../_next/static/chunks/6774f9c1f201e744.js | 1 + .../static/chunks/6891-f1ac8ffa31a6df21.js | 1 - .../static/chunks/6894-2fd23948f7e54e8a.js | 4 - .../static/chunks/6941-536f8e8db15f47f4.js | 1 - .../_next/static/chunks/6ad80d0858c84af4.js | 1 + .../_next/static/chunks/6c4c97f1ea6e7d77.js | 4 + .../_next/static/chunks/6d587e6e43260fc9.js | 19 + .../_next/static/chunks/6e033c78c15ab9a6.js | 4 + .../static/chunks/7117-d281a769913bfb9d.js | 1 - .../_next/static/chunks/7214f5c31e651298.js | 1 + .../_next/static/chunks/72250192fd3153b7.js | 1 + .../static/chunks/7271-679d2708358f8f7b.js | 1 - .../_next/static/chunks/730305e005d7bd1d.js | 105 +++ .../_next/static/chunks/738c339383c3b4b6.js | 1 + .../static/chunks/7474-889476d5d23d4e55.js | 1 - .../_next/static/chunks/74982774ef38dcdb.js | 2 + .../static/chunks/7526-dde6bc1b8c04d02f.js | 1 - .../_next/static/chunks/76a83e13dfaf23db.js | 2 + .../static/chunks/7746-6eba538311e1b174.js | 1 - .../static/chunks/7840-d53dd626c4b8aba4.js | 1 - .../static/chunks/786-18be523d92ce1097.js | 1 - .../static/chunks/7906-74ae99e62d197da3.js | 1 - .../_next/static/chunks/799b258fbe06c072.js | 1 + .../_next/static/chunks/7af309decf630af7.js | 1 + .../_next/static/chunks/7b788dd93ad868b3.js | 1 + .../_next/static/chunks/7ce19d2281dd4011.js | 1 + .../_next/static/chunks/7d75124a5bfd9588.js | 1 + .../_next/static/chunks/7e2badb3d178f837.js | 13 + .../_next/static/chunks/7e3f5ce4b2a613d4.js | 1 + .../_next/static/chunks/7e417dd24c8becd0.js | 1 + .../_next/static/chunks/7f9e9c54ac262de2.js | 1 + .../static/chunks/8049-0790984190a47d46.js | 1 - .../static/chunks/8143-88f2b6e87ee73823.js | 1 - .../_next/static/chunks/81b07b773a2abeeb.js | 7 + .../_next/static/chunks/81e224efc874dea6.js | 8 + .../static/chunks/8221-6fb2e6af1131a7a2.js | 1 - .../_next/static/chunks/82ef36abe5e2e833.js | 1 + .../_next/static/chunks/8354d717e34ebd6f.js | 86 +++ .../_next/static/chunks/8485b66c53cff513.js | 1 + .../_next/static/chunks/84884fbf517f5d74.js | 1 + .../static/chunks/8507-c6b80922c66bc943.js | 1 - .../static/chunks/8640-89a75388b9a92a2c.js | 1 - .../_next/static/chunks/86b8d7c6282e3520.js | 1 + .../static/chunks/8736-69ed8b05f04b0615.js | 1 - .../_next/static/chunks/88876358fce5a2d8.js | 8 + .../_next/static/chunks/88c74f8b4b20d25a.js | 1 + .../_next/static/chunks/890364dd77e340a9.js | 1 + .../static/chunks/8907-b0dd2b0d2e3581b9.js | 5 - .../_next/static/chunks/8992001a9a91bc67.js | 1 + .../_next/static/chunks/89b9f8dbb6f0d490.js | 1 + .../_next/static/chunks/8a607e531e36f204.js | 8 + .../_next/static/chunks/8e12212d7a0aeaee.js | 4 + .../static/chunks/9037-32f2c937d7fda43c.js | 1 - .../static/chunks/9039-74aae2b078ef3414.js | 1 - .../static/chunks/9055-0b8d1226d5378b31.js | 1 - .../static/chunks/9190-8a1444f95a6df8a5.js | 1 - .../static/chunks/9258-ce960bcd573d7ce8.js | 1 - .../static/chunks/9262-b4a2177ca579ac89.js | 1 - .../static/chunks/9264-b013c415875d165a.js | 1 - .../_next/static/chunks/92cf5d832080641f.js | 13 + .../_next/static/chunks/93032856602932c1.js | 420 ++++++++++++ .../_next/static/chunks/937c3b6cb00f6b79.js | 13 + .../static/chunks/9442-0addb74077c3ac6c.js | 1 - .../static/chunks/9447-821c7c160976c68b.js | 1 - .../static/chunks/9553-92af9e2767601fc9.js | 1 - .../static/chunks/9611-418447af8f839a16.js | 1 - .../_next/static/chunks/97efd6e1c67bedcb.js | 421 ++++++++++++ .../_next/static/chunks/983036f73d37142a.js | 7 + .../_next/static/chunks/98593965456d6221.js | 1 + .../static/chunks/9992-3fd2edb28e89644e.js | 1 - .../_next/static/chunks/99be180c22b927f8.js | 167 +++++ .../_next/static/chunks/99cf9cf99df5ccfc.js | 1 + .../_next/static/chunks/9cf03e6d4b5b806e.js | 420 ++++++++++++ .../_next/static/chunks/9dc55e5c98dadc0f.js | 8 + .../_next/static/chunks/9f5ccd929375c1d6.js | 1 + .../_next/static/chunks/a0f302271a793712.js | 4 + .../_next/static/chunks/a1ef280b7ad5ae6a.js | 3 + .../_next/static/chunks/a21582fe1f52b973.js | 2 + .../_next/static/chunks/a382857dbbcea5d1.js | 50 ++ .../_next/static/chunks/a44b0c08814c45ae.js | 1 + .../_next/static/chunks/a477187ed455bc59.js | 1 + .../_next/static/chunks/a5b99c0875d4c9cf.js | 1 + .../_next/static/chunks/a5fe06c2cefac5bc.js | 1 + .../_next/static/chunks/a6dad97d9634a72d.js | 1 + .../static/chunks/a6dad97d9634a72d.js.map | 1 + .../_next/static/chunks/a7c0a41b6156d9b2.js | 1 + .../_next/static/chunks/a8fe9ac74ddfc8aa.js | 1 + .../_next/static/chunks/a966296c3a6b28f6.js | 2 + .../_next/static/chunks/a9ebedc318fa36dc.js | 1 + .../_next/static/chunks/ab7a826839e7e423.js | 1 + .../_next/static/chunks/ad02748134652429.js | 1 + .../api-reference/page-922b5e2fdafbd942.js | 1 - .../api-playground/page-648caa567791468b.js | 1 - .../budgets/page-47e65464111e3de5.js | 1 - .../caching/page-90c15ac22f3235d0.js | 1 - .../page-869f7711f27df002.js | 1 - .../old-usage/page-a3ee65e1ac6e11de.js | 1 - .../prompts/page-9bc8c3555bbec9ec.js | 1 - .../tag-management/page-c78d6c5df022fb84.js | 1 - .../guardrails/page-60b56c3b3ff203e6.js | 1 - .../(dashboard)/layout-7a868c8049b70343.js | 1 - .../(dashboard)/logs/page-a2df3b6735153dd3.js | 1 - .../model-hub/page-fd84db9638de8c38.js | 1 - .../page-4e453b71bdca9880.js | 1 - .../organizations/page-31a9cfc4fd6de748.js | 1 - .../playground/page-728f77f75dd27b1e.js | 1 - .../policies/page-ab88a2f8428feba0.js | 1 - .../admin-settings/page-971f8f5b92d08656.js | 1 - .../page-9dac1b11387d3d1b.js | 1 - .../router-settings/page-938cfbffd3788468.js | 1 - .../ui-theme/page-dd7de5d3e3c39f94.js | 1 - .../teams/page-9de6cde8c02fe237.js | 1 - .../test-key/page-3a68b854b4bbdcd6.js | 1 - .../mcp-servers/page-9a35a1280e0ecfb0.js | 1 - .../vector-stores/page-8db3f07230780069.js | 1 - .../usage/page-f6cc9bb14efffbaf.js | 1 - .../users/page-1e7666c0bc02703d.js | 1 - .../virtual-keys/page-459749f696b96c6f.js | 1 - .../app/_not-found/page-05c6a78b593da7d9.js | 1 - .../chunks/app/layout-066dc55ee81d2151.js | 1 - .../chunks/app/login/page-528809d7a1da96e3.js | 1 - .../oauth/callback/page-537827e984add08a.js | 1 - .../app/model_hub/page-03a1109c0e429bfb.js | 1 - .../model_hub_table/page-14e1e5255ce44df0.js | 1 - .../app/onboarding/page-49c02eb9c64f297d.js | 1 - .../chunks/app/page-bac47037ec8203b4.js | 1 - .../_next/static/chunks/b4b83382d3c7968a.js | 1 + .../_next/static/chunks/b5bcd87b218a6bcd.js | 14 + .../_next/static/chunks/b85f190e8626c49c.js | 1 + .../_next/static/chunks/ba5a05afc286361c.js | 8 + .../_next/static/chunks/baa15cbb8a22e3d5.js | 1 + .../_next/static/chunks/bd551344ff132d66.js | 1 + .../_next/static/chunks/bdf355b41816a002.js | 82 +++ .../_next/static/chunks/c058ac3e89dc33df.js | 1 + .../_next/static/chunks/c19d75622900fb62.js | 1 + .../_next/static/chunks/c1a1145476aa422b.js | 1 + .../_next/static/chunks/c1ac320d056807fe.js | 1 + .../_next/static/chunks/c24d3e9cf8b1b7ed.js | 139 ++++ .../_next/static/chunks/c4452a79c69324a6.js | 17 + .../_next/static/chunks/c45fb8a82fd72734.js | 8 + .../_next/static/chunks/c4bafdbb1a0ec1d3.js | 1 + .../_next/static/chunks/c5d11126226451ab.js | 1 + .../_next/static/chunks/c637e0ee56f50900.js | 216 +++++++ .../_next/static/chunks/c7b74067c01ee971.js | 2 + .../_next/static/chunks/c8a0095ffe8cea4a.js | 1 + .../_next/static/chunks/c9af2deb434988d6.js | 8 + .../_next/static/chunks/ca22b37c24b4d34a.js | 35 + .../_next/static/chunks/cb8e6ba28461af15.js | 4 + .../_next/static/chunks/cd9b2d4c4ae6ba20.js | 1 + .../_next/static/chunks/cdeb8eaf177eae12.js | 1 + .../_next/static/chunks/ce69b40ed22abf2d.js | 8 + .../_next/static/chunks/cf68fd1f1761ba48.js | 10 + .../_next/static/chunks/d1fe69810296bcf1.js | 1 + .../_next/static/chunks/d24f23929997cfa1.js | 1 + .../_next/static/chunks/d2aa91699d95f4b3.js | 1 + .../_next/static/chunks/d4710ffa8fe96c6a.js | 2 + .../_next/static/chunks/d64d74932cb225a3.js | 1 + .../_next/static/chunks/d682c064a60ae3d6.css | 1 + .../_next/static/chunks/d96012bcfc98706a.js | 1 + .../_next/static/chunks/d991de8f2cd90aca.js | 1 + .../_next/static/chunks/db89710f0ce96e05.js | 1 + .../_next/static/chunks/dbca964212122d58.js | 1 + .../_next/static/chunks/de9cdee2e8c8fa36.js | 1 + .../_next/static/chunks/e007904603a33bc5.js | 10 + .../_next/static/chunks/e0d42088ec18edc9.js | 420 ++++++++++++ .../_next/static/chunks/e1c5d2e47c042b8a.js | 50 ++ .../_next/static/chunks/e1f23fd814ac3500.js | 4 + .../_next/static/chunks/e1fe71b9ff3d3857.js | 8 + .../chunks/e228588e-e1afb953a4acfed4.js | 1 - .../_next/static/chunks/e3bc795c751bb99a.js | 41 ++ .../_next/static/chunks/e71fe358fd0c350f.js | 7 + .../_next/static/chunks/e8ed72789c2b42ff.js | 39 ++ .../_next/static/chunks/e96398764f77c728.js | 2 + .../_next/static/chunks/eaf91f44e099fe65.js | 1 + .../_next/static/chunks/ed3c364642d6dcea.js | 1 + .../_next/static/chunks/eea976cf4a05fc92.js | 55 ++ .../_next/static/chunks/ef07d6a551a3fb2a.js | 1 + .../_next/static/chunks/f297e2472321a2fc.js | 1 + .../_next/static/chunks/f628c4bfd7854ec0.js | 21 + .../_next/static/chunks/f98b25d79cd05714.js | 7 + .../_next/static/chunks/fa8a1b9b6454c116.js | 1 + .../_next/static/chunks/fb981bf7548d9de3.js | 2 + .../chunks/fd9d1056-aad4dc781fa8e9e2.js | 1 - .../_next/static/chunks/fe750aa0bf04912c.js | 21 + .../_next/static/chunks/fea300adfdeaf3b9.js | 1 + .../_next/static/chunks/ffd416b6dab7092c.js | 12 + .../_next/static/chunks/ffe482191cf04a55.js | 1 + .../chunks/main-app-77a6ca3c04ee9adf.js | 1 - .../static/chunks/main-caaa60109c950ab4.js | 1 - .../chunks/turbopack-901b35f89c1f6751.js | 4 + .../out/_next/static/css/f59f830a2bd4f76f.css | 3 - .../media/1bffadaabf893a1e-s.7cd81963.woff2 | Bin 0 -> 85272 bytes .../media/2bbe8d2671613f1f-s.76dcb0b2.woff2 | Bin 0 -> 10280 bytes .../media/2c55a0e60120577a-s.2a48534a.woff2 | Bin 0 -> 25844 bytes .../media/5476f68d60460930-s.c995e352.woff2 | Bin 0 -> 19044 bytes .../media/83afe278b6a6bb3c-s.p.3a6ba036.woff2 | Bin 0 -> 48432 bytes .../media/9c72aa0f40e4eef8-s.18a48cbc.woff2 | Bin 0 -> 18744 bytes .../media/ad66f9afd8947f86-s.7a40eb73.woff2 | Bin 0 -> 11272 bytes .../_next/static/media/favicon.1d32c690.ico | Bin 0 -> 6387 bytes .../proxy/_experimental/out/_not-found.html | 1 + .../proxy/_experimental/out/_not-found.txt | 16 + .../out/_not-found/__next._full.txt | 16 + .../out/_not-found/__next._head.txt | 6 + .../out/_not-found/__next._index.txt | 7 + .../_not-found/__next._not-found.__PAGE__.txt | 5 + .../out/_not-found/__next._not-found.txt | 4 + .../out/_not-found/__next._tree.txt | 3 + .../_experimental/out/api-reference.html | 2 +- .../proxy/_experimental/out/api-reference.txt | 41 +- ...KGRhc2hib2FyZCk.api-reference.__PAGE__.txt | 9 + .../__next.!KGRhc2hib2FyZCk.api-reference.txt | 4 + .../api-reference/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/api-reference/__next._full.txt | 27 + .../out/api-reference/__next._head.txt | 6 + .../out/api-reference/__next._index.txt | 7 + .../out/api-reference/__next._tree.txt | 4 + .../out/experimental/api-playground.html | 2 +- .../out/experimental/api-playground.txt | 43 +- ...k.experimental.api-playground.__PAGE__.txt | 9 + ...2hib2FyZCk.experimental.api-playground.txt | 4 + .../__next.!KGRhc2hib2FyZCk.experimental.txt | 4 + .../__next.!KGRhc2hib2FyZCk.txt | 7 + .../api-playground/__next._full.txt | 29 + .../api-playground/__next._head.txt | 6 + .../api-playground/__next._index.txt | 7 + .../api-playground/__next._tree.txt | 4 + .../out/experimental/budgets.html | 2 +- .../out/experimental/budgets.txt | 43 +- ...ib2FyZCk.experimental.budgets.__PAGE__.txt | 9 + ....!KGRhc2hib2FyZCk.experimental.budgets.txt | 4 + .../__next.!KGRhc2hib2FyZCk.experimental.txt | 4 + .../budgets/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/experimental/budgets/__next._full.txt | 29 + .../out/experimental/budgets/__next._head.txt | 6 + .../experimental/budgets/__next._index.txt | 7 + .../out/experimental/budgets/__next._tree.txt | 4 + .../out/experimental/caching.html | 2 +- .../out/experimental/caching.txt | 43 +- ...ib2FyZCk.experimental.caching.__PAGE__.txt | 9 + ....!KGRhc2hib2FyZCk.experimental.caching.txt | 4 + .../__next.!KGRhc2hib2FyZCk.experimental.txt | 4 + .../caching/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/experimental/caching/__next._full.txt | 29 + .../out/experimental/caching/__next._head.txt | 6 + .../experimental/caching/__next._index.txt | 7 + .../out/experimental/caching/__next._tree.txt | 4 + .../out/experimental/claude-code-plugins.html | 2 +- .../out/experimental/claude-code-plugins.txt | 43 +- ...erimental.claude-code-plugins.__PAGE__.txt | 9 + ...FyZCk.experimental.claude-code-plugins.txt | 4 + .../__next.!KGRhc2hib2FyZCk.experimental.txt | 4 + .../__next.!KGRhc2hib2FyZCk.txt | 7 + .../claude-code-plugins/__next._full.txt | 29 + .../claude-code-plugins/__next._head.txt | 6 + .../claude-code-plugins/__next._index.txt | 7 + .../claude-code-plugins/__next._tree.txt | 4 + .../out/experimental/old-usage.html | 2 +- .../out/experimental/old-usage.txt | 43 +- ...2FyZCk.experimental.old-usage.__PAGE__.txt | 9 + ...KGRhc2hib2FyZCk.experimental.old-usage.txt | 4 + .../__next.!KGRhc2hib2FyZCk.experimental.txt | 4 + .../old-usage/__next.!KGRhc2hib2FyZCk.txt | 7 + .../experimental/old-usage/__next._full.txt | 29 + .../experimental/old-usage/__next._head.txt | 6 + .../experimental/old-usage/__next._index.txt | 7 + .../experimental/old-usage/__next._tree.txt | 4 + .../out/experimental/prompts.html | 2 +- .../out/experimental/prompts.txt | 43 +- ...ib2FyZCk.experimental.prompts.__PAGE__.txt | 9 + ....!KGRhc2hib2FyZCk.experimental.prompts.txt | 4 + .../__next.!KGRhc2hib2FyZCk.experimental.txt | 4 + .../prompts/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/experimental/prompts/__next._full.txt | 29 + .../out/experimental/prompts/__next._head.txt | 6 + .../experimental/prompts/__next._index.txt | 7 + .../out/experimental/prompts/__next._tree.txt | 4 + .../out/experimental/tag-management.html | 2 +- .../out/experimental/tag-management.txt | 43 +- ...k.experimental.tag-management.__PAGE__.txt | 9 + ...2hib2FyZCk.experimental.tag-management.txt | 4 + .../__next.!KGRhc2hib2FyZCk.experimental.txt | 4 + .../__next.!KGRhc2hib2FyZCk.txt | 7 + .../tag-management/__next._full.txt | 29 + .../tag-management/__next._head.txt | 6 + .../tag-management/__next._index.txt | 7 + .../tag-management/__next._tree.txt | 4 + .../proxy/_experimental/out/guardrails.html | 2 +- .../proxy/_experimental/out/guardrails.txt | 41 +- ...t.!KGRhc2hib2FyZCk.guardrails.__PAGE__.txt | 9 + .../__next.!KGRhc2hib2FyZCk.guardrails.txt | 4 + .../guardrails/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/guardrails/__next._full.txt | 27 + .../out/guardrails/__next._head.txt | 6 + .../out/guardrails/__next._index.txt | 7 + .../out/guardrails/__next._tree.txt | 4 + litellm/proxy/_experimental/out/index.html | 2 +- litellm/proxy/_experimental/out/index.txt | 70 +- litellm/proxy/_experimental/out/login.html | 2 +- litellm/proxy/_experimental/out/login.txt | 29 +- .../_experimental/out/login/__next._full.txt | 21 + .../_experimental/out/login/__next._head.txt | 6 + .../_experimental/out/login/__next._index.txt | 7 + .../_experimental/out/login/__next._tree.txt | 4 + .../out/login/__next.login.__PAGE__.txt | 9 + .../_experimental/out/login/__next.login.txt | 4 + litellm/proxy/_experimental/out/logs.html | 2 +- litellm/proxy/_experimental/out/logs.txt | 42 +- .../__next.!KGRhc2hib2FyZCk.logs.__PAGE__.txt | 10 + .../out/logs/__next.!KGRhc2hib2FyZCk.logs.txt | 4 + .../out/logs/__next.!KGRhc2hib2FyZCk.txt | 7 + .../_experimental/out/logs/__next._full.txt | 28 + .../_experimental/out/logs/__next._head.txt | 6 + .../_experimental/out/logs/__next._index.txt | 7 + .../_experimental/out/logs/__next._tree.txt | 5 + .../_experimental/out/mcp/oauth/callback.html | 2 +- .../_experimental/out/mcp/oauth/callback.txt | 29 +- .../out/mcp/oauth/callback/__next._full.txt | 21 + .../out/mcp/oauth/callback/__next._head.txt | 6 + .../out/mcp/oauth/callback/__next._index.txt | 7 + .../out/mcp/oauth/callback/__next._tree.txt | 4 + .../__next.mcp.oauth.callback.__PAGE__.txt | 9 + .../callback/__next.mcp.oauth.callback.txt | 4 + .../mcp/oauth/callback/__next.mcp.oauth.txt | 4 + .../out/mcp/oauth/callback/__next.mcp.txt | 4 + .../proxy/_experimental/out/model-hub.html | 2 +- litellm/proxy/_experimental/out/model-hub.txt | 41 +- ...xt.!KGRhc2hib2FyZCk.model-hub.__PAGE__.txt | 9 + .../__next.!KGRhc2hib2FyZCk.model-hub.txt | 4 + .../out/model-hub/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/model-hub/__next._full.txt | 27 + .../out/model-hub/__next._head.txt | 6 + .../out/model-hub/__next._index.txt | 7 + .../out/model-hub/__next._tree.txt | 4 + .../proxy/_experimental/out/model_hub.html | 2 +- litellm/proxy/_experimental/out/model_hub.txt | 31 +- .../out/model_hub/__next._full.txt | 23 + .../out/model_hub/__next._head.txt | 6 + .../out/model_hub/__next._index.txt | 7 + .../out/model_hub/__next._tree.txt | 4 + .../model_hub/__next.model_hub.__PAGE__.txt | 9 + .../out/model_hub/__next.model_hub.txt | 4 + .../_experimental/out/model_hub_table.html | 2 +- .../_experimental/out/model_hub_table.txt | 36 +- .../out/model_hub_table/__next._full.txt | 28 + .../out/model_hub_table/__next._head.txt | 6 + .../out/model_hub_table/__next._index.txt | 7 + .../out/model_hub_table/__next._tree.txt | 4 + .../__next.model_hub_table.__PAGE__.txt | 9 + .../__next.model_hub_table.txt | 4 + .../out/models-and-endpoints.html | 2 +- .../out/models-and-endpoints.txt | 41 +- ...ib2FyZCk.models-and-endpoints.__PAGE__.txt | 9 + ....!KGRhc2hib2FyZCk.models-and-endpoints.txt | 4 + .../__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/models-and-endpoints/__next._full.txt | 27 + .../out/models-and-endpoints/__next._head.txt | 6 + .../models-and-endpoints/__next._index.txt | 7 + .../out/models-and-endpoints/__next._tree.txt | 4 + .../proxy/_experimental/out/onboarding.html | 2 +- .../proxy/_experimental/out/onboarding.txt | 29 +- .../out/onboarding/__next._full.txt | 21 + .../out/onboarding/__next._head.txt | 6 + .../out/onboarding/__next._index.txt | 7 + .../out/onboarding/__next._tree.txt | 4 + .../onboarding/__next.onboarding.__PAGE__.txt | 9 + .../out/onboarding/__next.onboarding.txt | 4 + .../_experimental/out/organizations.html | 2 +- .../proxy/_experimental/out/organizations.txt | 41 +- ...KGRhc2hib2FyZCk.organizations.__PAGE__.txt | 9 + .../__next.!KGRhc2hib2FyZCk.organizations.txt | 4 + .../organizations/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/organizations/__next._full.txt | 27 + .../out/organizations/__next._head.txt | 6 + .../out/organizations/__next._index.txt | 7 + .../out/organizations/__next._tree.txt | 4 + .../proxy/_experimental/out/playground.html | 2 +- .../proxy/_experimental/out/playground.txt | 41 +- ...t.!KGRhc2hib2FyZCk.playground.__PAGE__.txt | 9 + .../__next.!KGRhc2hib2FyZCk.playground.txt | 4 + .../playground/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/playground/__next._full.txt | 27 + .../out/playground/__next._head.txt | 6 + .../out/playground/__next._index.txt | 7 + .../out/playground/__next._tree.txt | 4 + litellm/proxy/_experimental/out/policies.html | 2 +- litellm/proxy/_experimental/out/policies.txt | 41 +- ...ext.!KGRhc2hib2FyZCk.policies.__PAGE__.txt | 9 + .../__next.!KGRhc2hib2FyZCk.policies.txt | 4 + .../out/policies/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/policies/__next._full.txt | 27 + .../out/policies/__next._head.txt | 6 + .../out/policies/__next._index.txt | 7 + .../out/policies/__next._tree.txt | 4 + .../out/settings/admin-settings.html | 2 +- .../out/settings/admin-settings.txt | 43 +- ...FyZCk.settings.admin-settings.__PAGE__.txt | 9 + ...GRhc2hib2FyZCk.settings.admin-settings.txt | 4 + .../__next.!KGRhc2hib2FyZCk.settings.txt | 4 + .../__next.!KGRhc2hib2FyZCk.txt | 7 + .../settings/admin-settings/__next._full.txt | 29 + .../settings/admin-settings/__next._head.txt | 6 + .../settings/admin-settings/__next._index.txt | 7 + .../settings/admin-settings/__next._tree.txt | 4 + .../out/settings/logging-and-alerts.html | 2 +- .../out/settings/logging-and-alerts.txt | 43 +- ...k.settings.logging-and-alerts.__PAGE__.txt | 9 + ...2hib2FyZCk.settings.logging-and-alerts.txt | 4 + .../__next.!KGRhc2hib2FyZCk.settings.txt | 4 + .../__next.!KGRhc2hib2FyZCk.txt | 7 + .../logging-and-alerts/__next._full.txt | 29 + .../logging-and-alerts/__next._head.txt | 6 + .../logging-and-alerts/__next._index.txt | 7 + .../logging-and-alerts/__next._tree.txt | 4 + .../out/settings/router-settings.html | 2 +- .../out/settings/router-settings.txt | 43 +- ...yZCk.settings.router-settings.__PAGE__.txt | 9 + ...Rhc2hib2FyZCk.settings.router-settings.txt | 4 + .../__next.!KGRhc2hib2FyZCk.settings.txt | 4 + .../__next.!KGRhc2hib2FyZCk.txt | 7 + .../settings/router-settings/__next._full.txt | 29 + .../settings/router-settings/__next._head.txt | 6 + .../router-settings/__next._index.txt | 7 + .../settings/router-settings/__next._tree.txt | 4 + .../_experimental/out/settings/ui-theme.html | 2 +- .../_experimental/out/settings/ui-theme.txt | 42 +- .../__next.!KGRhc2hib2FyZCk.settings.txt | 4 + ...c2hib2FyZCk.settings.ui-theme.__PAGE__.txt | 9 + ...ext.!KGRhc2hib2FyZCk.settings.ui-theme.txt | 4 + .../ui-theme/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/settings/ui-theme/__next._full.txt | 28 + .../out/settings/ui-theme/__next._head.txt | 6 + .../out/settings/ui-theme/__next._index.txt | 7 + .../out/settings/ui-theme/__next._tree.txt | 4 + litellm/proxy/_experimental/out/teams.html | 2 +- litellm/proxy/_experimental/out/teams.txt | 41 +- ...__next.!KGRhc2hib2FyZCk.teams.__PAGE__.txt | 9 + .../teams/__next.!KGRhc2hib2FyZCk.teams.txt | 4 + .../out/teams/__next.!KGRhc2hib2FyZCk.txt | 7 + .../_experimental/out/teams/__next._full.txt | 27 + .../_experimental/out/teams/__next._head.txt | 6 + .../_experimental/out/teams/__next._index.txt | 7 + .../_experimental/out/teams/__next._tree.txt | 4 + litellm/proxy/_experimental/out/test-key.html | 2 +- litellm/proxy/_experimental/out/test-key.txt | 41 +- ...ext.!KGRhc2hib2FyZCk.test-key.__PAGE__.txt | 9 + .../__next.!KGRhc2hib2FyZCk.test-key.txt | 4 + .../out/test-key/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/test-key/__next._full.txt | 27 + .../out/test-key/__next._head.txt | 6 + .../out/test-key/__next._index.txt | 7 + .../out/test-key/__next._tree.txt | 4 + .../_experimental/out/tools/mcp-servers.html | 2 +- .../_experimental/out/tools/mcp-servers.txt | 42 +- ...c2hib2FyZCk.tools.mcp-servers.__PAGE__.txt | 9 + ...ext.!KGRhc2hib2FyZCk.tools.mcp-servers.txt | 4 + .../__next.!KGRhc2hib2FyZCk.tools.txt | 4 + .../mcp-servers/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/tools/mcp-servers/__next._full.txt | 28 + .../out/tools/mcp-servers/__next._head.txt | 6 + .../out/tools/mcp-servers/__next._index.txt | 7 + .../out/tools/mcp-servers/__next._tree.txt | 4 + .../out/tools/vector-stores.html | 2 +- .../_experimental/out/tools/vector-stores.txt | 43 +- .../__next.!KGRhc2hib2FyZCk.tools.txt | 4 + ...hib2FyZCk.tools.vector-stores.__PAGE__.txt | 9 + ...t.!KGRhc2hib2FyZCk.tools.vector-stores.txt | 4 + .../vector-stores/__next.!KGRhc2hib2FyZCk.txt | 7 + .../out/tools/vector-stores/__next._full.txt | 29 + .../out/tools/vector-stores/__next._head.txt | 6 + .../out/tools/vector-stores/__next._index.txt | 7 + .../out/tools/vector-stores/__next._tree.txt | 4 + litellm/proxy/_experimental/out/usage.html | 2 +- litellm/proxy/_experimental/out/usage.txt | 41 +- .../out/usage/__next.!KGRhc2hib2FyZCk.txt | 7 + ...__next.!KGRhc2hib2FyZCk.usage.__PAGE__.txt | 9 + .../usage/__next.!KGRhc2hib2FyZCk.usage.txt | 4 + .../_experimental/out/usage/__next._full.txt | 27 + .../_experimental/out/usage/__next._head.txt | 6 + .../_experimental/out/usage/__next._index.txt | 7 + .../_experimental/out/usage/__next._tree.txt | 4 + litellm/proxy/_experimental/out/users.html | 2 +- litellm/proxy/_experimental/out/users.txt | 41 +- .../out/users/__next.!KGRhc2hib2FyZCk.txt | 7 + ...__next.!KGRhc2hib2FyZCk.users.__PAGE__.txt | 9 + .../users/__next.!KGRhc2hib2FyZCk.users.txt | 4 + .../_experimental/out/users/__next._full.txt | 27 + .../_experimental/out/users/__next._head.txt | 6 + .../_experimental/out/users/__next._index.txt | 7 + .../_experimental/out/users/__next._tree.txt | 4 + .../proxy/_experimental/out/virtual-keys.html | 2 +- .../proxy/_experimental/out/virtual-keys.txt | 41 +- .../virtual-keys/__next.!KGRhc2hib2FyZCk.txt | 7 + ...!KGRhc2hib2FyZCk.virtual-keys.__PAGE__.txt | 9 + .../__next.!KGRhc2hib2FyZCk.virtual-keys.txt | 4 + .../out/virtual-keys/__next._full.txt | 27 + .../out/virtual-keys/__next._head.txt | 6 + .../out/virtual-keys/__next._index.txt | 7 + .../out/virtual-keys/__next._tree.txt | 4 + 659 files changed, 8426 insertions(+), 597 deletions(-) create mode 100644 litellm/proxy/_experimental/out/__next.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/__next._tree.txt delete mode 100644 litellm/proxy/_experimental/out/_next/static/-YcCp5y5G0wpTwGaCJTwX/_buildManifest.js create mode 100644 litellm/proxy/_experimental/out/_next/static/FNzcPugrMYo8KWdUvIcl9/_buildManifest.js create mode 100644 litellm/proxy/_experimental/out/_next/static/FNzcPugrMYo8KWdUvIcl9/_clientMiddlewareManifest.json rename litellm/proxy/_experimental/out/_next/static/{-YcCp5y5G0wpTwGaCJTwX => FNzcPugrMYo8KWdUvIcl9}/_ssgManifest.js (100%) create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/00bcc8d30dd19793.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/00ff280cdb7d7ee5.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/01d33dac4f6576c1.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/04b9c7b5c33ea26c.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/06aaedbe7d27898c.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/0a65da2cd24e2ab6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/0a671fedee641c02.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/0a6c418370a8c183.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/0aece5fc054ad66e.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/0d1694151d7fdaec.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1067d2c077cd73d6.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1088-c02fed07efa8e3b8.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1098-f78fb04eeb42c4e0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1112-62aa5eef02a46309.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1125-997dafd1c51527b8.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/11383a8b78399079.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/115-9b3af056f550fde4.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1208-c73262bafe09e8d7.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/120d96e5e05ab994.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1213-9a1179ea50cba754.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/121a51d3bbb6f362.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1236-c4d9ccb0f99a3b51.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1300460219810c10.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/134f728fa7099e3e.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/14096aec9021bf29.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1512-a2667f307ad7c115.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1632-4f95f33a116ba3b2.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/16ddc23511fe16c0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1747-6538506d0a7865be.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/179f4b987bc9083f.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/193ac6435f936582.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1953-4abaab16a291b91b.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1994-39659d054539ed7e.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1a02bad0824510c9.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1ab4ccc7c0ba9eff.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1b20284f2d2f96a3.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1d3826d625e92c33.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1e0e6eb47fe60159.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/1fe0596a309ad6cf.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/20c32f4791dcb18b.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2117-e455d1d5f3f70c13.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/21ae464276343547.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/22e715061d511345.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/23f80b1de2d3b634.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/25d1ef14bd591cf9.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2618-e3b2304a0f9519ff.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2652-b5e59300361a628d.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2684-bf5f673f82c4ea4d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/26adfa4e8ffc85c7.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/27195d3ec0cab1b4.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2784-2ad5876fe92fda98.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/27c7596aa0326b71.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2829-0e5cc4beadf61932.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2926-8969275129112ce3.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/2971c4658f1bcd7d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/29f80447de6eef64.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3014691f-3744547003ceb497.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3092-058fbb7ae622a10e.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3125-ebfbf54b5940a5f0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3331-ea7fa9112bc1f4ed.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3367-c994bf9785fb130d.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/337-786f5154f8a6e761.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3407-ef143b4b8627965b.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3454255bdea68dda.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/353-134ffd729cd05fa6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/36ccc2b555a26ad4.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3709-06e05a2318097e5d.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3711-9bcd66aa46b4451a.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3729-2f31823fd505fab2.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3792-9552eeef41f80194.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3866-a7f4f033a7a018b5.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3885-0ea2230667989a21.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/391d3aca1957236a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3afadb9a550fc886.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3b30ab8eaa03bc21.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3dad14bcec641ba8.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3f369c603677cd7a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3f3fa56b5786d58c.css create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/3f49d66311c27fe1.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/403c4d96324c23a6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/40e89c053e10e01c.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4114-fda9c53fcb013293.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4188d520ca4e5f2b.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4221-9eb0cc777c84e269.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4262f254ec63c549.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4341-250db613af0fba0e.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/44edba5625a9a9b4.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/450ebd094f4fa24d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4537761df9dff7f0.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/457923c551f21385.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4587f4ad9ebcbb4e.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/464560f129260d42.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4752-9dab5f654a9a66f8.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4776-9da324bc53b94c99.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4804-aac05f01eb7e1eb1.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4851-d557e58e9186f46c.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4865-0bb410f43dfbdb9a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/49562ec1ef0389b3.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/496b84010c33cf69.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4980372eaa37b78b.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4adf500a979e2522.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4af6a1c366381700.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4bacf5b9194c12f5.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4c241fdd65d8e95b.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4e20891f2fd03463.css create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/4ed86d695abe3c87.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5000-f969129bcd09ccf5.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/513-f09847b9a6be7fa0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5144-5a65ef42a1955496.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/515-664d2fa20fede776.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5173-18600847c10ce0b1.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/52ed5bc35d5e5133.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5319-15e1927d37a73075.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/53218dce8acb3bff.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/536-1ea971c1dbdcd002.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/542a1a209eb732c6.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5510-617647f4a77073d6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5583bc893837fdf8.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/55c4117d5fcd0aae.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/55f7e1462ab93421.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/565cdfe156dcb380.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5706-38b9521b17a03c62.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/570b2e10aa856e54.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5733-66d7f9ff534fdc28.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5744-d13762919295ecb1.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5818dc2df34f9efc.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5869-3be7f5b7e252e375.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/58b9eb1766fba8e0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5975-52620444a79ca76d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5b2b7fd4dd9a44f3.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5b9c0b6d6c814e58.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5d1f33f9fa668633.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5d3e07ae5afa6fa6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5d547ead001142ce.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5eb6648cefff2d8a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/5f9c3b92a016f382.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6008d176e68995d6.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6121-2076fab213c11143.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/617bc18095fe8025.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6213-555e4b60e6aae409.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6263-b38d68c675bce16a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6367dd1d1cf7eeef.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6399-caf000072c096fbc.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/64f1a2ef9113d86f.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6554-0673737425072d76.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6600-3d7725da829062ce.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6609-1fc2206fe2aede7e.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/665-0b6864635d780032.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6697-dad1379b933195d0.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/66a190706fc6c35a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/67570d9401e62846.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6774f9c1f201e744.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6891-f1ac8ffa31a6df21.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6894-2fd23948f7e54e8a.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6941-536f8e8db15f47f4.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6ad80d0858c84af4.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6c4c97f1ea6e7d77.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6d587e6e43260fc9.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/6e033c78c15ab9a6.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7117-d281a769913bfb9d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7214f5c31e651298.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/72250192fd3153b7.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7271-679d2708358f8f7b.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/730305e005d7bd1d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/738c339383c3b4b6.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7474-889476d5d23d4e55.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/74982774ef38dcdb.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7526-dde6bc1b8c04d02f.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/76a83e13dfaf23db.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7746-6eba538311e1b174.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7840-d53dd626c4b8aba4.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/786-18be523d92ce1097.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7906-74ae99e62d197da3.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/799b258fbe06c072.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7af309decf630af7.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7b788dd93ad868b3.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7ce19d2281dd4011.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7d75124a5bfd9588.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7e2badb3d178f837.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7e3f5ce4b2a613d4.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7e417dd24c8becd0.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/7f9e9c54ac262de2.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8049-0790984190a47d46.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8143-88f2b6e87ee73823.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/81b07b773a2abeeb.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/81e224efc874dea6.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8221-6fb2e6af1131a7a2.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/82ef36abe5e2e833.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8354d717e34ebd6f.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8485b66c53cff513.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/84884fbf517f5d74.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8507-c6b80922c66bc943.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8640-89a75388b9a92a2c.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/86b8d7c6282e3520.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8736-69ed8b05f04b0615.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/88876358fce5a2d8.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/88c74f8b4b20d25a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/890364dd77e340a9.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8907-b0dd2b0d2e3581b9.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8992001a9a91bc67.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/89b9f8dbb6f0d490.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8a607e531e36f204.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/8e12212d7a0aeaee.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9037-32f2c937d7fda43c.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9039-74aae2b078ef3414.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9055-0b8d1226d5378b31.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9190-8a1444f95a6df8a5.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9258-ce960bcd573d7ce8.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9262-b4a2177ca579ac89.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9264-b013c415875d165a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/92cf5d832080641f.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/93032856602932c1.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/937c3b6cb00f6b79.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9442-0addb74077c3ac6c.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9447-821c7c160976c68b.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9553-92af9e2767601fc9.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9611-418447af8f839a16.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/97efd6e1c67bedcb.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/983036f73d37142a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/98593965456d6221.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9992-3fd2edb28e89644e.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/99be180c22b927f8.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/99cf9cf99df5ccfc.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9cf03e6d4b5b806e.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9dc55e5c98dadc0f.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/9f5ccd929375c1d6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a0f302271a793712.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a1ef280b7ad5ae6a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a21582fe1f52b973.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a382857dbbcea5d1.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a44b0c08814c45ae.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a477187ed455bc59.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a5b99c0875d4c9cf.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a5fe06c2cefac5bc.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a6dad97d9634a72d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a6dad97d9634a72d.js.map create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a7c0a41b6156d9b2.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a8fe9ac74ddfc8aa.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a966296c3a6b28f6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/a9ebedc318fa36dc.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/ab7a826839e7e423.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/ad02748134652429.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/api-reference/page-922b5e2fdafbd942.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/api-playground/page-648caa567791468b.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/budgets/page-47e65464111e3de5.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/caching/page-90c15ac22f3235d0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/claude-code-plugins/page-869f7711f27df002.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/old-usage/page-a3ee65e1ac6e11de.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/prompts/page-9bc8c3555bbec9ec.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/experimental/tag-management/page-c78d6c5df022fb84.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/guardrails/page-60b56c3b3ff203e6.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/layout-7a868c8049b70343.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/logs/page-a2df3b6735153dd3.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/model-hub/page-fd84db9638de8c38.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/models-and-endpoints/page-4e453b71bdca9880.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/organizations/page-31a9cfc4fd6de748.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/playground/page-728f77f75dd27b1e.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/policies/page-ab88a2f8428feba0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/admin-settings/page-971f8f5b92d08656.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/logging-and-alerts/page-9dac1b11387d3d1b.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/router-settings/page-938cfbffd3788468.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/settings/ui-theme/page-dd7de5d3e3c39f94.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/teams/page-9de6cde8c02fe237.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/test-key/page-3a68b854b4bbdcd6.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/mcp-servers/page-9a35a1280e0ecfb0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/tools/vector-stores/page-8db3f07230780069.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/usage/page-f6cc9bb14efffbaf.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/users/page-1e7666c0bc02703d.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/(dashboard)/virtual-keys/page-459749f696b96c6f.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/_not-found/page-05c6a78b593da7d9.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/layout-066dc55ee81d2151.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/login/page-528809d7a1da96e3.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/mcp/oauth/callback/page-537827e984add08a.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/model_hub/page-03a1109c0e429bfb.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/model_hub_table/page-14e1e5255ce44df0.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/onboarding/page-49c02eb9c64f297d.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/app/page-bac47037ec8203b4.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/b4b83382d3c7968a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/b5bcd87b218a6bcd.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/b85f190e8626c49c.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/ba5a05afc286361c.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/baa15cbb8a22e3d5.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/bd551344ff132d66.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/bdf355b41816a002.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c058ac3e89dc33df.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c19d75622900fb62.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c1a1145476aa422b.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c1ac320d056807fe.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c24d3e9cf8b1b7ed.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c4452a79c69324a6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c45fb8a82fd72734.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c4bafdbb1a0ec1d3.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c5d11126226451ab.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c637e0ee56f50900.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c7b74067c01ee971.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c8a0095ffe8cea4a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/c9af2deb434988d6.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/ca22b37c24b4d34a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/cb8e6ba28461af15.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/cd9b2d4c4ae6ba20.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/cdeb8eaf177eae12.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/ce69b40ed22abf2d.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/cf68fd1f1761ba48.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/d1fe69810296bcf1.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/d24f23929997cfa1.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/d2aa91699d95f4b3.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/d4710ffa8fe96c6a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/d64d74932cb225a3.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/d682c064a60ae3d6.css create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/d96012bcfc98706a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/d991de8f2cd90aca.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/db89710f0ce96e05.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/dbca964212122d58.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/de9cdee2e8c8fa36.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/e007904603a33bc5.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/e0d42088ec18edc9.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/e1c5d2e47c042b8a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/e1f23fd814ac3500.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/e1fe71b9ff3d3857.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/e228588e-e1afb953a4acfed4.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/e3bc795c751bb99a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/e71fe358fd0c350f.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/e8ed72789c2b42ff.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/e96398764f77c728.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/eaf91f44e099fe65.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/ed3c364642d6dcea.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/eea976cf4a05fc92.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/ef07d6a551a3fb2a.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/f297e2472321a2fc.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/f628c4bfd7854ec0.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/f98b25d79cd05714.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/fa8a1b9b6454c116.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/fb981bf7548d9de3.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/fd9d1056-aad4dc781fa8e9e2.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/fe750aa0bf04912c.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/fea300adfdeaf3b9.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/ffd416b6dab7092c.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/ffe482191cf04a55.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/main-app-77a6ca3c04ee9adf.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/main-caaa60109c950ab4.js create mode 100644 litellm/proxy/_experimental/out/_next/static/chunks/turbopack-901b35f89c1f6751.js delete mode 100644 litellm/proxy/_experimental/out/_next/static/css/f59f830a2bd4f76f.css create mode 100644 litellm/proxy/_experimental/out/_next/static/media/1bffadaabf893a1e-s.7cd81963.woff2 create mode 100644 litellm/proxy/_experimental/out/_next/static/media/2bbe8d2671613f1f-s.76dcb0b2.woff2 create mode 100644 litellm/proxy/_experimental/out/_next/static/media/2c55a0e60120577a-s.2a48534a.woff2 create mode 100644 litellm/proxy/_experimental/out/_next/static/media/5476f68d60460930-s.c995e352.woff2 create mode 100644 litellm/proxy/_experimental/out/_next/static/media/83afe278b6a6bb3c-s.p.3a6ba036.woff2 create mode 100644 litellm/proxy/_experimental/out/_next/static/media/9c72aa0f40e4eef8-s.18a48cbc.woff2 create mode 100644 litellm/proxy/_experimental/out/_next/static/media/ad66f9afd8947f86-s.7a40eb73.woff2 create mode 100644 litellm/proxy/_experimental/out/_next/static/media/favicon.1d32c690.ico create mode 100644 litellm/proxy/_experimental/out/_not-found.html create mode 100644 litellm/proxy/_experimental/out/_not-found.txt create mode 100644 litellm/proxy/_experimental/out/_not-found/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/_not-found/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/_not-found/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/_not-found/__next._not-found.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/_not-found/__next._not-found.txt create mode 100644 litellm/proxy/_experimental/out/_not-found/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/api-reference/__next.!KGRhc2hib2FyZCk.api-reference.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/api-reference/__next.!KGRhc2hib2FyZCk.api-reference.txt create mode 100644 litellm/proxy/_experimental/out/api-reference/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/api-reference/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/api-reference/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/api-reference/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/api-reference/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/experimental/api-playground/__next.!KGRhc2hib2FyZCk.experimental.api-playground.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/experimental/api-playground/__next.!KGRhc2hib2FyZCk.experimental.api-playground.txt create mode 100644 litellm/proxy/_experimental/out/experimental/api-playground/__next.!KGRhc2hib2FyZCk.experimental.txt create mode 100644 litellm/proxy/_experimental/out/experimental/api-playground/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/experimental/api-playground/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/experimental/api-playground/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/experimental/api-playground/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/experimental/api-playground/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/experimental/budgets/__next.!KGRhc2hib2FyZCk.experimental.budgets.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/experimental/budgets/__next.!KGRhc2hib2FyZCk.experimental.budgets.txt create mode 100644 litellm/proxy/_experimental/out/experimental/budgets/__next.!KGRhc2hib2FyZCk.experimental.txt create mode 100644 litellm/proxy/_experimental/out/experimental/budgets/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/experimental/budgets/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/experimental/budgets/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/experimental/budgets/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/experimental/budgets/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/experimental/caching/__next.!KGRhc2hib2FyZCk.experimental.caching.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/experimental/caching/__next.!KGRhc2hib2FyZCk.experimental.caching.txt create mode 100644 litellm/proxy/_experimental/out/experimental/caching/__next.!KGRhc2hib2FyZCk.experimental.txt create mode 100644 litellm/proxy/_experimental/out/experimental/caching/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/experimental/caching/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/experimental/caching/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/experimental/caching/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/experimental/caching/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/experimental/claude-code-plugins/__next.!KGRhc2hib2FyZCk.experimental.claude-code-plugins.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/experimental/claude-code-plugins/__next.!KGRhc2hib2FyZCk.experimental.claude-code-plugins.txt create mode 100644 litellm/proxy/_experimental/out/experimental/claude-code-plugins/__next.!KGRhc2hib2FyZCk.experimental.txt create mode 100644 litellm/proxy/_experimental/out/experimental/claude-code-plugins/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/experimental/claude-code-plugins/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/experimental/claude-code-plugins/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/experimental/claude-code-plugins/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/experimental/claude-code-plugins/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/experimental/old-usage/__next.!KGRhc2hib2FyZCk.experimental.old-usage.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/experimental/old-usage/__next.!KGRhc2hib2FyZCk.experimental.old-usage.txt create mode 100644 litellm/proxy/_experimental/out/experimental/old-usage/__next.!KGRhc2hib2FyZCk.experimental.txt create mode 100644 litellm/proxy/_experimental/out/experimental/old-usage/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/experimental/old-usage/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/experimental/old-usage/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/experimental/old-usage/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/experimental/old-usage/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/experimental/prompts/__next.!KGRhc2hib2FyZCk.experimental.prompts.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/experimental/prompts/__next.!KGRhc2hib2FyZCk.experimental.prompts.txt create mode 100644 litellm/proxy/_experimental/out/experimental/prompts/__next.!KGRhc2hib2FyZCk.experimental.txt create mode 100644 litellm/proxy/_experimental/out/experimental/prompts/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/experimental/prompts/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/experimental/prompts/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/experimental/prompts/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/experimental/prompts/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/experimental/tag-management/__next.!KGRhc2hib2FyZCk.experimental.tag-management.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/experimental/tag-management/__next.!KGRhc2hib2FyZCk.experimental.tag-management.txt create mode 100644 litellm/proxy/_experimental/out/experimental/tag-management/__next.!KGRhc2hib2FyZCk.experimental.txt create mode 100644 litellm/proxy/_experimental/out/experimental/tag-management/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/experimental/tag-management/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/experimental/tag-management/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/experimental/tag-management/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/experimental/tag-management/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/guardrails/__next.!KGRhc2hib2FyZCk.guardrails.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/guardrails/__next.!KGRhc2hib2FyZCk.guardrails.txt create mode 100644 litellm/proxy/_experimental/out/guardrails/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/guardrails/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/guardrails/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/guardrails/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/guardrails/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/login/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/login/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/login/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/login/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/login/__next.login.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/login/__next.login.txt create mode 100644 litellm/proxy/_experimental/out/logs/__next.!KGRhc2hib2FyZCk.logs.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/logs/__next.!KGRhc2hib2FyZCk.logs.txt create mode 100644 litellm/proxy/_experimental/out/logs/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/logs/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/logs/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/logs/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/logs/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/mcp/oauth/callback/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/mcp/oauth/callback/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/mcp/oauth/callback/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/mcp/oauth/callback/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/mcp/oauth/callback/__next.mcp.oauth.callback.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/mcp/oauth/callback/__next.mcp.oauth.callback.txt create mode 100644 litellm/proxy/_experimental/out/mcp/oauth/callback/__next.mcp.oauth.txt create mode 100644 litellm/proxy/_experimental/out/mcp/oauth/callback/__next.mcp.txt create mode 100644 litellm/proxy/_experimental/out/model-hub/__next.!KGRhc2hib2FyZCk.model-hub.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/model-hub/__next.!KGRhc2hib2FyZCk.model-hub.txt create mode 100644 litellm/proxy/_experimental/out/model-hub/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/model-hub/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/model-hub/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/model-hub/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/model-hub/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/model_hub/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/model_hub/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/model_hub/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/model_hub/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/model_hub/__next.model_hub.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/model_hub/__next.model_hub.txt create mode 100644 litellm/proxy/_experimental/out/model_hub_table/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/model_hub_table/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/model_hub_table/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/model_hub_table/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/model_hub_table/__next.model_hub_table.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/model_hub_table/__next.model_hub_table.txt create mode 100644 litellm/proxy/_experimental/out/models-and-endpoints/__next.!KGRhc2hib2FyZCk.models-and-endpoints.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/models-and-endpoints/__next.!KGRhc2hib2FyZCk.models-and-endpoints.txt create mode 100644 litellm/proxy/_experimental/out/models-and-endpoints/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/models-and-endpoints/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/models-and-endpoints/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/models-and-endpoints/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/models-and-endpoints/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/onboarding/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/onboarding/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/onboarding/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/onboarding/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/onboarding/__next.onboarding.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/onboarding/__next.onboarding.txt create mode 100644 litellm/proxy/_experimental/out/organizations/__next.!KGRhc2hib2FyZCk.organizations.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/organizations/__next.!KGRhc2hib2FyZCk.organizations.txt create mode 100644 litellm/proxy/_experimental/out/organizations/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/organizations/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/organizations/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/organizations/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/organizations/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/playground/__next.!KGRhc2hib2FyZCk.playground.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/playground/__next.!KGRhc2hib2FyZCk.playground.txt create mode 100644 litellm/proxy/_experimental/out/playground/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/playground/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/playground/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/playground/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/playground/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/policies/__next.!KGRhc2hib2FyZCk.policies.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/policies/__next.!KGRhc2hib2FyZCk.policies.txt create mode 100644 litellm/proxy/_experimental/out/policies/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/policies/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/policies/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/policies/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/policies/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/settings/admin-settings/__next.!KGRhc2hib2FyZCk.settings.admin-settings.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/settings/admin-settings/__next.!KGRhc2hib2FyZCk.settings.admin-settings.txt create mode 100644 litellm/proxy/_experimental/out/settings/admin-settings/__next.!KGRhc2hib2FyZCk.settings.txt create mode 100644 litellm/proxy/_experimental/out/settings/admin-settings/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/settings/admin-settings/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/settings/admin-settings/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/settings/admin-settings/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/settings/admin-settings/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/settings/logging-and-alerts/__next.!KGRhc2hib2FyZCk.settings.logging-and-alerts.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/settings/logging-and-alerts/__next.!KGRhc2hib2FyZCk.settings.logging-and-alerts.txt create mode 100644 litellm/proxy/_experimental/out/settings/logging-and-alerts/__next.!KGRhc2hib2FyZCk.settings.txt create mode 100644 litellm/proxy/_experimental/out/settings/logging-and-alerts/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/settings/logging-and-alerts/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/settings/logging-and-alerts/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/settings/logging-and-alerts/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/settings/logging-and-alerts/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/settings/router-settings/__next.!KGRhc2hib2FyZCk.settings.router-settings.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/settings/router-settings/__next.!KGRhc2hib2FyZCk.settings.router-settings.txt create mode 100644 litellm/proxy/_experimental/out/settings/router-settings/__next.!KGRhc2hib2FyZCk.settings.txt create mode 100644 litellm/proxy/_experimental/out/settings/router-settings/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/settings/router-settings/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/settings/router-settings/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/settings/router-settings/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/settings/router-settings/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/settings/ui-theme/__next.!KGRhc2hib2FyZCk.settings.txt create mode 100644 litellm/proxy/_experimental/out/settings/ui-theme/__next.!KGRhc2hib2FyZCk.settings.ui-theme.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/settings/ui-theme/__next.!KGRhc2hib2FyZCk.settings.ui-theme.txt create mode 100644 litellm/proxy/_experimental/out/settings/ui-theme/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/settings/ui-theme/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/settings/ui-theme/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/settings/ui-theme/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/settings/ui-theme/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/teams/__next.!KGRhc2hib2FyZCk.teams.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/teams/__next.!KGRhc2hib2FyZCk.teams.txt create mode 100644 litellm/proxy/_experimental/out/teams/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/teams/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/teams/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/teams/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/teams/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/test-key/__next.!KGRhc2hib2FyZCk.test-key.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/test-key/__next.!KGRhc2hib2FyZCk.test-key.txt create mode 100644 litellm/proxy/_experimental/out/test-key/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/test-key/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/test-key/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/test-key/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/test-key/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/tools/mcp-servers/__next.!KGRhc2hib2FyZCk.tools.mcp-servers.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/tools/mcp-servers/__next.!KGRhc2hib2FyZCk.tools.mcp-servers.txt create mode 100644 litellm/proxy/_experimental/out/tools/mcp-servers/__next.!KGRhc2hib2FyZCk.tools.txt create mode 100644 litellm/proxy/_experimental/out/tools/mcp-servers/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/tools/mcp-servers/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/tools/mcp-servers/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/tools/mcp-servers/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/tools/mcp-servers/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/tools/vector-stores/__next.!KGRhc2hib2FyZCk.tools.txt create mode 100644 litellm/proxy/_experimental/out/tools/vector-stores/__next.!KGRhc2hib2FyZCk.tools.vector-stores.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/tools/vector-stores/__next.!KGRhc2hib2FyZCk.tools.vector-stores.txt create mode 100644 litellm/proxy/_experimental/out/tools/vector-stores/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/tools/vector-stores/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/tools/vector-stores/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/tools/vector-stores/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/tools/vector-stores/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/usage/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/usage/__next.!KGRhc2hib2FyZCk.usage.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/usage/__next.!KGRhc2hib2FyZCk.usage.txt create mode 100644 litellm/proxy/_experimental/out/usage/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/usage/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/usage/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/usage/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/users/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/users/__next.!KGRhc2hib2FyZCk.users.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/users/__next.!KGRhc2hib2FyZCk.users.txt create mode 100644 litellm/proxy/_experimental/out/users/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/users/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/users/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/users/__next._tree.txt create mode 100644 litellm/proxy/_experimental/out/virtual-keys/__next.!KGRhc2hib2FyZCk.txt create mode 100644 litellm/proxy/_experimental/out/virtual-keys/__next.!KGRhc2hib2FyZCk.virtual-keys.__PAGE__.txt create mode 100644 litellm/proxy/_experimental/out/virtual-keys/__next.!KGRhc2hib2FyZCk.virtual-keys.txt create mode 100644 litellm/proxy/_experimental/out/virtual-keys/__next._full.txt create mode 100644 litellm/proxy/_experimental/out/virtual-keys/__next._head.txt create mode 100644 litellm/proxy/_experimental/out/virtual-keys/__next._index.txt create mode 100644 litellm/proxy/_experimental/out/virtual-keys/__next._tree.txt diff --git a/litellm/proxy/_experimental/out/404.html b/litellm/proxy/_experimental/out/404.html index 788e9379f62..47a4eda7e8b 100644 --- a/litellm/proxy/_experimental/out/404.html +++ b/litellm/proxy/_experimental/out/404.html @@ -1 +1 @@ -404: This page could not be found.LiteLLM Dashboard

404

This page could not be found.

\ No newline at end of file +404: This page could not be found.LiteLLM Dashboard

404

This page could not be found.

\ No newline at end of file diff --git a/litellm/proxy/_experimental/out/__next.__PAGE__.txt b/litellm/proxy/_experimental/out/__next.__PAGE__.txt new file mode 100644 index 00000000000..449accbb05b --- /dev/null +++ b/litellm/proxy/_experimental/out/__next.__PAGE__.txt @@ -0,0 +1,31 @@ +1:"$Sreact.fragment" +2:I[347257,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ClientPageRoot"] +3:I[952683,["/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","/litellm-asset-prefix/_next/static/chunks/baa15cbb8a22e3d5.js","/litellm-asset-prefix/_next/static/chunks/9f5ccd929375c1d6.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/e3bc795c751bb99a.js","/litellm-asset-prefix/_next/static/chunks/29f80447de6eef64.js","/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","/litellm-asset-prefix/_next/static/chunks/58b9eb1766fba8e0.js","/litellm-asset-prefix/_next/static/chunks/5eb6648cefff2d8a.js","/litellm-asset-prefix/_next/static/chunks/27195d3ec0cab1b4.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/0a671fedee641c02.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/fe750aa0bf04912c.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","/litellm-asset-prefix/_next/static/chunks/7af309decf630af7.js","/litellm-asset-prefix/_next/static/chunks/4188d520ca4e5f2b.js","/litellm-asset-prefix/_next/static/chunks/64f1a2ef9113d86f.js","/litellm-asset-prefix/_next/static/chunks/457923c551f21385.js","/litellm-asset-prefix/_next/static/chunks/0aece5fc054ad66e.js","/litellm-asset-prefix/_next/static/chunks/c8a0095ffe8cea4a.js","/litellm-asset-prefix/_next/static/chunks/72250192fd3153b7.js","/litellm-asset-prefix/_next/static/chunks/a9ebedc318fa36dc.js","/litellm-asset-prefix/_next/static/chunks/3f369c603677cd7a.js","/litellm-asset-prefix/_next/static/chunks/66a190706fc6c35a.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/e007904603a33bc5.js","/litellm-asset-prefix/_next/static/chunks/5d3e07ae5afa6fa6.js","/litellm-asset-prefix/_next/static/chunks/c7b74067c01ee971.js","/litellm-asset-prefix/_next/static/chunks/8992001a9a91bc67.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/bdf355b41816a002.js","/litellm-asset-prefix/_next/static/chunks/799b258fbe06c072.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/00ff280cdb7d7ee5.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/23f80b1de2d3b634.js","/litellm-asset-prefix/_next/static/chunks/c637e0ee56f50900.js","/litellm-asset-prefix/_next/static/chunks/a382857dbbcea5d1.js","/litellm-asset-prefix/_next/static/chunks/8e12212d7a0aeaee.js","/litellm-asset-prefix/_next/static/chunks/1ab4ccc7c0ba9eff.js","/litellm-asset-prefix/_next/static/chunks/8354d717e34ebd6f.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","/litellm-asset-prefix/_next/static/chunks/a21582fe1f52b973.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/21ae464276343547.js","/litellm-asset-prefix/_next/static/chunks/c4452a79c69324a6.js","/litellm-asset-prefix/_next/static/chunks/a5fe06c2cefac5bc.js","/litellm-asset-prefix/_next/static/chunks/450ebd094f4fa24d.js","/litellm-asset-prefix/_next/static/chunks/6367dd1d1cf7eeef.js","/litellm-asset-prefix/_next/static/chunks/c24d3e9cf8b1b7ed.js"],"default"] +1b:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"OutletBoundary"] +1c:"$Sreact.suspense" +:HL["/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","style"] +0:{"buildId":"FNzcPugrMYo8KWdUvIcl9","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","precedence":"next"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/baa15cbb8a22e3d5.js","async":true}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/9f5ccd929375c1d6.js","async":true}],["$","script","script-2",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true}],["$","script","script-3",{"src":"/litellm-asset-prefix/_next/static/chunks/e3bc795c751bb99a.js","async":true}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/29f80447de6eef64.js","async":true}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","async":true}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/58b9eb1766fba8e0.js","async":true}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/5eb6648cefff2d8a.js","async":true}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/27195d3ec0cab1b4.js","async":true}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/0a671fedee641c02.js","async":true}],["$","script","script-12",{"src":"/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","async":true}],["$","script","script-13",{"src":"/litellm-asset-prefix/_next/static/chunks/fe750aa0bf04912c.js","async":true}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","async":true}],["$","script","script-16",{"src":"/litellm-asset-prefix/_next/static/chunks/7af309decf630af7.js","async":true}],["$","script","script-17",{"src":"/litellm-asset-prefix/_next/static/chunks/4188d520ca4e5f2b.js","async":true}],["$","script","script-18",{"src":"/litellm-asset-prefix/_next/static/chunks/64f1a2ef9113d86f.js","async":true}],["$","script","script-19",{"src":"/litellm-asset-prefix/_next/static/chunks/457923c551f21385.js","async":true}],["$","script","script-20",{"src":"/litellm-asset-prefix/_next/static/chunks/0aece5fc054ad66e.js","async":true}],["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/c8a0095ffe8cea4a.js","async":true}],["$","script","script-22",{"src":"/litellm-asset-prefix/_next/static/chunks/72250192fd3153b7.js","async":true}],["$","script","script-23",{"src":"/litellm-asset-prefix/_next/static/chunks/a9ebedc318fa36dc.js","async":true}],["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/3f369c603677cd7a.js","async":true}],["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/66a190706fc6c35a.js","async":true}],["$","script","script-26",{"src":"/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","async":true}],["$","script","script-27",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","async":true}],["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/e007904603a33bc5.js","async":true}],["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/5d3e07ae5afa6fa6.js","async":true}],["$","script","script-30",{"src":"/litellm-asset-prefix/_next/static/chunks/c7b74067c01ee971.js","async":true}],["$","script","script-31",{"src":"/litellm-asset-prefix/_next/static/chunks/8992001a9a91bc67.js","async":true}],["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","async":true}],["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/bdf355b41816a002.js","async":true}],"$L6","$L7","$L8","$L9","$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15","$L16","$L17","$L18","$L19"],"$L1a"]}],"loading":null,"isPartial":false} +4:{} +5:"$0:rsc:props:children:0:props:serverProvidedParams:params" +6:["$","script","script-34",{"src":"/litellm-asset-prefix/_next/static/chunks/799b258fbe06c072.js","async":true}] +7:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true}] +8:["$","script","script-36",{"src":"/litellm-asset-prefix/_next/static/chunks/00ff280cdb7d7ee5.js","async":true}] +9:["$","script","script-37",{"src":"/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","async":true}] +a:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/23f80b1de2d3b634.js","async":true}] +b:["$","script","script-39",{"src":"/litellm-asset-prefix/_next/static/chunks/c637e0ee56f50900.js","async":true}] +c:["$","script","script-40",{"src":"/litellm-asset-prefix/_next/static/chunks/a382857dbbcea5d1.js","async":true}] +d:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/8e12212d7a0aeaee.js","async":true}] +e:["$","script","script-42",{"src":"/litellm-asset-prefix/_next/static/chunks/1ab4ccc7c0ba9eff.js","async":true}] +f:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/8354d717e34ebd6f.js","async":true}] +10:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","async":true}] +11:["$","script","script-45",{"src":"/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","async":true}] +12:["$","script","script-46",{"src":"/litellm-asset-prefix/_next/static/chunks/a21582fe1f52b973.js","async":true}] +13:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","async":true}] +14:["$","script","script-48",{"src":"/litellm-asset-prefix/_next/static/chunks/21ae464276343547.js","async":true}] +15:["$","script","script-49",{"src":"/litellm-asset-prefix/_next/static/chunks/c4452a79c69324a6.js","async":true}] +16:["$","script","script-50",{"src":"/litellm-asset-prefix/_next/static/chunks/a5fe06c2cefac5bc.js","async":true}] +17:["$","script","script-51",{"src":"/litellm-asset-prefix/_next/static/chunks/450ebd094f4fa24d.js","async":true}] +18:["$","script","script-52",{"src":"/litellm-asset-prefix/_next/static/chunks/6367dd1d1cf7eeef.js","async":true}] +19:["$","script","script-53",{"src":"/litellm-asset-prefix/_next/static/chunks/c24d3e9cf8b1b7ed.js","async":true}] +1a:["$","$L1b",null,{"children":["$","$1c",null,{"name":"Next.MetadataOutlet","children":"$@1d"}]}] +1d:null diff --git a/litellm/proxy/_experimental/out/__next._full.txt b/litellm/proxy/_experimental/out/__next._full.txt new file mode 100644 index 00000000000..61c41ae3ca5 --- /dev/null +++ b/litellm/proxy/_experimental/out/__next._full.txt @@ -0,0 +1,62 @@ +1:"$Sreact.fragment" +2:I[71195,["/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js"],"default"] +3:I[339756,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] +4:I[837457,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] +5:I[347257,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ClientPageRoot"] +6:I[952683,["/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","/litellm-asset-prefix/_next/static/chunks/baa15cbb8a22e3d5.js","/litellm-asset-prefix/_next/static/chunks/9f5ccd929375c1d6.js","/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","/litellm-asset-prefix/_next/static/chunks/e3bc795c751bb99a.js","/litellm-asset-prefix/_next/static/chunks/29f80447de6eef64.js","/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","/litellm-asset-prefix/_next/static/chunks/58b9eb1766fba8e0.js","/litellm-asset-prefix/_next/static/chunks/5eb6648cefff2d8a.js","/litellm-asset-prefix/_next/static/chunks/27195d3ec0cab1b4.js","/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","/litellm-asset-prefix/_next/static/chunks/0a671fedee641c02.js","/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","/litellm-asset-prefix/_next/static/chunks/fe750aa0bf04912c.js","/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","/litellm-asset-prefix/_next/static/chunks/7af309decf630af7.js","/litellm-asset-prefix/_next/static/chunks/4188d520ca4e5f2b.js","/litellm-asset-prefix/_next/static/chunks/64f1a2ef9113d86f.js","/litellm-asset-prefix/_next/static/chunks/457923c551f21385.js","/litellm-asset-prefix/_next/static/chunks/0aece5fc054ad66e.js","/litellm-asset-prefix/_next/static/chunks/c8a0095ffe8cea4a.js","/litellm-asset-prefix/_next/static/chunks/72250192fd3153b7.js","/litellm-asset-prefix/_next/static/chunks/a9ebedc318fa36dc.js","/litellm-asset-prefix/_next/static/chunks/3f369c603677cd7a.js","/litellm-asset-prefix/_next/static/chunks/66a190706fc6c35a.js","/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","/litellm-asset-prefix/_next/static/chunks/e007904603a33bc5.js","/litellm-asset-prefix/_next/static/chunks/5d3e07ae5afa6fa6.js","/litellm-asset-prefix/_next/static/chunks/c7b74067c01ee971.js","/litellm-asset-prefix/_next/static/chunks/8992001a9a91bc67.js","/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","/litellm-asset-prefix/_next/static/chunks/bdf355b41816a002.js","/litellm-asset-prefix/_next/static/chunks/799b258fbe06c072.js","/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","/litellm-asset-prefix/_next/static/chunks/00ff280cdb7d7ee5.js","/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","/litellm-asset-prefix/_next/static/chunks/23f80b1de2d3b634.js","/litellm-asset-prefix/_next/static/chunks/c637e0ee56f50900.js","/litellm-asset-prefix/_next/static/chunks/a382857dbbcea5d1.js","/litellm-asset-prefix/_next/static/chunks/8e12212d7a0aeaee.js","/litellm-asset-prefix/_next/static/chunks/1ab4ccc7c0ba9eff.js","/litellm-asset-prefix/_next/static/chunks/8354d717e34ebd6f.js","/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","/litellm-asset-prefix/_next/static/chunks/a21582fe1f52b973.js","/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","/litellm-asset-prefix/_next/static/chunks/21ae464276343547.js","/litellm-asset-prefix/_next/static/chunks/c4452a79c69324a6.js","/litellm-asset-prefix/_next/static/chunks/a5fe06c2cefac5bc.js","/litellm-asset-prefix/_next/static/chunks/450ebd094f4fa24d.js","/litellm-asset-prefix/_next/static/chunks/6367dd1d1cf7eeef.js","/litellm-asset-prefix/_next/static/chunks/c24d3e9cf8b1b7ed.js"],"default"] +31:I[168027,[],"default"] +:HL["/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","style"] +:HL["/litellm-asset-prefix/_next/static/chunks/d682c064a60ae3d6.css","style"] +:HL["/litellm-asset-prefix/_next/static/media/83afe278b6a6bb3c-s.p.3a6ba036.woff2","font",{"crossOrigin":"","type":"font/woff2"}] +:HL["/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","style"] +0:{"P":null,"b":"FNzcPugrMYo8KWdUvIcl9","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/d682c064a60ae3d6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"inter_5972bc34-module__OU16Qa__className","children":["$","$L2",null,{"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/baa15cbb8a22e3d5.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/9f5ccd929375c1d6.js","async":true,"nonce":"$undefined"}],["$","script","script-2",{"src":"/litellm-asset-prefix/_next/static/chunks/1fe0596a309ad6cf.js","async":true,"nonce":"$undefined"}],["$","script","script-3",{"src":"/litellm-asset-prefix/_next/static/chunks/e3bc795c751bb99a.js","async":true,"nonce":"$undefined"}],["$","script","script-4",{"src":"/litellm-asset-prefix/_next/static/chunks/29f80447de6eef64.js","async":true,"nonce":"$undefined"}],["$","script","script-5",{"src":"/litellm-asset-prefix/_next/static/chunks/5f9c3b92a016f382.js","async":true,"nonce":"$undefined"}],["$","script","script-6",{"src":"/litellm-asset-prefix/_next/static/chunks/58b9eb1766fba8e0.js","async":true,"nonce":"$undefined"}],["$","script","script-7",{"src":"/litellm-asset-prefix/_next/static/chunks/5eb6648cefff2d8a.js","async":true,"nonce":"$undefined"}],["$","script","script-8",{"src":"/litellm-asset-prefix/_next/static/chunks/27195d3ec0cab1b4.js","async":true,"nonce":"$undefined"}],["$","script","script-9",{"src":"/litellm-asset-prefix/_next/static/chunks/403c4d96324c23a6.js","async":true,"nonce":"$undefined"}],["$","script","script-10",{"src":"/litellm-asset-prefix/_next/static/chunks/88c74f8b4b20d25a.js","async":true,"nonce":"$undefined"}],["$","script","script-11",{"src":"/litellm-asset-prefix/_next/static/chunks/0a671fedee641c02.js","async":true,"nonce":"$undefined"}],["$","script","script-12",{"src":"/litellm-asset-prefix/_next/static/chunks/134f728fa7099e3e.js","async":true,"nonce":"$undefined"}],["$","script","script-13",{"src":"/litellm-asset-prefix/_next/static/chunks/fe750aa0bf04912c.js","async":true,"nonce":"$undefined"}],["$","script","script-14",{"src":"/litellm-asset-prefix/_next/static/chunks/7b788dd93ad868b3.js","async":true,"nonce":"$undefined"}],["$","script","script-15",{"src":"/litellm-asset-prefix/_next/static/chunks/d64d74932cb225a3.js","async":true,"nonce":"$undefined"}],"$L9","$La","$Lb","$Lc","$Ld","$Le","$Lf","$L10","$L11","$L12","$L13","$L14","$L15","$L16","$L17","$L18","$L19","$L1a","$L1b","$L1c","$L1d","$L1e","$L1f","$L20","$L21","$L22","$L23","$L24","$L25","$L26","$L27","$L28","$L29","$L2a","$L2b","$L2c","$L2d","$L2e"],"$L2f"]}],{},null,false,false]},null,false,false],"$L30",false]],"m":"$undefined","G":["$31",[]],"S":true} +32:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"OutletBoundary"] +33:"$Sreact.suspense" +35:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ViewportBoundary"] +37:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"MetadataBoundary"] +9:["$","script","script-16",{"src":"/litellm-asset-prefix/_next/static/chunks/7af309decf630af7.js","async":true,"nonce":"$undefined"}] +a:["$","script","script-17",{"src":"/litellm-asset-prefix/_next/static/chunks/4188d520ca4e5f2b.js","async":true,"nonce":"$undefined"}] +b:["$","script","script-18",{"src":"/litellm-asset-prefix/_next/static/chunks/64f1a2ef9113d86f.js","async":true,"nonce":"$undefined"}] +c:["$","script","script-19",{"src":"/litellm-asset-prefix/_next/static/chunks/457923c551f21385.js","async":true,"nonce":"$undefined"}] +d:["$","script","script-20",{"src":"/litellm-asset-prefix/_next/static/chunks/0aece5fc054ad66e.js","async":true,"nonce":"$undefined"}] +e:["$","script","script-21",{"src":"/litellm-asset-prefix/_next/static/chunks/c8a0095ffe8cea4a.js","async":true,"nonce":"$undefined"}] +f:["$","script","script-22",{"src":"/litellm-asset-prefix/_next/static/chunks/72250192fd3153b7.js","async":true,"nonce":"$undefined"}] +10:["$","script","script-23",{"src":"/litellm-asset-prefix/_next/static/chunks/a9ebedc318fa36dc.js","async":true,"nonce":"$undefined"}] +11:["$","script","script-24",{"src":"/litellm-asset-prefix/_next/static/chunks/3f369c603677cd7a.js","async":true,"nonce":"$undefined"}] +12:["$","script","script-25",{"src":"/litellm-asset-prefix/_next/static/chunks/66a190706fc6c35a.js","async":true,"nonce":"$undefined"}] +13:["$","script","script-26",{"src":"/litellm-asset-prefix/_next/static/chunks/3b30ab8eaa03bc21.js","async":true,"nonce":"$undefined"}] +14:["$","script","script-27",{"src":"/litellm-asset-prefix/_next/static/chunks/7e417dd24c8becd0.js","async":true,"nonce":"$undefined"}] +15:["$","script","script-28",{"src":"/litellm-asset-prefix/_next/static/chunks/e007904603a33bc5.js","async":true,"nonce":"$undefined"}] +16:["$","script","script-29",{"src":"/litellm-asset-prefix/_next/static/chunks/5d3e07ae5afa6fa6.js","async":true,"nonce":"$undefined"}] +17:["$","script","script-30",{"src":"/litellm-asset-prefix/_next/static/chunks/c7b74067c01ee971.js","async":true,"nonce":"$undefined"}] +18:["$","script","script-31",{"src":"/litellm-asset-prefix/_next/static/chunks/8992001a9a91bc67.js","async":true,"nonce":"$undefined"}] +19:["$","script","script-32",{"src":"/litellm-asset-prefix/_next/static/chunks/4980372eaa37b78b.js","async":true,"nonce":"$undefined"}] +1a:["$","script","script-33",{"src":"/litellm-asset-prefix/_next/static/chunks/bdf355b41816a002.js","async":true,"nonce":"$undefined"}] +1b:["$","script","script-34",{"src":"/litellm-asset-prefix/_next/static/chunks/799b258fbe06c072.js","async":true,"nonce":"$undefined"}] +1c:["$","script","script-35",{"src":"/litellm-asset-prefix/_next/static/chunks/99cf9cf99df5ccfc.js","async":true,"nonce":"$undefined"}] +1d:["$","script","script-36",{"src":"/litellm-asset-prefix/_next/static/chunks/00ff280cdb7d7ee5.js","async":true,"nonce":"$undefined"}] +1e:["$","script","script-37",{"src":"/litellm-asset-prefix/_next/static/chunks/0a65da2cd24e2ab6.js","async":true,"nonce":"$undefined"}] +1f:["$","script","script-38",{"src":"/litellm-asset-prefix/_next/static/chunks/23f80b1de2d3b634.js","async":true,"nonce":"$undefined"}] +20:["$","script","script-39",{"src":"/litellm-asset-prefix/_next/static/chunks/c637e0ee56f50900.js","async":true,"nonce":"$undefined"}] +21:["$","script","script-40",{"src":"/litellm-asset-prefix/_next/static/chunks/a382857dbbcea5d1.js","async":true,"nonce":"$undefined"}] +22:["$","script","script-41",{"src":"/litellm-asset-prefix/_next/static/chunks/8e12212d7a0aeaee.js","async":true,"nonce":"$undefined"}] +23:["$","script","script-42",{"src":"/litellm-asset-prefix/_next/static/chunks/1ab4ccc7c0ba9eff.js","async":true,"nonce":"$undefined"}] +24:["$","script","script-43",{"src":"/litellm-asset-prefix/_next/static/chunks/8354d717e34ebd6f.js","async":true,"nonce":"$undefined"}] +25:["$","script","script-44",{"src":"/litellm-asset-prefix/_next/static/chunks/2971c4658f1bcd7d.js","async":true,"nonce":"$undefined"}] +26:["$","script","script-45",{"src":"/litellm-asset-prefix/_next/static/chunks/6c4c97f1ea6e7d77.js","async":true,"nonce":"$undefined"}] +27:["$","script","script-46",{"src":"/litellm-asset-prefix/_next/static/chunks/a21582fe1f52b973.js","async":true,"nonce":"$undefined"}] +28:["$","script","script-47",{"src":"/litellm-asset-prefix/_next/static/chunks/496b84010c33cf69.js","async":true,"nonce":"$undefined"}] +29:["$","script","script-48",{"src":"/litellm-asset-prefix/_next/static/chunks/21ae464276343547.js","async":true,"nonce":"$undefined"}] +2a:["$","script","script-49",{"src":"/litellm-asset-prefix/_next/static/chunks/c4452a79c69324a6.js","async":true,"nonce":"$undefined"}] +2b:["$","script","script-50",{"src":"/litellm-asset-prefix/_next/static/chunks/a5fe06c2cefac5bc.js","async":true,"nonce":"$undefined"}] +2c:["$","script","script-51",{"src":"/litellm-asset-prefix/_next/static/chunks/450ebd094f4fa24d.js","async":true,"nonce":"$undefined"}] +2d:["$","script","script-52",{"src":"/litellm-asset-prefix/_next/static/chunks/6367dd1d1cf7eeef.js","async":true,"nonce":"$undefined"}] +2e:["$","script","script-53",{"src":"/litellm-asset-prefix/_next/static/chunks/c24d3e9cf8b1b7ed.js","async":true,"nonce":"$undefined"}] +2f:["$","$L32",null,{"children":["$","$33",null,{"name":"Next.MetadataOutlet","children":"$@34"}]}] +30:["$","$1","h",{"children":[null,["$","$L35",null,{"children":"$L36"}],["$","div",null,{"hidden":true,"children":["$","$L37",null,{"children":["$","$33",null,{"name":"Next.Metadata","children":"$L38"}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}] +7:{} +8:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params" +36:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]] +39:I[27201,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"IconMark"] +34:null +38:[["$","title","0",{"children":"LiteLLM Dashboard"}],["$","meta","1",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","2",{"rel":"icon","href":"/favicon.ico?favicon.1d32c690.ico","sizes":"48x48","type":"image/x-icon"}],["$","link","3",{"rel":"icon","href":"./favicon.ico"}],["$","$L39","4",{}]] diff --git a/litellm/proxy/_experimental/out/__next._head.txt b/litellm/proxy/_experimental/out/__next._head.txt new file mode 100644 index 00000000000..ec79a772ce5 --- /dev/null +++ b/litellm/proxy/_experimental/out/__next._head.txt @@ -0,0 +1,6 @@ +1:"$Sreact.fragment" +2:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"ViewportBoundary"] +3:I[897367,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"MetadataBoundary"] +4:"$Sreact.suspense" +5:I[27201,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"IconMark"] +0:{"buildId":"FNzcPugrMYo8KWdUvIcl9","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]}],["$","div",null,{"hidden":true,"children":["$","$L3",null,{"children":["$","$4",null,{"name":"Next.Metadata","children":[["$","title","0",{"children":"LiteLLM Dashboard"}],["$","meta","1",{"name":"description","content":"LiteLLM Proxy Admin UI"}],["$","link","2",{"rel":"icon","href":"/favicon.ico?favicon.1d32c690.ico","sizes":"48x48","type":"image/x-icon"}],["$","link","3",{"rel":"icon","href":"./favicon.ico"}],["$","$L5","4",{}]]}]}]}],["$","meta",null,{"name":"next-size-adjust","content":""}]]}],"loading":null,"isPartial":false} diff --git a/litellm/proxy/_experimental/out/__next._index.txt b/litellm/proxy/_experimental/out/__next._index.txt new file mode 100644 index 00000000000..8bb2bd8e3ed --- /dev/null +++ b/litellm/proxy/_experimental/out/__next._index.txt @@ -0,0 +1,7 @@ +1:"$Sreact.fragment" +2:I[71195,["/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js"],"default"] +3:I[339756,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] +4:I[837457,["/litellm-asset-prefix/_next/static/chunks/d96012bcfc98706a.js","/litellm-asset-prefix/_next/static/chunks/dbca964212122d58.js"],"default"] +:HL["/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","style"] +:HL["/litellm-asset-prefix/_next/static/chunks/d682c064a60ae3d6.css","style"] +0:{"buildId":"FNzcPugrMYo8KWdUvIcl9","rsc":["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","precedence":"next"}],["$","link","1",{"rel":"stylesheet","href":"/litellm-asset-prefix/_next/static/chunks/d682c064a60ae3d6.css","precedence":"next"}],["$","script","script-0",{"src":"/litellm-asset-prefix/_next/static/chunks/26adfa4e8ffc85c7.js","async":true}],["$","script","script-1",{"src":"/litellm-asset-prefix/_next/static/chunks/e8ed72789c2b42ff.js","async":true}]],["$","html",null,{"lang":"en","children":["$","body",null,{"className":"inter_5972bc34-module__OU16Qa__className","children":["$","$L2",null,{"children":["$","$L3",null,{"parallelRouterKey":"children","template":["$","$L4",null,{}],"notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]]}]}]}]}]]}],"loading":null,"isPartial":false} diff --git a/litellm/proxy/_experimental/out/__next._tree.txt b/litellm/proxy/_experimental/out/__next._tree.txt new file mode 100644 index 00000000000..f28d766a8f7 --- /dev/null +++ b/litellm/proxy/_experimental/out/__next._tree.txt @@ -0,0 +1,5 @@ +:HL["/litellm-asset-prefix/_next/static/chunks/4e20891f2fd03463.css","style"] +:HL["/litellm-asset-prefix/_next/static/chunks/d682c064a60ae3d6.css","style"] +:HL["/litellm-asset-prefix/_next/static/media/83afe278b6a6bb3c-s.p.3a6ba036.woff2","font",{"crossOrigin":"","type":"font/woff2"}] +:HL["/litellm-asset-prefix/_next/static/chunks/3f3fa56b5786d58c.css","style"] +0:{"buildId":"FNzcPugrMYo8KWdUvIcl9","tree":{"name":"","paramType":null,"paramKey":"","hasRuntimePrefetch":false,"slots":{"children":{"name":"__PAGE__","paramType":null,"paramKey":"__PAGE__","hasRuntimePrefetch":false,"slots":null,"isRootLayout":false}},"isRootLayout":true},"staleTime":300} diff --git a/litellm/proxy/_experimental/out/_next/static/-YcCp5y5G0wpTwGaCJTwX/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/-YcCp5y5G0wpTwGaCJTwX/_buildManifest.js deleted file mode 100644 index 1b732be87b0..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/-YcCp5y5G0wpTwGaCJTwX/_buildManifest.js +++ /dev/null @@ -1 +0,0 @@ -self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-cf5ca766ac8f493f.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/FNzcPugrMYo8KWdUvIcl9/_buildManifest.js b/litellm/proxy/_experimental/out/_next/static/FNzcPugrMYo8KWdUvIcl9/_buildManifest.js new file mode 100644 index 00000000000..d74e1661bbe --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/FNzcPugrMYo8KWdUvIcl9/_buildManifest.js @@ -0,0 +1,16 @@ +self.__BUILD_MANIFEST = { + "__rewrites": { + "afterFiles": [], + "beforeFiles": [ + { + "source": "/litellm-asset-prefix/_next/:path+", + "destination": "/_next/:path+" + } + ], + "fallback": [] + }, + "sortedPages": [ + "/_app", + "/_error" + ] +};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB() \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/FNzcPugrMYo8KWdUvIcl9/_clientMiddlewareManifest.json b/litellm/proxy/_experimental/out/_next/static/FNzcPugrMYo8KWdUvIcl9/_clientMiddlewareManifest.json new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/FNzcPugrMYo8KWdUvIcl9/_clientMiddlewareManifest.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/-YcCp5y5G0wpTwGaCJTwX/_ssgManifest.js b/litellm/proxy/_experimental/out/_next/static/FNzcPugrMYo8KWdUvIcl9/_ssgManifest.js similarity index 100% rename from litellm/proxy/_experimental/out/_next/static/-YcCp5y5G0wpTwGaCJTwX/_ssgManifest.js rename to litellm/proxy/_experimental/out/_next/static/FNzcPugrMYo8KWdUvIcl9/_ssgManifest.js diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/00bcc8d30dd19793.js b/litellm/proxy/_experimental/out/_next/static/chunks/00bcc8d30dd19793.js new file mode 100644 index 00000000000..6ad60ffa7fc --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/00bcc8d30dd19793.js @@ -0,0 +1,9 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,360820,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});e.s(["ChevronUpIcon",0,r],360820)},871943,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});e.s(["ChevronDownIcon",0,r],871943)},269200,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("Table"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement("div",{className:(0,a.tremorTwMerge)(o("root"),"overflow-auto",i)},r.default.createElement("table",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},s),n))});l.displayName="Table",e.s(["Table",()=>l],269200)},942232,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableBody"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tbody",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",i)},s),n))});l.displayName="TableBody",e.s(["TableBody",()=>l],942232)},977572,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableCell"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("td",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"align-middle whitespace-nowrap text-left p-4",i)},s),n))});l.displayName="TableCell",e.s(["TableCell",()=>l],977572)},427612,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableHead"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("thead",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",i)},s),n))});l.displayName="TableHead",e.s(["TableHead",()=>l],427612)},64848,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableHeaderCell"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("th",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",i)},s),n))});l.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>l],64848)},496020,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let o=(0,e.i(673706).makeClassName)("TableRow"),l=r.default.forwardRef((e,l)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tr",Object.assign({ref:l,className:(0,a.tremorTwMerge)(o("row"),i)},s),n))});l.displayName="TableRow",e.s(["TableRow",()=>l],496020)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),a=e.i(271645);let o=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],l=e=>({_s:e,status:o[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),n=e=>e?6:5,i=(e,t,r,a,o)=>{clearTimeout(a.current);let n=l(e);t(n),r.current=n,o&&o({current:n})};var s=e.i(480731),d=e.i(444755),c=e.i(673706);let u=e=>{var r=(0,t.__rest)(e,[]);return a.default.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),a.default.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),a.default.createElement("path",{d:"M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z"}))};var g=e.i(95779);let m={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},b=(e,t)=>{switch(e){case"primary":return{textColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,c.getColorClassNames)(t,g.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?(0,c.getColorClassNames)(t,g.colorPalette.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?(0,c.getColorClassNames)(t,g.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?(0,c.getColorClassNames)(t,g.colorPalette.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?(0,c.getColorClassNames)(t,g.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,g.colorPalette.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,hoverBgColor:t?(0,d.tremorTwMerge)((0,c.getColorClassNames)(t,g.colorPalette.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:t?(0,c.getColorClassNames)(t,g.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?(0,c.getColorClassNames)(t,g.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,g.colorPalette.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},p=(0,c.makeClassName)("Button"),f=({loading:e,iconSize:t,iconPosition:r,Icon:o,needMargin:l,transitionStatus:n})=>{let i=l?r===s.HorizontalPositions.Left?(0,d.tremorTwMerge)("-ml-1","mr-1.5"):(0,d.tremorTwMerge)("-mr-1","ml-1.5"):"",c=(0,d.tremorTwMerge)("w-0 h-0"),g={default:c,entering:c,entered:t,exiting:t,exited:c};return e?a.default.createElement(u,{className:(0,d.tremorTwMerge)(p("icon"),"animate-spin shrink-0",i,g.default,g[n]),style:{transition:"width 150ms"}}):a.default.createElement(o,{className:(0,d.tremorTwMerge)(p("icon"),"shrink-0",t,i)})},h=a.default.forwardRef((e,o)=>{let{icon:u,iconPosition:g=s.HorizontalPositions.Left,size:h=s.Sizes.SM,color:C,variant:k="primary",disabled:v,loading:x=!1,loadingText:w,children:$,tooltip:y,className:E}=e,O=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),N=x||v,j=void 0!==u||x,S=x&&w,T=!(!$&&!S),R=(0,d.tremorTwMerge)(m[h].height,m[h].width),B="light"!==k?(0,d.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",z=b(k,C),M=("light"!==k?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}})[h],{tooltipProps:I,getReferenceProps:q}=(0,r.useTooltip)(300),[P,H]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:o,timeout:s,initialEntered:d,mountOnEnter:c,unmountOnExit:u,onStateChange:g}={})=>{let[m,b]=(0,a.useState)(()=>l(d?2:n(c))),p=(0,a.useRef)(m),f=(0,a.useRef)(0),[h,C]="object"==typeof s?[s.enter,s.exit]:[s,s],k=(0,a.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return n(t)}})(p.current._s,u);e&&i(e,b,p,f,g)},[g,u]);return[m,(0,a.useCallback)(a=>{let l=e=>{switch(i(e,b,p,f,g),e){case 1:h>=0&&(f.current=((...e)=>setTimeout(...e))(k,h));break;case 4:C>=0&&(f.current=((...e)=>setTimeout(...e))(k,C));break;case 0:case 3:f.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||l(e+1)},0)}},s=p.current.isEnter;"boolean"!=typeof a&&(a=!s),a?s||l(e?+!r:2):s&&l(t?o?3:4:n(u))},[k,g,e,t,r,o,h,C,u]),k]})({timeout:50});return(0,a.useEffect)(()=>{H(x)},[x]),a.default.createElement("button",Object.assign({ref:(0,c.mergeRefs)([o,I.refs.setReference]),className:(0,d.tremorTwMerge)(p("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",B,M.paddingX,M.paddingY,M.fontSize,z.textColor,z.bgColor,z.borderColor,z.hoverBorderColor,N?"opacity-50 cursor-not-allowed":(0,d.tremorTwMerge)(b(k,C).hoverTextColor,b(k,C).hoverBgColor,b(k,C).hoverBorderColor),E),disabled:N},q,O),a.default.createElement(r.default,Object.assign({text:y},I)),j&&g!==s.HorizontalPositions.Right?a.default.createElement(f,{loading:x,iconSize:R,iconPosition:g,Icon:u,transitionStatus:P.status,needMargin:T}):null,S||$?a.default.createElement("span",{className:(0,d.tremorTwMerge)(p("text"),"text-tremor-default whitespace-nowrap")},S?w:$):null,j&&g===s.HorizontalPositions.Right?a.default.createElement(f,{loading:x,iconSize:R,iconPosition:g,Icon:u,transitionStatus:P.status,needMargin:T}):null)});h.displayName="Button",e.s(["Button",()=>h],994388)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(480731),o=e.i(95779),l=e.i(444755),n=e.i(673706);let i=(0,n.makeClassName)("Card"),s=r.default.forwardRef((e,s)=>{let{decoration:d="",decorationColor:c,children:u,className:g}=e,m=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:s,className:(0,l.tremorTwMerge)(i("root"),"relative w-full text-left ring-1 rounded-tremor-default p-6","bg-tremor-background ring-tremor-ring shadow-tremor-card","dark:bg-dark-tremor-background dark:ring-dark-tremor-ring dark:shadow-dark-tremor-card",c?(0,n.getColorClassNames)(c,o.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case a.HorizontalPositions.Left:return"border-l-4";case a.VerticalPositions.Top:return"border-t-4";case a.HorizontalPositions.Right:return"border-r-4";case a.VerticalPositions.Bottom:return"border-b-4";default:return""}})(d),g)},m),u)});s.displayName="Card",e.s(["Card",()=>s],304967)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(242064),o=e.i(529681);let l=e=>{let{prefixCls:a,className:o,style:l,size:n,shape:i}=e,s=(0,r.default)({[`${a}-lg`]:"large"===n,[`${a}-sm`]:"small"===n}),d=(0,r.default)({[`${a}-circle`]:"circle"===i,[`${a}-square`]:"square"===i,[`${a}-round`]:"round"===i}),c=t.useMemo(()=>"number"==typeof n?{width:n,height:n,lineHeight:`${n}px`}:{},[n]);return t.createElement("span",{className:(0,r.default)(a,s,d,o),style:Object.assign(Object.assign({},c),l)})};e.i(296059);var n=e.i(694758),i=e.i(915654),s=e.i(246422),d=e.i(838378);let c=new n.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),u=e=>({height:e,lineHeight:(0,i.unit)(e)}),g=e=>Object.assign({width:e},u(e)),m=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},u(e)),b=e=>Object.assign({width:e},u(e)),p=(e,t,r)=>{let{skeletonButtonCls:a}=e;return{[`${r}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${r}${a}-round`]:{borderRadius:t}}},f=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},u(e)),h=(0,s.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:r}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:r,skeletonTitleCls:a,skeletonParagraphCls:o,skeletonButtonCls:l,skeletonInputCls:n,skeletonImageCls:i,controlHeight:s,controlHeightLG:d,controlHeightSM:u,gradientFromColor:h,padding:C,marginSM:k,borderRadius:v,titleHeight:x,blockRadius:w,paragraphLiHeight:$,controlHeightXS:y,paragraphMarginTop:E}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:C,verticalAlign:"top",[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:h},g(s)),[`${r}-circle`]:{borderRadius:"50%"},[`${r}-lg`]:Object.assign({},g(d)),[`${r}-sm`]:Object.assign({},g(u))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:x,background:h,borderRadius:w,[`+ ${o}`]:{marginBlockStart:u}},[o]:{padding:0,"> li":{width:"100%",height:$,listStyle:"none",background:h,borderRadius:w,"+ li":{marginBlockStart:y}}},[`${o}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${o} > li`]:{borderRadius:v}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:k,[`+ ${o}`]:{marginBlockStart:E}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:r,controlHeight:a,controlHeightLG:o,controlHeightSM:l,gradientFromColor:n,calc:i}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:t,width:i(a).mul(2).equal(),minWidth:i(a).mul(2).equal()},f(a,i))},p(e,a,r)),{[`${r}-lg`]:Object.assign({},f(o,i))}),p(e,o,`${r}-lg`)),{[`${r}-sm`]:Object.assign({},f(l,i))}),p(e,l,`${r}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:r,controlHeight:a,controlHeightLG:o,controlHeightSM:l}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:r},g(a)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},g(o)),[`${t}${t}-sm`]:Object.assign({},g(l))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:r,skeletonInputCls:a,controlHeightLG:o,controlHeightSM:l,gradientFromColor:n,calc:i}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:r},m(t,i)),[`${a}-lg`]:Object.assign({},m(o,i)),[`${a}-sm`]:Object.assign({},m(l,i))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:r,gradientFromColor:a,borderRadiusSM:o,calc:l}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:o},b(l(r).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},b(r)),{maxWidth:l(r).mul(4).equal(),maxHeight:l(r).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[l]:{width:"100%"},[n]:{width:"100%"}},[`${t}${t}-active`]:{[` + ${a}, + ${o} > li, + ${r}, + ${l}, + ${n}, + ${i} + `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:c,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,d.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:r(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:r}=e;return{color:t,colorGradientEnd:r,gradientFromColor:t,gradientToColor:r,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),C=e=>{let{prefixCls:a,className:o,style:l,rows:n=0}=e,i=Array.from({length:n}).map((r,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:r,rows:a=2}=t;return Array.isArray(r)?r[e]:a-1===e?r:void 0})(a,e)}}));return t.createElement("ul",{className:(0,r.default)(a,o),style:l},i)},k=({prefixCls:e,className:a,width:o,style:l})=>t.createElement("h3",{className:(0,r.default)(e,a),style:Object.assign({width:o},l)});function v(e){return e&&"object"==typeof e?e:{}}let x=e=>{let{prefixCls:o,loading:n,className:i,rootClassName:s,style:d,children:c,avatar:u=!1,title:g=!0,paragraph:m=!0,active:b,round:p}=e,{getPrefixCls:f,direction:x,className:w,style:$}=(0,a.useComponentConfig)("skeleton"),y=f("skeleton",o),[E,O,N]=h(y);if(n||!("loading"in e)){let e,a,o=!!u,n=!!g,c=!!m;if(o){let r=Object.assign(Object.assign({prefixCls:`${y}-avatar`},n&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),v(u));e=t.createElement("div",{className:`${y}-header`},t.createElement(l,Object.assign({},r)))}if(n||c){let e,r;if(n){let r=Object.assign(Object.assign({prefixCls:`${y}-title`},!o&&c?{width:"38%"}:o&&c?{width:"50%"}:{}),v(g));e=t.createElement(k,Object.assign({},r))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${y}-paragraph`},(e={},o&&n||(e.width="61%"),!o&&n?e.rows=3:e.rows=2,e)),v(m));r=t.createElement(C,Object.assign({},a))}a=t.createElement("div",{className:`${y}-content`},e,r)}let f=(0,r.default)(y,{[`${y}-with-avatar`]:o,[`${y}-active`]:b,[`${y}-rtl`]:"rtl"===x,[`${y}-round`]:p},w,i,s,O,N);return E(t.createElement("div",{className:f,style:Object.assign(Object.assign({},$),d)},e,a))}return null!=c?c:null};x.Button=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,block:c=!1,size:u="default"}=e,{getPrefixCls:g}=t.useContext(a.ConfigContext),m=g("skeleton",n),[b,p,f]=h(m),C=(0,o.default)(e,["prefixCls"]),k=(0,r.default)(m,`${m}-element`,{[`${m}-active`]:d,[`${m}-block`]:c},i,s,p,f);return b(t.createElement("div",{className:k},t.createElement(l,Object.assign({prefixCls:`${m}-button`,size:u},C))))},x.Avatar=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,shape:c="circle",size:u="default"}=e,{getPrefixCls:g}=t.useContext(a.ConfigContext),m=g("skeleton",n),[b,p,f]=h(m),C=(0,o.default)(e,["prefixCls","className"]),k=(0,r.default)(m,`${m}-element`,{[`${m}-active`]:d},i,s,p,f);return b(t.createElement("div",{className:k},t.createElement(l,Object.assign({prefixCls:`${m}-avatar`,shape:c,size:u},C))))},x.Input=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,block:c,size:u="default"}=e,{getPrefixCls:g}=t.useContext(a.ConfigContext),m=g("skeleton",n),[b,p,f]=h(m),C=(0,o.default)(e,["prefixCls"]),k=(0,r.default)(m,`${m}-element`,{[`${m}-active`]:d,[`${m}-block`]:c},i,s,p,f);return b(t.createElement("div",{className:k},t.createElement(l,Object.assign({prefixCls:`${m}-input`,size:u},C))))},x.Image=e=>{let{prefixCls:o,className:l,rootClassName:n,style:i,active:s}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",o),[u,g,m]=h(c),b=(0,r.default)(c,`${c}-element`,{[`${c}-active`]:s},l,n,g,m);return u(t.createElement("div",{className:b},t.createElement("div",{className:(0,r.default)(`${c}-image`,l),style:i},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},x.Node=e=>{let{prefixCls:o,className:l,rootClassName:n,style:i,active:s,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),u=c("skeleton",o),[g,m,b]=h(u),p=(0,r.default)(u,`${u}-element`,{[`${u}-active`]:s},m,l,n,b);return g(t.createElement("div",{className:p},t.createElement("div",{className:(0,r.default)(`${u}-image`,l),style:i},d)))},e.s(["default",0,x],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var o=e.i(9583),l=r.forwardRef(function(e,l){return r.createElement(o.default,(0,t.default)({},e,{ref:l,icon:a}))});e.s(["default",0,l],959013)},68155,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,r],68155)},544195,e=>{"use strict";var t=e.i(271645),r=e.i(343794),a=e.i(981444),o=e.i(914949),l=e.i(244009),n=e.i(242064),i=e.i(321883),s=e.i(517455);let d=t.createContext(null),c=d.Provider,u=t.createContext(null),g=u.Provider;e.i(247167);var m=e.i(91874),b=e.i(611935),p=e.i(121872),f=e.i(26905),h=e.i(681216),C=e.i(937328),k=e.i(62139);e.i(296059);var v=e.i(915654),x=e.i(183293),w=e.i(246422),$=e.i(838378);let y=(0,w.genStyleHooks)("Radio",e=>{let{controlOutline:t,controlOutlineWidth:r}=e,a=`0 0 0 ${(0,v.unit)(r)} ${t}`,o=(0,$.mergeToken)(e,{radioFocusShadow:a,radioButtonFocusShadow:a});return[(e=>{let{componentCls:t,antCls:r}=e,a=`${t}-group`;return{[a]:Object.assign(Object.assign({},(0,x.resetComponent)(e)),{display:"inline-block",fontSize:0,[`&${a}-rtl`]:{direction:"rtl"},[`&${a}-block`]:{display:"flex"},[`${r}-badge ${r}-badge-count`]:{zIndex:1},[`> ${r}-badge:not(:first-child) > ${r}-button-wrapper`]:{borderInlineStart:"none"}})}})(o),(e=>{let{componentCls:t,wrapperMarginInlineEnd:r,colorPrimary:a,radioSize:o,motionDurationSlow:l,motionDurationMid:n,motionEaseInOutCirc:i,colorBgContainer:s,colorBorder:d,lineWidth:c,colorBgContainerDisabled:u,colorTextDisabled:g,paddingXS:m,dotColorDisabled:b,lineType:p,radioColor:f,radioBgColor:h,calc:C}=e,k=`${t}-inner`,w=C(o).sub(C(4).mul(2)),$=C(1).mul(o).equal({unit:!0});return{[`${t}-wrapper`]:Object.assign(Object.assign({},(0,x.resetComponent)(e)),{display:"inline-flex",alignItems:"baseline",marginInlineStart:0,marginInlineEnd:r,cursor:"pointer","&:last-child":{marginInlineEnd:0},[`&${t}-wrapper-rtl`]:{direction:"rtl"},"&-disabled":{cursor:"not-allowed",color:e.colorTextDisabled},"&::after":{display:"inline-block",width:0,overflow:"hidden",content:'"\\a0"'},"&-block":{flex:1,justifyContent:"center"},[`${t}-checked::after`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:"100%",height:"100%",border:`${(0,v.unit)(c)} ${p} ${a}`,borderRadius:"50%",visibility:"hidden",opacity:0,content:'""'},[t]:Object.assign(Object.assign({},(0,x.resetComponent)(e)),{position:"relative",display:"inline-block",outline:"none",cursor:"pointer",alignSelf:"center",borderRadius:"50%"}),[`${t}-wrapper:hover &, + &:hover ${k}`]:{borderColor:a},[`${t}-input:focus-visible + ${k}`]:(0,x.genFocusOutline)(e),[`${t}:hover::after, ${t}-wrapper:hover &::after`]:{visibility:"visible"},[`${t}-inner`]:{"&::after":{boxSizing:"border-box",position:"absolute",insetBlockStart:"50%",insetInlineStart:"50%",display:"block",width:$,height:$,marginBlockStart:C(1).mul(o).div(-2).equal({unit:!0}),marginInlineStart:C(1).mul(o).div(-2).equal({unit:!0}),backgroundColor:f,borderBlockStart:0,borderInlineStart:0,borderRadius:$,transform:"scale(0)",opacity:0,transition:`all ${l} ${i}`,content:'""'},boxSizing:"border-box",position:"relative",insetBlockStart:0,insetInlineStart:0,display:"block",width:$,height:$,backgroundColor:s,borderColor:d,borderStyle:"solid",borderWidth:c,borderRadius:"50%",transition:`all ${n}`},[`${t}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0},[`${t}-checked`]:{[k]:{borderColor:a,backgroundColor:h,"&::after":{transform:`scale(${e.calc(e.dotSize).div(o).equal()})`,opacity:1,transition:`all ${l} ${i}`}}},[`${t}-disabled`]:{cursor:"not-allowed",[k]:{backgroundColor:u,borderColor:d,cursor:"not-allowed","&::after":{backgroundColor:b}},[`${t}-input`]:{cursor:"not-allowed"},[`${t}-disabled + span`]:{color:g,cursor:"not-allowed"},[`&${t}-checked`]:{[k]:{"&::after":{transform:`scale(${C(w).div(o).equal()})`}}}},[`span${t} + *`]:{paddingInlineStart:m,paddingInlineEnd:m}})}})(o),(e=>{let{buttonColor:t,controlHeight:r,componentCls:a,lineWidth:o,lineType:l,colorBorder:n,motionDurationMid:i,buttonPaddingInline:s,fontSize:d,buttonBg:c,fontSizeLG:u,controlHeightLG:g,controlHeightSM:m,paddingXS:b,borderRadius:p,borderRadiusSM:f,borderRadiusLG:h,buttonCheckedBg:C,buttonSolidCheckedColor:k,colorTextDisabled:w,colorBgContainerDisabled:$,buttonCheckedBgDisabled:y,buttonCheckedColorDisabled:E,colorPrimary:O,colorPrimaryHover:N,colorPrimaryActive:j,buttonSolidCheckedBg:S,buttonSolidCheckedHoverBg:T,buttonSolidCheckedActiveBg:R,calc:B}=e;return{[`${a}-button-wrapper`]:{position:"relative",display:"inline-block",height:r,margin:0,paddingInline:s,paddingBlock:0,color:t,fontSize:d,lineHeight:(0,v.unit)(B(r).sub(B(o).mul(2)).equal()),background:c,border:`${(0,v.unit)(o)} ${l} ${n}`,borderBlockStartWidth:B(o).add(.02).equal(),borderInlineEndWidth:o,cursor:"pointer",transition:`color ${i},background ${i},box-shadow ${i}`,a:{color:t},[`> ${a}-button`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,zIndex:-1,width:"100%",height:"100%"},"&:not(:last-child)":{marginInlineEnd:B(o).mul(-1).equal()},"&:first-child":{borderInlineStart:`${(0,v.unit)(o)} ${l} ${n}`,borderStartStartRadius:p,borderEndStartRadius:p},"&:last-child":{borderStartEndRadius:p,borderEndEndRadius:p},"&:first-child:last-child":{borderRadius:p},[`${a}-group-large &`]:{height:g,fontSize:u,lineHeight:(0,v.unit)(B(g).sub(B(o).mul(2)).equal()),"&:first-child":{borderStartStartRadius:h,borderEndStartRadius:h},"&:last-child":{borderStartEndRadius:h,borderEndEndRadius:h}},[`${a}-group-small &`]:{height:m,paddingInline:B(b).sub(o).equal(),paddingBlock:0,lineHeight:(0,v.unit)(B(m).sub(B(o).mul(2)).equal()),"&:first-child":{borderStartStartRadius:f,borderEndStartRadius:f},"&:last-child":{borderStartEndRadius:f,borderEndEndRadius:f}},"&:hover":{position:"relative",color:O},"&:has(:focus-visible)":(0,x.genFocusOutline)(e),[`${a}-inner, input[type='checkbox'], input[type='radio']`]:{width:0,height:0,opacity:0,pointerEvents:"none"},[`&-checked:not(${a}-button-wrapper-disabled)`]:{zIndex:1,color:O,background:C,borderColor:O,"&::before":{backgroundColor:O},"&:first-child":{borderColor:O},"&:hover":{color:N,borderColor:N,"&::before":{backgroundColor:N}},"&:active":{color:j,borderColor:j,"&::before":{backgroundColor:j}}},[`${a}-group-solid &-checked:not(${a}-button-wrapper-disabled)`]:{color:k,background:S,borderColor:S,"&:hover":{color:k,background:T,borderColor:T},"&:active":{color:k,background:R,borderColor:R}},"&-disabled":{color:w,backgroundColor:$,borderColor:n,cursor:"not-allowed","&:first-child, &:hover":{color:w,backgroundColor:$,borderColor:n}},[`&-disabled${a}-button-wrapper-checked`]:{color:E,backgroundColor:y,borderColor:n,boxShadow:"none"},"&-block":{flex:1,textAlign:"center"}}}})(o)]},e=>{let{wireframe:t,padding:r,marginXS:a,lineWidth:o,fontSizeLG:l,colorText:n,colorBgContainer:i,colorTextDisabled:s,controlItemBgActiveDisabled:d,colorTextLightSolid:c,colorPrimary:u,colorPrimaryHover:g,colorPrimaryActive:m,colorWhite:b}=e;return{radioSize:l,dotSize:t?l-8:l-(4+o)*2,dotColorDisabled:s,buttonSolidCheckedColor:c,buttonSolidCheckedBg:u,buttonSolidCheckedHoverBg:g,buttonSolidCheckedActiveBg:m,buttonBg:i,buttonCheckedBg:i,buttonColor:n,buttonCheckedBgDisabled:d,buttonCheckedColorDisabled:s,buttonPaddingInline:r-o,wrapperMarginInlineEnd:a,radioColor:t?u:b,radioBgColor:t?i:u}},{unitless:{radioSize:!0,dotSize:!0}});var E=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]]);return r};let O=t.forwardRef((e,a)=>{var o,l;let s=t.useContext(d),c=t.useContext(u),{getPrefixCls:g,direction:v,radio:x}=t.useContext(n.ConfigContext),w=t.useRef(null),$=(0,b.composeRef)(a,w),{isFormItemInput:O}=t.useContext(k.FormItemInputContext),{prefixCls:N,className:j,rootClassName:S,children:T,style:R,title:B}=e,z=E(e,["prefixCls","className","rootClassName","children","style","title"]),M=g("radio",N),I="button"===((null==s?void 0:s.optionType)||c),q=I?`${M}-button`:M,P=(0,i.default)(M),[H,_,A]=y(M,P),L=Object.assign({},z),F=t.useContext(C.default);s&&(L.name=s.name,L.onChange=t=>{var r,a;null==(r=e.onChange)||r.call(e,t),null==(a=null==s?void 0:s.onChange)||a.call(s,t)},L.checked=e.value===s.value,L.disabled=null!=(o=L.disabled)?o:s.disabled),L.disabled=null!=(l=L.disabled)?l:F;let X=(0,r.default)(`${q}-wrapper`,{[`${q}-wrapper-checked`]:L.checked,[`${q}-wrapper-disabled`]:L.disabled,[`${q}-wrapper-rtl`]:"rtl"===v,[`${q}-wrapper-in-form-item`]:O,[`${q}-wrapper-block`]:!!(null==s?void 0:s.block)},null==x?void 0:x.className,j,S,_,A,P),[W,Y]=(0,h.default)(L.onClick);return H(t.createElement(p.default,{component:"Radio",disabled:L.disabled},t.createElement("label",{className:X,style:Object.assign(Object.assign({},null==x?void 0:x.style),R),onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,title:B,onClick:W},t.createElement(m.default,Object.assign({},L,{className:(0,r.default)(L.className,{[f.TARGET_CLS]:!I}),type:"radio",prefixCls:q,ref:$,onClick:Y})),void 0!==T?t.createElement("span",{className:`${q}-label`},T):null)))});var N=e.i(286039);let j=t.forwardRef((e,d)=>{let{getPrefixCls:u,direction:g}=t.useContext(n.ConfigContext),{name:m}=t.useContext(k.FormItemInputContext),b=(0,a.default)((0,N.toNamePathStr)(m)),{prefixCls:p,className:f,rootClassName:h,options:C,buttonStyle:v="outline",disabled:x,children:w,size:$,style:E,id:j,optionType:S,name:T=b,defaultValue:R,value:B,block:z=!1,onChange:M,onMouseEnter:I,onMouseLeave:q,onFocus:P,onBlur:H}=e,[_,A]=(0,o.default)(R,{value:B}),L=t.useCallback(t=>{let r=t.target.value;"value"in e||A(r),r!==_&&(null==M||M(t))},[_,A,M]),F=u("radio",p),X=`${F}-group`,W=(0,i.default)(F),[Y,D,G]=y(F,W),V=w;C&&C.length>0&&(V=C.map(e=>"string"==typeof e||"number"==typeof e?t.createElement(O,{key:e.toString(),prefixCls:F,disabled:x,value:e,checked:_===e},e):t.createElement(O,{key:`radio-group-value-options-${e.value}`,prefixCls:F,disabled:e.disabled||x,value:e.value,checked:_===e.value,title:e.title,style:e.style,className:e.className,id:e.id,required:e.required},e.label)));let K=(0,s.default)($),U=(0,r.default)(X,`${X}-${v}`,{[`${X}-${K}`]:K,[`${X}-rtl`]:"rtl"===g,[`${X}-block`]:z},f,h,D,G,W),J=t.useMemo(()=>({onChange:L,value:_,disabled:x,name:T,optionType:S,block:z}),[L,_,x,T,S,z]);return Y(t.createElement("div",Object.assign({},(0,l.default)(e,{aria:!0,data:!0}),{className:U,style:E,onMouseEnter:I,onMouseLeave:q,onFocus:P,onBlur:H,id:j,ref:d}),t.createElement(c,{value:J},V)))}),S=t.memo(j);var T=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,a=Object.getOwnPropertySymbols(e);ot.indexOf(a[o])&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(r[a[o]]=e[a[o]]);return r};let R=t.forwardRef((e,r)=>{let{getPrefixCls:a}=t.useContext(n.ConfigContext),{prefixCls:o}=e,l=T(e,["prefixCls"]),i=a("radio",o);return t.createElement(g,{value:"button"},t.createElement(O,Object.assign({prefixCls:i},l,{type:"radio",ref:r})))});O.Button=R,O.Group=S,O.__ANT_RADIO=!0,e.s(["default",0,O],544195)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/00ff280cdb7d7ee5.js b/litellm/proxy/_experimental/out/_next/static/chunks/00ff280cdb7d7ee5.js new file mode 100644 index 00000000000..ef84e7aadbe --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/00ff280cdb7d7ee5.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,829087,397126,229315,343084,953760,e=>{"use strict";e.i(247167);var t=e.i(271645);new WeakMap,new WeakMap;var n='input:not([inert]):not([inert] *),select:not([inert]):not([inert] *),textarea:not([inert]):not([inert] *),a[href]:not([inert]):not([inert] *),button:not([inert]):not([inert] *),[tabindex]:not(slot):not([inert]):not([inert] *),audio[controls]:not([inert]):not([inert] *),video[controls]:not([inert]):not([inert] *),[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *),details>summary:first-of-type:not([inert]):not([inert] *),details:not([inert]):not([inert] *)',r="u"typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=h(t,e.form);return!o||o===e},v=function(e){return m(e)&&"radio"===e.type&&!g(e)},y=function(e){var t,n,r,o,l,u,a,c=e&&i(e),s=null==(t=c)?void 0:t.host,f=!1;if(c&&c!==e)for(f=!!(null!=(n=s)&&null!=(r=n.ownerDocument)&&r.contains(s)||null!=e&&null!=(o=e.ownerDocument)&&o.contains(e));!f&&s;)f=!!(null!=(u=s=null==(l=c=i(s))?void 0:l.host)&&null!=(a=u.ownerDocument)&&a.contains(s));return f},w=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},b=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("full-native"===n&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if("hidden"===getComputedStyle(e).visibility)return!0;var l=o.call(e,"details>summary:first-of-type")?e.parentElement:e;if(o.call(l,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return w(e)}else{if("function"==typeof r){for(var u=e;e;){var a=e.parentElement,c=i(e);if(a&&!a.shadowRoot&&!0===r(a))return w(e);e=e.assignedSlot?e.assignedSlot:a||c===e.ownerDocument?a:c.host}e=u}if(y(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},x=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;nf(t))&&!!E(e,t)},S=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!isNaN(t)||!!(t>=0)},T=function(e){var t=[],n=[];return e.forEach(function(e,r){var o=!!e.scopeParent,i=o?e.scopeParent:e,l=d(i,o),u=o?T(e.candidates):i;0===l?o?t.push.apply(t,u):t.push(i):n.push({documentOrder:r,tabIndex:l,item:e,isScope:o,content:u})}),n.sort(p).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},L=function(e,t){return T((t=t||{}).getShadowRoot?c([e],t.includeContainer,{filter:R.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:S}):a(e,t.includeContainer,R.bind(null,t)))},A=function(e,t){if(t=t||{},!e)throw Error("No node provided");return!1!==o.call(e,n)&&R(t,e)};e.s(["isTabbable",()=>A,"tabbable",()=>L],397126);var C=e.i(174080);function P(){return"u">typeof window}function O(e){return M(e)?(e.nodeName||"").toLowerCase():"#document"}function k(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function D(e){var t;return null==(t=(M(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function M(e){return!!P()&&(e instanceof Node||e instanceof k(e).Node)}function N(e){return!!P()&&(e instanceof Element||e instanceof k(e).Element)}function F(e){return!!P()&&(e instanceof HTMLElement||e instanceof k(e).HTMLElement)}function I(e){return!(!P()||"u"{try{return e.matches(t)}catch(e){return!1}})}let z=["transform","translate","scale","rotate","perspective"],K=["transform","translate","scale","rotate","perspective","filter"],U=["paint","layout","strict","content"];function X(e){let t=$(),n=N(e)?J(e):e;return z.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||K.some(e=>(n.willChange||"").includes(e))||U.some(e=>(n.contain||"").includes(e))}function Y(e){let t=Z(e);for(;F(t)&&!G(t);){if(X(t))return t;if(j(t))break;t=Z(t)}return null}function $(){return!("u"J,"getContainingBlock",()=>Y,"getDocumentElement",()=>D,"getFrameElement",()=>et,"getNodeName",()=>O,"getNodeScroll",()=>Q,"getOverflowAncestors",()=>ee,"getParentNode",()=>Z,"getWindow",()=>k,"isContainingBlock",()=>X,"isElement",()=>N,"isHTMLElement",()=>F,"isLastTraversableNode",()=>G,"isOverflowElement",()=>W,"isShadowRoot",()=>I,"isTableElement",()=>V,"isTopLayer",()=>j,"isWebKit",()=>$],229315);let en=["top","right","bottom","left"],er=en.reduce((e,t)=>e.concat(t,t+"-start",t+"-end"),[]),eo=Math.min,ei=Math.max,el=Math.round,eu=Math.floor,ea=e=>({x:e,y:e}),ec={left:"right",right:"left",bottom:"top",top:"bottom"},es={start:"end",end:"start"};function ef(e,t,n){return ei(e,eo(t,n))}function ed(e,t){return"function"==typeof e?e(t):e}function ep(e){return e.split("-")[0]}function em(e){return e.split("-")[1]}function eh(e){return"x"===e?"y":"x"}function eg(e){return"y"===e?"height":"width"}let ev=new Set(["top","bottom"]);function ey(e){return ev.has(ep(e))?"y":"x"}function ew(e){return eh(ey(e))}function eb(e,t,n){void 0===n&&(n=!1);let r=em(e),o=ew(e),i=eg(o),l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=eC(l)),[l,eC(l)]}function ex(e){let t=eC(e);return[eE(e),t,eE(t)]}function eE(e){return e.replace(/start|end/g,e=>es[e])}let eR=["left","right"],eS=["right","left"],eT=["top","bottom"],eL=["bottom","top"];function eA(e,t,n,r){let o=em(e),i=function(e,t,n){switch(e){case"top":case"bottom":if(n)return t?eS:eR;return t?eR:eS;case"left":case"right":return t?eT:eL;default:return[]}}(ep(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(eE)))),i}function eC(e){return e.replace(/left|right|bottom|top/g,e=>ec[e])}function eP(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function eO(e){let{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function ek(e,t,n){let r,{reference:o,floating:i}=e,l=ey(t),u=ew(t),a=eg(u),c=ep(t),s="y"===l,f=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,p=o[a]/2-i[a]/2;switch(c){case"top":r={x:f,y:o.y-i.height};break;case"bottom":r={x:f,y:o.y+o.height};break;case"right":r={x:o.x+o.width,y:d};break;case"left":r={x:o.x-i.width,y:d};break;default:r={x:o.x,y:o.y}}switch(em(t)){case"start":r[u]-=p*(n&&s?-1:1);break;case"end":r[u]+=p*(n&&s?-1:1)}return r}async function eD(e,t){var n;void 0===t&&(t={});let{x:r,y:o,platform:i,rects:l,elements:u,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:s="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=ed(t,e),m=eP(p),h=u[d?"floating"===f?"reference":"floating":f],g=eO(await i.getClippingRect({element:null==(n=await (null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await (null==i.getDocumentElement?void 0:i.getDocumentElement(u.floating)),boundary:c,rootBoundary:s,strategy:a})),v="floating"===f?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,y=await (null==i.getOffsetParent?void 0:i.getOffsetParent(u.floating)),w=await (null==i.isElement?void 0:i.isElement(y))&&await (null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=eO(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:v,offsetParent:y,strategy:a}):v);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}e.s(["clamp",()=>ef,"createCoords",()=>ea,"evaluate",()=>ed,"floor",()=>eu,"getAlignment",()=>em,"getAlignmentAxis",()=>ew,"getAlignmentSides",()=>eb,"getAxisLength",()=>eg,"getExpandedPlacements",()=>ex,"getOppositeAlignmentPlacement",()=>eE,"getOppositeAxis",()=>eh,"getOppositeAxisPlacements",()=>eA,"getOppositePlacement",()=>eC,"getPaddingObject",()=>eP,"getSide",()=>ep,"getSideAxis",()=>ey,"max",()=>ei,"min",()=>eo,"placements",()=>er,"rectToClientRect",()=>eO,"round",()=>el,"sides",()=>en],343084);let eM=async(e,t,n)=>{let{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,u=i.filter(Boolean),a=await (null==l.isRTL?void 0:l.isRTL(t)),c=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:s,y:f}=ek(c,r,a),d=r,p={},m=0;for(let n=0;ne[t]>=0)}function eI(e){let t=eo(...e.map(e=>e.left)),n=eo(...e.map(e=>e.top));return{x:t,y:n,width:ei(...e.map(e=>e.right))-t,height:ei(...e.map(e=>e.bottom))-n}}let eB=new Set(["left","top"]);async function eW(e,t){let{placement:n,platform:r,elements:o}=e,i=await (null==r.isRTL?void 0:r.isRTL(o.floating)),l=ep(n),u=em(n),a="y"===ey(n),c=eB.has(l)?-1:1,s=i&&a?-1:1,f=ed(t,e),{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return u&&"number"==typeof m&&(p="end"===u?-1*m:m),a?{x:p*s,y:d*c}:{x:d*c,y:p*s}}function eH(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,o=F(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=el(n)!==i||el(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function eV(e){return N(e)?e:e.contextElement}function e_(e){let t=eV(e);if(!F(t))return ea(1);let n=t.getBoundingClientRect(),{width:r,height:o,$:i}=eH(t),l=(i?el(n.width):n.width)/r,u=(i?el(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),u&&Number.isFinite(u)||(u=1),{x:l,y:u}}let ej=ea(0);function ez(e){let t=k(e);return $()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ej}function eK(e,t,n,r){var o;void 0===t&&(t=!1),void 0===n&&(n=!1);let i=e.getBoundingClientRect(),l=eV(e),u=ea(1);t&&(r?N(r)&&(u=e_(r)):u=e_(e));let a=(void 0===(o=n)&&(o=!1),r&&(!o||r===k(l))&&o)?ez(l):ea(0),c=(i.left+a.x)/u.x,s=(i.top+a.y)/u.y,f=i.width/u.x,d=i.height/u.y;if(l){let e=k(l),t=r&&N(r)?k(r):r,n=e,o=et(n);for(;o&&r&&t!==n;){let e=e_(o),t=o.getBoundingClientRect(),r=J(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,s*=e.y,f*=e.x,d*=e.y,c+=i,s+=l,o=et(n=k(o))}}return eO({width:f,height:d,x:c,y:s})}function eU(e,t){let n=Q(e).scrollLeft;return t?t.left+n:eK(D(e)).left+n}function eX(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-eU(e,n),y:n.top+t.scrollTop}}let eY=new Set(["absolute","fixed"]);function e$(e,t,n){var r;let o;if("viewport"===t)o=function(e,t){let n=k(e),r=D(e),o=n.visualViewport,i=r.clientWidth,l=r.clientHeight,u=0,a=0;if(o){i=o.width,l=o.height;let e=$();(!e||e&&"fixed"===t)&&(u=o.offsetLeft,a=o.offsetTop)}let c=eU(r);if(c<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),o="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(r.clientWidth-t.clientWidth-o);l<=25&&(i-=l)}else c<=25&&(i+=c);return{width:i,height:l,x:u,y:a}}(e,n);else if("document"===t){let t,n,i,l,u,a,c;r=D(e),t=D(r),n=Q(r),i=r.ownerDocument.body,l=ei(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),u=ei(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight),a=-n.scrollLeft+eU(r),c=-n.scrollTop,"rtl"===J(i).direction&&(a+=ei(t.clientWidth,i.clientWidth)-l),o={width:l,height:u,x:a,y:c}}else if(N(t)){let e,r,i,l,u,a;r=(e=eK(t,!0,"fixed"===n)).top+t.clientTop,i=e.left+t.clientLeft,l=F(t)?e_(t):ea(1),u=t.clientWidth*l.x,a=t.clientHeight*l.y,o={width:u,height:a,x:i*l.x,y:r*l.y}}else{let n=ez(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return eO(o)}function eq(e){return"static"===J(e).position}function eG(e,t){if(!F(e)||"fixed"===J(e).position)return null;if(t)return t(e);let n=e.offsetParent;return D(e)===n&&(n=n.ownerDocument.body),n}function eJ(e,t){let n=k(e);if(j(e))return n;if(!F(e)){let t=Z(e);for(;t&&!G(t);){if(N(t)&&!eq(t))return t;t=Z(t)}return n}let r=eG(e,t);for(;r&&V(r)&&eq(r);)r=eG(r,t);return r&&G(r)&&eq(r)&&!X(r)?n:r||Y(e)||n}let eQ=async function(e){let t=this.getOffsetParent||eJ,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=F(t),o=D(t),i="fixed"===n,l=eK(e,!0,i,t),u={scrollLeft:0,scrollTop:0},a=ea(0);if(r||!r&&!i)if(("body"!==O(t)||W(o))&&(u=Q(t)),r){let e=eK(t,!0,i,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else o&&(a.x=eU(o));i&&!r&&o&&(a.x=eU(o));let c=!o||r||i?ea(0):eX(o,u);return{x:l.left+u.scrollLeft-a.x-c.x,y:l.top+u.scrollTop-a.y-c.y,width:l.width,height:l.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},eZ={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e,i="fixed"===o,l=D(r),u=!!t&&j(t.floating);if(r===l||u&&i)return n;let a={scrollLeft:0,scrollTop:0},c=ea(1),s=ea(0),f=F(r);if((f||!f&&!i)&&(("body"!==O(r)||W(l))&&(a=Q(r)),F(r))){let e=eK(r);c=e_(r),s.x=e.x+r.clientLeft,s.y=e.y+r.clientTop}let d=!l||f||i?ea(0):eX(l,a);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+s.x+d.x,y:n.y*c.y-a.scrollTop*c.y+s.y+d.y}},getDocumentElement:D,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e,i=[..."clippingAncestors"===n?j(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=ee(e,[],!1).filter(e=>N(e)&&"body"!==O(e)),o=null,i="fixed"===J(e).position,l=i?Z(e):e;for(;N(l)&&!G(l);){let t=J(l),n=X(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&!!o&&eY.has(o.position)||W(l)&&!n&&function e(t,n){let r=Z(t);return!(r===n||!N(r)||G(r))&&("fixed"===J(r).position||e(r,n))}(e,l))?r=r.filter(e=>e!==l):o=t,l=Z(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],u=i.reduce((e,n)=>{let r=e$(t,n,o);return e.top=ei(r.top,e.top),e.right=eo(r.right,e.right),e.bottom=eo(r.bottom,e.bottom),e.left=ei(r.left,e.left),e},e$(t,l,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:eJ,getElementRects:eQ,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=eH(e);return{width:t,height:n}},getScale:e_,isElement:N,isRTL:function(e){return"rtl"===J(e).direction}};function e0(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function e1(e,t,n,r){let o;void 0===r&&(r={});let{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:u="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,s=eV(e),f=i||l?[...s?ee(s):[],...ee(t)]:[];f.forEach(e=>{i&&e.addEventListener("scroll",n,{passive:!0}),l&&e.addEventListener("resize",n)});let d=s&&a?function(e,t){let n,r=null,o=D(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return!function l(u,a){void 0===u&&(u=!1),void 0===a&&(a=1),i();let c=e.getBoundingClientRect(),{left:s,top:f,width:d,height:p}=c;if(u||t(),!d||!p)return;let m={rootMargin:-eu(f)+"px "+-eu(o.clientWidth-(s+d))+"px "+-eu(o.clientHeight-(f+p))+"px "+-eu(s)+"px",threshold:ei(0,eo(1,a))||1},h=!0;function g(t){let r=t[0].intersectionRatio;if(r!==a){if(!h)return l();r?l(!1,r):n=setTimeout(()=>{l(!1,1e-7)},1e3)}1!==r||e0(c,e.getBoundingClientRect())||l(),h=!1}try{r=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,m)}r.observe(e)}(!0),i}(s,n):null,p=-1,m=null;u&&(m=new ResizeObserver(e=>{let[r]=e;r&&r.target===s&&m&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),n()}),s&&!c&&m.observe(s),m.observe(t));let h=c?eK(e):null;return c&&function t(){let r=eK(e);h&&!e0(h,r)&&n(),h=r,o=requestAnimationFrame(t)}(),n(),()=>{var e;f.forEach(e=>{i&&e.removeEventListener("scroll",n),l&&e.removeEventListener("resize",n)}),null==d||d(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(o)}}let e2=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:o,y:i,placement:l,middlewareData:u}=t,a=await eW(t,e);return l===(null==(n=u.offset)?void 0:n.placement)&&null!=(r=u.arrow)&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:l}}}}},e3=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o,i;let{rects:l,middlewareData:u,placement:a,platform:c,elements:s}=t,{crossAxis:f=!1,alignment:d,allowedPlacements:p=er,autoAlignment:m=!0,...h}=ed(e,t),g=void 0!==d||p===er?((i=d||null)?[...p.filter(e=>em(e)===i),...p.filter(e=>em(e)!==i)]:p.filter(e=>ep(e)===e)).filter(e=>!i||em(e)===i||!!m&&eE(e)!==e):p,v=await c.detectOverflow(t,h),y=(null==(n=u.autoPlacement)?void 0:n.index)||0,w=g[y];if(null==w)return{};let b=eb(w,l,await (null==c.isRTL?void 0:c.isRTL(s.floating)));if(a!==w)return{reset:{placement:g[0]}};let x=[v[ep(w)],v[b[0]],v[b[1]]],E=[...(null==(r=u.autoPlacement)?void 0:r.overflows)||[],{placement:w,overflows:x}],R=g[y+1];if(R)return{data:{index:y+1,overflows:E},reset:{placement:R}};let S=E.map(e=>{let t=em(e.placement);return[e.placement,t&&f?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),T=(null==(o=S.filter(e=>e[2].slice(0,em(e[0])?2:3).every(e=>e<=0))[0])?void 0:o[0])||S[0][0];return T!==a?{data:{index:y+1,overflows:E},reset:{placement:T}}:{}}}},e5=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:r,placement:o,platform:i}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=ed(e,t),s={x:n,y:r},f=await i.detectOverflow(t,c),d=ey(ep(o)),p=eh(d),m=s[p],h=s[d];if(l){let e="y"===p?"top":"left",t="y"===p?"bottom":"right",n=m+f[e],r=m-f[t];m=ef(n,m,r)}if(u){let e="y"===d?"top":"left",t="y"===d?"bottom":"right",n=h+f[e],r=h-f[t];h=ef(n,h,r)}let g=a.fn({...t,[p]:m,[d]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:l,[d]:u}}}}}},e7=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r,o,i,l;let{placement:u,middlewareData:a,rects:c,initialPlacement:s,platform:f,elements:d}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:y=!0,...w}=ed(e,t);if(null!=(n=a.arrow)&&n.alignmentOffset)return{};let b=ep(u),x=ey(s),E=ep(s)===s,R=await (null==f.isRTL?void 0:f.isRTL(d.floating)),S=h||(E||!y?[eC(s)]:ex(s)),T="none"!==v;!h&&T&&S.push(...eA(s,y,v,R));let L=[s,...S],A=await f.detectOverflow(t,w),C=[],P=(null==(r=a.flip)?void 0:r.overflows)||[];if(p&&C.push(A[b]),m){let e=eb(u,c,R);C.push(A[e[0]],A[e[1]])}if(P=[...P,{placement:u,overflows:C}],!C.every(e=>e<=0)){let e=((null==(o=a.flip)?void 0:o.index)||0)+1,t=L[e];if(t&&("alignment"!==m||x===ey(t)||P.every(e=>ey(e.placement)!==x||e.overflows[0]>0)))return{data:{index:e,overflows:P},reset:{placement:t}};let n=null==(i=P.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:i.placement;if(!n)switch(g){case"bestFit":{let e=null==(l=P.filter(e=>{if(T){let t=ey(e.placement);return t===x||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:l[0];e&&(n=e);break}case"initialPlacement":n=s}if(u!==n)return{reset:{placement:n}}}return{}}}},e4=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,r;let o,i,{placement:l,rects:u,platform:a,elements:c}=t,{apply:s=()=>{},...f}=ed(e,t),d=await a.detectOverflow(t,f),p=ep(l),m=em(l),h="y"===ey(l),{width:g,height:v}=u.floating;"top"===p||"bottom"===p?(o=p,i=m===(await (null==a.isRTL?void 0:a.isRTL(c.floating))?"start":"end")?"left":"right"):(i=p,o="end"===m?"top":"bottom");let y=v-d.top-d.bottom,w=g-d.left-d.right,b=eo(v-d[o],y),x=eo(g-d[i],w),E=!t.middlewareData.shift,R=b,S=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(S=w),null!=(r=t.middlewareData.shift)&&r.enabled.y&&(R=y),E&&!m){let e=ei(d.left,0),t=ei(d.right,0),n=ei(d.top,0),r=ei(d.bottom,0);h?S=g-2*(0!==e||0!==t?e+t:ei(d.left,d.right)):R=v-2*(0!==n||0!==r?n+r:ei(d.top,d.bottom))}await s({...t,availableWidth:S,availableHeight:R});let T=await a.getDimensions(c.floating);return g!==T.width||v!==T.height?{reset:{rects:!0}}:{}}}},e9=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=ed(e,t);switch(o){case"referenceHidden":{let e=eN(await r.detectOverflow(t,{...i,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:eF(e)}}}case"escaped":{let e=eN(await r.detectOverflow(t,{...i,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:eF(e)}}}default:return{}}}}},e8=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:o,rects:i,platform:l,elements:u,middlewareData:a}=t,{element:c,padding:s=0}=ed(e,t)||{};if(null==c)return{};let f=eP(s),d={x:n,y:r},p=ew(o),m=eg(p),h=await l.getDimensions(c),g="y"===p,v=g?"clientHeight":"clientWidth",y=i.reference[m]+i.reference[p]-d[p]-i.floating[m],w=d[p]-i.reference[p],b=await (null==l.getOffsetParent?void 0:l.getOffsetParent(c)),x=b?b[v]:0;x&&await (null==l.isElement?void 0:l.isElement(b))||(x=u.floating[v]||i.floating[m]);let E=x/2-h[m]/2-1,R=eo(f[g?"top":"left"],E),S=eo(f[g?"bottom":"right"],E),T=x-h[m]-S,L=x/2-h[m]/2+(y/2-w/2),A=ef(R,L,T),C=!a.arrow&&null!=em(o)&&L!==A&&i.reference[m]/2-(Le.y-t.y),n=[],r=null;for(let e=0;er.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map(e=>eO(eI(e)))}(s),d=eO(eI(s)),p=eP(u),m=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===f.length&&f[0].left>f[1].right&&null!=a&&null!=c)return f.find(e=>a>e.left-p.left&&ae.top-p.top&&c=2){if("y"===ey(n)){let e=f[0],t=f[f.length-1],r="top"===ep(n),o=e.top,i=t.bottom,l=r?e.left:t.left,u=r?e.right:t.right;return{top:o,bottom:i,left:l,right:u,width:u-l,height:i-o,x:l,y:o}}let e="left"===ep(n),t=ei(...f.map(e=>e.right)),r=eo(...f.map(e=>e.left)),o=f.filter(n=>e?n.left===r:n.right===t),i=o[0].top,l=o[o.length-1].bottom;return{top:i,bottom:l,left:r,right:t,width:t-r,height:l-i,x:r,y:i}}return d}},floating:r.floating,strategy:l});return o.reference.x!==m.reference.x||o.reference.y!==m.reference.y||o.reference.width!==m.reference.width||o.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},te=function(e){return void 0===e&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:o,rects:i,middlewareData:l}=t,{offset:u=0,mainAxis:a=!0,crossAxis:c=!0}=ed(e,t),s={x:n,y:r},f=ey(o),d=eh(f),p=s[d],m=s[f],h=ed(u,t),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(a){let e="y"===d?"height":"width",t=i.reference[d]-i.floating[e]+g.mainAxis,n=i.reference[d]+i.reference[e]-g.mainAxis;pn&&(p=n)}if(c){var v,y;let e="y"===d?"width":"height",t=eB.has(ep(o)),n=i.reference[f]-i.floating[e]+(t&&(null==(v=l.offset)?void 0:v[f])||0)+(t?0:g.crossAxis),r=i.reference[f]+i.reference[e]+(t?0:(null==(y=l.offset)?void 0:y[f])||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[d]:p,[f]:m}}}},tt=(e,t,n)=>{let r=new Map,o={platform:eZ,...n},i={...o.platform,_c:r};return eM(e,t,{...o,platform:i})};e.s(["arrow",()=>e8,"autoPlacement",()=>e3,"autoUpdate",()=>e1,"computePosition",()=>tt,"detectOverflow",()=>eD,"flip",()=>e7,"hide",()=>e9,"inline",()=>e6,"limitShift",()=>te,"offset",()=>e2,"shift",()=>e5,"size",()=>e4],953760);var tn="u">typeof document?t.useLayoutEffect:t.useEffect;function tr(e,t){let n,r,o;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(!tr(e[r],t[r]))return!1;return!0}if((n=(o=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){let n=o[r];if(("_owner"!==n||!e.$$typeof)&&!tr(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function to(e){let n=t.useRef(e);return tn(()=>{n.current=e}),n}var ti="u">typeof document?t.useLayoutEffect:t.useEffect;let tl=!1,tu=0,ta=()=>"floating-ui-"+tu++,tc=t["useId".toString()]||function(){let[e,n]=t.useState(()=>tl?ta():void 0);return ti(()=>{null==e&&n(ta())},[]),t.useEffect(()=>{tl||(tl=!0)},[]),e},ts=t.createContext(null),tf=t.createContext(null),td=()=>{var e;return(null==(e=t.useContext(ts))?void 0:e.id)||null};function tp(e){return(null==e?void 0:e.ownerDocument)||document}function tm(e){return tp(e).defaultView||window}function th(e){return!!e&&e instanceof tm(e).Element}function tg(e){return!!e&&e instanceof tm(e).HTMLElement}function tv(e,t){let n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function ty(e){let n=(0,t.useRef)(e);return ti(()=>{n.current=e}),n}let tw="data-floating-ui-safe-polygon";function tb(e,t,n){return n&&!tv(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}let tx=function(e,n){let{enabled:r=!0,delay:o=0,handleClose:i=null,mouseOnly:l=!1,restMs:u=0,move:a=!0}=void 0===n?{}:n,{open:c,onOpenChange:s,dataRef:f,events:d,elements:{domReference:p,floating:m},refs:h}=e,g=t.useContext(tf),v=td(),y=ty(i),w=ty(o),b=t.useRef(),x=t.useRef(),E=t.useRef(),R=t.useRef(),S=t.useRef(!0),T=t.useRef(!1),L=t.useRef(()=>{}),A=t.useCallback(()=>{var e;let t=null==(e=f.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t},[f]);t.useEffect(()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(x.current),clearTimeout(R.current),S.current=!0}},[r,d]),t.useEffect(()=>{if(!r||!y.current||!c)return;function e(){A()&&s(!1)}let t=tp(m).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[m,c,s,r,y,f,A]);let C=t.useCallback(function(e){void 0===e&&(e=!0);let t=tb(w.current,"close",b.current);t&&!E.current?(clearTimeout(x.current),x.current=setTimeout(()=>s(!1),t)):e&&(clearTimeout(x.current),s(!1))},[w,s]),P=t.useCallback(()=>{L.current(),E.current=void 0},[]),O=t.useCallback(()=>{if(T.current){let e=tp(h.floating.current).body;e.style.pointerEvents="",e.removeAttribute(tw),T.current=!1}},[h]);return t.useEffect(()=>{if(r&&th(p))return c&&p.addEventListener("mouseleave",i),null==m||m.addEventListener("mouseleave",i),a&&p.addEventListener("mousemove",n,{once:!0}),p.addEventListener("mouseenter",n),p.addEventListener("mouseleave",o),()=>{c&&p.removeEventListener("mouseleave",i),null==m||m.removeEventListener("mouseleave",i),a&&p.removeEventListener("mousemove",n),p.removeEventListener("mouseenter",n),p.removeEventListener("mouseleave",o)};function t(){return!!f.current.openEvent&&["click","mousedown"].includes(f.current.openEvent.type)}function n(e){if(clearTimeout(x.current),S.current=!1,l&&!tv(b.current)||u>0&&0===tb(w.current,"open"))return;f.current.openEvent=e;let t=tb(w.current,"open",b.current);t?x.current=setTimeout(()=>{s(!0)},t):s(!0)}function o(n){if(t())return;L.current();let r=tp(m);if(clearTimeout(R.current),y.current){c||clearTimeout(x.current),E.current=y.current({...e,tree:g,x:n.clientX,y:n.clientY,onClose(){O(),P(),C()}});let t=E.current;r.addEventListener("mousemove",t),L.current=()=>{r.removeEventListener("mousemove",t)};return}C()}function i(n){t()||null==y.current||y.current({...e,tree:g,x:n.clientX,y:n.clientY,onClose(){O(),P(),C()}})(n)}},[p,m,r,e,l,u,a,C,P,O,s,c,g,w,y,f]),ti(()=>{var e,t,n;if(r&&c&&null!=(e=y.current)&&e.__options.blockPointerEvents&&A()){let e=tp(m).body;if(e.setAttribute(tw,""),e.style.pointerEvents="none",T.current=!0,th(p)&&m){let e=null==g||null==(t=g.nodesRef.current.find(e=>e.id===v))||null==(n=t.context)?void 0:n.elements.floating;return e&&(e.style.pointerEvents=""),p.style.pointerEvents="auto",m.style.pointerEvents="auto",()=>{p.style.pointerEvents="",m.style.pointerEvents=""}}}},[r,c,v,m,p,g,y,f,A]),ti(()=>{c||(b.current=void 0,P(),O())},[c,P,O]),t.useEffect(()=>()=>{P(),clearTimeout(x.current),clearTimeout(R.current),O()},[r,P,O]),t.useMemo(()=>{if(!r)return{};function e(e){b.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){c||0===u||(clearTimeout(R.current),R.current=setTimeout(()=>{S.current||s(!0)},u))}},floating:{onMouseEnter(){clearTimeout(x.current)},onMouseLeave(){d.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),C(!1)}}}},[d,r,u,c,s,C])};function tE(e,t){if(!e||!t)return!1;let n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&function(e){if("u"{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})||[],r=n;for(;r.length;)r=e.filter(e=>{var t;return null==(t=r)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})})||[],n=n.concat(r);return n}let tS=t["useInsertionEffect".toString()]||(e=>e());function tT(e){let n=t.useRef(()=>{});return tS(()=>{n.current=e}),t.useCallback(function(){for(var e=arguments.length,t=Array(e),r=0;r!1),E="function"==typeof p?x:p,R=t.useRef(!1),{escapeKeyBubbles:S,outsidePressBubbles:T}=tP(y);return t.useEffect(()=>{if(!r||!f)return;function e(e){if("Escape"===e.key){let e=w?tR(w.nodesRef.current,l):[];if(e.length>0){let t=!0;if(e.forEach(e=>{var n;if(null!=(n=e.context)&&n.open&&!e.context.dataRef.current.__escapeKeyBubbles){t=!1;return}}),!t)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)}}function t(e){var t;let n=R.current;if(R.current=!1,n||"function"==typeof E&&!E(e))return;let r="composedPath"in e?e.composedPath()[0]:e.target;if(tg(r)&&c){let t=c.ownerDocument.defaultView||window,n=r.scrollWidth>r.clientWidth,o=r.scrollHeight>r.clientHeight,i=o&&e.offsetX>r.clientWidth;if(o&&"rtl"===t.getComputedStyle(r).direction&&(i=e.offsetX<=r.offsetWidth-r.clientWidth),i||n&&e.offsetY>r.clientHeight)return}let u=w&&tR(w.nodesRef.current,l).some(t=>{var n;return tL(e,null==(n=t.context)?void 0:n.elements.floating)});if(tL(e,c)||tL(e,a)||u)return;let s=w?tR(w.nodesRef.current,l):[];if(s.length>0){let e=!0;if(s.forEach(t=>{var n;if(null!=(n=t.context)&&n.open&&!t.context.dataRef.current.__outsidePressBubbles){e=!1;return}}),!e)return}i.emit("dismiss",{type:"outsidePress",data:{returnFocus:b?{preventScroll:!0}:function(e){let t,n;if(0===e.mozInputSource&&e.isTrusted)return!0;let r=/Android/i;return(r.test(null!=(n=navigator.userAgentData)&&n.platform?n.platform:navigator.platform)||r.test((t=navigator.userAgentData)&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:t,version:n}=e;return t+"/"+n}).join(" "):navigator.userAgent))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}(e)||0===(t=e).width&&0===t.height||1===t.width&&1===t.height&&0===t.pressure&&0===t.detail&&"mouse"!==t.pointerType||t.width<1&&t.height<1&&0===t.pressure&&0===t.detail}}),o(!1)}function n(){o(!1)}s.current.__escapeKeyBubbles=S,s.current.__outsidePressBubbles=T;let p=tp(c);d&&p.addEventListener("keydown",e),E&&p.addEventListener(m,t);let h=[];return v&&(th(a)&&(h=ee(a)),th(c)&&(h=h.concat(ee(c))),!th(u)&&u&&u.contextElement&&(h=h.concat(ee(u.contextElement)))),(h=h.filter(e=>{var t;return e!==(null==(t=p.defaultView)?void 0:t.visualViewport)})).forEach(e=>{e.addEventListener("scroll",n,{passive:!0})}),()=>{d&&p.removeEventListener("keydown",e),E&&p.removeEventListener(m,t),h.forEach(e=>{e.removeEventListener("scroll",n)})}},[s,c,a,u,d,E,m,i,w,l,r,o,v,f,S,T,b]),t.useEffect(()=>{R.current=!1},[E,m]),t.useMemo(()=>f?{reference:{[tA[g]]:()=>{h&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{[tC[m]]:()=>{R.current=!0}}}:{},[f,i,h,m,g,o])},tk=function(e,n){let{open:r,onOpenChange:o,dataRef:i,events:l,refs:u,elements:{floating:a,domReference:c}}=e,{enabled:s=!0,keyboardOnly:f=!0}=void 0===n?{}:n,d=t.useRef(""),p=t.useRef(!1),m=t.useRef();return t.useEffect(()=>{if(!s)return;let e=tp(a).defaultView||window;function t(){!r&&tg(c)&&c===function(e){let t=e.activeElement;for(;(null==(n=t)||null==(r=n.shadowRoot)?void 0:r.activeElement)!=null;){var n,r;t=t.shadowRoot.activeElement}return t}(tp(c))&&(p.current=!0)}return e.addEventListener("blur",t),()=>{e.removeEventListener("blur",t)}},[a,c,r,s]),t.useEffect(()=>{if(s)return l.on("dismiss",e),()=>{l.off("dismiss",e)};function e(e){("referencePress"===e.type||"escapeKey"===e.type)&&(p.current=!0)}},[l,s]),t.useEffect(()=>()=>{clearTimeout(m.current)},[]),t.useMemo(()=>s?{reference:{onPointerDown(e){let{pointerType:t}=e;d.current=t,p.current=!!(t&&f)},onMouseLeave(){p.current=!1},onFocus(e){var t;p.current||"focus"===e.type&&(null==(t=i.current.openEvent)?void 0:t.type)==="mousedown"&&i.current.openEvent&&tL(i.current.openEvent,c)||(i.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){p.current=!1;let t=e.relatedTarget,n=th(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");m.current=setTimeout(()=>{tE(u.floating.current,t)||tE(c,t)||n||o(!1)})}}}:{},[s,f,c,u,i,o])},tD=function(e,n){let{open:r}=e,{enabled:o=!0,role:i="dialog"}=void 0===n?{}:n,l=tc(),u=tc();return t.useMemo(()=>{let e={id:l,role:i};return o?"tooltip"===i?{reference:{"aria-describedby":r?l:void 0},floating:e}:{reference:{"aria-expanded":r?"true":"false","aria-haspopup":"alertdialog"===i?"dialog":i,"aria-controls":r?l:void 0,..."listbox"===i&&{role:"combobox"},..."menu"===i&&{id:u}},floating:{...e,..."menu"===i&&{"aria-labelledby":u}}}:{}},[o,i,r,l,u])};function tM(e,t,n){let r=new Map;return{..."floating"===n&&{tabIndex:-1},...e,...t.map(e=>e?e[n]:null).concat(e).reduce((e,t)=>(t&&Object.entries(t).forEach(t=>{let[n,o]=t;if(0===n.indexOf("on")){if(r.has(n)||r.set(n,[]),"function"==typeof o){var i;null==(i=r.get(n))||i.push(o),e[n]=function(){for(var e,t=arguments.length,o=Array(t),i=0;ie(...o))}}}else e[n]=o}),e),{})}}let tN=function(e){void 0===e&&(e=[]);let n=e,r=t.useCallback(t=>tM(t,e,"reference"),n),o=t.useCallback(t=>tM(t,e,"floating"),n),i=t.useCallback(t=>tM(t,e,"item"),e.map(e=>null==e?void 0:e.item));return t.useMemo(()=>({getReferenceProps:r,getFloatingProps:o,getItemProps:i}),[r,o,i])};var tF=e.i(444755);let tI=e=>{let[n,r]=(0,t.useState)(!1),[o,i]=(0,t.useState)(),{x:l,y:u,refs:a,strategy:c,context:s}=function(e){void 0===e&&(e={});let{open:n=!1,onOpenChange:r,nodeId:o}=e,i=function(e){void 0===e&&(e={});let{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,whileElementsMounted:l,open:u}=e,[a,c]=t.useState({x:null,y:null,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[s,f]=t.useState(o);tr(s,o)||f(o);let d=t.useRef(null),p=t.useRef(null),m=t.useRef(a),h=to(l),g=to(i),[v,y]=t.useState(null),[w,b]=t.useState(null),x=t.useCallback(e=>{d.current!==e&&(d.current=e,y(e))},[]),E=t.useCallback(e=>{p.current!==e&&(p.current=e,b(e))},[]),R=t.useCallback(()=>{if(!d.current||!p.current)return;let e={placement:n,strategy:r,middleware:s};g.current&&(e.platform=g.current),tt(d.current,p.current,e).then(e=>{let t={...e,isPositioned:!0};S.current&&!tr(m.current,t)&&(m.current=t,C.flushSync(()=>{c(t)}))})},[s,n,r,g]);tn(()=>{!1===u&&m.current.isPositioned&&(m.current.isPositioned=!1,c(e=>({...e,isPositioned:!1})))},[u]);let S=t.useRef(!1);tn(()=>(S.current=!0,()=>{S.current=!1}),[]),tn(()=>{if(v&&w)if(h.current)return h.current(v,w,R);else R()},[v,w,R,h]);let T=t.useMemo(()=>({reference:d,floating:p,setReference:x,setFloating:E}),[x,E]),L=t.useMemo(()=>({reference:v,floating:w}),[v,w]);return t.useMemo(()=>({...a,update:R,refs:T,elements:L,reference:x,floating:E}),[a,R,T,L,x,E])}(e),l=t.useContext(tf),u=t.useRef(null),a=t.useRef({}),c=t.useState(()=>{let e;return e=new Map,{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(e=>e!==n))}}})[0],[s,f]=t.useState(null),d=t.useCallback(e=>{let t=th(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;i.refs.setReference(t)},[i.refs]),p=t.useCallback(e=>{(th(e)||null===e)&&(u.current=e,f(e)),(th(i.refs.reference.current)||null===i.refs.reference.current||null!==e&&!th(e))&&i.refs.setReference(e)},[i.refs]),m=t.useMemo(()=>({...i.refs,setReference:p,setPositionReference:d,domReference:u}),[i.refs,p,d]),h=t.useMemo(()=>({...i.elements,domReference:s}),[i.elements,s]),g=tT(r),v=t.useMemo(()=>({...i,refs:m,elements:h,dataRef:a,nodeId:o,events:c,open:n,onOpenChange:g}),[i,o,c,n,g,m,h]);return ti(()=>{let e=null==l?void 0:l.nodesRef.current.find(e=>e.id===o);e&&(e.context=v)}),t.useMemo(()=>({...i,context:v,refs:m,reference:p,positionReference:d}),[i,m,v,p,d])}({open:n,onOpenChange:t=>{t&&e?i(setTimeout(()=>{r(t)},e)):(clearTimeout(o),r(t))},placement:"top",whileElementsMounted:e1,middleware:[e2(5),e7({fallbackAxisSideDirection:"start"}),e5()]}),{getReferenceProps:f,getFloatingProps:d}=tN([tx(s,{move:!1}),tk(s),tO(s),tD(s,{role:"tooltip"})]);return{tooltipProps:{open:n,x:l,y:u,refs:a,strategy:c,getFloatingProps:d},getReferenceProps:f}},tB=({text:e,open:n,x:r,y:o,refs:i,strategy:l,getFloatingProps:u})=>n&&e?t.default.createElement("div",Object.assign({className:(0,tF.tremorTwMerge)("max-w-xs text-sm z-20 rounded-tremor-default opacity-100 px-2.5 py-1","text-white bg-tremor-background-emphasis","dark:text-tremor-content-emphasis dark:bg-white"),ref:i.setFloating,style:{position:l,top:null!=o?o:0,left:null!=r?r:0}},u()),e):null;tB.displayName="Tooltip",e.s(["default",()=>tB,"useTooltip",()=>tI],829087)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/01d33dac4f6576c1.js b/litellm/proxy/_experimental/out/_next/static/chunks/01d33dac4f6576c1.js new file mode 100644 index 00000000000..f10ce27c201 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/01d33dac4f6576c1.js @@ -0,0 +1,8 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,519756,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"};var l=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(l.default,(0,t.default)({},e,{ref:o,icon:a}))});e.s(["UploadOutlined",0,o],519756)},530212,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});e.s(["ArrowLeftIcon",0,r],530212)},678784,678745,e=>{"use strict";let t=(0,e.i(475254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",()=>t],678745),e.s(["CheckIcon",()=>t],678784)},500330,e=>{"use strict";var t=e.i(727749);function r(e,t){let r=structuredClone(e);for(let[e,a]of Object.entries(t))e in r&&(r[e]=a);return r}let a=(e,t=0,r=!1,a=!0)=>{if(null==e||!Number.isFinite(e)||0===e&&!a)return"-";let l={minimumFractionDigits:t,maximumFractionDigits:t};if(!r)return e.toLocaleString("en-US",l);let o=e<0?"-":"",i=Math.abs(e),n=i,s="";return i>=1e6?(n=i/1e6,s="M"):i>=1e3&&(n=i/1e3,s="K"),`${o}${n.toLocaleString("en-US",l)}${s}`},l=async(e,r="Copied to clipboard")=>{if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return o(e,r);try{return await navigator.clipboard.writeText(e),t.default.success(r),!0}catch(t){return console.error("Clipboard API failed: ",t),o(e,r)}},o=(e,r)=>{try{let a=document.createElement("textarea");a.value=e,a.style.position="fixed",a.style.left="-999999px",a.style.top="-999999px",a.setAttribute("readonly",""),document.body.appendChild(a),a.focus(),a.select();let l=document.execCommand("copy");if(document.body.removeChild(a),l)return t.default.success(r),!0;throw Error("execCommand failed")}catch(e){return t.default.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}};e.s(["copyToClipboard",0,l,"formatNumberWithCommas",0,a,"getSpendString",0,(e,t=6)=>{if(null==e||!Number.isFinite(e)||0===e)return"-";let r=a(e,t,!1,!1);if(0===Number(r.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return`< $${e}`}return`$${r}`},"updateExistingKeys",()=>r])},118366,e=>{"use strict";var t=e.i(991124);e.s(["CopyIcon",()=>t.default])},981339,e=>{"use strict";var t=e.i(185793);e.s(["Skeleton",()=>t.default])},603908,e=>{"use strict";let t=(0,e.i(475254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["default",()=>t])},689020,e=>{"use strict";var t=e.i(764205);let r=async e=>{try{let r=await (0,t.modelHubCall)(e);if(console.log("model_info:",r),r?.data.length>0){let e=r.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,r])},983561,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"};var l=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(l.default,(0,t.default)({},e,{ref:o,icon:a}))});e.s(["RobotOutlined",0,o],983561)},992619,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(779241),l=e.i(599724),o=e.i(199133),i=e.i(983561),n=e.i(689020);e.s(["default",0,({accessToken:e,value:s,placeholder:d="Select a Model",onChange:c,disabled:m=!1,style:u,className:g,showLabel:f=!0,labelText:h="Select Model"})=>{let[b,p]=(0,r.useState)(s),[C,x]=(0,r.useState)(!1),[v,k]=(0,r.useState)([]),w=(0,r.useRef)(null);return(0,r.useEffect)(()=>{p(s)},[s]),(0,r.useEffect)(()=>{e&&(async()=>{try{let t=await (0,n.fetchAvailableModels)(e);console.log("Fetched models for selector:",t),t.length>0&&k(t)}catch(e){console.error("Error fetching model info:",e)}})()},[e]),(0,t.jsxs)("div",{children:[f&&(0,t.jsxs)(l.Text,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,t.jsx)(i.RobotOutlined,{className:"mr-2"})," ",h]}),(0,t.jsx)(o.Select,{value:b,placeholder:d,onChange:e=>{"custom"===e?(x(!0),p(void 0)):(x(!1),p(e),c&&c(e))},options:[...Array.from(new Set(v.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...u},showSearch:!0,className:`rounded-md ${g||""}`,disabled:m}),C&&(0,t.jsx)(a.TextInput,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{p(e),c&&c(e)},500)},disabled:m})]})}])},653496,e=>{"use strict";var t=e.i(721369);e.s(["Tabs",()=>t.default])},629569,e=>{"use strict";var t=e.i(290571),r=e.i(95779),a=e.i(444755),l=e.i(673706),o=e.i(271645);let i=o.default.forwardRef((e,i)=>{let{color:n,children:s,className:d}=e,c=(0,t.__rest)(e,["color","children","className"]);return o.default.createElement("p",Object.assign({ref:i,className:(0,a.tremorTwMerge)("font-medium text-tremor-title",n?(0,l.getColorClassNames)(n,r.colorPalette.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",d)},c),s)});i.displayName="Title",e.s(["Title",()=>i],629569)},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),a=e.i(673706),l=e.i(271645);let o=l.default.forwardRef((e,o)=>{let{color:i,className:n,children:s}=e;return l.default.createElement("p",{ref:o,className:(0,r.tremorTwMerge)("text-tremor-default",i?(0,a.getColorClassNames)(i,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),n)},s)});o.displayName="Text",e.s(["default",()=>o],936325),e.s(["Text",()=>o],599724)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),a=e.i(271645);let l=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],o=e=>({_s:e,status:l[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),i=e=>e?6:5,n=(e,t,r,a,l)=>{clearTimeout(a.current);let i=o(e);t(i),r.current=i,l&&l({current:i})};var s=e.i(480731),d=e.i(444755),c=e.i(673706);let m=e=>{var r=(0,t.__rest)(e,[]);return a.default.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),a.default.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),a.default.createElement("path",{d:"M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z"}))};var u=e.i(95779);let g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},f=(e,t)=>{switch(e){case"primary":return{textColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,c.getColorClassNames)(t,u.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,hoverBgColor:t?(0,d.tremorTwMerge)((0,c.getColorClassNames)(t,u.colorPalette.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},h=(0,c.makeClassName)("Button"),b=({loading:e,iconSize:t,iconPosition:r,Icon:l,needMargin:o,transitionStatus:i})=>{let n=o?r===s.HorizontalPositions.Left?(0,d.tremorTwMerge)("-ml-1","mr-1.5"):(0,d.tremorTwMerge)("-mr-1","ml-1.5"):"",c=(0,d.tremorTwMerge)("w-0 h-0"),u={default:c,entering:c,entered:t,exiting:t,exited:c};return e?a.default.createElement(m,{className:(0,d.tremorTwMerge)(h("icon"),"animate-spin shrink-0",n,u.default,u[i]),style:{transition:"width 150ms"}}):a.default.createElement(l,{className:(0,d.tremorTwMerge)(h("icon"),"shrink-0",t,n)})},p=a.default.forwardRef((e,l)=>{let{icon:m,iconPosition:u=s.HorizontalPositions.Left,size:p=s.Sizes.SM,color:C,variant:x="primary",disabled:v,loading:k=!1,loadingText:w,children:$,tooltip:N,className:y}=e,T=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),j=k||v,E=void 0!==m||k,O=k&&w,M=!(!$&&!O),z=(0,d.tremorTwMerge)(g[p].height,g[p].width),S="light"!==x?(0,d.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",R=f(x,C),B=("light"!==x?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}})[p],{tooltipProps:P,getReferenceProps:H}=(0,r.useTooltip)(300),[q,_]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:l,timeout:s,initialEntered:d,mountOnEnter:c,unmountOnExit:m,onStateChange:u}={})=>{let[g,f]=(0,a.useState)(()=>o(d?2:i(c))),h=(0,a.useRef)(g),b=(0,a.useRef)(0),[p,C]="object"==typeof s?[s.enter,s.exit]:[s,s],x=(0,a.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return i(t)}})(h.current._s,m);e&&n(e,f,h,b,u)},[u,m]);return[g,(0,a.useCallback)(a=>{let o=e=>{switch(n(e,f,h,b,u),e){case 1:p>=0&&(b.current=((...e)=>setTimeout(...e))(x,p));break;case 4:C>=0&&(b.current=((...e)=>setTimeout(...e))(x,C));break;case 0:case 3:b.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||o(e+1)},0)}},s=h.current.isEnter;"boolean"!=typeof a&&(a=!s),a?s||o(e?+!r:2):s&&o(t?l?3:4:i(m))},[x,u,e,t,r,l,p,C,m]),x]})({timeout:50});return(0,a.useEffect)(()=>{_(k)},[k]),a.default.createElement("button",Object.assign({ref:(0,c.mergeRefs)([l,P.refs.setReference]),className:(0,d.tremorTwMerge)(h("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",S,B.paddingX,B.paddingY,B.fontSize,R.textColor,R.bgColor,R.borderColor,R.hoverBorderColor,j?"opacity-50 cursor-not-allowed":(0,d.tremorTwMerge)(f(x,C).hoverTextColor,f(x,C).hoverBgColor,f(x,C).hoverBorderColor),y),disabled:j},H,T),a.default.createElement(r.default,Object.assign({text:N},P)),E&&u!==s.HorizontalPositions.Right?a.default.createElement(b,{loading:k,iconSize:z,iconPosition:u,Icon:m,transitionStatus:q.status,needMargin:M}):null,O||$?a.default.createElement("span",{className:(0,d.tremorTwMerge)(h("text"),"text-tremor-default whitespace-nowrap")},O?w:$):null,E&&u===s.HorizontalPositions.Right?a.default.createElement(b,{loading:k,iconSize:z,iconPosition:u,Icon:m,transitionStatus:q.status,needMargin:M}):null)});p.displayName="Button",e.s(["Button",()=>p],994388)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(480731),l=e.i(95779),o=e.i(444755),i=e.i(673706);let n=(0,i.makeClassName)("Card"),s=r.default.forwardRef((e,s)=>{let{decoration:d="",decorationColor:c,children:m,className:u}=e,g=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:s,className:(0,o.tremorTwMerge)(n("root"),"relative w-full text-left ring-1 rounded-tremor-default p-6","bg-tremor-background ring-tremor-ring shadow-tremor-card","dark:bg-dark-tremor-background dark:ring-dark-tremor-ring dark:shadow-dark-tremor-card",c?(0,i.getColorClassNames)(c,l.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case a.HorizontalPositions.Left:return"border-l-4";case a.VerticalPositions.Top:return"border-t-4";case a.HorizontalPositions.Right:return"border-r-4";case a.VerticalPositions.Bottom:return"border-b-4";default:return""}})(d),u)},g),m)});s.displayName="Card",e.s(["Card",()=>s],304967)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(242064),l=e.i(529681);let o=e=>{let{prefixCls:a,className:l,style:o,size:i,shape:n}=e,s=(0,r.default)({[`${a}-lg`]:"large"===i,[`${a}-sm`]:"small"===i}),d=(0,r.default)({[`${a}-circle`]:"circle"===n,[`${a}-square`]:"square"===n,[`${a}-round`]:"round"===n}),c=t.useMemo(()=>"number"==typeof i?{width:i,height:i,lineHeight:`${i}px`}:{},[i]);return t.createElement("span",{className:(0,r.default)(a,s,d,l),style:Object.assign(Object.assign({},c),o)})};e.i(296059);var i=e.i(694758),n=e.i(915654),s=e.i(246422),d=e.i(838378);let c=new i.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),m=e=>({height:e,lineHeight:(0,n.unit)(e)}),u=e=>Object.assign({width:e},m(e)),g=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},m(e)),f=e=>Object.assign({width:e},m(e)),h=(e,t,r)=>{let{skeletonButtonCls:a}=e;return{[`${r}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${r}${a}-round`]:{borderRadius:t}}},b=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},m(e)),p=(0,s.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:r}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:r,skeletonTitleCls:a,skeletonParagraphCls:l,skeletonButtonCls:o,skeletonInputCls:i,skeletonImageCls:n,controlHeight:s,controlHeightLG:d,controlHeightSM:m,gradientFromColor:p,padding:C,marginSM:x,borderRadius:v,titleHeight:k,blockRadius:w,paragraphLiHeight:$,controlHeightXS:N,paragraphMarginTop:y}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:C,verticalAlign:"top",[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:p},u(s)),[`${r}-circle`]:{borderRadius:"50%"},[`${r}-lg`]:Object.assign({},u(d)),[`${r}-sm`]:Object.assign({},u(m))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:k,background:p,borderRadius:w,[`+ ${l}`]:{marginBlockStart:m}},[l]:{padding:0,"> li":{width:"100%",height:$,listStyle:"none",background:p,borderRadius:w,"+ li":{marginBlockStart:N}}},[`${l}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${l} > li`]:{borderRadius:v}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:x,[`+ ${l}`]:{marginBlockStart:y}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:r,controlHeight:a,controlHeightLG:l,controlHeightSM:o,gradientFromColor:i,calc:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:i,borderRadius:t,width:n(a).mul(2).equal(),minWidth:n(a).mul(2).equal()},b(a,n))},h(e,a,r)),{[`${r}-lg`]:Object.assign({},b(l,n))}),h(e,l,`${r}-lg`)),{[`${r}-sm`]:Object.assign({},b(o,n))}),h(e,o,`${r}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:r,controlHeight:a,controlHeightLG:l,controlHeightSM:o}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:r},u(a)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},u(l)),[`${t}${t}-sm`]:Object.assign({},u(o))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:r,skeletonInputCls:a,controlHeightLG:l,controlHeightSM:o,gradientFromColor:i,calc:n}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:i,borderRadius:r},g(t,n)),[`${a}-lg`]:Object.assign({},g(l,n)),[`${a}-sm`]:Object.assign({},g(o,n))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:r,gradientFromColor:a,borderRadiusSM:l,calc:o}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:l},f(o(r).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},f(r)),{maxWidth:o(r).mul(4).equal(),maxHeight:o(r).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[o]:{width:"100%"},[i]:{width:"100%"}},[`${t}${t}-active`]:{[` + ${a}, + ${l} > li, + ${r}, + ${o}, + ${i}, + ${n} + `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:c,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,d.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:r(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:r}=e;return{color:t,colorGradientEnd:r,gradientFromColor:t,gradientToColor:r,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),C=e=>{let{prefixCls:a,className:l,style:o,rows:i=0}=e,n=Array.from({length:i}).map((r,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:r,rows:a=2}=t;return Array.isArray(r)?r[e]:a-1===e?r:void 0})(a,e)}}));return t.createElement("ul",{className:(0,r.default)(a,l),style:o},n)},x=({prefixCls:e,className:a,width:l,style:o})=>t.createElement("h3",{className:(0,r.default)(e,a),style:Object.assign({width:l},o)});function v(e){return e&&"object"==typeof e?e:{}}let k=e=>{let{prefixCls:l,loading:i,className:n,rootClassName:s,style:d,children:c,avatar:m=!1,title:u=!0,paragraph:g=!0,active:f,round:h}=e,{getPrefixCls:b,direction:k,className:w,style:$}=(0,a.useComponentConfig)("skeleton"),N=b("skeleton",l),[y,T,j]=p(N);if(i||!("loading"in e)){let e,a,l=!!m,i=!!u,c=!!g;if(l){let r=Object.assign(Object.assign({prefixCls:`${N}-avatar`},i&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),v(m));e=t.createElement("div",{className:`${N}-header`},t.createElement(o,Object.assign({},r)))}if(i||c){let e,r;if(i){let r=Object.assign(Object.assign({prefixCls:`${N}-title`},!l&&c?{width:"38%"}:l&&c?{width:"50%"}:{}),v(u));e=t.createElement(x,Object.assign({},r))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${N}-paragraph`},(e={},l&&i||(e.width="61%"),!l&&i?e.rows=3:e.rows=2,e)),v(g));r=t.createElement(C,Object.assign({},a))}a=t.createElement("div",{className:`${N}-content`},e,r)}let b=(0,r.default)(N,{[`${N}-with-avatar`]:l,[`${N}-active`]:f,[`${N}-rtl`]:"rtl"===k,[`${N}-round`]:h},w,n,s,T,j);return y(t.createElement("div",{className:b,style:Object.assign(Object.assign({},$),d)},e,a))}return null!=c?c:null};k.Button=e=>{let{prefixCls:i,className:n,rootClassName:s,active:d,block:c=!1,size:m="default"}=e,{getPrefixCls:u}=t.useContext(a.ConfigContext),g=u("skeleton",i),[f,h,b]=p(g),C=(0,l.default)(e,["prefixCls"]),x=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},n,s,h,b);return f(t.createElement("div",{className:x},t.createElement(o,Object.assign({prefixCls:`${g}-button`,size:m},C))))},k.Avatar=e=>{let{prefixCls:i,className:n,rootClassName:s,active:d,shape:c="circle",size:m="default"}=e,{getPrefixCls:u}=t.useContext(a.ConfigContext),g=u("skeleton",i),[f,h,b]=p(g),C=(0,l.default)(e,["prefixCls","className"]),x=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d},n,s,h,b);return f(t.createElement("div",{className:x},t.createElement(o,Object.assign({prefixCls:`${g}-avatar`,shape:c,size:m},C))))},k.Input=e=>{let{prefixCls:i,className:n,rootClassName:s,active:d,block:c,size:m="default"}=e,{getPrefixCls:u}=t.useContext(a.ConfigContext),g=u("skeleton",i),[f,h,b]=p(g),C=(0,l.default)(e,["prefixCls"]),x=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},n,s,h,b);return f(t.createElement("div",{className:x},t.createElement(o,Object.assign({prefixCls:`${g}-input`,size:m},C))))},k.Image=e=>{let{prefixCls:l,className:o,rootClassName:i,style:n,active:s}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",l),[m,u,g]=p(c),f=(0,r.default)(c,`${c}-element`,{[`${c}-active`]:s},o,i,u,g);return m(t.createElement("div",{className:f},t.createElement("div",{className:(0,r.default)(`${c}-image`,o),style:n},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},k.Node=e=>{let{prefixCls:l,className:o,rootClassName:i,style:n,active:s,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),m=c("skeleton",l),[u,g,f]=p(m),h=(0,r.default)(m,`${m}-element`,{[`${m}-active`]:s},g,o,i,f);return u(t.createElement("div",{className:h},t.createElement("div",{className:(0,r.default)(`${m}-image`,o),style:n},d)))},e.s(["default",0,k],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var l=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(l.default,(0,t.default)({},e,{ref:o,icon:a}))});e.s(["default",0,o],959013)},269200,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("Table"),o=r.default.forwardRef((e,o)=>{let{children:i,className:n}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement("div",{className:(0,a.tremorTwMerge)(l("root"),"overflow-auto",n)},r.default.createElement("table",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},s),i))});o.displayName="Table",e.s(["Table",()=>o],269200)},942232,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableBody"),o=r.default.forwardRef((e,o)=>{let{children:i,className:n}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tbody",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",n)},s),i))});o.displayName="TableBody",e.s(["TableBody",()=>o],942232)},977572,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableCell"),o=r.default.forwardRef((e,o)=>{let{children:i,className:n}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("td",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"align-middle whitespace-nowrap text-left p-4",n)},s),i))});o.displayName="TableCell",e.s(["TableCell",()=>o],977572)},427612,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHead"),o=r.default.forwardRef((e,o)=>{let{children:i,className:n}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("thead",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",n)},s),i))});o.displayName="TableHead",e.s(["TableHead",()=>o],427612)},64848,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHeaderCell"),o=r.default.forwardRef((e,o)=>{let{children:i,className:n}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("th",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",n)},s),i))});o.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>o],64848)},496020,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableRow"),o=r.default.forwardRef((e,o)=>{let{children:i,className:n}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tr",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("row"),n)},s),i))});o.displayName="TableRow",e.s(["TableRow",()=>o],496020)},991124,e=>{"use strict";let t=(0,e.i(475254).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["default",()=>t])},797672,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"}))});e.s(["PencilIcon",0,r],797672)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/04b9c7b5c33ea26c.js b/litellm/proxy/_experimental/out/_next/static/chunks/04b9c7b5c33ea26c.js new file mode 100644 index 00000000000..7810bf6334d --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/04b9c7b5c33ea26c.js @@ -0,0 +1,14 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,91874,e=>{"use strict";var t=e.i(931067),r=e.i(209428),a=e.i(211577),l=e.i(392221),o=e.i(703923),n=e.i(343794),i=e.i(914949),s=e.i(271645),d=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],c=(0,s.forwardRef)(function(e,c){var u=e.prefixCls,m=void 0===u?"rc-checkbox":u,g=e.className,b=e.style,f=e.checked,p=e.disabled,h=e.defaultChecked,C=e.type,v=void 0===C?"checkbox":C,k=e.title,x=e.onChange,$=(0,o.default)(e,d),w=(0,s.useRef)(null),y=(0,s.useRef)(null),N=(0,i.default)(void 0!==h&&h,{value:f}),O=(0,l.default)(N,2),E=O[0],j=O[1];(0,s.useImperativeHandle)(c,function(){return{focus:function(e){var t;null==(t=w.current)||t.focus(e)},blur:function(){var e;null==(e=w.current)||e.blur()},input:w.current,nativeElement:y.current}});var T=(0,n.default)(m,g,(0,a.default)((0,a.default)({},"".concat(m,"-checked"),E),"".concat(m,"-disabled"),p));return s.createElement("span",{className:T,title:k,style:b,ref:y},s.createElement("input",(0,t.default)({},$,{className:"".concat(m,"-input"),ref:w,onChange:function(t){p||("checked"in e||j(t.target.checked),null==x||x({target:(0,r.default)((0,r.default)({},e),{},{type:v,checked:t.target.checked}),stopPropagation:function(){t.stopPropagation()},preventDefault:function(){t.preventDefault()},nativeEvent:t.nativeEvent}))},disabled:p,checked:!!E,type:v})),s.createElement("span",{className:"".concat(m,"-inner")}))});e.s(["default",0,c])},421512,236836,e=>{"use strict";let t=e.i(271645).default.createContext(null);e.s(["default",0,t],421512),e.i(296059);var r=e.i(915654),a=e.i(183293),l=e.i(246422),o=e.i(838378);function n(e,t){return(e=>{let{checkboxCls:t}=e,l=`${t}-wrapper`;return[{[`${t}-group`]:Object.assign(Object.assign({},(0,a.resetComponent)(e)),{display:"inline-flex",flexWrap:"wrap",columnGap:e.marginXS,[`> ${e.antCls}-row`]:{flex:1}}),[l]:Object.assign(Object.assign({},(0,a.resetComponent)(e)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},[`& + ${l}`]:{marginInlineStart:0},[`&${l}-in-form-item`]:{'input[type="checkbox"]':{width:14,height:14}}}),[t]:Object.assign(Object.assign({},(0,a.resetComponent)(e)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:e.borderRadiusSM,alignSelf:"center",[`${t}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,[`&:focus-visible + ${t}-inner`]:(0,a.genFocusOutline)(e)},[`${t}-inner`]:{boxSizing:"border-box",display:"block",width:e.checkboxSize,height:e.checkboxSize,direction:"ltr",backgroundColor:e.colorBgContainer,border:`${(0,r.unit)(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,borderCollapse:"separate",transition:`all ${e.motionDurationSlow}`,"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:e.calc(e.checkboxSize).div(14).mul(5).equal(),height:e.calc(e.checkboxSize).div(14).mul(8).equal(),border:`${(0,r.unit)(e.lineWidthBold)} solid ${e.colorWhite}`,borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:`all ${e.motionDurationFast} ${e.motionEaseInBack}, opacity ${e.motionDurationFast}`}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{[` + ${l}:not(${l}-disabled), + ${t}:not(${t}-disabled) + `]:{[`&:hover ${t}-inner`]:{borderColor:e.colorPrimary}},[`${l}:not(${l}-disabled)`]:{[`&:hover ${t}-checked:not(${t}-disabled) ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},[`&:hover ${t}-checked:not(${t}-disabled):after`]:{borderColor:e.colorPrimaryHover}}},{[`${t}-checked`]:{[`${t}-inner`]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack} ${e.motionDurationFast}`}}},[` + ${l}-checked:not(${l}-disabled), + ${t}-checked:not(${t}-disabled) + `]:{[`&:hover ${t}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[t]:{"&-indeterminate":{"&":{[`${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorBorder}`,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}},[`&:hover ${t}-inner`]:{backgroundColor:`${e.colorBgContainer}`,borderColor:`${e.colorPrimary}`}}}}},{[`${l}-disabled`]:{cursor:"not-allowed"},[`${t}-disabled`]:{[`&, ${t}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${t}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${t}-indeterminate ${t}-inner::after`]:{background:e.colorTextDisabled}}}]})((0,o.mergeToken)(t,{checkboxCls:`.${e}`,checkboxSize:t.controlInteractiveSize}))}let i=(0,l.genStyleHooks)("Checkbox",(e,{prefixCls:t})=>[n(t,e)]);e.s(["default",0,i,"getStyle",()=>n],236836)},681216,e=>{"use strict";var t=e.i(271645),r=e.i(963188);function a(e){let a=t.default.useRef(null),l=()=>{r.default.cancel(a.current),a.current=null};return[()=>{l(),a.current=(0,r.default)(()=>{a.current=null})},t=>{a.current&&(t.stopPropagation(),l()),null==e||e(t)}]}e.s(["default",()=>a])},374276,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(91874),l=e.i(611935),o=e.i(121872),n=e.i(26905),i=e.i(242064),s=e.i(937328),d=e.i(321883),c=e.i(62139),u=e.i(421512),m=e.i(236836),g=e.i(681216),b=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let f=t.forwardRef((e,f)=>{var p;let{prefixCls:h,className:C,rootClassName:v,children:k,indeterminate:x=!1,style:$,onMouseEnter:w,onMouseLeave:y,skipGroup:N=!1,disabled:O}=e,E=b(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:j,direction:T,checkbox:S}=t.useContext(i.ConfigContext),R=t.useContext(u.default),{isFormItemInput:M}=t.useContext(c.FormItemInputContext),z=t.useContext(s.default),P=null!=(p=(null==R?void 0:R.disabled)||O)?p:z,B=t.useRef(E.value),q=t.useRef(null),H=(0,l.composeRef)(f,q);t.useEffect(()=>{null==R||R.registerValue(E.value)},[]),t.useEffect(()=>{if(!N)return E.value!==B.current&&(null==R||R.cancelValue(B.current),null==R||R.registerValue(E.value),B.current=E.value),()=>null==R?void 0:R.cancelValue(E.value)},[E.value]),t.useEffect(()=>{var e;(null==(e=q.current)?void 0:e.input)&&(q.current.input.indeterminate=x)},[x]);let I=j("checkbox",h),_=(0,d.default)(I),[A,L,X]=(0,m.default)(I,_),F=Object.assign({},E);R&&!N&&(F.onChange=(...e)=>{E.onChange&&E.onChange.apply(E,e),R.toggleOption&&R.toggleOption({label:k,value:E.value})},F.name=R.name,F.checked=R.value.includes(E.value));let D=(0,r.default)(`${I}-wrapper`,{[`${I}-rtl`]:"rtl"===T,[`${I}-wrapper-checked`]:F.checked,[`${I}-wrapper-disabled`]:P,[`${I}-wrapper-in-form-item`]:M},null==S?void 0:S.className,C,v,X,_,L),Y=(0,r.default)({[`${I}-indeterminate`]:x},n.TARGET_CLS,L),[V,W]=(0,g.default)(F.onClick);return A(t.createElement(o.default,{component:"Checkbox",disabled:P},t.createElement("label",{className:D,style:Object.assign(Object.assign({},null==S?void 0:S.style),$),onMouseEnter:w,onMouseLeave:y,onClick:V},t.createElement(a.default,Object.assign({},F,{onClick:W,prefixCls:I,className:Y,disabled:P,ref:H})),null!=k&&t.createElement("span",{className:`${I}-label`},k))))});var p=e.i(8211),h=e.i(529681),C=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var l=0,a=Object.getOwnPropertySymbols(e);lt.indexOf(a[l])&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]]);return r};let v=t.forwardRef((e,a)=>{let{defaultValue:l,children:o,options:n=[],prefixCls:s,className:c,rootClassName:g,style:b,onChange:v}=e,k=C(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:x,direction:$}=t.useContext(i.ConfigContext),[w,y]=t.useState(k.value||l||[]),[N,O]=t.useState([]);t.useEffect(()=>{"value"in k&&y(k.value||[])},[k.value]);let E=t.useMemo(()=>n.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[n]),j=e=>{O(t=>t.filter(t=>t!==e))},T=e=>{O(t=>[].concat((0,p.default)(t),[e]))},S=e=>{let t=w.indexOf(e.value),r=(0,p.default)(w);-1===t?r.push(e.value):r.splice(t,1),"value"in k||y(r),null==v||v(r.filter(e=>N.includes(e)).sort((e,t)=>E.findIndex(t=>t.value===e)-E.findIndex(e=>e.value===t)))},R=x("checkbox",s),M=`${R}-group`,z=(0,d.default)(R),[P,B,q]=(0,m.default)(R,z),H=(0,h.default)(k,["value","disabled"]),I=n.length?E.map(e=>t.createElement(f,{prefixCls:R,key:e.value.toString(),disabled:"disabled"in e?e.disabled:k.disabled,value:e.value,checked:w.includes(e.value),onChange:e.onChange,className:(0,r.default)(`${M}-item`,e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):o,_=t.useMemo(()=>({toggleOption:S,value:w,disabled:k.disabled,name:k.name,registerValue:T,cancelValue:j}),[S,w,k.disabled,k.name,T,j]),A=(0,r.default)(M,{[`${M}-rtl`]:"rtl"===$},c,g,q,z,B);return P(t.createElement("div",Object.assign({className:A,style:b},H,{ref:a}),t.createElement(u.default.Provider,{value:_},I)))});f.Group=v,f.__ANT_CHECKBOX=!0,e.s(["default",0,f],374276)},536916,e=>{"use strict";var t=e.i(374276);e.s(["Checkbox",()=>t.default])},68155,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});e.s(["TrashIcon",0,r],68155)},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),a=e.i(673706),l=e.i(271645);let o=l.default.forwardRef((e,o)=>{let{color:n,className:i,children:s}=e;return l.default.createElement("p",{ref:o,className:(0,r.tremorTwMerge)("text-tremor-default",n?(0,a.getColorClassNames)(n,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),i)},s)});o.displayName="Text",e.s(["default",()=>o],936325),e.s(["Text",()=>o],599724)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),a=e.i(271645);let l=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],o=e=>({_s:e,status:l[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),n=e=>e?6:5,i=(e,t,r,a,l)=>{clearTimeout(a.current);let n=o(e);t(n),r.current=n,l&&l({current:n})};var s=e.i(480731),d=e.i(444755),c=e.i(673706);let u=e=>{var r=(0,t.__rest)(e,[]);return a.default.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),a.default.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),a.default.createElement("path",{d:"M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z"}))};var m=e.i(95779);let g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},b=(e,t)=>{switch(e){case"primary":return{textColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,c.getColorClassNames)(t,m.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?(0,c.getColorClassNames)(t,m.colorPalette.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?(0,c.getColorClassNames)(t,m.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?(0,c.getColorClassNames)(t,m.colorPalette.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?(0,c.getColorClassNames)(t,m.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,m.colorPalette.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,hoverBgColor:t?(0,d.tremorTwMerge)((0,c.getColorClassNames)(t,m.colorPalette.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:t?(0,c.getColorClassNames)(t,m.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?(0,c.getColorClassNames)(t,m.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,m.colorPalette.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},f=(0,c.makeClassName)("Button"),p=({loading:e,iconSize:t,iconPosition:r,Icon:l,needMargin:o,transitionStatus:n})=>{let i=o?r===s.HorizontalPositions.Left?(0,d.tremorTwMerge)("-ml-1","mr-1.5"):(0,d.tremorTwMerge)("-mr-1","ml-1.5"):"",c=(0,d.tremorTwMerge)("w-0 h-0"),m={default:c,entering:c,entered:t,exiting:t,exited:c};return e?a.default.createElement(u,{className:(0,d.tremorTwMerge)(f("icon"),"animate-spin shrink-0",i,m.default,m[n]),style:{transition:"width 150ms"}}):a.default.createElement(l,{className:(0,d.tremorTwMerge)(f("icon"),"shrink-0",t,i)})},h=a.default.forwardRef((e,l)=>{let{icon:u,iconPosition:m=s.HorizontalPositions.Left,size:h=s.Sizes.SM,color:C,variant:v="primary",disabled:k,loading:x=!1,loadingText:$,children:w,tooltip:y,className:N}=e,O=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),E=x||k,j=void 0!==u||x,T=x&&$,S=!(!w&&!T),R=(0,d.tremorTwMerge)(g[h].height,g[h].width),M="light"!==v?(0,d.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",z=b(v,C),P=("light"!==v?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}})[h],{tooltipProps:B,getReferenceProps:q}=(0,r.useTooltip)(300),[H,I]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:l,timeout:s,initialEntered:d,mountOnEnter:c,unmountOnExit:u,onStateChange:m}={})=>{let[g,b]=(0,a.useState)(()=>o(d?2:n(c))),f=(0,a.useRef)(g),p=(0,a.useRef)(0),[h,C]="object"==typeof s?[s.enter,s.exit]:[s,s],v=(0,a.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return n(t)}})(f.current._s,u);e&&i(e,b,f,p,m)},[m,u]);return[g,(0,a.useCallback)(a=>{let o=e=>{switch(i(e,b,f,p,m),e){case 1:h>=0&&(p.current=((...e)=>setTimeout(...e))(v,h));break;case 4:C>=0&&(p.current=((...e)=>setTimeout(...e))(v,C));break;case 0:case 3:p.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||o(e+1)},0)}},s=f.current.isEnter;"boolean"!=typeof a&&(a=!s),a?s||o(e?+!r:2):s&&o(t?l?3:4:n(u))},[v,m,e,t,r,l,h,C,u]),v]})({timeout:50});return(0,a.useEffect)(()=>{I(x)},[x]),a.default.createElement("button",Object.assign({ref:(0,c.mergeRefs)([l,B.refs.setReference]),className:(0,d.tremorTwMerge)(f("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",M,P.paddingX,P.paddingY,P.fontSize,z.textColor,z.bgColor,z.borderColor,z.hoverBorderColor,E?"opacity-50 cursor-not-allowed":(0,d.tremorTwMerge)(b(v,C).hoverTextColor,b(v,C).hoverBgColor,b(v,C).hoverBorderColor),N),disabled:E},q,O),a.default.createElement(r.default,Object.assign({text:y},B)),j&&m!==s.HorizontalPositions.Right?a.default.createElement(p,{loading:x,iconSize:R,iconPosition:m,Icon:u,transitionStatus:H.status,needMargin:S}):null,T||w?a.default.createElement("span",{className:(0,d.tremorTwMerge)(f("text"),"text-tremor-default whitespace-nowrap")},T?$:w):null,j&&m===s.HorizontalPositions.Right?a.default.createElement(p,{loading:x,iconSize:R,iconPosition:m,Icon:u,transitionStatus:H.status,needMargin:S}):null)});h.displayName="Button",e.s(["Button",()=>h],994388)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(480731),l=e.i(95779),o=e.i(444755),n=e.i(673706);let i=(0,n.makeClassName)("Card"),s=r.default.forwardRef((e,s)=>{let{decoration:d="",decorationColor:c,children:u,className:m}=e,g=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:s,className:(0,o.tremorTwMerge)(i("root"),"relative w-full text-left ring-1 rounded-tremor-default p-6","bg-tremor-background ring-tremor-ring shadow-tremor-card","dark:bg-dark-tremor-background dark:ring-dark-tremor-ring dark:shadow-dark-tremor-card",c?(0,n.getColorClassNames)(c,l.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case a.HorizontalPositions.Left:return"border-l-4";case a.VerticalPositions.Top:return"border-t-4";case a.HorizontalPositions.Right:return"border-r-4";case a.VerticalPositions.Bottom:return"border-b-4";default:return""}})(d),m)},g),u)});s.displayName="Card",e.s(["Card",()=>s],304967)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),a=e.i(242064),l=e.i(529681);let o=e=>{let{prefixCls:a,className:l,style:o,size:n,shape:i}=e,s=(0,r.default)({[`${a}-lg`]:"large"===n,[`${a}-sm`]:"small"===n}),d=(0,r.default)({[`${a}-circle`]:"circle"===i,[`${a}-square`]:"square"===i,[`${a}-round`]:"round"===i}),c=t.useMemo(()=>"number"==typeof n?{width:n,height:n,lineHeight:`${n}px`}:{},[n]);return t.createElement("span",{className:(0,r.default)(a,s,d,l),style:Object.assign(Object.assign({},c),o)})};e.i(296059);var n=e.i(694758),i=e.i(915654),s=e.i(246422),d=e.i(838378);let c=new n.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),u=e=>({height:e,lineHeight:(0,i.unit)(e)}),m=e=>Object.assign({width:e},u(e)),g=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},u(e)),b=e=>Object.assign({width:e},u(e)),f=(e,t,r)=>{let{skeletonButtonCls:a}=e;return{[`${r}${a}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${r}${a}-round`]:{borderRadius:t}}},p=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},u(e)),h=(0,s.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:r}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:r,skeletonTitleCls:a,skeletonParagraphCls:l,skeletonButtonCls:o,skeletonInputCls:n,skeletonImageCls:i,controlHeight:s,controlHeightLG:d,controlHeightSM:u,gradientFromColor:h,padding:C,marginSM:v,borderRadius:k,titleHeight:x,blockRadius:$,paragraphLiHeight:w,controlHeightXS:y,paragraphMarginTop:N}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:C,verticalAlign:"top",[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:h},m(s)),[`${r}-circle`]:{borderRadius:"50%"},[`${r}-lg`]:Object.assign({},m(d)),[`${r}-sm`]:Object.assign({},m(u))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[a]:{width:"100%",height:x,background:h,borderRadius:$,[`+ ${l}`]:{marginBlockStart:u}},[l]:{padding:0,"> li":{width:"100%",height:w,listStyle:"none",background:h,borderRadius:$,"+ li":{marginBlockStart:y}}},[`${l}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${a}, ${l} > li`]:{borderRadius:k}}},[`${t}-with-avatar ${t}-content`]:{[a]:{marginBlockStart:v,[`+ ${l}`]:{marginBlockStart:N}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:r,controlHeight:a,controlHeightLG:l,controlHeightSM:o,gradientFromColor:n,calc:i}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:t,width:i(a).mul(2).equal(),minWidth:i(a).mul(2).equal()},p(a,i))},f(e,a,r)),{[`${r}-lg`]:Object.assign({},p(l,i))}),f(e,l,`${r}-lg`)),{[`${r}-sm`]:Object.assign({},p(o,i))}),f(e,o,`${r}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:r,controlHeight:a,controlHeightLG:l,controlHeightSM:o}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:r},m(a)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},m(l)),[`${t}${t}-sm`]:Object.assign({},m(o))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:r,skeletonInputCls:a,controlHeightLG:l,controlHeightSM:o,gradientFromColor:n,calc:i}=e;return{[a]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:r},g(t,i)),[`${a}-lg`]:Object.assign({},g(l,i)),[`${a}-sm`]:Object.assign({},g(o,i))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:r,gradientFromColor:a,borderRadiusSM:l,calc:o}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:a,borderRadius:l},b(o(r).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},b(r)),{maxWidth:o(r).mul(4).equal(),maxHeight:o(r).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[o]:{width:"100%"},[n]:{width:"100%"}},[`${t}${t}-active`]:{[` + ${a}, + ${l} > li, + ${r}, + ${o}, + ${n}, + ${i} + `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:c,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,d.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:r(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:r}=e;return{color:t,colorGradientEnd:r,gradientFromColor:t,gradientToColor:r,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),C=e=>{let{prefixCls:a,className:l,style:o,rows:n=0}=e,i=Array.from({length:n}).map((r,a)=>t.createElement("li",{key:a,style:{width:((e,t)=>{let{width:r,rows:a=2}=t;return Array.isArray(r)?r[e]:a-1===e?r:void 0})(a,e)}}));return t.createElement("ul",{className:(0,r.default)(a,l),style:o},i)},v=({prefixCls:e,className:a,width:l,style:o})=>t.createElement("h3",{className:(0,r.default)(e,a),style:Object.assign({width:l},o)});function k(e){return e&&"object"==typeof e?e:{}}let x=e=>{let{prefixCls:l,loading:n,className:i,rootClassName:s,style:d,children:c,avatar:u=!1,title:m=!0,paragraph:g=!0,active:b,round:f}=e,{getPrefixCls:p,direction:x,className:$,style:w}=(0,a.useComponentConfig)("skeleton"),y=p("skeleton",l),[N,O,E]=h(y);if(n||!("loading"in e)){let e,a,l=!!u,n=!!m,c=!!g;if(l){let r=Object.assign(Object.assign({prefixCls:`${y}-avatar`},n&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),k(u));e=t.createElement("div",{className:`${y}-header`},t.createElement(o,Object.assign({},r)))}if(n||c){let e,r;if(n){let r=Object.assign(Object.assign({prefixCls:`${y}-title`},!l&&c?{width:"38%"}:l&&c?{width:"50%"}:{}),k(m));e=t.createElement(v,Object.assign({},r))}if(c){let e,a=Object.assign(Object.assign({prefixCls:`${y}-paragraph`},(e={},l&&n||(e.width="61%"),!l&&n?e.rows=3:e.rows=2,e)),k(g));r=t.createElement(C,Object.assign({},a))}a=t.createElement("div",{className:`${y}-content`},e,r)}let p=(0,r.default)(y,{[`${y}-with-avatar`]:l,[`${y}-active`]:b,[`${y}-rtl`]:"rtl"===x,[`${y}-round`]:f},$,i,s,O,E);return N(t.createElement("div",{className:p,style:Object.assign(Object.assign({},w),d)},e,a))}return null!=c?c:null};x.Button=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,block:c=!1,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",n),[b,f,p]=h(g),C=(0,l.default)(e,["prefixCls"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},i,s,f,p);return b(t.createElement("div",{className:v},t.createElement(o,Object.assign({prefixCls:`${g}-button`,size:u},C))))},x.Avatar=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,shape:c="circle",size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",n),[b,f,p]=h(g),C=(0,l.default)(e,["prefixCls","className"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d},i,s,f,p);return b(t.createElement("div",{className:v},t.createElement(o,Object.assign({prefixCls:`${g}-avatar`,shape:c,size:u},C))))},x.Input=e=>{let{prefixCls:n,className:i,rootClassName:s,active:d,block:c,size:u="default"}=e,{getPrefixCls:m}=t.useContext(a.ConfigContext),g=m("skeleton",n),[b,f,p]=h(g),C=(0,l.default)(e,["prefixCls"]),v=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},i,s,f,p);return b(t.createElement("div",{className:v},t.createElement(o,Object.assign({prefixCls:`${g}-input`,size:u},C))))},x.Image=e=>{let{prefixCls:l,className:o,rootClassName:n,style:i,active:s}=e,{getPrefixCls:d}=t.useContext(a.ConfigContext),c=d("skeleton",l),[u,m,g]=h(c),b=(0,r.default)(c,`${c}-element`,{[`${c}-active`]:s},o,n,m,g);return u(t.createElement("div",{className:b},t.createElement("div",{className:(0,r.default)(`${c}-image`,o),style:i},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},x.Node=e=>{let{prefixCls:l,className:o,rootClassName:n,style:i,active:s,children:d}=e,{getPrefixCls:c}=t.useContext(a.ConfigContext),u=c("skeleton",l),[m,g,b]=h(u),f=(0,r.default)(u,`${u}-element`,{[`${u}-active`]:s},g,o,n,b);return m(t.createElement("div",{className:f},t.createElement("div",{className:(0,r.default)(`${u}-image`,o),style:i},d)))},e.s(["default",0,x],185793)},959013,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"};var l=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(l.default,(0,t.default)({},e,{ref:o,icon:a}))});e.s(["default",0,o],959013)},269200,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("Table"),o=r.default.forwardRef((e,o)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement("div",{className:(0,a.tremorTwMerge)(l("root"),"overflow-auto",i)},r.default.createElement("table",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},s),n))});o.displayName="Table",e.s(["Table",()=>o],269200)},427612,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHead"),o=r.default.forwardRef((e,o)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("thead",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",i)},s),n))});o.displayName="TableHead",e.s(["TableHead",()=>o],427612)},64848,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableHeaderCell"),o=r.default.forwardRef((e,o)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("th",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",i)},s),n))});o.displayName="TableHeaderCell",e.s(["TableHeaderCell",()=>o],64848)},942232,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableBody"),o=r.default.forwardRef((e,o)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tbody",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",i)},s),n))});o.displayName="TableBody",e.s(["TableBody",()=>o],942232)},496020,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableRow"),o=r.default.forwardRef((e,o)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("tr",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("row"),i)},s),n))});o.displayName="TableRow",e.s(["TableRow",()=>o],496020)},977572,e=>{"use strict";var t=e.i(290571),r=e.i(271645),a=e.i(444755);let l=(0,e.i(673706).makeClassName)("TableCell"),o=r.default.forwardRef((e,o)=>{let{children:n,className:i}=e,s=(0,t.__rest)(e,["children","className"]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("td",Object.assign({ref:o,className:(0,a.tremorTwMerge)(l("root"),"align-middle whitespace-nowrap text-left p-4",i)},s),n))});o.displayName="TableCell",e.s(["TableCell",()=>o],977572)},991124,e=>{"use strict";let t=(0,e.i(475254).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["default",()=>t])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/06aaedbe7d27898c.js b/litellm/proxy/_experimental/out/_next/static/chunks/06aaedbe7d27898c.js new file mode 100644 index 00000000000..5b79d13c9bc --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/06aaedbe7d27898c.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,270377,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"};var n=e.i(9583),o=r.forwardRef(function(e,o){return r.createElement(n.default,(0,t.default)({},e,{ref:o,icon:i}))});e.s(["ExclamationCircleOutlined",0,o],270377)},244451,e=>{"use strict";let t;e.i(247167);var r=e.i(271645),i=e.i(343794),n=e.i(242064),o=e.i(763731),a=e.i(174428);let l=80*Math.PI,s=e=>{let{dotClassName:t,style:n,hasCircleCls:o}=e;return r.createElement("circle",{className:(0,i.default)(`${t}-circle`,{[`${t}-circle-bg`]:o}),r:40,cx:50,cy:50,strokeWidth:20,style:n})},c=({percent:e,prefixCls:t})=>{let n=`${t}-dot`,o=`${n}-holder`,c=`${o}-hidden`,[u,d]=r.useState(!1);(0,a.default)(()=>{0!==e&&d(!0)},[0!==e]);let m=Math.max(Math.min(e,100),0);if(!u)return null;let p={strokeDashoffset:`${l/4}`,strokeDasharray:`${l*m/100} ${l*(100-m)/100}`};return r.createElement("span",{className:(0,i.default)(o,`${n}-progress`,m<=0&&c)},r.createElement("svg",{viewBox:"0 0 100 100",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":m},r.createElement(s,{dotClassName:n,hasCircleCls:!0}),r.createElement(s,{dotClassName:n,style:p})))};function u(e){let{prefixCls:t,percent:n=0}=e,o=`${t}-dot`,a=`${o}-holder`,l=`${a}-hidden`;return r.createElement(r.Fragment,null,r.createElement("span",{className:(0,i.default)(a,n>0&&l)},r.createElement("span",{className:(0,i.default)(o,`${t}-dot-spin`)},[1,2,3,4].map(e=>r.createElement("i",{className:`${t}-dot-item`,key:e})))),r.createElement(c,{prefixCls:t,percent:n}))}function d(e){var t;let{prefixCls:n,indicator:a,percent:l}=e,s=`${n}-dot`;return a&&r.isValidElement(a)?(0,o.cloneElement)(a,{className:(0,i.default)(null==(t=a.props)?void 0:t.className,s),percent:l}):r.createElement(u,{prefixCls:n,percent:l})}e.i(296059);var m=e.i(694758),p=e.i(183293),f=e.i(246422),g=e.i(838378);let h=new m.Keyframes("antSpinMove",{to:{opacity:1}}),y=new m.Keyframes("antRotate",{to:{transform:"rotate(405deg)"}}),v=(0,f.genStyleHooks)("Spin",e=>(e=>{let{componentCls:t,calc:r}=e;return{[t]:Object.assign(Object.assign({},(0,p.resetComponent)(e)),{position:"absolute",display:"none",color:e.colorPrimary,fontSize:0,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`,"&-spinning":{position:"relative",display:"inline-block",opacity:1},[`${t}-text`]:{fontSize:e.fontSize,paddingTop:r(r(e.dotSize).sub(e.fontSize)).div(2).add(2).equal()},"&-fullscreen":{position:"fixed",width:"100vw",height:"100vh",backgroundColor:e.colorBgMask,zIndex:e.zIndexPopupBase,inset:0,display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:0,visibility:"hidden",transition:`all ${e.motionDurationMid}`,"&-show":{opacity:1,visibility:"visible"},[t]:{[`${t}-dot-holder`]:{color:e.colorWhite},[`${t}-text`]:{color:e.colorTextLightSolid}}},"&-nested-loading":{position:"relative",[`> div > ${t}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:e.contentHeight,[`${t}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:r(e.dotSize).mul(-1).div(2).equal()},[`${t}-text`]:{position:"absolute",top:"50%",width:"100%",textShadow:`0 1px 2px ${e.colorBgContainer}`},[`&${t}-show-text ${t}-dot`]:{marginTop:r(e.dotSize).div(2).mul(-1).sub(10).equal()},"&-sm":{[`${t}-dot`]:{margin:r(e.dotSizeSM).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:r(r(e.dotSizeSM).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:r(e.dotSizeSM).div(2).mul(-1).sub(10).equal()}},"&-lg":{[`${t}-dot`]:{margin:r(e.dotSizeLG).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:r(r(e.dotSizeLG).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:r(e.dotSizeLG).div(2).mul(-1).sub(10).equal()}}},[`${t}-container`]:{position:"relative",transition:`opacity ${e.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:e.colorBgContainer,opacity:0,transition:`all ${e.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${t}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:e.spinDotDefault},[`${t}-dot-holder`]:{width:"1em",height:"1em",fontSize:e.dotSize,display:"inline-block",transition:`transform ${e.motionDurationSlow} ease, opacity ${e.motionDurationSlow} ease`,transformOrigin:"50% 50%",lineHeight:1,color:e.colorPrimary,"&-hidden":{transform:"scale(0.3)",opacity:0}},[`${t}-dot-progress`]:{position:"absolute",inset:0},[`${t}-dot`]:{position:"relative",display:"inline-block",fontSize:e.dotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:r(e.dotSize).sub(r(e.marginXXS).div(2)).div(2).equal(),height:r(e.dotSize).sub(r(e.marginXXS).div(2)).div(2).equal(),background:"currentColor",borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:h,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0,animationDelay:"0s"},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:y,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"},"&-circle":{strokeLinecap:"round",transition:["stroke-dashoffset","stroke-dasharray","stroke","stroke-width","opacity"].map(t=>`${t} ${e.motionDurationSlow} ease`).join(","),fillOpacity:0,stroke:"currentcolor"},"&-circle-bg":{stroke:e.colorFillSecondary}},[`&-sm ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeSM}},[`&-sm ${t}-dot-holder`]:{i:{width:r(r(e.dotSizeSM).sub(r(e.marginXXS).div(2))).div(2).equal(),height:r(r(e.dotSizeSM).sub(r(e.marginXXS).div(2))).div(2).equal()}},[`&-lg ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeLG}},[`&-lg ${t}-dot-holder`]:{i:{width:r(r(e.dotSizeLG).sub(e.marginXXS)).div(2).equal(),height:r(r(e.dotSizeLG).sub(e.marginXXS)).div(2).equal()}},[`&${t}-show-text ${t}-text`]:{display:"block"}})}})((0,g.mergeToken)(e,{spinDotDefault:e.colorTextDescription})),e=>{let{controlHeightLG:t,controlHeight:r}=e;return{contentHeight:400,dotSize:t/2,dotSizeSM:.35*t,dotSizeLG:r}}),b=[[30,.05],[70,.03],[96,.01]];var $=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);nt.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};let S=e=>{var o;let{prefixCls:a,spinning:l=!0,delay:s=0,className:c,rootClassName:u,size:m="default",tip:p,wrapperClassName:f,style:g,children:h,fullscreen:y=!1,indicator:S,percent:x}=e,k=$(e,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:C,direction:w,className:E,style:O,indicator:z}=(0,n.useComponentConfig)("spin"),j=C("spin",a),[D,N,I]=v(j),[M,T]=r.useState(()=>l&&(!l||!s||!!Number.isNaN(Number(s)))),P=function(e,t){let[i,n]=r.useState(0),o=r.useRef(null),a="auto"===t;return r.useEffect(()=>(a&&e&&(n(0),o.current=setInterval(()=>{n(e=>{let t=100-e;for(let r=0;r{o.current&&(clearInterval(o.current),o.current=null)}),[a,e]),a?i:t}(M,x);r.useEffect(()=>{if(l){let e=function(e,t,r){var i,n=r||{},o=n.noTrailing,a=void 0!==o&&o,l=n.noLeading,s=void 0!==l&&l,c=n.debounceMode,u=void 0===c?void 0:c,d=!1,m=0;function p(){i&&clearTimeout(i)}function f(){for(var r=arguments.length,n=Array(r),o=0;oe?s?(m=Date.now(),a||(i=setTimeout(u?g:f,e))):f():!0!==a&&(i=setTimeout(u?g:f,void 0===u?e-c:e)))}return f.cancel=function(e){var t=(e||{}).upcomingOnly;p(),d=!(void 0!==t&&t)},f}(s,()=>{T(!0)},{debounceMode:false});return e(),()=>{var t;null==(t=null==e?void 0:e.cancel)||t.call(e)}}T(!1)},[s,l]);let A=r.useMemo(()=>void 0!==h&&!y,[h,y]),X=(0,i.default)(j,E,{[`${j}-sm`]:"small"===m,[`${j}-lg`]:"large"===m,[`${j}-spinning`]:M,[`${j}-show-text`]:!!p,[`${j}-rtl`]:"rtl"===w},c,!y&&u,N,I),W=(0,i.default)(`${j}-container`,{[`${j}-blur`]:M}),L=null!=(o=null!=S?S:z)?o:t,R=Object.assign(Object.assign({},O),g),q=r.createElement("div",Object.assign({},k,{style:R,className:X,"aria-live":"polite","aria-busy":M}),r.createElement(d,{prefixCls:j,indicator:L,percent:P}),p&&(A||y)?r.createElement("div",{className:`${j}-text`},p):null);return D(A?r.createElement("div",Object.assign({},k,{className:(0,i.default)(`${j}-nested-loading`,f,N,I)}),M&&r.createElement("div",{key:"loading"},q),r.createElement("div",{className:W,key:"container"},h)):y?r.createElement("div",{className:(0,i.default)(`${j}-fullscreen`,{[`${j}-fullscreen-show`]:M},u,N,I)},q):q)};S.setDefaultIndicator=e=>{t=e},e.s(["default",0,S],244451)},482725,e=>{"use strict";var t=e.i(244451);e.s(["Spin",()=>t.default])},309821,e=>{"use strict";e.i(247167);var t=e.i(271645);e.i(262370);var r=e.i(135551),i=e.i(201072),n=e.i(121229),o=e.i(726289),a=e.i(864517),l=e.i(343794),s=e.i(529681),c=e.i(242064),u=e.i(931067),d=e.i(209428),m=e.i(703923),p={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},f=function(){var e=(0,t.useRef)([]),r=(0,t.useRef)(null);return(0,t.useEffect)(function(){var t=Date.now(),i=!1;e.current.forEach(function(e){if(e){i=!0;var n=e.style;n.transitionDuration=".3s, .3s, .3s, .06s",r.current&&t-r.current<100&&(n.transitionDuration="0s, 0s")}}),i&&(r.current=Date.now())}),e.current},g=e.i(410160),h=e.i(392221),y=e.i(654310),v=0,b=(0,y.default)();let $=function(e){var r=t.useState(),i=(0,h.default)(r,2),n=i[0],o=i[1];return t.useEffect(function(){var e;o("rc_progress_".concat((b?(e=v,v+=1):e="TEST_OR_SSR",e)))},[]),e||n};var S=function(e){var r=e.bg,i=e.children;return t.createElement("div",{style:{width:"100%",height:"100%",background:r}},i)};function x(e,t){return Object.keys(e).map(function(r){var i=parseFloat(r),n="".concat(Math.floor(i*t),"%");return"".concat(e[r]," ").concat(n)})}var k=t.forwardRef(function(e,r){var i=e.prefixCls,n=e.color,o=e.gradientId,a=e.radius,l=e.style,s=e.ptg,c=e.strokeLinecap,u=e.strokeWidth,d=e.size,m=e.gapDegree,p=n&&"object"===(0,g.default)(n),f=d/2,h=t.createElement("circle",{className:"".concat(i,"-circle-path"),r:a,cx:f,cy:f,stroke:p?"#FFF":void 0,strokeLinecap:c,strokeWidth:u,opacity:+(0!==s),style:l,ref:r});if(!p)return h;var y="".concat(o,"-conic"),v=x(n,(360-m)/360),b=x(n,1),$="conic-gradient(from ".concat(m?"".concat(180+m/2,"deg"):"0deg",", ").concat(v.join(", "),")"),k="linear-gradient(to ".concat(m?"bottom":"top",", ").concat(b.join(", "),")");return t.createElement(t.Fragment,null,t.createElement("mask",{id:y},h),t.createElement("foreignObject",{x:0,y:0,width:d,height:d,mask:"url(#".concat(y,")")},t.createElement(S,{bg:k},t.createElement(S,{bg:$}))))}),C=function(e,t,r,i,n,o,a,l,s,c){var u=arguments.length>10&&void 0!==arguments[10]?arguments[10]:0,d=(100-i)/100*t;return"round"===s&&100!==i&&(d+=c/2)>=t&&(d=t-.01),{stroke:"string"==typeof l?l:void 0,strokeDasharray:"".concat(t,"px ").concat(e),strokeDashoffset:d+u,transform:"rotate(".concat(n+r/100*360*((360-o)/360)+(0===o?0:({bottom:0,top:180,left:90,right:-90})[a]),"deg)"),transformOrigin:"".concat(50,"px ").concat(50,"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s",fillOpacity:0}},w=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function E(e){var t=null!=e?e:[];return Array.isArray(t)?t:[t]}let O=function(e){var r,i,n,o,a=(0,d.default)((0,d.default)({},p),e),s=a.id,c=a.prefixCls,h=a.steps,y=a.strokeWidth,v=a.trailWidth,b=a.gapDegree,S=void 0===b?0:b,x=a.gapPosition,O=a.trailColor,z=a.strokeLinecap,j=a.style,D=a.className,N=a.strokeColor,I=a.percent,M=(0,m.default)(a,w),T=$(s),P="".concat(T,"-gradient"),A=50-y/2,X=2*Math.PI*A,W=S>0?90+S/2:-90,L=(360-S)/360*X,R="object"===(0,g.default)(h)?h:{count:h,gap:2},q=R.count,B=R.gap,F=E(I),H=E(N),G=H.find(function(e){return e&&"object"===(0,g.default)(e)}),_=G&&"object"===(0,g.default)(G)?"butt":z,K=C(X,L,0,100,W,S,x,O,_,y),U=f();return t.createElement("svg",(0,u.default)({className:(0,l.default)("".concat(c,"-circle"),D),viewBox:"0 0 ".concat(100," ").concat(100),style:j,id:s,role:"presentation"},M),!q&&t.createElement("circle",{className:"".concat(c,"-circle-trail"),r:A,cx:50,cy:50,stroke:O,strokeLinecap:_,strokeWidth:v||y,style:K}),q?(r=Math.round(q*(F[0]/100)),i=100/q,n=0,Array(q).fill(null).map(function(e,o){var a=o<=r-1?H[0]:O,l=a&&"object"===(0,g.default)(a)?"url(#".concat(P,")"):void 0,s=C(X,L,n,i,W,S,x,a,"butt",y,B);return n+=(L-s.strokeDashoffset+B)*100/L,t.createElement("circle",{key:o,className:"".concat(c,"-circle-path"),r:A,cx:50,cy:50,stroke:l,strokeWidth:y,opacity:1,style:s,ref:function(e){U[o]=e}})})):(o=0,F.map(function(e,r){var i=H[r]||H[H.length-1],n=C(X,L,o,e,W,S,x,i,_,y);return o+=e,t.createElement(k,{key:r,color:i,ptg:e,radius:A,prefixCls:c,gradientId:P,style:n,strokeLinecap:_,strokeWidth:y,gapDegree:S,ref:function(e){U[r]=e},size:100})}).reverse()))};var z=e.i(491816);e.i(765846);var j=e.i(896091);function D(e){return!e||e<0?0:e>100?100:e}function N({success:e,successPercent:t}){let r=t;return e&&"progress"in e&&(r=e.progress),e&&"percent"in e&&(r=e.percent),r}let I=(e,t,r)=>{var i,n,o,a;let l=-1,s=-1;if("step"===t){let t=r.steps,i=r.strokeWidth;"string"==typeof e||void 0===e?(l="small"===e?2:14,s=null!=i?i:8):"number"==typeof e?[l,s]=[e,e]:[l=14,s=8]=Array.isArray(e)?e:[e.width,e.height],l*=t}else if("line"===t){let t=null==r?void 0:r.strokeWidth;"string"==typeof e||void 0===e?s=t||("small"===e?6:8):"number"==typeof e?[l,s]=[e,e]:[l=-1,s=8]=Array.isArray(e)?e:[e.width,e.height]}else("circle"===t||"dashboard"===t)&&("string"==typeof e||void 0===e?[l,s]="small"===e?[60,60]:[120,120]:"number"==typeof e?[l,s]=[e,e]:Array.isArray(e)&&(l=null!=(n=null!=(i=e[0])?i:e[1])?n:120,s=null!=(a=null!=(o=e[0])?o:e[1])?a:120));return[l,s]},M=e=>{let{prefixCls:r,trailColor:i=null,strokeLinecap:n="round",gapPosition:o,gapDegree:a,width:s=120,type:c,children:u,success:d,size:m=s,steps:p}=e,[f,g]=I(m,"circle"),{strokeWidth:h}=e;void 0===h&&(h=Math.max(3/f*100,6));let y=t.useMemo(()=>a||0===a?a:"dashboard"===c?75:void 0,[a,c]),v=(({percent:e,success:t,successPercent:r})=>{let i=D(N({success:t,successPercent:r}));return[i,D(D(e)-i)]})(e),b="[object Object]"===Object.prototype.toString.call(e.strokeColor),$=(({success:e={},strokeColor:t})=>{let{strokeColor:r}=e;return[r||j.presetPrimaryColors.green,t||null]})({success:d,strokeColor:e.strokeColor}),S=(0,l.default)(`${r}-inner`,{[`${r}-circle-gradient`]:b}),x=t.createElement(O,{steps:p,percent:p?v[1]:v,strokeWidth:h,trailWidth:h,strokeColor:p?$[1]:$,strokeLinecap:n,trailColor:i,prefixCls:r,gapDegree:y,gapPosition:o||"dashboard"===c&&"bottom"||void 0}),k=f<=20,C=t.createElement("div",{className:S,style:{width:f,height:g,fontSize:.15*f+6}},x,!k&&u);return k?t.createElement(z.default,{title:u},C):C};e.i(296059);var T=e.i(694758),P=e.i(915654),A=e.i(183293),X=e.i(246422),W=e.i(838378);let L="--progress-line-stroke-color",R="--progress-percent",q=e=>{let t=e?"100%":"-100%";return new T.Keyframes(`antProgress${e?"RTL":"LTR"}Active`,{"0%":{transform:`translateX(${t}) scaleX(0)`,opacity:.1},"20%":{transform:`translateX(${t}) scaleX(0)`,opacity:.5},to:{transform:"translateX(0) scaleX(1)",opacity:0}})},B=(0,X.genStyleHooks)("Progress",e=>{let t=e.calc(e.marginXXS).div(2).equal(),r=(0,W.mergeToken)(e,{progressStepMarginInlineEnd:t,progressStepMinWidth:t,progressActiveMotionDuration:"2.4s"});return[(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:Object.assign(Object.assign({},(0,A.resetComponent)(e)),{display:"inline-block","&-rtl":{direction:"rtl"},"&-line":{position:"relative",width:"100%",fontSize:e.fontSize},[`${t}-outer`]:{display:"inline-flex",alignItems:"center",width:"100%"},[`${t}-inner`]:{position:"relative",display:"inline-block",width:"100%",flex:1,overflow:"hidden",verticalAlign:"middle",backgroundColor:e.remainingColor,borderRadius:e.lineBorderRadius},[`${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.defaultColor}},[`${t}-success-bg, ${t}-bg`]:{position:"relative",background:e.defaultColor,borderRadius:e.lineBorderRadius,transition:`all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`},[`${t}-layout-bottom`]:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",[`${t}-text`]:{width:"max-content",marginInlineStart:0,marginTop:e.marginXXS}},[`${t}-bg`]:{overflow:"hidden","&::after":{content:'""',background:{_multi_value_:!0,value:["inherit",`var(${L})`]},height:"100%",width:`calc(1 / var(${R}) * 100%)`,display:"block"},[`&${t}-bg-inner`]:{minWidth:"max-content","&::after":{content:"none"},[`${t}-text-inner`]:{color:e.colorWhite,[`&${t}-text-bright`]:{color:"rgba(0, 0, 0, 0.45)"}}}},[`${t}-success-bg`]:{position:"absolute",insetBlockStart:0,insetInlineStart:0,backgroundColor:e.colorSuccess},[`${t}-text`]:{display:"inline-block",marginInlineStart:e.marginXS,color:e.colorText,lineHeight:1,width:"2em",whiteSpace:"nowrap",textAlign:"start",verticalAlign:"middle",wordBreak:"normal",[r]:{fontSize:e.fontSize},[`&${t}-text-outer`]:{width:"max-content"},[`&${t}-text-outer${t}-text-start`]:{width:"max-content",marginInlineStart:0,marginInlineEnd:e.marginXS}},[`${t}-text-inner`]:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",marginInlineStart:0,padding:`0 ${(0,P.unit)(e.paddingXXS)}`,[`&${t}-text-start`]:{justifyContent:"start"},[`&${t}-text-end`]:{justifyContent:"end"}},[`&${t}-status-active`]:{[`${t}-bg::before`]:{position:"absolute",inset:0,backgroundColor:e.colorBgContainer,borderRadius:e.lineBorderRadius,opacity:0,animationName:q(),animationDuration:e.progressActiveMotionDuration,animationTimingFunction:e.motionEaseOutQuint,animationIterationCount:"infinite",content:'""'}},[`&${t}-rtl${t}-status-active`]:{[`${t}-bg::before`]:{animationName:q(!0)}},[`&${t}-status-exception`]:{[`${t}-bg`]:{backgroundColor:e.colorError},[`${t}-text`]:{color:e.colorError}},[`&${t}-status-exception ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorError}},[`&${t}-status-success`]:{[`${t}-bg`]:{backgroundColor:e.colorSuccess},[`${t}-text`]:{color:e.colorSuccess}},[`&${t}-status-success ${t}-inner:not(${t}-circle-gradient)`]:{[`${t}-circle-path`]:{stroke:e.colorSuccess}}})}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-circle-trail`]:{stroke:e.remainingColor},[`&${t}-circle ${t}-inner`]:{position:"relative",lineHeight:1,backgroundColor:"transparent"},[`&${t}-circle ${t}-text`]:{position:"absolute",insetBlockStart:"50%",insetInlineStart:0,width:"100%",margin:0,padding:0,color:e.circleTextColor,fontSize:e.circleTextFontSize,lineHeight:1,whiteSpace:"normal",textAlign:"center",transform:"translateY(-50%)",[r]:{fontSize:e.circleIconFontSize}},[`${t}-circle&-status-exception`]:{[`${t}-text`]:{color:e.colorError}},[`${t}-circle&-status-success`]:{[`${t}-text`]:{color:e.colorSuccess}}},[`${t}-inline-circle`]:{lineHeight:1,[`${t}-inner`]:{verticalAlign:"bottom"}}}})(r),(e=>{let{componentCls:t}=e;return{[t]:{[`${t}-steps`]:{display:"inline-block","&-outer":{display:"flex",flexDirection:"row",alignItems:"center"},"&-item":{flexShrink:0,minWidth:e.progressStepMinWidth,marginInlineEnd:e.progressStepMarginInlineEnd,backgroundColor:e.remainingColor,transition:`all ${e.motionDurationSlow}`,"&-active":{backgroundColor:e.defaultColor}}}}}})(r),(e=>{let{componentCls:t,iconCls:r}=e;return{[t]:{[`${t}-small&-line, ${t}-small&-line ${t}-text ${r}`]:{fontSize:e.fontSizeSM}}}})(r)]},e=>({circleTextColor:e.colorText,defaultColor:e.colorInfo,remainingColor:e.colorFillSecondary,lineBorderRadius:100,circleTextFontSize:"1em",circleIconFontSize:`${e.fontSize/e.fontSizeSM}em`}));var F=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);nt.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};let H=e=>{let{prefixCls:r,direction:i,percent:n,size:o,strokeWidth:a,strokeColor:s,strokeLinecap:c="round",children:u,trailColor:d=null,percentPosition:m,success:p}=e,{align:f,type:g}=m,h=s&&"string"!=typeof s?((e,t)=>{let{from:r=j.presetPrimaryColors.blue,to:i=j.presetPrimaryColors.blue,direction:n="rtl"===t?"to left":"to right"}=e,o=F(e,["from","to","direction"]);if(0!==Object.keys(o).length){let e,t=(e=[],Object.keys(o).forEach(t=>{let r=Number.parseFloat(t.replace(/%/g,""));Number.isNaN(r)||e.push({key:r,value:o[t]})}),(e=e.sort((e,t)=>e.key-t.key)).map(({key:e,value:t})=>`${t} ${e}%`).join(", ")),r=`linear-gradient(${n}, ${t})`;return{background:r,[L]:r}}let a=`linear-gradient(${n}, ${r}, ${i})`;return{background:a,[L]:a}})(s,i):{[L]:s,background:s},y="square"===c||"butt"===c?0:void 0,[v,b]=I(null!=o?o:[-1,a||("small"===o?6:8)],"line",{strokeWidth:a}),$=Object.assign(Object.assign({width:`${D(n)}%`,height:b,borderRadius:y},h),{[R]:D(n)/100}),S=N(e),x={width:`${D(S)}%`,height:b,borderRadius:y,backgroundColor:null==p?void 0:p.strokeColor},k=t.createElement("div",{className:`${r}-inner`,style:{backgroundColor:d||void 0,borderRadius:y}},t.createElement("div",{className:(0,l.default)(`${r}-bg`,`${r}-bg-${g}`),style:$},"inner"===g&&u),void 0!==S&&t.createElement("div",{className:`${r}-success-bg`,style:x})),C="outer"===g&&"start"===f,w="outer"===g&&"end"===f;return"outer"===g&&"center"===f?t.createElement("div",{className:`${r}-layout-bottom`},k,u):t.createElement("div",{className:`${r}-outer`,style:{width:v<0?"100%":v}},C&&u,k,w&&u)},G=e=>{let{size:r,steps:i,rounding:n=Math.round,percent:o=0,strokeWidth:a=8,strokeColor:s,trailColor:c=null,prefixCls:u,children:d}=e,m=n(o/100*i),[p,f]=I(null!=r?r:["small"===r?2:14,a],"step",{steps:i,strokeWidth:a}),g=p/i,h=Array.from({length:i});for(let e=0;et.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);nt.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};let K=["normal","exception","active","success"],U=t.forwardRef((e,u)=>{let d,{prefixCls:m,className:p,rootClassName:f,steps:g,strokeColor:h,percent:y=0,size:v="default",showInfo:b=!0,type:$="line",status:S,format:x,style:k,percentPosition:C={}}=e,w=_(e,["prefixCls","className","rootClassName","steps","strokeColor","percent","size","showInfo","type","status","format","style","percentPosition"]),{align:E="end",type:O="outer"}=C,z=Array.isArray(h)?h[0]:h,j="string"==typeof h||Array.isArray(h)?h:void 0,T=t.useMemo(()=>{if(z){let e="string"==typeof z?z:Object.values(z)[0];return new r.FastColor(e).isLight()}return!1},[h]),P=t.useMemo(()=>{var t,r;let i=N(e);return Number.parseInt(void 0!==i?null==(t=null!=i?i:0)?void 0:t.toString():null==(r=null!=y?y:0)?void 0:r.toString(),10)},[y,e.success,e.successPercent]),A=t.useMemo(()=>!K.includes(S)&&P>=100?"success":S||"normal",[S,P]),{getPrefixCls:X,direction:W,progress:L}=t.useContext(c.ConfigContext),R=X("progress",m),[q,F,U]=B(R),V="line"===$,Q=V&&!g,Y=t.useMemo(()=>{let r;if(!b)return null;let s=N(e),c=x||(e=>`${e}%`),u=V&&T&&"inner"===O;return"inner"===O||x||"exception"!==A&&"success"!==A?r=c(D(y),D(s)):"exception"===A?r=V?t.createElement(o.default,null):t.createElement(a.default,null):"success"===A&&(r=V?t.createElement(i.default,null):t.createElement(n.default,null)),t.createElement("span",{className:(0,l.default)(`${R}-text`,{[`${R}-text-bright`]:u,[`${R}-text-${E}`]:Q,[`${R}-text-${O}`]:Q}),title:"string"==typeof r?r:void 0},r)},[b,y,P,A,$,R,x]);"line"===$?d=g?t.createElement(G,Object.assign({},e,{strokeColor:j,prefixCls:R,steps:"object"==typeof g?g.count:g}),Y):t.createElement(H,Object.assign({},e,{strokeColor:z,prefixCls:R,direction:W,percentPosition:{align:E,type:O}}),Y):("circle"===$||"dashboard"===$)&&(d=t.createElement(M,Object.assign({},e,{strokeColor:z,prefixCls:R,progressStatus:A}),Y));let J=(0,l.default)(R,`${R}-status-${A}`,{[`${R}-${"dashboard"===$&&"circle"||$}`]:"line"!==$,[`${R}-inline-circle`]:"circle"===$&&I(v,"circle")[0]<=20,[`${R}-line`]:Q,[`${R}-line-align-${E}`]:Q,[`${R}-line-position-${O}`]:Q,[`${R}-steps`]:g,[`${R}-show-info`]:b,[`${R}-${v}`]:"string"==typeof v,[`${R}-rtl`]:"rtl"===W},null==L?void 0:L.className,p,f,F,U);return q(t.createElement("div",Object.assign({ref:u,style:Object.assign(Object.assign({},null==L?void 0:L.style),k),className:J,role:"progressbar","aria-valuenow":P,"aria-valuemin":0,"aria-valuemax":100},(0,s.default)(w,["trailColor","strokeWidth","width","gapDegree","gapPosition","strokeLinecap","success","successPercent"])),d))});e.s(["default",0,U],309821)},955135,e=>{"use strict";var t=e.i(597440);e.s(["DeleteOutlined",()=>t.default])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0a65da2cd24e2ab6.js b/litellm/proxy/_experimental/out/_next/static/chunks/0a65da2cd24e2ab6.js new file mode 100644 index 00000000000..0bb6bef6dc3 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0a65da2cd24e2ab6.js @@ -0,0 +1,3 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,621642,25080,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(144582),a=e.i(888288),o=e.i(757440);let l=e=>{var n=(0,t.__rest)(e,[]);return r.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},n),r.default.createElement("path",{d:"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z"}))};var s=e.i(446428);let i=e=>{var n=(0,t.__rest)(e,[]);return r.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},n),r.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))};var u=e.i(444755),d=e.i(673706),c=e.i(103471),m=e.i(495470),f=e.i(854056);let h=(0,d.makeClassName)("MultiSelect"),p=r.default.forwardRef((e,d)=>{let{defaultValue:p=[],value:b,onValueChange:v,placeholder:g="Select...",placeholderSearch:w="Search",disabled:y=!1,icon:x,children:k,className:M,required:D,name:N,error:E=!1,errorMessage:S,id:P}=e,T=(0,t.__rest)(e,["defaultValue","value","onValueChange","placeholder","placeholderSearch","disabled","icon","children","className","required","name","error","errorMessage","id"]),C=(0,r.useRef)(null),[_,j]=(0,a.default)(p,b),{reactElementChildren:L,optionsAvailable:F}=(0,r.useMemo)(()=>{let e=r.default.Children.toArray(k).filter(r.isValidElement);return{reactElementChildren:e,optionsAvailable:(0,c.getFilteredOptions)("",e)}},[k]),[O,I]=(0,r.useState)(""),Y=(null!=_?_:[]).length>0,W=(0,r.useMemo)(()=>O?(0,c.getFilteredOptions)(O,L):F,[O,L,F]),H=()=>{I("")};return r.default.createElement("div",{className:(0,u.tremorTwMerge)("w-full min-w-[10rem] text-tremor-default",M)},r.default.createElement("div",{className:"relative"},r.default.createElement("select",{title:"multi-select-hidden",required:D,className:(0,u.tremorTwMerge)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:_,onChange:e=>{e.preventDefault()},name:N,disabled:y,multiple:!0,id:P,onFocus:()=>{let e=C.current;e&&e.focus()}},r.default.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},g),W.map(e=>{let t=e.props.value,n=e.props.children;return r.default.createElement("option",{className:"hidden",key:t,value:t},n)})),r.default.createElement(m.Listbox,Object.assign({as:"div",ref:d,defaultValue:_,value:_,onChange:e=>{null==v||v(e),j(e)},disabled:y,id:P,multiple:!0},T),({value:e})=>r.default.createElement(r.default.Fragment,null,r.default.createElement(m.ListboxButton,{className:(0,u.tremorTwMerge)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-1.5","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",x?"pl-11 -ml-0.5":"pl-3",(0,c.getSelectButtonColors)(e.length>0,y,E)),ref:C},x&&r.default.createElement("span",{className:(0,u.tremorTwMerge)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},r.default.createElement(x,{className:(0,u.tremorTwMerge)(h("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),r.default.createElement("div",{className:"h-6 flex items-center"},e.length>0?r.default.createElement("div",{className:"flex flex-nowrap overflow-x-scroll [&::-webkit-scrollbar]:hidden [scrollbar-width:none] gap-x-1 mr-5 -ml-1.5 relative"},F.filter(t=>e.includes(t.props.value)).map((t,n)=>{var a;return r.default.createElement("div",{key:n,className:(0,u.tremorTwMerge)("max-w-[100px] lg:max-w-[200px] flex justify-center items-center pl-2 pr-1.5 py-1 font-medium","rounded-tremor-small","bg-tremor-background-muted dark:bg-dark-tremor-background-muted","bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle","text-tremor-content-default dark:text-dark-tremor-content-default","text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis")},r.default.createElement("div",{className:"text-xs truncate "},null!=(a=t.props.children)?a:t.props.value),r.default.createElement("div",{onClick:r=>{r.preventDefault();let n=e.filter(e=>e!==t.props.value);null==v||v(n),j(n)}},r.default.createElement(i,{className:(0,u.tremorTwMerge)(h("clearIconItem"),"cursor-pointer rounded-tremor-full w-3.5 h-3.5 ml-2","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle dark:hover:text-tremor-content")})))})):r.default.createElement("span",null,g)),r.default.createElement("span",{className:(0,u.tremorTwMerge)("absolute inset-y-0 right-0 flex items-center mr-2.5")},r.default.createElement(o.default,{className:(0,u.tremorTwMerge)(h("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),Y&&!y?r.default.createElement("button",{type:"button",className:(0,u.tremorTwMerge)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),j([]),null==v||v([])}},r.default.createElement(s.default,{className:(0,u.tremorTwMerge)(h("clearIconAllItems"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,r.default.createElement(f.Transition,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},r.default.createElement(m.ListboxOptions,{anchor:"bottom start",className:(0,u.tremorTwMerge)("z-10 divide-y w-[var(--button-width)] overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},r.default.createElement("div",{className:(0,u.tremorTwMerge)("flex items-center w-full px-2.5","bg-tremor-background-muted","dark:bg-dark-tremor-background-muted")},r.default.createElement("span",null,r.default.createElement(l,{className:(0,u.tremorTwMerge)("flex-none w-4 h-4 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),r.default.createElement("input",{name:"search",type:"input",autoComplete:"off",placeholder:w,className:(0,u.tremorTwMerge)("w-full focus:outline-none focus:ring-none bg-transparent text-tremor-default py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-subtle"),onKeyDown:e=>{"Space"===e.code&&""!==e.target.value&&e.stopPropagation()},onChange:e=>I(e.target.value),value:O})),r.default.createElement(n.default.Provider,Object.assign({},{onBlur:{handleResetSearch:H}},{value:{selectedValue:e}}),W)))))),E&&S?r.default.createElement("p",{className:(0,u.tremorTwMerge)("errorMessage","text-sm text-rose-500 mt-1")},S):null)});p.displayName="MultiSelect",e.s(["MultiSelect",()=>p],621642);let b=(0,d.makeClassName)("MultiSelectItem"),v=r.default.forwardRef((e,a)=>{let{value:o,className:l,children:s}=e,i=(0,t.__rest)(e,["value","className","children"]),{selectedValue:c}=(0,r.useContext)(n.default),f=(0,d.isValueInArray)(o,c);return r.default.createElement(m.ListboxOption,Object.assign({className:(0,u.tremorTwMerge)(b("root"),"flex justify-start items-center cursor-default text-tremor-default p-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[select]ed:text-tremor-content-strong text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[select]ed:text-dark-tremor-content-strong dark:data-[select]ed:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",l),ref:a,key:o,value:o},i),r.default.createElement("input",{type:"checkbox",className:(0,u.tremorTwMerge)(b("checkbox"),"flex-none focus:ring-none focus:outline-none cursor-pointer mr-2.5","accent-tremor-brand","dark:accent-dark-tremor-brand"),checked:f,readOnly:!0}),r.default.createElement("span",{className:"whitespace-nowrap truncate"},null!=s?s:o))});v.displayName="MultiSelectItem",e.s(["MultiSelectItem",()=>v],25080)},144267,e=>{"use strict";let t,r,n;var a,o,l,s=e.i(843476),i=e.i(271645),u=e.i(290571);let d=e=>{var t=(0,u.__rest)(e,[]);return i.default.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}),i.default.createElement("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"}))};var c=e.i(446428),m=e.i(435684);function f(e){let t=(0,m.toDate)(e);return t.setHours(0,0,0,0),t}function h(){return f(Date.now())}function p(e){let t=(0,m.toDate)(e);return t.setDate(1),t.setHours(0,0,0,0),t}var b=e.i(444755),v=e.i(103471),g=e.i(439189);function w(e,t){return(0,g.addDays)(e,-t)}var y=e.i(497245),x=e.i(96226);function k(e,t){var r;let{years:n=0,months:a=0,weeks:o=0,days:l=0,hours:s=0,minutes:i=0,seconds:u=0}=t,d=w((r=a+12*n,(0,y.addMonths)(e,-r)),l+7*o);return(0,x.constructFrom)(e,d.getTime()-1e3*(u+60*(i+60*s)))}function M(e){let t=(0,m.toDate)(e),r=(0,x.constructFrom)(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}function D(e){let t;return e.forEach(function(e){let r=(0,m.toDate)(e);(void 0===t||t{let r=(0,m.toDate)(e);(!t||t>r||isNaN(+r))&&(t=r)}),t||new Date(NaN)}let E={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function S(e){return (t={})=>{let r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}let P={date:S({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:S({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:S({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},T={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function C(e){return(t,r)=>{let n;if("formatting"===(r?.context?String(r.context):"standalone")&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,a=r?.width?String(r.width):t;n=e.formattingValues[a]||e.formattingValues[t]}else{let t=e.defaultWidth,a=r?.width?String(r.width):e.defaultWidth;n=e.values[a]||e.values[t]}return n[e.argumentCallback?e.argumentCallback(t):t]}}function _(e){return(t,r={})=>{let n,a=r.width,o=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],l=t.match(o);if(!l)return null;let s=l[0],i=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(i)?function(e,t){for(let r=0;re.test(s)):function(e,t){for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}(i,e=>e.test(s));return n=e.valueCallback?e.valueCallback(u):u,{value:n=r.valueCallback?r.valueCallback(n):n,rest:t.slice(s.length)}}}let j={code:"en-US",formatDistance:(e,t,r)=>{let n,a=E[e];if(n="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",t.toString()),r?.addSuffix)if(r.comparison&&r.comparison>0)return"in "+n;else return n+" ago";return n},formatLong:P,formatRelative:(e,t,r,n)=>T[e],localize:{ordinalNumber:(e,t)=>{let r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:C({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:C({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:C({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:C({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:C({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(a={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{let r=e.match(a.matchPattern);if(!r)return null;let n=r[0],o=e.match(a.parsePattern);if(!o)return null;let l=a.valueCallback?a.valueCallback(o[0]):o[0];return{value:l=t.valueCallback?t.valueCallback(l):l,rest:e.slice(n.length)}}),era:_({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:_({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:_({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:_({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:_({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},L={};function F(e){let t=(0,m.toDate)(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),e-r}function O(e,t){let r=f(e),n=f(t);return Math.round((r-F(r)-(n-F(n)))/864e5)}function I(e,t){let r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??L.weekStartsOn??L.locale?.options?.weekStartsOn??0,n=(0,m.toDate)(e),a=n.getDay();return n.setDate(n.getDate()-(7*(a=a.getTime()?r+1:t.getTime()>=l.getTime()?r:r-1}function H(e){let t,r,n=(0,m.toDate)(e);return Math.round((Y(n)-(t=W(n),(r=(0,x.constructFrom)(n,0)).setFullYear(t,0,4),r.setHours(0,0,0,0),Y(r)))/6048e5)+1}function R(e,t){let r=(0,m.toDate)(e),n=r.getFullYear(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??L.firstWeekContainsDate??L.locale?.options?.firstWeekContainsDate??1,o=(0,x.constructFrom)(e,0);o.setFullYear(n+1,0,a),o.setHours(0,0,0,0);let l=I(o,t),s=(0,x.constructFrom)(e,0);s.setFullYear(n,0,a),s.setHours(0,0,0,0);let i=I(s,t);return r.getTime()>=l.getTime()?n+1:r.getTime()>=i.getTime()?n:n-1}function B(e,t){let r,n,a,o=(0,m.toDate)(e);return Math.round((I(o,t)-(r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??L.firstWeekContainsDate??L.locale?.options?.firstWeekContainsDate??1,n=R(o,t),(a=(0,x.constructFrom)(o,0)).setFullYear(n,0,r),a.setHours(0,0,0,0),I(a,t)))/6048e5)+1}function q(e,t){let r=Math.abs(e).toString().padStart(t,"0");return(e<0?"-":"")+r}let A={y(e,t){let r=e.getFullYear(),n=r>0?r:1-r;return q("yy"===t?n%100:n,t.length)},M(e,t){let r=e.getMonth();return"M"===t?String(r+1):q(r+1,2)},d:(e,t)=>q(e.getDate(),t.length),a(e,t){let r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return"am"===r?"a.m.":"p.m."}},h:(e,t)=>q(e.getHours()%12||12,t.length),H:(e,t)=>q(e.getHours(),t.length),m:(e,t)=>q(e.getMinutes(),t.length),s:(e,t)=>q(e.getSeconds(),t.length),S(e,t){let r=t.length;return q(Math.trunc(e.getMilliseconds()*Math.pow(10,r-3)),t.length)}},Q={G:function(e,t,r){let n=+(e.getFullYear()>0);switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){let t=e.getFullYear();return r.ordinalNumber(t>0?t:1-t,{unit:"year"})}return A.y(e,t)},Y:function(e,t,r,n){let a=R(e,n),o=a>0?a:1-a;return"YY"===t?q(o%100,2):"Yo"===t?r.ordinalNumber(o,{unit:"year"}):q(o,t.length)},R:function(e,t){return q(W(e),t.length)},u:function(e,t){return q(e.getFullYear(),t.length)},Q:function(e,t,r){let n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return q(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){let n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return q(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){let n=e.getMonth();switch(t){case"M":case"MM":return A.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){let n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return q(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){let a=B(e,n);return"wo"===t?r.ordinalNumber(a,{unit:"week"}):q(a,t.length)},I:function(e,t,r){let n=H(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):q(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getDate(),{unit:"date"}):A.d(e,t)},D:function(e,t,r){let n,a=O(n=(0,m.toDate)(e),M(n))+1;return"Do"===t?r.ordinalNumber(a,{unit:"dayOfYear"}):q(a,t.length)},E:function(e,t,r){let n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){let a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return q(o,2);case"eo":return r.ordinalNumber(o,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){let a=e.getDay(),o=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return q(o,t.length);case"co":return r.ordinalNumber(o,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){let n=e.getDay(),a=0===n?7:n;switch(t){case"i":return String(a);case"ii":return q(a,t.length);case"io":return r.ordinalNumber(a,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){let n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){let n,a=e.getHours();switch(n=12===a?"noon":0===a?"midnight":a/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,r){let n,a=e.getHours();switch(n=a>=17?"evening":a>=12?"afternoon":a>=4?"morning":"night",t){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),r.ordinalNumber(t,{unit:"hour"})}return A.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getHours(),{unit:"hour"}):A.H(e,t)},K:function(e,t,r){let n=e.getHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):q(n,t.length)},k:function(e,t,r){let n=e.getHours();return(0===n&&(n=24),"ko"===t)?r.ordinalNumber(n,{unit:"hour"}):q(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):A.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getSeconds(),{unit:"second"}):A.s(e,t)},S:function(e,t){return A.S(e,t)},X:function(e,t,r){let n=e.getTimezoneOffset();if(0===n)return"Z";switch(t){case"X":return z(n);case"XXXX":case"XX":return V(n);default:return V(n,":")}},x:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"x":return z(n);case"xxxx":case"xx":return V(n);default:return V(n,":")}},O:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+G(n,":");default:return"GMT"+V(n,":")}},z:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+G(n,":");default:return"GMT"+V(n,":")}},t:function(e,t,r){return q(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,r){return q(e.getTime(),t.length)}};function G(e,t=""){let r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),o=n%60;return 0===o?r+String(a):r+String(a)+t+q(o,2)}function z(e,t){return e%60==0?(e>0?"-":"+")+q(Math.abs(e)/60,2):V(e,t)}function V(e,t=""){let r=Math.abs(e);return(e>0?"-":"+")+q(Math.trunc(r/60),2)+t+q(r%60,2)}let $=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},K=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},X={p:K,P:(e,t)=>{let r,n=e.match(/(P+)(p+)?/)||[],a=n[1],o=n[2];if(!o)return $(e,t);switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",$(a,t)).replace("{{time}}",K(o,t))}},Z=/^D+$/,U=/^Y+$/,J=["D","DD","YY","YYYY"];function ee(e){return e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}let et=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,er=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,en=/^'([^]*?)'?$/,ea=/''/g,eo=/[a-zA-Z]/;function el(e,t,r){let n=r?.locale??L.locale??j,a=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??L.firstWeekContainsDate??L.locale?.options?.firstWeekContainsDate??1,o=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??L.weekStartsOn??L.locale?.options?.weekStartsOn??0,l=(0,m.toDate)(e);if(!((ee(l)||"number"==typeof l)&&!isNaN(Number((0,m.toDate)(l)))))throw RangeError("Invalid time value");let s=t.match(er).map(e=>{let t=e[0];return"p"===t||"P"===t?(0,X[t])(e,n.formatLong):e}).join("").match(et).map(e=>{if("''"===e)return{isToken:!1,value:"'"};let t=e[0];if("'"===t){var r;let t;return{isToken:!1,value:(t=(r=e).match(en))?t[1].replace(ea,"'"):r}}if(Q[t])return{isToken:!0,value:e};if(t.match(eo))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});n.localize.preprocessor&&(s=n.localize.preprocessor(l,s));let i={firstWeekContainsDate:a,weekStartsOn:o,locale:n};return s.map(a=>{if(!a.isToken)return a.value;let o=a.value;return(!r?.useAdditionalWeekYearTokens&&U.test(o)||!r?.useAdditionalDayOfYearTokens&&Z.test(o))&&function(e,t,r){var n,a,o;let l,s=(n=e,a=t,o=r,l="Y"===n[0]?"years":"days of the month",`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${a}\`) for formatting ${l} to the input \`${o}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);if(console.warn(s),J.includes(e))throw RangeError(s)}(o,t,String(e)),(0,Q[o[0]])(l,o,n.localize,i)}).join("")}let es=(0,e.i(673706).makeClassName)("DateRangePicker"),ei=[{value:"tdy",text:"Today",from:h()},{value:"w",text:"Last 7 days",from:k(h(),{days:7})},{value:"t",text:"Last 30 days",from:k(h(),{days:30})},{value:"m",text:"Month to Date",from:p(h())},{value:"y",text:"Year to Date",from:M(h())}];function eu(e){let t=(0,m.toDate)(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function ed(e,t){let r,n,a,o,l=(0,m.toDate)(e),s=l.getFullYear(),i=l.getDate(),u=(0,x.constructFrom)(e,0);u.setFullYear(s,t,15),u.setHours(0,0,0,0);let d=(n=(r=(0,m.toDate)(u)).getFullYear(),a=r.getMonth(),(o=(0,x.constructFrom)(u,0)).setFullYear(n,a+1,0),o.setHours(0,0,0,0),o.getDate());return l.setMonth(t,Math.min(i,d)),l}function ec(e,t){let r=(0,m.toDate)(e);return isNaN(+r)?(0,x.constructFrom)(e,NaN):(r.setFullYear(t),r)}function em(e,t){let r=(0,m.toDate)(e),n=(0,m.toDate)(t);return 12*(r.getFullYear()-n.getFullYear())+(r.getMonth()-n.getMonth())}function ef(e,t){let r=(0,m.toDate)(e),n=(0,m.toDate)(t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function eh(e,t){return+(0,m.toDate)(e)<+(0,m.toDate)(t)}function ep(e,t){return+f(e)==+f(t)}function eb(e,t){let r=(0,m.toDate)(e),n=(0,m.toDate)(t);return r.getTime()>n.getTime()}function ev(e,t){return(0,g.addDays)(e,7*t)}function eg(e,t){return(0,y.addMonths)(e,12*t)}function ew(e,t){let r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??L.weekStartsOn??L.locale?.options?.weekStartsOn??0,n=(0,m.toDate)(e),a=n.getDay();return n.setDate(n.getDate()+((a0,a=n?t:1-t;if(a<=50)r=e||100;else{let t=a+50;r=e+100*Math.trunc(t/100)-100*(e>=t%100)}return n?r:1-r}function e1(e){return e%400==0||e%4==0&&e%100!=0}let e2=[31,28,31,30,31,30,31,31,30,31,30,31],e4=[31,29,31,30,31,30,31,31,30,31,30,31];function e3(e,t,r){let n=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??L.weekStartsOn??L.locale?.options?.weekStartsOn??0,a=(0,m.toDate)(e),o=a.getDay(),l=7-n,s=t<0||t>6?t-(o+l)%7:((t%7+7)%7+l)%7-(o+l)%7;return(0,g.addDays)(a,s)}new class extends eM{priority=140;parse(e,t,r){switch(t){case"G":case"GG":case"GGG":return r.era(e,{width:"abbreviated"})||r.era(e,{width:"narrow"});case"GGGGG":return r.era(e,{width:"narrow"});default:return r.era(e,{width:"wide"})||r.era(e,{width:"abbreviated"})||r.era(e,{width:"narrow"})}}set(e,t,r){return t.era=r,e.setFullYear(r,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]},new class extends eM{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,r){let n=e=>({year:e,isTwoDigitYear:"yy"===t});switch(t){case"y":return e$(eZ(4,e),n);case"yo":return e$(r.ordinalNumber(e,{unit:"year"}),n);default:return e$(eZ(t.length,e),n)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,r){let n=e.getFullYear();if(r.isTwoDigitYear){let t=e0(r.year,n);return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}let a="era"in t&&1!==t.era?1-r.year:r.year;return e.setFullYear(a,0,1),e.setHours(0,0,0,0),e}},new class extends eM{priority=130;parse(e,t,r){let n=e=>({year:e,isTwoDigitYear:"YY"===t});switch(t){case"Y":return e$(eZ(4,e),n);case"Yo":return e$(r.ordinalNumber(e,{unit:"year"}),n);default:return e$(eZ(t.length,e),n)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,r,n){let a=R(e,n);if(r.isTwoDigitYear){let t=e0(r.year,a);return e.setFullYear(t,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),I(e,n)}let o="era"in t&&1!==t.era?1-r.year:r.year;return e.setFullYear(o,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),I(e,n)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},new class extends eM{priority=130;parse(e,t){return"R"===t?eU(4,e):eU(t.length,e)}set(e,t,r){let n=(0,x.constructFrom)(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),Y(n)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},new class extends eM{priority=130;parse(e,t){return"u"===t?eU(4,e):eU(t.length,e)}set(e,t,r){return e.setFullYear(r,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]},new class extends eM{priority=120;parse(e,t,r){switch(t){case"Q":case"QQ":return eZ(t.length,e);case"Qo":return r.ordinalNumber(e,{unit:"quarter"});case"QQQ":return r.quarter(e,{width:"abbreviated",context:"formatting"})||r.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return r.quarter(e,{width:"narrow",context:"formatting"});default:return r.quarter(e,{width:"wide",context:"formatting"})||r.quarter(e,{width:"abbreviated",context:"formatting"})||r.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,r){return e.setMonth((r-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},new class extends eM{priority=120;parse(e,t,r){switch(t){case"q":case"qq":return eZ(t.length,e);case"qo":return r.ordinalNumber(e,{unit:"quarter"});case"qqq":return r.quarter(e,{width:"abbreviated",context:"standalone"})||r.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return r.quarter(e,{width:"narrow",context:"standalone"});default:return r.quarter(e,{width:"wide",context:"standalone"})||r.quarter(e,{width:"abbreviated",context:"standalone"})||r.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,r){return e.setMonth((r-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},new class extends eM{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,r){let n=e=>e-1;switch(t){case"M":return e$(eK(eD,e),n);case"MM":return e$(eZ(2,e),n);case"Mo":return e$(r.ordinalNumber(e,{unit:"month"}),n);case"MMM":return r.month(e,{width:"abbreviated",context:"formatting"})||r.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return r.month(e,{width:"narrow",context:"formatting"});default:return r.month(e,{width:"wide",context:"formatting"})||r.month(e,{width:"abbreviated",context:"formatting"})||r.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,r){return e.setMonth(r,1),e.setHours(0,0,0,0),e}},new class extends eM{priority=110;parse(e,t,r){let n=e=>e-1;switch(t){case"L":return e$(eK(eD,e),n);case"LL":return e$(eZ(2,e),n);case"Lo":return e$(r.ordinalNumber(e,{unit:"month"}),n);case"LLL":return r.month(e,{width:"abbreviated",context:"standalone"})||r.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return r.month(e,{width:"narrow",context:"standalone"});default:return r.month(e,{width:"wide",context:"standalone"})||r.month(e,{width:"abbreviated",context:"standalone"})||r.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,r){return e.setMonth(r,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},new class extends eM{priority=100;parse(e,t,r){switch(t){case"w":return eK(eS,e);case"wo":return r.ordinalNumber(e,{unit:"week"});default:return eZ(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,r,n){let a,o;return I((o=B(a=(0,m.toDate)(e),n)-r,a.setDate(a.getDate()-7*o),a),n)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},new class extends eM{priority=100;parse(e,t,r){switch(t){case"I":return eK(eS,e);case"Io":return r.ordinalNumber(e,{unit:"week"});default:return eZ(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,r){let n,a;return Y((a=H(n=(0,m.toDate)(e))-r,n.setDate(n.getDate()-7*a),n))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},new class extends eM{priority=90;subPriority=1;parse(e,t,r){switch(t){case"d":return eK(eN,e);case"do":return r.ordinalNumber(e,{unit:"date"});default:return eZ(t.length,e)}}validate(e,t){let r=e1(e.getFullYear()),n=e.getMonth();return r?t>=1&&t<=e4[n]:t>=1&&t<=e2[n]}set(e,t,r){return e.setDate(r),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]},new class extends eM{priority=90;subpriority=1;parse(e,t,r){switch(t){case"D":case"DD":return eK(eE,e);case"Do":return r.ordinalNumber(e,{unit:"date"});default:return eZ(t.length,e)}}validate(e,t){return e1(e.getFullYear())?t>=1&&t<=366:t>=1&&t<=365}set(e,t,r){return e.setMonth(0,r),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},new class extends eM{priority=90;parse(e,t,r){switch(t){case"E":case"EE":case"EEE":return r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return r.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});default:return r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,r,n){return(e=e3(e,r,n)).setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]},new class extends eM{priority=90;parse(e,t,r,n){let a=e=>{let t=7*Math.floor((e-1)/7);return(e+n.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return e$(eZ(t.length,e),a);case"eo":return e$(r.ordinalNumber(e,{unit:"day"}),a);case"eee":return r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"eeeee":return r.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});default:return r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,r,n){return(e=e3(e,r,n)).setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},new class extends eM{priority=90;parse(e,t,r,n){let a=e=>{let t=7*Math.floor((e-1)/7);return(e+n.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return e$(eZ(t.length,e),a);case"co":return e$(r.ordinalNumber(e,{unit:"day"}),a);case"ccc":return r.day(e,{width:"abbreviated",context:"standalone"})||r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"});case"ccccc":return r.day(e,{width:"narrow",context:"standalone"});case"cccccc":return r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"});default:return r.day(e,{width:"wide",context:"standalone"})||r.day(e,{width:"abbreviated",context:"standalone"})||r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,r,n){return(e=e3(e,r,n)).setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},new class extends eM{priority=90;parse(e,t,r){let n=e=>0===e?7:e;switch(t){case"i":case"ii":return eZ(t.length,e);case"io":return r.ordinalNumber(e,{unit:"day"});case"iii":return e$(r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"}),n);case"iiiii":return e$(r.day(e,{width:"narrow",context:"formatting"}),n);case"iiiiii":return e$(r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"}),n);default:return e$(r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"}),n)}}validate(e,t){return t>=1&&t<=7}set(e,t,r){var n;let a,o,l;return n=e,a=(0,m.toDate)(n),0===(o=(0,m.toDate)(a).getDay())&&(o=7),l=o,(e=(0,g.addDays)(a,r-l)).setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]},new class extends eM{priority=80;parse(e,t,r){switch(t){case"a":case"aa":case"aaa":return r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return r.dayPeriod(e,{width:"narrow",context:"formatting"});default:return r.dayPeriod(e,{width:"wide",context:"formatting"})||r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,r){return e.setHours(eJ(r),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]},new class extends eM{priority=80;parse(e,t,r){switch(t){case"b":case"bb":case"bbb":return r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return r.dayPeriod(e,{width:"narrow",context:"formatting"});default:return r.dayPeriod(e,{width:"wide",context:"formatting"})||r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,r){return e.setHours(eJ(r),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]},new class extends eM{priority=80;parse(e,t,r){switch(t){case"B":case"BB":case"BBB":return r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return r.dayPeriod(e,{width:"narrow",context:"formatting"});default:return r.dayPeriod(e,{width:"wide",context:"formatting"})||r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,r){return e.setHours(eJ(r),0,0,0),e}incompatibleTokens=["a","b","t","T"]},new class extends eM{priority=70;parse(e,t,r){switch(t){case"h":return eK(e_,e);case"ho":return r.ordinalNumber(e,{unit:"hour"});default:return eZ(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,r){let n=e.getHours()>=12;return n&&r<12?e.setHours(r+12,0,0,0):n||12!==r?e.setHours(r,0,0,0):e.setHours(0,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]},new class extends eM{priority=70;parse(e,t,r){switch(t){case"H":return eK(eP,e);case"Ho":return r.ordinalNumber(e,{unit:"hour"});default:return eZ(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,r){return e.setHours(r,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]},new class extends eM{priority=70;parse(e,t,r){switch(t){case"K":return eK(eC,e);case"Ko":return r.ordinalNumber(e,{unit:"hour"});default:return eZ(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,r){return e.getHours()>=12&&r<12?e.setHours(r+12,0,0,0):e.setHours(r,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]},new class extends eM{priority=70;parse(e,t,r){switch(t){case"k":return eK(eT,e);case"ko":return r.ordinalNumber(e,{unit:"hour"});default:return eZ(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,r){return e.setHours(r<=24?r%24:r,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]},new class extends eM{priority=60;parse(e,t,r){switch(t){case"m":return eK(ej,e);case"mo":return r.ordinalNumber(e,{unit:"minute"});default:return eZ(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,r){return e.setMinutes(r,0,0),e}incompatibleTokens=["t","T"]},new class extends eM{priority=50;parse(e,t,r){switch(t){case"s":return eK(eL,e);case"so":return r.ordinalNumber(e,{unit:"second"});default:return eZ(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,r){return e.setSeconds(r,0),e}incompatibleTokens=["t","T"]},new class extends eM{priority=30;parse(e,t){return e$(eZ(t.length,e),e=>Math.trunc(e*Math.pow(10,-t.length+3)))}set(e,t,r){return e.setMilliseconds(r),e}incompatibleTokens=["t","T"]},new class extends eM{priority=10;parse(e,t){switch(t){case"X":return eX(eA,e);case"XX":return eX(eQ,e);case"XXXX":return eX(eG,e);case"XXXXX":return eX(eV,e);default:return eX(ez,e)}}set(e,t,r){return t.timestampIsSet?e:(0,x.constructFrom)(e,e.getTime()-F(e)-r)}incompatibleTokens=["t","T","x"]},new class extends eM{priority=10;parse(e,t){switch(t){case"x":return eX(eA,e);case"xx":return eX(eQ,e);case"xxxx":return eX(eG,e);case"xxxxx":return eX(eV,e);default:return eX(ez,e)}}set(e,t,r){return t.timestampIsSet?e:(0,x.constructFrom)(e,e.getTime()-F(e)-r)}incompatibleTokens=["t","T","X"]},new class extends eM{priority=40;parse(e){return eK(eW,e)}set(e,t,r){return[(0,x.constructFrom)(e,1e3*r),{timestampIsSet:!0}]}incompatibleTokens="*"},new class extends eM{priority=20;parse(e){return eK(eW,e)}set(e,t,r){return[(0,x.constructFrom)(e,r),{timestampIsSet:!0}]}incompatibleTokens="*"};var e5=function(){return(e5=Object.assign||function(e){for(var t,r=1,n=arguments.length;rem(u,l)&&(l=(0,y.addMonths)(u,-1*((void 0===c?1:c)-1))),d&&0>em(l,d)&&(l=d),m=p(l),f=t.month,b=(h=(0,i.useState)(m))[0],v=[void 0===f?b:f,h[1]])[0],w=v[1],[g,function(e){if(!t.disableNavigation){var r,n=p(e);w(n),null==(r=t.onMonthChange)||r.call(t,n)}}]),M=k[0],D=k[1],N=function(e,t){for(var r=t.reverseMonths,n=t.numberOfMonths,a=p(e),o=em(p((0,y.addMonths)(a,n)),a),l=[],s=0;s=em(o,r)))return(0,y.addMonths)(o,-(n?void 0===a?1:a:1))}}(M,x),P=function(e){return N.some(function(t){return ef(e,t)})};return(0,s.jsx)(tc.Provider,{value:{currentMonth:M,displayMonths:N,goToMonth:D,goToDate:function(e,t){P(e)||(t&&eh(e,t)?D((0,y.addMonths)(e,1+-1*x.numberOfMonths)):D(e))},previousMonth:S,nextMonth:E,isDateDisplayed:P},children:e.children})}function tf(){var e=(0,i.useContext)(tc);if(!e)throw Error("useNavigation must be used within a NavigationProvider");return e}function th(e){var t,r=to(),n=r.classNames,a=r.styles,o=r.components,l=tf().goToMonth,i=function(t){l((0,y.addMonths)(t,e.displayIndex?-e.displayIndex:0))},u=null!=(t=null==o?void 0:o.CaptionLabel)?t:tl,d=(0,s.jsx)(u,{id:e.id,displayMonth:e.displayMonth});return(0,s.jsxs)("div",{className:n.caption_dropdowns,style:a.caption_dropdowns,children:[(0,s.jsx)("div",{className:n.vhidden,children:d}),(0,s.jsx)(tu,{onChange:i,displayMonth:e.displayMonth}),(0,s.jsx)(td,{onChange:i,displayMonth:e.displayMonth})]})}function tp(e){return(0,s.jsx)("svg",e5({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:(0,s.jsx)("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function tb(e){return(0,s.jsx)("svg",e5({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:(0,s.jsx)("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var tv=(0,i.forwardRef)(function(e,t){var r=to(),n=r.classNames,a=r.styles,o=[n.button_reset,n.button];e.className&&o.push(e.className);var l=o.join(" "),i=e5(e5({},a.button_reset),a.button);return e.style&&Object.assign(i,e.style),(0,s.jsx)("button",e5({},e,{ref:t,type:"button",className:l,style:i}))});function tg(e){var t,r,n=to(),a=n.dir,o=n.locale,l=n.classNames,i=n.styles,u=n.labels,d=u.labelPrevious,c=u.labelNext,m=n.components;if(!e.nextMonth&&!e.previousMonth)return(0,s.jsx)(s.Fragment,{});var f=d(e.previousMonth,{locale:o}),h=[l.nav_button,l.nav_button_previous].join(" "),p=c(e.nextMonth,{locale:o}),b=[l.nav_button,l.nav_button_next].join(" "),v=null!=(t=null==m?void 0:m.IconRight)?t:tb,g=null!=(r=null==m?void 0:m.IconLeft)?r:tp;return(0,s.jsxs)("div",{className:l.nav,style:i.nav,children:[!e.hidePrevious&&(0,s.jsx)(tv,{name:"previous-month","aria-label":f,className:h,style:i.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:"rtl"===a?(0,s.jsx)(v,{className:l.nav_icon,style:i.nav_icon}):(0,s.jsx)(g,{className:l.nav_icon,style:i.nav_icon})}),!e.hideNext&&(0,s.jsx)(tv,{name:"next-month","aria-label":p,className:b,style:i.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:"rtl"===a?(0,s.jsx)(g,{className:l.nav_icon,style:i.nav_icon}):(0,s.jsx)(v,{className:l.nav_icon,style:i.nav_icon})})]})}function tw(e){var t=to().numberOfMonths,r=tf(),n=r.previousMonth,a=r.nextMonth,o=r.goToMonth,l=r.displayMonths,i=l.findIndex(function(t){return ef(e.displayMonth,t)}),u=0===i,d=i===l.length-1;return(0,s.jsx)(tg,{displayMonth:e.displayMonth,hideNext:t>1&&(u||!d),hidePrevious:t>1&&(d||!u),nextMonth:a,previousMonth:n,onPreviousClick:function(){n&&o(n)},onNextClick:function(){a&&o(a)}})}function ty(e){var t,r,n=to(),a=n.classNames,o=n.disableNavigation,l=n.styles,i=n.captionLayout,u=n.components,d=null!=(t=null==u?void 0:u.CaptionLabel)?t:tl;return r=o?(0,s.jsx)(d,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===i?(0,s.jsx)(th,{displayMonth:e.displayMonth,id:e.id}):"dropdown-buttons"===i?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(th,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),(0,s.jsx)(tw,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(d,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),(0,s.jsx)(tw,{displayMonth:e.displayMonth,id:e.id})]}),(0,s.jsx)("div",{className:a.caption,style:l.caption,children:r})}function tx(e){var t=to(),r=t.footer,n=t.styles,a=t.classNames.tfoot;return r?(0,s.jsx)("tfoot",{className:a,style:n.tfoot,children:(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:8,children:r})})}):(0,s.jsx)(s.Fragment,{})}function tk(){var e=to(),t=e.classNames,r=e.styles,n=e.showWeekNumber,a=e.locale,o=e.weekStartsOn,l=e.ISOWeek,i=e.formatters.formatWeekdayName,u=e.labels.labelWeekday,d=function(e,t,r){for(var n=r?Y(new Date):I(new Date,{locale:e,weekStartsOn:t}),a=[],o=0;o<7;o++){var l=(0,g.addDays)(n,o);a.push(l)}return a}(a,o,l);return(0,s.jsxs)("tr",{style:r.head_row,className:t.head_row,children:[n&&(0,s.jsx)("td",{style:r.head_cell,className:t.head_cell}),d.map(function(e,n){return(0,s.jsx)("th",{scope:"col",className:t.head_cell,style:r.head_cell,"aria-label":u(e,{locale:a}),children:i(e,{locale:a})},n)})]})}function tM(){var e,t=to(),r=t.classNames,n=t.styles,a=t.components,o=null!=(e=null==a?void 0:a.HeadRow)?e:tk;return(0,s.jsx)("thead",{style:n.head,className:r.head,children:(0,s.jsx)(o,{})})}function tD(e){var t=to(),r=t.locale,n=t.formatters.formatDay;return(0,s.jsx)(s.Fragment,{children:n(e.date,{locale:r})})}var tN=(0,i.createContext)(void 0);function tE(e){return e7(e.initialProps)?(0,s.jsx)(tS,{initialProps:e.initialProps,children:e.children}):(0,s.jsx)(tN.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}function tS(e){var t=e.initialProps,r=e.children,n=t.selected,a=t.min,o=t.max,l={disabled:[]};return n&&l.disabled.push(function(e){var t=o&&n.length>o-1,r=n.some(function(t){return ep(t,e)});return!!(t&&!r)}),(0,s.jsx)(tN.Provider,{value:{selected:n,onDayClick:function(e,r,l){var s,i;if((null==(s=t.onDayClick)||s.call(t,e,r,l),!r.selected||!a||(null==n?void 0:n.length)!==a)&&!(!r.selected&&o&&(null==n?void 0:n.length)===o)){var u=n?e6([],n,!0):[];if(r.selected){var d=u.findIndex(function(t){return ep(e,t)});u.splice(d,1)}else u.push(e);null==(i=t.onSelect)||i.call(t,u,e,r,l)}},modifiers:l},children:r})}function tP(){var e=(0,i.useContext)(tN);if(!e)throw Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var tT=(0,i.createContext)(void 0);function tC(e){return e8(e.initialProps)?(0,s.jsx)(t_,{initialProps:e.initialProps,children:e.children}):(0,s.jsx)(tT.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}function t_(e){var t=e.initialProps,r=e.children,n=t.selected,a=n||{},o=a.from,l=a.to,i=t.min,u=t.max,d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(d.range_start=[o],l?(d.range_end=[l],ep(o,l)||(d.range_middle=[{after:o,before:l}])):d.range_end=[o]):l&&(d.range_start=[l],d.range_end=[l]),i&&(o&&!l&&d.disabled.push({after:w(o,i-1),before:(0,g.addDays)(o,i-1)}),o&&l&&d.disabled.push({after:o,before:(0,g.addDays)(o,i-1)}),!o&&l&&d.disabled.push({after:w(l,i-1),before:(0,g.addDays)(l,i-1)})),u){if(o&&!l&&(d.disabled.push({before:(0,g.addDays)(o,-u+1)}),d.disabled.push({after:(0,g.addDays)(o,u-1)})),o&&l){var c=u-(O(l,o)+1);d.disabled.push({before:w(o,c)}),d.disabled.push({after:(0,g.addDays)(l,c)})}!o&&l&&(d.disabled.push({before:(0,g.addDays)(l,-u+1)}),d.disabled.push({after:(0,g.addDays)(l,u-1)}))}return(0,s.jsx)(tT.Provider,{value:{selected:n,onDayClick:function(e,r,a){null==(u=t.onDayClick)||u.call(t,e,r,a);var o,l,s,i,u,d,c=(o=e,s=(l=n||{}).from,i=l.to,s&&i?ep(i,o)&&ep(s,o)?void 0:ep(i,o)?{from:i,to:void 0}:ep(s,o)?void 0:eb(s,o)?{from:o,to:i}:{from:s,to:o}:i?eb(o,i)?{from:i,to:o}:{from:o,to:i}:s?eh(o,s)?{from:o,to:s}:{from:s,to:o}:{from:o,to:void 0});null==(d=t.onSelect)||d.call(t,c,e,r,a)},modifiers:d},children:r})}function tj(){var e=(0,i.useContext)(tT);if(!e)throw Error("useSelectRange must be used within a SelectRangeProvider");return e}function tL(e){return Array.isArray(e)?e6([],e,!0):void 0!==e?[e]:[]}(o=l||(l={})).Outside="outside",o.Disabled="disabled",o.Selected="selected",o.Hidden="hidden",o.Today="today",o.RangeStart="range_start",o.RangeEnd="range_end",o.RangeMiddle="range_middle";var tF=l.Selected,tO=l.Disabled,tI=l.Hidden,tY=l.Today,tW=l.RangeEnd,tH=l.RangeMiddle,tR=l.RangeStart,tB=l.Outside,tq=(0,i.createContext)(void 0);function tA(e){var t,r,n,a,o=to(),l=tP(),i=tj(),u=((t={})[tF]=tL(o.selected),t[tO]=tL(o.disabled),t[tI]=tL(o.hidden),t[tY]=[o.today],t[tW]=[],t[tH]=[],t[tR]=[],t[tB]=[],r=t,o.fromDate&&r[tO].push({before:o.fromDate}),o.toDate&&r[tO].push({after:o.toDate}),e7(o)?r[tO]=r[tO].concat(l.modifiers[tO]):e8(o)&&(r[tO]=r[tO].concat(i.modifiers[tO]),r[tR]=i.modifiers[tR],r[tH]=i.modifiers[tH],r[tW]=i.modifiers[tW]),r),d=(n=o.modifiers,a={},Object.entries(n).forEach(function(e){var t=e[0],r=e[1];a[t]=tL(r)}),a),c=e5(e5({},u),d);return(0,s.jsx)(tq.Provider,{value:c,children:e.children})}function tQ(){var e=(0,i.useContext)(tq);if(!e)throw Error("useModifiers must be used within a ModifiersProvider");return e}function tG(e,t,r){var n=Object.keys(t).reduce(function(r,n){return t[n].some(function(t){if("boolean"==typeof t)return t;if(ee(t))return ep(e,t);if(Array.isArray(t)&&t.every(ee))return t.includes(e);if(t&&"object"==typeof t&&"from"in t)return n=t.from,a=t.to,n&&a?(0>O(a,n)&&(n=(r=[a,n])[0],a=r[1]),O(e,n)>=0&&O(a,e)>=0):a?ep(a,e):!!n&&ep(n,e);if(t&&"object"==typeof t&&"dayOfWeek"in t)return t.dayOfWeek.includes(e.getDay());if(t&&"object"==typeof t&&"before"in t&&"after"in t){var r,n,a,o=O(t.before,e),l=O(t.after,e),s=o>0,i=l<0;return eb(t.before,t.after)?i&&s:s||i}return t&&"object"==typeof t&&"after"in t?O(e,t.after)>0:t&&"object"==typeof t&&"before"in t?O(t.before,e)>0:"function"==typeof t&&t(e)})&&r.push(n),r},[]),a={};return n.forEach(function(e){return a[e]=!0}),r&&!ef(e,r)&&(a.outside=!0),a}var tz=(0,i.createContext)(void 0);function tV(e){var t=tf(),r=tQ(),n=(0,i.useState)(),a=n[0],o=n[1],l=(0,i.useState)(),u=l[0],d=l[1],c=function(e,t){for(var r,n,a=p(e[0]),o=eu(e[e.length-1]),l=a;l<=o;){var s=tG(l,t);if(!(!s.disabled&&!s.hidden)){l=(0,g.addDays)(l,1);continue}if(s.selected)return l;s.today&&!n&&(n=l),r||(r=l),l=(0,g.addDays)(l,1)}return n||r}(t.displayMonths,r),m=(null!=a?a:u&&t.isDateDisplayed(u))?u:c,f=function(e){o(e)},h=to(),b=function(e,n){if(a){var o=function e(t,r){var n=r.moveBy,a=r.direction,o=r.context,l=r.modifiers,s=r.retry,i=void 0===s?{count:0,lastFocused:t}:s,u=o.weekStartsOn,d=o.fromDate,c=o.toDate,m=o.locale,f=({day:g.addDays,week:ev,month:y.addMonths,year:eg,startOfWeek:function(e){return o.ISOWeek?Y(e):I(e,{locale:m,weekStartsOn:u})},endOfWeek:function(e){return o.ISOWeek?ey(e):ew(e,{locale:m,weekStartsOn:u})}})[n](t,"after"===a?1:-1);"before"===a&&d?f=D([d,f]):"after"===a&&c&&(f=N([c,f]));var h=!0;if(l){var p=tG(f,l);h=!p.disabled&&!p.hidden}return h?f:i.count>365?i.lastFocused:e(f,{moveBy:n,direction:a,context:o,modifiers:l,retry:e5(e5({},i),{count:i.count+1})})}(a,{moveBy:e,direction:n,context:h,modifiers:r});ep(a,o)||(t.goToDate(o,a),f(o))}};return(0,s.jsx)(tz.Provider,{value:{focusedDay:a,focusTarget:m,blur:function(){d(a),o(void 0)},focus:f,focusDayAfter:function(){return b("day","after")},focusDayBefore:function(){return b("day","before")},focusWeekAfter:function(){return b("week","after")},focusWeekBefore:function(){return b("week","before")},focusMonthBefore:function(){return b("month","before")},focusMonthAfter:function(){return b("month","after")},focusYearBefore:function(){return b("year","before")},focusYearAfter:function(){return b("year","after")},focusStartOfWeek:function(){return b("startOfWeek","before")},focusEndOfWeek:function(){return b("endOfWeek","after")}},children:e.children})}function t$(){var e=(0,i.useContext)(tz);if(!e)throw Error("useFocusContext must be used within a FocusProvider");return e}var tK=(0,i.createContext)(void 0);function tX(e){return e9(e.initialProps)?(0,s.jsx)(tZ,{initialProps:e.initialProps,children:e.children}):(0,s.jsx)(tK.Provider,{value:{selected:void 0},children:e.children})}function tZ(e){var t=e.initialProps,r=e.children,n={selected:t.selected,onDayClick:function(e,r,n){var a,o,l;if(null==(a=t.onDayClick)||a.call(t,e,r,n),r.selected&&!t.required){null==(o=t.onSelect)||o.call(t,void 0,e,r,n);return}null==(l=t.onSelect)||l.call(t,e,e,r,n)}};return(0,s.jsx)(tK.Provider,{value:n,children:r})}function tU(){var e=(0,i.useContext)(tK);if(!e)throw Error("useSelectSingle must be used within a SelectSingleProvider");return e}function tJ(e){var t,r,n,a,o,u,d,c,m,f,h,p,b,v,g,w,y,x,k,M,D,N,E,S,P,T,C,_,j,L,F,O,I,Y,W,H,R,B,q,A,Q,G,z=(0,i.useRef)(null),V=(t=e.date,r=e.displayMonth,u=to(),d=t$(),c=tG(t,tQ(),r),m=to(),f=tU(),h=tP(),p=tj(),v=(b=t$()).focusDayAfter,g=b.focusDayBefore,w=b.focusWeekAfter,y=b.focusWeekBefore,x=b.blur,k=b.focus,M=b.focusMonthBefore,D=b.focusMonthAfter,N=b.focusYearBefore,E=b.focusYearAfter,S=b.focusStartOfWeek,P=b.focusEndOfWeek,T={onClick:function(e){var r,n,a,o;e9(m)?null==(r=f.onDayClick)||r.call(f,t,c,e):e7(m)?null==(n=h.onDayClick)||n.call(h,t,c,e):e8(m)?null==(a=p.onDayClick)||a.call(p,t,c,e):null==(o=m.onDayClick)||o.call(m,t,c,e)},onFocus:function(e){var r;k(t),null==(r=m.onDayFocus)||r.call(m,t,c,e)},onBlur:function(e){var r;x(),null==(r=m.onDayBlur)||r.call(m,t,c,e)},onKeyDown:function(e){var r;switch(e.key){case"ArrowLeft":e.preventDefault(),e.stopPropagation(),"rtl"===m.dir?v():g();break;case"ArrowRight":e.preventDefault(),e.stopPropagation(),"rtl"===m.dir?g():v();break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),w();break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),y();break;case"PageUp":e.preventDefault(),e.stopPropagation(),e.shiftKey?N():M();break;case"PageDown":e.preventDefault(),e.stopPropagation(),e.shiftKey?E():D();break;case"Home":e.preventDefault(),e.stopPropagation(),S();break;case"End":e.preventDefault(),e.stopPropagation(),P()}null==(r=m.onDayKeyDown)||r.call(m,t,c,e)},onKeyUp:function(e){var r;null==(r=m.onDayKeyUp)||r.call(m,t,c,e)},onMouseEnter:function(e){var r;null==(r=m.onDayMouseEnter)||r.call(m,t,c,e)},onMouseLeave:function(e){var r;null==(r=m.onDayMouseLeave)||r.call(m,t,c,e)},onPointerEnter:function(e){var r;null==(r=m.onDayPointerEnter)||r.call(m,t,c,e)},onPointerLeave:function(e){var r;null==(r=m.onDayPointerLeave)||r.call(m,t,c,e)},onTouchCancel:function(e){var r;null==(r=m.onDayTouchCancel)||r.call(m,t,c,e)},onTouchEnd:function(e){var r;null==(r=m.onDayTouchEnd)||r.call(m,t,c,e)},onTouchMove:function(e){var r;null==(r=m.onDayTouchMove)||r.call(m,t,c,e)},onTouchStart:function(e){var r;null==(r=m.onDayTouchStart)||r.call(m,t,c,e)}},C=to(),_=tU(),j=tP(),L=tj(),F=e9(C)?_.selected:e7(C)?j.selected:e8(C)?L.selected:void 0,O=!!(u.onDayClick||"default"!==u.mode),(0,i.useEffect)(function(){var e;c.outside||!d.focusedDay||O&&ep(d.focusedDay,t)&&(null==(e=z.current)||e.focus())},[d.focusedDay,t,z,O,c.outside]),Y=(I=[u.classNames.day],Object.keys(c).forEach(function(e){var t=u.modifiersClassNames[e];if(t)I.push(t);else if(Object.values(l).includes(e)){var r=u.classNames["day_".concat(e)];r&&I.push(r)}}),I).join(" "),W=e5({},u.styles.day),Object.keys(c).forEach(function(e){var t;W=e5(e5({},W),null==(t=u.modifiersStyles)?void 0:t[e])}),H=W,R=!!(c.outside&&!u.showOutsideDays||c.hidden),B=null!=(o=null==(a=u.components)?void 0:a.DayContent)?o:tD,q={style:H,className:Y,children:(0,s.jsx)(B,{date:t,displayMonth:r,activeModifiers:c}),role:"gridcell"},A=d.focusTarget&&ep(d.focusTarget,t)&&!c.outside,Q=d.focusedDay&&ep(d.focusedDay,t),G=e5(e5(e5({},q),((n={disabled:c.disabled,role:"gridcell"})["aria-selected"]=c.selected,n.tabIndex=Q||A?0:-1,n)),T),{isButton:O,isHidden:R,activeModifiers:c,selectedDays:F,buttonProps:G,divProps:q});return V.isHidden?(0,s.jsx)("div",{role:"gridcell"}):V.isButton?(0,s.jsx)(tv,e5({name:"day",ref:z},V.buttonProps)):(0,s.jsx)("div",e5({},V.divProps))}function t0(e){var t=e.number,r=e.dates,n=to(),a=n.onWeekNumberClick,o=n.styles,l=n.classNames,i=n.locale,u=n.labels.labelWeekNumber,d=(0,n.formatters.formatWeekNumber)(Number(t),{locale:i});if(!a)return(0,s.jsx)("span",{className:l.weeknumber,style:o.weeknumber,children:d});var c=u(Number(t),{locale:i});return(0,s.jsx)(tv,{name:"week-number","aria-label":c,className:l.weeknumber,style:o.weeknumber,onClick:function(e){a(t,r,e)},children:d})}function t1(e){var t,r,n,a=to(),o=a.styles,l=a.classNames,i=a.showWeekNumber,u=a.components,d=null!=(t=null==u?void 0:u.Day)?t:tJ,c=null!=(r=null==u?void 0:u.WeekNumber)?r:t0;return i&&(n=(0,s.jsx)("td",{className:l.cell,style:o.cell,children:(0,s.jsx)(c,{number:e.weekNumber,dates:e.dates})})),(0,s.jsxs)("tr",{className:l.row,style:o.row,children:[n,e.dates.map(function(t){return(0,s.jsx)("td",{className:l.cell,style:o.cell,role:"presentation",children:(0,s.jsx)(d,{displayMonth:e.displayMonth,date:t})},Math.trunc((0,m.toDate)(t)/1e3))})]})}function t2(e,t,r){for(var n=(null==r?void 0:r.ISOWeek)?ey(t):ew(t,r),a=(null==r?void 0:r.ISOWeek)?Y(e):I(e,r),o=O(n,a),l=[],s=0;s<=o;s++)l.push((0,g.addDays)(a,s));return l.reduce(function(e,t){var n=(null==r?void 0:r.ISOWeek)?H(t):B(t,r),a=e.find(function(e){return e.weekNumber===n});return a?a.dates.push(t):e.push({weekNumber:n,dates:[t]}),e},[])}function t4(e){var t,r,n,a=to(),o=a.locale,l=a.classNames,i=a.styles,u=a.hideHead,d=a.fixedWeeks,c=a.components,f=a.weekStartsOn,h=a.firstWeekContainsDate,b=a.ISOWeek,v=function(e,t){var r=t2(p(e),eu(e),t);if(null==t?void 0:t.useFixedWeeks){let d,c,f,h;var n,a,o=(c=(d=(0,m.toDate)(e)).getMonth(),d.setFullYear(d.getFullYear(),c+1,0),d.setHours(0,0,0,0),n=d,a=p(e),f=I(n,t),h=I(a,t),Math.round((f-F(f)-(h-F(h)))/6048e5)+1);if(o<6){var l=r[r.length-1],s=l.dates[l.dates.length-1],i=ev(s,6-o),u=t2(ev(s,1),i,t);r.push.apply(r,u)}}return r}(e.displayMonth,{useFixedWeeks:!!d,ISOWeek:b,locale:o,weekStartsOn:f,firstWeekContainsDate:h}),g=null!=(t=null==c?void 0:c.Head)?t:tM,w=null!=(r=null==c?void 0:c.Row)?r:t1,y=null!=(n=null==c?void 0:c.Footer)?n:tx;return(0,s.jsxs)("table",{id:e.id,className:l.table,style:i.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!u&&(0,s.jsx)(g,{}),(0,s.jsx)("tbody",{className:l.tbody,style:i.tbody,children:v.map(function(t){return(0,s.jsx)(w,{displayMonth:e.displayMonth,dates:t.dates,weekNumber:t.weekNumber},t.weekNumber)})}),(0,s.jsx)(y,{displayMonth:e.displayMonth})]})}var t3="u">typeof window&&window.document&&window.document.createElement?i.useLayoutEffect:i.useEffect,t5=!1,t6=0;function t7(){return"react-day-picker-".concat(++t6)}function t8(e){var t,r,n,a,o,l,u,d,c=to(),m=c.dir,f=c.classNames,h=c.styles,p=c.components,b=tf().displayMonths,v=(n=null!=(t=c.id?"".concat(c.id,"-").concat(e.displayIndex):void 0)?t:t5?t7():null,o=(a=(0,i.useState)(n))[0],l=a[1],t3(function(){null===o&&l(t7())},[]),(0,i.useEffect)(function(){!1===t5&&(t5=!0)},[]),null!=(r=null!=t?t:o)?r:void 0),g=c.id?"".concat(c.id,"-grid-").concat(e.displayIndex):void 0,w=[f.month],y=h.month,x=0===e.displayIndex,k=e.displayIndex===b.length-1,M=!x&&!k;"rtl"===m&&(k=(u=[x,k])[0],x=u[1]),x&&(w.push(f.caption_start),y=e5(e5({},y),h.caption_start)),k&&(w.push(f.caption_end),y=e5(e5({},y),h.caption_end)),M&&(w.push(f.caption_between),y=e5(e5({},y),h.caption_between));var D=null!=(d=null==p?void 0:p.Caption)?d:ty;return(0,s.jsxs)("div",{className:w.join(" "),style:y,children:[(0,s.jsx)(D,{id:v,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),(0,s.jsx)(t4,{id:g,"aria-labelledby":v,displayMonth:e.displayMonth})]},e.displayIndex)}function t9(e){var t=to(),r=t.classNames,n=t.styles;return(0,s.jsx)("div",{className:r.months,style:n.months,children:e.children})}function re(e){var t,r,n=e.initialProps,a=to(),o=t$(),l=tf(),u=(0,i.useState)(!1),d=u[0],c=u[1];(0,i.useEffect)(function(){a.initialFocus&&o.focusTarget&&(d||(o.focus(o.focusTarget),c(!0)))},[a.initialFocus,d,o.focus,o.focusTarget,o]);var m=[a.classNames.root,a.className];a.numberOfMonths>1&&m.push(a.classNames.multiple_months),a.showWeekNumber&&m.push(a.classNames.with_weeknumber);var f=e5(e5({},a.styles.root),a.style),h=Object.keys(n).filter(function(e){return e.startsWith("data-")}).reduce(function(e,t){var r;return e5(e5({},e),((r={})[t]=n[t],r))},{}),p=null!=(r=null==(t=n.components)?void 0:t.Months)?r:t9;return(0,s.jsx)("div",e5({className:m.join(" "),style:f,dir:a.dir,id:a.id,nonce:n.nonce,title:n.title,lang:n.lang},h,{children:(0,s.jsx)(p,{children:l.displayMonths.map(function(e,t){return(0,s.jsx)(t8,{displayIndex:t,displayMonth:e},t)})})}))}function rt(e){var t=e.children,r=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}(e,["children"]);return(0,s.jsx)(ta,{initialProps:r,children:(0,s.jsx)(tm,{children:(0,s.jsx)(tX,{initialProps:r,children:(0,s.jsx)(tE,{initialProps:r,children:(0,s.jsx)(tC,{initialProps:r,children:(0,s.jsx)(tA,{children:(0,s.jsx)(tV,{children:t})})})})})})})}function rr(e){return(0,s.jsx)(rt,e5({},e,{children:(0,s.jsx)(re,{initialProps:e})}))}let rn=e=>{var t=(0,u.__rest)(e,[]);return i.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),i.default.createElement("path",{d:"M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z"}))},ra=e=>{var t=(0,u.__rest)(e,[]);return i.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),i.default.createElement("path",{d:"M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z"}))},ro=e=>{var t=(0,u.__rest)(e,[]);return i.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),i.default.createElement("path",{d:"M4.83582 12L11.0429 18.2071L12.4571 16.7929L7.66424 12L12.4571 7.20712L11.0429 5.79291L4.83582 12ZM10.4857 12L16.6928 18.2071L18.107 16.7929L13.3141 12L18.107 7.20712L16.6928 5.79291L10.4857 12Z"}))},rl=e=>{var t=(0,u.__rest)(e,[]);return i.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),i.default.createElement("path",{d:"M19.1642 12L12.9571 5.79291L11.5429 7.20712L16.3358 12L11.5429 16.7929L12.9571 18.2071L19.1642 12ZM13.5143 12L7.30722 5.79291L5.89301 7.20712L10.6859 12L5.89301 16.7929L7.30722 18.2071L13.5143 12Z"}))};var rs=e.i(936325),ri=e.i(728889);let ru=e=>{var{onClick:t,icon:r}=e,n=(0,u.__rest)(e,["onClick","icon"]);return i.default.createElement("button",Object.assign({type:"button",className:(0,b.tremorTwMerge)("flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle select-none dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content")},n),i.default.createElement(ri.default,{onClick:t,icon:r,variant:"simple",color:"slate",size:"sm"}))};function rd(e){var{mode:t,defaultMonth:r,selected:n,onSelect:a,locale:o,disabled:l,enableYearNavigation:s,classNames:d,weekStartsOn:c=0}=e,m=(0,u.__rest)(e,["mode","defaultMonth","selected","onSelect","locale","disabled","enableYearNavigation","classNames","weekStartsOn"]);return i.default.createElement(rr,Object.assign({showOutsideDays:!0,mode:t,defaultMonth:r,selected:n,onSelect:a,locale:o,disabled:l,weekStartsOn:c,classNames:Object.assign({months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-2 relative items-center",caption_label:"text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium",nav:"space-x-1 flex items-center",nav_button:"flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content",nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"w-9 font-normal text-center text-tremor-content-subtle dark:text-dark-tremor-content-subtle",row:"flex w-full mt-0.5",cell:"text-center p-0 relative focus-within:relative text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",day:"h-9 w-9 p-0 hover:bg-tremor-background-subtle dark:hover:bg-dark-tremor-background-subtle outline-tremor-brand dark:outline-dark-tremor-brand rounded-tremor-default",day_today:"font-bold",day_selected:"aria-selected:bg-tremor-background-emphasis aria-selected:text-tremor-content-inverted dark:aria-selected:bg-dark-tremor-background-emphasis dark:aria-selected:text-dark-tremor-content-inverted ",day_disabled:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle disabled:hover:bg-transparent",day_outside:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle"},d),components:{IconLeft:e=>{var t=(0,u.__rest)(e,[]);return i.default.createElement(rn,Object.assign({className:"h-4 w-4"},t))},IconRight:e=>{var t=(0,u.__rest)(e,[]);return i.default.createElement(ra,Object.assign({className:"h-4 w-4"},t))},Caption:e=>{var t=(0,u.__rest)(e,[]);let{goToMonth:r,nextMonth:n,previousMonth:a,currentMonth:l}=tf();return i.default.createElement("div",{className:"flex justify-between items-center"},i.default.createElement("div",{className:"flex items-center space-x-1"},s&&i.default.createElement(ru,{onClick:()=>l&&r(eg(l,-1)),icon:ro}),i.default.createElement(ru,{onClick:()=>a&&r(a),icon:rn})),i.default.createElement(rs.default,{className:"text-tremor-default tabular-nums capitalize text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium"},el(t.displayMonth,"LLLL yyy",{locale:o})),i.default.createElement("div",{className:"flex items-center space-x-1"},i.default.createElement(ru,{onClick:()=>n&&r(n),icon:ra}),s&&i.default.createElement(ru,{onClick:()=>l&&r(eg(l,1)),icon:rl})))}}},m))}rd.displayName="DateRangePicker";var rc=e.i(333771),rm=e.i(888288),rf=e.i(429427),rh=e.i(371330),rp=e.i(394487),rb=e.i(992704),rv=e.i(914189),rg=e.i(941444),rw=e.i(835696),ry=e.i(877891),rx=e.i(952744),rk=e.i(605083),rM=e.i(144279),rD=e.i(2788),rN=e.i(402155);let rE=(0,i.createContext)(null);function rS({children:e,node:t}){let[r,n]=(0,i.useState)(null),a=rP(null!=t?t:r);return i.default.createElement(rE.Provider,{value:a},e,null===a&&i.default.createElement(rD.Hidden,{features:rD.HiddenFeatures.Hidden,ref:e=>{var t,r;if(e){for(let a of null!=(r=null==(t=(0,rN.getOwnerDocument)(e))?void 0:t.querySelectorAll("html > *, body > *"))?r:[])if(a!==document.body&&a!==document.head&&a instanceof HTMLElement&&null!=a&&a.contains(e)){n(a);break}}}}))}function rP(e=null){var t;return null!=(t=(0,i.useContext)(rE))?t:e}var rT=e.i(101852),rC=e.i(294316),r_=e.i(401141),rj=((t=rj||{})[t.Forwards=0]="Forwards",t[t.Backwards=1]="Backwards",t);function rL(){let e=(0,i.useRef)(0);return(0,r_.useWindowEvent)(!0,"keydown",t=>{"Tab"===t.key&&(e.current=+!!t.shiftKey)},!0),e}var rF=e.i(83733),rO=e.i(674175),rI=e.i(919751),rY=e.i(233137),rW=e.i(233538),rH=e.i(652265),rR=e.i(397701),rB=e.i(700020),rq=e.i(998348),rA=e.i(635307),rQ=((r=rQ||{})[r.Open=0]="Open",r[r.Closed=1]="Closed",r),rG=((n=rG||{})[n.TogglePopover=0]="TogglePopover",n[n.ClosePopover=1]="ClosePopover",n[n.SetButton=2]="SetButton",n[n.SetButtonId=3]="SetButtonId",n[n.SetPanel=4]="SetPanel",n[n.SetPanelId=5]="SetPanelId",n);let rz={0:e=>({...e,popoverState:(0,rR.match)(e.popoverState,{0:1,1:0}),__demoMode:!1}),1:e=>1===e.popoverState?e:{...e,popoverState:1,__demoMode:!1},2:(e,t)=>e.button===t.button?e:{...e,button:t.button},3:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},4:(e,t)=>e.panel===t.panel?e:{...e,panel:t.panel},5:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId}},rV=(0,i.createContext)(null);function r$(e){let t=(0,i.useContext)(rV);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,r$),t}return t}rV.displayName="PopoverContext";let rK=(0,i.createContext)(null);function rX(e){let t=(0,i.useContext)(rK);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,rX),t}return t}rK.displayName="PopoverAPIContext";let rZ=(0,i.createContext)(null);function rU(){return(0,i.useContext)(rZ)}rZ.displayName="PopoverGroupContext";let rJ=(0,i.createContext)(null);function r0(e,t){return(0,rR.match)(t.type,rz,e,t)}rJ.displayName="PopoverPanelContext";let r1=rB.RenderFeatures.RenderStrategy|rB.RenderFeatures.Static;function r2(e,t){let r=(0,i.useId)(),{id:n=`headlessui-popover-backdrop-${r}`,transition:a=!1,...o}=e,[{popoverState:l},s]=r$("Popover.Backdrop"),[u,d]=(0,i.useState)(null),c=(0,rC.useSyncRefs)(t,d),m=(0,rY.useOpenClosed)(),[f,h]=(0,rF.useTransition)(a,u,null!==m?(m&rY.State.Open)===rY.State.Open:0===l),p=(0,rv.useEvent)(e=>{if((0,rW.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();s({type:1})}),b=(0,i.useMemo)(()=>({open:0===l}),[l]),v={ref:c,id:n,"aria-hidden":!0,onClick:p,...(0,rF.transitionDataAttributes)(h)};return(0,rB.useRender)()({ourProps:v,theirProps:o,slot:b,defaultTag:"div",features:r1,visible:f,name:"Popover.Backdrop"})}let r4=rB.RenderFeatures.RenderStrategy|rB.RenderFeatures.Static,r3=(0,rB.forwardRefWithAs)(function(e,t){var r,n,a;let o,{__demoMode:l=!1,...s}=e,u=(0,i.useRef)(null),d=(0,rC.useSyncRefs)(t,(0,rC.optionalRef)(e=>{u.current=e})),c=(0,i.useRef)([]),m=(0,i.useReducer)(r0,{__demoMode:l,popoverState:+!l,buttons:c,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:(0,i.createRef)(),afterPanelSentinel:(0,i.createRef)(),afterButtonSentinel:(0,i.createRef)()}),[{popoverState:f,button:h,buttonId:p,panel:b,panelId:v,beforePanelSentinel:g,afterPanelSentinel:w,afterButtonSentinel:y},x]=m,k=(0,rk.useOwnerDocument)(null!=(r=u.current)?r:h),M=(0,i.useMemo)(()=>{if(!h||!b)return!1;for(let e of document.querySelectorAll("body > *"))if(Number(null==e?void 0:e.contains(h))^Number(null==e?void 0:e.contains(b)))return!0;let e=(0,rH.getFocusableElements)(),t=e.indexOf(h),r=(t+e.length-1)%e.length,n=(t+1)%e.length,a=e[r],o=e[n];return!b.contains(a)&&!b.contains(o)},[h,b]),D=(0,rg.useLatestValue)(p),N=(0,rg.useLatestValue)(v),E=(0,i.useMemo)(()=>({buttonId:D,panelId:N,close:()=>x({type:1})}),[D,N,x]),S=rU(),P=null==S?void 0:S.registerPopover,T=(0,rv.useEvent)(()=>{var e;return null!=(e=null==S?void 0:S.isFocusWithinPopoverGroup())?e:(null==k?void 0:k.activeElement)&&((null==h?void 0:h.contains(k.activeElement))||(null==b?void 0:b.contains(k.activeElement)))});(0,i.useEffect)(()=>null==P?void 0:P(E),[P,E]);let[C,_]=(0,rA.useNestedPortals)(),j=rP(h),L=function({defaultContainers:e=[],portals:t,mainTreeNode:r}={}){let n=(0,rk.useOwnerDocument)(r),a=(0,rv.useEvent)(()=>{var a,o;let l=[];for(let t of e)null!==t&&(t instanceof HTMLElement?l.push(t):"current"in t&&t.current instanceof HTMLElement&&l.push(t.current));if(null!=t&&t.current)for(let e of t.current)l.push(e);for(let e of null!=(a=null==n?void 0:n.querySelectorAll("html > *, body > *"))?a:[])e!==document.body&&e!==document.head&&e instanceof HTMLElement&&"headlessui-portal-root"!==e.id&&(r&&(e.contains(r)||e.contains(null==(o=null==r?void 0:r.getRootNode())?void 0:o.host))||l.some(t=>e.contains(t))||l.push(e));return l});return{resolveContainers:a,contains:(0,rv.useEvent)(e=>a().some(t=>t.contains(e)))}}({mainTreeNode:j,portals:C,defaultContainers:[h,b]});n=null==k?void 0:k.defaultView,a="focus",o=(0,rg.useLatestValue)(e=>{var t,r,n,a,o,l;e.target!==window&&e.target instanceof HTMLElement&&0===f&&(T()||h&&b&&(L.contains(e.target)||null!=(r=null==(t=g.current)?void 0:t.contains)&&r.call(t,e.target)||null!=(a=null==(n=w.current)?void 0:n.contains)&&a.call(n,e.target)||null!=(l=null==(o=y.current)?void 0:o.contains)&&l.call(o,e.target)||x({type:1})))}),(0,i.useEffect)(()=>{function e(e){o.current(e)}return(n=null!=n?n:window).addEventListener(a,e,!0),()=>n.removeEventListener(a,e,!0)},[n,a,!0]),(0,rx.useOutsideClick)(0===f,L.resolveContainers,(e,t)=>{x({type:1}),(0,rH.isFocusableElement)(t,rH.FocusableMode.Loose)||(e.preventDefault(),null==h||h.focus())});let F=(0,rv.useEvent)(e=>{x({type:1});let t=e?e instanceof HTMLElement?e:"current"in e&&e.current instanceof HTMLElement?e.current:h:h;null==t||t.focus()}),O=(0,i.useMemo)(()=>({close:F,isPortalled:M}),[F,M]),I=(0,i.useMemo)(()=>({open:0===f,close:F}),[f,F]),Y=(0,rB.useRender)();return i.default.createElement(rS,{node:j},i.default.createElement(rI.FloatingProvider,null,i.default.createElement(rJ.Provider,{value:null},i.default.createElement(rV.Provider,{value:m},i.default.createElement(rK.Provider,{value:O},i.default.createElement(rO.CloseProvider,{value:F},i.default.createElement(rY.OpenClosedProvider,{value:(0,rR.match)(f,{0:rY.State.Open,1:rY.State.Closed})},i.default.createElement(_,null,Y({ourProps:{ref:d},theirProps:s,slot:I,defaultTag:"div",name:"Popover"})))))))))}),r5=(0,rB.forwardRefWithAs)(function(e,t){let r=(0,i.useId)(),{id:n=`headlessui-popover-button-${r}`,disabled:a=!1,autoFocus:o=!1,...l}=e,[s,u]=r$("Popover.Button"),{isPortalled:d}=rX("Popover.Button"),c=(0,i.useRef)(null),m=`headlessui-focus-sentinel-${(0,i.useId)()}`,f=rU(),h=null==f?void 0:f.closeOthers,p=null!==(0,i.useContext)(rJ);(0,i.useEffect)(()=>{if(!p)return u({type:3,buttonId:n}),()=>{u({type:3,buttonId:null})}},[p,n,u]);let[b]=(0,i.useState)(()=>Symbol()),v=(0,rC.useSyncRefs)(c,t,(0,rI.useFloatingReference)(),(0,rv.useEvent)(e=>{if(!p){if(e)s.buttons.current.push(b);else{let e=s.buttons.current.indexOf(b);-1!==e&&s.buttons.current.splice(e,1)}s.buttons.current.length>1&&console.warn("You are already using a but only 1 is supported."),e&&u({type:2,button:e})}})),g=(0,rC.useSyncRefs)(c,t),w=(0,rk.useOwnerDocument)(c),y=(0,rv.useEvent)(e=>{var t,r,n;if(p){if(1===s.popoverState)return;switch(e.key){case rq.Keys.Space:case rq.Keys.Enter:e.preventDefault(),null==(r=(t=e.target).click)||r.call(t),u({type:1}),null==(n=s.button)||n.focus()}}else switch(e.key){case rq.Keys.Space:case rq.Keys.Enter:e.preventDefault(),e.stopPropagation(),1===s.popoverState&&(null==h||h(s.buttonId)),u({type:0});break;case rq.Keys.Escape:if(0!==s.popoverState)return null==h?void 0:h(s.buttonId);if(!c.current||null!=w&&w.activeElement&&!c.current.contains(w.activeElement))return;e.preventDefault(),e.stopPropagation(),u({type:1})}}),x=(0,rv.useEvent)(e=>{p||e.key===rq.Keys.Space&&e.preventDefault()}),k=(0,rv.useEvent)(e=>{var t,r;(0,rW.isDisabledReactIssue7711)(e.currentTarget)||a||(p?(u({type:1}),null==(t=s.button)||t.focus()):(e.preventDefault(),e.stopPropagation(),1===s.popoverState&&(null==h||h(s.buttonId)),u({type:0}),null==(r=s.button)||r.focus()))}),M=(0,rv.useEvent)(e=>{e.preventDefault(),e.stopPropagation()}),{isFocusVisible:D,focusProps:N}=(0,rf.useFocusRing)({autoFocus:o}),{isHovered:E,hoverProps:S}=(0,rh.useHover)({isDisabled:a}),{pressed:P,pressProps:T}=(0,rp.useActivePress)({disabled:a}),C=0===s.popoverState,_=(0,i.useMemo)(()=>({open:C,active:P||C,disabled:a,hover:E,focus:D,autofocus:o}),[C,E,D,P,a,o]),j=(0,rM.useResolveButtonType)(e,s.button),L=p?(0,rB.mergeProps)({ref:g,type:j,onKeyDown:y,onClick:k,disabled:a||void 0,autoFocus:o},N,S,T):(0,rB.mergeProps)({ref:v,id:s.buttonId,type:j,"aria-expanded":0===s.popoverState,"aria-controls":s.panel?s.panelId:void 0,disabled:a||void 0,autoFocus:o,onKeyDown:y,onKeyUp:x,onClick:k,onMouseDown:M},N,S,T),F=rL(),O=(0,rv.useEvent)(()=>{let e=s.panel;e&&(0,rR.match)(F.current,{[rj.Forwards]:()=>(0,rH.focusIn)(e,rH.Focus.First),[rj.Backwards]:()=>(0,rH.focusIn)(e,rH.Focus.Last)})===rH.FocusResult.Error&&(0,rH.focusIn)((0,rH.getFocusableElements)().filter(e=>"true"!==e.dataset.headlessuiFocusGuard),(0,rR.match)(F.current,{[rj.Forwards]:rH.Focus.Next,[rj.Backwards]:rH.Focus.Previous}),{relativeTo:s.button})}),I=(0,rB.useRender)();return i.default.createElement(i.default.Fragment,null,I({ourProps:L,theirProps:l,slot:_,defaultTag:"button",name:"Popover.Button"}),C&&!p&&d&&i.default.createElement(rD.Hidden,{id:m,ref:s.afterButtonSentinel,features:rD.HiddenFeatures.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:O}))}),r6=(0,rB.forwardRefWithAs)(r2),r7=(0,rB.forwardRefWithAs)(r2),r8=(0,rB.forwardRefWithAs)(function(e,t){let r=(0,i.useId)(),{id:n=`headlessui-popover-panel-${r}`,focus:a=!1,anchor:o,portal:l=!1,modal:s=!1,transition:u=!1,...d}=e,[c,m]=r$("Popover.Panel"),{close:f,isPortalled:h}=rX("Popover.Panel"),p=`headlessui-focus-sentinel-before-${r}`,b=`headlessui-focus-sentinel-after-${r}`,v=(0,i.useRef)(null),g=(0,rI.useResolvedAnchor)(o),[w,y]=(0,rI.useFloatingPanel)(g),x=(0,rI.useFloatingPanelProps)();g&&(l=!0);let[k,M]=(0,i.useState)(null),D=(0,rC.useSyncRefs)(v,t,g?w:null,(0,rv.useEvent)(e=>m({type:4,panel:e})),M),N=(0,rk.useOwnerDocument)(v);(0,rw.useIsoMorphicEffect)(()=>(m({type:5,panelId:n}),()=>{m({type:5,panelId:null})}),[n,m]);let E=(0,rY.useOpenClosed)(),[S,P]=(0,rF.useTransition)(u,k,null!==E?(E&rY.State.Open)===rY.State.Open:0===c.popoverState);(0,ry.useOnDisappear)(S,c.button,()=>{m({type:1})});let T=!c.__demoMode&&s&&S;(0,rT.useScrollLock)(T,N);let C=(0,rv.useEvent)(e=>{var t;if(e.key===rq.Keys.Escape){if(0!==c.popoverState||!v.current||null!=N&&N.activeElement&&!v.current.contains(N.activeElement))return;e.preventDefault(),e.stopPropagation(),m({type:1}),null==(t=c.button)||t.focus()}});(0,i.useEffect)(()=>{var t;e.static||1===c.popoverState&&(null==(t=e.unmount)||t)&&m({type:4,panel:null})},[c.popoverState,e.unmount,e.static,m]),(0,i.useEffect)(()=>{if(c.__demoMode||!a||0!==c.popoverState||!v.current)return;let e=null==N?void 0:N.activeElement;v.current.contains(e)||(0,rH.focusIn)(v.current,rH.Focus.First)},[c.__demoMode,a,v.current,c.popoverState]);let _=(0,i.useMemo)(()=>({open:0===c.popoverState,close:f}),[c.popoverState,f]),j=(0,rB.mergeProps)(g?x():{},{ref:D,id:n,onKeyDown:C,onBlur:a&&0===c.popoverState?e=>{var t,r,n,a,o;let l=e.relatedTarget;l&&v.current&&(null!=(t=v.current)&&t.contains(l)||(m({type:1}),(null!=(n=null==(r=c.beforePanelSentinel.current)?void 0:r.contains)&&n.call(r,l)||null!=(o=null==(a=c.afterPanelSentinel.current)?void 0:a.contains)&&o.call(a,l))&&l.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...d.style,...y,"--button-width":(0,rb.useElementSize)(c.button,!0).width},...(0,rF.transitionDataAttributes)(P)}),L=rL(),F=(0,rv.useEvent)(()=>{let e=v.current;e&&(0,rR.match)(L.current,{[rj.Forwards]:()=>{var t;(0,rH.focusIn)(e,rH.Focus.First)===rH.FocusResult.Error&&(null==(t=c.afterPanelSentinel.current)||t.focus())},[rj.Backwards]:()=>{var e;null==(e=c.button)||e.focus({preventScroll:!0})}})}),O=(0,rv.useEvent)(()=>{let e=v.current;e&&(0,rR.match)(L.current,{[rj.Forwards]:()=>{if(!c.button)return;let e=(0,rH.getFocusableElements)(),t=e.indexOf(c.button),r=e.slice(0,t+1),n=[...e.slice(t+1),...r];for(let e of n.slice())if("true"===e.dataset.headlessuiFocusGuard||null!=k&&k.contains(e)){let t=n.indexOf(e);-1!==t&&n.splice(t,1)}(0,rH.focusIn)(n,rH.Focus.First,{sorted:!1})},[rj.Backwards]:()=>{var t;(0,rH.focusIn)(e,rH.Focus.Previous)===rH.FocusResult.Error&&(null==(t=c.button)||t.focus())}})}),I=(0,rB.useRender)();return i.default.createElement(rY.ResetOpenClosedProvider,null,i.default.createElement(rJ.Provider,{value:n},i.default.createElement(rK.Provider,{value:{close:f,isPortalled:h}},i.default.createElement(rA.Portal,{enabled:!!l&&(e.static||S)},S&&h&&i.default.createElement(rD.Hidden,{id:p,ref:c.beforePanelSentinel,features:rD.HiddenFeatures.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:F}),I({ourProps:j,theirProps:d,slot:_,defaultTag:"div",features:r4,visible:S,name:"Popover.Panel"}),S&&h&&i.default.createElement(rD.Hidden,{id:b,ref:c.afterPanelSentinel,features:rD.HiddenFeatures.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:O})))))}),r9=Object.assign(r3,{Button:r5,Backdrop:r7,Overlay:r6,Panel:r8,Group:(0,rB.forwardRefWithAs)(function(e,t){let r=(0,i.useRef)(null),n=(0,rC.useSyncRefs)(r,t),[a,o]=(0,i.useState)([]),l=(0,rv.useEvent)(e=>{o(t=>{let r=t.indexOf(e);if(-1!==r){let e=t.slice();return e.splice(r,1),e}return t})}),s=(0,rv.useEvent)(e=>(o(t=>[...t,e]),()=>l(e))),u=(0,rv.useEvent)(()=>{var e;let t=(0,rN.getOwnerDocument)(r);if(!t)return!1;let n=t.activeElement;return!!(null!=(e=r.current)&&e.contains(n))||a.some(e=>{var r,a;return(null==(r=t.getElementById(e.buttonId.current))?void 0:r.contains(n))||(null==(a=t.getElementById(e.panelId.current))?void 0:a.contains(n))})}),d=(0,rv.useEvent)(e=>{for(let t of a)t.buttonId.current!==e&&t.close()}),c=(0,i.useMemo)(()=>({registerPopover:s,unregisterPopover:l,isFocusWithinPopoverGroup:u,closeOthers:d}),[s,l,u,d]),m=(0,i.useMemo)(()=>({}),[]),f=(0,rB.useRender)();return i.default.createElement(rS,null,i.default.createElement(rZ.Provider,{value:c},f({ourProps:{ref:n},theirProps:e,slot:m,defaultTag:"div",name:"Popover.Group"})))})});var ne=e.i(854056),nt=e.i(495470);let nr=h(),nn=i.default.forwardRef((e,t)=>{var r,n;let{value:a,defaultValue:o,onValueChange:l,enableSelect:s=!0,minDate:g,maxDate:w,placeholder:y="Select range",selectPlaceholder:x="Select range",disabled:k=!1,locale:M=j,enableClear:E=!0,displayFormat:S,children:P,className:T,enableYearNavigation:C=!1,weekStartsOn:_=0,disabledDates:L}=e,F=(0,u.__rest)(e,["value","defaultValue","onValueChange","enableSelect","minDate","maxDate","placeholder","selectPlaceholder","disabled","locale","enableClear","displayFormat","children","className","enableYearNavigation","weekStartsOn","disabledDates"]),[O,I]=(0,rm.default)(o,a),[Y,W]=(0,i.useState)(!1),[H,R]=(0,i.useState)(!1),B=(0,i.useMemo)(()=>{let e=[];return g&&e.push({before:g}),w&&e.push({after:w}),[...e,...null!=L?L:[]]},[g,w,L]),q=(0,i.useMemo)(()=>{let e=new Map;return P?i.default.Children.forEach(P,t=>{var r;e.set(t.props.value,{text:null!=(r=(0,v.getNodeText)(t))?r:t.props.value,from:t.props.from,to:t.props.to})}):ei.forEach(t=>{e.set(t.value,{text:t.text,from:t.from,to:nr})}),e},[P]),A=(0,i.useMemo)(()=>{if(P)return(0,v.constructValueToNameMapping)(P);let e=new Map;return ei.forEach(t=>e.set(t.value,t.text)),e},[P]),Q=(null==O?void 0:O.selectValue)||"",G=((e,t,r,n)=>{var a;if(r&&(e=null==(a=n.get(r))?void 0:a.from),e)return f(e&&!t?e:D([e,t]))})(null==O?void 0:O.from,g,Q,q),z=((e,t,r,n)=>{var a,o;if(r&&(e=f(null!=(o=null==(a=n.get(r))?void 0:a.to)?o:h())),e)return f(e&&!t?e:N([e,t]))})(null==O?void 0:O.to,w,Q,q),V=G||z?((e,t,r,n)=>{let a=(null==r?void 0:r.code)||"en-US";if(!e&&!t)return"";if(e&&!t)return n?el(e,n):e.toLocaleDateString(a,{year:"numeric",month:"short",day:"numeric"});if(e&&t){if(+(0,m.toDate)(e)==+(0,m.toDate)(t))return n?el(e,n):e.toLocaleDateString(a,{year:"numeric",month:"short",day:"numeric"});if(e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear())return n?`${el(e,n)} - ${el(t,n)}`:`${e.toLocaleDateString(a,{month:"short",day:"numeric"})} - + ${t.getDate()}, ${t.getFullYear()}`;{if(n)return`${el(e,n)} - ${el(t,n)}`;let r={year:"numeric",month:"short",day:"numeric"};return`${e.toLocaleDateString(a,r)} - + ${t.toLocaleDateString(a,r)}`}}return""})(G,z,M,S):y,$=p(null!=(n=null!=(r=null!=z?z:G)?r:w)?n:nr),K=E&&!k;return i.default.createElement("div",Object.assign({ref:t,className:(0,b.tremorTwMerge)("w-full min-w-[10rem] relative flex justify-between text-tremor-default max-w-sm shadow-tremor-input dark:shadow-dark-tremor-input rounded-tremor-default",T)},F),i.default.createElement(r9,{as:"div",className:(0,b.tremorTwMerge)("w-full",s?"rounded-l-tremor-default":"rounded-tremor-default",Y&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10")},i.default.createElement("div",{className:"relative w-full"},i.default.createElement(r5,{onFocus:()=>W(!0),onBlur:()=>W(!1),disabled:k,className:(0,b.tremorTwMerge)("w-full outline-none text-left whitespace-nowrap truncate focus:ring-2 transition duration-100 rounded-l-tremor-default flex flex-nowrap border pl-3 py-2","rounded-l-tremor-default border-tremor-border text-tremor-content-emphasis focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",s?"rounded-l-tremor-default":"rounded-tremor-default",K?"pr-8":"pr-4",(0,v.getSelectButtonColors)((0,v.hasValue)(G||z),k))},i.default.createElement(d,{className:(0,b.tremorTwMerge)(es("calendarIcon"),"flex-none shrink-0 h-5 w-5 -ml-0.5 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle"),"aria-hidden":"true"}),i.default.createElement("p",{className:"truncate"},V)),K&&G?i.default.createElement("button",{type:"button",className:(0,b.tremorTwMerge)("absolute outline-none inset-y-0 right-0 flex items-center transition duration-100 mr-4"),onClick:e=>{e.preventDefault(),null==l||l({}),I({})}},i.default.createElement(c.default,{className:(0,b.tremorTwMerge)(es("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null),i.default.createElement(ne.Transition,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},i.default.createElement(r8,{anchor:"bottom start",focus:!0,className:(0,b.tremorTwMerge)("min-w-min divide-y overflow-y-auto outline-none rounded-tremor-default p-3 border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},i.default.createElement(rd,Object.assign({mode:"range",showOutsideDays:!0,defaultMonth:$,selected:{from:G,to:z},onSelect:e=>{null==l||l({from:null==e?void 0:e.from,to:null==e?void 0:e.to}),I({from:null==e?void 0:e.from,to:null==e?void 0:e.to})},locale:M,disabled:B,enableYearNavigation:C,classNames:{day_range_middle:(0,b.tremorTwMerge)("!rounded-none aria-selected:!bg-tremor-background-subtle aria-selected:dark:!bg-dark-tremor-background-subtle aria-selected:!text-tremor-content aria-selected:dark:!bg-dark-tremor-background-subtle"),day_range_start:"rounded-r-none rounded-l-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted",day_range_end:"rounded-l-none rounded-r-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted"},weekStartsOn:_},e))))),s&&i.default.createElement(nt.Listbox,{as:"div",className:(0,b.tremorTwMerge)("w-48 -ml-px rounded-r-tremor-default",H&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10"),value:Q,onChange:e=>{let{from:t,to:r}=q.get(e),n=null!=r?r:nr;null==l||l({from:t,to:n,selectValue:e}),I({from:t,to:n,selectValue:e})},disabled:k},({value:e})=>{var t;return i.default.createElement(i.default.Fragment,null,i.default.createElement(nt.ListboxButton,{onFocus:()=>R(!0),onBlur:()=>R(!1),className:(0,b.tremorTwMerge)("w-full outline-none text-left whitespace-nowrap truncate rounded-r-tremor-default transition duration-100 border px-4 py-2","border-tremor-border text-tremor-content-emphasis focus:border-tremor-brand-subtle","dark:border-dark-tremor-border dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle",(0,v.getSelectButtonColors)((0,v.hasValue)(e),k))},e&&null!=(t=A.get(e))?t:x),i.default.createElement(ne.Transition,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},i.default.createElement(nt.ListboxOptions,{anchor:"bottom end",className:(0,b.tremorTwMerge)("[--anchor-gap:4px] divide-y overflow-y-auto outline-none border min-w-44","shadow-tremor-dropdown bg-tremor-background border-tremor-border divide-tremor-border rounded-tremor-default","dark:shadow-dark-tremor-dropdown dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border")},null!=P?P:ei.map(e=>i.default.createElement(rc.default,{key:e.value,value:e.value},e.text)))))}))});nn.displayName="DateRangePicker";var na=e.i(599724);e.s(["default",0,({value:e,onValueChange:t,label:r="Select Time Range",className:n="",showTimeRange:a=!0})=>{let[o,l]=(0,i.useState)(!1),u=(0,i.useRef)(null),d=(0,i.useCallback)(e=>{l(!0),setTimeout(()=>l(!1),1500),t(e),requestIdleCallback(()=>{if(e.from){let r,n={...e},a=new Date(e.from);r=new Date(e.to?e.to:e.from),a.toDateString(),r.toDateString(),a.setHours(0,0,0,0),r.setHours(23,59,59,999),n.from=a,n.to=r,t(n)}},{timeout:100})},[t]),c=(0,i.useCallback)((e,t)=>{if(!e||!t)return"";let r=e=>e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});if(e.toDateString()!==t.toDateString())return`${r(e)} - ${r(t)}`;{let r=e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),n=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),a=t.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0,timeZoneName:"short"});return`${r}: ${n} - ${a}`}},[]);return(0,s.jsxs)("div",{className:n,children:[r&&(0,s.jsx)(na.Text,{className:"mb-2",children:r}),(0,s.jsxs)("div",{className:"relative w-fit",children:[(0,s.jsx)("div",{ref:u,children:(0,s.jsx)(nn,{enableSelect:!0,value:e,onValueChange:d,placeholder:"Select date range",enableClear:!1,style:{zIndex:100}})}),o&&(0,s.jsx)("div",{className:"absolute top-1/2 animate-pulse",style:{left:"calc(100% + 8px)",transform:"translateY(-50%)",zIndex:110},children:(0,s.jsxs)("div",{className:"flex items-center gap-1 text-green-600 text-sm font-medium bg-white px-2 py-1 rounded-full border border-green-200 shadow-sm whitespace-nowrap",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-green-500 text-white rounded-full flex items-center justify-center text-xs",children:"✓"}),(0,s.jsx)("span",{className:"text-xs",children:"Selected"})]})})]}),a&&e.from&&e.to&&(0,s.jsx)(na.Text,{className:"mt-2 text-xs text-gray-500",children:c(e.from,e.to)})]})}],144267)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0a671fedee641c02.js b/litellm/proxy/_experimental/out/_next/static/chunks/0a671fedee641c02.js new file mode 100644 index 00000000000..6fca76c9838 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0a671fedee641c02.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,241902,e=>{"use strict";var t,r=e.i(843476),s=e.i(271645),l=e.i(752978),a=e.i(994388),o=e.i(309426),i=e.i(599724),n=e.i(350967),c=e.i(653824),d=e.i(881073),m=e.i(197647),x=e.i(723731),u=e.i(404206),h=e.i(278587),p=e.i(764205),v=e.i(871943),g=e.i(360820),j=e.i(94629),f=e.i(152990),b=e.i(682830),y=e.i(269200),_=e.i(942232),w=e.i(977572),N=e.i(427612),S=e.i(64848),C=e.i(496020),I=e.i(592968),T=e.i(902555),k=e.i(916925);let A=({data:e,onView:t,onEdit:l,onDelete:a})=>{let[o,i]=s.default.useState([{id:"created_at",desc:!0}]),n=[{header:"Vector Store ID",accessorKey:"vector_store_id",cell:({row:e})=>{let s=e.original;return(0,r.jsx)("button",{onClick:()=>t(s.vector_store_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:s.vector_store_id.length>15?`${s.vector_store_id.slice(0,15)}...`:s.vector_store_id})}},{header:"Name",accessorKey:"vector_store_name",cell:({row:e})=>{let t=e.original;return(0,r.jsx)(I.Tooltip,{title:t.vector_store_name,children:(0,r.jsx)("span",{className:"text-xs",children:t.vector_store_name||"-"})})}},{header:"Description",accessorKey:"vector_store_description",cell:({row:e})=>{let t=e.original;return(0,r.jsx)(I.Tooltip,{title:t.vector_store_description,children:(0,r.jsx)("span",{className:"text-xs",children:t.vector_store_description||"-"})})}},{header:"Files",accessorKey:"vector_store_metadata",cell:({row:e})=>{let t=e.original,s=t.vector_store_metadata?.ingested_files||[];if(0===s.length)return(0,r.jsx)("span",{className:"text-xs text-gray-400",children:"-"});let l=s.map(e=>e.filename||e.file_url||"Unknown").join(", "),a=1===s.length?s[0].filename||s[0].file_url||"1 file":`${s.length} files`;return(0,r.jsx)(I.Tooltip,{title:l,children:(0,r.jsx)("span",{className:"text-xs text-blue-600",children:a})})}},{header:"Provider",accessorKey:"custom_llm_provider",cell:({row:e})=>{let t=e.original,{displayName:s,logo:l}=(0,k.getProviderLogoAndName)(t.custom_llm_provider);return(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[l&&(0,r.jsx)("img",{src:l,alt:s,className:"h-4 w-4"}),(0,r.jsx)("span",{className:"text-xs",children:s})]})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:({row:e})=>{let t=e.original;return(0,r.jsx)("span",{className:"text-xs",children:new Date(t.created_at).toLocaleDateString()})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:({row:e})=>{let t=e.original;return(0,r.jsx)("span",{className:"text-xs",children:new Date(t.updated_at).toLocaleDateString()})}},{id:"actions",header:"",cell:({row:e})=>{let t=e.original;return(0,r.jsxs)("div",{className:"flex space-x-2",children:[(0,r.jsx)(T.default,{variant:"Edit",tooltipText:"Edit vector store",onClick:()=>l(t.vector_store_id)}),(0,r.jsx)(T.default,{variant:"Delete",tooltipText:"Delete vector store",onClick:()=>a(t.vector_store_id)})]})}}],c=(0,f.useReactTable)({data:e,columns:n,state:{sorting:o},onSortingChange:i,getCoreRowModel:(0,b.getCoreRowModel)(),getSortedRowModel:(0,b.getSortedRowModel)(),enableSorting:!0});return(0,r.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)(y.Table,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,r.jsx)(N.TableHead,{children:c.getHeaderGroups().map(e=>(0,r.jsx)(C.TableRow,{children:e.headers.map(e=>(0,r.jsx)(S.TableHeaderCell,{className:`py-1 h-8 ${"actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,onClick:e.column.getToggleSortingHandler(),children:(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,f.flexRender)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,r.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,r.jsx)(g.ChevronUpIcon,{className:"h-4 w-4 text-blue-500"}),desc:(0,r.jsx)(v.ChevronDownIcon,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,r.jsx)(j.SwitchVerticalIcon,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,r.jsx)(_.TableBody,{children:c.getRowModel().rows.length>0?c.getRowModel().rows.map(e=>(0,r.jsx)(C.TableRow,{className:"h-8",children:e.getVisibleCells().map(e=>(0,r.jsx)(w.TableCell,{className:`py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ${"actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""}`,children:(0,f.flexRender)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,r.jsx)(C.TableRow,{children:(0,r.jsx)(w.TableCell,{colSpan:n.length,className:"h-8 text-center",children:(0,r.jsx)("div",{className:"text-center text-gray-500",children:(0,r.jsx)("p",{children:"No vector stores found"})})})})})]})})})};var L=e.i(779241),V=e.i(212931),O=e.i(808613),E=e.i(199133),D=e.i(311451),P=e.i(560445),F=e.i(827252),B=((t={}).Bedrock="Amazon Bedrock",t.S3Vectors="Amazon S3 Vectors",t.PgVector="PostgreSQL pgvector (LiteLLM Connector)",t.VertexRagEngine="Vertex AI RAG Engine",t.OpenAI="OpenAI",t.Azure="Azure OpenAI",t.Milvus="Milvus",t);let z={Bedrock:"bedrock",PgVector:"pg_vector",VertexRagEngine:"vertex_ai",OpenAI:"openai",Azure:"azure",Milvus:"milvus",S3Vectors:"s3_vectors"},R="../ui/assets/logos/",M={"Amazon Bedrock":`${R}bedrock.svg`,"PostgreSQL pgvector (LiteLLM Connector)":`${R}postgresql.svg`,"Vertex AI RAG Engine":`${R}google.svg`,OpenAI:`${R}openai_small.svg`,"Azure OpenAI":`${R}microsoft_azure.svg`,Milvus:`${R}milvus.svg`,"Amazon S3 Vectors":`${R}s3_vector.png`},q={bedrock:[],pg_vector:[{name:"api_base",label:"API Base",tooltip:"Enter the base URL of your deployed litellm-pgvector server (e.g., http://your-server:8000)",placeholder:"http://your-deployed-server:8000",required:!0,type:"text"},{name:"api_key",label:"API Key",tooltip:"Enter the API key from your deployed litellm-pgvector server",placeholder:"your-deployed-api-key",required:!0,type:"password"}],vertex_rag_engine:[],openai:[{name:"api_key",label:"API Key",tooltip:"Enter your OpenAI API key",placeholder:"sk-...",required:!0,type:"password"}],azure:[{name:"api_key",label:"API Key",tooltip:"Enter your Azure OpenAI API key",placeholder:"your-azure-api-key",required:!0,type:"password"},{name:"api_base",label:"API Base",tooltip:"Enter your Azure OpenAI endpoint (e.g., https://your-resource.openai.azure.com/)",placeholder:"https://your-resource.openai.azure.com/",required:!0,type:"text"}],milvus:[{name:"api_key",label:"API Key",tooltip:"To obtain a token, you should use a colon (:) to concatenate the username and password that you use to access your Milvus instance (e.g., username:password)",placeholder:"username:password or api key",required:!0,type:"password"},{name:"api_base",label:"API Base",tooltip:"Enter your Milvus endpoint (e.g., https://your-milvus-endpoint.com/)",placeholder:"https://your-milvus-endpoint.com/",required:!0,type:"text"},{name:"embedding_model",label:"Embedding Model",tooltip:"Select the embedding model to use",placeholder:"text-embedding-3-small",required:!0,type:"select"}],s3_vectors:[{name:"vector_bucket_name",label:"Vector Bucket Name",tooltip:"S3 bucket name for vector storage (will be auto-created if it doesn't exist)",placeholder:"my-vector-bucket",required:!0,type:"text"},{name:"index_name",label:"Index Name",tooltip:"Name for the vector index (optional, will be auto-generated if not provided)",placeholder:"my-vector-index",required:!1,type:"text"},{name:"aws_region_name",label:"AWS Region",tooltip:"AWS region where the S3 bucket is located (e.g., us-west-2)",placeholder:"us-west-2",required:!0,type:"text"},{name:"embedding_model",label:"Embedding Model",tooltip:"Select the embedding model to use for vector generation",placeholder:"text-embedding-3-small",required:!0,type:"select"}]},$=e=>q[e]||[];var U=e.i(689020),K=e.i(727749);let G=({isVisible:e,onCancel:t,onSuccess:l,accessToken:o,credentials:i})=>{let[n]=O.Form.useForm(),[c,d]=(0,s.useState)("{}"),[m,x]=(0,s.useState)("bedrock"),[u,h]=(0,s.useState)([]);(0,s.useEffect)(()=>{o&&(async()=>{try{let e=await (0,U.fetchAvailableModels)(o);e.length>0&&h(e)}catch(e){console.error("Error fetching model info:",e)}})()},[o]);let v=async e=>{if(o)try{let t={};try{t=c.trim()?JSON.parse(c):{}}catch(e){K.default.fromBackend("Invalid JSON in metadata field");return}let r={vector_store_id:e.vector_store_id,custom_llm_provider:e.custom_llm_provider,vector_store_name:e.vector_store_name,vector_store_description:e.vector_store_description,vector_store_metadata:t,litellm_credential_name:e.litellm_credential_name};r.litellm_params=$(e.custom_llm_provider).reduce((t,r)=>("milvus"===e.custom_llm_provider&&"embedding_model"===r.name?t.litellm_embedding_model=e[r.name]:t[r.name]=e[r.name],t),{}),await (0,p.vectorStoreCreateCall)(o,r),K.default.success("Vector store created successfully"),n.resetFields(),d("{}"),l()}catch(e){console.error("Error creating vector store:",e),K.default.fromBackend("Error creating vector store: "+e)}},g=()=>{n.resetFields(),d("{}"),x("bedrock"),t()};return(0,r.jsx)(V.Modal,{title:"Add New Vector Store",open:e,width:1e3,footer:null,onCancel:g,children:(0,r.jsxs)(O.Form,{form:n,onFinish:v,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Provider"," ",(0,r.jsx)(I.Tooltip,{title:"Select the provider for this vector store",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"custom_llm_provider",rules:[{required:!0,message:"Please select a provider"}],initialValue:"bedrock",children:(0,r.jsx)(E.Select,{onChange:e=>x(e),children:Object.entries(B).map(([e,t])=>(0,r.jsx)(E.Select.Option,{value:z[e],children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("img",{src:M[t],alt:`${e} logo`,className:"w-5 h-5",onError:e=>{let r=e.target,s=r.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,r)}}}),(0,r.jsx)("span",{children:t})]})},e))})}),"pg_vector"===m&&(0,r.jsx)(P.Alert,{message:"PG Vector Setup Required",description:(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{children:"LiteLLM provides a server to connect to PG Vector. To use this provider:"}),(0,r.jsxs)("ol",{style:{marginLeft:"16px",marginTop:"8px"},children:[(0,r.jsxs)("li",{children:["Deploy the litellm-pgvector server from:"," ",(0,r.jsx)("a",{href:"https://github.com/BerriAI/litellm-pgvector",target:"_blank",rel:"noopener noreferrer",children:"https://github.com/BerriAI/litellm-pgvector"})]}),(0,r.jsx)("li",{children:"Configure your PostgreSQL database with pgvector extension"}),(0,r.jsx)("li",{children:"Start the server and note the API base URL and API key"}),(0,r.jsx)("li",{children:"Enter those details in the fields below"})]})]}),type:"info",showIcon:!0,style:{marginBottom:"16px"}}),"vertex_rag_engine"===m&&(0,r.jsx)(P.Alert,{message:"Vertex AI RAG Engine Setup",description:(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{children:"To use Vertex AI RAG Engine:"}),(0,r.jsxs)("ol",{style:{marginLeft:"16px",marginTop:"8px"},children:[(0,r.jsxs)("li",{children:["Set up your Vertex AI RAG Engine corpus following the guide:"," ",(0,r.jsx)("a",{href:"https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/rag-overview",target:"_blank",rel:"noopener noreferrer",children:"Vertex AI RAG Engine Overview"})]}),(0,r.jsx)("li",{children:"Create a corpus in your Google Cloud project"}),(0,r.jsx)("li",{children:"Note the corpus ID from the Vertex AI console"}),(0,r.jsx)("li",{children:"Enter the corpus ID in the Vector Store ID field below"})]})]}),type:"info",showIcon:!0,style:{marginBottom:"16px"}}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Vector Store ID"," ",(0,r.jsx)(I.Tooltip,{title:"Enter the vector store ID from your api provider",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"vector_store_id",rules:[{required:!0,message:"Please input the vector store ID from your api provider"}],children:(0,r.jsx)(L.TextInput,{placeholder:"vertex_rag_engine"===m?"6917529027641081856 (Get corpus ID from Vertex AI console)":"Enter vector store ID from your provider"})}),$(m).map(e=>{if("select"===e.type){let t=u.filter(e=>"embedding"===e.mode||null===e.mode).map(e=>({value:e.model_group,label:e.model_group}));return(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:[e.label," ",(0,r.jsx)(I.Tooltip,{title:e.tooltip,children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:e.name,rules:e.required?[{required:!0,message:`Please select the ${e.label.toLowerCase()}`}]:[],children:(0,r.jsx)(E.Select,{placeholder:e.placeholder,showSearch:!0,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:t,style:{width:"100%"}})},e.name)}return(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:[e.label," ",(0,r.jsx)(I.Tooltip,{title:e.tooltip,children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:e.name,rules:e.required?[{required:!0,message:`Please input the ${e.label.toLowerCase()}`}]:[],children:(0,r.jsx)(L.TextInput,{type:e.type||"text",placeholder:e.placeholder})},e.name)}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Vector Store Name"," ",(0,r.jsx)(I.Tooltip,{title:"Custom name you want to give to the vector store, this name will be rendered on the LiteLLM UI",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"vector_store_name",children:(0,r.jsx)(L.TextInput,{})}),(0,r.jsx)(O.Form.Item,{label:"Description",name:"vector_store_description",children:(0,r.jsx)(D.Input.TextArea,{rows:4})}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Existing Credentials"," ",(0,r.jsx)(I.Tooltip,{title:"Optionally select API provider credentials for this vector store eg. Bedrock API KEY",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"litellm_credential_name",children:(0,r.jsx)(E.Select,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:[{value:null,label:"None"},...i.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Metadata"," ",(0,r.jsx)(I.Tooltip,{title:"JSON metadata for the vector store (optional)",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),children:(0,r.jsx)(D.Input.TextArea,{rows:4,value:c,onChange:e=>d(e.target.value),placeholder:'{"key": "value"}'})}),(0,r.jsxs)("div",{className:"flex justify-end space-x-3",children:[(0,r.jsx)(a.Button,{onClick:g,variant:"secondary",children:"Cancel"}),(0,r.jsx)(a.Button,{variant:"primary",type:"submit",children:"Create"})]})]})})};var H=e.i(127952),J=e.i(304967),W=e.i(629569),X=e.i(389083),Q=e.i(464571),Y=e.i(530212),Z=e.i(175712),ee=e.i(898586),et=e.i(482725),er=e.i(998573),es=e.i(312361);e.i(247167);var el=e.i(931067),ea={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"}}]},name:"send",theme:"outlined"},eo=e.i(9583),ei=s.forwardRef(function(e,t){return s.createElement(eo.default,(0,el.default)({},e,{ref:t,icon:ea}))}),en=e.i(210612),ec=e.i(56456),ed=e.i(755151),em=e.i(240647);let{TextArea:ex}=D.Input,{Text:eu,Title:eh}=ee.Typography,ep=({vectorStoreId:e,accessToken:t,className:l=""})=>{let[a,o]=(0,s.useState)(""),[i,n]=(0,s.useState)(!1),[c,d]=(0,s.useState)([]),[m,x]=(0,s.useState)({}),u=async()=>{if(!a.trim())return void er.message.warning("Please enter a search query");n(!0);try{let r=await (0,p.vectorStoreSearchCall)(t,e,a),s={query:a,response:r,timestamp:Date.now()};d(e=>[s,...e]),o("")}catch(e){console.error("Error searching vector store:",e),K.default.fromBackend("Failed to search vector store")}finally{n(!1)}};return(0,r.jsx)(Z.Card,{className:"w-full rounded-xl shadow-md",children:(0,r.jsxs)("div",{className:"flex flex-col h-[600px]",children:[(0,r.jsxs)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(en.DatabaseOutlined,{className:"mr-2 text-blue-500"}),(0,r.jsx)(eh,{level:4,className:"mb-0",children:"Test Vector Store"})]}),c.length>0&&(0,r.jsx)(Q.Button,{onClick:()=>{d([]),x({}),K.default.success("Search history cleared")},size:"small",children:"Clear History"})]}),(0,r.jsxs)("div",{className:"flex-1 overflow-auto p-4 pb-0",children:[0===c.length?(0,r.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,r.jsx)(en.DatabaseOutlined,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,r.jsx)(eu,{children:"Test your vector store by entering a search query below"})]}):(0,r.jsx)("div",{className:"space-y-4",children:c.map((e,t)=>(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"text-right",children:(0,r.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3 bg-blue-50 border border-blue-200",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)("strong",{className:"text-sm",children:"Query"}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:new Date(e.timestamp).toLocaleString()})]}),(0,r.jsx)("div",{className:"text-left",children:e.query})]})}),(0,r.jsx)("div",{className:"text-left",children:(0,r.jsxs)("div",{className:"inline-block max-w-[80%] rounded-lg shadow-sm p-3 bg-white border border-gray-200",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,r.jsx)(en.DatabaseOutlined,{className:"text-green-500"}),(0,r.jsx)("strong",{className:"text-sm",children:"Vector Store Results"}),e.response&&(0,r.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded bg-gray-100 text-gray-600",children:[e.response.data?.length||0," results"]})]}),e.response&&e.response.data&&e.response.data.length>0?(0,r.jsx)("div",{className:"space-y-3",children:e.response.data.map((e,s)=>{let l=m[`${t}-${s}`]||!1;return(0,r.jsxs)("div",{className:"border rounded-lg overflow-hidden bg-gray-50",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center p-3 cursor-pointer hover:bg-gray-100 transition-colors",onClick:()=>{let e;return e=`${t}-${s}`,void x(t=>({...t,[e]:!t[e]}))},children:[(0,r.jsxs)("div",{className:"flex items-center",children:[l?(0,r.jsx)(ed.DownOutlined,{className:"text-gray-500 mr-2"}):(0,r.jsx)(em.RightOutlined,{className:"text-gray-500 mr-2"}),(0,r.jsxs)("span",{className:"font-medium text-sm",children:["Result ",s+1]}),!l&&e.content&&e.content[0]&&(0,r.jsxs)("span",{className:"ml-2 text-xs text-gray-500 truncate max-w-md",children:["- ",e.content[0].text.substring(0,100),"..."]})]}),(0,r.jsxs)("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:["Score: ",e.score.toFixed(4)]})]}),l&&(0,r.jsxs)("div",{className:"border-t bg-white p-3",children:[e.content&&e.content.map((e,t)=>(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsxs)("div",{className:"text-xs text-gray-500 mb-1",children:["Content (",e.type,")"]}),(0,r.jsx)("div",{className:"text-sm bg-gray-50 p-3 rounded border text-gray-800 max-h-40 overflow-y-auto",children:e.text})]},t)),(e.file_id||e.filename||e.attributes)&&(0,r.jsxs)("div",{className:"mt-3 pt-3 border-t border-gray-200",children:[(0,r.jsx)("div",{className:"text-xs text-gray-500 mb-2 font-medium",children:"Metadata"}),(0,r.jsxs)("div",{className:"space-y-2 text-xs",children:[e.file_id&&(0,r.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,r.jsx)("span",{className:"font-medium",children:"File ID:"})," ",e.file_id]}),e.filename&&(0,r.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,r.jsx)("span",{className:"font-medium",children:"Filename:"})," ",e.filename]}),e.attributes&&Object.keys(e.attributes).length>0&&(0,r.jsxs)("div",{className:"bg-gray-50 p-2 rounded",children:[(0,r.jsx)("span",{className:"font-medium block mb-1",children:"Attributes:"}),(0,r.jsx)("pre",{className:"text-xs bg-white p-2 rounded border overflow-x-auto",children:JSON.stringify(e.attributes,null,2)})]})]})]})]})]},s)})}):(0,r.jsx)("div",{className:"text-gray-500 text-sm",children:"No results found"})]})}),to(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),u())},placeholder:"Enter your search query... (Shift+Enter for new line)",disabled:i,autoSize:{minRows:1,maxRows:4},style:{resize:"none"}})}),(0,r.jsx)(Q.Button,{type:"primary",onClick:u,disabled:i||!a.trim(),icon:(0,r.jsx)(ei,{}),loading:i,children:"Search"})]})})]})})},ev=({vectorStoreId:e,onClose:t,accessToken:l,is_admin:o,editVectorStore:n})=>{let[h]=O.Form.useForm(),[v,g]=(0,s.useState)(null),[j,f]=(0,s.useState)(n),[b,y]=(0,s.useState)("{}"),[_,w]=(0,s.useState)([]),[N,S]=(0,s.useState)("details"),C=async()=>{if(l)try{let t=await (0,p.vectorStoreInfoCall)(l,e);if(t&&t.vector_store){if(g(t.vector_store),t.vector_store.vector_store_metadata){let e="string"==typeof t.vector_store.vector_store_metadata?JSON.parse(t.vector_store.vector_store_metadata):t.vector_store.vector_store_metadata;y(JSON.stringify(e,null,2))}n&&h.setFieldsValue({vector_store_id:t.vector_store.vector_store_id,custom_llm_provider:t.vector_store.custom_llm_provider,vector_store_name:t.vector_store.vector_store_name,vector_store_description:t.vector_store.vector_store_description})}}catch(e){console.error("Error fetching vector store details:",e),K.default.fromBackend("Error fetching vector store details: "+e)}},T=async()=>{if(l)try{let e=await (0,p.credentialListCall)(l);console.log("List credentials response:",e),w(e.credentials||[])}catch(e){console.error("Error fetching credentials:",e)}};(0,s.useEffect)(()=>{C(),T()},[e,l]);let A=async e=>{if(l)try{let t={};try{t=b?JSON.parse(b):{}}catch(e){K.default.fromBackend("Invalid JSON in metadata field");return}let r={vector_store_id:e.vector_store_id,custom_llm_provider:e.custom_llm_provider,vector_store_name:e.vector_store_name,vector_store_description:e.vector_store_description,vector_store_metadata:t};await (0,p.vectorStoreUpdateCall)(l,r),K.default.success("Vector store updated successfully"),f(!1),C()}catch(e){console.error("Error updating vector store:",e),K.default.fromBackend("Error updating vector store: "+e)}};return v?(0,r.jsxs)("div",{className:"p-4 max-w-full",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(a.Button,{icon:Y.ArrowLeftIcon,variant:"light",className:"mb-4",onClick:t,children:"Back to Vector Stores"}),(0,r.jsxs)(W.Title,{children:["Vector Store ID: ",v.vector_store_id]}),(0,r.jsx)(i.Text,{className:"text-gray-500",children:v.vector_store_description||"No description"})]}),o&&!j&&(0,r.jsx)(a.Button,{onClick:()=>f(!0),children:"Edit Vector Store"})]}),(0,r.jsxs)(c.TabGroup,{children:[(0,r.jsxs)(d.TabList,{className:"mb-6",children:[(0,r.jsx)(m.Tab,{children:"Details"}),(0,r.jsx)(m.Tab,{children:"Test Vector Store"})]}),(0,r.jsxs)(x.TabPanels,{children:[(0,r.jsx)(u.TabPanel,{children:j?(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,r.jsx)(W.Title,{children:"Edit Vector Store"})}),(0,r.jsx)(J.Card,{children:(0,r.jsxs)(O.Form,{form:h,onFinish:A,layout:"vertical",initialValues:v,children:[(0,r.jsx)(O.Form.Item,{label:"Vector Store ID",name:"vector_store_id",rules:[{required:!0,message:"Please input a vector store ID"}],children:(0,r.jsx)(D.Input,{disabled:!0})}),(0,r.jsx)(O.Form.Item,{label:"Vector Store Name",name:"vector_store_name",children:(0,r.jsx)(D.Input,{})}),(0,r.jsx)(O.Form.Item,{label:"Description",name:"vector_store_description",children:(0,r.jsx)(D.Input.TextArea,{rows:4})}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Provider"," ",(0,r.jsx)(I.Tooltip,{title:"Select the provider for this vector store",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),name:"custom_llm_provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,r.jsx)(E.Select,{children:Object.entries(k.Providers).map(([e,t])=>"Bedrock"===e?(0,r.jsx)(E.Select.Option,{value:k.provider_map[e],children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("img",{src:k.providerLogoMap[t],alt:`${e} logo`,className:"w-5 h-5",onError:e=>{let r=e.target,s=r.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,r)}}}),(0,r.jsx)("span",{children:t})]})},e):null)})}),(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(i.Text,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter provider credentials below"})}),(0,r.jsx)(O.Form.Item,{label:"Existing Credentials",name:"litellm_credential_name",children:(0,r.jsx)(E.Select,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:[{value:null,label:"None"},..._.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,r.jsxs)("div",{className:"flex items-center my-4",children:[(0,r.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,r.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,r.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Metadata"," ",(0,r.jsx)(I.Tooltip,{title:"JSON metadata for the vector store",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),children:(0,r.jsx)(D.Input.TextArea,{rows:4,value:b,onChange:e=>y(e.target.value),placeholder:'{"key": "value"}'})}),(0,r.jsxs)("div",{className:"flex justify-end space-x-2",children:[(0,r.jsx)(Q.Button,{onClick:()=>f(!1),children:"Cancel"}),(0,r.jsx)(Q.Button,{type:"primary",htmlType:"submit",children:"Save Changes"})]})]})})]}):(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,r.jsx)(W.Title,{children:"Vector Store Details"}),o&&(0,r.jsx)(a.Button,{onClick:()=>f(!0),children:"Edit Vector Store"})]}),(0,r.jsx)(J.Card,{children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(i.Text,{className:"font-medium",children:"ID"}),(0,r.jsx)(i.Text,{children:v.vector_store_id})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(i.Text,{className:"font-medium",children:"Name"}),(0,r.jsx)(i.Text,{children:v.vector_store_name||"-"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(i.Text,{className:"font-medium",children:"Description"}),(0,r.jsx)(i.Text,{children:v.vector_store_description||"-"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(i.Text,{className:"font-medium",children:"Provider"}),(0,r.jsx)("div",{className:"flex items-center space-x-2 mt-1",children:(()=>{let e=v.custom_llm_provider||"bedrock",{displayName:t,logo:s}=(()=>{let t=Object.keys(k.provider_map).find(t=>k.provider_map[t].toLowerCase()===e.toLowerCase());if(!t)return{displayName:e,logo:""};let r=k.Providers[t],s=k.providerLogoMap[r];return{displayName:r,logo:s}})();return(0,r.jsxs)(r.Fragment,{children:[s&&(0,r.jsx)("img",{src:s,alt:`${t} logo`,className:"w-5 h-5",onError:e=>{let r=e.target,s=r.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,r)}}}),(0,r.jsx)(X.Badge,{color:"blue",children:t})]})})()})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(i.Text,{className:"font-medium",children:"Metadata"}),(0,r.jsx)("div",{className:"bg-gray-50 p-3 rounded mt-2 font-mono text-xs overflow-auto max-h-48",children:(0,r.jsx)("pre",{children:b})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(i.Text,{className:"font-medium",children:"Created"}),(0,r.jsx)(i.Text,{children:v.created_at?new Date(v.created_at).toLocaleString():"-"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(i.Text,{className:"font-medium",children:"Last Updated"}),(0,r.jsx)(i.Text,{children:v.updated_at?new Date(v.updated_at).toLocaleString():"-"})]})]})})]})}),(0,r.jsx)(u.TabPanel,{children:(0,r.jsx)(ep,{vectorStoreId:v.vector_store_id,accessToken:l||""})})]})]})]}):(0,r.jsx)("div",{children:"Loading..."})};var eg=e.i(515831);let ej={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M885.2 446.3l-.2-.8-112.2-285.1c-5-16.1-19.9-27.2-36.8-27.2H281.2c-17 0-32.1 11.3-36.9 27.6L139.4 443l-.3.7-.2.8c-1.3 4.9-1.7 9.9-1 14.8-.1 1.6-.2 3.2-.2 4.8V830a60.9 60.9 0 0060.8 60.8h627.2c33.5 0 60.8-27.3 60.9-60.8V464.1c0-1.3 0-2.6-.1-3.7.4-4.9 0-9.6-1.3-14.1zm-295.8-43l-.3 15.7c-.8 44.9-31.8 75.1-77.1 75.1-22.1 0-41.1-7.1-54.8-20.6S436 441.2 435.6 419l-.3-15.7H229.5L309 210h399.2l81.7 193.3H589.4zm-375 76.8h157.3c24.3 57.1 76 90.8 140.4 90.8 33.7 0 65-9.4 90.3-27.2 22.2-15.6 39.5-37.4 50.7-63.6h156.5V814H214.4V480.1z"}}]},name:"inbox",theme:"outlined"};var ef=s.forwardRef(function(e,t){return s.createElement(eo.default,(0,el.default)({},e,{ref:t,icon:ej}))}),eb=e.i(291542),ey=e.i(906579),e_=e.i(984125),e_=e_,ew=e.i(166406),eN=e.i(955135);let eS=({documents:e,onRemove:t})=>{let s=[{title:"Name",dataIndex:"name",key:"name",render:(e,t)=>(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("span",{className:"text-sm",children:e}),t.size&&(0,r.jsxs)("span",{className:"text-xs text-gray-400",children:["(",(e=>{if(!e)return"-";let t=e/1024;return t<1024?`${t.toFixed(2)} KB`:`${(t/1024).toFixed(2)} MB`})(t.size),")"]})]})},{title:"Status",dataIndex:"status",key:"status",width:150,render:e=>{let t;return t=({uploading:{color:"blue",text:"Uploading"},done:{color:"green",text:"Ready"},error:{color:"red",text:"Error"},removed:{color:"default",text:"Removed"}})[e],(0,r.jsx)(ey.Badge,{color:t.color,text:t.text})}},{title:"Actions",key:"actions",width:120,render:(e,s)=>(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(I.Tooltip,{title:"View details",children:(0,r.jsx)(e_.default,{className:"cursor-pointer text-gray-600 hover:text-blue-500",onClick:()=>console.log("View",s)})}),(0,r.jsx)(I.Tooltip,{title:"Copy ID",children:(0,r.jsx)(ew.CopyOutlined,{className:"cursor-pointer text-gray-600 hover:text-blue-500",onClick:()=>{var e;return e=s.uid,void(navigator.clipboard.writeText(e),er.message.success("Document ID copied to clipboard"))}})}),(0,r.jsx)(I.Tooltip,{title:"Remove",children:(0,r.jsx)(eN.DeleteOutlined,{className:"cursor-pointer text-gray-600 hover:text-red-500",onClick:()=>t(s.uid)})})]})}];return(0,r.jsx)(eb.Table,{dataSource:e,columns:s,rowKey:"uid",pagination:!1,locale:{emptyText:"No documents uploaded yet. Upload documents above to get started."},size:"small"})},eC=({accessToken:e,providerParams:t,onParamsChange:l})=>{let[a,o]=(0,s.useState)([]),[i,n]=(0,s.useState)(!1);(0,s.useEffect)(()=>{e&&(async()=>{n(!0);try{let t=(await (0,U.fetchAvailableModels)(e)).filter(e=>"embedding"===e.mode);o(t)}catch(e){console.error("Error fetching embedding models:",e)}finally{n(!1)}})()},[e]);let c=(e,r)=>{l({...t,[e]:r})};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(P.Alert,{message:"AWS S3 Vectors Setup",description:(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{children:"AWS S3 Vectors allows you to store and query vector embeddings directly in S3:"}),(0,r.jsxs)("ul",{style:{marginLeft:"16px",marginTop:"8px"},children:[(0,r.jsx)("li",{children:"Vector buckets and indexes will be automatically created if they don't exist"}),(0,r.jsx)("li",{children:"Vector dimensions are auto-detected from your selected embedding model"}),(0,r.jsx)("li",{children:"Ensure your AWS credentials have permissions for S3 Vectors operations"}),(0,r.jsxs)("li",{children:["Learn more:"," ",(0,r.jsx)("a",{href:"https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-vector-buckets.html",target:"_blank",rel:"noopener noreferrer",children:"AWS S3 Vectors Documentation"})]})]})]}),type:"info",showIcon:!0,style:{marginBottom:"16px"}}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Vector Bucket Name"," ",(0,r.jsx)(I.Tooltip,{title:"S3 bucket name for vector storage (must be at least 3 characters, lowercase letters, numbers, hyphens, and periods only)",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),required:!0,validateStatus:t.vector_bucket_name&&t.vector_bucket_name.length<3?"error":void 0,help:t.vector_bucket_name&&t.vector_bucket_name.length<3?"Bucket name must be at least 3 characters":void 0,children:(0,r.jsx)(D.Input,{value:t.vector_bucket_name||"",onChange:e=>c("vector_bucket_name",e.target.value),placeholder:"my-vector-bucket (min 3 chars)",size:"large",className:"rounded-md"})}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Index Name"," ",(0,r.jsx)(I.Tooltip,{title:"Name for the vector index (optional, will be auto-generated if not provided). If provided, must be at least 3 characters.",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),validateStatus:t.index_name&&t.index_name.length>0&&t.index_name.length<3?"error":void 0,help:t.index_name&&t.index_name.length>0&&t.index_name.length<3?"Index name must be at least 3 characters if provided":void 0,children:(0,r.jsx)(D.Input,{value:t.index_name||"",onChange:e=>c("index_name",e.target.value),placeholder:"my-vector-index (optional, min 3 chars)",size:"large",className:"rounded-md"})}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["AWS Region"," ",(0,r.jsx)(I.Tooltip,{title:"AWS region where the S3 bucket is located (e.g., us-west-2)",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),required:!0,children:(0,r.jsx)(D.Input,{value:t.aws_region_name||"",onChange:e=>c("aws_region_name",e.target.value),placeholder:"us-west-2",size:"large",className:"rounded-md"})}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Embedding Model"," ",(0,r.jsx)(I.Tooltip,{title:"Select the embedding model to use for vector generation",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),required:!0,children:(0,r.jsx)(E.Select,{value:t.embedding_model||void 0,onChange:e=>c("embedding_model",e),placeholder:"Select an embedding model",size:"large",showSearch:!0,loading:i,filterOption:(e,t)=>(t?.label??"").toLowerCase().includes(e.toLowerCase()),options:a.map(e=>({value:e.model_group,label:e.model_group})),style:{width:"100%"}})})]})},{Dragger:eI}=eg.Upload,eT=({accessToken:e,onSuccess:t})=>{let[l]=O.Form.useForm(),[a,o]=(0,s.useState)([]),[n,c]=(0,s.useState)(!1),[d,m]=(0,s.useState)("bedrock"),[x,u]=(0,s.useState)(""),[h,v]=(0,s.useState)(""),[g,j]=(0,s.useState)([]),[f,b]=(0,s.useState)({}),y={name:"file",multiple:!0,accept:".pdf,.txt,.docx,.md,.doc",beforeUpload:e=>{if(!["application/pdf","text/plain","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/msword","text/markdown"].includes(e.type))return er.message.error(`${e.name} is not a supported file type. Please upload PDF, TXT, DOCX, or MD files.`),eg.Upload.LIST_IGNORE;if(!(e.size/1024/1024<50))return er.message.error(`${e.name} must be smaller than 50MB!`),eg.Upload.LIST_IGNORE;let t={uid:e.uid,name:e.name,status:"done",size:e.size,type:e.type,originFileObj:e};return o(e=>[...e,t]),!1},onRemove:e=>{o(t=>t.filter(t=>t.uid!==e.uid))},fileList:a.map(e=>({uid:e.uid,name:e.name,status:e.status,size:e.size})),showUploadList:!1},_=async()=>{let r;if(0===a.length)return void er.message.warning("Please upload at least one document");if(!d)return void er.message.warning("Please select a provider");for(let e of $(d).filter(e=>e.required))if(!f[e.name])return void er.message.warning(`Please provide ${e.label}`);if("s3_vectors"===d){if(f.vector_bucket_name&&f.vector_bucket_name.length<3)return void er.message.warning("Vector bucket name must be at least 3 characters");if(f.index_name&&f.index_name.length>0&&f.index_name.length<3)return void er.message.warning("Index name must be at least 3 characters if provided")}if(!e)return void er.message.error("No access token available");c(!0);let s=[];try{for(let t of a)if(t.originFileObj){o(e=>e.map(e=>e.uid===t.uid?{...e,status:"uploading"}:e));try{let l=await (0,p.ragIngestCall)(e,t.originFileObj,d,r,x||void 0,h||void 0,f);!r&&l.vector_store_id&&(r=l.vector_store_id),s.push(l),o(e=>e.map(e=>e.uid===t.uid?{...e,status:"done"}:e))}catch(e){throw console.error(`Error ingesting ${t.name}:`,e),o(e=>e.map(e=>e.uid===t.uid?{...e,status:"error"}:e)),e}}j(s),K.default.success(`Successfully created vector store with ${s.length} document(s). Vector Store ID: ${r}`),t&&r&&t(r),setTimeout(()=>{o([]),j([])},3e3)}catch(e){console.error("Error creating vector store:",e),K.default.fromBackend(`Failed to create vector store: ${e}`)}finally{c(!1)}};return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(W.Title,{children:"Create Vector Store"}),(0,r.jsx)(i.Text,{className:"text-gray-500",children:"Upload documents and select a provider to create a new vector store with embedded content."})]}),(0,r.jsxs)(J.Card,{children:[(0,r.jsxs)("div",{className:"mb-4",children:[(0,r.jsx)(i.Text,{className:"font-medium",children:"Step 1: Upload Documents"}),(0,r.jsx)(i.Text,{className:"text-sm text-gray-500 block mt-1",children:"Upload one or more documents (PDF, TXT, DOCX, MD). Maximum file size: 50MB per file."})]}),(0,r.jsxs)(eI,{...y,children:[(0,r.jsx)("p",{className:"ant-upload-drag-icon",children:(0,r.jsx)(ef,{style:{fontSize:"48px",color:"#1890ff"}})}),(0,r.jsx)("p",{className:"ant-upload-text",children:"Click or drag files to this area to upload"}),(0,r.jsx)("p",{className:"ant-upload-hint",children:"Support for single or bulk upload. Supported formats: PDF, TXT, DOCX, MD"})]})]}),a.length>0&&(0,r.jsxs)(J.Card,{children:[(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsxs)(i.Text,{className:"font-medium",children:["Uploaded Documents (",a.length,")"]})}),(0,r.jsx)(eS,{documents:a,onRemove:e=>{o(t=>t.filter(t=>t.uid!==e))}})]}),(0,r.jsx)(J.Card,{children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(i.Text,{className:"font-medium",children:"Step 2: Configure Vector Store"}),(0,r.jsx)(i.Text,{className:"text-sm text-gray-500 block mt-1",children:"Choose the provider and optionally provide a name and description for your vector store."})]}),(0,r.jsxs)(O.Form,{form:l,layout:"vertical",children:[(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Vector Store Name"," ",(0,r.jsx)(I.Tooltip,{title:"Optional: Give your vector store a meaningful name",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),children:(0,r.jsx)(D.Input,{value:x,onChange:e=>u(e.target.value),placeholder:"e.g., Product Documentation, Customer Support KB",size:"large",className:"rounded-md"})}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Description"," ",(0,r.jsx)(I.Tooltip,{title:"Optional: Describe what this vector store contains",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),children:(0,r.jsx)(D.Input.TextArea,{value:h,onChange:e=>v(e.target.value),placeholder:"e.g., Contains all product documentation and user guides",rows:2,size:"large",className:"rounded-md"})}),(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:["Provider"," ",(0,r.jsx)(I.Tooltip,{title:"Select the provider for embedding and vector store operations",children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),required:!0,children:(0,r.jsx)(E.Select,{value:d,onChange:m,placeholder:"Select a provider",size:"large",style:{width:"100%"},children:Object.entries(B).map(([e,t])=>(0,r.jsx)(E.Select.Option,{value:z[e],children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("img",{src:M[t],alt:`${e} logo`,className:"w-5 h-5",onError:e=>{let r=e.target,s=r.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,r)}}}),(0,r.jsx)("span",{children:t})]})},e))})}),"s3_vectors"===d&&(0,r.jsx)(eC,{accessToken:e,providerParams:f,onParamsChange:b}),"s3_vectors"!==d&&$(d).map(e=>"select"===e.type?(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:[e.label," ",(0,r.jsx)(I.Tooltip,{title:e.tooltip,children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),required:e.required,children:(0,r.jsx)(D.Input,{value:f[e.name]||"",onChange:t=>b(r=>({...r,[e.name]:t.target.value})),placeholder:e.placeholder,size:"large",className:"rounded-md"})},e.name):(0,r.jsx)(O.Form.Item,{label:(0,r.jsxs)("span",{children:[e.label," ",(0,r.jsx)(I.Tooltip,{title:e.tooltip,children:(0,r.jsx)(F.InfoCircleOutlined,{style:{marginLeft:"4px"}})})]}),required:e.required,children:(0,r.jsx)(D.Input,{type:"password"===e.type?"password":"text",value:f[e.name]||"",onChange:t=>b(r=>({...r,[e.name]:t.target.value})),placeholder:e.placeholder,size:"large",className:"rounded-md"})},e.name))]}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsx)(Q.Button,{type:"primary",size:"large",onClick:_,loading:n,disabled:0===a.length||!d,children:n?"Creating Vector Store...":"Create Vector Store"})})]})}),g.length>0&&(0,r.jsx)(P.Alert,{message:"Vector Store Created Successfully",description:(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{children:[(0,r.jsx)("strong",{children:"Vector Store ID:"})," ",g[0]?.vector_store_id]}),(0,r.jsxs)("p",{children:[(0,r.jsx)("strong",{children:"Documents Ingested:"})," ",g.length]})]}),type:"success",showIcon:!0,closable:!0})]})},{Text:ek,Title:eA}=ee.Typography,eL=({accessToken:e,vectorStores:t})=>{let[l,a]=(0,s.useState)(t.length>0?t[0].vector_store_id:void 0);return e?0===t.length?(0,r.jsx)(Z.Card,{children:(0,r.jsx)("div",{className:"text-center py-8",children:(0,r.jsx)(ek,{type:"secondary",children:"No vector stores available. Create one first to test it."})})}):(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)(Z.Card,{children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(eA,{level:5,children:"Select Vector Store"}),(0,r.jsx)(ek,{type:"secondary",children:"Choose a vector store to test search queries against"})]}),(0,r.jsx)(E.Select,{value:l,onChange:a,placeholder:"Select a vector store",size:"large",style:{width:"100%"},showSearch:!0,optionFilterProp:"children",children:t.map(e=>(0,r.jsx)(E.Select.Option,{value:e.vector_store_id,children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"font-medium",children:e.vector_store_name||e.vector_store_id}),e.vector_store_name&&(0,r.jsx)("span",{className:"text-xs text-gray-500 font-mono",children:e.vector_store_id})]})},e.vector_store_id))})]})}),l&&(0,r.jsx)(ep,{vectorStoreId:l,accessToken:e})]}):(0,r.jsx)(Z.Card,{children:(0,r.jsx)(ek,{type:"secondary",children:"Access token is required to test vector stores."})})};var eV=e.i(708347);e.s(["default",0,({accessToken:e,userID:t,userRole:v})=>{let[g,j]=(0,s.useState)([]),[f,b]=(0,s.useState)(!1),[y,_]=(0,s.useState)(!1),[w,N]=(0,s.useState)(null),[S,C]=(0,s.useState)(""),[I,T]=(0,s.useState)([]),[k,L]=(0,s.useState)(null),[V,O]=(0,s.useState)(!1),[E,D]=(0,s.useState)(!1),P=async()=>{if(e)try{let t=await (0,p.vectorStoreListCall)(e);console.log("List vector stores response:",t),j(t.data||[])}catch(e){console.error("Error fetching vector stores:",e),K.default.fromBackend("Error fetching vector stores: "+e)}},F=async()=>{if(e)try{let t=await (0,p.credentialListCall)(e);console.log("List credentials response:",t),T(t.credentials||[])}catch(e){console.error("Error fetching credentials:",e),K.default.fromBackend("Error fetching credentials: "+e)}},B=async e=>{N(e),_(!0)},z=async()=>{if(e&&w){D(!0);try{await (0,p.vectorStoreDeleteCall)(e,w),K.default.success("Vector store deleted successfully"),P()}catch(e){console.error("Error deleting vector store:",e),K.default.fromBackend("Error deleting vector store: "+e)}finally{D(!1),_(!1),N(null)}}};return(0,s.useEffect)(()=>{P(),F()},[e]),k?(0,r.jsx)("div",{className:"w-full h-full",children:(0,r.jsx)(ev,{vectorStoreId:k,onClose:()=>{L(null),O(!1),P()},accessToken:e,is_admin:(0,eV.isAdminRole)(v||""),editVectorStore:V})}):(0,r.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,r.jsxs)("div",{className:"gap-2 p-8 h-[75vh] w-full mt-2",children:[(0,r.jsxs)("div",{className:"flex justify-between mt-2 w-full items-center mb-4",children:[(0,r.jsx)("h1",{children:"Vector Store Management"}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[S&&(0,r.jsxs)(i.Text,{children:["Last Refreshed: ",S]}),(0,r.jsx)(l.Icon,{icon:h.RefreshIcon,variant:"shadow",size:"xs",className:"self-center cursor-pointer",onClick:()=>{P(),F(),C(new Date().toLocaleString())}})]})]}),(0,r.jsx)(i.Text,{className:"mb-4",children:(0,r.jsx)("p",{children:"You can use vector stores to store and retrieve LLM embeddings."})}),(0,r.jsxs)(c.TabGroup,{children:[(0,r.jsxs)(d.TabList,{className:"mb-6",children:[(0,r.jsx)(m.Tab,{children:"Create Vector Store"}),(0,r.jsx)(m.Tab,{children:"Manage Vector Stores"}),(0,r.jsx)(m.Tab,{children:"Test Vector Store"})]}),(0,r.jsxs)(x.TabPanels,{children:[(0,r.jsx)(u.TabPanel,{children:(0,r.jsx)(eT,{accessToken:e,onSuccess:e=>{console.log("Vector store created:",e),P()}})}),(0,r.jsxs)(u.TabPanel,{children:[(0,r.jsx)(a.Button,{className:"mb-4",onClick:()=>b(!0),children:"+ Add Vector Store"}),(0,r.jsx)(n.Grid,{numItems:1,className:"gap-2 pt-2 pb-2 w-full mt-2",children:(0,r.jsx)(o.Col,{numColSpan:1,children:(0,r.jsx)(A,{data:g,onView:e=>{L(e),O(!1)},onEdit:e=>{L(e),O(!0)},onDelete:B})})})]}),(0,r.jsx)(u.TabPanel,{children:(0,r.jsx)(eL,{accessToken:e,vectorStores:g})})]})]}),(0,r.jsx)(G,{isVisible:f,onCancel:()=>b(!1),onSuccess:()=>{b(!1),P()},accessToken:e,credentials:I}),(0,r.jsx)(H.default,{isOpen:y,title:"Delete Vector Store",message:"Are you sure you want to delete this vector store? This action cannot be undone.",resourceInformationTitle:"Vector Store Information",resourceInformation:[{label:"Vector Store ID",value:w,code:!0}],onCancel:()=>_(!1),onOk:z,confirmLoading:E})]})})}],241902)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0a6c418370a8c183.js b/litellm/proxy/_experimental/out/_next/static/chunks/0a6c418370a8c183.js new file mode 100644 index 00000000000..b3e15e69622 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0a6c418370a8c183.js @@ -0,0 +1,41 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,486794,(e,t,n)=>{t.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],l=0;l{"use strict";var l=e.r(486794),r={"text/plain":"Text","text/html":"Url",default:"Text"};t.exports=function(e,t){var n,o,a,i,c,s,u,d,p=!1;t||(t={}),a=t.debug||!1;try{if(c=l(),s=document.createRange(),u=document.getSelection(),(d=document.createElement("span")).textContent=e,d.ariaHidden="true",d.style.all="unset",d.style.position="fixed",d.style.top=0,d.style.clip="rect(0, 0, 0, 0)",d.style.whiteSpace="pre",d.style.webkitUserSelect="text",d.style.MozUserSelect="text",d.style.msUserSelect="text",d.style.userSelect="text",d.addEventListener("copy",function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){a&&console.warn("unable to use e.clipboardData"),a&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var l=r[t.format]||r.default;window.clipboardData.setData(l,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(d),s.selectNodeContents(d),u.addRange(s),!document.execCommand("copy"))throw Error("copy command was unsuccessful");p=!0}catch(l){a&&console.error("unable to copy using execCommand: ",l),a&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),p=!0}catch(l){a&&console.error("unable to copy using clipboardData: ",l),a&&console.error("falling back to prompt"),n="message"in t?t.message:"Copy to clipboard: #{key}, Enter",o=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C",i=n.replace(/#{\s*key\s*}/g,o),window.prompt(i,e)}}finally{u&&("function"==typeof u.removeRange?u.removeRange(s):u.removeAllRanges()),d&&document.body.removeChild(d),c()}return p}},898586,401361,335771,e=>{"use strict";e.i(247167);var t=e.i(271645),n=e.i(8211),l=e.i(931067);let r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"}}]},name:"edit",theme:"outlined"};var o=e.i(9583),a=t.forwardRef(function(e,n){return t.createElement(o.default,(0,l.default)({},e,{ref:n,icon:r}))});e.s(["default",0,a],401361);var i=e.i(343794),c=e.i(430073),s=e.i(876556),u=e.i(174428),d=e.i(914949),p=e.i(529681),f=e.i(611935),m=e.i(735049),g=e.i(242064),b=e.i(929447),y=e.i(491816);let v={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z"}}]},name:"enter",theme:"outlined"};var h=t.forwardRef(function(e,n){return t.createElement(o.default,(0,l.default)({},e,{ref:n,icon:v}))}),x=e.i(404948),O=e.i(763731),E=e.i(635432),S=e.i(183293),w=e.i(246422);e.i(765846);var j=e.i(896091);let C=(0,w.genStyleHooks)("Typography",e=>{let t,{componentCls:n,titleMarginTop:l}=e;return{[n]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({color:e.colorText,wordBreak:"break-word",lineHeight:e.lineHeight,[`&${n}-secondary`]:{color:e.colorTextDescription},[`&${n}-success`]:{color:e.colorSuccessText},[`&${n}-warning`]:{color:e.colorWarningText},[`&${n}-danger`]:{color:e.colorErrorText,"a&:active, a&:focus":{color:e.colorErrorTextActive},"a&:hover":{color:e.colorErrorTextHover}},[`&${n}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed",userSelect:"none"},[` + div&, + p + `]:{marginBottom:"1em"}},(t={},[1,2,3,4,5].forEach(n=>{t[` + h${n}&, + div&-h${n}, + div&-h${n} > textarea, + h${n} + `]=((e,t,n,l)=>{let{titleMarginBottom:r,fontWeightStrong:o}=l;return{marginBottom:r,color:n,fontWeight:o,fontSize:e,lineHeight:t}})(e[`fontSizeHeading${n}`],e[`lineHeightHeading${n}`],e.colorTextHeading,e)}),t)),{[` + & + h1${n}, + & + h2${n}, + & + h3${n}, + & + h4${n}, + & + h5${n} + `]:{marginTop:l},[` + div, + ul, + li, + p, + h1, + h2, + h3, + h4, + h5`]:{[` + + h1, + + h2, + + h3, + + h4, + + h5 + `]:{marginTop:l}}}),{code:{margin:"0 0.2em",paddingInline:"0.4em",paddingBlock:"0.2em 0.1em",fontSize:"85%",fontFamily:e.fontFamilyCode,background:"rgba(150, 150, 150, 0.1)",border:"1px solid rgba(100, 100, 100, 0.2)",borderRadius:3},kbd:{margin:"0 0.2em",paddingInline:"0.4em",paddingBlock:"0.15em 0.1em",fontSize:"90%",fontFamily:e.fontFamilyCode,background:"rgba(150, 150, 150, 0.06)",border:"1px solid rgba(100, 100, 100, 0.2)",borderBottomWidth:2,borderRadius:3},mark:{padding:0,backgroundColor:j.gold[2]},"u, ins":{textDecoration:"underline",textDecorationSkipInk:"auto"},"s, del":{textDecoration:"line-through"},strong:{fontWeight:e.fontWeightStrong},"ul, ol":{marginInline:0,marginBlock:"0 1em",padding:0,li:{marginInline:"20px 0",marginBlock:0,paddingInline:"4px 0",paddingBlock:0}},ul:{listStyleType:"circle",ul:{listStyleType:"disc"}},ol:{listStyleType:"decimal"},"pre, blockquote":{margin:"1em 0"},pre:{padding:"0.4em 0.6em",whiteSpace:"pre-wrap",wordWrap:"break-word",background:"rgba(150, 150, 150, 0.1)",border:"1px solid rgba(100, 100, 100, 0.2)",borderRadius:3,fontFamily:e.fontFamilyCode,code:{display:"inline",margin:0,padding:0,fontSize:"inherit",fontFamily:"inherit",background:"transparent",border:0}},blockquote:{paddingInline:"0.6em 0",paddingBlock:0,borderInlineStart:"4px solid rgba(100, 100, 100, 0.2)",opacity:.85}}),(e=>{let{componentCls:t}=e;return{"a&, a":Object.assign(Object.assign({},(0,S.operationUnit)(e)),{userSelect:"text",[`&[disabled], &${t}-disabled`]:{color:e.colorTextDisabled,cursor:"not-allowed","&:active, &:hover":{color:e.colorTextDisabled},"&:active":{pointerEvents:"none"}}})}})(e)),{[` + ${n}-expand, + ${n}-collapse, + ${n}-edit, + ${n}-copy + `]:Object.assign(Object.assign({},(0,S.operationUnit)(e)),{marginInlineStart:e.marginXXS})}),(e=>{let{componentCls:t,paddingSM:n}=e;return{"&-edit-content":{position:"relative","div&":{insetInlineStart:e.calc(e.paddingSM).mul(-1).equal(),insetBlockStart:e.calc(n).div(-2).add(1).equal(),marginBottom:e.calc(n).div(2).sub(2).equal()},[`${t}-edit-content-confirm`]:{position:"absolute",insetInlineEnd:e.calc(e.marginXS).add(2).equal(),insetBlockEnd:e.marginXS,color:e.colorIcon,fontWeight:"normal",fontSize:e.fontSize,fontStyle:"normal",pointerEvents:"none"},textarea:{margin:"0!important",MozTransition:"none",height:"1em"}}}})(e)),{[`${e.componentCls}-copy-success`]:{[` + &, + &:hover, + &:focus`]:{color:e.colorSuccess}},[`${e.componentCls}-copy-icon-only`]:{marginInlineStart:0}}),{[` + a&-ellipsis, + span&-ellipsis + `]:{display:"inline-block",maxWidth:"100%"},"&-ellipsis-single-line":{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis","a&, span&":{verticalAlign:"bottom"},"> code":{paddingBlock:0,maxWidth:"calc(100% - 1.2em)",display:"inline-block",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"bottom",boxSizing:"content-box"}},"&-ellipsis-multiple-line":{display:"-webkit-box",overflow:"hidden",WebkitLineClamp:3,WebkitBoxOrient:"vertical"}}),{"&-rtl":{direction:"rtl"}})}},()=>({titleMarginTop:"1.2em",titleMarginBottom:"0.5em"})),k=e=>{let{prefixCls:n,"aria-label":l,className:r,style:o,direction:a,maxLength:c,autoSize:s=!0,value:u,onSave:d,onCancel:p,onEnd:f,component:m,enterIcon:g=t.createElement(h,null)}=e,b=t.useRef(null),y=t.useRef(!1),v=t.useRef(null),[S,w]=t.useState(u);t.useEffect(()=>{w(u)},[u]),t.useEffect(()=>{var e;if(null==(e=b.current)?void 0:e.resizableTextArea){let{textArea:e}=b.current.resizableTextArea;e.focus();let{length:t}=e.value;e.setSelectionRange(t,t)}},[]);let j=()=>{d(S.trim())},[k,R,$]=C(n),T=(0,i.default)(n,`${n}-edit-content`,{[`${n}-rtl`]:"rtl"===a,[`${n}-${m}`]:!!m},r,R,$);return k(t.createElement("div",{className:T,style:o},t.createElement(E.default,{ref:b,maxLength:c,value:S,onChange:({target:e})=>{w(e.value.replace(/[\n\r]/g,""))},onKeyDown:({keyCode:e})=>{y.current||(v.current=e)},onKeyUp:({keyCode:e,ctrlKey:t,altKey:n,metaKey:l,shiftKey:r})=>{v.current!==e||y.current||t||n||l||r||(e===x.default.ENTER?(j(),null==f||f()):e===x.default.ESC&&p())},onCompositionStart:()=>{y.current=!0},onCompositionEnd:()=>{y.current=!1},onBlur:()=>{j()},"aria-label":l,rows:1,autoSize:s}),null!==g?(0,O.cloneElement)(g,{className:`${n}-edit-content-confirm`}):null))};var R=e.i(844343),$=e.i(175066);function T(e,n){return t.useMemo(()=>{let t=!!e;return[t,Object.assign(Object.assign({},n),t&&"object"==typeof e?e:null)]},[e])}var I=function(e,t){var n={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(n[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,l=Object.getOwnPropertySymbols(e);rt.indexOf(l[r])&&Object.prototype.propertyIsEnumerable.call(e,l[r])&&(n[l[r]]=e[l[r]]);return n};let D=t.forwardRef((e,n)=>{let{prefixCls:l,component:r="article",className:o,rootClassName:a,setContentRef:c,children:s,direction:u,style:d}=e,p=I(e,["prefixCls","component","className","rootClassName","setContentRef","children","direction","style"]),{getPrefixCls:m,direction:b,className:y,style:v}=(0,g.useComponentConfig)("typography"),h=c?(0,f.composeRef)(n,c):n,x=m("typography",l),[O,E,S]=C(x),w=(0,i.default)(x,y,{[`${x}-rtl`]:"rtl"===(null!=u?u:b)},o,a,E,S),j=Object.assign(Object.assign({},v),d);return O(t.createElement(r,Object.assign({className:w,style:j,ref:h},p),s))});var P=e.i(121229),B=e.i(190144),M=e.i(739295);function H(e){return!1===e?[!1,!1]:Array.isArray(e)?e:[e]}function z(e,t,n){return!0===e||void 0===e?t:e||n&&t}let A=e=>["string","number"].includes(typeof e),W=({prefixCls:e,copied:n,locale:l,iconOnly:r,tooltips:o,icon:a,tabIndex:c,onCopy:s,loading:u})=>{let d=H(o),p=H(a),{copied:f,copy:m}=null!=l?l:{},g=n?f:m,b=z(d[+!!n],g),v="string"==typeof b?b:g;return t.createElement(y.default,{title:b},t.createElement("button",{type:"button",className:(0,i.default)(`${e}-copy`,{[`${e}-copy-success`]:n,[`${e}-copy-icon-only`]:r}),onClick:s,"aria-label":v,tabIndex:c},n?z(p[1],t.createElement(P.default,null),!0):z(p[0],u?t.createElement(M.default,null):t.createElement(B.default,null),!0)))},L=t.forwardRef(({style:e,children:n},l)=>{let r=t.useRef(null);return t.useImperativeHandle(l,()=>({isExceed:()=>{let e=r.current;return e.scrollHeight>e.clientHeight},getHeight:()=>r.current.clientHeight})),t.createElement("span",{"aria-hidden":!0,ref:r,style:Object.assign({position:"fixed",display:"block",left:0,top:0,pointerEvents:"none",backgroundColor:"rgba(255, 0, 0, 0.65)"},e)},n)});function N(e,t){let n=0,l=[];for(let r=0;rt){let e=t-n;return l.push(String(o).slice(0,e)),l}l.push(o),n=a}return e}let U={display:"-webkit-box",overflow:"hidden",WebkitBoxOrient:"vertical"};function F(e){let{enableMeasure:l,width:r,text:o,children:a,rows:i,expanded:c,miscDeps:d,onEllipsis:p}=e,f=t.useMemo(()=>(0,s.default)(o),[o]),m=t.useMemo(()=>f.reduce((e,t)=>e+(A(t)?String(t).length:1),0),[o]),g=t.useMemo(()=>a(f,!1),[o]),[b,y]=t.useState(null),v=t.useRef(null),h=t.useRef(null),x=t.useRef(null),O=t.useRef(null),E=t.useRef(null),[S,w]=t.useState(!1),[j,C]=t.useState(0),[k,R]=t.useState(0),[$,T]=t.useState(null);(0,u.default)(()=>{l&&r&&m?C(1):C(0)},[r,o,i,l,f]),(0,u.default)(()=>{var e,t,n,l;if(1===j)C(2),T(h.current&&getComputedStyle(h.current).whiteSpace);else if(2===j){let r=!!(null==(e=x.current)?void 0:e.isExceed());C(r?3:4),y(r?[0,m]:null),w(r),R(Math.max((null==(t=x.current)?void 0:t.getHeight())||0,(1===i?0:(null==(n=O.current)?void 0:n.getHeight())||0)+((null==(l=E.current)?void 0:l.getHeight())||0))+1),p(r)}},[j]);let I=b?Math.ceil((b[0]+b[1])/2):0;(0,u.default)(()=>{var e;let[t,n]=b||[0,0];if(t!==n){let l=((null==(e=v.current)?void 0:e.getHeight())||0)>k,r=I;n-t==1&&(r=l?t:n),y(l?[t,r]:[r,n])}},[b,I]);let D=t.useMemo(()=>{if(!l)return a(f,!1);if(3!==j||!b||b[0]!==b[1]){let e=a(f,!1);return[4,0].includes(j)?e:t.createElement("span",{style:Object.assign(Object.assign({},U),{WebkitLineClamp:i})},e)}return a(c?f:N(f,b[0]),S)},[c,j,b,f].concat((0,n.default)(d))),P={width:r,margin:0,padding:0,whiteSpace:"nowrap"===$?"normal":"inherit"};return t.createElement(t.Fragment,null,D,2===j&&t.createElement(t.Fragment,null,t.createElement(L,{style:Object.assign(Object.assign(Object.assign({},P),U),{WebkitLineClamp:i}),ref:x},g),t.createElement(L,{style:Object.assign(Object.assign(Object.assign({},P),U),{WebkitLineClamp:i-1}),ref:O},g),t.createElement(L,{style:Object.assign(Object.assign(Object.assign({},P),U),{WebkitLineClamp:1}),ref:E},a([],!0))),3===j&&b&&b[0]!==b[1]&&t.createElement(L,{style:Object.assign(Object.assign({},P),{top:400}),ref:v},a(N(f,I),!0)),1===j&&t.createElement("span",{style:{whiteSpace:"inherit"},ref:h}))}let q=({enableEllipsis:e,isEllipsis:n,children:l,tooltipProps:r})=>(null==r?void 0:r.title)&&e?t.createElement(y.default,Object.assign({open:!!n&&void 0},r),l):l;var X=function(e,t){var n={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(n[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,l=Object.getOwnPropertySymbols(e);rt.indexOf(l[r])&&Object.prototype.propertyIsEnumerable.call(e,l[r])&&(n[l[r]]=e[l[r]]);return n};let K=["delete","mark","code","underline","strong","keyboard","italic"],V=t.forwardRef((e,l)=>{var r;let o,v,h,{prefixCls:x,className:O,style:E,type:S,disabled:w,children:j,ellipsis:C,editable:I,copyable:P,component:B,title:M}=e,H=X(e,["prefixCls","className","style","type","disabled","children","ellipsis","editable","copyable","component","title"]),{getPrefixCls:z,direction:L}=t.useContext(g.ConfigContext),[N]=(0,b.default)("Text"),U=t.useRef(null),V=t.useRef(null),_=z("typography",x),G=(0,p.default)(H,K),[J,Q]=T(I),[Y,Z]=(0,d.default)(!1,{value:Q.editing}),{triggerType:ee=["icon"]}=Q,et=e=>{var t;e&&(null==(t=Q.onStart)||t.call(Q)),Z(e)},en=(o=(0,t.useRef)(void 0),(0,t.useEffect)(()=>{o.current=Y}),o.current);(0,u.default)(()=>{var e;!Y&&en&&(null==(e=V.current)||e.focus())},[Y]);let el=e=>{null==e||e.preventDefault(),et(!0)},[er,eo]=T(P),{copied:ea,copyLoading:ei,onClick:ec}=(({copyConfig:e,children:n})=>{let[l,r]=t.useState(!1),[o,a]=t.useState(!1),i=t.useRef(null),c=()=>{i.current&&clearTimeout(i.current)},s={};e.format&&(s.format=e.format),t.useEffect(()=>c,[]);let u=(0,$.default)(t=>{var l,o,u,d;return l=void 0,o=void 0,u=void 0,d=function*(){var l;null==t||t.preventDefault(),null==t||t.stopPropagation(),a(!0);try{let o="function"==typeof e.text?yield e.text():e.text;(0,R.default)(o||((e,t=!1)=>t&&null==e?[]:Array.isArray(e)?e:[e])(n,!0).join("")||"",s),a(!1),r(!0),c(),i.current=setTimeout(()=>{r(!1)},3e3),null==(l=e.onCopy)||l.call(e,t)}catch(e){throw a(!1),e}},new(u||(u=Promise))(function(e,t){function n(e){try{a(d.next(e))}catch(e){t(e)}}function r(e){try{a(d.throw(e))}catch(e){t(e)}}function a(t){var l;t.done?e(t.value):((l=t.value)instanceof u?l:new u(function(e){e(l)})).then(n,r)}a((d=d.apply(l,o||[])).next())})});return{copied:l,copyLoading:o,onClick:u}})({copyConfig:eo,children:j}),[es,eu]=t.useState(!1),[ed,ep]=t.useState(!1),[ef,em]=t.useState(!1),[eg,eb]=t.useState(!1),[ey,ev]=t.useState(!0),[eh,ex]=T(C,{expandable:!1,symbol:e=>e?null==N?void 0:N.collapse:null==N?void 0:N.expand}),[eO,eE]=(0,d.default)(ex.defaultExpanded||!1,{value:ex.expanded}),eS=eh&&(!eO||"collapsible"===ex.expandable),{rows:ew=1}=ex,ej=t.useMemo(()=>eS&&(void 0!==ex.suffix||ex.onEllipsis||ex.expandable||J||er),[eS,ex,J,er]);(0,u.default)(()=>{eh&&!ej&&(eu((0,m.isStyleSupport)("webkitLineClamp")),ep((0,m.isStyleSupport)("textOverflow")))},[ej,eh]);let[eC,ek]=t.useState(eS),eR=t.useMemo(()=>!ej&&(1===ew?ed:es),[ej,ed,es]);(0,u.default)(()=>{ek(eR&&eS)},[eR,eS]);let e$=eS&&(eC?eg:ef),eT=eS&&1===ew&&eC,eI=eS&&ew>1&&eC,[eD,eP]=t.useState(0),eB=e=>{var t;em(e),ef!==e&&(null==(t=ex.onEllipsis)||t.call(ex,e))};t.useEffect(()=>{let e=U.current;if(eh&&eC&&e){let t,n,l,r=(t=document.createElement("em"),e.appendChild(t),n=e.getBoundingClientRect(),l=t.getBoundingClientRect(),e.removeChild(t),n.left>l.left||l.right>n.right||n.top>l.top||l.bottom>n.bottom);eg!==r&&eb(r)}},[eh,eC,j,eI,ey,eD]),t.useEffect(()=>{let e=U.current;if("u"{ev(!!e.offsetParent)});return t.observe(e),()=>{t.disconnect()}},[eC,eS]);let eM=(v=ex.tooltip,h=Q.text,(0,t.useMemo)(()=>!0===v?{title:null!=h?h:j}:(0,t.isValidElement)(v)?{title:v}:"object"==typeof v?Object.assign({title:null!=h?h:j},v):{title:v},[v,h,j])),eH=t.useMemo(()=>{if(eh&&!eC)return[Q.text,j,M,eM.title].find(A)},[eh,eC,M,eM.title,e$]);return Y?t.createElement(k,{value:null!=(r=Q.text)?r:"string"==typeof j?j:"",onSave:e=>{var t;null==(t=Q.onChange)||t.call(Q,e),et(!1)},onCancel:()=>{var e;null==(e=Q.onCancel)||e.call(Q),et(!1)},onEnd:Q.onEnd,prefixCls:_,className:O,style:E,direction:L,component:B,maxLength:Q.maxLength,autoSize:Q.autoSize,enterIcon:Q.enterIcon}):t.createElement(c.default,{onResize:({offsetWidth:e})=>{eP(e)},disabled:!eS},r=>t.createElement(q,{tooltipProps:eM,enableEllipsis:eS,isEllipsis:e$},t.createElement(D,Object.assign({className:(0,i.default)({[`${_}-${S}`]:S,[`${_}-disabled`]:w,[`${_}-ellipsis`]:eh,[`${_}-ellipsis-single-line`]:eT,[`${_}-ellipsis-multiple-line`]:eI},O),prefixCls:x,style:Object.assign(Object.assign({},E),{WebkitLineClamp:eI?ew:void 0}),component:B,ref:(0,f.composeRef)(r,U,l),direction:L,onClick:ee.includes("text")?el:void 0,"aria-label":null==eH?void 0:eH.toString(),title:M},G),t.createElement(F,{enableMeasure:eS&&!eC,text:j,rows:ew,width:eD,onEllipsis:eB,expanded:eO,miscDeps:[ea,eO,ei,J,er,N].concat((0,n.default)(K.map(t=>e[t])))},(n,l)=>{let r;return function({mark:e,code:n,underline:l,delete:r,strong:o,keyboard:a,italic:i},c){let s=c;function u(e,n){n&&(s=t.createElement(e,{},s))}return u("strong",o),u("u",l),u("del",r),u("code",n),u("mark",e),u("kbd",a),u("i",i),s}(e,t.createElement(t.Fragment,null,n.length>0&&l&&!eO&&eH?t.createElement("span",{key:"show-content","aria-hidden":!0},n):n,[(r=l)&&!eO&&t.createElement("span",{"aria-hidden":!0,key:"ellipsis"},"..."),ex.suffix,[r&&(()=>{let{expandable:e,symbol:n}=ex;return e?t.createElement("button",{type:"button",key:"expand",className:`${_}-${eO?"collapse":"expand"}`,onClick:e=>{var t,n;eE((t={expanded:!eO}).expanded),null==(n=ex.onExpand)||n.call(ex,e,t)},"aria-label":eO?N.collapse:null==N?void 0:N.expand},"function"==typeof n?n(eO):n):null})(),(()=>{if(!J)return;let{icon:e,tooltip:n,tabIndex:l}=Q,r=(0,s.default)(n)[0]||(null==N?void 0:N.edit),o="string"==typeof r?r:"";return ee.includes("icon")?t.createElement(y.default,{key:"edit",title:!1===n?"":r},t.createElement("button",{type:"button",ref:V,className:`${_}-edit`,onClick:el,"aria-label":o,tabIndex:l},e||t.createElement(a,{role:"button"}))):null})(),er?t.createElement(W,Object.assign({key:"copy"},eo,{prefixCls:_,copied:ea,locale:N,onCopy:ec,loading:ei,iconOnly:null==j})):null]]))}))))});var _=function(e,t){var n={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(n[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,l=Object.getOwnPropertySymbols(e);rt.indexOf(l[r])&&Object.prototype.propertyIsEnumerable.call(e,l[r])&&(n[l[r]]=e[l[r]]);return n};let G=t.forwardRef((e,n)=>{let{ellipsis:l,rel:r,children:o,navigate:a}=e,i=_(e,["ellipsis","rel","children","navigate"]),c=Object.assign(Object.assign({},i),{rel:void 0===r&&"_blank"===i.target?"noopener noreferrer":r});return t.createElement(V,Object.assign({},c,{ref:n,ellipsis:!!l,component:"a"}),o)});var J=function(e,t){var n={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(n[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,l=Object.getOwnPropertySymbols(e);rt.indexOf(l[r])&&Object.prototype.propertyIsEnumerable.call(e,l[r])&&(n[l[r]]=e[l[r]]);return n};let Q=t.forwardRef((e,n)=>{let{children:l}=e,r=J(e,["children"]);return t.createElement(V,Object.assign({ref:n},r,{component:"div"}),l)});var Y=function(e,t){var n={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(n[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,l=Object.getOwnPropertySymbols(e);rt.indexOf(l[r])&&Object.prototype.propertyIsEnumerable.call(e,l[r])&&(n[l[r]]=e[l[r]]);return n};let Z=t.forwardRef((e,n)=>{let{ellipsis:l,children:r}=e,o=Y(e,["ellipsis","children"]),a=t.useMemo(()=>l&&"object"==typeof l?(0,p.default)(l,["expandable","rows"]):l,[l]);return t.createElement(V,Object.assign({ref:n},o,{ellipsis:a,component:"span"}),r)});var ee=function(e,t){var n={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(n[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,l=Object.getOwnPropertySymbols(e);rt.indexOf(l[r])&&Object.prototype.propertyIsEnumerable.call(e,l[r])&&(n[l[r]]=e[l[r]]);return n};let et=[1,2,3,4,5],en=t.forwardRef((e,n)=>{let{level:l=1,children:r}=e,o=ee(e,["level","children"]),a=et.includes(l)?`h${l}`:"h1";return t.createElement(V,Object.assign({ref:n},o,{component:a}),r)});e.s(["default",0,en],335771),D.Text=Z,D.Link=G,D.Title=en,D.Paragraph=Q,e.s(["Typography",0,D],898586)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0aece5fc054ad66e.js b/litellm/proxy/_experimental/out/_next/static/chunks/0aece5fc054ad66e.js new file mode 100644 index 00000000000..95c91c00200 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0aece5fc054ad66e.js @@ -0,0 +1 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,438957,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5l-41.1 41.1-62.3-62.3a8.15 8.15 0 00-11.4 0l-39.8 39.8a8.15 8.15 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.15 8.15 0 00-11.4 0l-39.8 39.8a8.15 8.15 0 000 11.4l62.3 62.3-65.3 65.3a8.03 8.03 0 000 11.3l42.3 42.3c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.06 304.06 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112zm161.2 465.2C726.2 620.3 668.9 644 608 644c-60.9 0-118.2-23.7-161.2-66.8-43.1-43-66.8-100.3-66.8-161.2 0-60.9 23.7-118.2 66.8-161.2 43-43.1 100.3-66.8 161.2-66.8 60.9 0 118.2 23.7 161.2 66.8 43.1 43 66.8 100.3 66.8 161.2 0 60.9-23.7 118.2-66.8 161.2z"}}]},name:"key",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["KeyOutlined",0,i],438957)},210612,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z"}}]},name:"database",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["DatabaseOutlined",0,i],210612)},232164,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M483.2 790.3L861.4 412c1.7-1.7 2.5-4 2.3-6.3l-25.5-301.4c-.7-7.8-6.8-13.9-14.6-14.6L522.2 64.3c-2.3-.2-4.7.6-6.3 2.3L137.7 444.8a8.03 8.03 0 000 11.3l334.2 334.2c3.1 3.2 8.2 3.2 11.3 0zm62.6-651.7l224.6 19 19 224.6L477.5 694 233.9 450.5l311.9-311.9zm60.16 186.23a48 48 0 1067.88-67.89 48 48 0 10-67.88 67.89zM889.7 539.8l-39.6-39.5a8.03 8.03 0 00-11.3 0l-362 361.3-237.6-237a8.03 8.03 0 00-11.3 0l-39.6 39.5a8.03 8.03 0 000 11.3l243.2 242.8 39.6 39.5c3.1 3.1 8.2 3.1 11.3 0l407.3-406.6c3.1-3.1 3.1-8.2 0-11.3z"}}]},name:"tags",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["TagsOutlined",0,i],232164)},218129,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z"}}]},name:"api",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["ApiOutlined",0,i],218129)},366308,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 01144-53.5L537 318.9a32.05 32.05 0 000 45.3l124.5 124.5a32.05 32.05 0 0045.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z"}}]},name:"tool",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["ToolOutlined",0,i],366308)},313603,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["SettingOutlined",0,i],313603)},531278,e=>{"use strict";let t=(0,e.i(475254).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>t],531278)},788191,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["PlayCircleOutlined",0,i],788191)},19732,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z"}}]},name:"experiment",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["ExperimentOutlined",0,i],19732)},299251,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M894 462c30.9 0 43.8-39.7 18.7-58L530.8 126.2a31.81 31.81 0 00-37.6 0L111.3 404c-25.1 18.2-12.2 58 18.8 58H192v374h-72c-4.4 0-8 3.6-8 8v52c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-52c0-4.4-3.6-8-8-8h-72V462h62zM512 196.7l271.1 197.2H240.9L512 196.7zM264 462h117v374H264V462zm189 0h117v374H453V462zm307 374H642V462h118v374z"}}]},name:"bank",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["BankOutlined",0,i],299251)},153702,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z"}}]},name:"bar-chart",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["BarChartOutlined",0,i],153702)},777579,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM305.8 637.7c3.1 3.1 8.1 3.1 11.3 0l138.3-137.6L583 628.5c3.1 3.1 8.2 3.1 11.3 0l275.4-275.3c3.1-3.1 3.1-8.2 0-11.3l-39.6-39.6a8.03 8.03 0 00-11.3 0l-230 229.9L461.4 404a8.03 8.03 0 00-11.3 0L266.3 586.7a8.03 8.03 0 000 11.3l39.5 39.7z"}}]},name:"line-chart",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["LineChartOutlined",0,i],777579)},645526,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M824.2 699.9a301.55 301.55 0 00-86.4-60.4C783.1 602.8 812 546.8 812 484c0-110.8-92.4-201.7-203.2-200-109.1 1.7-197 90.6-197 200 0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C345 754.6 314 826.8 312 903.8a8 8 0 008 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5A226.62 226.62 0 01612 684c60.9 0 118.2 23.7 161.3 66.8C814.5 792 838 846.3 840 904.3c.1 4.3 3.7 7.7 8 7.7h56a8 8 0 008-8.2c-2-77-33-149.2-87.8-203.9zM612 612c-34.2 0-66.4-13.3-90.5-37.5a126.86 126.86 0 01-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4 0 34.2-13.3 66.3-37.5 90.5A127.3 127.3 0 01612 612zM361.5 510.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 01-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.9-1.7-203.3 89.2-203.3 199.9 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 008 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.9-1 6.5-4.7 6-8.7z"}}]},name:"team",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["TeamOutlined",0,i],645526)},477189,457202,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z"}}]},name:"appstore",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["AppstoreOutlined",0,i],477189);let l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M296 250c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm184 144H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zm-48 458H208V148h560v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h264c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm440-88H728v-36.6c46.3-13.8 80-56.6 80-107.4 0-61.9-50.1-112-112-112s-112 50.1-112 112c0 50.7 33.7 93.6 80 107.4V764H520c-8.8 0-16 7.2-16 16v152c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16V780c0-8.8-7.2-16-16-16zM646 620c0-27.6 22.4-50 50-50s50 22.4 50 50-22.4 50-50 50-50-22.4-50-50zm180 266H566v-60h260v60z"}}]},name:"audit",theme:"outlined"};var c=a.forwardRef(function(e,s){return a.createElement(r.default,(0,t.default)({},e,{ref:s,icon:l}))});e.s(["AuditOutlined",0,c],457202)},182399,e=>{"use strict";e.i(247167);var t=e.i(931067),a=e.i(271645);let s={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M856 376H648V168c0-8.8-7.2-16-16-16H168c-8.8 0-16 7.2-16 16v464c0 8.8 7.2 16 16 16h208v208c0 8.8 7.2 16 16 16h464c8.8 0 16-7.2 16-16V392c0-8.8-7.2-16-16-16zm-480 16v188H220V220h360v156H392c-8.8 0-16 7.2-16 16zm204 52v136H444V444h136zm224 360H444V648h188c8.8 0 16-7.2 16-16V444h156v360z"}}]},name:"block",theme:"outlined"};var r=e.i(9583),i=a.forwardRef(function(e,i){return a.createElement(r.default,(0,t.default)({},e,{ref:i,icon:s}))});e.s(["BlockOutlined",0,i],182399)},592143,e=>{"use strict";var t=e.i(609587);e.s(["ConfigProvider",()=>t.default])},372943,899268,e=>{"use strict";e.i(247167);var t=e.i(8211),a=e.i(271645),s=e.i(343794),r=e.i(529681),i=e.i(242064),l=e.i(704914),c=e.i(876556),n=e.i(290224),d=e.i(251224),o=function(e,t){var a={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>t.indexOf(s)&&(a[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,s=Object.getOwnPropertySymbols(e);rt.indexOf(s[r])&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(a[s[r]]=e[s[r]]);return a};function m({suffixCls:e,tagName:t,displayName:s}){return s=>a.forwardRef((r,i)=>a.createElement(s,Object.assign({ref:i,suffixCls:e,tagName:t},r)))}let u=a.forwardRef((e,t)=>{let{prefixCls:r,suffixCls:l,className:c,tagName:n}=e,m=o(e,["prefixCls","suffixCls","className","tagName"]),{getPrefixCls:u}=a.useContext(i.ConfigContext),f=u("layout",r),[h,x,g]=(0,d.default)(f),v=l?`${f}-${l}`:f;return h(a.createElement(n,Object.assign({className:(0,s.default)(r||v,c,x,g),ref:t},m)))}),f=a.forwardRef((e,m)=>{let{direction:u}=a.useContext(i.ConfigContext),[f,h]=a.useState([]),{prefixCls:x,className:g,rootClassName:v,children:y,hasSider:p,tagName:b,style:N}=e,w=o(e,["prefixCls","className","rootClassName","children","hasSider","tagName","style"]),j=(0,r.default)(w,["suffixCls"]),{getPrefixCls:L,className:z,style:M}=(0,i.useComponentConfig)("layout"),O=L("layout",x),C="boolean"==typeof p?p:!!f.length||(0,c.default)(y).some(e=>e.type===n.default),[k,H,_]=(0,d.default)(O),V=(0,s.default)(O,{[`${O}-has-sider`]:C,[`${O}-rtl`]:"rtl"===u},z,g,v,H,_),E=a.useMemo(()=>({siderHook:{addSider:e=>{h(a=>[].concat((0,t.default)(a),[e]))},removeSider:e=>{h(t=>t.filter(t=>t!==e))}}}),[]);return k(a.createElement(l.LayoutContext.Provider,{value:E},a.createElement(b,Object.assign({ref:m,className:V,style:Object.assign(Object.assign({},M),N)},j),y)))}),h=m({tagName:"div",displayName:"Layout"})(f),x=m({suffixCls:"header",tagName:"header",displayName:"Header"})(u),g=m({suffixCls:"footer",tagName:"footer",displayName:"Footer"})(u),v=m({suffixCls:"content",tagName:"main",displayName:"Content"})(u);h.Header=x,h.Footer=g,h.Content=v,h.Sider=n.default,h._InternalSiderContext=n.SiderContext,e.s(["Layout",0,h],372943);var y=e.i(60699);e.s(["Menu",()=>y.default],899268)},878894,87316,664659,655900,299023,25652,882293,e=>{"use strict";var t=e.i(582458);e.s(["AlertTriangle",()=>t.default],878894);var a=e.i(475254);let s=(0,a.default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);e.s(["Calendar",()=>s],87316);let r=(0,a.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",()=>r],664659);let i=(0,a.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);e.s(["ChevronUp",()=>i],655900);let l=(0,a.default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["Minus",()=>l],299023);let c=(0,a.default)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);e.s(["TrendingUp",()=>c],25652);let n=(0,a.default)("user-check",[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);e.s(["UserCheck",()=>n],882293)},761911,98740,e=>{"use strict";let t=(0,e.i(475254).default)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);e.s(["default",()=>t],98740),e.s(["Users",()=>t],761911)},190983,e=>{"use strict";var t=e.i(843476),a=e.i(371401);e.i(389083);var s=e.i(878894),r=e.i(87316);e.i(664659),e.i(655900);var i=e.i(531278),l=e.i(299023),c=e.i(25652),n=e.i(882293),d=e.i(761911),o=e.i(271645),m=e.i(764205);let u=(...e)=>e.filter(Boolean).join(" ");function f({accessToken:e,width:f=220}){let h=(0,a.useDisableUsageIndicator)(),[x,g]=(0,o.useState)(!1),[v,y]=(0,o.useState)(!1),[p,b]=(0,o.useState)(null),[N,w]=(0,o.useState)(null),[j,L]=(0,o.useState)(!1),[z,M]=(0,o.useState)(null);(0,o.useEffect)(()=>{(async()=>{if(e){L(!0),M(null);try{let[t,a]=await Promise.all([(0,m.getRemainingUsers)(e),(0,m.getLicenseInfo)(e).catch(()=>null)]);b(t),w(a)}catch(e){console.error("Failed to fetch usage data:",e),M("Failed to load usage data")}finally{L(!1)}}})()},[e]);let O=N?.expiration_date?(e=>{if(!e)return null;let t=new Date(e+"T00:00:00Z"),a=new Date;return a.setHours(0,0,0,0),Math.ceil((t.getTime()-a.getTime())/864e5)})(N.expiration_date):null,C=null!==O&&O<0,k=null!==O&&O>=0&&O<30,{isOverLimit:H,isNearLimit:_,usagePercentage:V,userMetrics:E,teamMetrics:R}=(e=>{if(!e)return{isOverLimit:!1,isNearLimit:!1,usagePercentage:0,userMetrics:{isOverLimit:!1,isNearLimit:!1,usagePercentage:0},teamMetrics:{isOverLimit:!1,isNearLimit:!1,usagePercentage:0}};let t=e.total_users?e.total_users_used/e.total_users*100:0,a=t>100,s=t>=80&&t<=100,r=e.total_teams?e.total_teams_used/e.total_teams*100:0,i=r>100,l=r>=80&&r<=100,c=a||i;return{isOverLimit:c,isNearLimit:(s||l)&&!c,usagePercentage:Math.max(t,r),userMetrics:{isOverLimit:a,isNearLimit:s,usagePercentage:t},teamMetrics:{isOverLimit:i,isNearLimit:l,usagePercentage:r}}})(p),B=H||_||C||k,S=H||C,U=(_||k)&&!S;return h||!e||p?.total_users===null&&p?.total_teams===null?null:(0,t.jsx)("div",{className:"fixed bottom-4 left-4 z-50",style:{width:`${Math.min(f,220)}px`},children:(0,t.jsx)(()=>v?(0,t.jsx)("button",{onClick:()=>y(!1),className:u("bg-white border border-gray-200 rounded-lg shadow-sm p-3 hover:shadow-md transition-all w-full"),title:"Show usage details",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Users,{className:"h-4 w-4 flex-shrink-0"}),B&&(0,t.jsx)("span",{className:"flex-shrink-0",children:S?(0,t.jsx)(s.AlertTriangle,{className:"h-3 w-3"}):U?(0,t.jsx)(c.TrendingUp,{className:"h-3 w-3"}):null}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium truncate",children:[p&&null!==p.total_users&&(0,t.jsxs)("span",{className:u("flex-shrink-0 px-1.5 py-0.5 rounded text-xs border",E.isOverLimit&&"bg-red-50 text-red-700 border-red-200",E.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!E.isOverLimit&&!E.isNearLimit&&"bg-gray-50 text-gray-700 border-gray-200"),children:["U: ",p.total_users_used,"/",p.total_users]}),p&&null!==p.total_teams&&(0,t.jsxs)("span",{className:u("flex-shrink-0 px-1.5 py-0.5 rounded text-xs border",R.isOverLimit&&"bg-red-50 text-red-700 border-red-200",R.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!R.isOverLimit&&!R.isNearLimit&&"bg-gray-50 text-gray-700 border-gray-200"),children:["T: ",p.total_teams_used,"/",p.total_teams]}),N?.expiration_date&&null!==O&&(0,t.jsx)("span",{className:u("flex-shrink-0 px-1.5 py-0.5 rounded text-xs border",C&&"bg-red-50 text-red-700 border-red-200",k&&"bg-yellow-50 text-yellow-700 border-yellow-200",!C&&!k&&"bg-gray-50 text-gray-700 border-gray-200"),children:O<0?"Exp!":`${O}d`}),!p||null===p.total_users&&null===p.total_teams&&!N&&(0,t.jsx)("span",{className:"truncate",children:"Usage"})]})]})}):j?(0,t.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg shadow-sm p-4 w-full",children:(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 py-2",children:[(0,t.jsx)(i.Loader2,{className:"h-4 w-4 animate-spin"}),(0,t.jsx)("span",{className:"text-sm text-gray-500 truncate",children:"Loading..."})]})}):z||!p?(0,t.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg shadow-sm p-4 group w-full",children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex-1 min-w-0",children:(0,t.jsx)("span",{className:"text-sm text-gray-500 truncate block",children:z||"No data"})}),(0,t.jsx)("button",{onClick:()=>y(!0),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-gray-100 rounded transition-all flex-shrink-0",title:"Minimize",children:(0,t.jsx)(l.Minus,{className:"h-3 w-3 text-gray-400"})})]})}):(0,t.jsxs)("div",{className:u("bg-white border rounded-lg shadow-sm p-3 transition-all duration-200 group w-full"),children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,t.jsx)(d.Users,{className:"h-4 w-4 flex-shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:"Usage"})]}),(0,t.jsx)("button",{onClick:()=>y(!0),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-gray-100 rounded transition-all flex-shrink-0",title:"Minimize",children:(0,t.jsx)(l.Minus,{className:"h-3 w-3 text-gray-400"})})]}),(0,t.jsxs)("div",{className:"space-y-3 text-sm",children:[N?.has_license&&N.expiration_date&&(0,t.jsxs)("div",{className:u("space-y-1 border rounded-md p-2",C&&"border-red-200 bg-red-50",k&&"border-yellow-200 bg-yellow-50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-600 mb-1",children:[(0,t.jsx)(r.Calendar,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-medium",children:"License"}),(0,t.jsx)("span",{className:u("ml-1 px-1.5 py-0.5 rounded border",C&&"bg-red-50 text-red-700 border-red-200",k&&"bg-yellow-50 text-yellow-700 border-yellow-200",!C&&!k&&"bg-gray-50 text-gray-600 border-gray-200"),children:C?"Expired":k?"Expiring soon":"OK"})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Status:"}),(0,t.jsx)("span",{className:u("font-medium text-right",C&&"text-red-600",k&&"text-yellow-600"),children:(e=>{if(null===e)return"No expiration";if(e<0)return"Expired";if(0===e)return"Expires today";if(1===e)return"1 day remaining";if(e<30)return`${e} days remaining`;if(e<60)return"1 month remaining";let t=Math.floor(e/30);return`${t} months remaining`})(O)})]}),N.license_type&&(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Type:"}),(0,t.jsx)("span",{className:"font-medium text-right capitalize",children:N.license_type})]})]}),null!==p.total_users&&(0,t.jsxs)("div",{className:u("space-y-1 border rounded-md p-2",E.isOverLimit&&"border-red-200 bg-red-50",E.isNearLimit&&"border-yellow-200 bg-yellow-50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-600 mb-1",children:[(0,t.jsx)(d.Users,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-medium",children:"Users"}),(0,t.jsx)("span",{className:u("ml-1 px-1.5 py-0.5 rounded border",E.isOverLimit&&"bg-red-50 text-red-700 border-red-200",E.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!E.isOverLimit&&!E.isNearLimit&&"bg-gray-50 text-gray-600 border-gray-200"),children:E.isOverLimit?"Over limit":E.isNearLimit?"Near limit":"OK"})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Used:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[p.total_users_used,"/",p.total_users]})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Remaining:"}),(0,t.jsx)("span",{className:u("font-medium text-right",E.isOverLimit&&"text-red-600",E.isNearLimit&&"text-yellow-600"),children:p.total_users_remaining})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Usage:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[Math.round(E.usagePercentage),"%"]})]}),(0,t.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,t.jsx)("div",{className:u("h-2 rounded-full transition-all duration-300",E.isOverLimit&&"bg-red-500",E.isNearLimit&&"bg-yellow-500",!E.isOverLimit&&!E.isNearLimit&&"bg-green-500"),style:{width:`${Math.min(E.usagePercentage,100)}%`}})})]}),null!==p.total_teams&&(0,t.jsxs)("div",{className:u("space-y-1 border rounded-md p-2",R.isOverLimit&&"border-red-200 bg-red-50",R.isNearLimit&&"border-yellow-200 bg-yellow-50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-600 mb-1",children:[(0,t.jsx)(n.UserCheck,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-medium",children:"Teams"}),(0,t.jsx)("span",{className:u("ml-1 px-1.5 py-0.5 rounded border",R.isOverLimit&&"bg-red-50 text-red-700 border-red-200",R.isNearLimit&&"bg-yellow-50 text-yellow-700 border-yellow-200",!R.isOverLimit&&!R.isNearLimit&&"bg-gray-50 text-gray-600 border-gray-200"),children:R.isOverLimit?"Over limit":R.isNearLimit?"Near limit":"OK"})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Used:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[p.total_teams_used,"/",p.total_teams]})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Remaining:"}),(0,t.jsx)("span",{className:u("font-medium text-right",R.isOverLimit&&"text-red-600",R.isNearLimit&&"text-yellow-600"),children:p.total_teams_remaining})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-600 text-xs",children:"Usage:"}),(0,t.jsxs)("span",{className:"font-medium text-right",children:[Math.round(R.usagePercentage),"%"]})]}),(0,t.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-2",children:(0,t.jsx)("div",{className:u("h-2 rounded-full transition-all duration-300",R.isOverLimit&&"bg-red-500",R.isNearLimit&&"bg-yellow-500",!R.isOverLimit&&!R.isNearLimit&&"bg-green-500"),style:{width:`${Math.min(R.usagePercentage,100)}%`}})})]})]})]}),{})})}e.s(["default",()=>f])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/0d1694151d7fdaec.js b/litellm/proxy/_experimental/out/_next/static/chunks/0d1694151d7fdaec.js new file mode 100644 index 00000000000..6c9e93d7db9 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/0d1694151d7fdaec.js @@ -0,0 +1,38 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,349356,e=>{e.v({AElig:"Æ",AMP:"&",Aacute:"Á",Acirc:"Â",Agrave:"À",Aring:"Å",Atilde:"Ã",Auml:"Ä",COPY:"©",Ccedil:"Ç",ETH:"Ð",Eacute:"É",Ecirc:"Ê",Egrave:"È",Euml:"Ë",GT:">",Iacute:"Í",Icirc:"Î",Igrave:"Ì",Iuml:"Ï",LT:"<",Ntilde:"Ñ",Oacute:"Ó",Ocirc:"Ô",Ograve:"Ò",Oslash:"Ø",Otilde:"Õ",Ouml:"Ö",QUOT:'"',REG:"®",THORN:"Þ",Uacute:"Ú",Ucirc:"Û",Ugrave:"Ù",Uuml:"Ü",Yacute:"Ý",aacute:"á",acirc:"â",acute:"´",aelig:"æ",agrave:"à",amp:"&",aring:"å",atilde:"ã",auml:"ä",brvbar:"¦",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",ecirc:"ê",egrave:"è",eth:"ð",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",iacute:"í",icirc:"î",iexcl:"¡",igrave:"ì",iquest:"¿",iuml:"ï",laquo:"«",lt:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",oacute:"ó",ocirc:"ô",ograve:"ò",ordf:"ª",ordm:"º",oslash:"ø",otilde:"õ",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',raquo:"»",reg:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",thorn:"þ",times:"×",uacute:"ú",ucirc:"û",ugrave:"ù",uml:"¨",uuml:"ü",yacute:"ý",yen:"¥",yuml:"ÿ"})},137429,e=>{e.v({0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"})},434626,e=>{"use strict";var r=e.i(271645);let t=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.s(["ExternalLinkIcon",0,t],434626)},902555,e=>{"use strict";var r=e.i(843476),t=e.i(591935),l=e.i(122577),a=e.i(278587),o=e.i(68155),i=e.i(360820),n=e.i(871943),s=e.i(434626),d=e.i(592968),c=e.i(115504),u=e.i(752978);function m({icon:e,onClick:t,className:l,disabled:a,dataTestId:o}){return a?(0,r.jsx)(u.Icon,{icon:e,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":o}):(0,r.jsx)(u.Icon,{icon:e,size:"sm",onClick:t,className:(0,c.cx)("cursor-pointer",l),"data-testid":o})}let g={Edit:{icon:t.PencilAltIcon,className:"hover:text-blue-600"},Delete:{icon:o.TrashIcon,className:"hover:text-red-600"},Test:{icon:l.PlayIcon,className:"hover:text-blue-600"},Regenerate:{icon:a.RefreshIcon,className:"hover:text-green-600"},Up:{icon:i.ChevronUpIcon,className:"hover:text-blue-600"},Down:{icon:n.ChevronDownIcon,className:"hover:text-blue-600"},Open:{icon:s.ExternalLinkIcon,className:"hover:text-green-600"}};function h({onClick:e,tooltipText:t,disabled:l=!1,disabledTooltipText:a,dataTestId:o,variant:i}){let{icon:n,className:s}=g[i];return(0,r.jsx)(d.Tooltip,{title:l?a:t,children:(0,r.jsx)("span",{children:(0,r.jsx)(m,{icon:n,onClick:e,className:s,disabled:l,dataTestId:o})})})}e.s(["default",()=>h],902555)},122577,e=>{"use strict";var r=e.i(271645);let t=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["PlayIcon",0,t],122577)},207670,e=>{"use strict";function r(){for(var e,r,t=0,l="",a=arguments.length;tr,"default",0,r])},728889,e=>{"use strict";var r=e.i(290571),t=e.i(271645),l=e.i(829087),a=e.i(480731),o=e.i(444755),i=e.i(673706),n=e.i(95779);let s={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},d={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},c={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},u=(0,i.makeClassName)("Icon"),m=t.default.forwardRef((e,m)=>{let{icon:g,variant:h="simple",tooltip:b,size:p=a.Sizes.SM,color:x,className:f}=e,j=(0,r.__rest)(e,["icon","variant","tooltip","size","color","className"]),C=((e,r)=>{switch(e){case"simple":return{textColor:r?(0,i.getColorClassNames)(r,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:r?(0,i.getColorClassNames)(r,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,o.tremorTwMerge)((0,i.getColorClassNames)(r,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:r?(0,i.getColorClassNames)(r,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,o.tremorTwMerge)((0,i.getColorClassNames)(r,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:r?(0,i.getColorClassNames)(r,n.colorPalette.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:r?(0,o.tremorTwMerge)((0,i.getColorClassNames)(r,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:r?(0,i.getColorClassNames)(r,n.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,o.tremorTwMerge)((0,i.getColorClassNames)(r,n.colorPalette.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:r?(0,i.getColorClassNames)(r,n.colorPalette.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:r?(0,o.tremorTwMerge)((0,i.getColorClassNames)(r,n.colorPalette.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}})(h,x),{tooltipProps:k,getReferenceProps:y}=(0,l.useTooltip)();return t.default.createElement("span",Object.assign({ref:(0,i.mergeRefs)([m,k.refs.setReference]),className:(0,o.tremorTwMerge)(u("root"),"inline-flex shrink-0 items-center justify-center",C.bgColor,C.textColor,C.borderColor,C.ringColor,c[h].rounded,c[h].border,c[h].shadow,c[h].ring,s[p].paddingX,s[p].paddingY,f)},y,j),t.default.createElement(l.default,Object.assign({text:b},k)),t.default.createElement(g,{className:(0,o.tremorTwMerge)(u("icon"),"shrink-0",d[p].height,d[p].width)}))});m.displayName="Icon",e.s(["default",()=>m],728889)},752978,e=>{"use strict";var r=e.i(728889);e.s(["Icon",()=>r.default])},591935,e=>{"use strict";var r=e.i(271645);let t=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});e.s(["PencilAltIcon",0,t],591935)},646050,e=>{"use strict";var r=e.i(843476),t=e.i(994388),l=e.i(304967),a=e.i(197647),o=e.i(653824),i=e.i(269200),n=e.i(942232),s=e.i(977572),d=e.i(427612),c=e.i(64848),u=e.i(496020),m=e.i(881073),g=e.i(404206),h=e.i(723731),b=e.i(599724),p=e.i(271645),x=e.i(650056),f=e.i(127952),j=e.i(902555),C=e.i(727749),k=e.i(764205),y=e.i(779241),T=e.i(677667),v=e.i(898667),w=e.i(130643),I=e.i(464571),N=e.i(212931),B=e.i(808613),_=e.i(28651),P=e.i(199133);let A=({isModalVisible:e,accessToken:t,setIsModalVisible:l,setBudgetList:a})=>{let[o]=B.Form.useForm(),i=async e=>{if(null!=t&&void 0!=t)try{C.default.info("Making API Call");let r=await (0,k.budgetCreateCall)(t,e);console.log("key create Response:",r),a(e=>e?[...e,r]:[r]),C.default.success("Budget Created"),o.resetFields()}catch(e){console.error("Error creating the key:",e),C.default.fromBackend(`Error creating the key: ${e}`)}};return(0,r.jsx)(N.Modal,{title:"Create Budget",open:e,width:800,footer:null,onOk:()=>{l(!1),o.resetFields()},onCancel:()=>{l(!1),o.resetFields()},children:(0,r.jsxs)(B.Form,{form:o,onFinish:i,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(B.Form.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,r.jsx)(y.TextInput,{placeholder:""})}),(0,r.jsx)(B.Form.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,r.jsx)(_.InputNumber,{step:1,precision:2,width:200})}),(0,r.jsx)(B.Form.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,r.jsx)(_.InputNumber,{step:1,precision:2,width:200})}),(0,r.jsxs)(T.Accordion,{className:"mt-20 mb-8",children:[(0,r.jsx)(v.AccordionHeader,{children:(0,r.jsx)("b",{children:"Optional Settings"})}),(0,r.jsxs)(w.AccordionBody,{children:[(0,r.jsx)(B.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(_.InputNumber,{step:.01,precision:2,width:200})}),(0,r.jsx)(B.Form.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(P.Select,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(P.Select.Option,{value:"24h",children:"daily"}),(0,r.jsx)(P.Select.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(P.Select.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(I.Button,{htmlType:"submit",children:"Create Budget"})})]})})},E=({isModalVisible:e,accessToken:t,setIsModalVisible:l,setBudgetList:a,existingBudget:o,handleUpdateCall:i})=>{console.log("existingBudget",o);let[n]=B.Form.useForm();(0,p.useEffect)(()=>{n.setFieldsValue(o)},[o,n]);let s=async e=>{if(null!=t&&void 0!=t)try{C.default.info("Making API Call"),l(!0);let r=await (0,k.budgetUpdateCall)(t,e);a(e=>e?[...e,r]:[r]),C.default.success("Budget Updated"),n.resetFields(),i()}catch(e){console.error("Error creating the key:",e),C.default.fromBackend(`Error creating the key: ${e}`)}};return(0,r.jsx)(N.Modal,{title:"Edit Budget",open:e,width:800,footer:null,onOk:()=>{l(!1),n.resetFields()},onCancel:()=>{l(!1),n.resetFields()},children:(0,r.jsxs)(B.Form,{form:n,onFinish:s,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:o,children:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(B.Form.Item,{label:"Budget ID",name:"budget_id",rules:[{required:!0,message:"Please input a human-friendly name for the budget"}],help:"A human-friendly name for the budget",children:(0,r.jsx)(y.TextInput,{placeholder:""})}),(0,r.jsx)(B.Form.Item,{label:"Max Tokens per minute",name:"tpm_limit",help:"Default is model limit.",children:(0,r.jsx)(_.InputNumber,{step:1,precision:2,width:200})}),(0,r.jsx)(B.Form.Item,{label:"Max Requests per minute",name:"rpm_limit",help:"Default is model limit.",children:(0,r.jsx)(_.InputNumber,{step:1,precision:2,width:200})}),(0,r.jsxs)(T.Accordion,{className:"mt-20 mb-8",children:[(0,r.jsx)(v.AccordionHeader,{children:(0,r.jsx)("b",{children:"Optional Settings"})}),(0,r.jsxs)(w.AccordionBody,{children:[(0,r.jsx)(B.Form.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,r.jsx)(_.InputNumber,{step:.01,precision:2,width:200})}),(0,r.jsx)(B.Form.Item,{className:"mt-8",label:"Reset Budget",name:"budget_duration",children:(0,r.jsxs)(P.Select,{defaultValue:null,placeholder:"n/a",children:[(0,r.jsx)(P.Select.Option,{value:"24h",children:"daily"}),(0,r.jsx)(P.Select.Option,{value:"7d",children:"weekly"}),(0,r.jsx)(P.Select.Option,{value:"30d",children:"monthly"})]})})]})]})]}),(0,r.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,r.jsx)(I.Button,{htmlType:"submit",children:"Save"})})]})})},M=` +curl -X POST --location '/end_user/new' \\ + +-H 'Authorization: Bearer ' \\ + +-H 'Content-Type: application/json' \\ + +-d '{"user_id": "my-customer-id', "budget_id": ""}' # 👈 KEY CHANGE + +`,O=` +curl -X POST --location '/chat/completions' \\ + +-H 'Authorization: Bearer ' \\ + +-H 'Content-Type: application/json' \\ + +-d '{ + "model": "gpt-3.5-turbo', + "messages":[{"role": "user", "content": "Hey, how's it going?"}], + "user": "my-customer-id" +}' # 👈 KEY CHANGE + +`,F=`from openai import OpenAI +client = OpenAI( + base_url="", + api_key="" +) + +completion = client.chat.completions.create( + model="gpt-3.5-turbo", + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Hello!"} + ], + user="my-customer-id" +) + +print(completion.choices[0].message)`;e.s(["default",0,({accessToken:e})=>{let[y,T]=(0,p.useState)(!1),[v,w]=(0,p.useState)(!1),[I,N]=(0,p.useState)(null),[B,_]=(0,p.useState)([]),[P,S]=(0,p.useState)(!1),[D,R]=(0,p.useState)(!1);(0,p.useEffect)(()=>{e&&(0,k.getBudgetList)(e).then(e=>{_(e)})},[e]);let H=async r=>{null!=e&&(N(r),w(!0))},L=async()=>{if(I&&null!=e){S(!0);try{await (0,k.budgetDeleteCall)(e,I.budget_id),C.default.success("Budget deleted."),await U()}catch(e){console.error("Error deleting budget:",e),"function"==typeof C.default.fromBackend?C.default.fromBackend("Failed to delete budget"):C.default.info("Failed to delete budget")}finally{S(!1),R(!1),N(null)}}},U=async()=>{null!=e&&(0,k.getBudgetList)(e).then(e=>{_(e)})};return(0,r.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,r.jsx)(t.Button,{size:"sm",variant:"primary",className:"mb-2",onClick:()=>T(!0),children:"+ Create Budget"}),(0,r.jsxs)(o.TabGroup,{children:[(0,r.jsxs)(m.TabList,{children:[(0,r.jsx)(a.Tab,{children:"Budgets"}),(0,r.jsx)(a.Tab,{children:"Examples"})]}),(0,r.jsxs)(h.TabPanels,{children:[(0,r.jsx)(g.TabPanel,{children:(0,r.jsxs)("div",{className:"mt-6",children:[(0,r.jsx)(A,{accessToken:e,isModalVisible:y,setIsModalVisible:T,setBudgetList:_}),I&&(0,r.jsx)(E,{accessToken:e,isModalVisible:v,setIsModalVisible:w,setBudgetList:_,existingBudget:I,handleUpdateCall:U}),(0,r.jsxs)(l.Card,{children:[(0,r.jsx)(b.Text,{children:"Create a budget to assign to customers."}),(0,r.jsxs)(i.Table,{children:[(0,r.jsx)(d.TableHead,{children:(0,r.jsxs)(u.TableRow,{children:[(0,r.jsx)(c.TableHeaderCell,{children:"Budget ID"}),(0,r.jsx)(c.TableHeaderCell,{children:"Max Budget"}),(0,r.jsx)(c.TableHeaderCell,{children:"TPM"}),(0,r.jsx)(c.TableHeaderCell,{children:"RPM"})]})}),(0,r.jsx)(n.TableBody,{children:B.slice().sort((e,r)=>new Date(r.updated_at).getTime()-new Date(e.updated_at).getTime()).map((e,t)=>(0,r.jsxs)(u.TableRow,{children:[(0,r.jsx)(s.TableCell,{children:e.budget_id}),(0,r.jsx)(s.TableCell,{children:e.max_budget?e.max_budget:"n/a"}),(0,r.jsx)(s.TableCell,{children:e.tpm_limit?e.tpm_limit:"n/a"}),(0,r.jsx)(s.TableCell,{children:e.rpm_limit?e.rpm_limit:"n/a"}),(0,r.jsx)(j.default,{variant:"Edit",tooltipText:"Edit budget",onClick:()=>H(e),dataTestId:"edit-budget-button"}),(0,r.jsx)(j.default,{variant:"Delete",tooltipText:"Delete budget",onClick:()=>{N(e),R(!0)},dataTestId:"delete-budget-button"})]},t))})]})]}),(0,r.jsx)(f.default,{isOpen:D,title:"Delete Budget?",message:"Are you sure you want to delete this budget? This action cannot be undone.",resourceInformationTitle:"Budget Information",resourceInformation:[{label:"Budget ID",value:I?.budget_id,code:!0},{label:"Max Budget",value:I?.max_budget},{label:"TPM",value:I?.tpm_limit},{label:"RPM",value:I?.rpm_limit}],onCancel:()=>{R(!1)},onOk:L,confirmLoading:P})]})}),(0,r.jsx)(g.TabPanel,{children:(0,r.jsxs)("div",{className:"mt-6",children:[(0,r.jsx)(b.Text,{className:"text-base",children:"How to use budget id"}),(0,r.jsxs)(o.TabGroup,{children:[(0,r.jsxs)(m.TabList,{children:[(0,r.jsx)(a.Tab,{children:"Assign Budget to Customer"}),(0,r.jsx)(a.Tab,{children:"Test it (Curl)"}),(0,r.jsx)(a.Tab,{children:"Test it (OpenAI SDK)"})]}),(0,r.jsxs)(h.TabPanels,{children:[(0,r.jsx)(g.TabPanel,{children:(0,r.jsx)(x.Prism,{language:"bash",children:M})}),(0,r.jsx)(g.TabPanel,{children:(0,r.jsx)(x.Prism,{language:"bash",children:O})}),(0,r.jsx)(g.TabPanel,{children:(0,r.jsx)(x.Prism,{language:"python",children:F})})]})]})]})})]})]})]})}],646050)},267167,e=>{"use strict";var r=e.i(843476),t=e.i(646050),l=e.i(135214);e.s(["default",0,()=>{let{accessToken:e}=(0,l.default)();return(0,r.jsx)(t.default,{accessToken:e})}])}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1067d2c077cd73d6.js b/litellm/proxy/_experimental/out/_next/static/chunks/1067d2c077cd73d6.js new file mode 100644 index 00000000000..0379598998b --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1067d2c077cd73d6.js @@ -0,0 +1,4 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,751734,e=>{"use strict";let t=(0,e.i(271645).createContext)(0);e.s(["default",()=>t])},144582,e=>{"use strict";let t=(0,e.i(271645).createContext)({selectedValue:void 0,handleValueChange:void 0});e.s(["default",()=>t])},404206,e=>{"use strict";var t=e.i(290571),r=e.i(751734),n=e.i(144582),o=e.i(444755),a=e.i(673706),s=e.i(271645);let l=(0,a.makeClassName)("TabPanel"),i=s.default.forwardRef((e,a)=>{let{children:i,className:u}=e,c=(0,t.__rest)(e,["children","className"]),{selectedValue:d}=(0,s.useContext)(n.default),f=d===(0,s.useContext)(r.default);return s.default.createElement("div",Object.assign({ref:a,className:(0,o.tremorTwMerge)(l("root"),"w-full mt-2",f?"":"hidden",u),"aria-selected":f?"true":"false"},c),i)});i.displayName="TabPanel",e.s(["TabPanel",()=>i],404206)},429427,371330,80758,402155,368578,544508,746725,835696,941444,914189,394487,e=>{"use strict";let t;e.i(247167);var r=e.i(271645);let n="u">typeof document?r.default.useLayoutEffect:()=>{},o=e=>{var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document},a=e=>e&&"window"in e&&e.window===e?e:o(e).defaultView||window;"u">typeof Element&&Element.prototype;let s=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"];s.join(":not([hidden]),"),s.push('[tabindex]:not([tabindex="-1"]):not([disabled])'),s.join(':not([hidden]):not([tabindex="-1"]),');let l=null;function i(e){return e.nativeEvent=e,e.isDefaultPrevented=()=>e.defaultPrevented,e.isPropagationStopped=()=>e.cancelBubble,e.persist=()=>{},e}function u(e){let t=(0,r.useRef)({isFocused:!1,observer:null});return n(()=>{let e=t.current;return()=>{e.observer&&(e.observer.disconnect(),e.observer=null)}},[]),(0,r.useCallback)(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let n=r.target;n.addEventListener("focusout",r=>{if(t.current.isFocused=!1,n.disabled){let t=i(r);null==e||e(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&n.disabled){var e;null==(e=t.current.observer)||e.disconnect();let r=n===document.activeElement?null:document.activeElement;n.dispatchEvent(new FocusEvent("blur",{relatedTarget:r})),n.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:r}))}}),t.current.observer.observe(n,{attributes:!0,attributeFilter:["disabled"]})}},[e])}function c(e){var t;if("u"e.test(t.brand))||e.test(window.navigator.userAgent)}function d(e){var t;return"u">typeof window&&null!=window.navigator&&e.test((null==(t=window.navigator.userAgentData)?void 0:t.platform)||window.navigator.platform)}function f(e){let t=null;return()=>(null==t&&(t=e()),t)}let p=f(function(){return d(/^Mac/i)}),m=f(function(){return d(/^iPhone/i)}),v=f(function(){return d(/^iPad/i)||p()&&navigator.maxTouchPoints>1}),b=f(function(){return m()||v()});f(function(){return p()||b()});let g=f(function(){return c(/AppleWebKit/i)&&!h()}),h=f(function(){return c(/Chrome/i)}),y=f(function(){return c(/Android/i)}),E=f(function(){return c(/Firefox/i)});function w(e,t,r=!0){var n,o;let{metaKey:a,ctrlKey:s,altKey:i,shiftKey:u}=t;E()&&(null==(o=window.event)||null==(n=o.type)?void 0:n.startsWith("key"))&&"_blank"===e.target&&(p()?a=!0:s=!0);let c=g()&&p()&&!v()&&1?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:a,ctrlKey:s,altKey:i,shiftKey:u}):new MouseEvent("click",{metaKey:a,ctrlKey:s,altKey:i,shiftKey:u,detail:1,bubbles:!0,cancelable:!0});if(w.isOpening=r,function(){if(null==l){l=!1;try{document.createElement("div").focus({get preventScroll(){return l=!0,!0}})}catch{}}return l}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeighttypeof window&&window.document&&window.document.createElement,new WeakMap;r.default.useId;let x=null,F=new Set,P=new Map,k=!1,L=!1,N={Tab:!0,Escape:!0};function C(e,t){for(let r of F)r(e,t)}function I(e){k=!0,w.isOpening||e.metaKey||!p()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key||(x="keyboard",C("keyboard",e))}function S(e){x="pointer","pointerType"in e&&e.pointerType,("mousedown"===e.type||"pointerdown"===e.type)&&(k=!0,C("pointer",e))}function A(e){w.isOpening||(""!==e.pointerType||!e.isTrusted)&&(y()&&e.pointerType?"click"!==e.type||1!==e.buttons:0!==e.detail||e.pointerType)||(k=!0,x="virtual")}function M(e){e.target!==window&&e.target!==document&&e.isTrusted&&(k||L||(x="virtual",C("virtual",e)),k=!1,L=!1)}function R(){k=!1,L=!0}function O(e){if("u"typeof PointerEvent&&(r.addEventListener("pointerdown",S,!0),r.addEventListener("pointermove",S,!0),r.addEventListener("pointerup",S,!0)),t.addEventListener("beforeunload",()=>{D(e)},{once:!0}),P.set(t,{focus:n})}let D=(e,t)=>{let r=a(e),n=o(e);t&&n.removeEventListener("DOMContentLoaded",t),P.has(r)&&(r.HTMLElement.prototype.focus=P.get(r).focus,n.removeEventListener("keydown",I,!0),n.removeEventListener("keyup",I,!0),n.removeEventListener("click",A,!0),r.removeEventListener("focus",M,!0),r.removeEventListener("blur",R,!1),"u">typeof PointerEvent&&(n.removeEventListener("pointerdown",S,!0),n.removeEventListener("pointermove",S,!0),n.removeEventListener("pointerup",S,!0)),P.delete(r))};function H(){return"pointer"!==x}"u">typeof document&&("loading"!==(t=o(void 0)).readyState?O(void 0):t.addEventListener("DOMContentLoaded",()=>{O(void 0)}));let j=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function K(e,t){return!!t&&!!e&&e.contains(t)}function W(){let e=(0,r.useRef)(new Map),t=(0,r.useCallback)((t,r,n,o)=>{let a=(null==o?void 0:o.once)?(...t)=>{e.current.delete(n),n(...t)}:n;e.current.set(n,{type:r,eventTarget:t,fn:a,options:o}),t.addEventListener(r,a,o)},[]),n=(0,r.useCallback)((t,r,n,o)=>{var a;let s=(null==(a=e.current.get(n))?void 0:a.fn)||n;t.removeEventListener(r,s,o),e.current.delete(n)},[]),o=(0,r.useCallback)(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return(0,r.useEffect)(()=>o,[o]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:o}}function B(e={}){var t;let{autoFocus:n=!1,isTextInput:s,within:l}=e,c=(0,r.useRef)({isFocused:!1,isFocusVisible:n||H()}),[d,f]=(0,r.useState)(!1),[p,m]=(0,r.useState)(()=>c.current.isFocused&&c.current.isFocusVisible),v=(0,r.useCallback)(()=>m(c.current.isFocused&&c.current.isFocusVisible),[]),b=(0,r.useCallback)(e=>{c.current.isFocused=e,f(e),v()},[v]);t={isTextInput:s},O(),(0,r.useEffect)(()=>{let e=(e,r)=>{var n;let s,l,i,u,d;n=!!(null==t?void 0:t.isTextInput),s=o(null==r?void 0:r.target),l="u">typeof window?a(null==r?void 0:r.target).HTMLInputElement:HTMLInputElement,i="u">typeof window?a(null==r?void 0:r.target).HTMLTextAreaElement:HTMLTextAreaElement,u="u">typeof window?a(null==r?void 0:r.target).HTMLElement:HTMLElement,d="u">typeof window?a(null==r?void 0:r.target).KeyboardEvent:KeyboardEvent,(n=n||s.activeElement instanceof l&&!j.has(s.activeElement.type)||s.activeElement instanceof i||s.activeElement instanceof u&&s.activeElement.isContentEditable)&&"keyboard"===e&&r instanceof d&&!N[r.key]||(e=>{c.current.isFocusVisible=e,v()})(H())};return F.add(e),()=>{F.delete(e)}},[]);let{focusProps:g}=function(e){let{isDisabled:t,onFocus:n,onBlur:a,onFocusChange:s}=e,l=(0,r.useCallback)(e=>{if(e.target===e.currentTarget)return a&&a(e),s&&s(!1),!0},[a,s]),i=u(l),c=(0,r.useCallback)(e=>{var t;let r=o(e.target),a=r?((e=document)=>e.activeElement)(r):((e=document)=>e.activeElement)();e.target===e.currentTarget&&a===(t=e.nativeEvent,t.target)&&(n&&n(e),s&&s(!0),i(e))},[s,n,i]);return{focusProps:{onFocus:!t&&(n||s||a)?c:void 0,onBlur:!t&&(a||s)?l:void 0}}}({isDisabled:l,onFocusChange:b}),{focusWithinProps:h}=function(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:a,onFocusWithinChange:s}=e,l=(0,r.useRef)({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:d}=W(),f=(0,r.useCallback)(e=>{e.currentTarget.contains(e.target)&&l.current.isFocusWithin&&!e.currentTarget.contains(e.relatedTarget)&&(l.current.isFocusWithin=!1,d(),n&&n(e),s&&s(!1))},[n,s,l,d]),p=u(f),m=(0,r.useCallback)(e=>{var t;if(!e.currentTarget.contains(e.target))return;let r=o(e.target),n=((e=document)=>e.activeElement)(r);if(!l.current.isFocusWithin&&n===(t=e.nativeEvent,t.target)){a&&a(e),s&&s(!0),l.current.isFocusWithin=!0,p(e);let t=e.currentTarget;c(r,"focus",e=>{if(l.current.isFocusWithin&&!K(t,e.target)){let n=new r.defaultView.FocusEvent("blur",{relatedTarget:e.target});Object.defineProperty(n,"target",{value:t}),Object.defineProperty(n,"currentTarget",{value:t}),f(i(n))}},{capture:!0})}},[a,s,p,c,f]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:m,onBlur:f}}}({isDisabled:!l,onFocusWithinChange:b});return{isFocused:d,isFocusVisible:p,focusProps:l?h:g}}e.s(["useFocusRing",()=>B],429427);let V=!1,_=0;function G(e){"touch"===e.pointerType&&(V=!0,setTimeout(()=>{V=!1},50))}function U(){if("u">typeof document)return 0===_&&"u">typeof PointerEvent&&document.addEventListener("pointerup",G),_++,()=>{!(--_>0)&&"u">typeof PointerEvent&&document.removeEventListener("pointerup",G)}}function $(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:a,isDisabled:s}=e,[l,i]=(0,r.useState)(!1),u=(0,r.useRef)({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;(0,r.useEffect)(U,[]);let{addGlobalListener:c,removeAllGlobalListeners:d}=W(),{hoverProps:f,triggerHoverEnd:p}=(0,r.useMemo)(()=>{let e=(e,t)=>{let r=u.target;u.pointerType="",u.target=null,"touch"!==t&&u.isHovered&&r&&(u.isHovered=!1,d(),a&&a({type:"hoverend",target:r,pointerType:t}),n&&n(!1),i(!1))},r={};return"u">typeof PointerEvent&&(r.onPointerEnter=r=>{V&&"mouse"===r.pointerType||((r,a)=>{if(u.pointerType=a,s||"touch"===a||u.isHovered||!r.currentTarget.contains(r.target))return;u.isHovered=!0;let l=r.currentTarget;u.target=l,c(o(r.target),"pointerover",t=>{u.isHovered&&u.target&&!K(u.target,t.target)&&e(t,t.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:l,pointerType:a}),n&&n(!0),i(!0)})(r,r.pointerType)},r.onPointerLeave=t=>{!s&&t.currentTarget.contains(t.target)&&e(t,t.pointerType)}),{hoverProps:r,triggerHoverEnd:e}},[t,n,a,s,u,c,d]);return(0,r.useEffect)(()=>{s&&p({currentTarget:u.target},u.pointerType)},[s]),{hoverProps:f,isHovered:l}}e.s(["useHover",()=>$],371330);var q=Object.defineProperty,X=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?q(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,r};let Y=new class{constructor(){X(this,"current",this.detect()),X(this,"handoffState","pending"),X(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return"server"===this.current}get isClient(){return"client"===this.current}detect(){return"u"setTimeout(()=>{throw e}))}function J(){let e=[],t={addEventListener:(e,r,n,o)=>(e.addEventListener(r,n,o),t.add(()=>e.removeEventListener(r,n,o))),requestAnimationFrame(...e){let r=requestAnimationFrame(...e);return t.add(()=>cancelAnimationFrame(r))},nextFrame:(...e)=>t.requestAnimationFrame(()=>t.requestAnimationFrame(...e)),setTimeout(...e){let r=setTimeout(...e);return t.add(()=>clearTimeout(r))},microTask(...e){let r={current:!0};return Z(()=>{r.current&&e[0]()}),t.add(()=>{r.current=!1})},style(e,t,r){let n=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:r}),this.add(()=>{Object.assign(e.style,{[t]:n})})},group(e){let t=J();return e(t),this.add(()=>t.dispose())},add:t=>(e.includes(t)||e.push(t),()=>{let r=e.indexOf(t);if(r>=0)for(let t of e.splice(r,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function Q(){let[e]=(0,r.useState)(J);return(0,r.useEffect)(()=>()=>e.dispose(),[e]),e}e.s(["env",()=>Y],80758),e.s(["getOwnerDocument",()=>z],402155),e.s(["microTask",()=>Z],368578),e.s(["disposables",()=>J],544508),e.s(["useDisposables",()=>Q],746725);let ee=(e,t)=>{Y.isServer?(0,r.useEffect)(e,t):(0,r.useLayoutEffect)(e,t)};function et(e){let t=(0,r.useRef)(e);return ee(()=>{t.current=e},[e]),t}e.s(["useIsoMorphicEffect",()=>ee],835696),e.s(["useLatestValue",()=>et],941444);let er=function(e){let t=et(e);return r.default.useCallback((...e)=>t.current(...e),[t])};function en({disabled:e=!1}={}){let t=(0,r.useRef)(null),[n,o]=(0,r.useState)(!1),a=Q(),s=er(()=>{t.current=null,o(!1),a.dispose()}),l=er(e=>{if(a.dispose(),null===t.current){t.current=e.currentTarget,o(!0);{let r=z(e.currentTarget);a.addEventListener(r,"pointerup",s,!1),a.addEventListener(r,"pointermove",e=>{if(t.current){var r,n;let a,s;o((a=e.width/2,s=e.height/2,r={top:e.clientY-s,right:e.clientX+a,bottom:e.clientY+s,left:e.clientX-a},n=t.current.getBoundingClientRect(),!(!r||!n||r.rightn.right||r.bottomn.bottom)))}},!1),a.addEventListener(r,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:l,onPointerUp:s,onClick:s}}}e.s(["useEvent",()=>er],914189),e.s(["useActivePress",()=>en],394487)},144279,294316,e=>{"use strict";var t=e.i(271645);function r(e,r){return(0,t.useMemo)(()=>{var t;if(e.type)return e.type;let n=null!=(t=e.as)?t:"button";if("string"==typeof n&&"button"===n.toLowerCase()||(null==r?void 0:r.tagName)==="BUTTON"&&!r.hasAttribute("type"))return"button"},[e.type,e.as,r])}e.s(["useResolveButtonType",()=>r],144279);var n=e.i(914189);let o=Symbol();function a(e,t=!0){return Object.assign(e,{[o]:t})}function s(...e){let r=(0,t.useRef)(e);(0,t.useEffect)(()=>{r.current=e},[e]);let a=(0,n.useEvent)(e=>{for(let t of r.current)null!=t&&("function"==typeof t?t(e):t.current=e)});return e.every(e=>null==e||(null==e?void 0:e[o]))?void 0:a}e.s(["optionalRef",()=>a,"useSyncRefs",()=>s],294316)},553521,e=>{"use strict";var t=e.i(271645),r=e.i(835696);function n(){let e=(0,t.useRef)(!1);return(0,r.useIsoMorphicEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),e}e.s(["useIsMounted",()=>n])},732607,e=>{"use strict";function t(...e){return Array.from(new Set(e.flatMap(e=>"string"==typeof e?e.split(" "):[]))).filter(Boolean).join(" ")}e.s(["classNames",()=>t])},397701,e=>{"use strict";function t(e,r,...n){if(e in r){let t=r[e];return"function"==typeof t?t(...n):t}let o=Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(r).map(e=>`"${e}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,t),o}e.s(["match",()=>t])},700020,e=>{"use strict";let t,r;var n=e.i(271645),o=e.i(732607),a=e.i(397701),s=((t=s||{})[t.None=0]="None",t[t.RenderStrategy=1]="RenderStrategy",t[t.Static=2]="Static",t),l=((r=l||{})[r.Unmount=0]="Unmount",r[r.Hidden=1]="Hidden",r);function i(){let e,t,r=(e=(0,n.useRef)([]),t=(0,n.useCallback)(t=>{for(let r of e.current)null!=r&&("function"==typeof r?r(t):r.current=t)},[]),(...r)=>{if(!r.every(e=>null==e))return e.current=r,t});return(0,n.useCallback)(e=>(function({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:o,visible:s=!0,name:l,mergeRefs:i}){i=null!=i?i:c;let f=d(t,e);if(s)return u(f,r,n,l,i);let p=null!=o?o:0;if(2&p){let{static:e=!1,...t}=f;if(e)return u(t,r,n,l,i)}if(1&p){let{unmount:e=!0,...t}=f;return(0,a.match)(+!e,{0:()=>null,1:()=>u({...t,hidden:!0,style:{display:"none"}},r,n,l,i)})}return u(f,r,n,l,i)})({mergeRefs:r,...e}),[r])}function u(e,t={},r,a,s){let{as:l=r,children:i,refName:c="ref",...f}=v(e,["unmount","static"]),p=void 0!==e.ref?{[c]:e.ref}:{},b="function"==typeof i?i(t):i;"className"in f&&f.className&&"function"==typeof f.className&&(f.className=f.className(t)),f["aria-labelledby"]&&f["aria-labelledby"]===f.id&&(f["aria-labelledby"]=void 0);let g={};if(t){let e=!1,r=[];for(let[n,o]of Object.entries(t))"boolean"==typeof o&&(e=!0),!0===o&&r.push(n.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`));if(e)for(let e of(g["data-headlessui-state"]=r.join(" "),r))g[`data-${e}`]=""}if(l===n.Fragment&&(Object.keys(m(f)).length>0||Object.keys(m(g)).length>0))if(!(0,n.isValidElement)(b)||Array.isArray(b)&&b.length>1){if(Object.keys(m(f)).length>0)throw Error(['Passing props on "Fragment"!',"",`The current component <${a} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(m(f)).concat(Object.keys(m(g))).map(e=>` - ${e}`).join(` +`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(e=>` - ${e}`).join(` +`)].join(` +`))}else{var h;let e=b.props,t=null==e?void 0:e.className,r="function"==typeof t?(...e)=>(0,o.classNames)(t(...e),f.className):(0,o.classNames)(t,f.className),a=d(b.props,m(v(f,["ref"])));for(let e in g)e in a&&delete g[e];return(0,n.cloneElement)(b,Object.assign({},a,g,p,{ref:s((h=b,n.default.version.split(".")[0]>="19"?h.props.ref:h.ref),p.ref)},r?{className:r}:{}))}return(0,n.createElement)(l,Object.assign({},v(f,["ref"]),l!==n.Fragment&&p,l!==n.Fragment&&g),b)}function c(...e){return e.every(e=>null==e)?void 0:t=>{for(let r of e)null!=r&&("function"==typeof r?r(t):r.current=t)}}function d(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},r={};for(let n of e)for(let e in n)e.startsWith("on")&&"function"==typeof n[e]?(null!=r[e]||(r[e]=[]),r[e].push(n[e])):t[e]=n[e];if(t.disabled||t["aria-disabled"])for(let e in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(e)&&(r[e]=[e=>{var t;return null==(t=null==e?void 0:e.preventDefault)?void 0:t.call(e)}]);for(let e in r)Object.assign(t,{[e](t,...n){for(let o of r[e]){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;o(t,...n)}}});return t}function f(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},r={};for(let n of e)for(let e in n)e.startsWith("on")&&"function"==typeof n[e]?(null!=r[e]||(r[e]=[]),r[e].push(n[e])):t[e]=n[e];for(let e in r)Object.assign(t,{[e](...t){for(let n of r[e])null==n||n(...t)}});return t}function p(e){var t;return Object.assign((0,n.forwardRef)(e),{displayName:null!=(t=e.displayName)?t:e.name})}function m(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function v(e,t=[]){let r=Object.assign({},e);for(let e of t)e in r&&delete r[e];return r}e.s(["RenderFeatures",()=>s,"RenderStrategy",()=>l,"compact",()=>m,"forwardRefWithAs",()=>p,"mergeProps",()=>f,"useRender",()=>i])},2788,e=>{"use strict";let t;var r=e.i(700020),n=((t=n||{})[t.None=1]="None",t[t.Focusable=2]="Focusable",t[t.Hidden=4]="Hidden",t);let o=(0,r.forwardRefWithAs)(function(e,t){var n;let{features:o=1,...a}=e,s={ref:t,"aria-hidden":(2&o)==2||(null!=(n=a["aria-hidden"])?n:void 0),hidden:(4&o)==4||void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(4&o)==4&&(2&o)!=2&&{display:"none"}}};return(0,r.useRender)()({ourProps:s,theirProps:a,slot:{},defaultTag:"span",name:"Hidden"})});e.s(["Hidden",()=>o,"HiddenFeatures",()=>n])},640497,e=>{"use strict";var t=e.i(271645),r=e.i(553521),n=e.i(2788);function o({onFocus:e}){let[o,a]=(0,t.useState)(!0),s=(0,r.useIsMounted)();return o?t.default.createElement(n.Hidden,{as:"button",type:"button",features:n.HiddenFeatures.Focusable,onFocus:t=>{t.preventDefault();let r,n=50;r=requestAnimationFrame(function t(){if(n--<=0){r&&cancelAnimationFrame(r);return}if(e()){if(cancelAnimationFrame(r),!s.current)return;a(!1);return}r=requestAnimationFrame(t)})}}):null}e.s(["FocusSentinel",()=>o])},652265,e=>{"use strict";let t,r,n,o,a;e.i(544508);var s=e.i(397701),l=e.i(402155);let i=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),u=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var c=((t=c||{})[t.First=1]="First",t[t.Previous=2]="Previous",t[t.Next=4]="Next",t[t.Last=8]="Last",t[t.WrapAround=16]="WrapAround",t[t.NoScroll=32]="NoScroll",t[t.AutoFocus=64]="AutoFocus",t),d=((r=d||{})[r.Error=0]="Error",r[r.Overflow=1]="Overflow",r[r.Success=2]="Success",r[r.Underflow=3]="Underflow",r),f=((n=f||{})[n.Previous=-1]="Previous",n[n.Next=1]="Next",n);function p(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(i)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var m=((o=m||{})[o.Strict=0]="Strict",o[o.Loose=1]="Loose",o);function v(e,t=0){var r;return e!==(null==(r=(0,l.getOwnerDocument)(e))?void 0:r.body)&&(0,s.match)(t,{0:()=>e.matches(i),1(){let t=e;for(;null!==t;){if(t.matches(i))return!0;t=t.parentElement}return!1}})}var b=((a=b||{})[a.Keyboard=0]="Keyboard",a[a.Mouse=1]="Mouse",a);function g(e,t=e=>e){return e.slice().sort((e,r)=>{let n=t(e),o=t(r);if(null===n||null===o)return 0;let a=n.compareDocumentPosition(o);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function h(e,t){return y(p(),t,{relativeTo:e})}function y(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:o=[]}={}){var a,s,l;let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,c=Array.isArray(e)?r?g(e):e:64&t?function(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(u)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}(e):p(e);o.length>0&&c.length>1&&(c=c.filter(e=>!o.some(t=>null!=t&&"current"in t?(null==t?void 0:t.current)===e:t===e))),n=null!=n?n:i.activeElement;let d=(()=>{if(5&t)return 1;if(10&t)return -1;throw Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),f=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,c.indexOf(n))-1;if(4&t)return Math.max(0,c.indexOf(n))+1;if(8&t)return c.length-1;throw Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),m=32&t?{preventScroll:!0}:{},v=0,b=c.length,h;do{if(v>=b||v+b<=0)return 0;let e=f+v;if(16&t)e=(e+b)%b;else{if(e<0)return 3;if(e>=b)return 1}null==(h=c[e])||h.focus(m),v+=d}while(h!==i.activeElement)return 6&t&&null!=(l=null==(s=null==(a=h)?void 0:a.matches)?void 0:s.call(a,"textarea,input"))&&l&&h.select(),2}"u">typeof window&&"u">typeof document&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{1===e.detail?delete document.documentElement.dataset.headlessuiFocusVisible:0===e.detail&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0)),e.s(["Focus",()=>c,"FocusResult",()=>d,"FocusableMode",()=>m,"focusFrom",()=>h,"focusIn",()=>y,"getFocusableElements",()=>p,"isFocusableElement",()=>v,"sortByDomNode",()=>g])},963703,e=>{"use strict";var t=e.i(271645);let r=t.createContext(null);function n({children:e}){let n=t.useRef({groups:new Map,get(e,t){var r;let n=this.groups.get(e);n||(n=new Map,this.groups.set(e,n));let o=null!=(r=n.get(t))?r:0;return n.set(t,o+1),[Array.from(n.keys()).indexOf(t),function(){let e=n.get(t);e>1?n.set(t,e-1):n.delete(t)}]}});return t.createElement(r.Provider,{value:n},e)}function o(e){let n=t.useContext(r);if(!n)throw Error("You must wrap your component in a ");let o=t.useId(),[a,s]=n.current.get(e,o);return t.useEffect(()=>s,[]),a}e.s(["StableCollection",()=>n,"useStableCollectionIndex",()=>o])},998348,e=>{"use strict";let t;var r=((t=r||{}).Space=" ",t.Enter="Enter",t.Escape="Escape",t.Backspace="Backspace",t.Delete="Delete",t.ArrowLeft="ArrowLeft",t.ArrowUp="ArrowUp",t.ArrowRight="ArrowRight",t.ArrowDown="ArrowDown",t.Home="Home",t.End="End",t.PageUp="PageUp",t.PageDown="PageDown",t.Tab="Tab",t);e.s(["Keys",()=>r])},970554,e=>{"use strict";let t,r,n;var o=e.i(429427),a=e.i(371330),s=e.i(271645),l=e.i(394487),i=e.i(914189),u=e.i(835696),c=e.i(941444),d=e.i(144279),f=e.i(294316),p=e.i(640497),m=e.i(2788),v=e.i(652265),b=e.i(397701),g=e.i(368578),h=e.i(402155),y=e.i(700020),E=e.i(963703),w=e.i(998348),T=((t=T||{})[t.Forwards=0]="Forwards",t[t.Backwards=1]="Backwards",t),x=((r=x||{})[r.Less=-1]="Less",r[r.Equal=0]="Equal",r[r.Greater=1]="Greater",r),F=((n=F||{})[n.SetSelectedIndex=0]="SetSelectedIndex",n[n.RegisterTab=1]="RegisterTab",n[n.UnregisterTab=2]="UnregisterTab",n[n.RegisterPanel=3]="RegisterPanel",n[n.UnregisterPanel=4]="UnregisterPanel",n);let P={0(e,t){var r;let n=(0,v.sortByDomNode)(e.tabs,e=>e.current),o=(0,v.sortByDomNode)(e.panels,e=>e.current),a=n.filter(e=>{var t;return!(null!=(t=e.current)&&t.hasAttribute("disabled"))}),s={...e,tabs:n,panels:o};if(t.index<0||t.index>n.length-1){let r=(0,b.match)(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>(0,b.match)(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(0===a.length)return s;let o=(0,b.match)(r,{0:()=>n.indexOf(a[0]),1:()=>n.indexOf(a[a.length-1])});return{...s,selectedIndex:-1===o?e.selectedIndex:o}}let l=n.slice(0,t.index),i=[...n.slice(t.index),...l].find(e=>a.includes(e));if(!i)return s;let u=null!=(r=n.indexOf(i))?r:e.selectedIndex;return -1===u&&(u=e.selectedIndex),{...s,selectedIndex:u}},1(e,t){if(e.tabs.includes(t.tab))return e;let r=e.tabs[e.selectedIndex],n=(0,v.sortByDomNode)([...e.tabs,t.tab],e=>e.current),o=e.selectedIndex;return e.info.current.isControlled||-1===(o=n.indexOf(r))&&(o=e.selectedIndex),{...e,tabs:n,selectedIndex:o}},2:(e,t)=>({...e,tabs:e.tabs.filter(e=>e!==t.tab)}),3:(e,t)=>e.panels.includes(t.panel)?e:{...e,panels:(0,v.sortByDomNode)([...e.panels,t.panel],e=>e.current)},4:(e,t)=>({...e,panels:e.panels.filter(e=>e!==t.panel)})},k=(0,s.createContext)(null);function L(e){let t=(0,s.useContext)(k);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,L),t}return t}k.displayName="TabsDataContext";let N=(0,s.createContext)(null);function C(e){let t=(0,s.useContext)(N);if(null===t){let t=Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,C),t}return t}function I(e,t){return(0,b.match)(t.type,P,e,t)}N.displayName="TabsActionsContext";let S=y.RenderFeatures.RenderStrategy|y.RenderFeatures.Static,A=Object.assign((0,y.forwardRefWithAs)(function(e,t){var r,n;let c=(0,s.useId)(),{id:p=`headlessui-tabs-tab-${c}`,disabled:m=!1,autoFocus:T=!1,...x}=e,{orientation:F,activation:P,selectedIndex:k,tabs:N,panels:I}=L("Tab"),S=C("Tab"),A=L("Tab"),[M,R]=(0,s.useState)(null),O=(0,s.useRef)(null),D=(0,f.useSyncRefs)(O,t,R);(0,u.useIsoMorphicEffect)(()=>S.registerTab(O),[S,O]);let H=(0,E.useStableCollectionIndex)("tabs"),j=N.indexOf(O);-1===j&&(j=H);let K=j===k,W=(0,i.useEvent)(e=>{var t;let r=e();if(r===v.FocusResult.Success&&"auto"===P){let e=null==(t=(0,h.getOwnerDocument)(O))?void 0:t.activeElement,r=A.tabs.findIndex(t=>t.current===e);-1!==r&&S.change(r)}return r}),B=(0,i.useEvent)(e=>{let t=N.map(e=>e.current).filter(Boolean);if(e.key===w.Keys.Space||e.key===w.Keys.Enter){e.preventDefault(),e.stopPropagation(),S.change(j);return}switch(e.key){case w.Keys.Home:case w.Keys.PageUp:return e.preventDefault(),e.stopPropagation(),W(()=>(0,v.focusIn)(t,v.Focus.First));case w.Keys.End:case w.Keys.PageDown:return e.preventDefault(),e.stopPropagation(),W(()=>(0,v.focusIn)(t,v.Focus.Last))}if(W(()=>(0,b.match)(F,{vertical:()=>e.key===w.Keys.ArrowUp?(0,v.focusIn)(t,v.Focus.Previous|v.Focus.WrapAround):e.key===w.Keys.ArrowDown?(0,v.focusIn)(t,v.Focus.Next|v.Focus.WrapAround):v.FocusResult.Error,horizontal:()=>e.key===w.Keys.ArrowLeft?(0,v.focusIn)(t,v.Focus.Previous|v.Focus.WrapAround):e.key===w.Keys.ArrowRight?(0,v.focusIn)(t,v.Focus.Next|v.Focus.WrapAround):v.FocusResult.Error}))===v.FocusResult.Success)return e.preventDefault()}),V=(0,s.useRef)(!1),_=(0,i.useEvent)(()=>{var e;V.current||(V.current=!0,null==(e=O.current)||e.focus({preventScroll:!0}),S.change(j),(0,g.microTask)(()=>{V.current=!1}))}),G=(0,i.useEvent)(e=>{e.preventDefault()}),{isFocusVisible:U,focusProps:$}=(0,o.useFocusRing)({autoFocus:T}),{isHovered:q,hoverProps:X}=(0,a.useHover)({isDisabled:m}),{pressed:Y,pressProps:z}=(0,l.useActivePress)({disabled:m}),Z=(0,s.useMemo)(()=>({selected:K,hover:q,active:Y,focus:U,autofocus:T,disabled:m}),[K,q,U,Y,T,m]),J=(0,y.mergeProps)({ref:D,onKeyDown:B,onMouseDown:G,onClick:_,id:p,role:"tab",type:(0,d.useResolveButtonType)(e,M),"aria-controls":null==(n=null==(r=I[j])?void 0:r.current)?void 0:n.id,"aria-selected":K,tabIndex:K?0:-1,disabled:m||void 0,autoFocus:T},$,X,z);return(0,y.useRender)()({ourProps:J,theirProps:x,slot:Z,defaultTag:"button",name:"Tabs.Tab"})}),{Group:(0,y.forwardRefWithAs)(function(e,t){let{defaultIndex:r=0,vertical:n=!1,manual:o=!1,onChange:a,selectedIndex:l=null,...d}=e,m=n?"vertical":"horizontal",b=o?"manual":"auto",g=null!==l,h=(0,c.useLatestValue)({isControlled:g}),w=(0,f.useSyncRefs)(t),[T,x]=(0,s.useReducer)(I,{info:h,selectedIndex:null!=l?l:r,tabs:[],panels:[]}),F=(0,s.useMemo)(()=>({selectedIndex:T.selectedIndex}),[T.selectedIndex]),P=(0,c.useLatestValue)(a||(()=>{})),L=(0,c.useLatestValue)(T.tabs),C=(0,s.useMemo)(()=>({orientation:m,activation:b,...T}),[m,b,T]),S=(0,i.useEvent)(e=>(x({type:1,tab:e}),()=>x({type:2,tab:e}))),A=(0,i.useEvent)(e=>(x({type:3,panel:e}),()=>x({type:4,panel:e}))),M=(0,i.useEvent)(e=>{R.current!==e&&P.current(e),g||x({type:0,index:e})}),R=(0,c.useLatestValue)(g?e.selectedIndex:T.selectedIndex),O=(0,s.useMemo)(()=>({registerTab:S,registerPanel:A,change:M}),[]);(0,u.useIsoMorphicEffect)(()=>{x({type:0,index:null!=l?l:r})},[l]),(0,u.useIsoMorphicEffect)(()=>{if(void 0===R.current||T.tabs.length<=0)return;let e=(0,v.sortByDomNode)(T.tabs,e=>e.current);e.some((e,t)=>T.tabs[t]!==e)&&M(e.indexOf(T.tabs[R.current]))});let D=(0,y.useRender)();return s.default.createElement(E.StableCollection,null,s.default.createElement(N.Provider,{value:O},s.default.createElement(k.Provider,{value:C},C.tabs.length<=0&&s.default.createElement(p.FocusSentinel,{onFocus:()=>{var e,t;for(let r of L.current)if((null==(e=r.current)?void 0:e.tabIndex)===0)return null==(t=r.current)||t.focus(),!0;return!1}}),D({ourProps:{ref:w},theirProps:d,slot:F,defaultTag:"div",name:"Tabs"}))))}),List:(0,y.forwardRefWithAs)(function(e,t){let{orientation:r,selectedIndex:n}=L("Tab.List"),o=(0,f.useSyncRefs)(t),a=(0,s.useMemo)(()=>({selectedIndex:n}),[n]);return(0,y.useRender)()({ourProps:{ref:o,role:"tablist","aria-orientation":r},theirProps:e,slot:a,defaultTag:"div",name:"Tabs.List"})}),Panels:(0,y.forwardRefWithAs)(function(e,t){let{selectedIndex:r}=L("Tab.Panels"),n=(0,f.useSyncRefs)(t),o=(0,s.useMemo)(()=>({selectedIndex:r}),[r]);return(0,y.useRender)()({ourProps:{ref:n},theirProps:e,slot:o,defaultTag:"div",name:"Tabs.Panels"})}),Panel:(0,y.forwardRefWithAs)(function(e,t){var r,n,a,l;let i=(0,s.useId)(),{id:c=`headlessui-tabs-panel-${i}`,tabIndex:d=0,...p}=e,{selectedIndex:v,tabs:b,panels:g}=L("Tab.Panel"),h=C("Tab.Panel"),w=(0,s.useRef)(null),T=(0,f.useSyncRefs)(w,t);(0,u.useIsoMorphicEffect)(()=>h.registerPanel(w),[h,w]);let x=(0,E.useStableCollectionIndex)("panels"),F=g.indexOf(w);-1===F&&(F=x);let P=F===v,{isFocusVisible:k,focusProps:N}=(0,o.useFocusRing)(),I=(0,s.useMemo)(()=>({selected:P,focus:k}),[P,k]),A=(0,y.mergeProps)({ref:T,id:c,role:"tabpanel","aria-labelledby":null==(n=null==(r=b[F])?void 0:r.current)?void 0:n.id,tabIndex:P?d:-1},N),M=(0,y.useRender)();return P||null!=(a=p.unmount)&&!a||null!=(l=p.static)&&l?M({ourProps:A,theirProps:p,slot:I,defaultTag:"div",features:S,visible:P,name:"Tabs.Panel"}):s.default.createElement(m.Hidden,{"aria-hidden":"true",...A})})});e.s(["Tab",()=>A])},723731,e=>{"use strict";var t=e.i(290571),r=e.i(970554),n=e.i(751734),o=e.i(144582),a=e.i(444755),s=e.i(673706),l=e.i(271645);let i=(0,s.makeClassName)("TabPanels"),u=l.default.forwardRef((e,s)=>{let{children:u,className:c}=e,d=(0,t.__rest)(e,["children","className"]);return l.default.createElement(r.Tab.Panels,Object.assign({as:"div",ref:s,className:(0,a.tremorTwMerge)(i("root"),"w-full",c)},d),({selectedIndex:e})=>l.default.createElement(o.default.Provider,{value:{selectedValue:e}},l.default.Children.map(u,(e,t)=>l.default.createElement(n.default.Provider,{value:t},e))))});u.displayName="TabPanels",e.s(["TabPanels",()=>u],723731)},653824,e=>{"use strict";var t=e.i(290571),r=e.i(970554),n=e.i(444755),o=e.i(673706),a=e.i(271645);let s=(0,o.makeClassName)("TabGroup"),l=a.default.forwardRef((e,o)=>{let{defaultIndex:l,index:i,onIndexChange:u,children:c,className:d}=e,f=(0,t.__rest)(e,["defaultIndex","index","onIndexChange","children","className"]);return a.default.createElement(r.Tab.Group,Object.assign({as:"div",ref:o,defaultIndex:l,selectedIndex:i,onChange:u,className:(0,n.tremorTwMerge)(s("root"),"w-full",d)},f),c)});l.displayName="TabGroup",e.s(["TabGroup",()=>l],653824)},405371,910342,e=>{"use strict";var t=e.i(290571),r=e.i(271645),n=e.i(480731);let o=(0,r.createContext)(n.BaseColors.Blue);e.s(["default",()=>o],910342);var a=e.i(970554),s=e.i(444755);let l=(0,e.i(673706).makeClassName)("TabList"),i=(0,r.createContext)("line"),u={line:(0,s.tremorTwMerge)("flex border-b space-x-4","border-tremor-border","dark:border-dark-tremor-border"),solid:(0,s.tremorTwMerge)("inline-flex p-0.5 rounded-tremor-default space-x-1.5","bg-tremor-background-subtle","dark:bg-dark-tremor-background-subtle")},c=r.default.forwardRef((e,n)=>{let{color:c,variant:d="line",children:f,className:p}=e,m=(0,t.__rest)(e,["color","variant","children","className"]);return r.default.createElement(a.Tab.List,Object.assign({ref:n,className:(0,s.tremorTwMerge)(l("root"),"justify-start overflow-x-clip",u[d],p)},m),r.default.createElement(i.Provider,{value:d},r.default.createElement(o.Provider,{value:c},f)))});c.displayName="TabList",e.s(["TabVariantContext",()=>i,"default",()=>c],405371)},881073,e=>{"use strict";var t=e.i(405371);e.s(["TabList",()=>t.default])},197647,e=>{"use strict";var t=e.i(290571),r=e.i(970554),n=e.i(95779),o=e.i(444755),a=e.i(673706),s=e.i(271645),l=e.i(405371),i=e.i(910342);let u=(0,a.makeClassName)("Tab"),c=s.default.forwardRef((e,c)=>{let{icon:d,className:f,children:p}=e,m=(0,t.__rest)(e,["icon","className","children"]),v=(0,s.useContext)(l.TabVariantContext),b=(0,s.useContext)(i.default);return s.default.createElement(r.Tab,Object.assign({ref:c,className:(0,o.tremorTwMerge)(u("root"),"flex whitespace-nowrap truncate max-w-xs outline-none data-focus-visible:ring text-tremor-default transition duration-100",function(e,t){switch(e){case"line":return(0,o.tremorTwMerge)("data-[selected]:border-b-2 hover:border-b-2 border-transparent transition duration-100 -mb-px px-2 py-2","hover:border-tremor-content hover:text-tremor-content-emphasis text-tremor-content","[&:not([data-selected])]:dark:hover:border-dark-tremor-content-emphasis [&:not([data-selected])]:dark:hover:text-dark-tremor-content-emphasis [&:not([data-selected])]:dark:text-dark-tremor-content",t?(0,a.getColorClassNames)(t,n.colorPalette.border).selectBorderColor:["data-[selected]:border-tremor-brand data-[selected]:text-tremor-brand","data-[selected]:dark:border-dark-tremor-brand data-[selected]:dark:text-dark-tremor-brand"]);case"solid":return(0,o.tremorTwMerge)("border-transparent border rounded-tremor-small px-2.5 py-1","data-[selected]:border-tremor-border data-[selected]:bg-tremor-background data-[selected]:shadow-tremor-input [&:not([data-selected])]:hover:text-tremor-content-emphasis data-[selected]:text-tremor-brand [&:not([data-selected])]:text-tremor-content","dark:data-[selected]:border-dark-tremor-border dark:data-[selected]:bg-dark-tremor-background dark:data-[selected]:shadow-dark-tremor-input dark:[&:not([data-selected])]:hover:text-dark-tremor-content-emphasis dark:data-[selected]:text-dark-tremor-brand dark:[&:not([data-selected])]:text-dark-tremor-content",t?(0,a.getColorClassNames)(t,n.colorPalette.text).selectTextColor:"text-tremor-content dark:text-dark-tremor-content")}}(v,b),f,b&&(0,a.getColorClassNames)(b,n.colorPalette.text).selectTextColor)},m),d?s.default.createElement(d,{className:(0,o.tremorTwMerge)(u("icon"),"flex-none h-5 w-5",p?"mr-2":"")}):null,p?s.default.createElement("span",null,p):null)});c.displayName="Tab",e.s(["Tab",()=>c],197647)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1088-c02fed07efa8e3b8.js b/litellm/proxy/_experimental/out/_next/static/chunks/1088-c02fed07efa8e3b8.js deleted file mode 100644 index 7a3e7a58dc9..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1088-c02fed07efa8e3b8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1088],{4933:function(e,l,t){t.d(l,{i:function(){return i}});var s=t(19250),a=t(71632);let r=(0,t(90246).n)("modelCostMap"),i=()=>(0,a.a)({queryKey:r.list({}),queryFn:async()=>await (0,s.modelCostMap)(),staleTime:6e4,gcTime:6e4})},71088:function(e,l,t){t.d(l,{Z:function(){return l5}});var s=t(57437),a=t(19250),r=t(71632),i=t(90246),n=t(39760);let o=(0,i.n)("credentials"),d=()=>{let{accessToken:e}=(0,n.Z)();return(0,r.a)({queryKey:o.list({}),queryFn:async()=>await (0,a.credentialListCall)(e),enabled:!!e})};var c=t(4933),m=t(52178),u=t(55584),h=t(47359),x=t(71594),p=t(24525),g=t(2265),f=t(19130),j=t(47024);function v(e){let{data:l=[],columns:t,isLoading:a=!1,sorting:r=[],onSortingChange:i,pagination:n,onPaginationChange:o,enablePagination:d=!1}=e,[c]=g.useState("onChange"),[m,u]=g.useState({}),[h,v]=g.useState({}),_=(0,x.b7)({data:l,columns:t,state:{sorting:r,columnSizing:m,columnVisibility:h,...d&&n?{pagination:n}:{}},columnResizeMode:c,onSortingChange:i,onColumnSizingChange:u,onColumnVisibilityChange:v,...d&&o?{onPaginationChange:o}:{},getCoreRowModel:(0,p.sC)(),...d?{getPaginationRowModel:(0,p.G_)()}:{},enableSorting:!0,enableColumnResizing:!0,manualSorting:!0,defaultColumn:{minSize:40,maxSize:500}});return(0,s.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsx)("div",{className:"relative min-w-full",children:(0,s.jsxs)(f.iA,{className:"[&_td]:py-2 [&_th]:py-2",style:{width:_.getTotalSize(),minWidth:"100%",tableLayout:"fixed"},children:[(0,s.jsx)(f.ss,{children:_.getHeaderGroups().map(e=>(0,s.jsx)(f.SC,{children:e.headers.map(e=>{var l;return(0,s.jsxs)(f.xs,{className:"py-1 h-8 relative ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] w-[120px] ml-8":""," ").concat((null===(l=e.column.columnDef.meta)||void 0===l?void 0:l.className)||""),style:{width:"actions"===e.id?120:e.getSize(),position:"actions"===e.id?"sticky":"relative",right:"actions"===e.id?0:"auto"},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,x.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&e.column.getCanSort()&&i&&(0,s.jsx)(j._,{sortState:!1!==e.column.getIsSorted()&&e.column.getIsSorted(),onSortChange:l=>{!1===l?i([]):i([{id:e.column.id,desc:"desc"===l}])},columnId:e.column.id})]}),e.column.getCanResize()&&(0,s.jsx)("div",{onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none ".concat(e.column.getIsResizing()?"bg-blue-500":"hover:bg-blue-200")})]},e.id)})},e.id))}),(0,s.jsx)(f.RM,{children:a?(0,s.jsx)(f.SC,{children:(0,s.jsx)(f.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:"\uD83D\uDE85 Loading models..."})})})}):_.getRowModel().rows.length>0?_.getRowModel().rows.map(e=>(0,s.jsx)(f.SC,{children:e.getVisibleCells().map(e=>{var l;return(0,s.jsx)(f.pj,{className:"py-0.5 overflow-hidden ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)] w-[120px] ml-8":""," ").concat((null===(l=e.column.columnDef.meta)||void 0===l?void 0:l.className)||""),style:{width:"actions"===e.column.id?120:e.column.getSize(),position:"actions"===e.column.id?"sticky":"relative",right:"actions"===e.column.id?0:"auto"},children:(0,x.ie)(e.column.columnDef.cell,e.getContext())},e.id)})},e.id)):(0,s.jsx)(f.SC,{children:(0,s.jsx)(f.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:"No models found"})})})})})]})})})})}var _=t(30356),y=t(13377),b=t(15424),N=t(74998),Z=t(41649),w=t(78489),C=t(47323),k=t(57840),S=t(55590),P=t(10868),A=t(23496),E=t(99981),M=t(79326),L=t(45188);let{Text:F,Title:I}=k.default,T=(0,s.jsxs)(S.Z,{direction:"vertical",size:12,children:[(0,s.jsx)(F,{strong:!0,style:{fontSize:13},children:"Credential types"}),(0,s.jsxs)(S.Z,{direction:"vertical",size:8,children:[(0,s.jsx)(P.Z,{align:"center",gap:8,children:(0,s.jsxs)(S.Z,{direction:"vertical",children:[(0,s.jsxs)(P.Z,{align:"center",gap:8,children:[(0,s.jsx)(_.Z,{style:{color:"#1890ff"}}),(0,s.jsx)(I,{level:5,style:{margin:0,color:"#1890ff"},children:"Reusable"})]}),(0,s.jsx)(F,{type:"secondary",children:"Credentials saved in LiteLLM that can be added to models repeatedly."})]})}),(0,s.jsx)(A.Z,{size:"small"}),(0,s.jsx)(P.Z,{align:"center",gap:8,children:(0,s.jsxs)(S.Z,{direction:"vertical",size:8,children:[(0,s.jsxs)(P.Z,{align:"center",gap:8,children:[(0,s.jsx)(y.Z,{style:{color:"#8c8c8c",fontSize:14,flexShrink:0}}),(0,s.jsx)(I,{level:5,style:{margin:0},children:"Manual"})]}),(0,s.jsx)(F,{type:"secondary",children:"Credentials added directly during model creation or defined in the config file."})]})})]})]}),R=(e,l,t,a,r,i,n,o,d,c)=>[{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model ID"}),accessorKey:"model_info.id",enableSorting:!1,size:130,minSize:80,cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(E.Z,{title:t.model_info.id,children:(0,s.jsx)(F,{ellipsis:!0,className:"text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs cursor-pointer w-full block",style:{fontSize:14,padding:"1px 8px"},onClick:()=>a(t.model_info.id),children:t.model_info.id})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Information"}),accessorKey:"model_name",size:250,minSize:120,cell:e=>{let{row:l}=e,t=l.original,a=i(l.original)||"-",r=(0,s.jsxs)(S.Z,{direction:"vertical",size:12,style:{minWidth:220},children:[(0,s.jsxs)(P.Z,{align:"center",gap:8,children:[(0,s.jsx)(L.K,{provider:t.provider}),(0,s.jsx)(F,{type:"secondary",style:{fontSize:12},ellipsis:!0,children:t.provider||"Unknown provider"})]}),(0,s.jsxs)(S.Z,{direction:"vertical",size:6,children:[(0,s.jsxs)(S.Z,{direction:"vertical",size:2,style:{width:"100%"},children:[(0,s.jsx)(F,{type:"secondary",style:{fontSize:11},children:"Public Model Name"}),(0,s.jsx)(F,{strong:!0,style:{fontSize:13,maxWidth:480},ellipsis:!0,title:a,children:a})]}),(0,s.jsxs)(S.Z,{direction:"vertical",size:2,children:[(0,s.jsx)(F,{type:"secondary",style:{fontSize:11},children:"LiteLLM Model Name"}),(0,s.jsx)(F,{style:{fontSize:13},copyable:{text:t.litellm_model_name||"-"},ellipsis:!0,title:t.litellm_model_name||"-",children:t.litellm_model_name||"-"})]})]})]});return(0,s.jsx)(M.Z,{content:r,placement:"right",arrow:{pointAtCenter:!0},styles:{root:{maxWidth:500}},children:(0,s.jsxs)("div",{className:"flex items-start space-x-2 min-w-0 w-full cursor-pointer",children:[(0,s.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:t.provider?(0,s.jsx)(L.K,{provider:t.provider}):(0,s.jsx)("div",{className:"w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",children:"-"})}),(0,s.jsxs)("div",{className:"flex flex-col min-w-0 flex-1",children:[(0,s.jsx)(F,{ellipsis:!0,className:"text-gray-900",style:{fontSize:12,fontWeight:500,lineHeight:"16px"},children:a}),(0,s.jsx)(F,{ellipsis:!0,type:"secondary",style:{fontSize:12,lineHeight:"16px",marginTop:2},children:t.litellm_model_name||"-"})]})]})})}},{header:()=>(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Credentials"}),(0,s.jsx)(M.Z,{content:T,placement:"bottom",arrow:{pointAtCenter:!0},children:(0,s.jsx)(b.Z,{className:"cursor-pointer text-gray-400 hover:text-gray-600",style:{fontSize:12}})})]}),accessorKey:"litellm_credential_name",enableSorting:!1,size:180,minSize:100,cell:e=>{var l;let{row:t}=e,a=null===(l=t.original.litellm_params)||void 0===l?void 0:l.litellm_credential_name,r=!!a;return(0,s.jsx)("div",{className:"flex items-center space-x-2 min-w-0 w-full",children:r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(_.Z,{className:"flex-shrink-0",style:{color:"#1890ff",fontSize:14}}),(0,s.jsx)("span",{className:"text-xs truncate text-blue-600",title:a,children:a})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(y.Z,{className:"flex-shrink-0",style:{color:"#8c8c8c",fontSize:14}}),(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Manual"})]})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Created By"}),accessorKey:"model_info.created_by",sortingFn:"datetime",size:160,minSize:100,cell:e=>{var l;let{row:t}=e,a=t.original,r=!(null===(l=a.model_info)||void 0===l?void 0:l.db_model),i=a.model_info.created_by,n=a.model_info.created_at?new Date(a.model_info.created_at).toLocaleDateString():null;return(0,s.jsxs)("div",{className:"flex flex-col min-w-0 w-full",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-gray-900 truncate",title:r?"Defined in config":i||"Unknown",children:r?"Defined in config":i||"Unknown"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5",title:r?"Config file":n||"Unknown date",children:r?"-":n||"Unknown date"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Updated At"}),accessorKey:"model_info.updated_at",sortingFn:"datetime",size:120,minSize:80,cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("span",{className:"text-xs",children:t.model_info.updated_at?new Date(t.model_info.updated_at).toLocaleDateString():"-"})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Costs"}),accessorKey:"input_cost",size:120,minSize:80,cell:e=>{let{row:l}=e,t=l.original,a=t.input_cost,r=t.output_cost;return null==a&&null==r?(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"-"})}):(0,s.jsx)(E.Z,{title:"Cost per 1M tokens",children:(0,s.jsxs)("div",{className:"flex flex-col min-w-0 w-full",children:[null!=a&&(0,s.jsxs)("div",{className:"text-xs font-medium text-gray-900 truncate",children:["In: $",a]}),null!=r&&(0,s.jsxs)("div",{className:"text-xs text-gray-500 truncate mt-0.5",children:["Out: $",r]})]})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Team ID"}),accessorKey:"model_info.team_id",enableSorting:!1,size:130,minSize:80,cell:e=>{let{row:l}=e,t=l.original;return t.model_info.team_id?(0,s.jsx)("div",{className:"overflow-hidden w-full",children:(0,s.jsx)(E.Z,{title:t.model_info.team_id,children:(0,s.jsxs)(w.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate w-full",onClick:()=>r(t.model_info.team_id),children:[t.model_info.team_id.slice(0,7),"..."]})})}):"-"}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Model Access Group"}),accessorKey:"model_info.model_access_group",enableSorting:!1,size:180,minSize:100,cell:e=>{let{row:l}=e,t=l.original,a=t.model_info.access_groups;if(!a||0===a.length)return"-";let r=t.model_info.id,i=d.has(r),n=a.length>1,o=()=>{let e=new Set(d);i?e.delete(r):e.add(r),c(e)};return(0,s.jsxs)("div",{className:"flex items-center gap-1 overflow-hidden w-full",children:[(0,s.jsx)(Z.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:a[0]}),(i||!n&&2===a.length)&&a.slice(1).map((e,l)=>(0,s.jsx)(Z.Z,{size:"xs",color:"blue",className:"text-xs px-1.5 py-0.5 h-5 leading-tight flex-shrink-0",children:e},l+1)),n&&(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),o()},className:"text-xs text-blue-600 hover:text-blue-800 px-1 py-0.5 rounded hover:bg-blue-50 h-5 leading-tight flex-shrink-0 whitespace-nowrap",children:i?"−":"+".concat(a.length-1)})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Status"}),accessorKey:"model_info.db_model",size:120,minSize:80,cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)("div",{className:"\n inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium\n ".concat(t.model_info.db_model?"bg-blue-50 text-blue-600":"bg-gray-100 text-gray-600","\n "),children:t.model_info.db_model?"DB Model":"Config Model"})}},{id:"actions",header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Actions"}),size:60,minSize:40,enableResizing:!1,cell:t=>{var r,i;let{row:n}=t,o=n.original,d="Admin"===e||(null===(r=o.model_info)||void 0===r?void 0:r.created_by)===l,c=!(null===(i=o.model_info)||void 0===i?void 0:i.db_model);return(0,s.jsx)("div",{className:"flex items-center justify-end gap-2 pr-4",children:c?(0,s.jsx)(E.Z,{title:"Config model cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,s.jsx)(C.Z,{icon:N.Z,size:"sm",className:"opacity-50 cursor-not-allowed"})}):(0,s.jsx)(E.Z,{title:"Delete model",children:(0,s.jsx)(C.Z,{icon:N.Z,size:"sm",onClick:()=>{d&&a(o.model_info.id)},className:d?"cursor-pointer hover:text-red-600":"opacity-50 cursor-not-allowed"})})})}}],z=e=>{var l;return(null==e?void 0:null===(l=e.model_info)||void 0===l?void 0:l.team_public_model_name)?e.model_info.team_public_model_name:(null==e?void 0:e.model_name)||"-"};var O=t(67101),V=t(29706),q=t(50337),D=t(37592),B=t(33866),G=t(7310),U=t.n(G);let H=(e,l)=>{if(!(null==e?void 0:e.data))return{data:[]};let t=JSON.parse(JSON.stringify(e.data));for(let e=0;e{let[l]=e;return"model"!==l&&"api_base"!==l}))),t[e].provider=c,t[e].input_cost=m,t[e].output_cost=u,t[e].litellm_model_name=n,null!=t[e].input_cost&&(t[e].input_cost=(1e6*Number(t[e].input_cost)).toFixed(2)),null!=t[e].output_cost&&(t[e].output_cost=(1e6*Number(t[e].output_cost)).toFixed(2)),t[e].max_tokens=h,t[e].max_input_tokens=x,t[e].api_base=null==i?void 0:null===(r=i.litellm_params)||void 0===r?void 0:r.api_base,t[e].cleanedLitellmParams=p}return{data:t}},{Text:K}=k.default;var J=e=>{var l;let{selectedModelGroup:t,setSelectedModelGroup:a,availableModelGroups:r,availableModelAccessGroups:i,setSelectedModelId:o,setSelectedTeamId:d}=e,{data:u,isLoading:x}=(0,c.i)(),{userId:p,userRole:f,premiumUser:j}=(0,n.Z)(),{data:_,isLoading:y}=(0,h.y2)(),[N,Z]=(0,g.useState)(""),[w,C]=(0,g.useState)(""),[k,P]=(0,g.useState)("current_team"),[A,E]=(0,g.useState)("personal"),[M,L]=(0,g.useState)(!1),[F,I]=(0,g.useState)(null),[T,G]=(0,g.useState)(new Set),[J,W]=(0,g.useState)(1),[Y]=(0,g.useState)(50),[$,X]=(0,g.useState)({pageIndex:0,pageSize:50}),[Q,ee]=(0,g.useState)([]),el=(0,g.useMemo)(()=>U()(e=>{C(e),W(1),X(e=>({...e,pageIndex:0}))},200),[]);(0,g.useEffect)(()=>(el(N),()=>{el.cancel()}),[N,el]);let et="personal"===A?void 0:A.team_id,es=(0,g.useMemo)(()=>{if(0===Q.length)return;let e=Q[0];return({input_cost:"costs",model_info_db_model:"status",model_info_created_by:"created_at",model_info_updated_at:"updated_at"})[e.id]||e.id},[Q]),ea=(0,g.useMemo)(()=>{if(0!==Q.length)return Q[0].desc?"desc":"asc"},[Q]),{data:er,isLoading:ei}=(0,m.XP)(J,Y,w||void 0,void 0,et,es,ea),en=ei||x,eo=e=>null!=u&&"object"==typeof u&&e in u?u[e].litellm_provider:"openai",ed=(0,g.useMemo)(()=>er?H(er,eo):{data:[]},[er,u]),ec=(0,g.useMemo)(()=>{var e,l,t,s;return er?{total_count:null!==(e=er.total_count)&&void 0!==e?e:0,current_page:null!==(l=er.current_page)&&void 0!==l?l:1,total_pages:null!==(t=er.total_pages)&&void 0!==t?t:1,size:null!==(s=er.size)&&void 0!==s?s:Y}:{total_count:0,current_page:1,total_pages:1,size:Y}},[er,Y]),em=(0,g.useMemo)(()=>ed&&ed.data&&0!==ed.data.length?ed.data.filter(e=>{var l,s;let a="all"===t||e.model_name===t||!t||"wildcard"===t&&(null===(l=e.model_name)||void 0===l?void 0:l.includes("*")),r="all"===F||(null===(s=e.model_info.access_groups)||void 0===s?void 0:s.includes(F))||!F;return a&&r}):[],[ed,t,F]);return(0,g.useEffect)(()=>{X(e=>({...e,pageIndex:0})),W(1)},[t,F]),(0,g.useEffect)(()=>{W(1),X(e=>({...e,pageIndex:0}))},[et]),(0,g.useEffect)(()=>{W(1),X(e=>({...e,pageIndex:0}))},[Q]),(0,s.jsx)(V.Z,{children:(0,s.jsx)(O.Z,{children:(0,s.jsx)("div",{className:"flex flex-col space-y-4",children:(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,s.jsxs)("div",{className:"border-b px-6 py-4 bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(K,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,s.jsx)("div",{className:"w-80",children:en?(0,s.jsx)(q.Z.Input,{active:!0,block:!0,size:"large"}):(0,s.jsx)(D.default,{style:{width:"100%"},size:"large",defaultValue:"personal",value:"personal"===A?"personal":A.team_id,onChange:e=>{if("personal"===e)E("personal"),W(1),X(e=>({...e,pageIndex:0}));else{let l=null==_?void 0:_.find(l=>l.team_id===e);l&&(E(l),W(1),X(e=>({...e,pageIndex:0})))}},loading:y,options:[{value:"personal",label:(0,s.jsxs)(S.Z,{direction:"horizontal",align:"center",children:[(0,s.jsx)(B.Z,{color:"blue",size:"small"}),(0,s.jsx)(K,{style:{fontSize:16},children:"Personal"})]})},...null!==(l=null==_?void 0:_.filter(e=>e.team_id).map(e=>({value:e.team_id,label:(0,s.jsxs)(S.Z,{direction:"horizontal",align:"center",children:[(0,s.jsx)(B.Z,{color:"green",size:"small"}),(0,s.jsx)(K,{ellipsis:!0,style:{fontSize:16},children:e.team_alias?e.team_alias:e.team_id})]})})))&&void 0!==l?l:[]]})})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(K,{className:"text-lg font-semibold text-gray-900",children:"View:"}),(0,s.jsx)("div",{className:"w-64",children:en?(0,s.jsx)(q.Z.Input,{active:!0,block:!0,size:"large"}):(0,s.jsx)(D.default,{style:{width:"100%"},size:"large",defaultValue:"current_team",value:k,onChange:e=>P(e),options:[{value:"current_team",label:(0,s.jsxs)(S.Z,{direction:"horizontal",align:"center",children:[(0,s.jsx)(B.Z,{color:"purple",size:"small"}),(0,s.jsx)(K,{style:{fontSize:16},children:"Current Team Models"})]})},{value:"all",label:(0,s.jsxs)(S.Z,{direction:"horizontal",align:"center",children:[(0,s.jsx)(B.Z,{color:"gray",size:"small"}),(0,s.jsx)(K,{style:{fontSize:16},children:"All Available Models"})]})}]})})]})]}),"current_team"===k&&(0,s.jsxs)("div",{className:"flex items-start gap-2 mt-3",children:[(0,s.jsx)(b.Z,{className:"text-gray-400 mt-0.5 flex-shrink-0 text-xs"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"personal"===A?(0,s.jsxs)("span",{children:["To access these models: Create a Virtual Key without selecting a team on the"," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]}):(0,s.jsxs)("span",{children:['To access these models: Create a Virtual Key and select Team as "',"string"!=typeof A?A.team_alias||A.team_id:"",'" on the'," ",(0,s.jsx)("a",{href:"/public?login=success&page=api-keys",className:"text-gray-600 hover:text-gray-800 underline",children:"Virtual Keys page"})]})})]})]}),(0,s.jsx)("div",{className:"border-b px-6 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsxs)("div",{className:"relative w-64",children:[(0,s.jsx)("input",{type:"text",placeholder:"Search model names...",className:"w-full px-3 py-2 pl-8 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",value:N,onChange:e=>Z(e.target.value)}),(0,s.jsx)("svg",{className:"absolute left-2.5 top-2.5 h-4 w-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 ".concat(M?"bg-gray-100":""),onClick:()=>L(!M),children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"})}),"Filters"]}),(0,s.jsxs)("button",{className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",onClick:()=>{Z(""),a("all"),I(null),E("personal"),P("current_team"),W(1),X({pageIndex:0,pageSize:50}),ee([])},children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset Filters"]})]}),M&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:[(0,s.jsx)("div",{className:"w-64",children:(0,s.jsx)(D.default,{className:"w-full",value:null!=t?t:"all",onChange:e=>a("all"===e?"all":e),placeholder:"Filter by Public Model Name",showSearch:!0,options:[{value:"all",label:"All Models"},{value:"wildcard",label:"Wildcard Models (*)"},...r.map((e,l)=>({value:e,label:e}))]})}),(0,s.jsx)("div",{className:"w-64",children:(0,s.jsx)(D.default,{className:"w-full",value:null!=F?F:"all",onChange:e=>I("all"===e?null:e),placeholder:"Filter by Model Access Group",showSearch:!0,options:[{value:"all",label:"All Model Access Groups"},...i.map((e,l)=>({value:e,label:e}))]})})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[en?(0,s.jsx)(q.Z.Input,{active:!0,style:{width:184,height:20}}):(0,s.jsx)("span",{className:"text-sm text-gray-700",children:ec.total_count>0?"Showing ".concat((J-1)*Y+1," - ").concat(Math.min(J*Y,ec.total_count)," of ").concat(ec.total_count," results"):"Showing 0 results"}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[en?(0,s.jsx)(q.Z.Button,{active:!0,style:{width:84,height:30}}):(0,s.jsx)("button",{onClick:()=>{W(J-1),X(e=>({...e,pageIndex:0}))},disabled:1===J,className:"px-3 py-1 text-sm border rounded-md ".concat(1===J?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),en?(0,s.jsx)(q.Z.Button,{active:!0,style:{width:56,height:30}}):(0,s.jsx)("button",{onClick:()=>{W(J+1),X(e=>({...e,pageIndex:0}))},disabled:J>=ec.total_pages,className:"px-3 py-1 text-sm border rounded-md ".concat(J>=ec.total_pages?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})]})]})}),(0,s.jsx)(v,{columns:R(f,p,j,o,d,z,()=>{},()=>{},T,G),data:em,isLoading:ei,sorting:Q,onSortingChange:ee,pagination:$,onPaginationChange:X,enablePagination:!0})]})})})})},W=t(27281),Y=t(57365),$=t(84264),X=t(96761),Q=t(12221);let ee={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"};var el=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,globalRetryPolicy:r,setGlobalRetryPolicy:i,defaultRetry:n,modelGroupRetryPolicy:o,setModelGroupRetryPolicy:d,handleSaveRetrySettings:c}=e;return(0,s.jsxs)(V.Z,{children:[(0,s.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)($.Z,{children:"Retry Policy Scope:"}),(0,s.jsxs)(W.Z,{className:"ml-2 w-48",defaultValue:"global",value:"global"===l?"global":l||a[0],onValueChange:e=>t(e),children:[(0,s.jsx)(Y.Z,{value:"global",children:"Global Default"}),a.map((e,l)=>(0,s.jsx)(Y.Z,{value:e,onClick:()=>t(e),children:e},l))]})]})}),"global"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(X.Z,{children:"Global Retry Policy"}),(0,s.jsx)($.Z,{className:"mb-6",children:"Default retry settings applied to all model groups unless overridden"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(X.Z,{children:["Retry Policy for ",l]}),(0,s.jsx)($.Z,{className:"mb-6",children:"Model-specific retry settings. Falls back to global defaults if not set."})]}),ee&&(0,s.jsx)("table",{children:(0,s.jsx)("tbody",{children:Object.entries(ee).map((e,t)=>{var a,c,m,u;let h,[x,p]=e;if("global"===l)h=null!==(a=null==r?void 0:r[p])&&void 0!==a?a:n;else{let e=null==o?void 0:null===(c=o[l])||void 0===c?void 0:c[p];h=null!=e?e:null!==(m=null==r?void 0:r[p])&&void 0!==m?m:n}return(0,s.jsxs)("tr",{className:"flex justify-between items-center mt-2",children:[(0,s.jsxs)("td",{children:[(0,s.jsx)($.Z,{children:x}),"global"!==l&&(0,s.jsxs)($.Z,{className:"text-xs text-gray-500 ml-2",children:["(Global: ",null!==(u=null==r?void 0:r[p])&&void 0!==u?u:n,")"]})]}),(0,s.jsx)("td",{children:(0,s.jsx)(Q.Z,{className:"ml-5",value:h,min:0,step:1,onChange:e=>{"global"===l?i(l=>null==e?l:{...null!=l?l:{},[p]:e}):d(t=>{var s;let a=null!==(s=null==t?void 0:t[l])&&void 0!==s?s:{};return{...null!=t?t:{},[l]:{...a,[p]:e}}})}})})]},t)})})}),(0,s.jsx)(w.Z,{className:"mt-6 mr-8",onClick:c,children:"Save"})]})},et=t(867),es=t(5545),ea=t(5945),er=t(3810),ei=t(22116),en=t(89245),eo=t(5540),ed=t(8881),ec=t(9114);let{Text:em}=k.default;var eu=e=>{let{accessToken:l,onReloadSuccess:t,buttonText:r="Reload Price Data",showIcon:i=!0,size:n="middle",type:o="primary",className:d=""}=e,[c,m]=(0,g.useState)(!1),[u,h]=(0,g.useState)(!1),[x,p]=(0,g.useState)(!1),[f,j]=(0,g.useState)(!1),[v,_]=(0,g.useState)(6),[y,b]=(0,g.useState)(null),[N,Z]=(0,g.useState)(!1);(0,g.useEffect)(()=>{w();let e=setInterval(()=>{w()},3e4);return()=>clearInterval(e)},[l]);let w=async()=>{if(l){Z(!0);try{console.log("Fetching reload status...");let e=await (0,a.getModelCostMapReloadStatus)(l);console.log("Received status:",e),b(e)}catch(e){console.error("Failed to fetch reload status:",e),b({scheduled:!1,interval_hours:null,last_run:null,next_run:null})}finally{Z(!1)}}},C=async()=>{if(!l){ec.ZP.fromBackend("No access token available");return}m(!0);try{let e=await (0,a.reloadModelCostMap)(l);"success"===e.status?(ec.ZP.success("Price data reloaded successfully! ".concat(e.models_count||0," models updated.")),null==t||t(),await w()):ec.ZP.fromBackend("Failed to reload price data")}catch(e){console.error("Error reloading price data:",e),ec.ZP.fromBackend("Failed to reload price data. Please try again.")}finally{m(!1)}},k=async()=>{if(!l){ec.ZP.fromBackend("No access token available");return}if(v<=0){ec.ZP.fromBackend("Hours must be greater than 0");return}h(!0);try{let e=await (0,a.scheduleModelCostMapReload)(l,v);"success"===e.status?(ec.ZP.success("Periodic reload scheduled for every ".concat(v," hours")),j(!1),await w()):ec.ZP.fromBackend("Failed to schedule periodic reload")}catch(e){console.error("Error scheduling reload:",e),ec.ZP.fromBackend("Failed to schedule periodic reload. Please try again.")}finally{h(!1)}},P=async()=>{if(!l){ec.ZP.fromBackend("No access token available");return}p(!0);try{let e=await (0,a.cancelModelCostMapReload)(l);"success"===e.status?(ec.ZP.success("Periodic reload cancelled successfully"),await w()):ec.ZP.fromBackend("Failed to cancel periodic reload")}catch(e){console.error("Error cancelling reload:",e),ec.ZP.fromBackend("Failed to cancel periodic reload. Please try again.")}finally{p(!1)}},A=e=>{if(!e)return"Never";try{return new Date(e).toLocaleString()}catch(l){return e}};return(0,s.jsxs)("div",{className:d,children:[(0,s.jsxs)(S.Z,{direction:"horizontal",size:"middle",style:{marginBottom:16},children:[(0,s.jsx)(et.Z,{title:"Hard Refresh Price Data",description:"This will immediately fetch the latest pricing information from the remote source. Continue?",onConfirm:C,okText:"Yes",cancelText:"No",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"}},children:(0,s.jsx)(es.ZP,{type:o,size:n,loading:c,icon:i?(0,s.jsx)(en.Z,{}):void 0,style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem",transition:"all 0.2s ease-in-out"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#4f46e5"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="#6366f1"},children:r})}),(null==y?void 0:y.scheduled)?(0,s.jsx)(es.ZP,{type:"default",size:n,danger:!0,icon:(0,s.jsx)(ed.Z,{}),loading:x,onClick:P,style:{borderColor:"#ff4d4f",color:"#ff4d4f",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Cancel Periodic Reload"}):(0,s.jsx)(es.ZP,{type:"default",size:n,icon:(0,s.jsx)(eo.Z,{}),onClick:()=>j(!0),style:{borderColor:"#d9d9d9",color:"#6366f1",fontWeight:"500",borderRadius:"0.375rem",padding:"0.375rem 0.75rem",height:"auto",fontSize:"0.875rem",lineHeight:"1.25rem"},children:"Set Up Periodic Reload"})]}),y&&(0,s.jsx)(ea.Z,{size:"small",style:{backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:8},children:(0,s.jsxs)(S.Z,{direction:"vertical",size:"small",style:{width:"100%"},children:[y.scheduled?(0,s.jsx)("div",{children:(0,s.jsxs)(er.Z,{color:"green",icon:(0,s.jsx)(eo.Z,{}),children:["Scheduled every ",y.interval_hours," hours"]})}):(0,s.jsx)(em,{type:"secondary",children:"No periodic reload scheduled"}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(em,{type:"secondary",style:{fontSize:"12px"},children:"Last run:"}),(0,s.jsx)(em,{style:{fontSize:"12px"},children:A(y.last_run)})]}),y.scheduled&&(0,s.jsxs)(s.Fragment,{children:[y.next_run&&(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(em,{type:"secondary",style:{fontSize:"12px"},children:"Next run:"}),(0,s.jsx)(em,{style:{fontSize:"12px"},children:A(y.next_run)})]}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(em,{type:"secondary",style:{fontSize:"12px"},children:"Status:"}),(0,s.jsx)(er.Z,{color:(null==y?void 0:y.scheduled)?y.last_run?"success":"processing":"default",children:(null==y?void 0:y.scheduled)?y.last_run?"Active":"Ready":"Not scheduled"})]})]})]})}),(0,s.jsxs)(ei.Z,{title:"Set Up Periodic Reload",open:f,onOk:k,onCancel:()=>j(!1),confirmLoading:u,okText:"Schedule",cancelText:"Cancel",okButtonProps:{style:{backgroundColor:"#6366f1",borderColor:"#6366f1",color:"white"}},children:[(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(em,{children:"Set up automatic reload of price data every:"})}),(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(Q.Z,{min:1,max:168,value:v,onChange:e=>_(e||6),addonAfter:"hours",style:{width:"100%"}})}),(0,s.jsx)("div",{children:(0,s.jsxs)(em,{type:"secondary",children:["This will automatically fetch the latest pricing data from the remote source every ",v," hours."]})})]})]})},eh=()=>{let{accessToken:e}=(0,n.Z)(),{refetch:l}=(0,c.i)();return(0,s.jsx)(V.Z,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(X.Z,{children:"Price Data Management"}),(0,s.jsx)($.Z,{className:"text-tremor-content",children:"Manage model pricing data and configure automatic reload schedules"})]}),(0,s.jsx)(eu,{accessToken:e,onReloadSuccess:()=>{l()},buttonText:"Reload Price Data",size:"middle",type:"primary",className:"w-full"})]})})},ex=t(42673);let ep=async(e,l,t)=>{try{var s,a;console.log("handling submit for formValues:",e);let l=e.model_mappings||[];if("model_mappings"in e&&delete e.model_mappings,e.model&&e.model.includes("all-wildcard")){let t=e.custom_llm_provider,a=(null!==(s=ex.fK[t])&&void 0!==s?s:t.toLowerCase())+"/*";e.model_name=a,l.push({public_name:a,litellm_model:a}),e.model=a}let t=[];for(let s of l){let l={},r={},i=s.public_name;for(let[t,i]of(l.model=s.litellm_model,e.input_cost_per_token&&(e.input_cost_per_token=Number(e.input_cost_per_token)/1e6),e.output_cost_per_token&&(e.output_cost_per_token=Number(e.output_cost_per_token)/1e6),l.model=s.litellm_model,console.log("formValues add deployment:",e),Object.entries(e)))if(""!==i&&"custom_pricing"!==t&&"pricing_model"!==t&&"cache_control"!==t){if("model_name"==t)l.model=i;else if("custom_llm_provider"==t){console.log("custom_llm_provider:",i);let e=null!==(a=ex.fK[i])&&void 0!==a?a:i.toLowerCase();l.custom_llm_provider=e,console.log("custom_llm_provider mappingResult:",e)}else if("model"==t)continue;else if("base_model"===t)r[t]=i;else if("team_id"===t)r.team_id=i;else if("model_access_group"===t)r.access_groups=i;else if("mode"==t)console.log("placing mode in modelInfo"),r.mode=i,delete l.mode;else if("custom_model_name"===t)l.model=i;else if("litellm_extra_params"==t){console.log("litellm_extra_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw ec.ZP.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[t,s]of Object.entries(e))l[t]=s}}else if("model_info_params"==t){console.log("model_info_params:",i);let e={};if(i&&void 0!=i){try{e=JSON.parse(i)}catch(e){throw ec.ZP.fromBackend("Failed to parse LiteLLM Extra Params: "+e),Error("Failed to parse litellm_extra_params: "+e)}for(let[l,t]of Object.entries(e))r[l]=t}}else if("input_cost_per_token"===t||"output_cost_per_token"===t||"input_cost_per_second"===t){i&&(l[t]=Number(i));continue}else l[t]=i}t.push({litellmParamsObj:l,modelInfoObj:r,modelName:i})}return t}catch(e){ec.ZP.fromBackend("Failed to create model: "+e)}},eg=async(e,l,t,s)=>{try{let r=await ep(e,l,t);if(!r||0===r.length)return;for(let e of r){let{litellmParamsObj:t,modelInfoObj:s,modelName:r}=e,i={model_name:r,litellm_params:t,model_info:s},n=await (0,a.modelCreateCall)(l,i);console.log("response for model create call: ".concat(n.data))}s&&s(),t.resetFields()}catch(e){ec.ZP.fromBackend("Failed to add model: "+e)}};var ef=t(53410),ej=t(62490),ev=t(10032),e_=t(21609),ey=t(31283);let eb=(0,i.n)("providerFields"),eN=()=>(0,r.a)({queryKey:eb.list({}),queryFn:async()=>await (0,a.getProviderCreateMetadata)(),staleTime:864e5,gcTime:864e5});var eZ=t(3632),ew=t(56522),eC=t(47451),ek=t(69410),eS=t(65319),eP=t(4260);let{Link:eA}=k.default,eE=e=>{var l,t,s,a,r;let i="password"===e.field_type?"password":"select"===e.field_type?"select":"upload"===e.field_type?"upload":"textarea"===e.field_type?"textarea":"text";return{key:e.key,label:e.label,placeholder:null!==(l=e.placeholder)&&void 0!==l?l:void 0,tooltip:null!==(t=e.tooltip)&&void 0!==t?t:void 0,required:null!==(s=e.required)&&void 0!==s&&s,type:i,options:null!==(a=e.options)&&void 0!==a?a:void 0,defaultValue:null!==(r=e.default_value)&&void 0!==r?r:void 0}},eM={};var eL=e=>{let{selectedProvider:l,uploadProps:t}=e,a=ex.Cl[l],r=ev.Z.useFormInstance(),{data:i,isLoading:n,error:o}=eN(),d=g.useMemo(()=>{if(!i)return null;let e={};return i.forEach(l=>{let t=l.provider_display_name,s=l.credential_fields.map(eE);e[t]=s,l.provider&&(e[l.provider]=s),l.litellm_provider&&(e[l.litellm_provider]=s)}),e},[i]);g.useEffect(()=>{d&&Object.assign(eM,d)},[d]);let c=g.useMemo(()=>{var e;let t=null!==(e=eM[a])&&void 0!==e?e:eM[l];if(t)return t;if(!i)return[];let s=i.find(e=>e.provider_display_name===a||e.provider===l||e.litellm_provider===l);if(!s)return[];let r=s.credential_fields.map(eE);return eM[s.provider_display_name]=r,s.provider&&(eM[s.provider]=r),s.litellm_provider&&(eM[s.litellm_provider]=r),r},[a,l,i]),m={name:"file",accept:".json",beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;console.log("Setting field value from JSON, length: ".concat(l.length)),r.setFieldsValue({vertex_credentials:l}),console.log("Form values after setting:",r.getFieldsValue())}},l.readAsText(e)}return!1},onChange(e){console.log("Upload onChange triggered in ProviderSpecificFields"),console.log("Current form values:",r.getFieldsValue()),"uploading"!==e.file.status&&console.log(e.file,e.fileList)}};return(0,s.jsxs)(s.Fragment,{children:[n&&0===c.length&&(0,s.jsx)(eC.Z,{children:(0,s.jsx)(ek.Z,{span:24,children:(0,s.jsx)(ew.x,{className:"mb-2",children:"Loading provider fields..."})})}),o&&0===c.length&&(0,s.jsx)(eC.Z,{children:(0,s.jsx)(ek.Z,{span:24,children:(0,s.jsx)(ew.x,{className:"mb-2 text-red-500",children:o instanceof Error?o.message:"Failed to load provider credential fields"})})}),c.map(e=>{var l;return(0,s.jsxs)(g.Fragment,{children:[(0,s.jsx)(ev.Z.Item,{label:e.label,name:e.key,rules:e.required?[{required:!0,message:"Required"}]:void 0,tooltip:e.tooltip,className:"vertex_credentials"===e.key?"mb-0":void 0,children:"select"===e.type?(0,s.jsx)(D.default,{placeholder:e.placeholder,defaultValue:e.defaultValue,children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,s.jsx)(D.default.Option,{value:e,children:e},e))}):"upload"===e.type?(0,s.jsx)(eS.default,{...m,onChange:l=>{(null==t?void 0:t.onChange)&&t.onChange(l),setTimeout(()=>{let l=r.getFieldValue(e.key);console.log("".concat(e.key," value after upload:"),JSON.stringify(l))},500)},children:(0,s.jsx)(es.ZP,{icon:(0,s.jsx)(eZ.Z,{}),children:"Click to Upload"})}):"textarea"===e.type?(0,s.jsx)(eP.default.TextArea,{placeholder:e.placeholder,defaultValue:e.defaultValue,rows:6,style:{fontFamily:"monospace",fontSize:"12px"}}):(0,s.jsx)(ew.o,{placeholder:e.placeholder,type:"password"===e.type?"password":"text",defaultValue:e.defaultValue})}),"vertex_credentials"===e.key&&(0,s.jsx)(eC.Z,{children:(0,s.jsx)(ek.Z,{children:(0,s.jsx)(ew.x,{className:"mb-3 mt-1",children:"Give a gcp service account(.json file)"})})}),"base_model"===e.key&&(0,s.jsxs)(eC.Z,{children:[(0,s.jsx)(ek.Z,{span:10}),(0,s.jsx)(ek.Z,{span:10,children:(0,s.jsxs)(ew.x,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,s.jsx)(eA,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]},e.key)})]})};let{Link:eF}=k.default;var eI=e=>{let{open:l,onCancel:t,onAddCredential:a,uploadProps:r}=e,[i]=ev.Z.useForm(),[n,o]=(0,g.useState)(ex.Cl.OpenAI);return(0,s.jsx)(ei.Z,{title:"Add New Credential",open:l,onCancel:()=>{t(),i.resetFields()},footer:null,width:600,children:(0,s.jsxs)(ev.Z,{form:i,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),i.resetFields()},layout:"vertical",children:[(0,s.jsx)(ev.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],children:(0,s.jsx)(ey.o,{placeholder:"Enter a friendly name for these credentials"})}),(0,s.jsx)(ev.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(D.default,{showSearch:!0,onChange:e=>{o(e),i.setFieldValue("custom_llm_provider",e)},children:Object.entries(ex.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(D.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:ex.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(eL,{selectedProvider:n,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(E.Z,{title:"Get help on our github",children:(0,s.jsx)(eF,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(es.ZP,{onClick:()=>{t(),i.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(es.ZP,{htmlType:"submit",children:"Add Credential"})]})]})]})})};let{Link:eT}=k.default;function eR(e){let{open:l,onCancel:t,onUpdateCredential:a,uploadProps:r,existingCredential:i}=e,[n]=ev.Z.useForm(),[o,d]=(0,g.useState)(ex.Cl.Anthropic);return(0,g.useEffect)(()=>{if(i){let e=Object.entries(i.credential_values||{}).reduce((e,l)=>{let[t,s]=l;return e[t]=null!=s?s:null,e},{});n.setFieldsValue({credential_name:i.credential_name,custom_llm_provider:i.credential_info.custom_llm_provider,...e}),d(i.credential_info.custom_llm_provider)}},[i]),(0,s.jsx)(ei.Z,{title:"Edit Credential",open:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,destroyOnHidden:!0,children:(0,s.jsxs)(ev.Z,{form:n,onFinish:e=>{a(Object.entries(e).reduce((e,l)=>{let[t,s]=l;return""!==s&&null!=s&&(e[t]=s),e},{})),n.resetFields()},layout:"vertical",children:[(0,s.jsx)(ev.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==i?void 0:i.credential_name,children:(0,s.jsx)(ey.o,{placeholder:"Enter a friendly name for these credentials",disabled:null!=i&&!!i.credential_name})}),(0,s.jsx)(ev.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"Helper to auto-populate provider specific fields",children:(0,s.jsx)(D.default,{showSearch:!0,onChange:e=>{d(e),n.setFieldValue("custom_llm_provider",e)},children:Object.entries(ex.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(D.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:ex.cd[t],alt:"".concat(l," logo"),className:"w-5 h-5",onError:e=>{let l=e.target,s=l.parentElement;if(s){let e=document.createElement("div");e.className="w-5 h-5 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=t.charAt(0),s.replaceChild(e,l)}}}),(0,s.jsx)("span",{children:t})]})},l)})})}),(0,s.jsx)(eL,{selectedProvider:o,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(E.Z,{title:"Get help on our github",children:(0,s.jsx)(eT,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(es.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(es.ZP,{htmlType:"submit",children:"Update Credential"})]})]})]})})}var ez=e=>{var l;let{uploadProps:t}=e,{accessToken:r}=(0,n.Z)(),{data:i,refetch:o}=d(),c=(null==i?void 0:i.credentials)||[],[m,u]=(0,g.useState)(!1),[h,x]=(0,g.useState)(!1),[p,f]=(0,g.useState)(null),[j,v]=(0,g.useState)(null),[_,y]=(0,g.useState)(!1),[b,Z]=(0,g.useState)(!1),[w]=ev.Z.useForm(),C=["credential_name","custom_llm_provider"],k=async e=>{if(!r)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!C.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,a.credentialUpdateCall)(r,e.credential_name,t),ec.ZP.success("Credential updated successfully"),x(!1),await o()},S=async e=>{if(!r)return;let l=Object.entries(e).filter(e=>{let[l]=e;return!C.includes(l)}).reduce((e,l)=>{let[t,s]=l;return{...e,[t]:s}},{}),t={credential_name:e.credential_name,credential_values:l,credential_info:{custom_llm_provider:e.custom_llm_provider}};await (0,a.credentialCreateCall)(r,t),ec.ZP.success("Credential added successfully"),u(!1),await o()},P=e=>{let l={openai:"blue",azure:"indigo",anthropic:"purple",default:"gray"},t=l[e.toLowerCase()]||l.default;return(0,s.jsx)(ej.Ct,{color:t,size:"xs",children:e})},A=async()=>{if(r&&j){Z(!0);try{await (0,a.credentialDeleteCall)(r,j.credential_name),ec.ZP.success("Credential deleted successfully"),await o()}catch(e){ec.ZP.error("Failed to delete credential")}finally{v(null),y(!1),Z(!1)}}},E=e=>{v(e),y(!0)};return(0,s.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto p-2",children:[(0,s.jsx)(ej.zx,{onClick:()=>u(!0),children:"Add Credential"}),(0,s.jsx)("div",{className:"flex justify-between items-center mt-4 mb-4",children:(0,s.jsx)(ej.xv,{children:"Configured credentials for different AI providers. Add and manage your API credentials."})}),(0,s.jsx)(ej.Zb,{children:(0,s.jsxs)(ej.iA,{children:[(0,s.jsx)(ej.ss,{children:(0,s.jsxs)(ej.SC,{children:[(0,s.jsx)(ej.xs,{children:"Credential Name"}),(0,s.jsx)(ej.xs,{children:"Provider"}),(0,s.jsx)(ej.xs,{children:"Actions"})]})}),(0,s.jsx)(ej.RM,{children:c&&0!==c.length?c.map((e,l)=>{var t;return(0,s.jsxs)(ej.SC,{children:[(0,s.jsx)(ej.pj,{children:e.credential_name}),(0,s.jsx)(ej.pj,{children:P((null===(t=e.credential_info)||void 0===t?void 0:t.custom_llm_provider)||"-")}),(0,s.jsxs)(ej.pj,{children:[(0,s.jsx)(ej.zx,{icon:ef.Z,variant:"light",size:"sm",onClick:()=>{f(e),x(!0)}}),(0,s.jsx)(ej.zx,{icon:N.Z,variant:"light",size:"sm",onClick:()=>E(e),className:"ml-2"})]})]},l)}):(0,s.jsx)(ej.SC,{children:(0,s.jsx)(ej.pj,{colSpan:4,className:"text-center py-4 text-gray-500",children:"No credentials configured"})})})]})}),m&&(0,s.jsx)(eI,{onAddCredential:S,open:m,onCancel:()=>u(!1),uploadProps:t}),h&&(0,s.jsx)(eR,{open:h,existingCredential:p,onUpdateCredential:k,uploadProps:t,onCancel:()=>x(!1)}),(0,s.jsx)(e_.Z,{isOpen:_,onCancel:()=>{v(null),y(!1)},onOk:A,title:"Delete Credential?",message:"Are you sure you want to delete this credential? This action cannot be undone and may break existing integrations.",resourceInformationTitle:"Credential Information",resourceInformation:[{label:"Credential Name",value:null==j?void 0:j.credential_name},{label:"Provider",value:(null==j?void 0:null===(l=j.credential_info)||void 0===l?void 0:l.custom_llm_provider)||"-"}],confirmLoading:b,requiredConfirmation:null==j?void 0:j.credential_name})]})},eO=t(20347),eV=t(23628),eq=t(29827),eD=t(49804),eB=t(12485),eG=t(18135),eU=t(35242),eH=t(77991),eK=t(34419),eJ=t(58643),eW=t(29),eY=t.n(eW),e$=t(35291),eX=t(23639);let{Text:eQ}=k.default;var e0=e=>{let{formValues:l,accessToken:t,testMode:r,modelName:i="this model",onClose:n,onTestComplete:o}=e,[d,c]=g.useState(null),[m,u]=g.useState(null),[h,x]=g.useState(null),[p,f]=g.useState(!0),[j,v]=g.useState(!1),[_,y]=g.useState(!1),N=async()=>{f(!0),y(!1),c(null),u(null),x(null),v(!1),await new Promise(e=>setTimeout(e,100));try{console.log("Testing connection with form values:",l);let r=await ep(l,t,null);if(!r){console.log("No result from prepareModelAddRequest"),c("Failed to prepare model data. Please check your form inputs."),v(!1),f(!1);return}console.log("Result from prepareModelAddRequest:",r);let{litellmParamsObj:i,modelInfoObj:n,modelName:o}=r[0],d=await (0,a.testConnectionRequest)(t,i,n,null==n?void 0:n.mode);if("success"===d.status)ec.ZP.success("Connection test successful!"),c(null),v(!0);else{var e,s;let l=(null===(e=d.result)||void 0===e?void 0:e.error)||d.message||"Unknown error";c(l),u(i),x(null===(s=d.result)||void 0===s?void 0:s.raw_request_typed_dict),v(!1)}}catch(e){console.error("Test connection error:",e),c(e instanceof Error?e.message:String(e)),v(!1)}finally{f(!1),o&&o()}};g.useEffect(()=>{let e=setTimeout(()=>{N()},200);return()=>clearTimeout(e)},[]);let Z=e=>e?e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error: /,""):"Unknown error",w="string"==typeof d?Z(d):(null==d?void 0:d.message)?Z(d.message):"Unknown error",C=h?((e,l,t)=>{let s=JSON.stringify(l,null,2).split("\n").map(e=>" ".concat(e)).join("\n"),a=Object.entries(t).map(e=>{let[l,t]=e;return"-H '".concat(l,": ").concat(t,"'")}).join(" \\\n ");return"curl -X POST \\\n ".concat(e," \\\n ").concat(a?"".concat(a," \\\n "):"","-H 'Content-Type: application/json' \\\n -d '{\n").concat(s,"\n }'")})(h.raw_request_api_base,h.raw_request_body,h.raw_request_headers||{}):"";return(0,s.jsxs)("div",{style:{padding:"24px",borderRadius:"8px",backgroundColor:"#fff"},children:[p?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"32px 20px"},className:"jsx-dc9a0e2d897fe63b",children:[(0,s.jsx)("div",{style:{marginBottom:"16px"},className:"jsx-dc9a0e2d897fe63b loading-spinner",children:(0,s.jsx)("div",{style:{border:"3px solid #f3f3f3",borderTop:"3px solid #1890ff",borderRadius:"50%",width:"30px",height:"30px",animation:"spin 1s linear infinite",margin:"0 auto"},className:"jsx-dc9a0e2d897fe63b"})}),(0,s.jsxs)(eQ,{style:{fontSize:"16px"},children:["Testing connection to ",i,"..."]}),(0,s.jsx)(eY(),{id:"dc9a0e2d897fe63b",children:"@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg);transform:rotate(0deg)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);-moz-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}"})]}):j?(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px 20px"},children:[(0,s.jsx)("div",{style:{color:"#52c41a",fontSize:"24px",display:"flex",alignItems:"center"},children:(0,s.jsx)("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}),(0,s.jsxs)(eQ,{type:"success",style:{fontSize:"18px",fontWeight:500,marginLeft:"10px"},children:["Connection to ",i," successful!"]})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:"20px"},children:[(0,s.jsx)(e$.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,s.jsxs)(eQ,{type:"danger",style:{fontSize:"18px",fontWeight:500},children:["Connection to ",i," failed"]})]}),(0,s.jsxs)("div",{style:{backgroundColor:"#fff2f0",border:"1px solid #ffccc7",borderRadius:"8px",padding:"16px",marginBottom:"20px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.03)"},children:[(0,s.jsxs)(eQ,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,s.jsx)(eQ,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:w}),d&&(0,s.jsx)("div",{style:{marginTop:"12px"},children:(0,s.jsx)(es.ZP,{type:"link",onClick:()=>y(!_),style:{paddingLeft:0,height:"auto"},children:_?"Hide Details":"Show Details"})})]}),_&&(0,s.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,s.jsx)(eQ,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"Troubleshooting Details"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"200px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:"string"==typeof d?d:JSON.stringify(d,null,2)})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(eQ,{strong:!0,style:{display:"block",marginBottom:"8px",fontSize:"15px"},children:"API Request"}),(0,s.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",fontSize:"13px",maxHeight:"250px",overflow:"auto",border:"1px solid #e8e8e8",lineHeight:"1.5"},children:C||"No request data available"}),(0,s.jsx)(es.ZP,{style:{marginTop:"8px"},icon:(0,s.jsx)(eX.Z,{}),onClick:()=>{navigator.clipboard.writeText(C||""),ec.ZP.success("Copied to clipboard")},children:"Copy to Clipboard"})]})]})}),(0,s.jsx)(A.Z,{style:{margin:"24px 0 16px"}}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,s.jsx)(es.ZP,{type:"link",href:"https://docs.litellm.ai/docs/providers",target:"_blank",icon:(0,s.jsx)(b.Z,{}),children:"View Documentation"})})]})};let e1=async(e,l,t,s)=>{try{console.log("=== AUTO ROUTER SUBMIT HANDLER CALLED ==="),console.log("handling auto router submit for formValues:",e),console.log("Access token:",l?"Present":"Missing"),console.log("Form:",t?"Present":"Missing"),console.log("Callback:",s?"Present":"Missing");let r={model_name:e.auto_router_name,litellm_params:{model:"auto_router/".concat(e.auto_router_name),auto_router_config:JSON.stringify(e.auto_router_config),auto_router_default_model:e.auto_router_default_model},model_info:{}};e.auto_router_embedding_model&&"custom"!==e.auto_router_embedding_model?r.litellm_params.auto_router_embedding_model=e.auto_router_embedding_model:e.custom_embedding_model&&(r.litellm_params.auto_router_embedding_model=e.custom_embedding_model),e.team_id&&(r.model_info.team_id=e.team_id),e.model_access_group&&e.model_access_group.length>0&&(r.model_info.access_groups=e.model_access_group),console.log("Auto router configuration to be created:",r),console.log("Auto router config (stringified):",r.litellm_params.auto_router_config),console.log("Calling modelCreateCall with:",{accessToken:l?"Present":"Missing",config:r});let i=await (0,a.modelCreateCall)(l,r);console.log("response for auto router create call:",i),t.resetFields()}catch(e){console.error("Failed to add auto router:",e),ec.ZP.fromBackend("Failed to add auto router: "+e)}};var e2=t(10703),e4=t(96473),e5=t(26349),e6=t(85180),e3=t(44851);let{Text:e8}=k.default,{TextArea:e7}=eP.default;var e9=e=>{let{modelInfo:l,value:t,onChange:a}=e,[r,i]=(0,g.useState)([]),[n,o]=(0,g.useState)(!1),[d,c]=(0,g.useState)([]);(0,g.useEffect)(()=>{let e=null==t?void 0:t.routes;if(e){let l=[];i(t=>e.map((e,s)=>{var a;let r=t[s],i=(null==r?void 0:r.id)||e.id||"route-".concat(s,"-").concat(Date.now());return l.push(i),{id:i,model:e.name||e.model||"",utterances:e.utterances||[],description:e.description||"",score_threshold:null!==(a=e.score_threshold)&&void 0!==a?a:.5}})),c(l)}else i([]),c([])},[t]);let m=e=>{let l=r.filter(l=>l.id!==e);i(l),h(l),c(l=>l.filter(l=>l!==e))},u=(e,l,t)=>{let s=r.map(s=>s.id===e?{...s,[l]:t}:s);i(s),h(s)},h=e=>{let l={routes:e.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))};null==a||a(l)},x=l.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsxs)("div",{className:"w-full max-w-none",children:[(0,s.jsxs)(P.Z,{justify:"space-between",align:"center",gap:"middle",style:{width:"100%",marginBottom:24},children:[(0,s.jsxs)(S.Z,{align:"center",children:[(0,s.jsx)(k.default.Title,{level:4,style:{margin:0},children:"Routes Configuration"}),(0,s.jsx)(E.Z,{title:"Configure routing logic to automatically select the best model based on user input patterns",children:(0,s.jsx)(b.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(es.ZP,{type:"primary",icon:(0,s.jsx)(e4.Z,{}),onClick:()=>{let e="route-".concat(Date.now()),l=[...r,{id:e,model:"",utterances:[],description:"",score_threshold:.5}];i(l),h(l),c(l=>[...l,e])},className:"bg-blue-600 hover:bg-blue-700",children:"Add Route"})]}),0===r.length?(0,s.jsx)(ea.Z,{children:(0,s.jsx)(e6.Z,{description:'No routes configured. Click "Add Route" to get started.'})}):(0,s.jsx)(e3.default,{activeKey:d,onChange:e=>c(Array.isArray(e)?e:[e].filter(Boolean)),style:{width:"100%"},items:r.map((e,l)=>({key:e.id,label:(0,s.jsxs)(e8,{style:{fontSize:16},children:["Route ",l+1,": ",e.model||"Unnamed"]}),extra:(0,s.jsx)(es.ZP,{type:"text",danger:!0,size:"small",icon:(0,s.jsx)(e5.Z,{}),onClick:l=>{l.stopPropagation(),m(e.id)}}),children:(0,s.jsxs)(ea.Z,{children:[(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(e8,{className:"text-sm font-medium mb-2 block",children:"Model"}),(0,s.jsx)(D.default,{value:e.model,onChange:l=>u(e.id,"model",l),placeholder:"Select model",showSearch:!0,style:{width:"100%"},options:x})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(e8,{className:"text-sm font-medium mb-2 block",children:"Description"}),(0,s.jsx)(e7,{value:e.description,onChange:l=>u(e.id,"description",l.target.value),placeholder:"Describe when this route should be used...",rows:2,style:{width:"100%"}})]}),(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(e8,{className:"text-sm font-medium",children:"Score Threshold"}),(0,s.jsx)(E.Z,{title:"Minimum similarity score to route to this model (0-1)",children:(0,s.jsx)(b.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(Q.Z,{value:e.score_threshold,onChange:l=>u(e.id,"score_threshold",l||0),min:0,max:1,step:.1,style:{width:"100%"},placeholder:"0.5"})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(e8,{className:"text-sm font-medium",children:"Example Utterances"}),(0,s.jsx)(E.Z,{title:"Training examples for this route. Type an utterance and press Enter to add it.",children:(0,s.jsx)(b.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(e8,{className:"text-xs text-gray-500 mb-2",children:"Type an utterance and press Enter to add it. You can also paste multiple lines."}),(0,s.jsx)(D.default,{mode:"tags",value:e.utterances,onChange:l=>u(e.id,"utterances",l),placeholder:"Type an utterance and press Enter...",style:{width:"100%"},tokenSeparators:["\n"],maxTagCount:"responsive",allowClear:!0})]})]},e.id)}))}),(0,s.jsx)(A.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4 w-full",children:[(0,s.jsx)(e8,{className:"text-lg font-semibold",children:"JSON Preview"}),(0,s.jsx)(es.ZP,{type:"link",onClick:()=>o(!n),className:"text-blue-600 p-0",children:n?"Hide":"Show"})]}),n&&(0,s.jsx)(ea.Z,{className:"bg-gray-50 w-full",children:(0,s.jsx)("pre",{className:"text-sm overflow-auto max-h-64 w-full",children:JSON.stringify({routes:r.map(e=>({name:e.model,utterances:e.utterances,description:e.description,score_threshold:e.score_threshold}))},null,2)})})]})};let{Title:le,Link:ll}=k.default;var lt=e=>{let{form:l,handleOk:t,accessToken:r,userRole:i}=e,[n,o]=(0,g.useState)(!1),[d,c]=(0,g.useState)(!1),[m,u]=(0,g.useState)(""),[h,x]=(0,g.useState)([]),[p,f]=(0,g.useState)([]),[j,v]=(0,g.useState)(!1),[_,y]=(0,g.useState)(!1),[b,N]=(0,g.useState)(null);(0,g.useEffect)(()=>{(async()=>{x((await (0,a.modelAvailableCall)(r,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[r]),(0,g.useEffect)(()=>{(async()=>{try{let e=await (0,e2.p)(r);console.log("Fetched models for auto router:",e),f(e)}catch(e){console.error("Error fetching model info for auto router:",e)}})()},[r]);let Z=eO.ZL.includes(i),w=async()=>{c(!0),u("test-".concat(Date.now())),o(!0)},C=()=>{console.log("Auto router submit triggered!"),console.log("Router config:",b);let e=l.getFieldsValue();if(console.log("Form values:",e),!e.auto_router_name){ec.ZP.fromBackend("Please enter an Auto Router Name");return}if(!e.auto_router_default_model){ec.ZP.fromBackend("Please select a Default Model");return}if(l.setFieldsValue({custom_llm_provider:"auto_router",model:e.auto_router_name,api_key:"not_required_for_auto_router"}),!b||!b.routes||0===b.routes.length){ec.ZP.fromBackend("Please configure at least one route for the auto router");return}if(b.routes.filter(e=>!e.name||!e.description||0===e.utterances.length).length>0){ec.ZP.fromBackend("Please ensure all routes have a target model, description, and at least one utterance");return}l.validateFields().then(e=>{console.log("Form validation passed, submitting with values:",e);let s={...e,auto_router_config:b};console.log("Final submit values:",s),e1(s,r,l,t)}).catch(e=>{console.error("Validation failed:",e);let l=e.errorFields||[];if(l.length>0){let e=l.map(e=>{let l=e.name[0];return({auto_router_name:"Auto Router Name",auto_router_default_model:"Default Model",auto_router_embedding_model:"Embedding Model"})[l]||l});ec.ZP.fromBackend("Please fill in the following required fields: ".concat(e.join(", ")))}else ec.ZP.fromBackend("Please fill in all required fields")})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(le,{level:2,children:"Add Auto Router"}),(0,s.jsx)(ew.x,{className:"text-gray-600 mb-6",children:"Create an auto router with intelligent routing logic that automatically selects the best model based on user input patterns and semantic matching."}),(0,s.jsx)(ea.Z,{children:(0,s.jsxs)(ev.Z,{form:l,onFinish:C,labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsx)(ev.Z.Item,{rules:[{required:!0,message:"Auto router name is required"}],label:"Auto Router Name",name:"auto_router_name",tooltip:"Unique name for this auto router configuration",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(ew.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full mb-4",children:(0,s.jsx)(e9,{modelInfo:p,value:b,onChange:e=>{N(e),l.setFieldValue("auto_router_config",e)}})}),(0,s.jsx)(ev.Z.Item,{rules:[{required:!0,message:"Default model is required"}],label:"Default Model",name:"auto_router_default_model",tooltip:"Fallback model to use when auto routing logic cannot determine the best model",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(D.default,{placeholder:"Select a default model",onChange:e=>{v("custom"===e)},options:[...Array.from(new Set(p.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0})}),(0,s.jsx)(ev.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",tooltip:"Optional: Embedding model to use for semantic routing decisions",labelCol:{span:10},labelAlign:"left",children:(0,s.jsx)(D.default,{value:l.getFieldValue("auto_router_embedding_model"),placeholder:"Select an embedding model (optional)",onChange:e=>{y("custom"===e),l.setFieldValue("auto_router_embedding_model",e)},options:[...Array.from(new Set(p.map(e=>e.model_group))).map(e=>({value:e,label:e})),{value:"custom",label:"Enter custom model name"}],style:{width:"100%"},showSearch:!0,allowClear:!0})}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),Z&&(0,s.jsx)(ev.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to control who can access this auto router",children:(0,s.jsx)(D.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:h.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(E.Z,{title:"Get help on our github",children:(0,s.jsx)(k.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(es.ZP,{onClick:w,loading:d,children:"Test Connect"}),(0,s.jsx)(es.ZP,{onClick:()=>{console.log("Add Auto Router button clicked!"),console.log("Current router config:",b),console.log("Current form values:",l.getFieldsValue()),C()},children:"Add Auto Router"})]})]})]})}),(0,s.jsx)(ei.Z,{title:"Connection Test Results",open:n,onCancel:()=>{o(!1),c(!1)},footer:[(0,s.jsx)(es.ZP,{onClick:()=>{o(!1),c(!1)},children:"Close"},"close")],width:700,children:n&&(0,s.jsx)(e0,{formValues:l.getFieldsValue(),accessToken:r,testMode:"chat",modelName:l.getFieldValue("auto_router_name"),onClose:()=>{o(!1),c(!1)},onTestComplete:()=>c(!1)},m)})]})};let ls=(0,i.n)("guardrails"),la=()=>{let{accessToken:e,userId:l,userRole:t}=(0,n.Z)();return(0,r.a)({queryKey:ls.list({}),queryFn:async()=>(await (0,a.getGuardrailsList)(e)).guardrails.map(e=>e.guardrail_name),enabled:!!(e&&l&&t)})},lr=(0,i.n)("tags"),li=()=>{let{accessToken:e,userId:l,userRole:t}=(0,n.Z)();return(0,r.a)({queryKey:lr.list({}),queryFn:async()=>await (0,a.tagListCall)(e),enabled:!!(e&&l&&t)})};var ln=t(59341),lo=t(51653),ld=t(84376),lc=t(63709),lm=t(26210),lu=t(34766),lh=t(45246),lx=t(24199);let{Text:lp}=k.default;var lg=e=>{let{form:l,showCacheControl:t,onCacheControlChange:a}=e,r=e=>{let t=l.getFieldValue("litellm_extra_params");try{let s=t?JSON.parse(t):{};e.length>0?s.cache_control_injection_points=e:delete s.cache_control_injection_points,Object.keys(s).length>0?l.setFieldValue("litellm_extra_params",JSON.stringify(s,null,2)):l.setFieldValue("litellm_extra_params","")}catch(e){console.error("Error updating cache control points:",e)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ev.Z.Item,{label:"Cache Control Injection Points",name:"cache_control",valuePropName:"checked",className:"mb-4",tooltip:"Tell litellm where to inject cache control checkpoints. You can specify either by role (to apply to all messages of that role) or by specific message index.",children:(0,s.jsx)(lc.Z,{onChange:a,className:"bg-gray-600"})}),t&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(lp,{className:"text-sm text-gray-500 block mb-4",children:"Providers like Anthropic, Bedrock API require users to specify where to inject cache control checkpoints, litellm can automatically add them for you as a cost saving feature."}),(0,s.jsx)(ev.Z.List,{name:"cache_control_injection_points",initialValue:[{location:"message"}],children:(e,t)=>{let{add:a,remove:i}=t;return(0,s.jsxs)(s.Fragment,{children:[e.map((t,a)=>(0,s.jsxs)("div",{className:"flex items-center mb-4 gap-4",children:[(0,s.jsx)(ev.Z.Item,{...t,label:"Type",name:[t.name,"location"],initialValue:"message",className:"mb-0",style:{width:"180px"},children:(0,s.jsx)(D.default,{disabled:!0,options:[{value:"message",label:"Message"}]})}),(0,s.jsx)(ev.Z.Item,{...t,label:"Role",name:[t.name,"role"],className:"mb-0",style:{width:"180px"},tooltip:"LiteLLM will mark all messages of this role as cacheable",children:(0,s.jsx)(D.default,{placeholder:"Select a role",allowClear:!0,options:[{value:"user",label:"User"},{value:"system",label:"System"},{value:"assistant",label:"Assistant"}],onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),(0,s.jsx)(ev.Z.Item,{...t,label:"Index",name:[t.name,"index"],className:"mb-0",style:{width:"180px"},tooltip:"(Optional) If set litellm will mark the message at this index as cacheable",children:(0,s.jsx)(lx.Z,{type:"number",placeholder:"Optional",step:1,onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),e.length>1&&(0,s.jsx)(lh.Z,{className:"text-red-500 cursor-pointer text-lg ml-12",onClick:()=>{i(t.name),setTimeout(()=>{r(l.getFieldValue("cache_control_points"))},0)}})]},t.key)),(0,s.jsx)(ev.Z.Item,{children:(0,s.jsxs)("button",{type:"button",className:"flex items-center justify-center w-full border border-dashed border-gray-300 py-2 px-4 text-gray-600 hover:text-blue-600 hover:border-blue-300 transition-all rounded",onClick:()=>a(),children:[(0,s.jsx)(e4.Z,{className:"mr-2"}),"Add Injection Point"]})})]})}})]})]})},lf=t(9309);let{Link:lj}=k.default;var lv=e=>{let{showAdvancedSettings:l,setShowAdvancedSettings:t,teams:a,guardrailsList:r,tagsList:i}=e,[n]=ev.Z.useForm(),[o,d]=g.useState(!1),[c,m]=g.useState("per_token"),[u,h]=g.useState(!1),x=(e,l)=>l&&(isNaN(Number(l))||0>Number(l))?Promise.reject("Please enter a valid positive number"):Promise.resolve();return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(lm.UQ,{className:"mt-2 mb-4",children:[(0,s.jsx)(lm._m,{children:(0,s.jsx)("b",{children:"Advanced Settings"})}),(0,s.jsx)(lm.X1,{children:(0,s.jsxs)("div",{className:"bg-white rounded-lg",children:[(0,s.jsx)(ev.Z.Item,{label:"Custom Pricing",name:"custom_pricing",valuePropName:"checked",className:"mb-4",children:(0,s.jsx)(lc.Z,{onChange:e=>{d(e),e||n.setFieldsValue({input_cost_per_token:void 0,output_cost_per_token:void 0,input_cost_per_second:void 0})},className:"bg-gray-600"})}),(0,s.jsx)(ev.Z.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(E.Z,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(b.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:"Select existing guardrails. Go to 'Guardrails' tab to create new guardrails.",children:(0,s.jsx)(D.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:r.map(e=>({value:e,label:e}))})}),(0,s.jsx)(ev.Z.Item,{label:"Tags",name:"tags",className:"mb-4",children:(0,s.jsx)(D.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter tags",options:Object.values(i).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}),o&&(0,s.jsxs)("div",{className:"ml-6 pl-4 border-l-2 border-gray-200",children:[(0,s.jsx)(ev.Z.Item,{label:"Pricing Model",name:"pricing_model",className:"mb-4",children:(0,s.jsx)(D.default,{defaultValue:"per_token",onChange:e=>m(e),options:[{value:"per_token",label:"Per Million Tokens"},{value:"per_second",label:"Per Second"}]})}),"per_token"===c?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ev.Z.Item,{label:"Input Cost (per 1M tokens)",name:"input_cost_per_token",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(lm.oi,{})}),(0,s.jsx)(ev.Z.Item,{label:"Output Cost (per 1M tokens)",name:"output_cost_per_token",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(lm.oi,{})})]}):(0,s.jsx)(ev.Z.Item,{label:"Cost Per Second",name:"input_cost_per_second",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(lm.oi,{})})]}),(0,s.jsx)(ev.Z.Item,{label:"Use in pass through routes",name:"use_in_pass_through",valuePropName:"checked",className:"mb-4 mt-4",tooltip:(0,s.jsxs)("span",{children:["Allow using these credentials in pass through routes."," ",(0,s.jsx)(lj,{href:"https://docs.litellm.ai/docs/pass_through/vertex_ai",target:"_blank",children:"Learn more"})]}),children:(0,s.jsx)(lc.Z,{onChange:e=>{let l=n.getFieldValue("litellm_extra_params");try{let t=l?JSON.parse(l):{};e?t.use_in_pass_through=!0:delete t.use_in_pass_through,Object.keys(t).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(t,null,2)):n.setFieldValue("litellm_extra_params","")}catch(l){e?n.setFieldValue("litellm_extra_params",JSON.stringify({use_in_pass_through:!0},null,2)):n.setFieldValue("litellm_extra_params","")}},className:"bg-gray-600"})}),(0,s.jsx)(lg,{form:n,showCacheControl:u,onCacheControlChange:e=>{if(h(e),!e){let e=n.getFieldValue("litellm_extra_params");try{let l=e?JSON.parse(e):{};delete l.cache_control_injection_points,Object.keys(l).length>0?n.setFieldValue("litellm_extra_params",JSON.stringify(l,null,2)):n.setFieldValue("litellm_extra_params","")}catch(e){n.setFieldValue("litellm_extra_params","")}}}}),(0,s.jsx)(ev.Z.Item,{label:"LiteLLM Params",name:"litellm_extra_params",tooltip:"Optional litellm params used for making a litellm.completion() call.",className:"mb-4 mt-4",rules:[{validator:lf.Ac}],children:(0,s.jsx)(lu.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,s.jsxs)(eC.Z,{className:"mb-4",children:[(0,s.jsx)(ek.Z,{span:10}),(0,s.jsx)(ek.Z,{span:10,children:(0,s.jsxs)(lm.xv,{className:"text-gray-600 text-sm",children:["Pass JSON of litellm supported params"," ",(0,s.jsx)(lj,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]}),(0,s.jsx)(ev.Z.Item,{label:"Model Info",name:"model_info_params",tooltip:"Optional model info params. Returned when calling `/model/info` endpoint.",className:"mb-0",rules:[{validator:lf.Ac}],children:(0,s.jsx)(lu.Z,{rows:4,placeholder:'{ "mode": "chat" }'})})]})})]})})},l_=t(56609),ly=t(67187);let lb=e=>{let{content:l,children:t,width:a="auto",className:r=""}=e,[i,n]=(0,g.useState)(!1),[o,d]=(0,g.useState)("top"),c=(0,g.useRef)(null),m=()=>{if(c.current){let e=c.current.getBoundingClientRect(),l=e.top,t=window.innerHeight-e.bottom;l<300&&t>300?d("bottom"):d("top")}};return(0,s.jsxs)("div",{className:"relative inline-block",ref:c,children:[t||(0,s.jsx)(ly.Z,{className:"ml-1 text-gray-500 cursor-help",onMouseEnter:()=>{m(),n(!0)},onMouseLeave:()=>n(!1)}),i&&(0,s.jsxs)("div",{className:"absolute left-1/2 -translate-x-1/2 z-50 bg-black/90 text-white p-2 rounded-md text-sm font-normal shadow-lg ".concat(r),style:{["top"===o?"bottom":"top"]:"100%",width:a,marginBottom:"top"===o?"8px":"0",marginTop:"bottom"===o?"8px":"0"},children:[l,(0,s.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 w-0 h-0",style:{top:"top"===o?"100%":"auto",bottom:"bottom"===o?"100%":"auto",borderTop:"top"===o?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderBottom:"bottom"===o?"6px solid rgba(0, 0, 0, 0.9)":"6px solid transparent",borderLeft:"6px solid transparent",borderRight:"6px solid transparent"}})]})]})};var lN=()=>{let e=ev.Z.useFormInstance(),[l,t]=(0,g.useState)(0),a=ev.Z.useWatch("model",e)||[],r=Array.isArray(a)?a:[a],i=ev.Z.useWatch("custom_model_name",e),n=!r.includes("all-wildcard"),o=ev.Z.useWatch("custom_llm_provider",e);if((0,g.useEffect)(()=>{if(i&&r.includes("custom")){let l=(e.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?o===ex.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:e);e.setFieldValue("model_mappings",l),t(e=>e+1)}},[i,r,o,e]),(0,g.useEffect)(()=>{if(r.length>0&&!r.includes("all-wildcard")){let l=e.getFieldValue("model_mappings")||[];if(l.length!==r.length||!r.every(e=>l.some(l=>"custom"===e?"custom"===l.litellm_model||l.litellm_model===i:o===ex.Cl.Azure?l.litellm_model==="azure/".concat(e):l.litellm_model===e))){let l=r.map(e=>"custom"===e&&i?o===ex.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:o===ex.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});e.setFieldValue("model_mappings",l),t(e=>e+1)}}},[r,i,o,e]),!n)return null;let d=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"mb-2 font-normal",children:"The name you specify in your API calls to LiteLLM Proxy"}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Example:"})," If you name your public model"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"example-name"}),", and choose"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"openai/qwen-plus-latest"})," as the LiteLLM model"]}),(0,s.jsxs)("div",{className:"mb-2 font-normal",children:[(0,s.jsx)("strong",{children:"Usage:"})," You make an API call to the LiteLLM proxy with"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:'model = "example-name"'})]}),(0,s.jsxs)("div",{className:"font-normal",children:[(0,s.jsx)("strong",{children:"Result:"})," LiteLLM sends"," ",(0,s.jsx)("code",{className:"bg-gray-700 px-1 py-0.5 rounded text-xs",children:"qwen-plus-latest"})," to the provider"]})]}),c=(0,s.jsx)("div",{children:"The model name LiteLLM will send to the LLM API"}),m=[{title:(0,s.jsxs)("span",{className:"flex items-center",children:["Public Model Name",(0,s.jsx)(lb,{content:d,width:"500px"})]}),dataIndex:"public_name",key:"public_name",render:(l,t,a)=>(0,s.jsx)(ey.o,{value:l,onChange:l=>{let t=l.target.value,s=[...e.getFieldValue("model_mappings")],r=o===ex.Cl.Anthropic,i=t.endsWith("-1m"),n=e.getFieldValue("litellm_extra_params"),d=!n||""===n.trim(),c=t;if(r&&i&&d){let l=JSON.stringify({extra_headers:{"anthropic-beta":"context-1m-2025-08-07"}},null,2);e.setFieldValue("litellm_extra_params",l),c=t.slice(0,-3)}s[a].public_name=c,e.setFieldValue("model_mappings",s)}})},{title:(0,s.jsxs)("span",{className:"flex items-center",children:["LiteLLM Model Name",(0,s.jsx)(lb,{content:c,width:"360px"})]}),dataIndex:"litellm_model",key:"litellm_model"}];return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(ev.Z.Item,{label:"Model Mappings",name:"model_mappings",tooltip:"Map public model names to LiteLLM model names for load balancing",labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",rules:[{required:!0,validator:async(e,l)=>{if(!l||0===l.length)throw Error("At least one model mapping is required");if(l.filter(e=>!e.public_name||""===e.public_name.trim()).length>0)throw Error("All model mappings must have valid public names")}}],children:(0,s.jsx)(l_.Z,{dataSource:e.getFieldValue("model_mappings"),columns:m,pagination:!1,size:"small"},l)})})},lZ=e=>{let{selectedProvider:l,providerModels:t,getPlaceholder:a}=e,r=ev.Z.useFormInstance(),i=e=>{let t=e.target.value,s=(r.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?l===ex.Cl.Azure?{public_name:t,litellm_model:"azure/".concat(t)}:{public_name:t,litellm_model:t}:e);r.setFieldsValue({model_mappings:s})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(ev.Z.Item,{label:"LiteLLM Model Name(s)",tooltip:"The model name LiteLLM will send to the LLM API",className:"mb-0",children:[(0,s.jsx)(ev.Z.Item,{name:"model",rules:[{required:!0,message:"Please enter ".concat(l===ex.Cl.Azure?"a deployment name":"at least one model",".")}],noStyle:!0,children:l===ex.Cl.Azure||l===ex.Cl.OpenAI_Compatible||l===ex.Cl.Ollama?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(ew.o,{placeholder:a(l),onChange:l===ex.Cl.Azure?e=>{let l=e.target.value,t=l?[{public_name:l,litellm_model:"azure/".concat(l)}]:[];r.setFieldsValue({model:l,model_mappings:t})}:void 0})}):t.length>0?(0,s.jsx)(D.default,{mode:"multiple",allowClear:!0,showSearch:!0,placeholder:"Select models",onChange:e=>{let t=Array.isArray(e)?e:[e];if(t.includes("all-wildcard"))r.setFieldsValue({model_name:void 0,model_mappings:[]});else if(JSON.stringify(r.getFieldValue("model"))!==JSON.stringify(t)){let e=t.map(e=>l===ex.Cl.Azure?{public_name:e,litellm_model:"azure/".concat(e)}:{public_name:e,litellm_model:e});r.setFieldsValue({model:t,model_mappings:e})}},optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{label:"Custom Model Name (Enter below)",value:"custom"},{label:"All ".concat(l," Models (Wildcard)"),value:"all-wildcard"},...t.map(e=>({label:e,value:e}))],style:{width:"100%"}}):(0,s.jsx)(ew.o,{placeholder:a(l)})}),(0,s.jsx)(ev.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.model!==l.model,children:e=>{let{getFieldValue:t}=e,a=t("model")||[];return(Array.isArray(a)?a:[a]).includes("custom")&&(0,s.jsx)(ev.Z.Item,{name:"custom_model_name",rules:[{required:!0,message:"Please enter a custom model name."}],className:"mt-2",children:(0,s.jsx)(ew.o,{placeholder:l===ex.Cl.Azure?"Enter Azure deployment name":"Enter custom model name",onChange:i})})}})]}),(0,s.jsxs)(eC.Z,{children:[(0,s.jsx)(ek.Z,{span:10}),(0,s.jsx)(ek.Z,{span:14,children:(0,s.jsx)(ew.x,{className:"mb-3 mt-1",children:l===ex.Cl.Azure?"Your deployment name will be saved as the public model name, and LiteLLM will use 'azure/deployment-name' internally":"The model name LiteLLM will send to the LLM API"})})]})]})};let lw=[{value:"chat",label:"Chat - /chat/completions"},{value:"completion",label:"Completion - /completions"},{value:"embedding",label:"Embedding - /embeddings"},{value:"audio_speech",label:"Audio Speech - /audio/speech"},{value:"audio_transcription",label:"Audio Transcription - /audio/transcriptions"},{value:"image_generation",label:"Image Generation - /images/generations"},{value:"video_generation",label:"Video Generation - /videos"},{value:"rerank",label:"Rerank - /rerank"},{value:"realtime",label:"Realtime - /realtime"},{value:"batch",label:"Batch - /batch"},{value:"ocr",label:"OCR - /ocr"}],{Title:lC,Link:lk}=k.default;var lS=e=>{let{form:l,handleOk:t,selectedProvider:r,setSelectedProvider:i,providerModels:o,setProviderModelsFn:d,getPlaceholder:c,uploadProps:m,showAdvancedSettings:u,setShowAdvancedSettings:h,teams:x,credentials:p}=e,[f,j]=(0,g.useState)("chat"),[v,_]=(0,g.useState)(!1),[y,b]=(0,g.useState)(!1),[N,Z]=(0,g.useState)(""),{accessToken:w,userRole:C,premiumUser:S,userId:P}=(0,n.Z)(),{data:A,isLoading:M,error:F}=eN(),{data:I,isLoading:T,error:R}=la(),{data:z,isLoading:O,error:V}=li(),q=async()=>{b(!0),Z("test-".concat(Date.now())),_(!0)},[B,G]=(0,g.useState)(!1),[U,H]=(0,g.useState)([]),[K,J]=(0,g.useState)(null);(0,g.useEffect)(()=>{(async()=>{H((await (0,a.modelAvailableCall)(w,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[w]);let W=(0,g.useMemo)(()=>A?[...A].sort((e,l)=>e.provider_display_name.localeCompare(l.provider_display_name)):[],[A]),Y=F?F instanceof Error?F.message:"Failed to load providers":null,X=eO.ZL.includes(C),Q=(0,eO.yV)(x,P);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lC,{level:2,children:"Add Model"}),(0,s.jsx)(ea.Z,{children:(0,s.jsx)(ev.Z,{form:l,onFinish:async e=>{console.log("\uD83D\uDD25 Form onFinish triggered with values:",e),await t().then(()=>{J(null)})},onFinishFailed:e=>{console.log("\uD83D\uDCA5 Form onFinishFailed triggered:",e)},labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:(0,s.jsxs)(s.Fragment,{children:[Q&&!X&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ev.Z.Item,{label:"Select Team",name:"team_id",rules:[{required:!0,message:"Please select a team to continue"}],tooltip:"Select the team for which you want to add this model",children:(0,s.jsx)(ld.Z,{teams:x,onChange:e=>{J(e)}})}),!K&&(0,s.jsx)(lo.Z,{message:"Team Selection Required",description:"As a team admin, you need to select your team first before adding models.",type:"info",showIcon:!0,className:"mb-4"})]}),(X||Q&&K)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ev.Z.Item,{rules:[{required:!0,message:"Required"}],label:"Provider:",name:"custom_llm_provider",tooltip:"E.g. OpenAI, Azure OpenAI, Anthropic, Bedrock, etc.",labelCol:{span:10},labelAlign:"left",children:(0,s.jsxs)(D.default,{virtual:!1,showSearch:!0,loading:M,placeholder:M?"Loading providers...":"Select a provider",optionFilterProp:"data-label",onChange:e=>{i(e),d(e),l.setFieldsValue({custom_llm_provider:e}),l.setFieldsValue({model:[],model_name:void 0})},children:[Y&&0===W.length&&(0,s.jsx)(D.default.Option,{value:"",children:Y},"__error"),W.map(e=>{let l=e.provider_display_name,t=e.provider;return ex.cd[l],(0,s.jsx)(D.default.Option,{value:t,"data-label":l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(L.K,{provider:t,className:"w-5 h-5"}),(0,s.jsx)("span",{children:l})]})},t)})]})}),(0,s.jsx)(lZ,{selectedProvider:r,providerModels:o,getPlaceholder:c}),(0,s.jsx)(lN,{}),(0,s.jsx)(ev.Z.Item,{label:"Mode",name:"mode",className:"mb-1",children:(0,s.jsx)(D.default,{style:{width:"100%"},value:f,onChange:e=>j(e),options:lw})}),(0,s.jsxs)(eC.Z,{children:[(0,s.jsx)(ek.Z,{span:10}),(0,s.jsx)(ek.Z,{span:10,children:(0,s.jsxs)($.Z,{className:"mb-5 mt-1",children:[(0,s.jsx)("strong",{children:"Optional"})," - LiteLLM endpoint to use when health checking this model"," ",(0,s.jsx)(lk,{href:"https://docs.litellm.ai/docs/proxy/health#health",target:"_blank",children:"Learn more"})]})})]}),(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(k.default.Text,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter new provider credentials below"})}),(0,s.jsx)(ev.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",initialValue:null,children:(0,s.jsx)(D.default,{showSearch:!0,placeholder:"Select or search for existing credentials",optionFilterProp:"children",filterOption:(e,l)=>{var t;return(null!==(t=null==l?void 0:l.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:[{value:null,label:"None"},...p.map(e=>({value:e.credential_name,label:e.credential_name}))],allowClear:!0})}),(0,s.jsx)(ev.Z.Item,{noStyle:!0,shouldUpdate:(e,l)=>e.litellm_credential_name!==l.litellm_credential_name||e.provider!==l.provider,children:e=>{let{getFieldValue:l}=e,t=l("litellm_credential_name");return(console.log("\uD83D\uDD11 Credential Name Changed:",t),t)?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"OR"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(0,s.jsx)(eL,{selectedProvider:r,uploadProps:m})]})}}),(0,s.jsxs)("div",{className:"flex items-center my-4",children:[(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"}),(0,s.jsx)("span",{className:"px-4 text-gray-500 text-sm",children:"Additional Model Info Settings"}),(0,s.jsx)("div",{className:"flex-grow border-t border-gray-200"})]}),(X||!Q)&&(0,s.jsx)(ev.Z.Item,{label:"Team-BYOK Model",tooltip:"Only use this model + credential combination for this team. Useful when teams want to onboard their own OpenAI keys.",className:"mb-4",children:(0,s.jsx)(E.Z,{title:S?"":"This is an enterprise-only feature. Upgrade to premium to restrict model+credential combinations to a specific team.",placement:"top",children:(0,s.jsx)(ln.Z,{checked:B,onChange:e=>{G(e),e||l.setFieldValue("team_id",void 0)},disabled:!S})})}),B&&(X||!Q)&&(0,s.jsx)(ev.Z.Item,{label:"Select Team",name:"team_id",className:"mb-4",tooltip:"Only keys for this team will be able to call this model.",rules:[{required:B&&!X,message:"Please select a team."}],children:(0,s.jsx)(ld.Z,{teams:x,disabled:!S})}),X&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(ev.Z.Item,{label:"Model Access Group",name:"model_access_group",className:"mb-4",tooltip:"Use model access groups to give users access to select models, and add new ones to the group over time.",children:(0,s.jsx)(D.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:U.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})}),(0,s.jsx)(lv,{showAdvancedSettings:u,setShowAdvancedSettings:h,teams:x,guardrailsList:I||[],tagsList:z||{}})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(E.Z,{title:"Get help on our github",children:(0,s.jsx)(k.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(es.ZP,{onClick:q,loading:y,children:"Test Connect"}),(0,s.jsx)(es.ZP,{htmlType:"submit",children:"Add Model"})]})]})]})})}),(0,s.jsx)(ei.Z,{title:"Connection Test Results",open:v,onCancel:()=>{_(!1),b(!1)},footer:[(0,s.jsx)(es.ZP,{onClick:()=>{_(!1),b(!1)},children:"Close"},"close")],width:700,children:v&&(0,s.jsx)(e0,{formValues:l.getFieldsValue(),accessToken:w,testMode:f,modelName:l.getFieldValue("model_name")||l.getFieldValue("model"),onClose:()=>{_(!1),b(!1)},onTestComplete:()=>b(!1)},N)})]})},lP=e=>{let{form:l,handleOk:t,selectedProvider:a,setSelectedProvider:r,providerModels:i,setProviderModelsFn:n,getPlaceholder:o,uploadProps:d,showAdvancedSettings:c,setShowAdvancedSettings:m,teams:u,credentials:h,accessToken:x,userRole:p}=e,[g]=ev.Z.useForm();return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(eJ.v0,{className:"w-full",children:[(0,s.jsxs)(eJ.td,{className:"mb-4",children:[(0,s.jsx)(eJ.OK,{children:"Add Model"}),(0,s.jsx)(eJ.OK,{children:"Add Auto Router"})]}),(0,s.jsxs)(eJ.nP,{children:[(0,s.jsx)(eJ.x4,{children:(0,s.jsx)(lS,{form:l,handleOk:t,selectedProvider:a,setSelectedProvider:r,providerModels:i,setProviderModelsFn:n,getPlaceholder:o,uploadProps:d,showAdvancedSettings:c,setShowAdvancedSettings:m,teams:u,credentials:h})}),(0,s.jsx)(eJ.x4,{children:(0,s.jsx)(lt,{form:g,handleOk:()=>{g.validateFields().then(e=>{e1(e,x,g,t)}).catch(e=>{console.error("Validation failed:",e)})},accessToken:x,userRole:p})})]})]})})},lA=t(8048),lE=t(61994),lM=t(92280),lL=t(15731),lF=t(91126);let lI=(e,l,t,a,r,i,n,o,d,c,m,u)=>[{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lE.Z,{checked:t,indeterminate:l.length>0&&!t,onChange:e=>r(e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)("span",{children:"Model ID"})]}),accessorKey:"model_info.id",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:t}=e,r=t.original,i=r.model_name,n=l.includes(i);return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lE.Z,{checked:n,onChange:e=>a(i,e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)(E.Z,{title:r.model_info.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>m&&m(r.model_info.id),children:r.model_info.id})})]})}},{header:"Model Name",accessorKey:"model_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,t=l.original,a=o(t)||t.model_name;return(0,s.jsx)("div",{className:"font-medium text-sm",children:(0,s.jsx)(E.Z,{title:a,children:(0,s.jsx)("div",{className:"truncate max-w-[200px]",children:a})})})}},{header:"Team Alias",accessorKey:"model_info.team_id",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{var l;let{row:t}=e,a=null===(l=t.original.model_info)||void 0===l?void 0:l.team_id;if(!a)return(0,s.jsx)("span",{className:"text-gray-400 text-sm",children:"-"});let r=null==u?void 0:u.find(e=>e.team_id===a),i=(null==r?void 0:r.team_alias)||a;return(0,s.jsx)("div",{className:"text-sm",children:(0,s.jsx)(E.Z,{title:i,children:(0,s.jsx)("div",{className:"truncate max-w-[150px]",children:i})})})}},{header:"Health Status",accessorKey:"health_status",enableSorting:!0,sortingFn:(e,l,t)=>{var s,a;let r=e.getValue("health_status")||"unknown",i=l.getValue("health_status")||"unknown",n={healthy:0,checking:1,unknown:2,unhealthy:3};return(null!==(s=n[r])&&void 0!==s?s:4)-(null!==(a=n[i])&&void 0!==a?a:4)},cell:l=>{var t;let{row:a}=l,r=a.original,i={status:r.health_status,loading:r.health_loading,error:r.health_error};if(i.loading)return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-2 h-2 bg-indigo-500 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}),(0,s.jsx)(lM.x,{className:"text-gray-600 text-sm",children:"Checking..."})]});let o=r.model_name,d="healthy"===i.status&&(null===(t=e[o])||void 0===t?void 0:t.successResponse);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[n(i.status),d&&c&&(0,s.jsx)(E.Z,{title:"View response details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>{var l;return c(o,null===(l=e[o])||void 0===l?void 0:l.successResponse)},className:"p-1 text-green-600 hover:text-green-800 hover:bg-green-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Error Details",accessorKey:"health_error",enableSorting:!1,cell:l=>{let{row:t}=l,a=t.original.model_name,r=e[a];if(!(null==r?void 0:r.error))return(0,s.jsx)(lM.x,{className:"text-gray-400 text-sm",children:"No errors"});let i=r.error,n=r.fullError||r.error;return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"max-w-[200px]",children:(0,s.jsx)(E.Z,{title:i,placement:"top",children:(0,s.jsx)(lM.x,{className:"text-red-600 text-sm truncate",children:i})})}),d&&n!==i&&(0,s.jsx)(E.Z,{title:"View full error details",placement:"top",children:(0,s.jsx)("button",{onClick:()=>d(a,i,n),className:"p-1 text-red-600 hover:text-red-800 hover:bg-red-50 rounded cursor-pointer transition-colors",children:(0,s.jsx)(lL.Z,{className:"h-4 w-4"})})})]})}},{header:"Last Check",accessorKey:"last_check",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_check")||"Never checked",a=l.getValue("last_check")||"Never checked";if("Never checked"===s&&"Never checked"===a)return 0;if("Never checked"===s)return 1;if("Never checked"===a)return -1;if("Check in progress..."===s&&"Check in progress..."===a)return 0;if("Check in progress..."===s)return -1;if("Check in progress..."===a)return 1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(lM.x,{className:"text-gray-600 text-sm",children:t.health_loading?"Check in progress...":t.last_check})}},{header:"Last Success",accessorKey:"last_success",enableSorting:!0,sortingFn:(e,l,t)=>{let s=e.getValue("last_success")||"Never succeeded",a=l.getValue("last_success")||"Never succeeded";if("Never succeeded"===s&&"Never succeeded"===a)return 0;if("Never succeeded"===s)return 1;if("Never succeeded"===a)return -1;if("None"===s&&"None"===a)return 0;if("None"===s)return 1;if("None"===a)return -1;let r=new Date(s),i=new Date(a);return isNaN(r.getTime())&&isNaN(i.getTime())?0:isNaN(r.getTime())?1:isNaN(i.getTime())?-1:i.getTime()-r.getTime()},cell:l=>{let{row:t}=l,a=e[t.original.model_name],r=(null==a?void 0:a.lastSuccess)||"None";return(0,s.jsx)(lM.x,{className:"text-gray-600 text-sm",children:r})}},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e,t=l.original,a=t.model_name,r=t.health_status&&"none"!==t.health_status,n=t.health_loading?"Checking...":r?"Re-run Health Check":"Run Health Check";return(0,s.jsx)(E.Z,{title:n,placement:"top",children:(0,s.jsx)("button",{className:"p-2 rounded-md transition-colors ".concat(t.health_loading?"text-gray-400 cursor-not-allowed bg-gray-100":"text-indigo-600 hover:text-indigo-700 hover:bg-indigo-50"),onClick:()=>{t.health_loading||i(a)},disabled:t.health_loading,children:t.health_loading?(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.2s"}}),(0,s.jsx)("div",{className:"w-1 h-1 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"0.4s"}})]}):r?(0,s.jsx)(eV.Z,{className:"h-4 w-4"}):(0,s.jsx)(lF.Z,{className:"h-4 w-4"})})})},enableSorting:!1}],lT=[{pattern:/Missing .* API Key/i,replacement:"Missing API Key"},{pattern:/Connection timeout/i,replacement:"Connection timeout"},{pattern:/Network.*not.*ok/i,replacement:"Network connection failed"},{pattern:/403.*Forbidden/i,replacement:"Access forbidden - check API key permissions"},{pattern:/401.*Unauthorized/i,replacement:"Unauthorized - invalid API key"},{pattern:/429.*rate limit/i,replacement:"Rate limit exceeded"},{pattern:/500.*Internal Server Error/i,replacement:"Provider internal server error"},{pattern:/litellm\.AuthenticationError/i,replacement:"Authentication failed"},{pattern:/litellm\.RateLimitError/i,replacement:"Rate limit exceeded"},{pattern:/litellm\.APIError/i,replacement:"API error"}];var lR=e=>{let{accessToken:l,modelData:t,all_models_on_proxy:r,getDisplayModelName:i,setSelectedModelId:n,teams:o}=e,[d,c]=(0,g.useState)({}),[m,u]=(0,g.useState)([]),[h,x]=(0,g.useState)(!1),[p,f]=(0,g.useState)(!1),[j,v]=(0,g.useState)(null),[_,y]=(0,g.useState)(!1),[b,N]=(0,g.useState)(null);(0,g.useRef)(null),(0,g.useEffect)(()=>{l&&(null==t?void 0:t.data)&&(async()=>{let e={};t.data.forEach(l=>{e[l.model_name]={status:"none",lastCheck:"None",lastSuccess:"None",loading:!1,error:void 0,fullError:void 0,successResponse:void 0}});try{let s=await (0,a.latestHealthChecksCall)(l);s&&s.latest_health_checks&&"object"==typeof s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l;if(!a)return;let r=null,i=t.data.find(e=>e.model_name===s);if(i)r=i.model_name;else{let e=t.data.find(e=>e.model_info&&e.model_info.id===s);if(e)r=e.model_name;else if(a.model_name){let e=t.data.find(e=>e.model_name===a.model_name);e&&(r=e.model_name)}}if(r){let l=a.error_message||void 0;e[r]={status:a.status||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():"None",loading:!1,error:l?C(l):void 0,fullError:l,successResponse:"healthy"===a.status?a:void 0}}})}catch(e){console.warn("Failed to load health check history (using default states):",e)}c(e)})()},[l,t]);let C=e=>{var l;if(!e)return"Health check failed";let t="string"==typeof e?e:JSON.stringify(e),s=t.match(/(\w+Error):\s*(\d{3})/i);if(s)return"".concat(s[1],": ").concat(s[2]);let a=t.match(/(AuthenticationError|RateLimitError|BadRequestError|InternalServerError|TimeoutError|NotFoundError|ForbiddenError|ServiceUnavailableError|BadGatewayError|ContentPolicyViolationError|\w+Error)/i),r=t.match(/\b(400|401|403|404|408|429|500|502|503|504)\b/);if(a&&r)return"".concat(a[1],": ").concat(r[1]);if(r){let e=r[1];return"".concat({400:"BadRequestError",401:"AuthenticationError",403:"ForbiddenError",404:"NotFoundError",408:"TimeoutError",429:"RateLimitError",500:"InternalServerError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError"}[e],": ").concat(e)}if(a){let e=a[1],l={AuthenticationError:"401",RateLimitError:"429",BadRequestError:"400",InternalServerError:"500",TimeoutError:"408",NotFoundError:"404",ForbiddenError:"403",ServiceUnavailableError:"503",BadGatewayError:"502",GatewayTimeoutError:"504",ContentPolicyViolationError:"400"}[e];return l?"".concat(e,": ").concat(l):e}for(let{pattern:e,replacement:l}of lT)if(e.test(t))return l;if(/missing.*api.*key|invalid.*key|unauthorized/i.test(t))return"AuthenticationError: 401";if(/rate.*limit|too.*many.*requests/i.test(t))return"RateLimitError: 429";if(/timeout|timed.*out/i.test(t))return"TimeoutError: 408";if(/not.*found/i.test(t))return"NotFoundError: 404";if(/forbidden|access.*denied/i.test(t))return"ForbiddenError: 403";if(/internal.*server.*error/i.test(t))return"InternalServerError: 500";let i=t.replace(/[\n\r]+/g," ").replace(/\s+/g," ").trim(),n=null===(l=i.split(/[.!?]/)[0])||void 0===l?void 0:l.trim();return n&&n.length>0?n.length>100?n.substring(0,97)+"...":n:i.length>100?i.substring(0,97)+"...":i},k=async e=>{if(l){c(l=>({...l,[e]:{...l[e],loading:!0,status:"checking"}}));try{var s,r;let i=await (0,a.individualModelHealthCheckCall)(l,e),n=new Date().toLocaleString();if(i.unhealthy_count>0&&i.unhealthy_endpoints&&i.unhealthy_endpoints.length>0){let l=(null===(s=i.unhealthy_endpoints[0])||void 0===s?void 0:s.error)||"Health check failed",t=C(l);c(s=>{var a;return{...s,[e]:{status:"unhealthy",lastCheck:n,lastSuccess:(null===(a=s[e])||void 0===a?void 0:a.lastSuccess)||"None",loading:!1,error:t,fullError:l}}})}else c(l=>({...l,[e]:{status:"healthy",lastCheck:n,lastSuccess:n,loading:!1,successResponse:i}}));try{let s=await (0,a.latestHealthChecksCall)(l),i=t.data.find(l=>l.model_name===e);if(i){let l=i.model_info.id,t=null===(r=s.latest_health_checks)||void 0===r?void 0:r[l];if(t){let l=t.error_message||void 0;c(s=>{var a,r,i,n,o,d,c;return{...s,[e]:{status:t.status||(null===(a=s[e])||void 0===a?void 0:a.status)||"unknown",lastCheck:t.checked_at?new Date(t.checked_at).toLocaleString():(null===(r=s[e])||void 0===r?void 0:r.lastCheck)||"None",lastSuccess:"healthy"===t.status?t.checked_at?new Date(t.checked_at).toLocaleString():(null===(i=s[e])||void 0===i?void 0:i.lastSuccess)||"None":(null===(n=s[e])||void 0===n?void 0:n.lastSuccess)||"None",loading:!1,error:l?C(l):null===(o=s[e])||void 0===o?void 0:o.error,fullError:l||(null===(d=s[e])||void 0===d?void 0:d.fullError),successResponse:"healthy"===t.status?t:null===(c=s[e])||void 0===c?void 0:c.successResponse}}})}}}catch(e){console.debug("Could not fetch updated status from database (non-critical):",e)}}catch(a){let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=C(t);c(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}}},S=async()=>{let e=m.length>0?m:r,s=e.reduce((e,l)=>(e[l]={...d[l],loading:!0,status:"checking"},e),{});c(e=>({...e,...s}));let i={},n=e.map(async e=>{if(l)try{let s=await (0,a.individualModelHealthCheckCall)(l,e);i[e]=s;let r=new Date().toLocaleString();if(s.unhealthy_count>0&&s.unhealthy_endpoints&&s.unhealthy_endpoints.length>0){var t;let l=(null===(t=s.unhealthy_endpoints[0])||void 0===t?void 0:t.error)||"Health check failed",a=C(l);c(t=>{var s;return{...t,[e]:{status:"unhealthy",lastCheck:r,lastSuccess:(null===(s=t[e])||void 0===s?void 0:s.lastSuccess)||"None",loading:!1,error:a,fullError:l}}})}else c(l=>({...l,[e]:{status:"healthy",lastCheck:r,lastSuccess:r,loading:!1,successResponse:s}}))}catch(a){console.error("Health check failed for ".concat(e,":"),a);let l=new Date().toLocaleString(),t=a instanceof Error?a.message:String(a),s=C(t);c(a=>{var r;return{...a,[e]:{status:"unhealthy",lastCheck:l,lastSuccess:(null===(r=a[e])||void 0===r?void 0:r.lastSuccess)||"None",loading:!1,error:s,fullError:t}}})}});await Promise.allSettled(n);try{if(!l)return;let s=await (0,a.latestHealthChecksCall)(l);s.latest_health_checks&&Object.entries(s.latest_health_checks).forEach(l=>{let[s,a]=l,r=t.data.find(e=>e.model_info.id===s);if(r&&e.includes(r.model_name)&&a){let e=r.model_name,l=a.error_message||void 0;c(t=>{let s=t[e];return{...t,[e]:{status:a.status||(null==s?void 0:s.status)||"unknown",lastCheck:a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastCheck)||"None",lastSuccess:"healthy"===a.status&&a.checked_at?new Date(a.checked_at).toLocaleString():(null==s?void 0:s.lastSuccess)||"None",loading:!1,error:l?C(l):null==s?void 0:s.error,fullError:l||(null==s?void 0:s.fullError),successResponse:"healthy"===a.status?a:null==s?void 0:s.successResponse}}})}})}catch(e){console.warn("Failed to fetch updated health statuses from database (non-critical):",e)}},P=e=>{x(e),e?u(r):u([])},A=()=>{f(!1),v(null)},E=()=>{y(!1),N(null)};return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(X.Z,{children:"Model Health Status"}),(0,s.jsx)($.Z,{className:"text-gray-600 mt-1",children:"Run health checks on individual models to verify they are working correctly"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[m.length>0&&(0,s.jsx)(w.Z,{size:"sm",variant:"light",onClick:()=>P(!1),className:"px-3 py-1 text-sm",children:"Clear Selection"}),(0,s.jsx)(w.Z,{size:"sm",variant:"secondary",onClick:S,disabled:Object.values(d).some(e=>e.loading),className:"px-3 py-1 text-sm",children:m.length>0&&m.length{l?u(l=>[...l,e]):(u(l=>l.filter(l=>l!==e)),x(!1))},P,k,e=>{switch(e){case"healthy":return(0,s.jsx)(Z.Z,{color:"emerald",children:"healthy"});case"unhealthy":return(0,s.jsx)(Z.Z,{color:"red",children:"unhealthy"});case"checking":return(0,s.jsx)(Z.Z,{color:"blue",children:"checking"});case"none":return(0,s.jsx)(Z.Z,{color:"gray",children:"none"});default:return(0,s.jsx)(Z.Z,{color:"gray",children:"unknown"})}},i,(e,l,t)=>{v({modelName:e,cleanedError:l,fullError:t}),f(!0)},(e,l)=>{N({modelName:e,response:l}),y(!0)},n,o),data:t.data.map(e=>{let l=d[e.model_name]||{status:"none",lastCheck:"None",loading:!1};return{model_name:e.model_name,model_info:e.model_info,provider:e.provider,litellm_model_name:e.litellm_model_name,health_status:l.status,last_check:l.lastCheck,last_success:l.lastSuccess||"None",health_loading:l.loading,health_error:l.error,health_full_error:l.fullError}}),isLoading:!1})}),(0,s.jsx)(ei.Z,{title:j?"Health Check Error - ".concat(j.modelName):"Error Details",open:p,onCancel:A,footer:[(0,s.jsx)(es.ZP,{onClick:A,children:"Close"},"close")],width:800,children:j&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Error:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-red-50 border border-red-200 rounded-md",children:(0,s.jsx)($.Z,{className:"text-red-800",children:j.cleanedError})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Full Error Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:j.fullError})})]})]})}),(0,s.jsx)(ei.Z,{title:b?"Health Check Response - ".concat(b.modelName):"Response Details",open:_,onCancel:E,footer:[(0,s.jsx)(es.ZP,{onClick:E,children:"Close"},"close")],width:800,children:b&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Status:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-green-50 border border-green-200 rounded-md",children:(0,s.jsx)($.Z,{className:"text-green-800",children:"Health check passed successfully"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Response Details:"}),(0,s.jsx)("div",{className:"mt-2 p-3 bg-gray-50 border border-gray-200 rounded-md max-h-96 overflow-y-auto",children:(0,s.jsx)("pre",{className:"text-sm text-gray-800 whitespace-pre-wrap",children:JSON.stringify(b.response,null,2)})})]})]})})]})},lz=t(86462),lO=t(47686),lV=t(77355),lq=t(93416),lD=t(95704),lB=e=>{let{accessToken:l,initialModelGroupAlias:t={},onAliasUpdate:r}=e,[i,n]=(0,g.useState)([]),[o,d]=(0,g.useState)({aliasName:"",targetModelGroup:""}),[c,m]=(0,g.useState)(null),[u,h]=(0,g.useState)(!0);(0,g.useEffect)(()=>{n(Object.entries(t).map((e,l)=>{var t;let[s,a]=e;return{id:"".concat(l,"-").concat(s),aliasName:s,targetModelGroup:"string"==typeof a?a:null!==(t=null==a?void 0:a.model)&&void 0!==t?t:""}}))},[t]);let x=async e=>{if(!l)return console.error("Access token is missing"),!1;try{let t={};return e.forEach(e=>{t[e.aliasName]=e.targetModelGroup}),console.log("Saving model group alias:",t),await (0,a.setCallbacksCall)(l,{router_settings:{model_group_alias:t}}),r&&r(t),!0}catch(e){return console.error("Failed to save model group alias settings:",e),ec.ZP.fromBackend("Failed to save model group alias settings"),!1}},p=async()=>{if(!o.aliasName||!o.targetModelGroup){ec.ZP.fromBackend("Please provide both alias name and target model group");return}if(i.some(e=>e.aliasName===o.aliasName)){ec.ZP.fromBackend("An alias with this name already exists");return}let e=[...i,{id:"".concat(Date.now(),"-").concat(o.aliasName),aliasName:o.aliasName,targetModelGroup:o.targetModelGroup}];await x(e)&&(n(e),d({aliasName:"",targetModelGroup:""}),ec.ZP.success("Alias added successfully"))},f=e=>{m({...e})},j=async()=>{if(!c)return;if(!c.aliasName||!c.targetModelGroup){ec.ZP.fromBackend("Please provide both alias name and target model group");return}if(i.some(e=>e.id!==c.id&&e.aliasName===c.aliasName)){ec.ZP.fromBackend("An alias with this name already exists");return}let e=i.map(e=>e.id===c.id?c:e);await x(e)&&(n(e),m(null),ec.ZP.success("Alias updated successfully"))},v=()=>{m(null)},_=async e=>{let l=i.filter(l=>l.id!==e);await x(l)&&(n(l),ec.ZP.success("Alias deleted successfully"))},y=i.reduce((e,l)=>(e[l.aliasName]=l.targetModelGroup,e),{});return(0,s.jsxs)(lD.Zb,{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>h(!u),children:[(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)(lD.Dx,{className:"mb-0",children:"Model Group Alias Settings"}),(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Create aliases for your model groups to simplify API calls. For example, you can create an alias 'gpt-4o' that points to 'gpt-4o-mini-openai' model group."})]}),(0,s.jsx)("div",{className:"flex items-center",children:u?(0,s.jsx)(lz.Z,{className:"w-5 h-5 text-gray-500"}):(0,s.jsx)(lO.Z,{className:"w-5 h-5 text-gray-500"})})]}),u&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(lD.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,s.jsx)("input",{type:"text",value:o.aliasName,onChange:e=>d({...o,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model Group"}),(0,s.jsx)("input",{type:"text",value:o.targetModelGroup,onChange:e=>d({...o,targetModelGroup:e.target.value}),placeholder:"e.g., gpt-4o-mini-openai",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsx)("div",{className:"flex items-end",children:(0,s.jsxs)("button",{onClick:p,disabled:!o.aliasName||!o.targetModelGroup,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(o.aliasName&&o.targetModelGroup?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,s.jsx)(lV.Z,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,s.jsx)(lD.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,s.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(lD.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(lD.ss,{children:(0,s.jsxs)(lD.SC,{children:[(0,s.jsx)(lD.xs,{className:"py-1 h-8",children:"Alias Name"}),(0,s.jsx)(lD.xs,{className:"py-1 h-8",children:"Target Model Group"}),(0,s.jsx)(lD.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,s.jsxs)(lD.RM,{children:[i.map(e=>(0,s.jsx)(lD.SC,{className:"h-8",children:c&&c.id===e.id?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lD.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:c.aliasName,onChange:e=>m({...c,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lD.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:c.targetModelGroup,onChange:e=>m({...c,targetModelGroup:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(lD.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:j,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,s.jsx)("button",{onClick:v,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lD.pj,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,s.jsx)(lD.pj,{className:"py-0.5 text-sm text-gray-500",children:e.targetModelGroup}),(0,s.jsx)(lD.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:()=>f(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,s.jsx)(lq.Z,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>_(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,s.jsx)(N.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===i.length&&(0,s.jsx)(lD.SC,{children:(0,s.jsx)(lD.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),(0,s.jsxs)(lD.Zb,{children:[(0,s.jsx)(lD.Dx,{className:"mb-4",children:"Configuration Example"}),(0,s.jsx)(lD.xv,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config.yaml:"}),(0,s.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,s.jsxs)("div",{className:"text-gray-700",children:["router_settings:",(0,s.jsx)("br",{}),"\xa0\xa0model_group_alias:",0===Object.keys(y).length?(0,s.jsxs)("span",{className:"text-gray-500",children:[(0,s.jsx)("br",{}),"\xa0\xa0\xa0\xa0# No aliases configured yet"]}):Object.entries(y).map(e=>{let[l,t]=e;return(0,s.jsxs)("span",{children:[(0,s.jsx)("br",{}),'\xa0\xa0\xa0\xa0"',l,'": "',t,'"']},l)})]})})]})]})]})},lG=t(10900),lU=t(45589),lH=t(12514),lK=t(49566),lJ=t(30401),lW=t(78867),lY=t(59872),l$=e=>{let{isVisible:l,onCancel:t,onSuccess:r,modelData:i,accessToken:n,userRole:o}=e,[d]=ev.Z.useForm(),[c,m]=(0,g.useState)(!1),[u,h]=(0,g.useState)([]),[x,p]=(0,g.useState)([]),[f,j]=(0,g.useState)(!1),[v,_]=(0,g.useState)(!1),[y,b]=(0,g.useState)(null);(0,g.useEffect)(()=>{l&&i&&N()},[l,i]),(0,g.useEffect)(()=>{let e=async()=>{if(n)try{let e=await (0,a.modelAvailableCall)(n,"","",!1,null,!0,!0);h(e.data.map(e=>e.id))}catch(e){console.error("Error fetching model access groups:",e)}},t=async()=>{if(n)try{let e=await (0,e2.p)(n);p(e)}catch(e){console.error("Error fetching model info:",e)}};l&&(e(),t())},[l,n]);let N=()=>{try{var e,l,t,s,a,r;let n=null;(null===(e=i.litellm_params)||void 0===e?void 0:e.auto_router_config)&&(n="string"==typeof i.litellm_params.auto_router_config?JSON.parse(i.litellm_params.auto_router_config):i.litellm_params.auto_router_config),b(n),d.setFieldsValue({auto_router_name:i.model_name,auto_router_default_model:(null===(l=i.litellm_params)||void 0===l?void 0:l.auto_router_default_model)||"",auto_router_embedding_model:(null===(t=i.litellm_params)||void 0===t?void 0:t.auto_router_embedding_model)||"",model_access_group:(null===(s=i.model_info)||void 0===s?void 0:s.access_groups)||[]});let o=new Set(x.map(e=>e.model_group));j(!o.has(null===(a=i.litellm_params)||void 0===a?void 0:a.auto_router_default_model)),_(!o.has(null===(r=i.litellm_params)||void 0===r?void 0:r.auto_router_embedding_model))}catch(e){console.error("Error parsing auto router config:",e),ec.ZP.fromBackend("Error loading auto router configuration")}},Z=async()=>{try{m(!0);let e=await d.validateFields(),l={...i.litellm_params,auto_router_config:JSON.stringify(y),auto_router_default_model:e.auto_router_default_model,auto_router_embedding_model:e.auto_router_embedding_model||void 0},s={...i.model_info,access_groups:e.model_access_group||[]},o={model_name:e.auto_router_name,litellm_params:l,model_info:s};await (0,a.modelPatchUpdateCall)(n,o,i.model_info.id);let c={...i,model_name:e.auto_router_name,litellm_params:l,model_info:s};ec.ZP.success("Auto router configuration updated successfully"),r(c),t()}catch(e){console.error("Error updating auto router:",e),ec.ZP.fromBackend("Failed to update auto router configuration")}finally{m(!1)}},w=x.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsx)(ei.Z,{title:"Edit Auto Router Configuration",open:l,onCancel:t,footer:[(0,s.jsx)(es.ZP,{onClick:t,children:"Cancel"},"cancel"),(0,s.jsx)(es.ZP,{loading:c,onClick:Z,children:"Save Changes"},"submit")],width:1e3,destroyOnHidden:!0,children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(ew.x,{className:"text-gray-600",children:"Edit the auto router configuration including routing logic, default models, and access settings."}),(0,s.jsxs)(ev.Z,{form:d,layout:"vertical",className:"space-y-4",children:[(0,s.jsx)(ev.Z.Item,{label:"Auto Router Name",name:"auto_router_name",rules:[{required:!0,message:"Auto router name is required"}],children:(0,s.jsx)(ew.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)(e9,{modelInfo:x,value:y,onChange:e=>{b(e)}})}),(0,s.jsx)(ev.Z.Item,{label:"Default Model",name:"auto_router_default_model",rules:[{required:!0,message:"Default model is required"}],children:(0,s.jsx)(D.default,{placeholder:"Select a default model",onChange:e=>{j("custom"===e)},options:[...w,{value:"custom",label:"Enter custom model name"}],showSearch:!0})}),(0,s.jsx)(ev.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",children:(0,s.jsx)(D.default,{placeholder:"Select an embedding model (optional)",onChange:e=>{_("custom"===e)},options:[...w,{value:"custom",label:"Enter custom model name"}],showSearch:!0,allowClear:!0})}),"Admin"===o&&(0,s.jsx)(ev.Z.Item,{label:"Model Access Groups",name:"model_access_group",tooltip:"Control who can access this auto router",children:(0,s.jsx)(D.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:u.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})]})]})})};let{Title:lX,Link:lQ}=k.default;var l0=e=>{let{isVisible:l,onCancel:t,onAddCredential:a,existingCredential:r,setIsCredentialModalOpen:i}=e,[n]=ev.Z.useForm();return console.log("existingCredential in add credentials tab: ".concat(JSON.stringify(r))),(0,s.jsx)(ei.Z,{title:"Reuse Credentials",open:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,children:(0,s.jsxs)(ev.Z,{form:n,onFinish:e=>{a(e),n.resetFields(),i(!1)},layout:"vertical",children:[(0,s.jsx)(ev.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],initialValue:null==r?void 0:r.credential_name,children:(0,s.jsx)(ey.o,{placeholder:"Enter a friendly name for these credentials"})}),Object.entries((null==r?void 0:r.credential_values)||{}).map(e=>{let[l,t]=e;return(0,s.jsx)(ev.Z.Item,{label:l,name:l,initialValue:t,children:(0,s.jsx)(ey.o,{placeholder:"Enter ".concat(l),disabled:!0})},l)}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(E.Z,{title:"Get help on our github",children:(0,s.jsx)(lQ,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(es.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(es.ZP,{htmlType:"submit",children:"Reuse Credentials"})]})]})]})})};function l1(e){var l,t,r,i,n,o,d,u,h,x,p,f,j,v,_,y,Z,C,k,S,P,A,M,L,F,I,T,R,q,B,G,U,K;let{modelId:J,onClose:W,accessToken:Y,userID:Q,userRole:ee,onModelUpdate:el,modelAccessGroups:et}=e,[ea]=ev.Z.useForm(),[er,en]=(0,g.useState)(null),[eo,ed]=(0,g.useState)(!1),[em,eu]=(0,g.useState)(!1),[eh,ep]=(0,g.useState)(!1),[eg,ef]=(0,g.useState)(!1),[ej,ey]=(0,g.useState)(!1),[eb,eN]=(0,g.useState)(!1),[eZ,ew]=(0,g.useState)(null),[eC,ek]=(0,g.useState)(!1),[eS,eA]=(0,g.useState)({}),[eE,eM]=(0,g.useState)(!1),[eL,eF]=(0,g.useState)([]),[eI,eT]=(0,g.useState)({}),{data:eR,isLoading:ez}=(0,m.XP)(1,50,void 0,J),{data:eO}=(0,c.i)(),{data:eq}=(0,m.VI)(),eD=e=>null!=eO&&"object"==typeof eO&&e in eO?eO[e].litellm_provider:"openai",eK=(0,g.useMemo)(()=>(null==eR?void 0:eR.data)&&0!==eR.data.length&&H(eR,eD).data[0]||null,[eR,eO]),eJ=("Admin"===ee||(null==eK?void 0:null===(l=eK.model_info)||void 0===l?void 0:l.created_by)===Q)&&(null==eK?void 0:null===(t=eK.model_info)||void 0===t?void 0:t.db_model),eW="Admin"===ee,eY=(null==eK?void 0:null===(r=eK.litellm_params)||void 0===r?void 0:r.auto_router_config)!=null,e$=(null==eK?void 0:null===(i=eK.litellm_params)||void 0===i?void 0:i.litellm_credential_name)!=null&&(null==eK?void 0:null===(n=eK.litellm_params)||void 0===n?void 0:n.litellm_credential_name)!=void 0;(0,g.useEffect)(()=>{if(eK&&!er){var e,l,t,s,a,r,i;let n=eK;n.litellm_model_name||(n={...n,litellm_model_name:null!==(i=null!==(r=null!==(a=null==n?void 0:null===(l=n.litellm_params)||void 0===l?void 0:l.litellm_model_name)&&void 0!==a?a:null==n?void 0:null===(t=n.litellm_params)||void 0===t?void 0:t.model)&&void 0!==r?r:null==n?void 0:null===(s=n.model_info)||void 0===s?void 0:s.key)&&void 0!==i?i:null}),en(n),(null==n?void 0:null===(e=n.litellm_params)||void 0===e?void 0:e.cache_control_injection_points)&&ek(!0)}},[eK,er]),(0,g.useEffect)(()=>{let e=async()=>{var e,l,t,s,r,i,n;if(!Y||eK)return;let o=(await (0,a.modelInfoV1Call)(Y,J)).data[0];o&&!o.litellm_model_name&&(o={...o,litellm_model_name:null!==(n=null!==(i=null!==(r=null==o?void 0:null===(l=o.litellm_params)||void 0===l?void 0:l.litellm_model_name)&&void 0!==r?r:null==o?void 0:null===(t=o.litellm_params)||void 0===t?void 0:t.model)&&void 0!==i?i:null==o?void 0:null===(s=o.model_info)||void 0===s?void 0:s.key)&&void 0!==n?n:null}),en(o),(null==o?void 0:null===(e=o.litellm_params)||void 0===e?void 0:e.cache_control_injection_points)&&ek(!0)},l=async()=>{if(Y)try{let e=(await (0,a.getGuardrailsList)(Y)).guardrails.map(e=>e.guardrail_name);eF(e)}catch(e){console.error("Failed to fetch guardrails:",e)}},t=async()=>{if(Y)try{let e=await (0,a.tagListCall)(Y);eT(e)}catch(e){console.error("Failed to fetch tags:",e)}};(async()=>{if(!Y||e$)return;let e=await (0,a.credentialGetCall)(Y,null,J);ew({credential_name:e.credential_name,credential_values:e.credential_values,credential_info:e.credential_info})})(),e(),l(),t()},[Y,J]);let eX=async e=>{var l;if(!Y)return;let t={credential_name:e.credential_name,model_id:J,credential_info:{custom_llm_provider:null===(l=er.litellm_params)||void 0===l?void 0:l.custom_llm_provider}};ec.ZP.info("Storing credential.."),await (0,a.credentialCreateCall)(Y,t),ec.ZP.success("Credential stored successfully")},eQ=async e=>{try{var l;let t;if(!Y)return;ey(!0);let s={};try{s=e.litellm_extra_params?JSON.parse(e.litellm_extra_params):{}}catch(e){ec.ZP.fromBackend("Invalid JSON in LiteLLM Params"),ey(!1);return}let r={...e.litellm_params,...s,model:e.litellm_model_name,api_base:e.api_base,custom_llm_provider:e.custom_llm_provider,organization:e.organization,tpm:e.tpm,rpm:e.rpm,max_retries:e.max_retries,timeout:e.timeout,stream_timeout:e.stream_timeout,input_cost_per_token:e.input_cost/1e6,output_cost_per_token:e.output_cost/1e6,tags:e.tags};e.guardrails&&(r.guardrails=e.guardrails),e.cache_control&&(null===(l=e.cache_control_injection_points)||void 0===l?void 0:l.length)>0?r.cache_control_injection_points=e.cache_control_injection_points:delete r.cache_control_injection_points;try{t=e.model_info?JSON.parse(e.model_info):eK.model_info,e.model_access_group&&(t={...t,access_groups:e.model_access_group}),void 0!==e.health_check_model&&(t={...t,health_check_model:e.health_check_model})}catch(e){ec.ZP.fromBackend("Invalid JSON in Model Info");return}let i={model_name:e.model_name,litellm_params:r,model_info:t};await (0,a.modelPatchUpdateCall)(Y,i,J);let n={...er,model_name:e.model_name,litellm_model_name:e.litellm_model_name,litellm_params:r,model_info:t};en(n),el&&el(n),ec.ZP.success("Model settings updated successfully"),ef(!1),eN(!1)}catch(e){console.error("Error updating model:",e),ec.ZP.fromBackend("Failed to update model settings")}finally{ey(!1)}};if(ez)return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(w.Z,{icon:lG.Z,variant:"light",onClick:W,className:"mb-4",children:"Back to Models"}),(0,s.jsx)($.Z,{children:"Loading..."})]});if(!eK)return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(w.Z,{icon:lG.Z,variant:"light",onClick:W,className:"mb-4",children:"Back to Models"}),(0,s.jsx)($.Z,{children:"Model not found"})]});let e0=async()=>{if(Y)try{var e,l,t;ec.ZP.info("Testing connection...");let s=await (0,a.testConnectionRequest)(Y,{custom_llm_provider:er.litellm_params.custom_llm_provider,litellm_credential_name:er.litellm_params.litellm_credential_name,model:er.litellm_model_name},{mode:null===(e=er.model_info)||void 0===e?void 0:e.mode},null===(l=er.model_info)||void 0===l?void 0:l.mode);if("success"===s.status)ec.ZP.success("Connection test successful!");else throw Error((null==s?void 0:null===(t=s.result)||void 0===t?void 0:t.error)||(null==s?void 0:s.message)||"Unknown error")}catch(e){e instanceof Error?ec.ZP.error("Error testing connection: "+(0,lf.aS)(e.message,100)):ec.ZP.error("Error testing connection: "+String(e))}},e1=async()=>{try{if(eu(!0),!Y)return;await (0,a.modelDeleteCall)(Y,J),ec.ZP.success("Model deleted successfully"),el&&el({deleted:!0,model_info:{id:J}}),W()}catch(e){console.error("Error deleting the model:",e),ec.ZP.fromBackend("Failed to delete model")}finally{eu(!1),ed(!1)}},e2=async(e,l)=>{await (0,lY.vQ)(e)&&(eA(e=>({...e,[l]:!0})),setTimeout(()=>{eA(e=>({...e,[l]:!1}))},2e3))},e4=eK.litellm_model_name.includes("*");return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(w.Z,{icon:lG.Z,variant:"light",onClick:W,className:"mb-4",children:"Back to Models"}),(0,s.jsxs)(X.Z,{children:["Public Model Name: ",z(eK)]}),(0,s.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,s.jsx)($.Z,{className:"text-gray-500 font-mono",children:eK.model_info.id}),(0,s.jsx)(es.ZP,{type:"text",size:"small",icon:eS["model-id"]?(0,s.jsx)(lJ.Z,{size:12}):(0,s.jsx)(lW.Z,{size:12}),onClick:()=>e2(eK.model_info.id,"model-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eS["model-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(w.Z,{variant:"secondary",icon:eV.Z,onClick:e0,className:"flex items-center gap-2","data-testid":"test-connection-button",children:"Test Connection"}),(0,s.jsx)(w.Z,{icon:lU.Z,variant:"secondary",onClick:()=>ep(!0),className:"flex items-center",disabled:!eW,"data-testid":"reuse-credentials-button",children:"Re-use Credentials"}),(0,s.jsx)(w.Z,{icon:N.Z,variant:"secondary",onClick:()=>ed(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",disabled:!eJ,"data-testid":"delete-model-button",children:"Delete Model"})]})]}),(0,s.jsxs)(eG.Z,{children:[(0,s.jsxs)(eU.Z,{className:"mb-6",children:[(0,s.jsx)(eB.Z,{children:"Overview"}),(0,s.jsx)(eB.Z,{children:"Raw JSON"})]}),(0,s.jsxs)(eH.Z,{children:[(0,s.jsxs)(V.Z,{children:[(0,s.jsxs)(O.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6 mb-6",children:[(0,s.jsxs)(lH.Z,{children:[(0,s.jsx)($.Z,{children:"Provider"}),(0,s.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[eK.provider&&(0,s.jsx)("img",{src:(0,ex.dr)(eK.provider).logo,alt:"".concat(eK.provider," logo"),className:"w-4 h-4",onError:e=>{let l=e.currentTarget,t=l.parentElement;if(t&&t.contains(l))try{var s;let e=document.createElement("div");e.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",e.textContent=(null===(s=eK.provider)||void 0===s?void 0:s.charAt(0))||"-",t.replaceChild(e,l)}catch(e){console.error("Failed to replace provider logo fallback:",e)}}}),(0,s.jsx)(X.Z,{children:eK.provider||"Not Set"})]})]}),(0,s.jsxs)(lH.Z,{children:[(0,s.jsx)($.Z,{children:"LiteLLM Model"}),(0,s.jsx)("div",{className:"mt-2 overflow-hidden",children:(0,s.jsx)(E.Z,{title:eK.litellm_model_name||"Not Set",children:(0,s.jsx)("div",{className:"break-all text-sm font-medium leading-relaxed cursor-pointer",children:eK.litellm_model_name||"Not Set"})})})]}),(0,s.jsxs)(lH.Z,{children:[(0,s.jsx)($.Z,{children:"Pricing"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)($.Z,{children:["Input: $",eK.input_cost,"/1M tokens"]}),(0,s.jsxs)($.Z,{children:["Output: $",eK.output_cost,"/1M tokens"]})]})]})]}),(0,s.jsxs)("div",{className:"mb-6 text-sm text-gray-500 flex items-center gap-x-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Created At"," ",eK.model_info.created_at?new Date(eK.model_info.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"Not Set"]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})}),"Created By ",eK.model_info.created_by||"Not Set"]})]}),(0,s.jsxs)(lH.Z,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(X.Z,{children:"Model Settings"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[eY&&eJ&&!eb&&(0,s.jsx)(w.Z,{onClick:()=>eM(!0),className:"flex items-center",children:"Edit Auto Router"}),eJ?!eb&&(0,s.jsx)(w.Z,{onClick:()=>eN(!0),className:"flex items-center",children:"Edit Settings"}):(0,s.jsx)(E.Z,{title:"Only DB models can be edited. You must be an admin or the creator of the model to edit it.",children:(0,s.jsx)(b.Z,{})})]})]}),er?(0,s.jsx)(ev.Z,{form:ea,onFinish:eQ,initialValues:{model_name:er.model_name,litellm_model_name:er.litellm_model_name,api_base:er.litellm_params.api_base,custom_llm_provider:er.litellm_params.custom_llm_provider,organization:er.litellm_params.organization,tpm:er.litellm_params.tpm,rpm:er.litellm_params.rpm,max_retries:er.litellm_params.max_retries,timeout:er.litellm_params.timeout,stream_timeout:er.litellm_params.stream_timeout,input_cost:er.litellm_params.input_cost_per_token?1e6*er.litellm_params.input_cost_per_token:(null===(o=er.model_info)||void 0===o?void 0:o.input_cost_per_token)*1e6||null,output_cost:(null===(d=er.litellm_params)||void 0===d?void 0:d.output_cost_per_token)?1e6*er.litellm_params.output_cost_per_token:(null===(u=er.model_info)||void 0===u?void 0:u.output_cost_per_token)*1e6||null,cache_control:null!==(h=er.litellm_params)&&void 0!==h&&!!h.cache_control_injection_points,cache_control_injection_points:(null===(x=er.litellm_params)||void 0===x?void 0:x.cache_control_injection_points)||[],model_access_group:Array.isArray(null===(p=er.model_info)||void 0===p?void 0:p.access_groups)?er.model_info.access_groups:[],guardrails:Array.isArray(null===(f=er.litellm_params)||void 0===f?void 0:f.guardrails)?er.litellm_params.guardrails:[],tags:Array.isArray(null===(j=er.litellm_params)||void 0===j?void 0:j.tags)?er.litellm_params.tags:[],health_check_model:e4?null===(v=er.model_info)||void 0===v?void 0:v.health_check_model:null,litellm_extra_params:JSON.stringify(er.litellm_params||{},null,2)},layout:"vertical",onValuesChange:()=>ef(!0),children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Model Name"}),eb?(0,s.jsx)(ev.Z.Item,{name:"model_name",className:"mb-0",children:(0,s.jsx)(lK.Z,{placeholder:"Enter model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:er.model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"LiteLLM Model Name"}),eb?(0,s.jsx)(ev.Z.Item,{name:"litellm_model_name",className:"mb-0",children:(0,s.jsx)(lK.Z,{placeholder:"Enter LiteLLM model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:er.litellm_model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Input Cost (per 1M tokens)"}),eb?(0,s.jsx)(ev.Z.Item,{name:"input_cost",className:"mb-0",children:(0,s.jsx)(lx.Z,{placeholder:"Enter input cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==er?void 0:null===(_=er.litellm_params)||void 0===_?void 0:_.input_cost_per_token)?((null===(y=er.litellm_params)||void 0===y?void 0:y.input_cost_per_token)*1e6).toFixed(4):(null==er?void 0:null===(Z=er.model_info)||void 0===Z?void 0:Z.input_cost_per_token)?(1e6*er.model_info.input_cost_per_token).toFixed(4):"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Output Cost (per 1M tokens)"}),eb?(0,s.jsx)(ev.Z.Item,{name:"output_cost",className:"mb-0",children:(0,s.jsx)(lx.Z,{placeholder:"Enter output cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==er?void 0:null===(C=er.litellm_params)||void 0===C?void 0:C.output_cost_per_token)?(1e6*er.litellm_params.output_cost_per_token).toFixed(4):(null==er?void 0:null===(k=er.model_info)||void 0===k?void 0:k.output_cost_per_token)?(1e6*er.model_info.output_cost_per_token).toFixed(4):"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"API Base"}),eb?(0,s.jsx)(ev.Z.Item,{name:"api_base",className:"mb-0",children:(0,s.jsx)(lK.Z,{placeholder:"Enter API base"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(S=er.litellm_params)||void 0===S?void 0:S.api_base)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Custom LLM Provider"}),eb?(0,s.jsx)(ev.Z.Item,{name:"custom_llm_provider",className:"mb-0",children:(0,s.jsx)(lK.Z,{placeholder:"Enter custom LLM provider"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(P=er.litellm_params)||void 0===P?void 0:P.custom_llm_provider)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Organization"}),eb?(0,s.jsx)(ev.Z.Item,{name:"organization",className:"mb-0",children:(0,s.jsx)(lK.Z,{placeholder:"Enter organization"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(A=er.litellm_params)||void 0===A?void 0:A.organization)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"TPM (Tokens per Minute)"}),eb?(0,s.jsx)(ev.Z.Item,{name:"tpm",className:"mb-0",children:(0,s.jsx)(lx.Z,{placeholder:"Enter TPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(M=er.litellm_params)||void 0===M?void 0:M.tpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"RPM (Requests per Minute)"}),eb?(0,s.jsx)(ev.Z.Item,{name:"rpm",className:"mb-0",children:(0,s.jsx)(lx.Z,{placeholder:"Enter RPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(L=er.litellm_params)||void 0===L?void 0:L.rpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Max Retries"}),eb?(0,s.jsx)(ev.Z.Item,{name:"max_retries",className:"mb-0",children:(0,s.jsx)(lx.Z,{placeholder:"Enter max retries"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(F=er.litellm_params)||void 0===F?void 0:F.max_retries)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Timeout (seconds)"}),eb?(0,s.jsx)(ev.Z.Item,{name:"timeout",className:"mb-0",children:(0,s.jsx)(lx.Z,{placeholder:"Enter timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(I=er.litellm_params)||void 0===I?void 0:I.timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Stream Timeout (seconds)"}),eb?(0,s.jsx)(ev.Z.Item,{name:"stream_timeout",className:"mb-0",children:(0,s.jsx)(lx.Z,{placeholder:"Enter stream timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(T=er.litellm_params)||void 0===T?void 0:T.stream_timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Model Access Groups"}),eb?(0,s.jsx)(ev.Z.Item,{name:"model_access_group",className:"mb-0",children:(0,s.jsx)(D.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:null==et?void 0:et.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(R=er.model_info)||void 0===R?void 0:R.access_groups)?Array.isArray(er.model_info.access_groups)?er.model_info.access_groups.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:er.model_info.access_groups.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:e},l))}):"No groups assigned":er.model_info.access_groups:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)($.Z,{className:"font-medium",children:["Guardrails",(0,s.jsx)(E.Z,{title:"Apply safety guardrails to this model to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(b.Z,{style:{marginLeft:"4px"}})})})]}),eb?(0,s.jsx)(ev.Z.Item,{name:"guardrails",className:"mb-0",children:(0,s.jsx)(D.default,{mode:"tags",showSearch:!0,placeholder:"Select existing guardrails or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:eL.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(q=er.litellm_params)||void 0===q?void 0:q.guardrails)?Array.isArray(er.litellm_params.guardrails)?er.litellm_params.guardrails.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:er.litellm_params.guardrails.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:e},l))}):"No guardrails assigned":er.litellm_params.guardrails:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Tags"}),eb?(0,s.jsx)(ev.Z.Item,{name:"tags",className:"mb-0",children:(0,s.jsx)(D.default,{mode:"tags",showSearch:!0,placeholder:"Select existing tags or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],maxTagCount:"responsive",allowClear:!0,style:{width:"100%"},options:Object.values(eI).map(e=>({value:e.name,label:e.name,title:e.description||e.name}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(B=er.litellm_params)||void 0===B?void 0:B.tags)?Array.isArray(er.litellm_params.tags)?er.litellm_params.tags.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:er.litellm_params.tags.map((e,l)=>(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-purple-100 text-purple-800",children:e},l))}):"No tags assigned":er.litellm_params.tags:"Not Set"})]}),e4&&(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Health Check Model"}),eb?(0,s.jsx)(ev.Z.Item,{name:"health_check_model",className:"mb-0",children:(0,s.jsx)(D.default,{showSearch:!0,placeholder:"Select existing health check model",optionFilterProp:"children",allowClear:!0,options:(()=>{var e;let l=eK.litellm_model_name.split("/")[0];return(null==eq?void 0:null===(e=eq.data)||void 0===e?void 0:e.filter(e=>{var t;return(null===(t=e.providers)||void 0===t?void 0:t.includes(l))&&e.model_group!==eK.litellm_model_name}).map(e=>({value:e.model_group,label:e.model_group})))||[]})()})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(G=er.model_info)||void 0===G?void 0:G.health_check_model)||"Not Set"})]}),eb?(0,s.jsx)(lg,{form:ea,showCacheControl:eC,onCacheControlChange:e=>ek(e)}):(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Cache Control"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(U=er.litellm_params)||void 0===U?void 0:U.cache_control_injection_points)?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"Enabled"}),(0,s.jsx)("div",{className:"mt-2",children:er.litellm_params.cache_control_injection_points.map((e,l)=>(0,s.jsxs)("div",{className:"text-sm text-gray-600 mb-1",children:["Location: ",e.location,",",e.role&&(0,s.jsxs)("span",{children:[" Role: ",e.role]}),void 0!==e.index&&(0,s.jsxs)("span",{children:[" Index: ",e.index]})]},l))})]}):"Disabled"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Model Info"}),eb?(0,s.jsx)(ev.Z.Item,{name:"model_info",className:"mb-0",children:(0,s.jsx)(eP.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}',defaultValue:JSON.stringify(eK.model_info,null,2)})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(er.model_info,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)($.Z,{className:"font-medium",children:["LiteLLM Params",(0,s.jsx)(E.Z,{title:"Optional litellm params used for making a litellm.completion() call. Some params are automatically added by LiteLLM.",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(b.Z,{style:{marginLeft:"4px"}})})})]}),eb?(0,s.jsx)(ev.Z.Item,{name:"litellm_extra_params",rules:[{validator:lf.Ac}],children:(0,s.jsx)(eP.default.TextArea,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(0,s.jsx)("pre",{className:"bg-gray-100 p-2 rounded text-xs overflow-auto mt-1",children:JSON.stringify(er.litellm_params,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)($.Z,{className:"font-medium",children:"Team ID"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eK.model_info.team_id||"Not Set"})]})]}),eb&&(0,s.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,s.jsx)(w.Z,{variant:"secondary",onClick:()=>{ea.resetFields(),ef(!1),eN(!1)},disabled:ej,children:"Cancel"}),(0,s.jsx)(w.Z,{variant:"primary",onClick:()=>ea.submit(),loading:ej,children:"Save Changes"})]})]})}):(0,s.jsx)($.Z,{children:"Loading..."})]})]}),(0,s.jsx)(V.Z,{children:(0,s.jsx)(lH.Z,{children:(0,s.jsx)("pre",{className:"bg-gray-100 p-4 rounded text-xs overflow-auto",children:JSON.stringify(eK,null,2)})})})]})]}),(0,s.jsx)(e_.Z,{isOpen:eo,title:"Delete Model",alertMessage:"This action cannot be undone.",message:"Are you sure you want to delete this model?",resourceInformationTitle:"Model Information",resourceInformation:[{label:"Model Name",value:(null==eK?void 0:eK.model_name)||"Not Set"},{label:"LiteLLM Model Name",value:(null==eK?void 0:eK.litellm_model_name)||"Not Set"},{label:"Provider",value:(null==eK?void 0:eK.provider)||"Not Set"},{label:"Created By",value:(null==eK?void 0:null===(K=eK.model_info)||void 0===K?void 0:K.created_by)||"Not Set"}],onCancel:()=>ed(!1),onOk:e1,confirmLoading:em}),eh&&!e$?(0,s.jsx)(l0,{isVisible:eh,onCancel:()=>ep(!1),onAddCredential:eX,existingCredential:eZ,setIsCredentialModalOpen:ep}):(0,s.jsx)(ei.Z,{open:eh,onCancel:()=>ep(!1),title:"Using Existing Credential",children:(0,s.jsx)($.Z,{children:eK.litellm_params.litellm_credential_name})}),(0,s.jsx)(l$,{isVisible:eE,onCancel:()=>eM(!1),onSuccess:e=>{en(e),el&&el(e)},modelData:er||eK,accessToken:Y||"",userRole:ee||""})]})}var l2=t(82786),l4=t(73938),l5=e=>{var l;let{premiumUser:t,teams:r}=e,{accessToken:i,token:o,userRole:h,userId:x}=(0,n.Z)(),[p]=ev.Z.useForm(),[f,j]=(0,g.useState)(""),[v,_]=(0,g.useState)([]),[y,b]=(0,g.useState)(ex.Cl.Anthropic),[N,Z]=(0,g.useState)(null),[w,S]=(0,g.useState)(null),[P,A]=(0,g.useState)(null),[E,M]=(0,g.useState)(0),[L,F]=(0,g.useState)({}),[I,T]=(0,g.useState)(!1),[R,q]=(0,g.useState)(null),[D,B]=(0,g.useState)(null),[G,U]=(0,g.useState)(0),K=(0,eq.NL)(),{data:W,isLoading:Y,refetch:X}=(0,m.XP)(),{data:Q,isLoading:ee}=(0,c.i)(),{data:et,isLoading:es}=d(),ea=(null==et?void 0:et.credentials)||[],{data:er,isLoading:ei}=(0,u.L)(),en=(0,g.useMemo)(()=>{if(!(null==W?void 0:W.data))return[];let e=new Set;for(let l of W.data)e.add(l.model_name);return Array.from(e).sort()},[null==W?void 0:W.data]),eo=(0,g.useMemo)(()=>{if(!(null==W?void 0:W.data))return[];let e=new Set;for(let l of W.data){let t=l.model_info;if(null==t?void 0:t.access_groups)for(let l of t.access_groups)e.add(l)}return Array.from(e)},[null==W?void 0:W.data]),ed=(0,g.useMemo)(()=>(null==W?void 0:W.data)?W.data.map(e=>e.model_name):[],[null==W?void 0:W.data]),em=e=>null!=Q&&"object"==typeof Q&&e in Q?Q[e].litellm_provider:"openai",eu=(0,g.useMemo)(()=>(null==W?void 0:W.data)?H(W,em):{data:[]},[null==W?void 0:W.data,em]),ep=h&&(0,eO.P4)(h),ef=h&&eO.lo.includes(h),ej=x&&(0,eO.yV)(r,x),e_=ef&&(null==er?void 0:null===(l=er.values)||void 0===l?void 0:l.disable_model_add_for_internal_users)===!0,ey=!ep&&(e_||!ej),eb={name:"file",accept:".json",pastable:!1,beforeUpload:e=>{if("application/json"===e.type){let l=new FileReader;l.onload=e=>{if(e.target){let l=e.target.result;p.setFieldsValue({vertex_credentials:l})}},l.readAsText(e)}return!1},onChange(e){"done"===e.file.status?ec.ZP.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&ec.ZP.fromBackend("".concat(e.file.name," file upload failed."))}},eN=()=>{j(new Date().toLocaleString()),K.invalidateQueries({queryKey:["models","list"]}),X()},eZ=async()=>{if(i)try{let e={router_settings:{}};"global"===N?(P&&(e.router_settings.retry_policy=P),ec.ZP.success("Global retry settings saved successfully")):(w&&(e.router_settings.model_group_retry_policy=w),ec.ZP.success("Retry settings saved successfully for ".concat(N))),await (0,a.setCallbacksCall)(i,e)}catch(e){ec.ZP.fromBackend("Failed to save retry settings")}};if((0,g.useEffect)(()=>{if(!i||!o||!h||!x||!W)return;let e=async()=>{try{let e=(await (0,a.getCallbacksCall)(i,x,h)).router_settings,l=e.model_group_retry_policy,t=e.num_retries;S(l),A(e.retry_policy),M(t);let s=e.model_group_alias||{};F(s)}catch(e){console.error("Error fetching model data:",e)}};i&&o&&h&&x&&W&&e()},[i,o,h,x,W]),h&&"Admin Viewer"==h){let{Title:e,Paragraph:l}=k.default;return(0,s.jsxs)("div",{children:[(0,s.jsx)(e,{level:1,children:"Access Denied"}),(0,s.jsx)(l,{children:"Ask your proxy admin for access to view all models"})]})}let ew=async()=>{try{let e=await p.validateFields();await eg(e,i,p,eN)}catch(t){var e;let l=(null===(e=t.errorFields)||void 0===e?void 0:e.map(e=>"".concat(e.name.join("."),": ").concat(e.errors.join(", "))).join(" | "))||"Unknown validation error";ec.ZP.fromBackend("Please fill in the following required fields: ".concat(l))}};return(Object.keys(ex.Cl).find(e=>ex.Cl[e]===y),D)?(0,s.jsx)("div",{className:"w-full h-full",children:(0,s.jsx)(l4.Z,{teamId:D,onClose:()=>B(null),accessToken:i,is_team_admin:"Admin"===h,is_proxy_admin:"Proxy Admin"===h,userModels:ed,editTeam:!1,onUpdate:eN,premiumUser:t})}):(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(O.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(eD.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Model Management"}),eO.ZL.includes(h)?(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add and manage models for the proxy"}):(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Add models for teams you are an admin for."})]})}),(0,s.jsxs)("div",{className:"mb-4 px-4 py-3 bg-blue-50 rounded-lg border border-blue-100 flex items-center gap-4",children:[(0,s.jsx)("div",{className:"flex-shrink-0 w-10 h-10 bg-white rounded-full flex items-center justify-center border border-blue-200",children:(0,s.jsx)(eK.Z,{style:{fontSize:"18px",color:"#6366f1"}})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("h4",{className:"text-gray-900 font-semibold text-sm m-0",children:"Missing a provider?"}),(0,s.jsx)("p",{className:"text-gray-500 text-xs m-0 mt-0.5",children:"The LiteLLM engineering team is constantly adding support for new LLM models, providers, endpoints. If you don't see the one you need, let us know and we'll prioritize it."})]}),(0,s.jsxs)("a",{href:"https://models.litellm.ai/?request=true",target:"_blank",rel:"noopener noreferrer",className:"flex-shrink-0 inline-flex items-center gap-2 px-4 py-2 bg-[#6366f1] hover:bg-[#5558e3] text-white text-sm font-medium rounded-lg transition-colors",children:["Request Provider",(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]}),R&&!(Y||ee||es||ei)?(0,s.jsx)(l1,{modelId:R,onClose:()=>{q(null)},accessToken:i,userID:x,userRole:h,onModelUpdate:e=>{K.invalidateQueries({queryKey:["models","list"]}),eN()},modelAccessGroups:eo}):(0,s.jsxs)(eG.Z,{index:G,onIndexChange:U,className:"gap-2 h-[75vh] w-full ",children:[(0,s.jsxs)(eU.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,s.jsxs)("div",{className:"flex",children:[eO.ZL.includes(h)?(0,s.jsx)(eB.Z,{children:"All Models"}):(0,s.jsx)(eB.Z,{children:"Your Models"}),!ey&&(0,s.jsx)(eB.Z,{children:"Add Model"}),eO.ZL.includes(h)&&(0,s.jsx)(eB.Z,{children:"LLM Credentials"}),eO.ZL.includes(h)&&(0,s.jsx)(eB.Z,{children:"Pass-Through Endpoints"}),eO.ZL.includes(h)&&(0,s.jsx)(eB.Z,{children:"Health Status"}),eO.ZL.includes(h)&&(0,s.jsx)(eB.Z,{children:"Model Retry Settings"}),eO.ZL.includes(h)&&(0,s.jsx)(eB.Z,{children:"Model Group Alias"}),eO.ZL.includes(h)&&(0,s.jsx)(eB.Z,{children:"Price Data Reload"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[f&&(0,s.jsxs)($.Z,{children:["Last Refreshed: ",f]}),(0,s.jsx)(C.Z,{icon:eV.Z,variant:"shadow",size:"xs",className:"self-center",onClick:eN})]})]}),(0,s.jsxs)(eH.Z,{children:[(0,s.jsx)(J,{selectedModelGroup:N,setSelectedModelGroup:Z,availableModelGroups:en,availableModelAccessGroups:eo,setSelectedModelId:q,setSelectedTeamId:B}),!ey&&(0,s.jsx)(V.Z,{className:"h-full",children:(0,s.jsx)(lP,{form:p,handleOk:ew,selectedProvider:y,setSelectedProvider:b,providerModels:v,setProviderModelsFn:e=>{_((0,ex.bK)(e,Q))},getPlaceholder:ex.ph,uploadProps:eb,showAdvancedSettings:I,setShowAdvancedSettings:T,teams:r,credentials:ea,accessToken:i,userRole:h})}),(0,s.jsx)(V.Z,{children:(0,s.jsx)(ez,{uploadProps:eb})}),(0,s.jsx)(V.Z,{children:(0,s.jsx)(l2.Z,{accessToken:i,userRole:h,userID:x,modelData:eu,premiumUser:t})}),(0,s.jsx)(V.Z,{children:(0,s.jsx)(lR,{accessToken:i,modelData:eu,all_models_on_proxy:ed,getDisplayModelName:z,setSelectedModelId:q,teams:r})}),(0,s.jsx)(el,{selectedModelGroup:N,setSelectedModelGroup:Z,availableModelGroups:en,globalRetryPolicy:P,setGlobalRetryPolicy:A,defaultRetry:E,modelGroupRetryPolicy:w,setModelGroupRetryPolicy:S,handleSaveRetrySettings:eZ}),(0,s.jsx)(V.Z,{children:(0,s.jsx)(lB,{accessToken:i,initialModelGroupAlias:L,onAliasUpdate:F})}),(0,s.jsx)(eh,{})]})]})]})})})}},47024:function(e,l,t){t.d(l,{_:function(){return c}});var s=t(57437);t(2265);var a=t(73705),r=t(5545),i=t(44633),n=t(86462),o=t(3837),d=t(49084);let c=e=>{let{sortState:l,onSortChange:t}=e,c=[{key:"asc",label:"Ascending",icon:(0,s.jsx)(i.Z,{className:"h-4 w-4"})},{key:"desc",label:"Descending",icon:(0,s.jsx)(n.Z,{className:"h-4 w-4"})},{key:"reset",label:"Reset",icon:(0,s.jsx)(o.Z,{className:"h-4 w-4"})}];return(0,s.jsx)(a.Z,{menu:{items:c,onClick:e=>{let{key:l}=e;"asc"===l?t("asc"):"desc"===l?t("desc"):"reset"===l&&t(!1)},selectable:!0,selectedKeys:l?[l]:[]},trigger:["click"],autoAdjustOverflow:!0,children:(0,s.jsx)(r.ZP,{type:"text",onClick:e=>e.stopPropagation(),icon:"asc"===l?(0,s.jsx)(i.Z,{className:"h-4 w-4"}):"desc"===l?(0,s.jsx)(n.Z,{className:"h-4 w-4"}):(0,s.jsx)(d.Z,{className:"h-4 w-4"}),className:l?"text-blue-500 hover:text-blue-600":"text-gray-400 hover:text-blue-500"})})}},45188:function(e,l,t){t.d(l,{K:function(){return i}});var s=t(57437),a=t(2265),r=t(42673);let i=e=>{let{provider:l,className:t="w-4 h-4"}=e,[i,n]=(0,a.useState)(!1),{logo:o}=(0,r.dr)(l);return i||!o?(0,s.jsx)("div",{className:"".concat(t," rounded-full bg-gray-200 flex items-center justify-center text-xs"),children:(null==l?void 0:l.charAt(0))||"-"}):(0,s.jsx)("img",{src:o,alt:"".concat(l," logo"),className:t,onError:()=>n(!0)})}},82786:function(e,l,t){t.d(l,{Z:function(){return et}});var s=t(57437),a=t(2265),r=t(78489),i=t(47323),n=t(84264),o=t(96761),d=t(19250),c=t(99981),m=t(33866),u=t(15731),h=t(53410),x=t(74998),p=t(59341),g=t(49566),f=t(12514),j=t(97765),v=t(37592),_=t(10032),y=t(22116),b=t(51653),N=t(24199),Z=t(12660),w=t(15424),C=t(55590),k=t(5545),S=t(45246),P=t(96473),A=t(31283),E=e=>{let{value:l={},onChange:t}=e,[r,i]=(0,a.useState)(Object.entries(l)),n=e=>{let l=r.filter((l,t)=>t!==e);i(l),null==t||t(Object.fromEntries(l))},o=(e,l,s)=>{let a=[...r];a[e]=[l,s],i(a),null==t||t(Object.fromEntries(a))};return(0,s.jsxs)("div",{children:[r.map((e,l)=>{let[t,a]=e;return(0,s.jsxs)(C.Z,{style:{display:"flex",marginBottom:8},align:"center",children:[(0,s.jsx)(A.o,{placeholder:"Header Name",value:t,onChange:e=>o(l,e.target.value,a)}),(0,s.jsx)(A.o,{placeholder:"Header Value",value:a,onChange:e=>o(l,t,e.target.value)}),(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:(0,s.jsx)(S.Z,{onClick:()=>n(l),style:{cursor:"pointer"}})})]},l)}),(0,s.jsx)(k.ZP,{type:"dashed",onClick:()=>{i([...r,["",""]])},icon:(0,s.jsx)(P.Z,{}),children:"Add Header"})]})},M=t(77565),L=e=>{let{pathValue:l,targetValue:t,includeSubpath:a}=e,r=(0,d.getProxyBaseUrl)();return l&&t?(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Preview"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"How your requests will be routed"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"Basic routing:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:l?"".concat(r).concat(l):""})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(M.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsx)("code",{className:"font-mono text-sm text-gray-900",children:t})]})]})]}),a&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-base font-semibold text-gray-900 mb-3",children:"With subpaths:"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Your endpoint + subpath"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[l&&"".concat(r).concat(l),(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]}),(0,s.jsx)("div",{className:"text-gray-400",children:(0,s.jsx)(M.Z,{className:"text-lg"})}),(0,s.jsxs)("div",{className:"flex-1 bg-gray-50 border border-gray-200 rounded-lg p-3",children:[(0,s.jsx)("div",{className:"text-sm text-gray-600 mb-2",children:"Forwards to"}),(0,s.jsxs)("code",{className:"font-mono text-sm text-gray-900",children:[t,(0,s.jsx)("span",{className:"text-blue-600",children:"/v1/text-to-image/base/model"})]})]})]}),(0,s.jsxs)("div",{className:"mt-3 text-sm text-gray-600",children:["Any path after ",l," will be appended to the target URL"]})]})}),!a&&(0,s.jsx)("div",{className:"mt-4 p-3 bg-blue-50 rounded-md border border-blue-200",children:(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)(w.Z,{className:"text-blue-500 mt-0.5 mr-2 flex-shrink-0"}),(0,s.jsxs)("div",{className:"text-sm text-blue-700",children:[(0,s.jsx)("span",{className:"font-medium",children:"Not seeing the routing you wanted?"})," Try enabling - Include Subpaths - above - this allows subroutes like"," ",(0,s.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded font-mono text-xs",children:"/api/v1/models"})," to be forwarded automatically."]})]})})]})]}):null},F=t(9114),I=t(63709),T=e=>{let{premiumUser:l,authEnabled:t,onAuthChange:a}=e;return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Security"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-4",children:"When enabled, requests to this endpoint will require a valid LiteLLM Virtual Key"}),l?(0,s.jsx)(_.Z.Item,{name:"auth",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(I.Z,{checked:t,onChange:e=>{a(e)}})}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center mb-3",children:[(0,s.jsx)(I.Z,{disabled:!0,checked:!1,style:{outline:"2px solid #d1d5db",outlineOffset:"2px"}}),(0,s.jsx)("span",{className:"ml-2 text-sm text-gray-400",children:"Authentication (Premium)"})]}),(0,s.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,s.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:["Setting authentication for pass-through endpoints is a LiteLLM Enterprise feature. Get a trial key"," ",(0,s.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})]})},R=t(67479),z=e=>{let{accessToken:l,value:t={},onChange:r,disabled:i=!1}=e,[n,d]=(0,a.useState)(Object.keys(t)),[m,u]=(0,a.useState)(t);(0,a.useEffect)(()=>{u(t),d(Object.keys(t))},[t]);let h=(e,l,t)=>{var s,a;let i=m[e]||{},n={...m,[e]:{...i,[l]:t.length>0?t:void 0}};(null===(s=n[e])||void 0===s?void 0:s.request_fields)||(null===(a=n[e])||void 0===a?void 0:a.response_fields)||(n[e]=null),u(n),r&&r(n)};return(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Guardrails"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Configure guardrails to enforce policies on requests and responses. Guardrails are opt-in for passthrough endpoints."}),(0,s.jsx)(b.Z,{message:(0,s.jsxs)("span",{children:["Field-Level Targeting"," ",(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through_guardrails#field-level-targeting",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"(Learn More)"})]}),description:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("div",{children:"Optionally specify which fields to check. If left empty, the entire request/response is sent to the guardrail."}),(0,s.jsxs)("div",{className:"text-xs space-y-1 mt-2",children:[(0,s.jsx)("div",{className:"font-medium",children:"Common Examples:"}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"query"})," - Single field"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"documents[*].text"})," - All text in documents array"]}),(0,s.jsxs)("div",{children:["• ",(0,s.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"messages[*].content"})," - All message contents"]})]})]}),type:"info",showIcon:!0,className:"mb-4"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Select Guardrails",(0,s.jsx)(c.Z,{title:"Choose which guardrails should run on this endpoint. Org/team/key level guardrails will also be included.",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),children:(0,s.jsx)(R.Z,{accessToken:l,value:n,onChange:e=>{d(e);let l={};e.forEach(e=>{l[e]=m[e]||null}),u(l),r&&r(l)},disabled:i})}),n.length>0&&(0,s.jsxs)("div",{className:"mt-6 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Field Targeting (Optional)"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"\uD83D\uDCA1 Tip: Leave empty to check entire payload"})]}),n.map(e=>{var l,t;return(0,s.jsxs)(f.Z,{className:"p-4 bg-gray-50",children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-900 mb-3",children:e}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Request Fields (pre_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which request fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• query"}),(0,s.jsx)("div",{children:"• documents[*].text"}),(0,s.jsx)("div",{children:"• messages[*].content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"query"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ query"}),(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[];h(e,"request_fields",[...t,"documents[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ documents[*]"})]})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., query, documents[*].text)",value:(null===(l=m[e])||void 0===l?void 0:l.request_fields)||[],onChange:l=>h(e,"request_fields",l),disabled:i,tokenSeparators:[","]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("label",{className:"text-xs text-gray-600 flex items-center",children:["Response Fields (post_call)",(0,s.jsx)(c.Z,{title:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Specify which response fields to check"}),(0,s.jsxs)("div",{className:"text-xs space-y-1",children:[(0,s.jsx)("div",{children:"Examples:"}),(0,s.jsx)("div",{children:"• results[*].text"}),(0,s.jsx)("div",{children:"• choices[*].message.content"})]})]}),children:(0,s.jsx)(w.Z,{className:"ml-1 text-gray-400"})})]}),(0,s.jsx)("div",{className:"flex gap-1",children:(0,s.jsx)("button",{type:"button",onClick:()=>{var l;let t=(null===(l=m[e])||void 0===l?void 0:l.response_fields)||[];h(e,"response_fields",[...t,"results[*]"])},className:"text-xs px-2 py-1 bg-white border border-gray-300 rounded hover:bg-gray-50",disabled:i,children:"+ results[*]"})})]}),(0,s.jsx)(v.default,{mode:"tags",style:{width:"100%"},placeholder:"Type field name or use + buttons above (e.g., results[*].text)",value:(null===(t=m[e])||void 0===t?void 0:t.response_fields)||[],onChange:l=>h(e,"response_fields",l),disabled:i,tokenSeparators:[","]})]})]})]},e)})]})]})};let{Option:O}=v.default;var V=e=>{let{accessToken:l,setPassThroughItems:t,passThroughItems:i,premiumUser:n=!1}=e,[m]=_.Z.useForm(),[u,h]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),[C,k]=(0,a.useState)(""),[S,P]=(0,a.useState)(""),[A,M]=(0,a.useState)(""),[I,R]=(0,a.useState)(!0),[O,V]=(0,a.useState)(!1),[q,D]=(0,a.useState)({}),B=()=>{m.resetFields(),P(""),M(""),R(!0),D({}),h(!1)},G=e=>{let l=e;e&&!e.startsWith("/")&&(l="/"+e),P(l),m.setFieldsValue({path:l})},U=async e=>{console.log("addPassThrough called with:",e),v(!0);try{!n&&"auth"in e&&delete e.auth,q&&Object.keys(q).length>0&&(e.guardrails=q),console.log("formValues: ".concat(JSON.stringify(e)));let s=(await (0,d.createPassThroughEndpoint)(l,e)).endpoints[0],a=[...i,s];t(a),F.ZP.success("Pass-through endpoint created successfully"),m.resetFields(),P(""),M(""),R(!0),D({}),h(!1)}catch(e){F.ZP.fromBackend("Error creating pass-through endpoint: "+e)}finally{v(!1)}};return(0,s.jsxs)("div",{children:[(0,s.jsx)(r.Z,{className:"mx-auto mb-4 mt-4",onClick:()=>h(!0),children:"+ Add Pass-Through Endpoint"}),(0,s.jsx)(y.Z,{title:(0,s.jsxs)("div",{className:"flex items-center space-x-3 pb-4 border-b border-gray-100",children:[(0,s.jsx)(Z.Z,{className:"text-xl text-blue-500"}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add Pass-Through Endpoint"})]}),open:u,width:1e3,onCancel:B,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,s.jsxs)("div",{className:"mt-6",children:[(0,s.jsx)(b.Z,{message:"What is a Pass-Through Endpoint?",description:"Route requests from your LiteLLM proxy to any external API. Perfect for custom models, image generation APIs, or any service you want to proxy through LiteLLM.",type:"info",showIcon:!0,className:"mb-6"}),(0,s.jsxs)(_.Z,{form:m,onFinish:U,layout:"vertical",className:"space-y-6",initialValues:{include_subpath:!0,path:S,target:A},children:[(0,s.jsxs)(f.Z,{className:"p-5",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Route Configuration"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-5",children:"Configure how requests to your domain will be forwarded to the target API"}),(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Path Prefix"}),name:"path",rules:[{required:!0,message:"Path is required",pattern:/^\//}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example: /bria, /adobe-photoshop, /elasticsearch"}),className:"mb-4",children:(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsx)(g.Z,{placeholder:"bria",value:S,onChange:e=>G(e.target.value),className:"flex-1"})})}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Target URL"}),name:"target",rules:[{required:!0,message:"Target URL is required"},{type:"url",message:"Please enter a valid URL"}],extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:"Example:https://engine.prod.bria-api.com"}),className:"mb-4",children:(0,s.jsx)(g.Z,{placeholder:"https://engine.prod.bria-api.com",value:A,onChange:e=>{M(e.target.value),m.setFieldsValue({target:e.target.value})}})}),(0,s.jsxs)("div",{className:"flex items-center justify-between py-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-medium text-gray-700",children:"Include Subpaths"}),(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Forward all subpaths to the target API (recommended for REST APIs)"})]}),(0,s.jsx)(_.Z.Item,{name:"include_subpath",valuePropName:"checked",className:"mb-0",children:(0,s.jsx)(p.Z,{checked:I,onChange:R})})]})]})]}),(0,s.jsx)(L,{pathValue:S,targetValue:A,includeSubpath:I}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Headers"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Add headers that will be sent with every request to the target API"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Headers",(0,s.jsx)(c.Z,{title:"Authentication and other headers to forward with requests",children:(0,s.jsx)(w.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"headers",rules:[{required:!0,message:"Please configure the headers"}],extra:(0,s.jsxs)("div",{className:"text-xs text-gray-500 mt-2",children:[(0,s.jsx)("div",{className:"font-medium mb-1",children:"Add authentication tokens and other required headers"}),(0,s.jsx)("div",{children:"Common examples: auth_token, Authorization, x-api-key"})]}),children:(0,s.jsx)(E,{})})]}),(0,s.jsx)(T,{premiumUser:n,authEnabled:O,onAuthChange:e=>{V(e),m.setFieldsValue({auth:e})}}),(0,s.jsx)(z,{accessToken:l,value:q,onChange:D}),(0,s.jsxs)(f.Z,{className:"p-6",children:[(0,s.jsx)(o.Z,{className:"text-lg font-semibold text-gray-900 mb-2",children:"Billing"}),(0,s.jsx)(j.Z,{className:"text-gray-600 mb-6",children:"Optional cost tracking for this endpoint"}),(0,s.jsx)(_.Z.Item,{label:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Cost Per Request (USD)",(0,s.jsx)(c.Z,{title:"Optional: Track costs for requests to this endpoint",children:(0,s.jsx)(w.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:"cost_per_request",extra:(0,s.jsx)("div",{className:"text-xs text-gray-500 mt-2",children:"The cost charged for each request through this endpoint"}),children:(0,s.jsx)(N.Z,{min:0,step:.001,precision:4,placeholder:"2.0000",size:"large"})})]}),(0,s.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,s.jsx)(r.Z,{variant:"secondary",onClick:B,children:"Cancel"}),(0,s.jsx)(r.Z,{variant:"primary",loading:x,onClick:()=>{console.log("Submit button clicked"),m.submit()},children:x?"Creating...":"Add Pass-Through Endpoint"})]})]})]})})]})},q=t(41649),D=t(67101),B=t(12485),G=t(18135),U=t(35242),H=t(29706),K=t(77991),J=t(4260),W=t(12221),Y=t(87769),$=t(42208);let X=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l,null,2);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("pre",{className:"font-mono text-xs bg-gray-50 p-2 rounded max-w-md overflow-auto",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(Y.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)($.Z,{className:"w-4 h-4 text-gray-500"})})]})};var Q=e=>{let{endpointData:l,onClose:t,accessToken:i,isAdmin:c,premiumUser:m=!1,onEndpointUpdated:u}=e,[h,x]=(0,a.useState)(l),[p,j]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1),[b,N]=(0,a.useState)((null==l?void 0:l.auth)||!1),[Z,w]=(0,a.useState)((null==l?void 0:l.guardrails)||{}),[C]=_.Z.useForm(),S=async e=>{try{if(!i||!(null==h?void 0:h.id))return;let l={};if(e.headers)try{l="string"==typeof e.headers?JSON.parse(e.headers):e.headers}catch(e){F.ZP.fromBackend("Invalid JSON format for headers");return}let t={path:h.path,target:e.target,headers:l,include_subpath:e.include_subpath,cost_per_request:e.cost_per_request,auth:m?e.auth:void 0,guardrails:Z&&Object.keys(Z).length>0?Z:void 0};await (0,d.updatePassThroughEndpoint)(i,h.id,t),x({...h,...t}),y(!1),u&&u()}catch(e){console.error("Error updating endpoint:",e),F.ZP.fromBackend("Failed to update pass through endpoint")}},P=async()=>{try{if(!i||!(null==h?void 0:h.id))return;await (0,d.deletePassThroughEndpointsCall)(i,h.id),F.ZP.success("Pass through endpoint deleted successfully"),t(),u&&u()}catch(e){console.error("Error deleting endpoint:",e),F.ZP.fromBackend("Failed to delete pass through endpoint")}};return p?(0,s.jsx)("div",{className:"p-4",children:"Loading..."}):h?(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,s.jsxs)("div",{children:[(0,s.jsx)(k.ZP,{onClick:t,className:"mb-4",children:"← Back"}),(0,s.jsxs)(o.Z,{children:["Pass Through Endpoint: ",h.path]}),(0,s.jsx)(n.Z,{className:"text-gray-500 font-mono",children:h.id})]})}),(0,s.jsxs)(G.Z,{children:[(0,s.jsxs)(U.Z,{className:"mb-4",children:[(0,s.jsx)(B.Z,{children:"Overview"},"overview"),c?(0,s.jsx)(B.Z,{children:"Settings"},"settings"):(0,s.jsx)(s.Fragment,{})]}),(0,s.jsxs)(K.Z,{children:[(0,s.jsxs)(H.Z,{children:[(0,s.jsxs)(D.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,s.jsxs)(f.Z,{children:[(0,s.jsx)(n.Z,{children:"Path"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(o.Z,{className:"font-mono",children:h.path})})]}),(0,s.jsxs)(f.Z,{children:[(0,s.jsx)(n.Z,{children:"Target"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(o.Z,{children:h.target})})]}),(0,s.jsxs)(f.Z,{children:[(0,s.jsx)(n.Z,{children:"Configuration"}),(0,s.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(q.Z,{color:h.include_subpath?"green":"gray",children:h.include_subpath?"Include Subpath":"Exact Path"})}),(0,s.jsx)("div",{children:(0,s.jsx)(q.Z,{color:h.auth?"blue":"gray",children:h.auth?"Auth Required":"No Auth"})}),void 0!==h.cost_per_request&&(0,s.jsx)("div",{children:(0,s.jsxs)(n.Z,{children:["Cost per request: $",h.cost_per_request]})})]})]})]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(L,{pathValue:h.path,targetValue:h.target,includeSubpath:h.include_subpath||!1})}),h.headers&&Object.keys(h.headers).length>0&&(0,s.jsxs)(f.Z,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Headers"}),(0,s.jsxs)(q.Z,{color:"blue",children:[Object.keys(h.headers).length," headers configured"]})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(X,{value:h.headers})})]}),h.guardrails&&Object.keys(h.guardrails).length>0&&(0,s.jsxs)(f.Z,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Guardrails"}),(0,s.jsxs)(q.Z,{color:"purple",children:[Object.keys(h.guardrails).length," guardrails configured"]})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:Object.entries(h.guardrails).map(e=>{let[l,t]=e;return(0,s.jsxs)("div",{className:"p-3 bg-gray-50 rounded",children:[(0,s.jsx)("div",{className:"font-medium text-sm",children:l}),t&&(t.request_fields||t.response_fields)&&(0,s.jsxs)("div",{className:"mt-2 text-xs text-gray-600 space-y-1",children:[t.request_fields&&(0,s.jsxs)("div",{children:["Request fields: ",t.request_fields.join(", ")]}),t.response_fields&&(0,s.jsxs)("div",{children:["Response fields: ",t.response_fields.join(", ")]})]}),!t&&(0,s.jsx)("div",{className:"text-xs text-gray-600 mt-1",children:"Uses entire payload"})]},l)})})]})]}),c&&(0,s.jsx)(H.Z,{children:(0,s.jsxs)(f.Z,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(o.Z,{children:"Pass Through Endpoint Settings"}),(0,s.jsx)("div",{className:"space-x-2",children:!v&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.Z,{onClick:()=>y(!0),children:"Edit Settings"}),(0,s.jsx)(r.Z,{onClick:P,variant:"secondary",color:"red",children:"Delete Endpoint"})]})})]}),v?(0,s.jsxs)(_.Z,{form:C,onFinish:S,initialValues:{target:h.target,headers:h.headers?JSON.stringify(h.headers,null,2):"",include_subpath:h.include_subpath||!1,cost_per_request:h.cost_per_request,auth:h.auth||!1},layout:"vertical",children:[(0,s.jsx)(_.Z.Item,{label:"Target URL",name:"target",rules:[{required:!0,message:"Please input a target URL"}],children:(0,s.jsx)(g.Z,{placeholder:"https://api.example.com"})}),(0,s.jsx)(_.Z.Item,{label:"Headers (JSON)",name:"headers",children:(0,s.jsx)(J.default.TextArea,{rows:5,placeholder:'{"Authorization": "Bearer your-token", "Content-Type": "application/json"}'})}),(0,s.jsx)(_.Z.Item,{label:"Include Subpath",name:"include_subpath",valuePropName:"checked",children:(0,s.jsx)(I.Z,{})}),(0,s.jsx)(_.Z.Item,{label:"Cost per Request",name:"cost_per_request",children:(0,s.jsx)(W.Z,{min:0,step:.01,precision:2,placeholder:"0.00",addonBefore:"$"})}),(0,s.jsx)(T,{premiumUser:m,authEnabled:b,onAuthChange:e=>{N(e),C.setFieldsValue({auth:e})}}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(z,{accessToken:i||"",value:Z,onChange:w})}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,s.jsx)(k.ZP,{onClick:()=>y(!1),children:"Cancel"}),(0,s.jsx)(r.Z,{children:"Save Changes"})]})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Path"}),(0,s.jsx)("div",{className:"font-mono",children:h.path})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Target URL"}),(0,s.jsx)("div",{children:h.target})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Include Subpath"}),(0,s.jsx)(q.Z,{color:h.include_subpath?"green":"gray",children:h.include_subpath?"Yes":"No"})]}),void 0!==h.cost_per_request&&(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Cost per Request"}),(0,s.jsxs)("div",{children:["$",h.cost_per_request]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Authentication Required"}),(0,s.jsx)(q.Z,{color:h.auth?"green":"gray",children:h.auth?"Yes":"No"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(n.Z,{className:"font-medium",children:"Headers"}),h.headers&&Object.keys(h.headers).length>0?(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(X,{value:h.headers})}):(0,s.jsx)("div",{className:"text-gray-500",children:"No headers configured"})]})]})]})})]})]})]}):(0,s.jsx)("div",{className:"p-4",children:"Pass through endpoint not found"})},ee=t(60493);let el=e=>{let{value:l}=e,[t,r]=(0,a.useState)(!1),i=JSON.stringify(l);return(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("span",{className:"font-mono text-xs",children:t?i:"••••••••"}),(0,s.jsx)("button",{onClick:()=>r(!t),className:"p-1 hover:bg-gray-100 rounded",type:"button",children:t?(0,s.jsx)(Y.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)($.Z,{className:"w-4 h-4 text-gray-500"})})]})};var et=e=>{let{accessToken:l,userRole:t,userID:p,modelData:g,premiumUser:f}=e,[j,v]=(0,a.useState)([]),[_,y]=(0,a.useState)(null),[b,N]=(0,a.useState)(!1),[Z,w]=(0,a.useState)(null);(0,a.useEffect)(()=>{l&&t&&p&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})},[l,t,p]);let C=async e=>{w(e),N(!0)},k=async()=>{if(null!=Z&&l){try{await (0,d.deletePassThroughEndpointsCall)(l,Z);let e=j.filter(e=>e.id!==Z);v(e),F.ZP.success("Endpoint deleted successfully.")}catch(e){console.error("Error deleting the endpoint:",e),F.ZP.fromBackend("Error deleting the endpoint: "+e)}N(!1),w(null)}},S=(e,l)=>{C(e)},P=[{header:"ID",accessorKey:"id",cell:e=>(0,s.jsx)(c.Z,{title:e.row.original.id,children:(0,s.jsx)("div",{className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",onClick:()=>e.row.original.id&&y(e.row.original.id),children:e.row.original.id})})},{header:"Path",accessorKey:"path"},{header:"Target",accessorKey:"target",cell:e=>(0,s.jsx)(n.Z,{children:e.getValue()})},{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{children:"Authentication"}),(0,s.jsx)(c.Z,{title:"LiteLLM Virtual Key required to call endpoint",children:(0,s.jsx)(u.Z,{className:"w-4 h-4 text-gray-400 cursor-help"})})]}),accessorKey:"auth",cell:e=>(0,s.jsx)(m.Z,{color:e.getValue()?"green":"gray",children:e.getValue()?"Yes":"No"})},{header:"Headers",accessorKey:"headers",cell:e=>(0,s.jsx)(el,{value:e.getValue()||{}})},{header:"Actions",id:"actions",cell:e=>{let{row:l}=e;return(0,s.jsxs)("div",{className:"flex space-x-1",children:[(0,s.jsx)(i.Z,{icon:h.Z,size:"sm",onClick:()=>l.original.id&&y(l.original.id),title:"Edit"}),(0,s.jsx)(i.Z,{icon:x.Z,size:"sm",onClick:()=>S(l.original.id,l.index),title:"Delete"})]})}}];if(!l)return null;if(_){console.log("selectedEndpointId",_),console.log("generalSettings",j);let e=j.find(e=>e.id===_);return e?(0,s.jsx)(Q,{endpointData:e,onClose:()=>y(null),accessToken:l,isAdmin:"Admin"===t||"admin"===t,premiumUser:f,onEndpointUpdated:()=>{l&&(0,d.getPassThroughEndpointsCall)(l).then(e=>{v(e.endpoints)})}}):(0,s.jsx)("div",{children:"Endpoint not found"})}return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(o.Z,{children:"Pass Through Endpoints"}),(0,s.jsx)(n.Z,{className:"text-tremor-content",children:"Configure and manage your pass-through endpoints"})]}),(0,s.jsx)(V,{accessToken:l,setPassThroughItems:v,passThroughItems:j,premiumUser:f}),(0,s.jsx)(ee.w,{data:j,columns:P,renderSubComponent:()=>(0,s.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:!1,noDataMessage:"No pass-through endpoints configured"}),b&&(0,s.jsx)("div",{className:"fixed z-10 inset-0 overflow-y-auto",children:(0,s.jsxs)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0",children:[(0,s.jsx)("div",{className:"fixed inset-0 transition-opacity","aria-hidden":"true",children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gray-500 opacity-75"})}),(0,s.jsx)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true",children:"​"}),(0,s.jsxs)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full",children:[(0,s.jsx)("div",{className:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4",children:(0,s.jsx)("div",{className:"sm:flex sm:items-start",children:(0,s.jsxs)("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[(0,s.jsx)("h3",{className:"text-lg leading-6 font-medium text-gray-900",children:"Delete Pass-Through Endpoint"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"Are you sure you want to delete this pass-through endpoint? This action cannot be undone."})})]})})}),(0,s.jsxs)("div",{className:"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse",children:[(0,s.jsx)(r.Z,{onClick:k,color:"red",className:"ml-2",children:"Delete"}),(0,s.jsx)(r.Z,{onClick:()=>{N(!1),w(null)},children:"Cancel"})]})]})]})})]})}},60493:function(e,l,t){t.d(l,{w:function(){return o}});var s=t(57437),a=t(2265),r=t(71594),i=t(24525),n=t(19130);function o(e){let{data:l=[],columns:t,onRowClick:o,renderSubComponent:d,renderChildRows:c,getRowCanExpand:m,isLoading:u=!1,loadingMessage:h="\uD83D\uDE85 Loading logs...",noDataMessage:x="No logs found"}=e,p=!!(d||c)&&!!m,g=(0,r.b7)({data:l,columns:t,...p&&{getRowCanExpand:m},getRowId:(e,l)=>{var t;return null!==(t=null==e?void 0:e.request_id)&&void 0!==t?t:String(l)},getCoreRowModel:(0,i.sC)(),...p&&{getExpandedRowModel:(0,i.rV)()}});return(0,s.jsx)("div",{className:"rounded-lg custom-border overflow-x-auto w-full max-w-full box-border",children:(0,s.jsxs)(n.iA,{className:"[&_td]:py-0.5 [&_th]:py-1 table-fixed w-full box-border",style:{minWidth:"400px"},children:[(0,s.jsx)(n.ss,{children:g.getHeaderGroups().map(e=>(0,s.jsx)(n.SC,{children:e.headers.map(e=>(0,s.jsx)(n.xs,{className:"py-1 h-8",children:e.isPlaceholder?null:(0,r.ie)(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,s.jsx)(n.RM,{children:u?(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:h})})})}):g.getRowModel().rows.length>0?g.getRowModel().rows.map(e=>(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(n.SC,{className:"h-8 ".concat(o?"cursor-pointer hover:bg-gray-50":""),onClick:()=>null==o?void 0:o(e.original),children:e.getVisibleCells().map(e=>(0,s.jsx)(n.pj,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,r.ie)(e.column.columnDef.cell,e.getContext())},e.id))}),p&&e.getIsExpanded()&&c&&c({row:e}),p&&e.getIsExpanded()&&d&&!c&&(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:e.getVisibleCells().length,className:"p-0",children:(0,s.jsx)("div",{className:"w-full max-w-full overflow-hidden box-border",children:d({row:e})})})})]},e.id)):(0,s.jsx)(n.SC,{children:(0,s.jsx)(n.pj,{colSpan:t.length,className:"h-8 text-center",children:(0,s.jsx)("div",{className:"text-center text-gray-500",children:(0,s.jsx)("p",{children:x})})})})})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1098-f78fb04eeb42c4e0.js b/litellm/proxy/_experimental/out/_next/static/chunks/1098-f78fb04eeb42c4e0.js deleted file mode 100644 index 261ebebf8fd..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1098-f78fb04eeb42c4e0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1098],{30280:function(e,t,l){l.d(t,{EX:function(){return c},Km:function(){return o},Tv:function(){return u}});var s=l(71632),a=l(45345),r=l(90246),i=l(19250),n=l(39760);let o=(0,r.n)("keys"),d=async function(e,t,l){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};try{let a=(0,i.getProxyBaseUrl)(),r=new URLSearchParams(Object.entries({team_id:s.teamID,organization_id:s.organizationID,key_alias:s.selectedKeyAlias,key_hash:s.keyHash,user_id:s.userID,page:t,size:l,sort_by:s.sortBy,sort_order:s.sortOrder,expand:s.expand,status:s.status,return_full_object:"true",include_team_keys:"true",include_created_by_keys:"true"}).filter(e=>{let[,t]=e;return null!=t}).map(e=>{let[t,l]=e;return[t,String(l)]})),n="".concat(a?"".concat(a,"/key/list"):"/key/list","?").concat(r),o=await fetch(n,{method:"GET",headers:{[(0,i.getGlobalLitellmHeaderName)()]:"Bearer ".concat(e),"Content-Type":"application/json"}});if(!o.ok){let e=await o.json(),t=(0,i.deriveErrorMessage)(e);throw(0,i.handleError)(t),Error(t)}let d=await o.json();return console.log("/key/list API Response:",d),d}catch(e){throw console.error("Failed to list keys:",e),e}},c=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{accessToken:r}=(0,n.Z)();return(0,s.a)({queryKey:o.list({page:e,limit:t,...l}),queryFn:async()=>await d(r,e,t,l),enabled:!!r,staleTime:3e4,placeholderData:a.Wk})},m=(0,r.n)("deletedKeys"),u=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{accessToken:r}=(0,n.Z)();return(0,s.a)({queryKey:m.list({page:e,limit:t,...l}),queryFn:async()=>await d(r,e,t,{...l,status:"deleted"}),enabled:!!r,staleTime:3e4,placeholderData:a.Wk})}},89348:function(e,t,l){l.d(t,{$:function(){return x}});var s=l(57437),a=l(16312),r=l(42264),i=l(65869),n=l(99397),o=l(2265),d=l(37592),c=l(99981),m=l(49322),u=l(15051),h=l(32489);function g(e){let{group:t,onChange:l,availableModels:a,maxFallbacks:r}=e,i=a.filter(e=>e!==t.primaryModel),n=e=>{let s=t.fallbackModels.filter((t,l)=>l!==e);l({...t,fallbackModels:s})},o=t.fallbackModels.length{let s=[...t.fallbackModels];s.includes(e)&&(s=s.filter(t=>t!==e)),l({...t,primaryModel:e,fallbackModels:s})},showSearch:!0,filterOption:(e,t)=>{var l;return(null!==(l=null==t?void 0:t.label)&&void 0!==l?l:"").toLowerCase().includes(e.toLowerCase())},options:a.map(e=>({label:e,value:e}))}),!t.primaryModel&&(0,s.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-amber-600 text-xs bg-amber-50 p-2 rounded",children:[(0,s.jsx)(m.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Select a model to begin configuring fallbacks"})]})]}),(0,s.jsx)("div",{className:"flex items-center justify-center -my-4 z-10",children:(0,s.jsxs)("div",{className:"bg-indigo-50 text-indigo-500 px-4 py-1 rounded-full text-xs font-bold border border-indigo-100 flex items-center gap-2 shadow-sm",children:[(0,s.jsx)(u.Z,{className:"w-4 h-4"}),"IF FAILS, TRY..."]})}),(0,s.jsxs)("div",{className:"transition-opacity duration-300 ".concat(t.primaryModel?"opacity-100":"opacity-50 pointer-events-none"),children:[(0,s.jsxs)("label",{className:"block text-sm font-semibold text-gray-700 mb-2",children:["Fallback Chain ",(0,s.jsx)("span",{className:"text-red-500",children:"*"}),(0,s.jsxs)("span",{className:"text-xs text-gray-500 font-normal ml-2",children:["(Max ",r," fallbacks at a time)"]})]}),(0,s.jsxs)("div",{className:"bg-gray-50 rounded-xl p-4 border border-gray-200",children:[(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)(d.default,{mode:"multiple",className:"w-full",size:"large",placeholder:o?"Select fallback models to add...":"Maximum ".concat(r," fallbacks reached"),value:t.fallbackModels,onChange:e=>{let s=e.slice(0,r);l({...t,fallbackModels:s})},disabled:!t.primaryModel,options:i.map(e=>({label:e,value:e})),optionRender:(e,l)=>{let a=t.fallbackModels.includes(e.value),r=a?t.fallbackModels.indexOf(e.value)+1:null;return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[a&&null!==r&&(0,s.jsx)("span",{className:"flex items-center justify-center w-5 h-5 rounded bg-indigo-100 text-indigo-600 text-xs font-bold",children:r}),(0,s.jsx)("span",{children:e.label})]})},maxTagCount:"responsive",maxTagPlaceholder:e=>(0,s.jsx)(c.Z,{styles:{root:{pointerEvents:"none"}},title:e.map(e=>{let{value:t}=e;return t}).join(", "),children:(0,s.jsxs)("span",{children:["+",e.length," more"]})}),showSearch:!0,filterOption:(e,t)=>{var l;return(null!==(l=null==t?void 0:t.label)&&void 0!==l?l:"").toLowerCase().includes(e.toLowerCase())}}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-1 ml-1",children:o?"Search and select multiple models. Selected models will appear below in order. (".concat(t.fallbackModels.length,"/").concat(r," used)"):"Maximum ".concat(r," fallbacks reached. Remove some to add more.")})]}),(0,s.jsx)("div",{className:"space-y-2 min-h-[100px]",children:0===t.fallbackModels.length?(0,s.jsxs)("div",{className:"h-32 border-2 border-dashed border-gray-300 rounded-lg flex flex-col items-center justify-center text-gray-400",children:[(0,s.jsx)("span",{className:"text-sm",children:"No fallback models selected"}),(0,s.jsx)("span",{className:"text-xs mt-1",children:"Add models from the dropdown above"})]}):t.fallbackModels.map((e,t)=>(0,s.jsxs)("div",{className:"group flex items-center justify-between p-3 bg-white rounded-lg border border-gray-200 hover:border-indigo-300 hover:shadow-sm transition-all",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex items-center justify-center w-6 h-6 rounded bg-gray-100 text-gray-400 group-hover:text-indigo-500 group-hover:bg-indigo-50",children:(0,s.jsx)("span",{className:"text-xs font-bold",children:t+1})}),(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"font-medium text-gray-800",children:e})})]}),(0,s.jsx)("button",{type:"button",onClick:()=>n(t),className:"opacity-0 group-hover:opacity-100 transition-opacity text-gray-400 hover:text-red-500 p-1",children:(0,s.jsx)(h.Z,{className:"w-4 h-4"})})]},"".concat(e,"-").concat(t)))})]})]})]})}function x(e){let{groups:t,onGroupsChange:l,availableModels:d,maxFallbacks:c=10,maxGroups:m=5}=e,[u,h]=(0,o.useState)(t.length>0?t[0].id:"1");(0,o.useEffect)(()=>{t.length>0?t.some(e=>e.id===u)||h(t[0].id):h("1")},[t]);let x=()=>{if(t.length>=m)return;let e=Date.now().toString();l([...t,{id:e,primaryModel:null,fallbackModels:[]}]),h(e)},p=e=>{if(1===t.length){r.ZP.warning("At least one group is required");return}let s=t.filter(t=>t.id!==e);l(s),u===e&&s.length>0&&h(s[s.length-1].id)},y=e=>{l(t.map(t=>t.id===e.id?e:t))},f=t.map((e,l)=>{let a=e.primaryModel?e.primaryModel:"Group ".concat(l+1);return{key:e.id,label:a,closable:t.length>1,children:(0,s.jsx)(g,{group:e,onChange:y,availableModels:d,maxFallbacks:c})}});return 0===t.length?(0,s.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg border border-dashed border-gray-300",children:[(0,s.jsx)("p",{className:"text-gray-500 mb-4",children:"No fallback groups configured"}),(0,s.jsx)(a.z,{variant:"primary",onClick:x,icon:()=>(0,s.jsx)(n.Z,{className:"w-4 h-4"}),children:"Create First Group"})]}):(0,s.jsx)(i.default,{type:"editable-card",activeKey:u,onChange:h,onEdit:(e,l)=>{"add"===l?x():"remove"===l&&t.length>1&&p(e)},items:f,className:"fallback-tabs",tabBarStyle:{marginBottom:0},hideAdd:t.length>=m})}},62099:function(e,t,l){var s=l(57437),a=l(2265),r=l(37592),i=l(99981),n=l(23496),o=l(63709),d=l(15424),c=l(31283);let{Option:m}=r.default;t.Z=e=>{var t;let{form:l,autoRotationEnabled:u,onAutoRotationChange:h,rotationInterval:g,onRotationIntervalChange:x,isCreateMode:p=!1}=e,y=g&&!["7d","30d","90d","180d","365d"].includes(g),[f,j]=(0,a.useState)(y),[b,v]=(0,a.useState)(y?g:""),[_,N]=(0,a.useState)((null==l?void 0:null===(t=l.getFieldValue)||void 0===t?void 0:t.call(l,"duration"))||"");return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Key Expiry Settings"}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,s.jsx)("span",{children:"Expire Key"}),(0,s.jsx)(i.Z,{title:p?"Set when this key should expire. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days). Leave empty to never expire.":"Set when this key should expire. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days). Use -1 to never expire.",children:(0,s.jsx)(d.Z,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,s.jsx)(c.o,{name:"duration",placeholder:p?"e.g., 30d or leave empty to never expire":"e.g., 30d or -1 to never expire",className:"w-full",value:_,onValueChange:e=>{N(e),l&&"function"==typeof l.setFieldValue?l.setFieldValue("duration",e):l&&"function"==typeof l.setFieldsValue&&l.setFieldsValue({duration:e})}})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Auto-Rotation Settings"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,s.jsx)("span",{children:"Enable Auto-Rotation"}),(0,s.jsx)(i.Z,{title:"Key will automatically regenerate at the specified interval for enhanced security.",children:(0,s.jsx)(d.Z,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,s.jsx)(o.Z,{checked:u,onChange:h,size:"default",className:u?"":"bg-gray-400"})]}),u&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,s.jsx)("span",{children:"Rotation Interval"}),(0,s.jsx)(i.Z,{title:"How often the key should be automatically rotated. Choose the interval that best fits your security requirements.",children:(0,s.jsx)(d.Z,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(r.default,{value:f?"custom":g,onChange:e=>{"custom"===e?j(!0):(j(!1),v(""),x(e))},className:"w-full",placeholder:"Select interval",children:[(0,s.jsx)(m,{value:"7d",children:"7 days"}),(0,s.jsx)(m,{value:"30d",children:"30 days"}),(0,s.jsx)(m,{value:"90d",children:"90 days"}),(0,s.jsx)(m,{value:"180d",children:"180 days"}),(0,s.jsx)(m,{value:"365d",children:"365 days"}),(0,s.jsx)(m,{value:"custom",children:"Custom interval"})]}),f&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(c.o,{value:b,onChange:e=>{let t=e.target.value;v(t),x(t)},placeholder:"e.g., 1s, 5m, 2h, 14d"}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Supported formats: seconds (s), minutes (m), hours (h), days (d)"})]})]})]})]}),u&&(0,s.jsx)("div",{className:"bg-blue-50 p-3 rounded-md text-sm text-blue-700",children:"When rotation occurs, you'll receive a notification with the new key. The old key will be deactivated after a brief grace period."})]})]})}},72885:function(e,t,l){var s=l(57437),a=l(2265),r=l(77355),i=l(93416),n=l(74998),o=l(95704),d=l(76593),c=l(9114);t.Z=e=>{let{accessToken:t,initialModelAliases:l={},onAliasUpdate:m,showExampleConfig:u=!0}=e,[h,g]=(0,a.useState)([]),[x,p]=(0,a.useState)({aliasName:"",targetModel:""}),[y,f]=(0,a.useState)(null);(0,a.useEffect)(()=>{g(Object.entries(l).map((e,t)=>{let[l,s]=e;return{id:"".concat(t,"-").concat(l),aliasName:l,targetModel:s}}))},[l]);let j=e=>{f({...e})},b=()=>{if(!y)return;if(!y.aliasName||!y.targetModel){c.ZP.fromBackend("Please provide both alias name and target model");return}if(h.some(e=>e.id!==y.id&&e.aliasName===y.aliasName)){c.ZP.fromBackend("An alias with this name already exists");return}let e=h.map(e=>e.id===y.id?y:e);g(e),f(null);let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),m&&m(t),c.ZP.success("Alias updated successfully")},v=()=>{f(null)},_=e=>{let t=h.filter(t=>t.id!==e);g(t);let l={};t.forEach(e=>{l[e.aliasName]=e.targetModel}),m&&m(l),c.ZP.success("Alias deleted successfully")},N=h.reduce((e,t)=>(e[t.aliasName]=t.targetModel,e),{});return(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(o.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,s.jsx)("input",{type:"text",value:x.aliasName,onChange:e=>p({...x,aliasName:e.target.value}),placeholder:"e.g., gpt-4o",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model"}),(0,s.jsx)(d.Z,{accessToken:t,value:x.targetModel,placeholder:"Select target model",onChange:e=>p({...x,targetModel:e}),showLabel:!1})]}),(0,s.jsx)("div",{className:"flex items-end",children:(0,s.jsxs)("button",{onClick:()=>{if(!x.aliasName||!x.targetModel){c.ZP.fromBackend("Please provide both alias name and target model");return}if(h.some(e=>e.aliasName===x.aliasName)){c.ZP.fromBackend("An alias with this name already exists");return}let e=[...h,{id:"".concat(Date.now(),"-").concat(x.aliasName),aliasName:x.aliasName,targetModel:x.targetModel}];g(e),p({aliasName:"",targetModel:""});let t={};e.forEach(e=>{t[e.aliasName]=e.targetModel}),m&&m(t),c.ZP.success("Alias added successfully")},disabled:!x.aliasName||!x.targetModel,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(x.aliasName&&x.targetModel?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,s.jsx)(r.Z,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,s.jsx)(o.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,s.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(o.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(o.ss,{children:(0,s.jsxs)(o.SC,{children:[(0,s.jsx)(o.xs,{className:"py-1 h-8",children:"Alias Name"}),(0,s.jsx)(o.xs,{className:"py-1 h-8",children:"Target Model"}),(0,s.jsx)(o.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,s.jsxs)(o.RM,{children:[h.map(e=>(0,s.jsx)(o.SC,{className:"h-8",children:y&&y.id===e.id?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.pj,{className:"py-0.5",children:(0,s.jsx)("input",{type:"text",value:y.aliasName,onChange:e=>f({...y,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,s.jsx)(o.pj,{className:"py-0.5",children:(0,s.jsx)(d.Z,{accessToken:t,value:y.targetModel,onChange:e=>f({...y,targetModel:e}),showLabel:!1,style:{height:"32px"}})}),(0,s.jsx)(o.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:b,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,s.jsx)("button",{onClick:v,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.pj,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,s.jsx)(o.pj,{className:"py-0.5 text-sm text-gray-500",children:e.targetModel}),(0,s.jsx)(o.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:()=>j(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,s.jsx)(i.Z,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>_(e.id),className:"text-xs bg-red-50 text-red-600 px-2 py-1 rounded hover:bg-red-100",children:(0,s.jsx)(n.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===h.length&&(0,s.jsx)(o.SC,{children:(0,s.jsx)(o.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No aliases added yet. Add a new alias above."})})]})]})})}),u&&(0,s.jsxs)(o.Zb,{children:[(0,s.jsx)(o.Dx,{className:"mb-4",children:"Configuration Example"}),(0,s.jsx)(o.xv,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config:"}),(0,s.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,s.jsxs)("div",{className:"text-gray-700",children:["model_aliases:",0===Object.keys(N).length?(0,s.jsxs)("span",{className:"text-gray-500",children:[(0,s.jsx)("br",{}),"\xa0\xa0# No aliases configured yet"]}):Object.entries(N).map(e=>{let[t,l]=e;return(0,s.jsxs)("span",{children:[(0,s.jsx)("br",{}),'\xa0\xa0"',t,'": "',l,'"']},t)})]})})]})]})}},76593:function(e,t,l){var s=l(57437),a=l(2265),r=l(56522),i=l(37592),n=l(69993),o=l(10703);t.Z=e=>{let{accessToken:t,value:l,placeholder:d="Select a Model",onChange:c,disabled:m=!1,style:u,className:h,showLabel:g=!0,labelText:x="Select Model"}=e,[p,y]=(0,a.useState)(l),[f,j]=(0,a.useState)(!1),[b,v]=(0,a.useState)([]),_=(0,a.useRef)(null);return(0,a.useEffect)(()=>{y(l)},[l]),(0,a.useEffect)(()=>{t&&(async()=>{try{let e=await (0,o.p)(t);console.log("Fetched models for selector:",e),e.length>0&&v(e)}catch(e){console.error("Error fetching model info:",e)}})()},[t]),(0,s.jsxs)("div",{children:[g&&(0,s.jsxs)(r.x,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,s.jsx)(n.Z,{className:"mr-2"})," ",x]}),(0,s.jsx)(i.default,{value:p,placeholder:d,onChange:e=>{"custom"===e?(j(!0),y(void 0)):(j(!1),y(e),c&&c(e))},options:[...Array.from(new Set(b.map(e=>e.model_group))).map((e,t)=>({value:e,label:e,key:t})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...u},showSearch:!0,className:"rounded-md ".concat(h||""),disabled:m}),f&&(0,s.jsx)(r.o,{className:"mt-2",placeholder:"Enter custom model name",onValueChange:e=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{y(e),c&&c(e)},500)},disabled:m})]})}},2597:function(e,t,l){var s=l(57437);l(2265);var a=l(92280),r=l(54507);t.Z=function(e){let{value:t,onChange:l,premiumUser:i=!1,disabledCallbacks:n=[],onDisabledCallbacksChange:o}=e;return i?(0,s.jsx)(r.Z,{value:t,onChange:l,disabledCallbacks:n,onDisabledCallbacksChange:o}):(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,s.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ langfuse-logging"}),(0,s.jsx)("div",{className:"inline-flex items-center px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-green-800 text-sm font-medium opacity-50",children:"✨ datadog-logging"})]}),(0,s.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,s.jsxs)(a.x,{className:"text-sm text-yellow-800",children:["Setting Key/Team logging settings is a LiteLLM Enterprise feature. Global Logging Settings are available for all free users. Get a trial key"," ",(0,s.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})}},65895:function(e,t,l){var s=l(57437);l(2265);var a=l(37592),r=l(10032),i=l(99981),n=l(15424);let{Option:o}=a.default;t.Z=e=>{let{type:t,name:l,showDetailedDescriptions:d=!0,className:c="",initialValue:m=null,form:u,onChange:h}=e,g=t.toUpperCase(),x=t.toLowerCase(),p="Select 'guaranteed_throughput' to prevent overallocating ".concat(g," limit when the key belongs to a Team with specific ").concat(g," limits.");return(0,s.jsx)(r.Z.Item,{label:(0,s.jsxs)("span",{children:[g," Rate Limit Type"," ",(0,s.jsx)(i.Z,{title:p,children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:l,initialValue:m,className:c,children:(0,s.jsx)(a.default,{defaultValue:d?"default":void 0,placeholder:"Select rate limit type",style:{width:"100%"},optionLabelProp:d?"label":void 0,onChange:e=>{u&&u.setFieldValue(l,e),h&&h(e)},children:d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o,{value:"best_effort_throughput",label:"Default",children:(0,s.jsxs)("div",{style:{padding:"4px 0"},children:[(0,s.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,s.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Best effort throughput - no error if we're overallocating ",x," (Team/Key Limits checked at runtime)."]})]})}),(0,s.jsx)(o,{value:"guaranteed_throughput",label:"Guaranteed throughput",children:(0,s.jsxs)("div",{style:{padding:"4px 0"},children:[(0,s.jsx)("div",{style:{fontWeight:500},children:"Guaranteed throughput"}),(0,s.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["Guaranteed throughput - raise an error if we're overallocating ",x," (also checks model-specific limits)"]})]})}),(0,s.jsx)(o,{value:"dynamic",label:"Dynamic",children:(0,s.jsxs)("div",{style:{padding:"4px 0"},children:[(0,s.jsx)("div",{style:{fontWeight:500},children:"Dynamic"}),(0,s.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["If the key has a set ",g," (e.g. 2 ",g,") and there are no 429 errors, it can dynamically exceed the limit when the model being called is not erroring."]})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o,{value:"best_effort_throughput",children:"Best effort throughput"}),(0,s.jsx)(o,{value:"guaranteed_throughput",children:"Guaranteed throughput"}),(0,s.jsx)(o,{value:"dynamic",children:"Dynamic"})]})})})}},76364:function(e,t,l){var s=l(57437),a=l(2265),r=l(58643),i=l(19250),n=l(56334),o=l(89348),d=l(10703);let c=(0,a.forwardRef)((e,t)=>{let{accessToken:l,value:c,onChange:m,modelData:u}=e,[h,g]=(0,a.useState)({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),[x,p]=(0,a.useState)([]),[y,f]=(0,a.useState)([]),[j,b]=(0,a.useState)([]),[v,_]=(0,a.useState)([]),[N,w]=(0,a.useState)({}),[k,S]=(0,a.useState)({}),Z=(0,a.useRef)(!1),C=(0,a.useRef)(null),M=e=>e&&0!==e.length?e.map((e,t)=>{let[l,s]=Object.entries(e)[0];return{id:(t+1).toString(),primaryModel:l||null,fallbackModels:s||[]}}):[{id:"1",primaryModel:null,fallbackModels:[]}],P=e=>e.filter(e=>e.primaryModel&&e.fallbackModels.length>0).map(e=>({[e.primaryModel]:e.fallbackModels}));(0,a.useEffect)(()=>{let e=(null==c?void 0:c.router_settings)?JSON.stringify({routing_strategy:c.router_settings.routing_strategy,fallbacks:c.router_settings.fallbacks,enable_tag_filtering:c.router_settings.enable_tag_filtering}):null;if(Z.current&&e===C.current){Z.current=!1;return}if(Z.current&&e!==C.current&&(Z.current=!1),e!==C.current){if(C.current=e,null==c?void 0:c.router_settings){var t;let e=c.router_settings,{fallbacks:l,...s}=e;g({routerSettings:s,selectedStrategy:e.routing_strategy||null,enableTagFiltering:null!==(t=e.enable_tag_filtering)&&void 0!==t&&t});let a=e.fallbacks||[];p(a),f(M(a))}else g({routerSettings:{},selectedStrategy:null,enableTagFiltering:!1}),p([]),f([{id:"1",primaryModel:null,fallbackModels:[]}])}},[c]),(0,a.useEffect)(()=>{l&&(0,i.getRouterSettingsCall)(l).then(e=>{if(e.fields){let t={};e.fields.forEach(e=>{t[e.field_name]={ui_field_name:e.ui_field_name,field_description:e.field_description,options:e.options,link:e.link}}),w(t);let l=e.fields.find(e=>"routing_strategy"===e.field_name);(null==l?void 0:l.options)&&_(l.options),e.routing_strategy_descriptions&&S(e.routing_strategy_descriptions)}})},[l]),(0,a.useEffect)(()=>{l&&(async()=>{try{let e=await (0,d.p)(l);b(e)}catch(e){console.error("Error fetching model info for fallbacks:",e)}})()},[l]);let T=()=>{let e=new Set(["allowed_fails","cooldown_time","num_retries","timeout","retry_after"]),t=new Set(["model_group_alias","retry_policy"]),l=(l,s,a)=>{if(null==s)return a;let r=String(s).trim();if(""===r||"null"===r.toLowerCase())return null;if(e.has(l)){let e=Number(r);return Number.isNaN(e)?a:e}if(t.has(l)){if(""===r)return null;try{return JSON.parse(r)}catch(e){return a}}return"true"===r.toLowerCase()||"false"!==r.toLowerCase()&&r},s=Object.fromEntries(Object.entries({...h.routerSettings,enable_tag_filtering:h.enableTagFiltering,routing_strategy:h.selectedStrategy,fallbacks:x.length>0?x:null}).map(e=>{let[t,s]=e;if("routing_strategy_args"!==t&&"routing_strategy"!==t&&"enable_tag_filtering"!==t&&"fallbacks"!==t){let e=document.querySelector('input[name="'.concat(t,'"]'));if(e&&void 0!==e.value&&""!==e.value){let a=l(t,e.value,s);return[t,a]}}else if("routing_strategy"===t)return[t,h.selectedStrategy];else if("enable_tag_filtering"===t)return[t,h.enableTagFiltering];else if("fallbacks"===t)return[t,x.length>0?x:null];else if("routing_strategy_args"===t&&"latency-based-routing"===h.selectedStrategy){let e=document.querySelector('input[name="lowest_latency_buffer"]'),t=document.querySelector('input[name="ttl"]'),l={};return(null==e?void 0:e.value)&&(l.lowest_latency_buffer=Number(e.value)),(null==t?void 0:t.value)&&(l.ttl=Number(t.value)),["routing_strategy_args",Object.keys(l).length>0?l:null]}return[t,s]}).filter(e=>null!=e)),a=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return null==e||"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length||t&&("number"!=typeof e||Number.isNaN(e))?null:e};return{routing_strategy:a(s.routing_strategy),allowed_fails:a(s.allowed_fails,!0),cooldown_time:a(s.cooldown_time,!0),num_retries:a(s.num_retries,!0),timeout:a(s.timeout,!0),retry_after:a(s.retry_after,!0),fallbacks:x.length>0?x:null,context_window_fallbacks:a(s.context_window_fallbacks),retry_policy:a(s.retry_policy),model_group_alias:a(s.model_group_alias),enable_tag_filtering:h.enableTagFiltering,routing_strategy_args:a(s.routing_strategy_args)}};(0,a.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>{Z.current=!0,m({router_settings:T()})},100);return()=>clearTimeout(e)},[h,x]);let L=Array.from(new Set(j.map(e=>e.model_group))).sort();return((0,a.useImperativeHandle)(t,()=>({getValue:()=>({router_settings:T()})})),l)?(0,s.jsx)("div",{className:"w-full",children:(0,s.jsxs)(r.v0,{className:"w-full",children:[(0,s.jsxs)(r.td,{variant:"line",defaultValue:"1",className:"px-8 pt-4",children:[(0,s.jsx)(r.OK,{value:"1",children:"Loadbalancing"}),(0,s.jsx)(r.OK,{value:"2",children:"Fallbacks"})]}),(0,s.jsxs)(r.nP,{className:"px-8 py-6",children:[(0,s.jsx)(r.x4,{children:(0,s.jsx)(n.Z,{value:h,onChange:g,routerFieldsMetadata:N,availableRoutingStrategies:v,routingStrategyDescriptions:k})}),(0,s.jsx)(r.x4,{children:(0,s.jsx)(o.$,{groups:y,onGroupsChange:e=>{f(e),p(P(e))},availableModels:L,maxGroups:5})})]})]})}):null});c.displayName="RouterSettingsAccordion",t.Z=c},71098:function(e,t,l){l.d(t,{ZP:function(){return et},wk:function(){return X},Nr:function(){return ee}});var s=l(57437),a=l(30280),r=l(39760),i=l(59872),n=l(15424),o=l(29827),d=l(87452),c=l(88829),m=l(72208),u=l(78489),h=l(49804),g=l(67101),x=l(84264),p=l(49566),y=l(96761),f=l(37592),j=l(10032),b=l(22116),v=l(99981),_=l(29967),N=l(5545),w=l(63709),k=l(4260),S=l(7310),Z=l.n(S),C=l(2265),M=l(29233),P=l(20347),T=l(82586),L=l(97434),A=l(65925),F=l(63610),E=l(62099),I=l(72885),V=l(95096),R=l(2597),O=l(65895),D=l(76364),K=l(84376),U=l(25407),q=l(46468),B=l(97492),G=l(68473),z=l(9114),J=l(19250),W=l(24199),H=l(97415);let Y=e=>{let t;if(!(t=!e||"object"!=typeof e||e instanceof Error?String(e):JSON.stringify(e)).includes("/key/generate")&&!t.includes("KeyManagementRoutes.KEY_GENERATE"))return"Error creating the key: ".concat(e);let l=t;try{if(!e||"object"!=typeof e||e instanceof Error){let e=t.match(/\{[\s\S]*\}/);if(e){let t=JSON.parse(e[0]),s=(null==t?void 0:t.error)||t;(null==s?void 0:s.message)&&(l=s.message)}}else{let t=(null==e?void 0:e.error)||e;(null==t?void 0:t.message)&&(l=t.message)}}catch(e){}return t.includes("team_member_permission_error")||l.includes("Team member does not have permissions")?"Team member does not have permission to generate key for this team. Ask your proxy admin to configure the team member permission settings.":"Error creating the key: ".concat(e)},{Option:$}=f.default,Q=e=>{let t=[];if(console.log("data:",JSON.stringify(e)),e)for(let l of e)l.metadata&&l.metadata.tags&&t.push(...l.metadata.tags);let l=Array.from(new Set(t)).map(e=>({value:e,label:e}));return console.log("uniqueTags:",l),l},X=async(e,t,l,s)=>{try{if(null===e||null===t)return[];if(null!==l){let a=(await (0,J.modelAvailableCall)(l,e,t,!0,s,!0)).data.map(e=>e.id);return console.log("available_model_names:",a),a}return[]}catch(e){return console.error("Error fetching user models:",e),[]}},ee=async(e,t,l,s)=>{try{if(null===e||null===t)return;if(null!==l){let a=(await (0,J.modelAvailableCall)(l,e,t)).data.map(e=>e.id);console.log("available_model_names:",a),s(a)}}catch(e){console.error("Error fetching user models:",e)}};var et=e=>{let{team:t,teams:l,data:S,addKey:et}=e,{accessToken:el,userId:es,userRole:ea,premiumUser:er}=(0,r.Z)(),ei=(0,o.NL)(),[en]=j.Z.useForm(),[eo,ed]=(0,C.useState)(!1),[ec,em]=(0,C.useState)(null),[eu,eh]=(0,C.useState)(null),[eg,ex]=(0,C.useState)([]),[ep,ey]=(0,C.useState)([]),[ef,ej]=(0,C.useState)("you"),[eb,ev]=(0,C.useState)(Q(S)),[e_,eN]=(0,C.useState)([]),[ew,ek]=(0,C.useState)([]),[eS,eZ]=(0,C.useState)([]),[eC,eM]=(0,C.useState)([]),[eP,eT]=(0,C.useState)(t),[eL,eA]=(0,C.useState)(!1),[eF,eE]=(0,C.useState)(null),[eI,eV]=(0,C.useState)({}),[eR,eO]=(0,C.useState)([]),[eD,eK]=(0,C.useState)(!1),[eU,eq]=(0,C.useState)([]),[eB,eG]=(0,C.useState)([]),[ez,eJ]=(0,C.useState)("llm_api"),[eW,eH]=(0,C.useState)({}),[eY,e$]=(0,C.useState)(!1),[eQ,eX]=(0,C.useState)("30d"),[e0,e4]=(0,C.useState)(null),[e1,e2]=(0,C.useState)(0),e5=()=>{ed(!1),en.resetFields(),eM([]),eG([]),eJ("llm_api"),eH({}),e$(!1),eX("30d"),e4(null),e2(e=>e+1)},e3=()=>{ed(!1),em(null),eT(null),en.resetFields(),eM([]),eG([]),eJ("llm_api"),eH({}),e$(!1),eX("30d"),e4(null),e2(e=>e+1)};(0,C.useEffect)(()=>{es&&ea&&el&&ee(es,ea,el,ex)},[el,es,ea]),(0,C.useEffect)(()=>{let e=async()=>{try{let e=(await (0,J.getPoliciesList)(el)).policies.map(e=>e.policy_name);ek(e)}catch(e){console.error("Failed to fetch policies:",e)}},t=async()=>{try{let e=await (0,J.getPromptsList)(el);eZ(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}};(async()=>{try{let e=(await (0,J.getGuardrailsList)(el)).guardrails.map(e=>e.guardrail_name);eN(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e(),t()},[el]),(0,C.useEffect)(()=>{(async()=>{try{if(el){let e=sessionStorage.getItem("possibleUserRoles");if(e)eV(JSON.parse(e));else{let e=await (0,J.getPossibleUserRoles)(el);sessionStorage.setItem("possibleUserRoles",JSON.stringify(e)),eV(e)}}}catch(e){console.error("Error fetching possible user roles:",e)}})()},[el]);let e7=ep.includes("no-default-models")&&!eP,e6=async e=>{try{var t,l,s,r,i,n,o;let d;let c=null!==(i=null==e?void 0:e.key_alias)&&void 0!==i?i:"",m=null!==(n=null==e?void 0:e.team_id)&&void 0!==n?n:null;if((null!==(o=null==S?void 0:S.filter(e=>e.team_id===m).map(e=>e.key_alias))&&void 0!==o?o:[]).includes(c))throw Error("Key alias ".concat(c," already exists for team with ID ").concat(m,", please provide another key alias"));z.ZP.info("Making API Call"),ed(!0),"you"===ef&&(e.user_id=es);let u={};try{u=JSON.parse(e.metadata||"{}")}catch(e){console.error("Error parsing metadata:",e)}if("service_account"===ef&&(u.service_account_id=e.key_alias),eC.length>0&&(u={...u,logging:eC.filter(e=>e.callback_name)}),eB.length>0){let e=(0,L.Z3)(eB);u={...u,litellm_disabled_callbacks:e}}if(eY&&(e.auto_rotate=!0,e.rotation_interval=eQ),e.duration&&""!==e.duration.trim()||(e.duration=null),e.metadata=JSON.stringify(u),e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0&&(e.object_permission={vector_stores:e.allowed_vector_store_ids},delete e.allowed_vector_store_ids),e.allowed_mcp_servers_and_groups&&((null===(t=e.allowed_mcp_servers_and_groups.servers)||void 0===t?void 0:t.length)>0||(null===(l=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===l?void 0:l.length)>0)){e.object_permission||(e.object_permission={});let{servers:t,accessGroups:l}=e.allowed_mcp_servers_and_groups;t&&t.length>0&&(e.object_permission.mcp_servers=t),l&&l.length>0&&(e.object_permission.mcp_access_groups=l),delete e.allowed_mcp_servers_and_groups}let h=e.mcp_tool_permissions||{};if(Object.keys(h).length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_tool_permissions=h),delete e.mcp_tool_permissions,e.allowed_mcp_access_groups&&e.allowed_mcp_access_groups.length>0&&(e.object_permission||(e.object_permission={}),e.object_permission.mcp_access_groups=e.allowed_mcp_access_groups,delete e.allowed_mcp_access_groups),e.allowed_agents_and_groups&&((null===(s=e.allowed_agents_and_groups.agents)||void 0===s?void 0:s.length)>0||(null===(r=e.allowed_agents_and_groups.accessGroups)||void 0===r?void 0:r.length)>0)){e.object_permission||(e.object_permission={});let{agents:t,accessGroups:l}=e.allowed_agents_and_groups;t&&t.length>0&&(e.object_permission.agents=t),l&&l.length>0&&(e.object_permission.agent_access_groups=l),delete e.allowed_agents_and_groups}Object.keys(eW).length>0&&(e.aliases=JSON.stringify(eW)),(null==e0?void 0:e0.router_settings)&&Object.values(e0.router_settings).some(e=>null!=e&&""!==e)&&(e.router_settings=e0.router_settings),d="service_account"===ef?await (0,J.keyCreateServiceAccountCall)(el,e):await (0,J.keyCreateCall)(el,es,e),console.log("key create Response:",d),et(d),ei.invalidateQueries({queryKey:a.Km.lists()}),em(d.key),eh(d.soft_budget),z.ZP.success("Virtual Key Created"),en.resetFields(),localStorage.removeItem("userData"+es)}catch(t){console.log("error in create key:",t);let e=Y(t);z.ZP.fromBackend(e)}};(0,C.useEffect)(()=>{if(es&&ea&&el){var e;X(es,ea,el,null!==(e=null==eP?void 0:eP.team_id)&&void 0!==e?e:null).then(e=>{var t;ey(Array.from(new Set([...null!==(t=null==eP?void 0:eP.models)&&void 0!==t?t:[],...e])))})}en.setFieldValue("models",[])},[eP,el,es,ea]);let e9=async e=>{if(!e){eO([]);return}eK(!0);try{let t=new URLSearchParams;if(t.append("user_email",e),null==el)return;let l=(await (0,J.userFilterUICall)(el,t)).map(e=>({label:"".concat(e.user_email," (").concat(e.user_id,")"),value:e.user_id,user:e}));eO(l)}catch(e){console.error("Error fetching users:",e),z.ZP.fromBackend("Failed to search for users")}finally{eK(!1)}},e8=(0,C.useCallback)(Z()(e=>e9(e),300),[el]),te=(e,t)=>{let l=t.user;en.setFieldsValue({user_id:l.user_id})};return(0,s.jsxs)("div",{children:[ea&&P.LQ.includes(ea)&&(0,s.jsx)(u.Z,{className:"mx-auto",onClick:()=>ed(!0),children:"+ Create New Key"}),(0,s.jsx)(b.Z,{open:eo,width:1e3,footer:null,onOk:e5,onCancel:e3,children:(0,s.jsxs)(j.Z,{form:en,onFinish:e6,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsx)(y.Z,{className:"mb-4",children:"Key Ownership"}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Owned By"," ",(0,s.jsx)(v.Z,{title:"Select who will own this Virtual Key",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),className:"mb-4",children:(0,s.jsxs)(_.ZP.Group,{onChange:e=>ej(e.target.value),value:ef,children:[(0,s.jsx)(_.ZP,{value:"you",children:"You"}),(0,s.jsx)(_.ZP,{value:"service_account",children:"Service Account"}),"Admin"===ea&&(0,s.jsx)(_.ZP,{value:"another_user",children:"Another User"})]})}),"another_user"===ef&&(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["User ID"," ",(0,s.jsx)(v.Z,{title:"The user who will own this key and be responsible for its usage",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"user_id",className:"mt-4",rules:[{required:"another_user"===ef,message:"Please input the user ID of the user you are assigning the key to"}],children:(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{display:"flex",marginBottom:"8px"},children:[(0,s.jsx)(f.default,{showSearch:!0,placeholder:"Type email to search for users",filterOption:!1,onSearch:e=>{e8(e)},onSelect:(e,t)=>te(e,t),options:eR,loading:eD,allowClear:!0,style:{width:"100%"},notFoundContent:eD?"Searching...":"No users found"}),(0,s.jsx)(N.ZP,{onClick:()=>eA(!0),style:{marginLeft:"8px"},children:"Create User"})]}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Search by email to find users"})]})}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Team"," ",(0,s.jsx)(v.Z,{title:"The team this key belongs to, which determines available models and budget limits",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"team_id",initialValue:t?t.team_id:null,className:"mt-4",rules:[{required:"service_account"===ef,message:"Please select a team for the service account"}],help:"service_account"===ef?"required":"",children:(0,s.jsx)(K.Z,{teams:l,onChange:e=>{eT((null==l?void 0:l.find(t=>t.team_id===e))||null)}})})]}),e7&&(0,s.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,s.jsx)(x.Z,{className:"text-blue-800 text-sm",children:"Please select a team to continue configuring your Virtual Key. If you do not see any teams, please contact your Proxy Admin to either provide you with access to models or to add you to a team."})}),!e7&&(0,s.jsxs)("div",{className:"mb-8",children:[(0,s.jsx)(y.Z,{className:"mb-4",children:"Key Details"}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["you"===ef||"another_user"===ef?"Key Name":"Service Account ID"," ",(0,s.jsx)(v.Z,{title:"you"===ef||"another_user"===ef?"A descriptive name to identify this key":"Unique identifier for this service account",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"key_alias",rules:[{required:!0,message:"Please input a ".concat("you"===ef?"key name":"service account ID")}],help:"required",children:(0,s.jsx)(p.Z,{placeholder:""})}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Models"," ",(0,s.jsx)(v.Z,{title:"Select which models this key can access. Choose 'All Team Models' to grant access to all models available to the team",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"models",rules:"management"===ez||"read_only"===ez?[]:[{required:!0,message:"Please select a model"}],help:"management"===ez||"read_only"===ez?"Models field is disabled for this key type":"required",className:"mt-4",children:(0,s.jsxs)(f.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:"management"===ez||"read_only"===ez,onChange:e=>{e.includes("all-team-models")&&en.setFieldsValue({models:["all-team-models"]})},children:[(0,s.jsx)($,{value:"all-team-models",children:"All Team Models"},"all-team-models"),ep.map(e=>(0,s.jsx)($,{value:e,children:(0,q.W0)(e)},e))]})}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Key Type"," ",(0,s.jsx)(v.Z,{title:"Select the type of key to determine what routes and operations this key can access",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"key_type",initialValue:"llm_api",className:"mt-4",children:(0,s.jsxs)(f.default,{defaultValue:"llm_api",placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",onChange:e=>{eJ(e),("management"===e||"read_only"===e)&&en.setFieldsValue({models:[]})},children:[(0,s.jsx)($,{value:"default",label:"Default",children:(0,s.jsxs)("div",{style:{padding:"4px 0"},children:[(0,s.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,s.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call LLM API + Management routes"})]})}),(0,s.jsx)($,{value:"llm_api",label:"LLM API",children:(0,s.jsxs)("div",{style:{padding:"4px 0"},children:[(0,s.jsx)("div",{style:{fontWeight:500},children:"LLM API"}),(0,s.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only LLM API routes (chat/completions, embeddings, etc.)"})]})}),(0,s.jsx)($,{value:"management",label:"Management",children:(0,s.jsxs)("div",{style:{padding:"4px 0"},children:[(0,s.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,s.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})})]}),!e7&&(0,s.jsx)("div",{className:"mb-8",children:(0,s.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,s.jsx)(m.Z,{children:(0,s.jsx)(y.Z,{className:"m-0",children:"Optional Settings"})}),(0,s.jsxs)(c.Z,{children:[(0,s.jsx)(j.Z.Item,{className:"mt-4",label:(0,s.jsxs)("span",{children:["Max Budget (USD)"," ",(0,s.jsx)(v.Z,{title:"Maximum amount in USD this key can spend. When reached, the key will be blocked from making further requests",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"max_budget",help:"Budget cannot exceed team max budget: $".concat((null==t?void 0:t.max_budget)!==null&&(null==t?void 0:t.max_budget)!==void 0?null==t?void 0:t.max_budget:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&t&&null!==t.max_budget&&l>t.max_budget)throw Error("Budget cannot exceed team max budget: $".concat((0,i.pw)(t.max_budget,4)))}}],children:(0,s.jsx)(W.Z,{step:.01,precision:2,width:200})}),(0,s.jsx)(j.Z.Item,{className:"mt-4",label:(0,s.jsxs)("span",{children:["Reset Budget"," ",(0,s.jsx)(v.Z,{title:"How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",help:"Team Reset Budget: ".concat((null==t?void 0:t.budget_duration)!==null&&(null==t?void 0:t.budget_duration)!==void 0?null==t?void 0:t.budget_duration:"None"),children:(0,s.jsx)(A.Z,{onChange:e=>en.setFieldValue("budget_duration",e)})}),(0,s.jsx)(j.Z.Item,{className:"mt-4",label:(0,s.jsxs)("span",{children:["Tokens per minute Limit (TPM)"," ",(0,s.jsx)(v.Z,{title:"Maximum number of tokens this key can process per minute. Helps control usage and costs",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"tpm_limit",help:"TPM cannot exceed team TPM limit: ".concat((null==t?void 0:t.tpm_limit)!==null&&(null==t?void 0:t.tpm_limit)!==void 0?null==t?void 0:t.tpm_limit:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&t&&null!==t.tpm_limit&&l>t.tpm_limit)throw Error("TPM limit cannot exceed team TPM limit: ".concat(t.tpm_limit))}}],children:(0,s.jsx)(W.Z,{step:1,width:400})}),(0,s.jsx)(O.Z,{type:"tpm",name:"tpm_limit_type",className:"mt-4",initialValue:null,form:en,showDetailedDescriptions:!0}),(0,s.jsx)(j.Z.Item,{className:"mt-4",label:(0,s.jsxs)("span",{children:["Requests per minute Limit (RPM)"," ",(0,s.jsx)(v.Z,{title:"Maximum number of API requests this key can make per minute. Helps prevent abuse and manage load",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"rpm_limit",help:"RPM cannot exceed team RPM limit: ".concat((null==t?void 0:t.rpm_limit)!==null&&(null==t?void 0:t.rpm_limit)!==void 0?null==t?void 0:t.rpm_limit:"unlimited"),rules:[{validator:async(e,l)=>{if(l&&t&&null!==t.rpm_limit&&l>t.rpm_limit)throw Error("RPM limit cannot exceed team RPM limit: ".concat(t.rpm_limit))}}],children:(0,s.jsx)(W.Z,{step:1,width:400})}),(0,s.jsx)(O.Z,{type:"rpm",name:"rpm_limit_type",className:"mt-4",initialValue:null,form:en,showDetailedDescriptions:!0}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(v.Z,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:er?"Select existing guardrails or enter new ones":"Premium feature - Upgrade to set guardrails by key",children:(0,s.jsx)(f.default,{mode:"tags",style:{width:"100%"},disabled:!er,placeholder:er?"Select or enter guardrails":"Premium feature - Upgrade to set guardrails by key",options:e_.map(e=>({value:e,label:e}))})}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,s.jsx)(v.Z,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})})]}),name:"disable_global_guardrails",className:"mt-4",valuePropName:"checked",help:er?"Bypass global guardrails for this key":"Premium feature - Upgrade to disable global guardrails by key",children:(0,s.jsx)(w.Z,{disabled:!er,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Policies"," ",(0,s.jsx)(v.Z,{title:"Apply policies to this key to control guardrails and other settings",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/guardrail_policies",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})})]}),name:"policies",className:"mt-4",help:er?"Select existing policies or enter new ones":"Premium feature - Upgrade to set policies by key",children:(0,s.jsx)(f.default,{mode:"tags",style:{width:"100%"},disabled:!er,placeholder:er?"Select or enter policies":"Premium feature - Upgrade to set policies by key",options:ew.map(e=>({value:e,label:e}))})}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Prompts"," ",(0,s.jsx)(v.Z,{title:"Allow this key to use specific prompt templates",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/prompt_management",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})})]}),name:"prompts",className:"mt-4",help:er?"Select existing prompts or enter new ones":"Premium feature - Upgrade to set prompts by key",children:(0,s.jsx)(f.default,{mode:"tags",style:{width:"100%"},disabled:!er,placeholder:er?"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:eS.map(e=>({value:e,label:e}))})}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Allowed Pass Through Routes"," ",(0,s.jsx)(v.Z,{title:"Allow this key to use specific pass through routes",children:(0,s.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})})]}),name:"allowed_passthrough_routes",className:"mt-4",help:er?"Select existing pass through routes or enter new ones":"Premium feature - Upgrade to set pass through routes by key",children:(0,s.jsx)(V.Z,{onChange:e=>en.setFieldValue("allowed_passthrough_routes",e),value:en.getFieldValue("allowed_passthrough_routes"),accessToken:el,placeholder:er?"Select or enter pass through routes":"Premium feature - Upgrade to set pass through routes by key",disabled:!er,teamId:eP?eP.team_id:null})}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,s.jsx)(v.Z,{title:"Select which vector stores this key can access. If none selected, the key will have access to all available vector stores",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this key can access. Leave empty for access to all vector stores",children:(0,s.jsx)(H.Z,{onChange:e=>en.setFieldValue("allowed_vector_store_ids",e),value:en.getFieldValue("allowed_vector_store_ids"),accessToken:el,placeholder:"Select vector stores (optional)"})}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Metadata"," ",(0,s.jsx)(v.Z,{title:"JSON object with additional information about this key. Used for tracking or custom logic",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"metadata",className:"mt-4",children:(0,s.jsx)(k.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Tags"," ",(0,s.jsx)(v.Z,{title:"Tags for tracking spend and/or doing tag-based routing. Used for analytics and filtering",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"tags",className:"mt-4",help:"Tags for tracking spend and/or doing tag-based routing.",children:(0,s.jsx)(f.default,{mode:"tags",style:{width:"100%"},placeholder:"Enter tags",tokenSeparators:[","],options:eb})}),(0,s.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,s.jsx)(m.Z,{children:(0,s.jsx)("b",{children:"MCP Settings"})}),(0,s.jsxs)(c.Z,{children:[(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,s.jsx)(v.Z,{title:"Select which MCP servers or access groups this key can access",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",help:"Select MCP servers or access groups this key can access",children:(0,s.jsx)(B.Z,{onChange:e=>en.setFieldValue("allowed_mcp_servers_and_groups",e),value:en.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:el,placeholder:"Select MCP servers or access groups (optional)"})}),(0,s.jsx)(j.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,s.jsx)(k.default,{type:"hidden"})}),(0,s.jsx)(j.Z.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.allowed_mcp_servers_and_groups!==t.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==t.mcp_tool_permissions,children:()=>{var e;return(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(G.Z,{accessToken:el,selectedServers:(null===(e=en.getFieldValue("allowed_mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:en.getFieldValue("mcp_tool_permissions")||{},onChange:e=>en.setFieldsValue({mcp_tool_permissions:e})})})}})]})]}),(0,s.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,s.jsx)(m.Z,{children:(0,s.jsx)("b",{children:"Agent Settings"})}),(0,s.jsx)(c.Z,{children:(0,s.jsx)(j.Z.Item,{label:(0,s.jsxs)("span",{children:["Allowed Agents"," ",(0,s.jsx)(v.Z,{title:"Select which agents or access groups this key can access",children:(0,s.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_agents_and_groups",help:"Select agents or access groups this key can access",children:(0,s.jsx)(T.Z,{onChange:e=>en.setFieldValue("allowed_agents_and_groups",e),value:en.getFieldValue("allowed_agents_and_groups"),accessToken:el,placeholder:"Select agents or access groups (optional)"})})})]}),er?(0,s.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,s.jsx)(m.Z,{children:(0,s.jsx)("b",{children:"Logging Settings"})}),(0,s.jsx)(c.Z,{children:(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(R.Z,{value:eC,onChange:eM,premiumUser:!0,disabledCallbacks:eB,onDisabledCallbacksChange:eG})})})]}):(0,s.jsx)(v.Z,{title:(0,s.jsxs)("span",{children:["Key-level logging settings is an enterprise feature, get in touch -",(0,s.jsx)("a",{href:"https://www.litellm.ai/enterprise",target:"_blank",children:"https://www.litellm.ai/enterprise"})]}),placement:"top",children:(0,s.jsxs)("div",{style:{position:"relative"},children:[(0,s.jsx)("div",{style:{opacity:.5},children:(0,s.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,s.jsx)(m.Z,{children:(0,s.jsx)("b",{children:"Logging Settings"})}),(0,s.jsx)(c.Z,{children:(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(R.Z,{value:eC,onChange:eM,premiumUser:!1,disabledCallbacks:eB,onDisabledCallbacksChange:eG})})})]})}),(0,s.jsx)("div",{style:{position:"absolute",inset:0,cursor:"not-allowed"}})]})}),(0,s.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,s.jsx)(m.Z,{children:(0,s.jsx)("b",{children:"Router Settings"})}),(0,s.jsx)(c.Z,{children:(0,s.jsx)("div",{className:"mt-4 w-full",children:(0,s.jsx)(D.Z,{accessToken:el||"",value:e0||void 0,onChange:e4,modelData:eg.length>0?{data:eg.map(e=>({model_name:e}))}:void 0},e1)})})]},"router-settings-accordion-".concat(e1)),(0,s.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,s.jsx)(m.Z,{children:(0,s.jsx)("b",{children:"Model Aliases"})}),(0,s.jsx)(c.Z,{children:(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)(x.Z,{className:"text-sm text-gray-600 mb-4",children:"Create custom aliases for models that can be used in API calls. This allows you to create shortcuts for specific models."}),(0,s.jsx)(I.Z,{accessToken:el,initialModelAliases:eW,onAliasUpdate:eH,showExampleConfig:!1})]})})]}),(0,s.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,s.jsx)(m.Z,{children:(0,s.jsx)("b",{children:"Key Lifecycle"})}),(0,s.jsx)(c.Z,{children:(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(E.Z,{form:en,autoRotationEnabled:eY,onAutoRotationChange:e$,rotationInterval:eQ,onRotationIntervalChange:eX,isCreateMode:!0})})}),(0,s.jsx)(j.Z.Item,{name:"duration",hidden:!0,initialValue:null,children:(0,s.jsx)(k.default,{})})]}),(0,s.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,s.jsx)(m.Z,{children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("b",{children:"Advanced Settings"}),(0,s.jsx)(v.Z,{title:(0,s.jsxs)("span",{children:["Learn more about advanced settings in our"," ",(0,s.jsx)("a",{href:J.proxyBaseUrl?"".concat(J.proxyBaseUrl,"/#/key%20management/generate_key_fn_key_generate_post"):"/#/key%20management/generate_key_fn_key_generate_post",target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300",children:"documentation"})]}),children:(0,s.jsx)(n.Z,{className:"text-gray-400 hover:text-gray-300 cursor-help"})})]})}),(0,s.jsx)(c.Z,{children:(0,s.jsx)(F.Z,{schemaComponent:"GenerateKeyRequest",form:en,excludedFields:["key_alias","team_id","models","duration","metadata","tags","guardrails","max_budget","budget_duration","tpm_limit","rpm_limit"]})})]})]})]})}),(0,s.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,s.jsx)(N.ZP,{htmlType:"submit",disabled:e7,style:{opacity:e7?.5:1},children:"Create Key"})})]})}),eL&&(0,s.jsx)(b.Z,{title:"Create New User",open:eL,onCancel:()=>eA(!1),footer:null,width:800,children:(0,s.jsx)(U.v,{userID:es,accessToken:el,teams:l,possibleUIRoles:eI,onUserCreated:e=>{eE(e),en.setFieldsValue({user_id:e}),eA(!1)},isEmbedded:!0})}),ec&&(0,s.jsx)(b.Z,{open:eo,onOk:e5,onCancel:e3,footer:null,children:(0,s.jsxs)(g.Z,{numItems:1,className:"gap-2 w-full",children:[(0,s.jsx)(y.Z,{children:"Save your Key"}),(0,s.jsx)(h.Z,{numColSpan:1,children:(0,s.jsxs)("p",{children:["Please save this secret key somewhere safe and accessible. For security reasons,"," ",(0,s.jsx)("b",{children:"you will not be able to view it again"})," through your LiteLLM account. If you lose this secret key, you will need to generate a new one."]})}),(0,s.jsx)(h.Z,{numColSpan:1,children:null!=ec?(0,s.jsxs)("div",{children:[(0,s.jsx)(x.Z,{className:"mt-3",children:"Virtual Key:"}),(0,s.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,s.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:ec})}),(0,s.jsx)(M.CopyToClipboard,{text:ec,onCopy:()=>{z.ZP.success("Virtual Key copied to clipboard")},children:(0,s.jsx)(u.Z,{className:"mt-3",children:"Copy Virtual Key"})})]}):(0,s.jsx)(x.Z,{children:"Key being created, this might take 30s"})})]})})]})}},56334:function(e,t,l){l.d(t,{Z:function(){return u}});var s=l(57437);l(2265);var a=l(31283);let r={ttl:3600,lowest_latency_buffer:0};var i=e=>{let{routingStrategyArgs:t}=e,l={ttl:"Sliding window to look back over when calculating the average latency of a deployment. Default - 1 hour (in seconds).",lowest_latency_buffer:"Shuffle between deployments within this % of the lowest latency. Default - 0 (i.e. always pick lowest latency)."};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"max-w-3xl",children:[(0,s.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Latency-Based Configuration"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Fine-tune latency-based routing behavior"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(t||r).map(e=>{let[t,r]=e;return(0,s.jsx)("div",{className:"space-y-2",children:(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:t.replace(/_/g," ")}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:l[t]||""}),(0,s.jsx)(a.o,{name:t,defaultValue:"object"==typeof r?JSON.stringify(r,null,2):null==r?void 0:r.toString(),className:"font-mono text-sm w-full"})]})},t)})})]}),(0,s.jsx)("div",{className:"border-t border-gray-200"})]})},n=e=>{let{routerSettings:t,routerFieldsMetadata:l}=e;return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"max-w-3xl",children:[(0,s.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Reliability & Retries"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure retry logic and failure handling"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-3",children:Object.entries(t).filter(e=>{let[t,l]=e;return"fallbacks"!=t&&"context_window_fallbacks"!=t&&"routing_strategy_args"!=t&&"routing_strategy"!=t&&"enable_tag_filtering"!=t}).map(e=>{var t,r;let[i,n]=e;return(0,s.jsx)("div",{className:"space-y-2",children:(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:(null===(t=l[i])||void 0===t?void 0:t.ui_field_name)||i}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:(null===(r=l[i])||void 0===r?void 0:r.field_description)||""}),(0,s.jsx)(a.o,{name:i,defaultValue:null==n||"null"===n?"":"object"==typeof n?JSON.stringify(n,null,2):(null==n?void 0:n.toString())||"",placeholder:"—",className:"font-mono text-sm w-full"})]})},i)})})]})},o=l(37592),d=e=>{var t,l;let{selectedStrategy:a,availableStrategies:r,routingStrategyDescriptions:i,routerFieldsMetadata:n,onStrategyChange:d}=e;return(0,s.jsxs)("div",{className:"space-y-2 max-w-3xl",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:(null===(t=n.routing_strategy)||void 0===t?void 0:t.ui_field_name)||"Routing Strategy"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-0.5 mb-2",children:(null===(l=n.routing_strategy)||void 0===l?void 0:l.field_description)||""})]}),(0,s.jsx)("div",{className:"routing-strategy-select max-w-3xl",children:(0,s.jsx)(o.default,{value:a,onChange:d,style:{width:"100%"},size:"large",children:r.map(e=>(0,s.jsx)(o.default.Option,{value:e,label:e,children:(0,s.jsxs)("div",{className:"flex flex-col gap-0.5 py-1",children:[(0,s.jsx)("span",{className:"font-mono text-sm font-medium",children:e}),i[e]&&(0,s.jsx)("span",{className:"text-xs text-gray-500 font-normal",children:i[e]})]})},e))})})]})},c=l(59341),m=e=>{var t,l,a;let{enabled:r,routerFieldsMetadata:i,onToggle:n}=e;return(0,s.jsx)("div",{className:"space-y-3 max-w-3xl",children:(0,s.jsxs)("div",{className:"flex items-start justify-between",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("label",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:(null===(t=i.enable_tag_filtering)||void 0===t?void 0:t.ui_field_name)||"Enable Tag Filtering"}),(0,s.jsxs)("p",{className:"text-xs text-gray-500 mt-0.5",children:[(null===(l=i.enable_tag_filtering)||void 0===l?void 0:l.field_description)||"",(null===(a=i.enable_tag_filtering)||void 0===a?void 0:a.link)&&(0,s.jsxs)(s.Fragment,{children:[" ",(0,s.jsx)("a",{href:i.enable_tag_filtering.link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline",children:"Learn more"})]})]})]}),(0,s.jsx)(c.Z,{checked:r,onChange:n,className:"ml-4"})]})})},u=e=>{let{value:t,onChange:l,routerFieldsMetadata:a,availableRoutingStrategies:r,routingStrategyDescriptions:o}=e;return(0,s.jsxs)("div",{className:"w-full space-y-8 py-2",children:[(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"max-w-3xl",children:[(0,s.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:"Routing Settings"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how requests are routed to deployments"})]}),r.length>0&&(0,s.jsx)(d,{selectedStrategy:t.selectedStrategy||t.routerSettings.routing_strategy||null,availableStrategies:r,routingStrategyDescriptions:o,routerFieldsMetadata:a,onStrategyChange:e=>{l({...t,selectedStrategy:e})}}),(0,s.jsx)(m,{enabled:t.enableTagFiltering,routerFieldsMetadata:a,onToggle:e=>{l({...t,enableTagFiltering:e})}})]}),(0,s.jsx)("div",{className:"border-t border-gray-200"}),"latency-based-routing"===t.selectedStrategy&&(0,s.jsx)(i,{routingStrategyArgs:t.routerSettings.routing_strategy_args}),(0,s.jsx)(n,{routerSettings:t.routerSettings,routerFieldsMetadata:a})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1112-62aa5eef02a46309.js b/litellm/proxy/_experimental/out/_next/static/chunks/1112-62aa5eef02a46309.js deleted file mode 100644 index 6a7f4a4ea26..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1112-62aa5eef02a46309.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1112],{41112:function(e,l,s){s.d(l,{Z:function(){return B}});var a=s(57437),t=s(2265),r=s(16312),i=s(22116),n=s(19250),o=s(4260),c=s(37592),d=s(10032),m=s(42264),x=s(43769);let{TextArea:u}=o.default,{Option:h}=c.default,g=["Development","Productivity","Learning","Security","Data & Analytics","Integration","Testing","Documentation"];var p=e=>{let{visible:l,onClose:s,accessToken:p,onSuccess:j}=e,[y]=d.Z.useForm(),[b,N]=(0,t.useState)(!1),[Z,f]=(0,t.useState)("github"),v=async e=>{if(!p){m.ZP.error("No access token available");return}if(!(0,x.$L)(e.name)){m.ZP.error("Plugin name must be kebab-case (lowercase letters, numbers, and hyphens only)");return}if(e.version&&!(0,x.Nq)(e.version)){m.ZP.error("Version must be in semantic versioning format (e.g., 1.0.0)");return}if(e.authorEmail&&!(0,x.vV)(e.authorEmail)){m.ZP.error("Invalid email format");return}if(e.homepage&&!(0,x.jv)(e.homepage)){m.ZP.error("Invalid homepage URL format");return}N(!0);try{let l={name:e.name.trim(),source:"github"===Z?{source:"github",repo:e.repo.trim()}:{source:"url",url:e.url.trim()}};e.version&&(l.version=e.version.trim()),e.description&&(l.description=e.description.trim()),(e.authorName||e.authorEmail)&&(l.author={},e.authorName&&(l.author.name=e.authorName.trim()),e.authorEmail&&(l.author.email=e.authorEmail.trim())),e.homepage&&(l.homepage=e.homepage.trim()),e.category&&(l.category=e.category),e.keywords&&(l.keywords=(0,x.jE)(e.keywords)),await (0,n.registerClaudeCodePlugin)(p,l),m.ZP.success("Plugin registered successfully"),y.resetFields(),f("github"),j(),s()}catch(e){console.error("Error registering plugin:",e),m.ZP.error("Failed to register plugin")}finally{N(!1)}},C=()=>{y.resetFields(),f("github"),s()};return(0,a.jsx)(i.Z,{title:"Add New Claude Code Plugin",open:l,onCancel:C,footer:null,width:700,className:"top-8",children:(0,a.jsxs)(d.Z,{form:y,layout:"vertical",onFinish:v,className:"mt-4",children:[(0,a.jsx)(d.Z.Item,{label:"Plugin Name",name:"name",rules:[{required:!0,message:"Please enter plugin name"},{pattern:/^[a-z0-9-]+$/,message:"Name must be kebab-case (lowercase, numbers, hyphens only)"}],tooltip:"Unique identifier in kebab-case format (e.g., my-awesome-plugin)",children:(0,a.jsx)(o.default,{placeholder:"my-awesome-plugin",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Source Type",name:"sourceType",initialValue:"github",rules:[{required:!0,message:"Please select source type"}],children:(0,a.jsxs)(c.default,{onChange:e=>{f(e),y.setFieldsValue({repo:void 0,url:void 0})},className:"rounded-lg",children:[(0,a.jsx)(h,{value:"github",children:"GitHub"}),(0,a.jsx)(h,{value:"url",children:"URL"})]})}),"github"===Z&&(0,a.jsx)(d.Z.Item,{label:"GitHub Repository",name:"repo",rules:[{required:!0,message:"Please enter repository"},{pattern:/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/,message:"Repository must be in format: org/repo"}],tooltip:"Format: organization/repository (e.g., anthropics/claude-code)",children:(0,a.jsx)(o.default,{placeholder:"anthropics/claude-code",className:"rounded-lg"})}),"url"===Z&&(0,a.jsx)(d.Z.Item,{label:"Git URL",name:"url",rules:[{required:!0,message:"Please enter git URL"}],tooltip:"Full git URL to the repository",children:(0,a.jsx)(o.default,{type:"url",placeholder:"https://github.com/org/repo.git",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Version (Optional)",name:"version",tooltip:"Semantic version (e.g., 1.0.0)",children:(0,a.jsx)(o.default,{placeholder:"1.0.0",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Description (Optional)",name:"description",tooltip:"Brief description of what the plugin does",children:(0,a.jsx)(u,{rows:3,placeholder:"A plugin that helps with...",maxLength:500,className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Category (Optional)",name:"category",tooltip:"Select a category or enter a custom one",children:(0,a.jsx)(c.default,{placeholder:"Select or type a category",allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"rounded-lg",children:g.map(e=>(0,a.jsx)(h,{value:e,children:e},e))})}),(0,a.jsx)(d.Z.Item,{label:"Keywords (Optional)",name:"keywords",tooltip:"Comma-separated list of keywords for search",children:(0,a.jsx)(o.default,{placeholder:"search, web, api",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Author Name (Optional)",name:"authorName",tooltip:"Name of the plugin author or organization",children:(0,a.jsx)(o.default,{placeholder:"Your Name or Organization",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Author Email (Optional)",name:"authorEmail",rules:[{type:"email",message:"Please enter a valid email"}],tooltip:"Contact email for the plugin author",children:(0,a.jsx)(o.default,{type:"email",placeholder:"author@example.com",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{label:"Homepage (Optional)",name:"homepage",rules:[{type:"url",message:"Please enter a valid URL"}],tooltip:"URL to the plugin's homepage or documentation",children:(0,a.jsx)(o.default,{type:"url",placeholder:"https://example.com",className:"rounded-lg"})}),(0,a.jsx)(d.Z.Item,{className:"mb-0 mt-6",children:(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(r.z,{variant:"secondary",onClick:C,disabled:b,children:"Cancel"}),(0,a.jsx)(r.z,{type:"submit",loading:b,children:b?"Registering...":"Register Plugin"})]})})]})})},j=s(23639),y=s(74998),b=s(44633),N=s(86462),Z=s(49084),f=s(71594),v=s(24525),C=s(41649),w=s(78489),P=s(21626),k=s(97214),S=s(28241),_=s(58834),z=s(69552),I=s(71876),E=s(99981),A=s(63709),D=s(9114),L=e=>{let{pluginsList:l,isLoading:s,onDeleteClick:r,accessToken:i,onPluginUpdated:o,isAdmin:c,onPluginClick:d}=e,[m,u]=(0,t.useState)([{id:"created_at",desc:!0}]),[h,g]=(0,t.useState)(null),p=e=>e?new Date(e).toLocaleString():"-",L=e=>{navigator.clipboard.writeText(e),D.ZP.success("Copied to clipboard!")},R=async e=>{if(i){g(e.id);try{e.enabled?(await (0,n.disableClaudeCodePlugin)(i,e.name),D.ZP.success('Plugin "'.concat(e.name,'" disabled'))):(await (0,n.enableClaudeCodePlugin)(i,e.name),D.ZP.success('Plugin "'.concat(e.name,'" enabled'))),o()}catch(e){D.ZP.error("Failed to toggle plugin status")}finally{g(null)}}},F=[{header:"Plugin Name",accessorKey:"name",cell:e=>{let{row:l}=e,s=l.original,t=s.name||"";return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(E.Z,{title:t,children:(0,a.jsx)(w.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left overflow-hidden truncate min-w-[150px] justify-start",onClick:()=>d(s.id),children:t})}),(0,a.jsx)(E.Z,{title:"Copy Plugin ID",children:(0,a.jsx)(j.Z,{onClick:e=>{e.stopPropagation(),L(s.id)},className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]})}},{header:"Version",accessorKey:"version",cell:e=>{let{row:l}=e,s=l.original.version||"N/A";return(0,a.jsx)("span",{className:"text-xs text-gray-600",children:s})}},{header:"Description",accessorKey:"description",cell:e=>{let{row:l}=e,s=l.original.description||"No description";return(0,a.jsx)(E.Z,{title:s,children:(0,a.jsx)("span",{className:"text-xs text-gray-600 block max-w-[300px] truncate",children:s})})}},{header:"Category",accessorKey:"category",cell:e=>{let{row:l}=e,s=l.original.category;if(!s)return(0,a.jsx)(C.Z,{color:"gray",className:"text-xs font-normal",size:"xs",children:"Uncategorized"});let t=(0,x.LH)(s);return(0,a.jsx)(C.Z,{color:t,className:"text-xs font-normal",size:"xs",children:s})}},{header:"Enabled",accessorKey:"enabled",cell:e=>{let{row:l}=e,s=l.original;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(C.Z,{color:s.enabled?"green":"gray",className:"text-xs font-normal",size:"xs",children:s.enabled?"Yes":"No"}),c&&(0,a.jsx)(E.Z,{title:s.enabled?"Disable plugin":"Enable plugin",children:(0,a.jsx)(A.Z,{size:"small",checked:s.enabled,loading:h===s.id,onChange:()=>R(s)})})]})}},{header:"Created At",accessorKey:"created_at",cell:e=>{let{row:l}=e,s=l.original;return(0,a.jsx)(E.Z,{title:s.created_at,children:(0,a.jsx)("span",{className:"text-xs",children:p(s.created_at)})})}},...c?[{header:"Actions",id:"actions",enableSorting:!1,cell:e=>{let{row:l}=e,s=l.original;return(0,a.jsx)("div",{className:"flex items-center gap-1",children:(0,a.jsx)(E.Z,{title:"Delete plugin",children:(0,a.jsx)(w.Z,{size:"xs",variant:"light",color:"red",onClick:e=>{e.stopPropagation(),r(s.name,s.name)},icon:y.Z,className:"text-red-500 hover:text-red-700 hover:bg-red-50"})})})}}]:[]],U=(0,f.b7)({data:l,columns:F,state:{sorting:m},onSortingChange:u,getCoreRowModel:(0,v.sC)(),getSortedRowModel:(0,v.tj)(),enableSorting:!0});return(0,a.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(P.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(_.Z,{children:U.getHeaderGroups().map(e=>(0,a.jsx)(I.Z,{children:e.headers.map(e=>(0,a.jsx)(z.Z,{className:"py-1 h-8 ".concat("actions"===e.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),onClick:e.column.getCanSort()?e.column.getToggleSortingHandler():void 0,children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,f.ie)(e.column.columnDef.header,e.getContext())}),e.column.getCanSort()&&(0,a.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,a.jsx)(b.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,a.jsx)(N.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,a.jsx)(Z.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,a.jsx)(k.Z,{children:s?(0,a.jsx)(I.Z,{children:(0,a.jsx)(S.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"Loading..."})})})}):l&&l.length>0?U.getRowModel().rows.map(e=>(0,a.jsx)(I.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,a.jsx)(S.Z,{className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap ".concat("actions"===e.column.id?"sticky right-0 bg-white shadow-[-4px_0_8px_-6px_rgba(0,0,0,0.1)]":""),children:(0,f.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,a.jsx)(I.Z,{children:(0,a.jsx)(S.Z,{colSpan:F.length,className:"h-8 text-center",children:(0,a.jsx)("div",{className:"text-center text-gray-500",children:(0,a.jsx)("p",{children:"No plugins found. Add one to get started."})})})})})]})})})},R=s(20347),F=s(10900),U=s(3477),O=s(12514),T=s(67101),H=s(84264),K=s(96761),V=s(10353),q=e=>{let{pluginId:l,onClose:s,accessToken:r,isAdmin:i,onPluginUpdated:o}=e,[c,d]=(0,t.useState)(null),[m,u]=(0,t.useState)(!0),[h,g]=(0,t.useState)(!1);(0,t.useEffect)(()=>{p()},[l,r]);let p=async()=>{if(r){u(!0);try{let e=await (0,n.getClaudeCodePluginDetails)(r,l);d(e.plugin)}catch(e){console.error("Error fetching plugin info:",e),D.ZP.error("Failed to load plugin information")}finally{u(!1)}}},y=async()=>{if(r&&c){g(!0);try{c.enabled?(await (0,n.disableClaudeCodePlugin)(r,c.name),D.ZP.success('Plugin "'.concat(c.name,'" disabled'))):(await (0,n.enableClaudeCodePlugin)(r,c.name),D.ZP.success('Plugin "'.concat(c.name,'" enabled'))),o(),p()}catch(e){D.ZP.error("Failed to toggle plugin status")}finally{g(!1)}}},b=e=>{navigator.clipboard.writeText(e),D.ZP.success("Copied to clipboard!")};if(m)return(0,a.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,a.jsx)(V.Z,{size:"large"})});if(!c)return(0,a.jsxs)("div",{className:"p-8 text-center text-gray-500",children:[(0,a.jsx)("p",{children:"Plugin not found"}),(0,a.jsx)(w.Z,{className:"mt-4",onClick:s,children:"Go Back"})]});let N=(0,x.aB)(c),Z=(0,x.OB)(c.source),f=(0,x.LH)(c.category);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)(F.Z,{className:"h-5 w-5 cursor-pointer text-gray-500 hover:text-gray-700",onClick:s}),(0,a.jsx)("h2",{className:"text-2xl font-bold",children:c.name}),c.version&&(0,a.jsxs)(C.Z,{color:"blue",size:"xs",children:["v",c.version]}),c.category&&(0,a.jsx)(C.Z,{color:f,size:"xs",children:c.category}),(0,a.jsx)(C.Z,{color:c.enabled?"green":"gray",size:"xs",children:c.enabled?"Enabled":"Disabled"})]}),(0,a.jsx)(O.Z,{children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs mb-2",children:"Install Command"}),(0,a.jsx)("div",{className:"font-mono bg-gray-100 px-3 py-2 rounded text-sm",children:N})]}),(0,a.jsx)(E.Z,{title:"Copy install command",children:(0,a.jsx)(w.Z,{size:"xs",variant:"secondary",icon:j.Z,onClick:()=>b(N),className:"ml-4",children:"Copy"})})]})}),(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Plugin Details"}),(0,a.jsxs)(T.Z,{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6 mt-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Plugin ID"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,a.jsx)(H.Z,{className:"font-mono text-xs",children:c.id}),(0,a.jsx)(j.Z,{className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs",onClick:()=>b(c.id)})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Name"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Version"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.version||"N/A"})]}),(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Source"}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,a.jsx)(H.Z,{className:"font-semibold",children:(0,x.i5)(c.source)}),Z&&(0,a.jsx)("a",{href:Z,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700",children:(0,a.jsx)(U.Z,{className:"h-4 w-4"})})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Category"}),(0,a.jsx)("div",{className:"mt-1",children:c.category?(0,a.jsx)(C.Z,{color:f,size:"xs",children:c.category}):(0,a.jsx)(H.Z,{className:"text-gray-400",children:"Uncategorized"})})]}),i&&(0,a.jsxs)("div",{className:"col-span-3",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Status"}),(0,a.jsxs)("div",{className:"flex items-center gap-3 mt-2",children:[(0,a.jsx)(A.Z,{checked:c.enabled,loading:h,onChange:y}),(0,a.jsx)(H.Z,{className:"text-sm",children:c.enabled?"Plugin is enabled and visible in marketplace":"Plugin is disabled and hidden from marketplace"})]})]})]})]}),c.description&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Description"}),(0,a.jsx)(H.Z,{className:"mt-2",children:c.description})]}),c.keywords&&c.keywords.length>0&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Keywords"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mt-2",children:c.keywords.map((e,l)=>(0,a.jsx)(C.Z,{color:"gray",size:"xs",children:e},l))})]}),c.author&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Author Information"}),(0,a.jsxs)(T.Z,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[c.author.name&&(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Name"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.author.name})]}),c.author.email&&(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Email"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:(0,a.jsx)("a",{href:"mailto:".concat(c.author.email),className:"text-blue-500 hover:text-blue-700",children:c.author.email})})]})]})]}),c.homepage&&(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Homepage"}),(0,a.jsxs)("a",{href:c.homepage,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:text-blue-700 flex items-center gap-2 mt-2",children:[c.homepage,(0,a.jsx)(U.Z,{className:"h-4 w-4"})]})]}),(0,a.jsxs)(O.Z,{children:[(0,a.jsx)(K.Z,{children:"Metadata"}),(0,a.jsxs)(T.Z,{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mt-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Created At"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:(0,x.ie)(c.created_at)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Updated At"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:(0,x.ie)(c.updated_at)})]}),c.created_by&&(0,a.jsxs)("div",{className:"col-span-2",children:[(0,a.jsx)(H.Z,{className:"text-gray-600 text-xs",children:"Created By"}),(0,a.jsx)(H.Z,{className:"font-semibold mt-1",children:c.created_by})]})]})]})]})},B=e=>{let{accessToken:l,userRole:s}=e,[o,c]=(0,t.useState)([]),[d,m]=(0,t.useState)(!1),[x,u]=(0,t.useState)(!1),[h,g]=(0,t.useState)(!1),[j,y]=(0,t.useState)(null),[b,N]=(0,t.useState)(null),Z=!!s&&(0,R.tY)(s),f=async()=>{if(l){u(!0);try{let e=await (0,n.getClaudeCodePluginsList)(l,!1);console.log("Claude Code plugins: ".concat(JSON.stringify(e))),c(e.plugins)}catch(e){console.error("Error fetching Claude Code plugins:",e)}finally{u(!1)}}};(0,t.useEffect)(()=>{f()},[l]);let v=async()=>{if(j&&l){g(!0);try{await (0,n.deleteClaudeCodePlugin)(l,j.name),D.ZP.success('Plugin "'.concat(j.displayName,'" deleted successfully')),f()}catch(e){console.error("Error deleting plugin:",e),D.ZP.error("Failed to delete plugin")}finally{g(!1),y(null)}}};return(0,a.jsxs)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2 mb-4",children:[(0,a.jsx)("h1",{className:"text-2xl font-bold",children:"Claude Code Plugins"}),(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:["Manage Claude Code marketplace plugins. Add, enable, disable, or delete plugins that will be available in your marketplace catalog. Enabled plugins will appear in the public marketplace at"," ",(0,a.jsx)("code",{className:"bg-gray-100 px-1 rounded",children:"/claude-code/marketplace.json"}),"."]}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)(r.z,{onClick:()=>{b&&N(null),m(!0)},disabled:!l||!Z,children:"+ Add New Plugin"})})]}),b?(0,a.jsx)(q,{pluginId:b,onClose:()=>N(null),accessToken:l,isAdmin:Z,onPluginUpdated:f}):(0,a.jsx)(L,{pluginsList:o,isLoading:x,onDeleteClick:(e,l)=>{y({name:e,displayName:l})},accessToken:l,onPluginUpdated:f,isAdmin:Z,onPluginClick:e=>N(e)}),(0,a.jsx)(p,{visible:d,onClose:()=>{m(!1)},accessToken:l,onSuccess:()=>{f()}}),j&&(0,a.jsxs)(i.Z,{title:"Delete Plugin",open:null!==j,onOk:v,onCancel:()=>{y(null)},confirmLoading:h,okText:"Delete",okButtonProps:{danger:!0},children:[(0,a.jsxs)("p",{children:["Are you sure you want to delete plugin:"," ",(0,a.jsx)("strong",{children:j.displayName}),"?"]}),(0,a.jsx)("p",{children:"This action cannot be undone."})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1125-997dafd1c51527b8.js b/litellm/proxy/_experimental/out/_next/static/chunks/1125-997dafd1c51527b8.js deleted file mode 100644 index d96cd59479f..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1125-997dafd1c51527b8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1125],{71618:function(e,s,r){r.d(s,{OK:function(){return l.Z},nP:function(){return o.Z},td:function(){return n.Z},v0:function(){return a.Z},x4:function(){return i.Z},zx:function(){return t.Z}});var t=r(78489),l=r(12485),a=r(18135),n=r(35242),i=r(29706),o=r(77991)},44803:function(e,s,r){r.d(s,{Dx:function(){return a.Z},Zb:function(){return t.Z},xv:function(){return l.Z}});var t=r(12514),l=r(84264),a=r(96761)},71125:function(e,s,r){r.d(s,{d:function(){return sZ},o:function(){return sI}});var t=r(57437),l=r(20347),a=r(67187),n=r(78489),i=r(12485),o=r(18135),c=r(35242),d=r(29706),u=r(77991),m=r(84264),x=r(96761),h=r(57840),p=r(37592),g=r(22116),f=r(76188),v=r(99981),j=r(2265),b=r(68474),y=r(71632),N=r(90246),_=r(19250),w=r(39760);let C=(0,N.n)("mcpServerHealth"),Z=e=>{let{accessToken:s}=(0,w.Z)();return(0,y.a)({queryKey:[...C.lists(),{serverIds:e}],queryFn:async()=>await (0,_.fetchMCPServerHealth)(s,e),enabled:!!s,refetchInterval:3e4})};var S=r(9114),k=r(60493),P=r(10032),A=r(4260),T=r(15424),M=r(64504);let I={NONE:"none",API_KEY:"api_key",BEARER_TOKEN:"bearer_token",BASIC:"basic",OAUTH2:"oauth2"},O={INTERACTIVE:"interactive",M2M:"m2m"},E={SSE:"sse"},L=e=>null==e?E.SSE:e,z=e=>null==e?I.NONE:e,F="rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",R=e=>{let{label:s,tooltip:r}=e;return(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[s,(0,t.jsx)(v.Z,{title:r,children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]})};var q=e=>{var s,r;let{isM2M:l,isEditing:a=!1,oauthFlow:n,initialFlowType:i}=e,o=a?" (leave blank to keep existing)":"";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)(R,{label:"OAuth Flow Type",tooltip:"Choose how the proxy authenticates with this MCP server. M2M is for server-to-server communication using client credentials. Interactive (PKCE) is for user-facing flows that require browser-based authorization."}),name:"oauth_flow_type",...i?{initialValue:i}:{},children:(0,t.jsxs)(p.default,{className:"rounded-lg",size:"large",children:[(0,t.jsx)(p.default.Option,{value:O.M2M,children:(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:"Machine-to-Machine (M2M)"}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-2",children:"server-to-server, no user interaction"})]})}),(0,t.jsx)(p.default.Option,{value:O.INTERACTIVE,children:(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-medium",children:"Interactive (PKCE)"}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-2",children:"browser-based user authorization"})]})})]})}),l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)(R,{label:"Client ID",tooltip:"OAuth2 client ID for the client_credentials grant."}),name:["credentials","client_id"],rules:[{required:!0,message:"Client ID is required for M2M OAuth"}],children:(0,t.jsx)(M.o,{type:"password",placeholder:"Enter OAuth client ID".concat(o),className:F})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)(R,{label:"Client Secret",tooltip:"OAuth2 client secret for the client_credentials grant."}),name:["credentials","client_secret"],rules:[{required:!0,message:"Client Secret is required for M2M OAuth"}],children:(0,t.jsx)(M.o,{type:"password",placeholder:"Enter OAuth client secret".concat(o),className:F})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)(R,{label:"Token URL",tooltip:"Token endpoint URL for the client_credentials grant."}),name:"token_url",rules:[{required:!0,message:"Token URL is required for M2M OAuth"}],children:(0,t.jsx)(M.o,{placeholder:"https://auth.example.com/oauth/token",className:F})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)(R,{label:"Scopes (optional)",tooltip:"Optional scopes to request with the client_credentials grant."}),name:["credentials","scopes"],children:(0,t.jsx)(p.default,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)(R,{label:"Client ID (optional)",tooltip:"Provide only if your MCP server cannot handle dynamic client registration."}),name:["credentials","client_id"],children:(0,t.jsx)(M.o,{type:"password",placeholder:"Enter client ID".concat(o),className:F})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)(R,{label:"Client Secret (optional)",tooltip:"Provide only if your MCP server cannot handle dynamic client registration."}),name:["credentials","client_secret"],children:(0,t.jsx)(M.o,{type:"password",placeholder:"Enter client secret".concat(o),className:F})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)(R,{label:"Scopes (optional)",tooltip:"Optional scopes requested during token exchange. Separate multiple scopes with enter or commas."}),name:["credentials","scopes"],children:(0,t.jsx)(p.default,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)(R,{label:"Authorization URL (optional)",tooltip:"Optional override for the authorization endpoint."}),name:"authorization_url",children:(0,t.jsx)(M.o,{placeholder:"https://example.com/oauth/authorize",className:F})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)(R,{label:"Token URL (optional)",tooltip:"Optional override for the token endpoint."}),name:"token_url",children:(0,t.jsx)(M.o,{placeholder:"https://example.com/oauth/token",className:F})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)(R,{label:"Registration URL (optional)",tooltip:"Optional override for the dynamic client registration endpoint."}),name:"registration_url",children:(0,t.jsx)(M.o,{placeholder:"https://example.com/oauth/register",className:F})}),n&&(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Use OAuth to fetch a fresh access token and temporarily save it in the session as the authentication value."}),(0,t.jsx)(M.z,{variant:"secondary",onClick:n.startOAuthFlow,disabled:"authorizing"===n.status||"exchanging"===n.status,children:"authorizing"===n.status?"Waiting for authorization...":"exchanging"===n.status?"Exchanging authorization code...":"Authorize & Fetch Token"}),n.error&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:n.error}),"success"===n.status&&(null===(s=n.tokenResponse)||void 0===s?void 0:s.access_token)&&(0,t.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",null!==(r=n.tokenResponse.expires_in)&&void 0!==r?r:"?"," seconds."]})]})]})]})},V=r(12221),U=r(44851),B=r(33866),D=r(62670),K=r(58630),H=r(44803),J=e=>{let{value:s={},onChange:r,tools:l=[],disabled:a=!1}=e,n=(e,t)=>{let l={...s,tool_name_to_cost_per_query:{...s.tool_name_to_cost_per_query,[e]:t}};null==r||r(l)};return(0,t.jsx)(H.Zb,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,t.jsx)(D.Z,{className:"text-green-600"}),(0,t.jsx)(H.Dx,{children:"Cost Configuration"}),(0,t.jsx)(v.Z,{title:"Configure costs for this MCP server's tool calls. Set a default rate and per-tool overrides.",children:(0,t.jsx)(T.Z,{className:"text-gray-400"})})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Default Cost per Query ($)",(0,t.jsx)(v.Z,{title:"Default cost charged for each tool call to this server.",children:(0,t.jsx)(T.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(V.Z,{min:0,step:1e-4,precision:4,placeholder:"0.0000",value:s.default_cost_per_query,onChange:e=>{let t={...s,default_cost_per_query:e};null==r||r(t)},disabled:a,style:{width:"200px"},addonBefore:"$"}),(0,t.jsx)(H.xv,{className:"block mt-1 text-gray-500 text-sm",children:"Set a default cost for all tool calls to this server"})]}),l.length>0&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("label",{className:"block text-sm font-medium text-gray-700",children:["Tool-Specific Costs ($)",(0,t.jsx)(v.Z,{title:"Override the default cost for specific tools. Leave blank to use the default rate.",children:(0,t.jsx)(T.Z,{className:"ml-1 text-gray-400"})})]}),(0,t.jsx)(U.default,{items:[{key:"1",label:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(K.Z,{className:"mr-2 text-blue-500"}),(0,t.jsx)("span",{className:"font-medium",children:"Available Tools"}),(0,t.jsx)(B.Z,{count:l.length,style:{backgroundColor:"#52c41a",marginLeft:"8px"}})]}),children:(0,t.jsx)("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:l.map((e,r)=>{var l;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(H.xv,{className:"font-medium text-gray-900",children:e.name}),e.description&&(0,t.jsx)(H.xv,{className:"text-gray-500 text-sm block mt-1",children:e.description})]}),(0,t.jsx)("div",{className:"ml-4",children:(0,t.jsx)(V.Z,{min:0,step:1e-4,precision:4,placeholder:"Use default",value:null===(l=s.tool_name_to_cost_per_query)||void 0===l?void 0:l[e.name],onChange:s=>n(e.name,s),disabled:a,style:{width:"120px"},addonBefore:"$"})})]},r)})})}]})]})]}),(s.default_cost_per_query||s.tool_name_to_cost_per_query&&Object.keys(s.tool_name_to_cost_per_query).length>0)&&(0,t.jsxs)("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(H.xv,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[s.default_cost_per_query&&(0,t.jsxs)(H.xv,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),s.tool_name_to_cost_per_query&&Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)(H.xv,{className:"text-blue-700",children:["• ",s,": $",r.toFixed(4)," per query"]},s)})]})]})]})})},G=r(10353),Y=r(51653),W=r(5545),$=r(83669),Q=r(29271),X=r(89245);let ee=e=>{var s,r;let{accessToken:t,oauthAccessToken:l,formValues:a,enabled:n=!0}=e,[i,o]=(0,j.useState)([]),[c,d]=(0,j.useState)(!1),[u,m]=(0,j.useState)(null),[x,h]=(0,j.useState)(null),[p,g]=(0,j.useState)(!1),f=a.auth_type===I.OAUTH2&&a.oauth_flow_type===O.M2M,v=a.auth_type===I.OAUTH2&&!f,b=!!(a.url&&a.transport&&a.auth_type&&t&&(!v||l)),y=JSON.stringify(null!==(s=a.static_headers)&&void 0!==s?s:{}),N=JSON.stringify(null!==(r=a.credentials)&&void 0!==r?r:{}),w=async()=>{if(t&&a.url&&(!v||l)){d(!0),m(null);try{let e=Array.isArray(a.static_headers)?a.static_headers.reduce((e,s)=>{var r;let t=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return t&&(e[t]=(null==s?void 0:s.value)!=null?String(s.value):""),e},{}):!Array.isArray(a.static_headers)&&a.static_headers&&"object"==typeof a.static_headers?Object.entries(a.static_headers).reduce((e,s)=>{let[r,t]=s;return r&&(e[r]=null!=t?String(t):""),e},{}):{},s=a.credentials&&"object"==typeof a.credentials?Object.entries(a.credentials).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,r={server_id:a.server_id||"",server_name:a.server_name||"",url:a.url,transport:a.transport,auth_type:a.auth_type,authorization_url:a.authorization_url,token_url:a.token_url,registration_url:a.registration_url,mcp_info:a.mcp_info,static_headers:e};s&&Object.keys(s).length>0&&(r.credentials=s);let n=await (0,_.testMCPToolsListRequest)(t,r,l);if(n.tools&&!n.error)o(n.tools),m(null),h(null),n.tools.length>0&&!p&&g(!0);else{let e=n.message||"Failed to retrieve tools list";m(e),h(n.stack_trace||null),o([]),g(!1)}}catch(e){console.error("Tools fetch error:",e),m(e instanceof Error?e.message:String(e)),h(null),o([]),g(!1)}finally{d(!1)}}},C=()=>{o([]),m(null),h(null),g(!1)};return(0,j.useEffect)(()=>{n&&(b?w():C())},[a.url,a.transport,a.auth_type,t,n,l,b,y,N]),{tools:i,isLoadingTools:c,toolsError:u,toolsErrorStackTrace:x,hasShownSuccessMessage:p,canFetchTools:b,fetchTools:w,clearTools:C}};var es=e=>{let{accessToken:s,oauthAccessToken:r,formValues:l,onToolsLoaded:a}=e,{tools:n,isLoadingTools:i,toolsError:o,toolsErrorStackTrace:c,canFetchTools:d,fetchTools:u}=ee({accessToken:s,oauthAccessToken:r,formValues:l,enabled:!0});return((0,j.useEffect)(()=>{null==a||a(n)},[n,a]),d||l.url)?(0,t.jsx)(H.Zb,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)($.Z,{className:"text-blue-600"}),(0,t.jsx)(H.Dx,{children:"Connection Status"})]}),!d&&l.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(K.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(H.xv,{children:"Complete required fields to test connection"}),(0,t.jsx)("br",{}),(0,t.jsx)(H.xv,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to test MCP server connection"})]}),d&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(H.xv,{className:"text-gray-700 font-medium",children:i?"Testing connection to MCP server...":n.length>0?"Connection successful":o?"Connection failed":"Ready to test connection"}),(0,t.jsx)("br",{}),(0,t.jsxs)(H.xv,{className:"text-gray-500 text-sm",children:["Server: ",l.url]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center text-blue-600",children:[(0,t.jsx)(G.Z,{size:"small",className:"mr-2"}),(0,t.jsx)(H.xv,{className:"text-blue-600",children:"Connecting..."})]}),!i&&!o&&n.length>0&&(0,t.jsxs)("div",{className:"flex items-center text-green-600",children:[(0,t.jsx)($.Z,{className:"mr-1"}),(0,t.jsx)(H.xv,{className:"text-green-600 font-medium",children:"Connected"})]}),o&&(0,t.jsxs)("div",{className:"flex items-center text-red-600",children:[(0,t.jsx)(Q.Z,{className:"mr-1"}),(0,t.jsx)(H.xv,{className:"text-red-600 font-medium",children:"Failed"})]})]}),i&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(G.Z,{size:"large"}),(0,t.jsx)(H.xv,{className:"ml-3",children:"Testing connection and loading tools..."})]}),o&&(0,t.jsx)(Y.Z,{message:"Connection Failed",description:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{children:o}),c&&(0,t.jsx)(U.default,{items:[{key:"stack-trace",label:"Stack Trace",children:(0,t.jsx)("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px",fontFamily:"monospace",margin:0,padding:"8px",backgroundColor:"#f5f5f5",borderRadius:"4px",maxHeight:"400px",overflow:"auto"},children:c})}],style:{marginTop:"12px"}})]}),type:"error",showIcon:!0,action:(0,t.jsx)(W.ZP,{icon:(0,t.jsx)(X.Z,{}),onClick:u,size:"small",children:"Retry"})}),!i&&0===n.length&&!o&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-500 border rounded-lg border-dashed",children:[(0,t.jsx)($.Z,{className:"text-2xl mb-2 text-green-500"}),(0,t.jsx)(H.xv,{className:"text-green-600 font-medium",children:"Connection successful!"}),(0,t.jsx)("br",{}),(0,t.jsx)(H.xv,{className:"text-gray-500",children:"No tools found for this MCP server"})]})]})]})}):null},er=r(61994),et=e=>{let{accessToken:s,oauthAccessToken:r,formValues:l,allowedTools:a,existingAllowedTools:n,onAllowedToolsChange:i}=e,o=(0,j.useRef)(0),{tools:c,isLoadingTools:d,toolsError:u,canFetchTools:m}=ee({accessToken:s,oauthAccessToken:r,formValues:l,enabled:!0});(0,j.useEffect)(()=>{if(c.length>0&&c.length!==o.current&&0===a.length){if(n&&n.length>0){let e=c.map(e=>e.name);i(n.filter(s=>e.includes(s)))}else i(c.map(e=>e.name))}o.current=c.length},[c,a.length,n,i]);let x=e=>{a.includes(e)?i(a.filter(s=>s!==e)):i([...a,e])};return m||l.url?(0,t.jsx)(H.Zb,{children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(K.Z,{className:"text-blue-600"}),(0,t.jsx)(H.Dx,{children:"Tool Configuration"}),c.length>0&&(0,t.jsx)(B.Z,{count:c.length,style:{backgroundColor:"#52c41a"}})]})}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(H.xv,{className:"text-blue-800 text-sm",children:[(0,t.jsx)("strong",{children:"Select which tools users can call:"})," Only checked tools will be available for users to invoke. Unchecked tools will be blocked from execution."]})}),d&&(0,t.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,t.jsx)(G.Z,{size:"large"}),(0,t.jsx)(H.xv,{className:"ml-3",children:"Loading tools..."})]}),u&&!d&&(0,t.jsxs)("div",{className:"text-center py-6 text-red-500 border rounded-lg border-dashed border-red-300 bg-red-50",children:[(0,t.jsx)(K.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(H.xv,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(H.xv,{className:"text-sm text-red-500",children:u})]}),!d&&!u&&0===c.length&&m&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(K.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(H.xv,{children:"No tools available for configuration"}),(0,t.jsx)("br",{}),(0,t.jsx)(H.xv,{className:"text-sm",children:"Connect to an MCP server with tools to configure them"})]}),!m&&l.url&&(0,t.jsxs)("div",{className:"text-center py-6 text-gray-400 border rounded-lg border-dashed",children:[(0,t.jsx)(K.Z,{className:"text-2xl mb-2"}),(0,t.jsx)(H.xv,{children:"Complete required fields to configure tools"}),(0,t.jsx)("br",{}),(0,t.jsx)(H.xv,{className:"text-sm",children:"Fill in URL, Transport, and Authentication to load available tools"})]}),!d&&!u&&c.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-green-50 rounded-lg border border-green-200 flex-1",children:[(0,t.jsx)($.Z,{className:"text-green-600"}),(0,t.jsxs)(H.xv,{className:"text-green-700 font-medium",children:[a.length," of ",c.length," ",1===c.length?"tool":"tools"," enabled for user access"]})]}),(0,t.jsxs)("div",{className:"flex gap-2 ml-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{i(c.map(e=>e.name))},className:"px-3 py-1.5 text-sm text-blue-600 hover:text-blue-700 hover:bg-blue-50 rounded-md transition-colors",children:"Enable All"}),(0,t.jsx)("button",{type:"button",onClick:()=>{i([])},className:"px-3 py-1.5 text-sm text-gray-600 hover:text-gray-700 hover:bg-gray-100 rounded-md transition-colors",children:"Disable All"})]})]}),(0,t.jsx)("div",{className:"space-y-2",children:c.map((e,s)=>(0,t.jsx)("div",{className:"p-4 rounded-lg border transition-colors cursor-pointer ".concat(a.includes(e.name)?"bg-blue-50 border-blue-300 hover:border-blue-400":"bg-gray-50 border-gray-200 hover:border-gray-300"),onClick:()=>x(e.name),children:(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(er.Z,{checked:a.includes(e.name),onChange:()=>x(e.name)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(H.xv,{className:"font-medium text-gray-900",children:e.name}),(0,t.jsx)("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium ".concat(a.includes(e.name)?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:a.includes(e.name)?"Enabled":"Disabled"})]}),e.description&&(0,t.jsx)(H.xv,{className:"text-gray-500 text-sm block mt-1",children:e.description}),(0,t.jsx)(H.xv,{className:"text-gray-400 text-xs block mt-1",children:a.includes(e.name)?"✓ Users can call this tool":"✗ Users cannot call this tool"})]})]})},s))})]})]})}):null},el=e=>{let{isVisible:s,required:r=!0}=e;return s?(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Stdio Configuration (JSON)",(0,t.jsx)(v.Z,{title:"Paste your stdio MCP server configuration in JSON format. You can use the full mcpServers structure from config.yaml or just the inner server configuration.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"stdio_config",rules:[...r?[{required:!0,message:"Please enter stdio configuration"}]:[],{validator:(e,s)=>{if(!s)return Promise.resolve();try{return JSON.parse(s),Promise.resolve()}catch(e){return Promise.reject("Please enter valid JSON")}}}],children:(0,t.jsx)(A.default.TextArea,{placeholder:'{\n "mcpServers": {\n "circleci-mcp-server": {\n "command": "npx",\n "args": ["-y", "@circleci/mcp-server-circleci"],\n "env": {\n "CIRCLECI_TOKEN": "your-circleci-token",\n "CIRCLECI_BASE_URL": "https://circleci.com"\n }\n }\n }\n}',rows:12,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 font-mono text-sm"})}):null},ea=r(63709),en=r(55590),ei=r(45246),eo=r(96473);let{Panel:ec}=U.default;var ed=e=>{var s,r;let{availableAccessGroups:l,mcpServer:a,searchValue:n,setSearchValue:i,getAccessGroupOptions:o}=e,c=P.Z.useFormInstance();return(0,j.useEffect)(()=>{if(a){if(a.extra_headers&&c.setFieldValue("extra_headers",a.extra_headers),a.static_headers){let e=Object.entries(a.static_headers).map(e=>{let[s,r]=e;return{header:s,value:null!=r?String(r):""}});c.setFieldValue("static_headers",e)}"boolean"==typeof a.allow_all_keys&&c.setFieldValue("allow_all_keys",a.allow_all_keys),"boolean"==typeof a.available_on_public_internet&&c.setFieldValue("available_on_public_internet",a.available_on_public_internet)}else c.setFieldValue("allow_all_keys",!1),c.setFieldValue("available_on_public_internet",!1)},[a,c]),(0,t.jsx)(U.default,{className:"bg-gray-50 border border-gray-200 rounded-lg",expandIconPosition:"end",ghost:!1,children:(0,t.jsx)(ec,{header:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Permission Management / Access Control"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 ml-4",children:"Configure access permissions and security settings (Optional)"})]}),className:"border-0",children:(0,t.jsxs)("div",{className:"space-y-6 pt-4",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Allow All LiteLLM Keys",(0,t.jsx)(v.Z,{title:"When enabled, every API key can access this MCP server.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:'Enable if this server should be "public" to all keys.'})]}),(0,t.jsx)(P.Z.Item,{name:"allow_all_keys",valuePropName:"checked",initialValue:null!==(s=null==a?void 0:a.allow_all_keys)&&void 0!==s&&s,className:"mb-0",children:(0,t.jsx)(ea.Z,{})})]}),(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Available on Public Internet",(0,t.jsx)(v.Z,{title:"When enabled, this MCP server is accessible from external/public IPs (e.g., ChatGPT). When disabled, only callers from internal/private networks can access it.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),(0,t.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:"Enable if this server should be reachable from the public internet."})]}),(0,t.jsx)(P.Z.Item,{name:"available_on_public_internet",valuePropName:"checked",initialValue:null!==(r=null==a?void 0:a.available_on_public_internet)&&void 0!==r&&r,className:"mb-0",children:(0,t.jsx)(ea.Z,{})})]}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Access Groups",(0,t.jsx)(v.Z,{title:"Specify access groups for this MCP server. Users must be in at least one of these groups to access the server.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"mcp_access_groups",className:"mb-4",children:(0,t.jsx)(p.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"value",filterOption:(e,s)=>{var r;return(null!==(r=null==s?void 0:s.value)&&void 0!==r?r:"").toLowerCase().includes(e.toLowerCase())},onSearch:e=>i(e),tokenSeparators:[","],options:o(),maxTagCount:"responsive",allowClear:!0})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Extra Headers",(0,t.jsx)(v.Z,{title:"Forward custom headers from incoming requests to this MCP server (e.g., Authorization, X-Custom-Header, User-Agent)",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})}),(null==a?void 0:a.extra_headers)&&a.extra_headers.length>0&&(0,t.jsxs)("span",{className:"ml-2 text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded-full",children:[a.extra_headers.length," configured"]})]}),name:"extra_headers",children:(0,t.jsx)(p.default,{mode:"tags",placeholder:(null==a?void 0:a.extra_headers)&&a.extra_headers.length>0?"Currently: ".concat(a.extra_headers.join(", ")):"Enter header names (e.g., Authorization, X-Custom-Header)",className:"rounded-lg",size:"large",tokenSeparators:[","],allowClear:!0})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Static Headers",(0,t.jsx)(v.Z,{title:"Send these key-value headers with every request to this MCP server.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),required:!1,children:(0,t.jsx)(P.Z.List,{name:"static_headers",children:(e,s)=>{let{add:r,remove:l}=s;return(0,t.jsxs)("div",{className:"space-y-3",children:[e.map(e=>{let{key:s,name:r,...a}=e;return(0,t.jsxs)(en.Z,{className:"flex w-full",align:"baseline",size:"middle",children:[(0,t.jsx)(P.Z.Item,{...a,name:[r,"header"],className:"flex-1",rules:[{required:!0,message:"Header name is required"}],children:(0,t.jsx)(A.default,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header name (e.g., X-API-Key)"})}),(0,t.jsx)(P.Z.Item,{...a,name:[r,"value"],className:"flex-1",rules:[{required:!0,message:"Header value is required"}],children:(0,t.jsx)(A.default,{size:"large",allowClear:!0,className:"rounded-lg",placeholder:"Header value"})}),(0,t.jsx)(ei.Z,{onClick:()=>l(r),className:"text-gray-500 hover:text-red-500 cursor-pointer"})]},s)}),(0,t.jsx)(W.ZP,{type:"dashed",onClick:()=>r(),icon:(0,t.jsx)(eo.Z,{}),block:!0,children:"Add Static Header"})]})}})})]})},"permissions")})};let eu=e=>{try{let s=e.indexOf("/mcp/");if(-1===s)return{token:null,baseUrl:e};let r=e.split("/mcp/");if(2!==r.length)return{token:null,baseUrl:e};let t=r[0]+"/mcp/",l=r[1];if(!l)return{token:null,baseUrl:e};return{token:l,baseUrl:t}}catch(s){return console.error("Error parsing MCP URL:",s),{token:null,baseUrl:e}}},em=e=>{let{token:s,baseUrl:r}=eu(e);return s?r+"...":e},ex=e=>{let{token:s}=eu(e);return{maskedUrl:em(e),hasToken:!!s}},eh=e=>e?/^https?:\/\/[^\s/$.?#].[^\s]*$/i.test(e)?Promise.resolve():Promise.reject("Please enter a valid URL (e.g., http://service-name.domain:1234/path or https://example.com)"):Promise.resolve(),ep=e=>e&&(e.includes("-")||e.includes(" "))?Promise.reject("Cannot contain '-' (hyphen) or spaces. Please use '_' (underscore) instead."):Promise.resolve(),eg=e=>{let s=new Uint8Array(e),r="";return s.forEach(e=>r+=String.fromCharCode(e)),btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},ef=()=>{let e=new Uint8Array(32);return window.crypto.getRandomValues(e),eg(e.buffer)},ev=async e=>{let s=new TextEncoder().encode(e);return eg(await window.crypto.subtle.digest("SHA-256",s))},ej=e=>{let{accessToken:s,getCredentials:r,getTemporaryPayload:t,onTokenReceived:l,onBeforeRedirect:a}=e,[n,i]=(0,j.useState)("idle"),[o,c]=(0,j.useState)(null),[d,u]=(0,j.useState)(null),m="litellm-mcp-oauth-flow-state",x="litellm-mcp-oauth-result",h="litellm-mcp-oauth-return-url",p=()=>{try{window.sessionStorage.removeItem(m),window.sessionStorage.removeItem(x),window.sessionStorage.removeItem(h)}catch(e){console.warn("Failed to clear OAuth storage",e)}},g=()=>{{let e=window.location.pathname||"",s=e.indexOf("/ui"),r=(s>=0?e.slice(0,s+3):"").replace(/\/+$/,"");return"".concat(window.location.origin).concat(r,"/mcp/oauth/callback")}},f=()=>g(),v=(0,j.useCallback)(async()=>{let e=r()||{};if(!s){c("Missing admin token"),S.ZP.error("Access token missing. Please re-authenticate and try again.");return}let l=t();if(!l||!l.url||!l.transport){let e="Please complete server URL and transport before starting OAuth.";c(e),S.ZP.error(e);return}try{var n,o,d;i("authorizing"),c(null);let r=await (0,_.cacheTemporaryMcpServer)(s,l),t=null==r?void 0:null===(n=r.server_id)||void 0===n?void 0:n.trim();if(!t)throw Error("Temporary MCP server identifier missing. Please retry.");let u={};if(!((null===(o=l.credentials)||void 0===o?void 0:o.client_id)&&(null===(d=l.credentials)||void 0===d?void 0:d.client_secret))){let e=await (0,_.registerMcpOAuthClient)(s,t,{client_name:l.alias||l.server_name||t,grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:l.credentials&&l.credentials.client_secret?"client_secret_post":"none"});u={clientId:null==e?void 0:e.client_id,clientSecret:null==e?void 0:e.client_secret}}let x=ef(),p=await ev(x),g=crypto.randomUUID(),v=u.clientId||e.client_id,j=Array.isArray(e.scopes)?e.scopes.filter(e=>e&&e.trim().length>0).join(" "):void 0,b=(0,_.buildMcpOAuthAuthorizeUrl)({serverId:t,clientId:v,redirectUri:f(),state:g,codeChallenge:p,scope:j}),y={state:g,codeVerifier:x,clientId:v,clientSecret:u.clientSecret||e.client_secret,serverId:t,redirectUri:f()};if(a)try{a()}catch(e){console.error("Failed to prepare for OAuth redirect",e)}try{window.sessionStorage.setItem(m,JSON.stringify(y)),window.sessionStorage.setItem(h,window.location.href)}catch(e){throw console.error("Unable to persist OAuth state",e),Error("Unable to access browser storage for OAuth. Please enable storage and retry.")}window.location.href=b}catch(s){console.error("Failed to start OAuth flow",s),i("error");let e=s instanceof Error?s.message:String(s);c(e),S.ZP.error(e)}},[s,r,t,a]),b=(0,j.useCallback)(async()=>{let e=null,s=null;try{let r=window.sessionStorage.getItem(x);if(!r)return;e=JSON.parse(r),s=JSON.parse(window.sessionStorage.getItem(m)||"null")}catch(e){console.error("Failed to read OAuth session state",e),p(),c("Failed to resume OAuth flow. Please retry."),i("error"),S.ZP.error("Failed to resume OAuth flow. Please retry.");return}if(e){window.sessionStorage.removeItem(x);try{if(!s||!s.state||!s.codeVerifier||!s.serverId)throw Error("Missing OAuth session state. Please retry.");if(!e.state||e.state!==s.state)throw Error("OAuth state mismatch. Please retry.");if(e.error)throw Error(e.error_description||e.error);if(!e.code)throw Error("Authorization code missing in callback.");i("exchanging");let r=await (0,_.exchangeMcpOAuthToken)({serverId:s.serverId,code:e.code,clientId:s.clientId,clientSecret:s.clientSecret,codeVerifier:s.codeVerifier,redirectUri:s.redirectUri});l(r),u(r),i("success"),c(null),S.ZP.success("OAuth token retrieved successfully")}catch(s){console.error("OAuth flow failed",s);let e=s instanceof Error?s.message:String(s);c(e),i("error"),S.ZP.error(e)}finally{p()}}},[l]);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{e||await b()})(),()=>{e=!0}},[b]),{startOAuthFlow:v,status:n,error:o,tokenResponse:d}},eb="".concat("../ui/assets/logos/","mcp_logo.png"),ey=[I.API_KEY,I.BEARER_TOKEN,I.BASIC],eN=[...ey,I.OAUTH2],e_="litellm-mcp-oauth-create-state";var ew=e=>{let{userRole:s,accessToken:r,onCreateSuccess:a,isModalVisible:n,setModalVisible:i,availableAccessGroups:o,prefillData:c,onBackToDiscovery:d}=e,[u]=P.Z.useForm(),[m,x]=(0,j.useState)(!1),[h,f]=(0,j.useState)({}),[b,y]=(0,j.useState)({}),[N,w]=(0,j.useState)(null),[C,Z]=(0,j.useState)(!1),[k,E]=(0,j.useState)([]),[L,z]=(0,j.useState)([]),[F,R]=(0,j.useState)(""),[V,U]=(0,j.useState)(""),[B,D]=(0,j.useState)(null),K=b.auth_type,H=!!K&&ey.includes(K),G=K===I.OAUTH2,Y=G&&b.oauth_flow_type===O.M2M,{startOAuthFlow:W,status:$,error:Q,tokenResponse:X}=ej({accessToken:r,getCredentials:()=>u.getFieldValue("credentials"),getTemporaryPayload:()=>{let e=u.getFieldsValue(!0),s=e.url,r=e.transport||F;if(!s||!r)return null;let t=Array.isArray(e.static_headers)?e.static_headers.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{};return{server_id:void 0,server_name:e.server_name,alias:e.alias,description:e.description,url:s,transport:r,auth_type:I.OAUTH2,credentials:e.credentials,authorization_url:e.authorization_url,token_url:e.token_url,registration_url:e.registration_url,mcp_access_groups:e.mcp_access_groups,static_headers:t,command:e.command,args:e.args,env:e.env}},onTokenReceived:e=>{var s;D(null!==(s=null==e?void 0:e.access_token)&&void 0!==s?s:null)},onBeforeRedirect:()=>{try{let e=u.getFieldsValue(!0);window.sessionStorage.setItem(e_,JSON.stringify({modalVisible:n,formValues:e,transportType:F,costConfig:h,allowedTools:L,searchValue:V,aliasManuallyEdited:C}))}catch(e){console.warn("Failed to persist MCP create state",e)}}});j.useEffect(()=>{let e=window.sessionStorage.getItem(e_);if(e)try{var s;let r=JSON.parse(e);r.modalVisible&&i(!0);let t=(null===(s=r.formValues)||void 0===s?void 0:s.transport)||r.transportType||"";t&&R(t),r.formValues&&w({values:r.formValues,transport:t}),r.costConfig&&f(r.costConfig),r.allowedTools&&z(r.allowedTools),r.searchValue&&U(r.searchValue),"boolean"==typeof r.aliasManuallyEdited&&Z(r.aliasManuallyEdited)}catch(e){console.error("Failed to restore MCP create state",e)}finally{window.sessionStorage.removeItem(e_)}},[u,i]),j.useEffect(()=>{N&&(F||N.transport,(!N.transport||F)&&(u.setFieldsValue(N.values),y(N.values),w(null)))},[N,u,F]),j.useEffect(()=>{if(!n||!c)return;let e=(c.name||"").replace(/[^a-zA-Z0-9_]/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),s=c.transport||"";R(s);let r={server_name:e,alias:e,description:c.description||"",transport:s};if("stdio"===s){let e={};if(c.command&&(e.command=c.command),c.args&&c.args.length>0&&(e.args=c.args),c.env_vars&&c.env_vars.length>0){let s={};for(let e of c.env_vars)s[e.name]=e.description?"<".concat(e.description,">"):"";e.env=s}Object.keys(e).length>0&&(r.stdio_config=JSON.stringify(e,null,2))}else c.url&&(r.url=c.url);u.setFieldsValue(r),y(r),Z(!1)},[n,c,u]);let ee=async e=>{x(!0);try{let{static_headers:s,stdio_config:t,credentials:l,allow_all_keys:n,available_on_public_internet:o,...c}=e,d=c.mcp_access_groups,m=Array.isArray(s)?s.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{},x=l&&"object"==typeof l?Object.entries(l).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,p={};if(t&&"stdio"===F)try{let e=JSON.parse(t),s=e;if(e.mcpServers&&"object"==typeof e.mcpServers){let r=Object.keys(e.mcpServers);if(r.length>0){let t=r[0];s=e.mcpServers[t],c.server_name||(c.server_name=t.replace(/-/g,"_"))}}p={command:s.command,args:s.args,env:s.env},console.log("Parsed stdio config:",p)}catch(e){S.ZP.fromBackend("Invalid JSON in stdio configuration");return}let g={...c,...p,stdio_config:void 0,mcp_info:{server_name:c.server_name||c.url,description:c.description,mcp_server_cost_info:Object.keys(h).length>0?h:null},mcp_access_groups:d,alias:c.alias,allowed_tools:L.length>0?L:null,allow_all_keys:!!n,available_on_public_internet:!!o,static_headers:m};if(g.static_headers=m,c.auth_type&&eN.includes(c.auth_type)&&x&&Object.keys(x).length>0&&(g.credentials=x),console.log("Payload: ".concat(JSON.stringify(g))),null!=r){let e=await (0,_.createMCPServer)(r,g);S.ZP.success("MCP Server created successfully"),u.resetFields(),f({}),E([]),z([]),Z(!1),i(!1),a(e)}}catch(e){S.ZP.fromBackend("Error creating MCP Server: "+e)}finally{x(!1)}},er=()=>{u.resetFields(),f({}),E([]),z([]),Z(!1),i(!1)};return(j.useEffect(()=>{if(!C&&b.server_name){let e=b.server_name.replace(/\s+/g,"_");u.setFieldsValue({alias:e}),y(s=>({...s,alias:e}))}},[b.server_name]),j.useEffect(()=>{n||y({})},[n]),(0,l.tY)(s))?(0,t.jsx)(g.Z,{title:(0,t.jsxs)("div",{className:"flex items-center pb-4 border-b border-gray-100",style:{gap:12},children:[d&&(0,t.jsx)("button",{onClick:d,className:"text-sm text-blue-600 hover:text-blue-800 cursor-pointer bg-transparent border-none",style:{flexShrink:0},children:"←"}),(0,t.jsx)("img",{src:eb,alt:"MCP Logo",className:"w-8 h-8 object-contain",style:{height:"20px",width:"20px",objectFit:"contain"}}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add New MCP Server"})]}),open:n,width:1e3,onCancel:er,footer:null,className:"top-8",styles:{body:{padding:"24px"},header:{padding:"24px 24px 0 24px",border:"none"}},children:(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsxs)(P.Z,{form:u,onFinish:ee,onValuesChange:(e,s)=>y(s),layout:"vertical",className:"space-y-6",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["MCP Server Name",(0,t.jsx)(v.Z,{title:"Best practice: Use a descriptive name that indicates the server's purpose (e.g., 'GitHub_MCP', 'Email_Service'). Cannot contain spaces or hyphens; use underscores instead. Names must comply with SEP-986 and will be rejected if invalid (https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names).",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"server_name",rules:[{required:!1,message:"Please enter a server name"},{validator:(e,s)=>ep(s)}],children:(0,t.jsx)(M.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Alias",(0,t.jsx)(v.Z,{title:"A short, unique identifier for this server. Defaults to the server name if not provided. Cannot contain spaces or hyphens; use underscores instead.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"alias",rules:[{required:!1},{validator:(e,s)=>ep(s)}],children:(0,t.jsx)(M.o,{placeholder:"e.g., GitHub_MCP, Zapier_MCP, etc.",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500",onChange:()=>Z(!0)})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Description"}),name:"description",rules:[{required:!1,message:"Please enter a server description"}],children:(0,t.jsx)(M.o,{placeholder:"Brief description of what this server does",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Transport Type"}),name:"transport",rules:[{required:!0,message:"Please select a transport type"}],children:(0,t.jsxs)(p.default,{placeholder:"Select transport",className:"rounded-lg",size:"large",onChange:e=>{R(e),"stdio"===e?u.setFieldsValue({url:void 0,auth_type:void 0,credentials:void 0}):u.setFieldsValue({command:void 0,args:void 0,env:void 0})},value:F,children:[(0,t.jsx)(p.default.Option,{value:"http",children:"Streamable HTTP (Recommended)"}),(0,t.jsx)(p.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(p.default.Option,{value:"stdio",children:"Standard Input/Output (stdio)"})]})}),"stdio"!==F&&(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"MCP Server URL"}),name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>eh(s)}],children:(0,t.jsx)(A.default,{placeholder:"https://your-mcp-server.com",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),"stdio"!==F&&(0,t.jsx)(P.Z.Item,{label:(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Authentication"}),name:"auth_type",rules:[{required:!0,message:"Please select an auth type"}],children:(0,t.jsxs)(p.default,{placeholder:"Select auth type",className:"rounded-lg",size:"large",children:[(0,t.jsx)(p.default.Option,{value:"none",children:"None"}),(0,t.jsx)(p.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(p.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(p.default.Option,{value:"basic",children:"Basic Auth"}),(0,t.jsx)(p.default.Option,{value:"oauth2",children:"OAuth"})]})}),"stdio"!==F&&H&&(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,t.jsx)(v.Z,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{required:!0,message:"Please enter the authentication value"}],children:(0,t.jsx)(M.o,{type:"password",placeholder:"Enter token or secret",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),"stdio"!==F&&G&&(0,t.jsx)(q,{isM2M:Y,initialFlowType:O.INTERACTIVE,oauthFlow:{startOAuthFlow:W,status:$,error:Q,tokenResponse:X}}),(0,t.jsx)(el,{isVisible:"stdio"===F})]}),(0,t.jsx)("div",{className:"mt-8",children:(0,t.jsx)(ed,{availableAccessGroups:o,mcpServer:null,searchValue:V,setSearchValue:U,getAccessGroupOptions:()=>{let e=o.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return V&&!o.some(e=>e.toLowerCase().includes(V.toLowerCase()))&&e.push({value:V,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:V}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-8 pt-6 border-t border-gray-200",children:(0,t.jsx)(es,{accessToken:r,oauthAccessToken:B,formValues:b,onToolsLoaded:E})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(et,{accessToken:r,oauthAccessToken:B,formValues:b,allowedTools:L,existingAllowedTools:null,onAllowedToolsChange:z})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(J,{value:h,onChange:f,tools:k.filter(e=>L.includes(e.name)),disabled:!1})}),(0,t.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-6 border-t border-gray-100",children:[(0,t.jsx)(M.z,{variant:"secondary",onClick:er,children:"Cancel"}),(0,t.jsx)(M.z,{variant:"primary",loading:m,children:m?"Creating...":"Add MCP Server"})]})]})})}):null},eC=r(5945),eZ=r(64935),eS=r(30401),ek=r(78867),eP=r(11239),eA=r(54001),eT=r(96137),eM=r(96362),eI=r(80221),eO=r(29202),eE=r(59872);let{Title:eL,Text:ez}=h.default,{Panel:eF}=U.default,eR=e=>{let{icon:s,title:r,description:l,children:a,serverName:n,accessGroups:i=["dev-group"]}=e,[o,c]=(0,j.useState)(!1),d=()=>{let e={"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"};if(o&&n){let s=[n.replace(/\s+/g,"_"),...i].join(",");e["x-mcp-servers"]=s}return e};return(0,t.jsxs)(eC.Z,{className:"border border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)("span",{className:"p-2 rounded-lg bg-gray-50",children:s}),(0,t.jsxs)("div",{children:[(0,t.jsx)(eL,{level:5,className:"mb-0",children:r}),(0,t.jsx)(ez,{className:"text-gray-600",children:l})]})]}),n&&("Implementation Example"===r||"Configuration"===r)&&(0,t.jsxs)(P.Z.Item,{className:"mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(ea.Z,{size:"small",checked:o,onChange:c}),(0,t.jsxs)(ez,{className:"text-sm",children:["Limit tools to specific MCP servers or MCP groups by passing the ",(0,t.jsx)("code",{children:"x-mcp-servers"})," header"]})]}),o&&(0,t.jsx)(Y.Z,{className:"mt-2",type:"info",showIcon:!0,message:"Two Options",description:(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 1:"})," Get a specific server: ",(0,t.jsxs)("code",{children:['"',n.replace(/\s+/g,"_"),'"']})]}),(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Option 2:"})," Get a group of MCPs: ",(0,t.jsx)("code",{children:'"dev-group"'})]}),(0,t.jsxs)("p",{className:"mt-2 text-sm text-gray-600",children:["You can also mix both: ",(0,t.jsx)("code",{children:'"Server1,dev-group"'})]})]})})]}),j.Children.map(a,e=>{if(j.isValidElement(e)&&e.props.hasOwnProperty("code")&&e.props.hasOwnProperty("copyKey")){let s=e.props.code;if(s&&s.includes('"headers":'))return j.cloneElement(e,{code:s.replace(/"headers":\s*{[^}]*}/,'"headers": '.concat(JSON.stringify(d(),null,8)))})}return e})]})};var eq=e=>{let{currentServerAccessGroups:s=[]}=e,r=(0,_.getProxyBaseUrl)(),[l,a]=(0,j.useState)({}),[n,h]=(0,j.useState)({openai:[],litellm:[],cursor:[],http:[]}),[p]=(0,j.useState)("Zapier_MCP"),g=async(e,s)=>{await (0,eE.vQ)(e)&&(a(e=>({...e,[s]:!0})),setTimeout(()=>{a(e=>({...e,[s]:!1}))},2e3))},f=e=>{let{code:s,copyKey:r,title:a,className:n=""}=e;return(0,t.jsxs)("div",{className:"relative group",children:[a&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(eZ.Z,{size:16,className:"text-blue-600"}),(0,t.jsx)(ez,{strong:!0,className:"text-gray-700",children:a})]}),(0,t.jsxs)(eC.Z,{className:"bg-gray-50 border border-gray-200 relative ".concat(n),children:[(0,t.jsx)(W.ZP,{type:"text",size:"small",icon:l[r]?(0,t.jsx)(eS.Z,{size:12}):(0,t.jsx)(ek.Z,{size:12}),onClick:()=>g(s,r),className:"absolute top-2 right-2 z-10 transition-all duration-200 ".concat(l[r]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),(0,t.jsx)("pre",{className:"text-sm overflow-x-auto pr-10 text-gray-800 font-mono leading-relaxed",children:s})]})]})},v=e=>{let{step:s,title:r,children:l}=e;return(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("div",{className:"w-8 h-8 bg-blue-600 text-white rounded-full flex items-center justify-center text-sm font-semibold",children:s})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)(ez,{strong:!0,className:"text-gray-800 block mb-2",children:r}),l]})]})};return(0,t.jsx)("div",{children:(0,t.jsxs)(en.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(x.Z,{className:"text-3xl font-bold text-gray-900 mb-3",children:"Connect to your MCP client"}),(0,t.jsx)(m.Z,{className:"text-lg text-gray-600",children:"Use tools directly from any MCP client with LiteLLM MCP. Enable your AI assistant to perform real-world tasks through a simple, secure connection."})]}),(0,t.jsxs)(o.Z,{className:"w-full",children:[(0,t.jsx)(c.Z,{className:"flex justify-start mt-8 mb-6",children:(0,t.jsxs)("div",{className:"flex bg-gray-100 p-1 rounded-lg",children:[(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eZ.Z,{size:18}),"OpenAI API"]})}),(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eP.Z,{size:18}),"LiteLLM Proxy"]})}),(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eI.Z,{size:18}),"Cursor"]})}),(0,t.jsx)(i.Z,{className:"px-6 py-3 rounded-md transition-all duration-200",children:(0,t.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,t.jsx)(eO.Z,{size:18}),"Streamable HTTP"]})})]})}),(0,t.jsxs)(u.Z,{children:[(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(en.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 p-6 rounded-lg border border-blue-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eZ.Z,{className:"text-blue-600",size:24}),(0,t.jsx)(eL,{level:4,className:"mb-0 text-blue-900",children:"OpenAI Responses API Integration"})]}),(0,t.jsx)(ez,{className:"text-blue-700",children:"Connect OpenAI Responses API to your LiteLLM MCP server for seamless tool integration"})]}),(0,t.jsxs)(en.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(eR,{icon:(0,t.jsx)(eA.Z,{className:"text-blue-600",size:16}),title:"API Key Setup",description:"Configure your OpenAI API key for authentication",children:(0,t.jsxs)(en.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsxs)(ez,{children:["Get your API key from the"," ",(0,t.jsxs)("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 inline-flex items-center gap-1",children:["OpenAI platform ",(0,t.jsx)(eM.Z,{size:12})]})]})}),(0,t.jsx)(f,{title:"Environment Variable",code:'export OPENAI_API_KEY="sk-..."',copyKey:"openai-env"})]})}),(0,t.jsx)(eR,{icon:(0,t.jsx)(eT.Z,{className:"text-blue-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(f,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"openai-server-url"})}),(0,t.jsx)(eR,{icon:(0,t.jsx)(eZ.Z,{className:"text-blue-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the Responses API",serverName:"Zapier Gmail",accessGroups:["dev-group"],children:(0,t.jsx)(f,{code:'curl --location \'https://api.openai.com/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $OPENAI_API_KEY" \\\n--data \'{\n "model": "gpt-4.1",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "'.concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": "Zapier_MCP,dev-group"\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"openai-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(en.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-emerald-50 to-green-50 p-6 rounded-lg border border-emerald-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eP.Z,{className:"text-emerald-600",size:24}),(0,t.jsx)(eL,{level:4,className:"mb-0 text-emerald-900",children:"LiteLLM Proxy API Integration"})]}),(0,t.jsx)(ez,{className:"text-emerald-700",children:"Connect to LiteLLM Proxy Responses API for seamless tool integration with multiple model providers"})]}),(0,t.jsxs)(en.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(eR,{icon:(0,t.jsx)(eA.Z,{className:"text-emerald-600",size:16}),title:"Virtual Key Setup",description:"Configure your LiteLLM Proxy Virtual Key for authentication",children:(0,t.jsxs)(en.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(ez,{children:"Get your Virtual Key from your LiteLLM Proxy dashboard or contact your administrator"})}),(0,t.jsx)(f,{title:"Environment Variable",code:'export LITELLM_API_KEY="sk-..."',copyKey:"litellm-env"})]})}),(0,t.jsx)(eR,{icon:(0,t.jsx)(eT.Z,{className:"text-emerald-600",size:16}),title:"MCP Server Information",description:"Connection details for your LiteLLM MCP server",children:(0,t.jsx)(f,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"litellm-server-url"})}),(0,t.jsx)(eR,{icon:(0,t.jsx)(eZ.Z,{className:"text-emerald-600",size:16}),title:"Implementation Example",description:"Complete cURL example for using the LiteLLM Proxy Responses API",serverName:p,accessGroups:["dev-group"],children:(0,t.jsx)(f,{code:"curl --location '".concat(r,'/v1/responses\' \\\n--header \'Content-Type: application/json\' \\\n--header "Authorization: Bearer $LITELLM_VIRTUAL_KEY" \\\n--data \'{\n "model": "gpt-4",\n "tools": [\n {\n "type": "mcp",\n "server_label": "litellm",\n "server_url": "').concat(r,'/mcp",\n "require_approval": "never",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_VIRTUAL_KEY",\n "x-mcp-servers": "Zapier_MCP,dev-group"\n }\n }\n ],\n "input": "Run available tools",\n "tool_choice": "required"\n}\''),copyKey:"litellm-curl",className:"text-xs"})})]})]}),{})}),(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(en.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-purple-50 to-blue-50 p-6 rounded-lg border border-purple-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eI.Z,{className:"text-purple-600",size:24}),(0,t.jsx)(eL,{level:4,className:"mb-0 text-purple-900",children:"Cursor IDE Integration"})]}),(0,t.jsx)(ez,{className:"text-purple-700",children:"Use tools directly from Cursor IDE with LiteLLM MCP. Enable your AI assistant to perform real-world tasks without leaving your coding environment."})]}),(0,t.jsxs)(eC.Z,{className:"border border-gray-200",children:[(0,t.jsx)(eL,{level:5,className:"mb-4 text-gray-800",children:"Setup Instructions"}),(0,t.jsxs)(en.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsx)(v,{step:1,title:"Open Cursor Settings",children:(0,t.jsxs)(ez,{className:"text-gray-600",children:["Use the keyboard shortcut ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"⇧+⌘+J"})," (Mac) or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+Shift+J"})," (Windows/Linux)"]})}),(0,t.jsx)(v,{step:2,title:"Navigate to MCP Tools",children:(0,t.jsx)(ez,{className:"text-gray-600",children:'Go to the "MCP Tools" tab and click "New MCP Server"'})}),(0,t.jsxs)(v,{step:3,title:"Add Configuration",children:[(0,t.jsxs)(ez,{className:"text-gray-600 mb-3",children:["Copy the JSON configuration below and paste it into Cursor, then save with"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Cmd+S"})," or"," ",(0,t.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded",children:"Ctrl+S"})]}),(0,t.jsx)(eR,{icon:(0,t.jsx)(eZ.Z,{className:"text-purple-600",size:16}),title:"Configuration",description:"Cursor MCP configuration",serverName:"Zapier Gmail",accessGroups:["dev-group"],children:(0,t.jsx)(f,{code:'{\n "mcpServers": {\n "Zapier_MCP": {\n "url": "'.concat(r,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer YOUR_LITELLM_API_KEY",\n "x-mcp-servers": "Zapier_MCP,dev-group"\n }\n }\n }\n}'),copyKey:"cursor-config",className:"text-xs"})})]})]})]})]}),{})}),(0,t.jsx)(d.Z,{className:"mt-6",children:(0,t.jsx)(()=>(0,t.jsxs)(en.Z,{direction:"vertical",size:"large",className:"w-full",children:[(0,t.jsxs)("div",{className:"bg-gradient-to-r from-green-50 to-teal-50 p-6 rounded-lg border border-green-100",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,t.jsx)(eO.Z,{className:"text-green-600",size:24}),(0,t.jsx)(eL,{level:4,className:"mb-0 text-green-900",children:"Streamable HTTP Transport"})]}),(0,t.jsx)(ez,{className:"text-green-700",children:"Connect to LiteLLM MCP using HTTP transport. Compatible with any MCP client that supports HTTP streaming."})]}),(0,t.jsx)(eR,{icon:(0,t.jsx)(eO.Z,{className:"text-green-600",size:16}),title:"Universal MCP Connection",description:"Use this URL with any MCP client that supports HTTP transport",children:(0,t.jsxs)(en.Z,{direction:"vertical",size:"middle",className:"w-full",children:[(0,t.jsx)("div",{children:(0,t.jsx)(ez,{children:"Each MCP client supports different transports. Refer to your client documentation to determine the appropriate transport method."})}),(0,t.jsx)(f,{title:"Server URL",code:"".concat(r,"/mcp"),copyKey:"http-server-url"}),(0,t.jsx)(f,{title:"Headers Configuration",code:JSON.stringify({"x-litellm-api-key":"Bearer YOUR_LITELLM_API_KEY"},null,2),copyKey:"http-headers"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(W.ZP,{type:"link",className:"p-0 h-auto text-blue-600 hover:text-blue-700",href:"https://modelcontextprotocol.io/docs/concepts/transports",icon:(0,t.jsx)(eM.Z,{size:14}),children:"Learn more about MCP transports"})})]})})]}),{})})]})]})]})})},eV=r(58927),eU=r(53410),eB=r(74998);let eD=(e,s,r,l,a)=>[{accessorKey:"server_id",header:"Server ID",cell:e=>{let{row:r}=e;return(0,t.jsxs)("button",{onClick:()=>s(r.original.server_id),className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[15ch]",children:[r.original.server_id.slice(0,7),"..."]})}},{accessorKey:"server_name",header:"Name"},{accessorKey:"alias",header:"Alias"},{id:"url",header:"URL",cell:e=>{let{row:s}=e,r=s.original.url;if(!r)return(0,t.jsx)("span",{className:"text-gray-400",children:"—"});let{maskedUrl:l}=ex(r);return(0,t.jsx)("span",{className:"font-mono text-sm",children:l})}},{accessorKey:"transport",header:"Transport",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:(s()||"http").toUpperCase()})}},{accessorKey:"auth_type",header:"Auth Type",cell:e=>{let{getValue:s}=e;return(0,t.jsx)("span",{children:s()||"none"})}},{id:"health_status",header:"Health Status",cell:e=>{let{row:s}=e,r=s.original,l=r.status||"unknown",n=r.last_health_check,i=r.health_check_error;if(a)return(0,t.jsxs)("div",{className:"flex items-center text-gray-500",children:[(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-1",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,t.jsx)("span",{className:"text-xs",children:"Loading..."})]});let o=(0,t.jsxs)("div",{className:"max-w-xs",children:[(0,t.jsxs)("div",{className:"font-semibold mb-1",children:["Health Status: ",l]}),n&&(0,t.jsxs)("div",{className:"text-xs mb-1",children:["Last Check: ",new Date(n).toLocaleString()]}),i&&(0,t.jsxs)("div",{className:"text-xs",children:[(0,t.jsx)("div",{className:"font-medium text-red-400 mb-1",children:"Error:"}),(0,t.jsx)("div",{className:"break-words",children:i})]}),!n&&!i&&(0,t.jsx)("div",{className:"text-xs text-gray-400",children:"No health check data available"})]});return(0,t.jsx)(v.Z,{title:o,placement:"top",children:(0,t.jsxs)("button",{className:"font-mono text-xs font-normal px-2 py-0.5 text-left w-full truncate whitespace-nowrap cursor-pointer max-w-[10ch] ".concat((e=>{switch(e){case"healthy":return"text-green-500 bg-green-50 hover:bg-green-100";case"unhealthy":return"text-red-500 bg-red-50 hover:bg-red-100";default:return"text-gray-500 bg-gray-50 hover:bg-gray-100"}})(l)),children:[(0,t.jsx)("span",{className:"mr-1",children:"●"}),l.charAt(0).toUpperCase()+l.slice(1)]})})}},{id:"mcp_access_groups",header:"Access Groups",cell:e=>{let{row:s}=e,r=s.original.mcp_access_groups;if(Array.isArray(r)&&r.length>0&&"string"==typeof r[0]){let e=r.join(", ");return(0,t.jsx)(v.Z,{title:e,children:(0,t.jsx)("span",{className:"max-w-[200px] truncate block",children:e.length>30?"".concat(e.slice(0,30),"..."):e})})}return(0,t.jsx)("span",{className:"text-gray-400 italic",children:"None"})}},{id:"available_on_public_internet",header:"Network Access",cell:e=>{let{row:s}=e;return s.original.available_on_public_internet?(0,t.jsx)("span",{className:"px-2 py-0.5 bg-green-50 text-green-700 rounded text-xs font-medium",children:"Public"}):(0,t.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded text-xs font-medium",children:"Internal"})}},{header:"Created At",accessorKey:"created_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.created_at?new Date(r.created_at).toLocaleDateString():"-"})}},{header:"Updated At",accessorKey:"updated_at",sortingFn:"datetime",cell:e=>{let{row:s}=e,r=s.original;return(0,t.jsx)("span",{className:"text-xs",children:r.updated_at?new Date(r.updated_at).toLocaleDateString():"-"})}},{id:"actions",header:"Actions",cell:e=>{let{row:s}=e;return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(v.Z,{title:"Edit MCP Server",children:(0,t.jsx)(eV.J,{icon:eU.Z,size:"sm",onClick:()=>r(s.original.server_id),className:"cursor-pointer hover:text-blue-600"})}),(0,t.jsx)(v.Z,{title:"Delete MCP Server",children:(0,t.jsx)(eV.J,{icon:eB.Z,size:"sm",onClick:()=>l(s.original.server_id),className:"cursor-pointer hover:text-red-600"})})]})}}];var eK=r(10900),eH=r(82376),eJ=r(71437),eG=r(12514),eY=r(67101),eW=r(47323),e$=r(71618);let eQ=[I.API_KEY,I.BEARER_TOKEN,I.BASIC],eX=[...eQ,I.OAUTH2],e0="litellm-mcp-oauth-edit-state";var e2=e=>{var s;let{mcpServer:r,accessToken:l,onCancel:a,onSuccess:n,availableAccessGroups:i}=e,[o]=P.Z.useForm(),[c,d]=(0,j.useState)({}),[u,m]=(0,j.useState)([]),[x,h]=(0,j.useState)(!1),[g,f]=(0,j.useState)(""),[b,y]=(0,j.useState)(!1),[N,w]=(0,j.useState)([]),[C,Z]=(0,j.useState)(null),k=P.Z.useWatch("auth_type",o),M="stdio"===P.Z.useWatch("transport",o),E=!!k&&eQ.includes(k),L=k===I.OAUTH2;P.Z.useWatch("oauth_flow_type",o),L&&O.M2M;let[z,F]=(0,j.useState)(null),{startOAuthFlow:R,status:q,error:V,tokenResponse:U}=ej({accessToken:l,getCredentials:()=>o.getFieldValue("credentials"),getTemporaryPayload:()=>{let e=o.getFieldsValue(!0),s=e.url||r.url,t=e.transport||r.transport;if(!s||!t)return null;let l=Array.isArray(e.static_headers)?e.static_headers.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{};return{server_id:r.server_id,server_name:e.server_name||r.server_name||r.alias,alias:e.alias||r.alias,description:e.description||r.description,url:s,transport:t,auth_type:I.OAUTH2,credentials:e.credentials,mcp_access_groups:e.mcp_access_groups||r.mcp_access_groups,static_headers:l,command:e.command,args:e.args,env:e.env}},onTokenReceived:e=>{var s;F(null!==(s=null==e?void 0:e.access_token)&&void 0!==s?s:null)},onBeforeRedirect:()=>{try{let e=o.getFieldsValue(!0);window.sessionStorage.setItem(e0,JSON.stringify({serverId:r.server_id,formValues:e,costConfig:c,allowedTools:N,searchValue:g,aliasManuallyEdited:b}))}catch(e){console.warn("Failed to persist MCP edit state",e)}}}),B=j.useMemo(()=>r.static_headers?Object.entries(r.static_headers).map(e=>{let[s,r]=e;return{header:s,value:null!=r?String(r):""}}):[],[r.static_headers]),D=j.useMemo(()=>{var e;let s=null!==(e=r.env)&&void 0!==e?e:void 0;if(!s||0===Object.keys(s).length)return"";try{return JSON.stringify(s,null,2)}catch(e){return""}},[r.env]),K=j.useMemo(()=>({...r,static_headers:B,oauth_flow_type:r.token_url?O.M2M:O.INTERACTIVE}),[r,B,D]);(0,j.useEffect)(()=>{var e;(null===(e=r.mcp_info)||void 0===e?void 0:e.mcp_server_cost_info)&&d(r.mcp_info.mcp_server_cost_info)},[r]),(0,j.useEffect)(()=>{r.allowed_tools&&w(r.allowed_tools)},[r]),(0,j.useEffect)(()=>{let e=window.sessionStorage.getItem(e0);if(e)try{let s=JSON.parse(e);if(!s||s.serverId!==r.server_id)return;s.formValues&&Z({...r,...s.formValues}),s.costConfig&&d(s.costConfig),s.allowedTools&&w(s.allowedTools),s.searchValue&&f(s.searchValue),"boolean"==typeof s.aliasManuallyEdited&&y(s.aliasManuallyEdited)}catch(e){console.error("Failed to restore MCP edit state",e)}finally{window.sessionStorage.removeItem(e0)}},[o,r]),(0,j.useEffect)(()=>{if(!C)return;let e=C.transport||r.transport;if(e&&e!==o.getFieldValue("transport")){o.setFieldsValue({transport:e});return}o.setFieldsValue(C),Z(null)},[C,o,r.transport]),(0,j.useEffect)(()=>{if(r.mcp_access_groups){let e=r.mcp_access_groups.map(e=>"string"==typeof e?e:e.name||String(e));o.setFieldValue("mcp_access_groups",e)}},[r]),(0,j.useEffect)(()=>{H()},[r,l,z]);let H=async()=>{if(!l||"stdio"!==r.transport&&!r.url)return;let e=r.auth_type===I.OAUTH2&&!!r.token_url;if(r.auth_type!==I.OAUTH2||e||z){h(!0);try{let e={server_id:r.server_id,server_name:r.server_name,url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info,authorization_url:r.authorization_url,token_url:r.token_url,registration_url:r.registration_url,command:r.command,args:r.args,env:r.env},s=await (0,_.testMCPToolsListRequest)(l,e,z);s.tools&&!s.error?m(s.tools):(console.error("Failed to fetch tools:",s.message),m([]))}catch(e){console.error("Tools fetch error:",e),m([])}finally{h(!1)}}},G=async e=>{if(l)try{let{static_headers:s,credentials:t,stdio_config:a,env_json:i,command:o,args:d,allow_all_keys:u,available_on_public_internet:m,...x}=e,h=(x.mcp_access_groups||[]).map(e=>"string"==typeof e?e:e.name||String(e)),p=Array.isArray(s)?s.reduce((e,s)=>{var r,t;let l=null==s?void 0:null===(r=s.header)||void 0===r?void 0:r.trim();return l&&(e[l]=null!==(t=null==s?void 0:s.value)&&void 0!==t?t:""),e},{}):{},g=t&&"object"==typeof t?Object.entries(t).reduce((e,s)=>{let[r,t]=s;if(null==t||""===t)return e;if("scopes"===r){if(Array.isArray(t)){let s=t.filter(e=>null!=e&&""!==e);s.length>0&&(e[r]=s)}}else e[r]=t;return e},{}):void 0,f={};if("stdio"===x.transport){if(a)try{let e=JSON.parse(a),s=e;if((null==e?void 0:e.mcpServers)&&"object"==typeof e.mcpServers){let r=Object.keys(e.mcpServers);r.length>0&&(s=e.mcpServers[r[0]])}let r=Array.isArray(null==s?void 0:s.args)?s.args.map(e=>String(e)).filter(e=>""!==e.trim()):[],t=(null==s?void 0:s.env)&&"object"==typeof s.env&&!Array.isArray(s.env)?Object.entries(s.env).reduce((e,s)=>{let[r,t]=s;return null==r||""===String(r).trim()||(e[String(r)]=null==t?"":String(t)),e},{}):{};if(!(f={command:(null==s?void 0:s.command)?String(s.command):void 0,args:r,env:t}).command){S.ZP.fromBackend("Stdio configuration must include a command");return}}catch(e){S.ZP.fromBackend("Invalid JSON in stdio configuration");return}else{let e={};if(i)try{let s=JSON.parse(i);s&&"object"==typeof s&&!Array.isArray(s)&&(e=Object.entries(s).reduce((e,s)=>{let[r,t]=s;return null==r||""===String(r).trim()||(e[String(r)]=null==t?"":String(t)),e},{}))}catch(e){S.ZP.fromBackend("Invalid JSON in stdio env configuration");return}let s=Array.isArray(d)?d.map(e=>String(e)).filter(e=>""!==e.trim()):[],r=o?String(o).trim():"";if(!r){S.ZP.fromBackend("Stdio transport requires a command");return}f={command:r,args:s,env:e}}}let v=x.server_name||x.url||r.server_name||r.url||x.alias||r.alias||"unknown",j={...x,...f,stdio_config:void 0,env_json:void 0,server_id:r.server_id,mcp_info:{server_name:v,description:x.description,mcp_server_cost_info:Object.keys(c).length>0?c:null},mcp_access_groups:h,alias:x.alias,extra_headers:x.extra_headers||[],allowed_tools:N.length>0?N:null,disallowed_tools:x.disallowed_tools||[],static_headers:p,allow_all_keys:!!(null!=u?u:r.allow_all_keys),available_on_public_internet:!!(null!=m?m:r.available_on_public_internet)};x.auth_type&&eX.includes(x.auth_type)&&g&&Object.keys(g).length>0&&(j.credentials=g);let b=await (0,_.updateMCPServer)(l,j);S.ZP.success("MCP Server updated successfully"),n(b)}catch(e){S.ZP.fromBackend("Failed to update MCP Server"+((null==e?void 0:e.message)?": ".concat(e.message):""))}};return(0,t.jsxs)(e$.v0,{children:[(0,t.jsxs)(e$.td,{className:"grid w-full grid-cols-2",children:[(0,t.jsx)(e$.OK,{children:"Server Configuration"}),(0,t.jsx)(e$.OK,{children:"Cost Configuration"})]}),(0,t.jsxs)(e$.nP,{className:"mt-6",children:[(0,t.jsx)(e$.x4,{children:(0,t.jsxs)(P.Z,{form:o,onFinish:G,initialValues:K,layout:"vertical",children:[(0,t.jsx)(P.Z.Item,{label:"MCP Server Name",name:"server_name",rules:[{validator:(e,s)=>ep(s)}],children:(0,t.jsx)(A.default,{className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(P.Z.Item,{label:"Alias",name:"alias",rules:[{validator:(e,s)=>ep(s)}],children:(0,t.jsx)(A.default,{onChange:()=>y(!0),className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(P.Z.Item,{label:"Description",name:"description",children:(0,t.jsx)(A.default,{className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(P.Z.Item,{label:"Transport Type",name:"transport",rules:[{required:!0}],children:(0,t.jsxs)(p.default,{onChange:e=>{"stdio"===e?o.setFieldsValue({url:void 0,auth_type:void 0,credentials:void 0,authorization_url:void 0,token_url:void 0,registration_url:void 0}):o.setFieldsValue({command:void 0,args:void 0,env_json:void 0,stdio_config:void 0})},children:[(0,t.jsx)(p.default.Option,{value:"sse",children:"Server-Sent Events (SSE)"}),(0,t.jsx)(p.default.Option,{value:"http",children:"Streamable HTTP (Recommended)"}),(0,t.jsx)(p.default.Option,{value:"stdio",children:"Standard Input/Output (stdio)"})]})}),!M&&(0,t.jsx)(P.Z.Item,{label:"MCP Server URL",name:"url",rules:[{required:!0,message:"Please enter a server URL"},{validator:(e,s)=>eh(s)}],children:(0,t.jsx)(A.default,{placeholder:"https://your-mcp-server.com",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),!M&&(0,t.jsx)(P.Z.Item,{label:"Authentication",name:"auth_type",rules:[{required:!0}],children:(0,t.jsxs)(p.default,{children:[(0,t.jsx)(p.default.Option,{value:"none",children:"None"}),(0,t.jsx)(p.default.Option,{value:"api_key",children:"API Key"}),(0,t.jsx)(p.default.Option,{value:"bearer_token",children:"Bearer Token"}),(0,t.jsx)(p.default.Option,{value:"basic",children:"Basic Auth"}),(0,t.jsx)(p.default.Option,{value:"oauth2",children:"OAuth"})]})}),M&&(0,t.jsxs)("div",{className:"rounded-lg border border-gray-200 p-4 space-y-4",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Configure the stdio transport used to launch the MCP server process. You can either fill in the fields below or paste a JSON configuration."}),(0,t.jsx)(P.Z.Item,{label:"Command",name:"command",rules:[{required:!0,message:"Please enter a command for stdio transport"}],children:(0,t.jsx)(A.default,{placeholder:"e.g., npx",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(P.Z.Item,{label:"Args",name:"args",children:(0,t.jsx)(p.default,{mode:"tags",size:"large",tokenSeparators:[","],placeholder:"Add args (press enter or comma)",className:"rounded-lg"})}),(0,t.jsx)(P.Z.Item,{label:"Environment (JSON object)",name:"env_json",rules:[{validator:(e,s)=>{if(!s)return Promise.resolve();try{let e=JSON.parse(s);if(e&&"object"==typeof e&&!Array.isArray(e))return Promise.resolve();return Promise.reject(Error("Env must be a JSON object"))}catch(e){return Promise.reject(Error("Please enter valid JSON"))}}}],children:(0,t.jsx)(A.default.TextArea,{rows:6,className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500 font-mono text-sm",placeholder:'{\n "KEY": "value"\n}'})}),(0,t.jsx)(el,{isVisible:!0,required:!1})]}),!M&&E&&(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authentication Value",(0,t.jsx)(v.Z,{title:"Token, password, or header value to send with each request for the selected auth type.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","auth_value"],rules:[{validator:(e,s)=>s&&"string"==typeof s&&""===s.trim()?Promise.reject(Error("Authentication value cannot be empty")):Promise.resolve()}],children:(0,t.jsx)(A.default.Password,{placeholder:"Enter token or secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),!M&&L&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client ID (optional)",(0,t.jsx)(v.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_id"],children:(0,t.jsx)(A.default.Password,{placeholder:"Enter OAuth client ID (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Client Secret (optional)",(0,t.jsx)(v.Z,{title:"Provide only if your MCP server cannot handle dynamic client registration.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","client_secret"],children:(0,t.jsx)(A.default.Password,{placeholder:"Enter OAuth client secret (leave blank to keep existing)",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["OAuth Scopes (optional)",(0,t.jsx)(v.Z,{title:"Add scopes to override the default scope list used for this MCP server.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:["credentials","scopes"],children:(0,t.jsx)(p.default,{mode:"tags",tokenSeparators:[","],placeholder:"Add scopes",className:"rounded-lg",size:"large"})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Authorization URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the authorization endpoint.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"authorization_url",children:(0,t.jsx)(A.default,{placeholder:"https://example.com/oauth/authorize",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Token URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the token endpoint.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"token_url",children:(0,t.jsx)(A.default,{placeholder:"https://example.com/oauth/token",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:["Registration URL Override (optional)",(0,t.jsx)(v.Z,{title:"Optional override for the dynamic client registration endpoint.",children:(0,t.jsx)(T.Z,{className:"ml-2 text-blue-400 hover:text-blue-600 cursor-help"})})]}),name:"registration_url",children:(0,t.jsx)(A.default,{placeholder:"https://example.com/oauth/register",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})}),(0,t.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-4 space-y-2",children:[(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Use OAuth to fetch a fresh access token and temporarily save it in the session as the authentication value."}),(0,t.jsx)(e$.zx,{variant:"secondary",onClick:R,disabled:"authorizing"===q||"exchanging"===q,children:"authorizing"===q?"Waiting for authorization...":"exchanging"===q?"Exchanging authorization code...":"Authorize & Fetch Token"}),V&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:V}),"success"===q&&(null==U?void 0:U.access_token)&&(0,t.jsxs)("p",{className:"text-sm text-green-600",children:["Token fetched. Expires in ",null!==(s=U.expires_in)&&void 0!==s?s:"?"," seconds."]})]})]}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(ed,{availableAccessGroups:i,mcpServer:r,searchValue:g,setSearchValue:f,getAccessGroupOptions:()=>{let e=i.map(e=>({value:e,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})}));return g&&!i.some(e=>e.toLowerCase().includes(g.toLowerCase()))&&e.push({value:g,label:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:g}),(0,t.jsx)("span",{className:"text-gray-400 text-xs ml-1",children:"create new group"})]})}),e}})}),(0,t.jsx)("div",{className:"mt-6",children:(0,t.jsx)(et,{accessToken:l,oauthAccessToken:z,formValues:{server_id:r.server_id,server_name:r.server_name,url:r.url,transport:r.transport,auth_type:r.auth_type,mcp_info:r.mcp_info,oauth_flow_type:r.token_url?O.M2M:O.INTERACTIVE},allowedTools:N,existingAllowedTools:r.allowed_tools||null,onAllowedToolsChange:w})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(W.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(e$.zx,{type:"submit",children:"Save Changes"})]})]})}),(0,t.jsx)(e$.x4,{children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(J,{value:c,onChange:d,tools:u,disabled:x}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(W.ZP,{onClick:a,children:"Cancel"}),(0,t.jsx)(e$.zx,{onClick:()=>o.submit(),children:"Save Changes"})]})]})})]})]})},e1=r(92280),e4=e=>{let{costConfig:s}=e,r=(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null,l=(null==s?void 0:s.tool_name_to_cost_per_query)&&Object.keys(s.tool_name_to_cost_per_query).length>0;return r||l?(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsxs)("div",{className:"space-y-4",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)("div",{children:[(0,t.jsx)(e1.x,{className:"font-medium",children:"Default Cost per Query"}),(0,t.jsxs)("div",{className:"text-green-600 font-mono",children:["$",s.default_cost_per_query.toFixed(4)]})]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)("div",{children:[(0,t.jsx)(e1.x,{className:"font-medium",children:"Tool-Specific Costs"}),(0,t.jsx)("div",{className:"mt-2 space-y-2",children:Object.entries(s.tool_name_to_cost_per_query).map(e=>{let[s,r]=e;return null!=r&&(0,t.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,t.jsx)(e1.x,{className:"font-medium",children:s}),(0,t.jsxs)(e1.x,{className:"text-green-600 font-mono",children:["$",r.toFixed(4)," per query"]})]},s)})})]}),(0,t.jsxs)("div",{className:"mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,t.jsx)(e1.x,{className:"text-blue-800 font-medium",children:"Cost Summary:"}),(0,t.jsxs)("div",{className:"mt-2 space-y-1",children:[r&&(null==s?void 0:s.default_cost_per_query)!==void 0&&(null==s?void 0:s.default_cost_per_query)!==null&&(0,t.jsxs)(e1.x,{className:"text-blue-700",children:["• Default cost: $",s.default_cost_per_query.toFixed(4)," per query"]}),l&&(null==s?void 0:s.tool_name_to_cost_per_query)&&(0,t.jsxs)(e1.x,{className:"text-blue-700",children:["• ",Object.keys(s.tool_name_to_cost_per_query).length," tool(s) with custom pricing"]})]})]})]})}):(0,t.jsx)("div",{className:"mt-6 pt-6 border-t border-gray-200",children:(0,t.jsx)("div",{className:"space-y-4",children:(0,t.jsx)("div",{className:"p-4 bg-gray-50 border border-gray-200 rounded-lg",children:(0,t.jsx)(e1.x,{className:"text-gray-600",children:"No cost configuration set for this server. Tool calls will be charged at $0.00 per tool call."})})})})};let e5=e=>{var s,r,l,a,h,p;let{mcpServer:g,onBack:f,isEditing:v,isProxyAdmin:b,accessToken:y,userRole:N,userID:_,availableAccessGroups:w}=e,[C,Z]=(0,j.useState)(v),[S,k]=(0,j.useState)(!1),[P,A]=(0,j.useState)({}),[T,M]=(0,j.useState)(0),I=null!==(a=g.url)&&void 0!==a?a:"",{maskedUrl:O,hasToken:E}=I?ex(I):{maskedUrl:"—",hasToken:!1},F=(e,s)=>e?E?s?e:O:e:"—",R=async(e,s)=>{await (0,eE.vQ)(e)&&(A(e=>({...e,[s]:!0})),setTimeout(()=>{A(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"p-4 max-w-full",children:[(0,t.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(n.Z,{icon:eK.Z,variant:"light",className:"mb-4",onClick:f,children:"Back to All Servers"}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(x.Z,{children:g.server_name}),(0,t.jsx)(W.ZP,{type:"text",size:"small",icon:P["mcp-server_name"]?(0,t.jsx)(eS.Z,{size:12}):(0,t.jsx)(ek.Z,{size:12}),onClick:()=>R(g.server_name,"mcp-server_name"),className:"left-2 z-10 transition-all duration-200 ".concat(P["mcp-server_name"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")}),g.alias&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"ml-4 text-gray-500",children:"Alias:"}),(0,t.jsx)("span",{className:"ml-1 font-mono text-blue-600",children:g.alias}),(0,t.jsx)(W.ZP,{type:"text",size:"small",icon:P["mcp-alias"]?(0,t.jsx)(eS.Z,{size:12}):(0,t.jsx)(ek.Z,{size:12}),onClick:()=>R(g.alias,"mcp-alias"),className:"left-2 z-10 transition-all duration-200 ".concat(P["mcp-alias"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)(m.Z,{className:"text-gray-500 font-mono",children:g.server_id}),(0,t.jsx)(W.ZP,{type:"text",size:"small",icon:P["mcp-server-id"]?(0,t.jsx)(eS.Z,{size:12}):(0,t.jsx)(ek.Z,{size:12}),onClick:()=>R(g.server_id,"mcp-server-id"),className:"left-2 z-10 transition-all duration-200 ".concat(P["mcp-server-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,t.jsxs)(o.Z,{index:T,onIndexChange:M,children:[(0,t.jsx)(c.Z,{className:"mb-4",children:[(0,t.jsx)(i.Z,{children:"Overview"},"overview"),(0,t.jsx)(i.Z,{children:"MCP Tools"},"tools"),...b?[(0,t.jsx)(i.Z,{children:"Settings"},"settings")]:[]]}),(0,t.jsxs)(u.Z,{children:[(0,t.jsxs)(d.Z,{children:[(0,t.jsxs)(eY.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,t.jsxs)(eG.Z,{children:[(0,t.jsx)(m.Z,{children:"Transport"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(x.Z,{children:L(null!==(h=g.transport)&&void 0!==h?h:void 0)})})]}),(0,t.jsxs)(eG.Z,{children:[(0,t.jsx)(m.Z,{children:"Auth Type"}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(m.Z,{children:z(null!==(p=g.auth_type)&&void 0!==p?p:void 0)})})]}),(0,t.jsxs)(eG.Z,{children:[(0,t.jsx)(m.Z,{children:"Host Url"}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsx)(m.Z,{className:"break-all overflow-wrap-anywhere",children:F(g.url,S)}),E&&(0,t.jsx)("button",{onClick:()=>k(!S),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(eW.Z,{icon:S?eH.Z:eJ.Z,size:"sm",className:"text-gray-500"})})]})]})]}),(0,t.jsxs)(eG.Z,{className:"mt-2",children:[(0,t.jsx)(x.Z,{children:"Cost Configuration"}),(0,t.jsx)(e4,{costConfig:null===(s=g.mcp_info)||void 0===s?void 0:s.mcp_server_cost_info})]})]}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(sI,{serverId:g.server_id,accessToken:y,auth_type:g.auth_type,userRole:N,userID:_,serverAlias:g.alias})}),(0,t.jsx)(d.Z,{children:(0,t.jsxs)(eG.Z,{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)(x.Z,{children:"MCP Server Settings"}),C?null:(0,t.jsx)(n.Z,{variant:"light",onClick:()=>Z(!0),children:"Edit Settings"})]}),C?(0,t.jsx)(e2,{mcpServer:g,accessToken:y,onCancel:()=>Z(!1),onSuccess:e=>{Z(!1),f()},availableAccessGroups:w}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"Server Name"}),(0,t.jsx)("div",{children:g.server_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"Alias"}),(0,t.jsx)("div",{children:g.alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"Description"}),(0,t.jsx)("div",{children:g.description})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"URL"}),(0,t.jsxs)("div",{className:"font-mono break-all overflow-wrap-anywhere max-w-full flex items-center gap-2",children:[F(g.url,S),E&&(0,t.jsx)("button",{onClick:()=>k(!S),className:"p-1 hover:bg-gray-100 rounded",children:(0,t.jsx)(eW.Z,{icon:S?eH.Z:eJ.Z,size:"sm",className:"text-gray-500"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"Transport"}),(0,t.jsx)("div",{children:L(g.transport)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"Extra Headers"}),(0,t.jsx)("div",{children:null===(r=g.extra_headers)||void 0===r?void 0:r.join(", ")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"Auth Type"}),(0,t.jsx)("div",{children:z(g.auth_type)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"Allow All LiteLLM Keys"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[g.allow_all_keys?(0,t.jsx)("span",{className:"px-2 py-1 bg-green-50 text-green-700 rounded-md text-sm",children:"Enabled"}):(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 text-gray-600 rounded-md text-sm",children:"Disabled"}),g.allow_all_keys&&(0,t.jsx)(m.Z,{className:"text-xs text-gray-500",children:"All keys can access this MCP server"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"Available on Public Internet"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[g.available_on_public_internet?(0,t.jsx)("span",{className:"px-2 py-1 bg-green-50 text-green-700 rounded-md text-sm",children:"Public"}):(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 text-gray-600 rounded-md text-sm",children:"Internal"}),g.available_on_public_internet&&(0,t.jsx)(m.Z,{className:"text-xs text-gray-500",children:"Accessible from external/public IPs"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"Access Groups"}),(0,t.jsx)("div",{children:g.mcp_access_groups&&g.mcp_access_groups.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:g.mcp_access_groups.map((e,s)=>{var r;return(0,t.jsx)("span",{className:"px-2 py-1 bg-gray-100 rounded-md text-sm",children:"string"==typeof e?e:null!==(r=null==e?void 0:e.name)&&void 0!==r?r:""},s)})}):(0,t.jsx)(m.Z,{className:"text-gray-500",children:"No access groups defined"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"Allowed Tools"}),(0,t.jsx)("div",{children:g.allowed_tools&&g.allowed_tools.length>0?(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:g.allowed_tools.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-blue-50 border border-blue-200 rounded-md text-sm",children:e},s))}):(0,t.jsx)(m.Z,{className:"text-gray-500",children:"All tools enabled"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(m.Z,{className:"font-medium",children:"Cost Configuration"}),(0,t.jsx)(e4,{costConfig:null===(l=g.mcp_info)||void 0===l?void 0:l.mcp_server_cost_info})]})]})]})})]})]})]})},e6=(0,N.n)("mcpSemanticFilterSettings"),e3=()=>{let{accessToken:e}=(0,w.Z)();return(0,y.a)({queryKey:e6.list({}),queryFn:async()=>await (0,_.getMCPSemanticFilterSettings)(e),enabled:!!e,staleTime:36e5,gcTime:36e5})};var e8=r(29827),e7=r(21770);let e9=(0,N.n)("mcpSemanticFilterSettings"),se=e=>{let s=(0,e8.NL)();return(0,e7.D)({mutationFn:async s=>{if(!e)throw Error("Access token is required");return(0,_.updateMCPSemanticFilterSettings)(e,s)},onSuccess:()=>{s.invalidateQueries({queryKey:e9.all})}})};var ss=r(50337),sr=r(47451),st=r(69410),sl=r(85847),sa=r(78355),sn=r(10703),si=r(28595),so=r(11894),sc=r(65869),sd=r(76593);function su(e){let{accessToken:s,testQuery:r,setTestQuery:l,testModel:a,setTestModel:n,isTesting:i,onTest:o,filterEnabled:c,testResult:d,curlCommand:u}=e;return(0,t.jsx)(eC.Z,{title:"Test Configuration",style:{marginBottom:16},children:(0,t.jsx)(sc.default,{defaultActiveKey:"test",items:[{key:"test",label:"Test",children:(0,t.jsxs)(en.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)(h.default.Text,{strong:!0,style:{display:"block",marginBottom:8},children:[(0,t.jsx)(si.Z,{})," Test Query"]}),(0,t.jsx)(A.default.TextArea,{placeholder:"Enter a test query to see which tools would be selected...",value:r,onChange:e=>l(e.target.value),rows:4,disabled:i})]}),(0,t.jsx)("div",{children:(0,t.jsx)(sd.Z,{accessToken:s||"",value:a,onChange:n,disabled:i,showLabel:!0,labelText:"Select Model"})}),(0,t.jsx)(W.ZP,{type:"primary",icon:(0,t.jsx)(si.Z,{}),onClick:o,loading:i,disabled:!r||!a||!c,block:!0,children:"Test Filter"}),!c&&(0,t.jsx)(Y.Z,{type:"warning",message:"Semantic filtering is disabled",description:"Enable semantic filtering and save settings to test the filter.",showIcon:!0}),d&&(0,t.jsxs)("div",{children:[(0,t.jsx)(h.default.Title,{level:5,children:"Results"}),(0,t.jsx)(Y.Z,{type:"success",message:"".concat(d.selectedTools," tools selected"),description:"Filtered from ".concat(d.totalTools," available tools"),showIcon:!0,style:{marginBottom:16}}),(0,t.jsxs)("div",{children:[(0,t.jsx)(h.default.Text,{strong:!0,style:{display:"block",marginBottom:8},children:"Selected Tools:"}),(0,t.jsx)("ul",{style:{paddingLeft:20,margin:0},children:d.tools.map((e,s)=>(0,t.jsx)("li",{style:{marginBottom:4},children:(0,t.jsx)(h.default.Text,{children:e})},s))})]})]})]})},{key:"api",label:"API Usage",children:(0,t.jsxs)("div",{children:[(0,t.jsxs)(en.Z,{style:{marginBottom:8},children:[(0,t.jsx)(so.Z,{}),(0,t.jsx)(h.default.Text,{strong:!0,children:"API Usage"})]}),(0,t.jsx)(h.default.Text,{type:"secondary",style:{display:"block",marginBottom:8},children:"Use this curl command to test the semantic filter with your current configuration."}),(0,t.jsx)(h.default.Text,{strong:!0,style:{display:"block",marginBottom:8},children:"Response headers to check:"}),(0,t.jsxs)("ul",{style:{paddingLeft:20,margin:"0 0 12px 0"},children:[(0,t.jsxs)("li",{children:[(0,t.jsx)(h.default.Text,{children:"x-litellm-semantic-filter: shows total tools → selected tools"}),(0,t.jsx)(h.default.Text,{type:"secondary",style:{display:"block"},children:"Example: 10→3"})]}),(0,t.jsxs)("li",{children:[(0,t.jsx)(h.default.Text,{children:"x-litellm-semantic-filter-tools: CSV of selected tool names"}),(0,t.jsx)(h.default.Text,{type:"secondary",style:{display:"block"},children:"Example: wikipedia-fetch,github-search,slack-post"})]})]}),(0,t.jsx)("pre",{style:{background:"#f5f5f5",padding:12,borderRadius:4,overflow:"auto",fontSize:12,margin:0},children:u})]})}]})})}let sm=e=>{if(!e.filter)return null;let[s,r]=e.filter.split("->").map(Number);return{totalTools:s,selectedTools:r,tools:e.tools?e.tools.split(",").map(e=>e.trim()):[]}},sx=async e=>{let{accessToken:s,testModel:r,testQuery:t,setIsTesting:l,setTestResult:a}=e;if(!t||!r||!s){S.ZP.error("Please enter a query and select a model");return}l(!0),a(null);try{let{headers:e}=await (0,_.testMCPSemanticFilter)(s,r,t),l=sm(e);if(!l){S.ZP.warning("Semantic filter is not enabled or no tools were filtered");return}a(l),S.ZP.success("Semantic filter test completed successfully")}catch(e){console.error("Test failed:",e),S.ZP.error("Failed to test semantic filter")}finally{l(!1)}},sh=(e,s)=>"curl --location 'http://localhost:4000/v1/responses' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer sk-1234' \\\n--data '{\n \"model\": \"".concat(e,'",\n "input": [\n {\n "role": "user",\n "content": "').concat(s||"Your query here",'",\n "type": "message"\n }\n ],\n "tools": [\n {\n "type": "mcp",\n "server_url": "litellm_proxy",\n "require_approval": "never"\n }\n ],\n "tool_choice": "required"\n}\'');function sp(e){var s,r,l;let{accessToken:n}=e,{data:i,isLoading:o,isError:c,error:d}=e3(),{mutate:u,isPending:m,error:x}=se(n||""),[g]=P.Z.useForm(),[f,b]=(0,j.useState)(!1),[y,N]=(0,j.useState)(!1),[_,w]=(0,j.useState)([]),[C,Z]=(0,j.useState)(!0),[k,A]=(0,j.useState)(""),[T,M]=(0,j.useState)("gpt-4o"),[I,O]=(0,j.useState)(null),[E,L]=(0,j.useState)(!1),z=null==i?void 0:i.field_schema,F=null!==(l=null==i?void 0:i.values)&&void 0!==l?l:{};(0,j.useEffect)(()=>{(async()=>{if(n)try{Z(!0);let e=(await (0,sn.p)(n)).filter(e=>"embedding"===e.mode);w(e)}catch(e){console.error("Error fetching embedding models:",e)}finally{Z(!1)}})()},[n]),(0,j.useEffect)(()=>{if(F){var e,s,r,t;g.setFieldsValue({enabled:null!==(e=F.enabled)&&void 0!==e&&e,embedding_model:null!==(s=F.embedding_model)&&void 0!==s?s:"text-embedding-3-small",top_k:null!==(r=F.top_k)&&void 0!==r?r:10,similarity_threshold:null!==(t=F.similarity_threshold)&&void 0!==t?t:.3}),N(!1)}},[F,g]);let R=async()=>{try{let e=await g.validateFields();u(e,{onSuccess:()=>{N(!1),b(!0),setTimeout(()=>b(!1),3e3),S.ZP.success("Settings updated successfully. Changes will be applied across all pods within 10 seconds.")},onError:e=>{S.ZP.fromBackend(e)}})}catch(e){console.error("Form validation failed:",e)}},q=async()=>{n&&await sx({accessToken:n,testModel:T,testQuery:k,setIsTesting:L,setTestResult:O})};return n?(0,t.jsx)("div",{style:{width:"100%"},children:o?(0,t.jsx)(ss.Z,{active:!0}):c?(0,t.jsx)(Y.Z,{type:"error",message:"Could not load MCP Semantic Filter settings",description:d instanceof Error?d.message:void 0,style:{marginBottom:24}}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Y.Z,{type:"info",message:"Semantic Tool Filtering",description:"Filter MCP tools semantically based on query relevance. This reduces context window size and improves tool selection accuracy. Click 'Save Settings' to apply changes across all pods (takes effect within 10 seconds).",showIcon:!0,style:{marginBottom:24}}),f&&(0,t.jsx)(Y.Z,{type:"success",message:"Settings saved successfully",icon:(0,t.jsx)($.Z,{}),showIcon:!0,closable:!0,style:{marginBottom:16}}),x&&(0,t.jsx)(Y.Z,{type:"error",message:"Could not update settings",description:x instanceof Error?x.message:void 0,style:{marginBottom:16}}),(0,t.jsxs)(sr.Z,{gutter:24,children:[(0,t.jsx)(st.Z,{xs:24,lg:12,children:(0,t.jsxs)(P.Z,{form:g,layout:"vertical",disabled:m,onValuesChange:()=>{N(!0)},children:[(0,t.jsxs)(eC.Z,{style:{marginBottom:16},children:[(0,t.jsx)(P.Z.Item,{name:"enabled",label:(0,t.jsxs)(en.Z,{children:[(0,t.jsx)(h.default.Text,{strong:!0,children:"Enable Semantic Filtering"}),(0,t.jsx)(v.Z,{title:"When enabled, only the most relevant MCP tools will be included in requests based on semantic similarity",children:(0,t.jsx)(a.Z,{style:{color:"#8c8c8c"}})})]}),valuePropName:"checked",children:(0,t.jsx)(ea.Z,{disabled:m})}),(0,t.jsx)(h.default.Text,{type:"secondary",style:{display:"block",marginTop:-16,marginBottom:16},children:null==z?void 0:null===(r=z.properties)||void 0===r?void 0:null===(s=r.enabled)||void 0===s?void 0:s.description})]}),(0,t.jsxs)(eC.Z,{title:"Configuration",style:{marginBottom:16},children:[(0,t.jsx)(P.Z.Item,{name:"embedding_model",label:(0,t.jsxs)(en.Z,{children:[(0,t.jsx)(h.default.Text,{strong:!0,children:"Embedding Model"}),(0,t.jsx)(v.Z,{title:"The model used to generate embeddings for semantic matching",children:(0,t.jsx)(a.Z,{style:{color:"#8c8c8c"}})})]}),children:(0,t.jsx)(p.default,{options:_.map(e=>({label:e.model_group,value:e.model_group})),placeholder:C?"Loading models...":"Select embedding model",showSearch:!0,disabled:m||C,loading:C,notFoundContent:C?"Loading...":"No embedding models available"})}),(0,t.jsx)(P.Z.Item,{name:"top_k",label:(0,t.jsxs)(en.Z,{children:[(0,t.jsx)(h.default.Text,{strong:!0,children:"Top K Results"}),(0,t.jsx)(v.Z,{title:"Maximum number of tools to return after filtering",children:(0,t.jsx)(a.Z,{style:{color:"#8c8c8c"}})})]}),children:(0,t.jsx)(V.Z,{min:1,max:100,style:{width:"100%"},disabled:m})}),(0,t.jsx)(P.Z.Item,{name:"similarity_threshold",label:(0,t.jsxs)(en.Z,{children:[(0,t.jsx)(h.default.Text,{strong:!0,children:"Similarity Threshold"}),(0,t.jsx)(v.Z,{title:"Minimum similarity score (0-1) for a tool to be included",children:(0,t.jsx)(a.Z,{style:{color:"#8c8c8c"}})})]}),children:(0,t.jsx)(sl.Z,{min:0,max:1,step:.05,marks:{0:"0.0",.3:"0.3",.5:"0.5",.7:"0.7",1:"1.0"},disabled:m})})]}),(0,t.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:(0,t.jsx)(W.ZP,{type:"primary",icon:(0,t.jsx)(sa.Z,{}),onClick:R,loading:m,disabled:!y,children:"Save Settings"})})]})}),(0,t.jsx)(st.Z,{xs:24,lg:12,children:(0,t.jsx)(su,{accessToken:n,testQuery:k,setTestQuery:A,testModel:T,setTestModel:M,isTesting:E,onTest:q,filterEnabled:!!F.enabled,testResult:I,curlCommand:sh(T,k)})})]})]})}):(0,t.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Please log in to configure semantic filter settings."})}var sg=r(3810);let{Text:sf}=h.default;var sv=e=>{let{accessToken:s}=e,[r,l]=(0,j.useState)(!0),[a,n]=(0,j.useState)(!1),[i,o]=(0,j.useState)([]),[c,d]=(0,j.useState)(null);(0,j.useEffect)(()=>{u(),m()},[s]);let u=async()=>{if(s){l(!0);try{for(let e of(await (0,_.getGeneralSettingsCall)(s)))"mcp_internal_ip_ranges"===e.field_name&&e.field_value&&o(e.field_value)}catch(e){console.error("Failed to load MCP network settings:",e)}finally{l(!1)}}},m=async()=>{if(!s)return;let e=await (0,_.fetchMCPClientIp)(s);e&&d(e)},x=async()=>{if(s){n(!0);try{i.length>0?await (0,_.updateConfigFieldSetting)(s,"mcp_internal_ip_ranges",i):await (0,_.deleteConfigFieldSetting)(s,"mcp_internal_ip_ranges")}catch(e){console.error("Failed to save MCP network settings:",e)}finally{n(!1)}}},h=e=>{i.includes(e)||o([...i,e])};if(r)return(0,t.jsx)("div",{className:"flex justify-center py-12",children:(0,t.jsx)(G.Z,{})});let g=c?function(e){let s=e.split(".");return 4!==s.length?e+"/32":"".concat(s[0],".").concat(s[1],".").concat(s[2],".0/24")}(c):null;return(0,t.jsxs)("div",{className:"space-y-6 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(sf,{className:"text-lg font-semibold",children:"Private IP Ranges"}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:'Define which IP ranges are part of your private network. Callers from these IPs can see all MCP servers. Callers from any other IP can only see servers marked "Available on Public Internet".'})]}),(0,t.jsxs)(eC.Z,{children:[c&&(0,t.jsxs)("div",{className:"mb-4 p-3 bg-blue-50 rounded-lg",children:[(0,t.jsxs)(sf,{className:"text-sm text-blue-700",children:["Your current IP: ",(0,t.jsx)("span",{className:"font-mono font-medium",children:c})]}),g&&!i.includes(g)&&(0,t.jsxs)("div",{className:"mt-1",children:[(0,t.jsx)(sf,{className:"text-sm text-blue-600",children:"Suggested range: "}),(0,t.jsx)(sg.Z,{className:"cursor-pointer font-mono",color:"blue",icon:(0,t.jsx)(eo.Z,{}),onClick:()=>h(g),children:g})]})]}),(0,t.jsx)("div",{className:"flex items-center mb-2",children:(0,t.jsx)(sf,{className:"font-medium",children:"Your Private Network Ranges"})}),(0,t.jsx)(p.default,{mode:"tags",value:i,onChange:o,placeholder:"Leave empty to use defaults: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.0/8",tokenSeparators:[","],className:"w-full",size:"large",allowClear:!0}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mt-2",children:"Enter CIDR ranges (e.g., 10.0.0.0/8). When empty, standard private IP ranges are used."})]}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(W.ZP,{type:"primary",icon:(0,t.jsx)(sa.Z,{}),onClick:x,loading:a,children:"Save"})})]})};let{Search:sj}=A.default,{Text:sb}=h.default,sy=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899","#06B6D4","#84CC16"];var sN=e=>{let{isVisible:s,onClose:r,onSelectServer:l,onCustomServer:a,accessToken:n}=e,[i,o]=(0,j.useState)([]),[c,d]=(0,j.useState)([]),[u,m]=(0,j.useState)(!1),[x,h]=(0,j.useState)(null),[p,f]=(0,j.useState)(""),[v,b]=(0,j.useState)("All");(0,j.useEffect)(()=>{s&&n&&(m(!0),h(null),(0,_.fetchDiscoverableMCPServers)(n).then(e=>{o(e.servers||[]),d(e.categories||[])}).catch(e=>{h(e.message||"Failed to load MCP servers")}).finally(()=>{m(!1)}))},[s,n]),(0,j.useEffect)(()=>{s&&(f(""),b("All"))},[s]);let y=(0,j.useMemo)(()=>{let e=i;if("All"!==v&&(e=e.filter(e=>e.category===v)),p.trim()){let s=p.toLowerCase();e=e.filter(e=>e.name.toLowerCase().includes(s)||e.title.toLowerCase().includes(s)||e.description.toLowerCase().includes(s))}return e},[i,v,p]),N=(0,j.useMemo)(()=>{let e={};for(let s of y){let r=s.category||"Other";e[r]||(e[r]=[]),e[r].push(s)}return e},[y]);return(0,t.jsxs)(g.Z,{title:(0,t.jsxs)("div",{className:"flex items-center justify-between pb-4 border-b border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)("img",{src:eb,alt:"MCP Logo",className:"w-8 h-8 object-contain",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"}}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Add MCP Server"})]}),(0,t.jsx)("button",{onClick:a,className:"text-sm text-blue-600 hover:text-blue-800 cursor-pointer bg-transparent border-none font-medium",children:"+ Custom Server"})]}),open:s,onCancel:r,footer:null,width:1e3,className:"top-8",styles:{body:{padding:"24px",maxHeight:"70vh",overflowY:"auto"},header:{padding:"24px 24px 0 24px",border:"none"}},children:[(0,t.jsx)("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:12},children:["All",...c].map(e=>{let s=v===e;return(0,t.jsx)("button",{onClick:()=>b(e),style:{padding:"4px 12px",borderRadius:4,border:s?"1px solid #111827":"1px solid #e5e7eb",background:s?"#111827":"#fff",color:s?"#fff":"#4b5563",cursor:"pointer",fontSize:12,fontWeight:s?500:400,lineHeight:"20px"},children:e},e)})}),(0,t.jsx)(sj,{placeholder:"Search servers...",value:p,onChange:e=>f(e.target.value),style:{marginBottom:16},allowClear:!0}),u&&(0,t.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:4},children:Array.from({length:8}).map((e,s)=>(0,t.jsx)("div",{style:{height:36,borderRadius:6,background:"#f9fafb"}},s))}),x&&(0,t.jsx)("div",{style:{textAlign:"center",padding:"32px 0",color:"#9ca3af"},children:(0,t.jsxs)(sb,{children:["Failed to load servers: ",x]})}),!u&&!x&&0===y.length&&(0,t.jsx)("div",{style:{textAlign:"center",padding:"32px 0",color:"#9ca3af"},children:(0,t.jsxs)(sb,{children:["No servers found."," ",(0,t.jsx)("a",{onClick:a,style:{color:"#2563eb",cursor:"pointer"},children:"Add a custom server"})]})}),!u&&!x&&Object.entries(N).map(e=>{let[s,r]=e;return(0,t.jsxs)("div",{style:{marginBottom:16},children:[(0,t.jsx)("div",{style:{fontSize:11,fontWeight:500,color:"#9ca3af",textTransform:"uppercase",letterSpacing:"0.05em",padding:"6px 0",borderBottom:"1px solid #f3f4f6",marginBottom:4},children:s}),(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 16px"},children:r.map(e=>{let s=function(e){let s=e.charAt(0).toUpperCase(),r=e.split("").reduce((e,s)=>e+s.charCodeAt(0),0)%sy.length;return{initial:s,backgroundColor:sy[r]}}(e.title||e.name);return(0,t.jsxs)("div",{onClick:()=>l(e),style:{display:"flex",alignItems:"center",padding:"8px 10px",borderRadius:6,cursor:"pointer",transition:"background 0.1s ease"},onMouseEnter:e=>{e.currentTarget.style.background="#f9fafb"},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:[e.icon_url?(0,t.jsx)("img",{src:e.icon_url,alt:e.title,style:{width:20,height:20,objectFit:"contain",flexShrink:0,marginRight:12},onError:e=>{let s=e.currentTarget;s.style.display="none";let r=s.nextElementSibling;r&&(r.style.display="flex")}}):null,(0,t.jsx)("div",{style:{width:20,height:20,borderRadius:4,backgroundColor:s.backgroundColor,color:"#fff",display:e.icon_url?"none":"flex",alignItems:"center",justifyContent:"center",fontWeight:600,fontSize:11,flexShrink:0,marginRight:12},children:s.initial}),(0,t.jsx)("span",{style:{fontSize:14,fontWeight:400,color:"#111827",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.title||e.name}),(0,t.jsx)("span",{style:{color:"#d1d5db",fontSize:14,flexShrink:0,marginLeft:8},children:"›"})]},e.name)})})]},s)})]})};let{Text:s_,Title:sw}=h.default,{Option:sC}=p.default;var sZ=e=>{let{accessToken:s,userRole:r,userID:h}=e,{data:y,isLoading:N,refetch:w}=(0,b.F)(),{data:C,isLoading:P}=Z((0,j.useMemo)(()=>null==y?void 0:y.map(e=>e.server_id),[y])),A=(0,j.useMemo)(()=>{if(!y)return[];if(!C)return y;let e=new Map(C.map(e=>[e.server_id,e.status]));return y.map(s=>{let r=e.get(s.server_id);return{...s,status:r||s.status}})},[y,C]);j.useEffect(()=>{y&&(console.log("MCP Servers fetched:",y),y.forEach(e=>{console.log("Server: ".concat(e.server_name||e.server_id)),console.log(" allowed_tools:",e.allowed_tools)}))},[y]);let[T,M]=(0,j.useState)(null),[I,O]=(0,j.useState)(!1),[E,L]=(0,j.useState)(null),[z,F]=(0,j.useState)(!1),[R,q]=(0,j.useState)("all"),[V,U]=(0,j.useState)("all"),[B,D]=(0,j.useState)([]),[K,H]=(0,j.useState)(!1),[J,G]=(0,j.useState)(!1),[Y,W]=(0,j.useState)(null),[$,Q]=(0,j.useState)(!1),X="Internal User"===r;(0,j.useEffect)(()=>{try{let e=window.sessionStorage.getItem("litellm-mcp-oauth-edit-state");if(!e)return;let s=JSON.parse(e);(null==s?void 0:s.serverId)&&(L(s.serverId),F(!0))}catch(e){console.error("Failed to restore MCP edit view state",e)}},[]);let ee=j.useMemo(()=>{if(!A)return[];let e=new Set,s=[];return A.forEach(r=>{r.teams&&r.teams.forEach(r=>{let t=r.team_id;e.has(t)||(e.add(t),s.push(r))})}),s},[A]),es=j.useMemo(()=>A?Array.from(new Set(A.flatMap(e=>e.mcp_access_groups).filter(e=>null!=e))):[],[A]),er=(0,j.useCallback)((e,s)=>{if(!A)return D([]);let r=A;if("personal"===e){D([]);return}"all"!==e&&(r=r.filter(s=>{var r;return null===(r=s.teams)||void 0===r?void 0:r.some(s=>s.team_id===e)})),"all"!==s&&(r=r.filter(e=>{var r;return null===(r=e.mcp_access_groups)||void 0===r?void 0:r.some(e=>"string"==typeof e?e===s:e&&e.name===s)})),D(r)},[A]);(0,j.useEffect)(()=>{er(R,V)},[A,R,V,er]);let et=j.useMemo(()=>eD(null!=r?r:"",e=>{L(e),F(!1)},e=>{L(e),F(!0)},el,P),[r,P]);function el(e){M(e),O(!0)}let ea=async()=>{if(null!=T&&null!=s)try{Q(!0),await (0,_.deleteMCPServer)(s,T),S.ZP.success("Deleted MCP Server successfully"),w()}catch(e){console.error("Error deleting the mcp server:",e)}finally{Q(!1),O(!1),M(null)}},en=T?(y||[]).find(e=>e.server_id===T):null,ei=j.useMemo(()=>B.find(e=>e.server_id===E)||{server_id:"",server_name:"",alias:"",url:"",transport:"",auth_type:"",created_at:"",created_by:"",updated_at:"",updated_by:""},[B,E]),eo=j.useCallback(()=>{F(!1),L(null),w()},[w]);return s&&r&&h?(0,t.jsxs)("div",{className:"w-full h-full p-6",children:[(0,t.jsx)(g.Z,{open:I,title:"Delete MCP Server?",onOk:ea,okText:$?"Deleting...":"Delete",onCancel:()=>{O(!1),M(null)},cancelText:"Cancel",cancelButtonProps:{disabled:$},okButtonProps:{danger:!0},confirmLoading:$,children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(s_,{children:"Are you sure you want to delete this MCP Server? This action cannot be undone."}),en&&(0,t.jsxs)("div",{className:"mt-4 p-4 bg-red-50 rounded-lg border border-red-200",children:[(0,t.jsx)(sw,{level:5,className:"mb-3 text-gray-900",children:"Server Information"}),(0,t.jsxs)(f.Z,{column:1,size:"small",children:[en.server_name&&(0,t.jsx)(f.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Server Name"}),children:(0,t.jsx)(s_,{className:"text-sm",children:en.server_name})}),en.alias&&(0,t.jsx)(f.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Alias"}),children:(0,t.jsx)(s_,{className:"text-sm",children:en.alias})}),(0,t.jsx)(f.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"Server ID"}),children:(0,t.jsx)(s_,{code:!0,className:"text-sm",children:en.server_id})}),(0,t.jsx)(f.Z.Item,{label:(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:"URL"}),children:(0,t.jsx)(s_,{code:!0,className:"text-sm",children:en.url})})]})]})]})}),(0,t.jsx)(ew,{userRole:r,accessToken:s,onCreateSuccess:e=>{D(s=>[...s,e]),H(!1)},isModalVisible:K,setModalVisible:H,availableAccessGroups:es,prefillData:Y,onBackToDiscovery:()=>{H(!1),W(null),G(!0)}}),(0,t.jsx)(x.Z,{children:"MCP Servers"}),(0,t.jsx)(m.Z,{className:"text-tremor-content mt-2",children:"Configure and manage your MCP servers"}),(0,l.tY)(r)&&(0,t.jsx)(n.Z,{className:"mt-4 mb-4",onClick:()=>G(!0),children:"+ Add New MCP Server"}),(0,t.jsx)(sN,{isVisible:J,onClose:()=>G(!1),onSelectServer:e=>{W(e),G(!1),H(!0)},onCustomServer:()=>{W(null),G(!1),H(!0)},accessToken:s}),(0,t.jsxs)(o.Z,{className:"w-full h-full",children:[(0,t.jsx)(c.Z,{className:"flex justify-between mt-2 w-full items-center",children:(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(i.Z,{children:"All Servers"}),(0,t.jsx)(i.Z,{children:"Connect"}),(0,t.jsx)(i.Z,{children:"Semantic Filter"}),(0,t.jsx)(i.Z,{children:"Network Settings"})]})}),(0,t.jsxs)(u.Z,{children:[(0,t.jsx)(d.Z,{children:E?(0,t.jsx)(e5,{mcpServer:ei,onBack:eo,isProxyAdmin:(0,l.tY)(r),isEditing:z,accessToken:s,userID:h,userRole:r,availableAccessGroups:es},E):(0,t.jsxs)("div",{className:"w-full h-full",children:[(0,t.jsx)("div",{className:"w-full px-6",children:(0,t.jsx)("div",{className:"flex flex-col space-y-4",children:(0,t.jsx)("div",{className:"flex items-center justify-between bg-gray-50 rounded-lg p-4 border-2 border-gray-200",children:(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(m.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),(0,t.jsxs)(p.default,{value:R,onChange:e=>{q(e),er(e,V)},style:{width:300},children:[(0,t.jsx)(sC,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:X?"All Available Servers":"All Servers"})]})}),(0,t.jsx)(sC,{value:"personal",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"Personal"})]})}),ee.map(e=>(0,t.jsx)(sC,{value:e.team_id,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e.team_alias||e.team_id})]})},e.team_id))]}),(0,t.jsxs)(m.Z,{className:"text-lg font-semibold text-gray-900 ml-6",children:["Access Group:",(0,t.jsx)(v.Z,{title:"An MCP Access Group is a set of users or teams that have permission to access specific MCP servers. Use access groups to control and organize who can connect to which servers.",children:(0,t.jsx)(a.Z,{style:{marginLeft:4,color:"#888"}})})]}),(0,t.jsxs)(p.default,{value:V,onChange:e=>{U(e),er(R,e)},style:{width:300},children:[(0,t.jsx)(sC,{value:"all",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:"All Access Groups"})]})}),es.map(e=>(0,t.jsx)(sC,{value:e,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,t.jsx)("span",{className:"font-medium",children:e})]})},e))]})]})})})}),(0,t.jsx)("div",{className:"w-full px-6 mt-6",children:(0,t.jsx)(k.w,{data:B,columns:et,renderSubComponent:()=>(0,t.jsx)("div",{}),getRowCanExpand:()=>!1,isLoading:N,noDataMessage:"No MCP servers configured",loadingMessage:"\uD83D\uDE85 Loading MCP servers..."})})]})}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(eq,{})}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(sp,{accessToken:s})}),(0,t.jsx)(d.Z,{children:(0,t.jsx)(sv,{accessToken:s})})]})]})]}):(console.log("Missing required authentication parameters",{accessToken:s,userRole:r,userID:h}),(0,t.jsx)("div",{className:"p-6 text-center text-gray-500",children:"Missing required authentication parameters."}))};let sS=e=>"object"==typeof e&&null!==e&&!Array.isArray(e);function sk(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>sP(e)).filter(e=>void 0!==e);let s=sP(e);return void 0===s?[]:[s]}function sP(e,s){if(!e)return;let r=void 0!==s?s:e.default;if("object"===e.type){let s=sS(r)?{...r}:{};return e.properties&&Object.entries(e.properties).forEach(e=>{let[r,t]=e;s[r]=sP(t,s[r])}),s}if("array"===e.type){if(Array.isArray(r)){let s=e.items;if(!s)return r;if(0===r.length){let e=sk(s);return e.length?e:r}return Array.isArray(s)?r.map((e,r)=>{var t;return sP(null!==(t=s[r])&&void 0!==t?t:s[s.length-1],e)}):r.map(e=>sP(s,e))}return void 0!==r?r:sk(e.items)}if(void 0!==r)return r;switch(e.type){case"integer":case"number":return 0;case"boolean":return!1;default:return""}}let sA=e=>{let s=sP(e);if("object"===e.type||"array"===e.type){let r="array"===e.type?[]:{};return JSON.stringify(null!=s?s:r,null,2)}return s};function sT(e){let{tool:s,onSubmit:r,isLoading:l,result:a,error:n,onClose:i}=e,[o]=P.Z.useForm(),[c,d]=j.useState("formatted"),[u,m]=j.useState(null),[x,h]=j.useState(null),p=j.useMemo(()=>"string"==typeof s.inputSchema?{type:"object",properties:{input:{type:"string",description:"Input for this tool"}},required:["input"]}:s.inputSchema,[s.inputSchema]),g=j.useMemo(()=>p.properties&&p.properties.params&&"object"===p.properties.params.type&&p.properties.params.properties?{type:"object",properties:p.properties.params.properties,required:p.properties.params.required||[]}:p,[p]);j.useEffect(()=>{if(o.resetFields(),!g.properties)return;let e={};Object.entries(g.properties).forEach(s=>{let[r,t]=s;e[r]=sA(t)}),o.setFieldsValue(e)},[o,g,s]),j.useEffect(()=>{u&&(a||n)&&h(Date.now()-u)},[a,n,u]);let f=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.focus(),s.select();let r=document.execCommand("copy");if(document.body.removeChild(s),!r)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},b=async()=>{await f(JSON.stringify(a,null,2))?S.ZP.success("Result copied to clipboard"):S.ZP.fromBackend("Failed to copy result")},y=async()=>{await f(s.name)?S.ZP.success("Tool name copied to clipboard"):S.ZP.fromBackend("Failed to copy tool name")};return(0,t.jsxs)("div",{className:"space-y-4 h-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[s.mcp_info.logo_url&&(0,t.jsx)("img",{src:s.mcp_info.logo_url,alt:"".concat(s.mcp_info.server_name," logo"),className:"w-6 h-6 object-contain"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Tool:"}),(0,t.jsxs)("div",{className:"group inline-flex items-center space-x-1 bg-slate-50 hover:bg-slate-100 px-3 py-1 rounded-md cursor-pointer transition-colors border border-slate-200",onClick:y,title:"Click to copy tool name",children:[(0,t.jsx)("span",{className:"font-mono text-slate-700 font-medium text-sm",children:s.name}),(0,t.jsx)("svg",{className:"w-3 h-3 text-slate-400 group-hover:text-slate-600 transition-colors",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})]})]}),(0,t.jsx)("p",{className:"text-xs text-gray-600",children:s.description}),(0,t.jsxs)("p",{className:"text-xs text-gray-500",children:["Provider: ",s.mcp_info.server_name]})]})]}),(0,t.jsx)(M.z,{onClick:i,variant:"light",size:"sm",className:"text-gray-500 hover:text-gray-700",children:(0,t.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 h-full",children:[(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Input Parameters"}),(0,t.jsx)(v.Z,{title:"Configure the input parameters for this tool call",children:(0,t.jsx)(T.Z,{className:"text-gray-400 hover:text-gray-600"})})]})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsxs)(P.Z,{form:o,onFinish:e=>{m(Date.now()),h(null);let s={};Object.entries(e).forEach(e=>{var r;let[t,l]=e,a=null===(r=g.properties)||void 0===r?void 0:r[t];if(a&&null!=l&&""!==l)switch(a.type){case"boolean":s[t]="true"===l||!0===l;break;case"number":case"integer":{let e=Number(l);s[t]=Number.isNaN(e)?l:"integer"===a.type?Math.trunc(e):e;break}case"object":case"array":try{let e="string"==typeof l?JSON.parse(l):l,r="object"===a.type&&null!==e&&"object"==typeof e&&!Array.isArray(e),n="array"===a.type&&Array.isArray(e);"object"===a.type&&r||"array"===a.type&&n?s[t]=e:s[t]=l}catch(e){s[t]=l}break;case"string":s[t]=String(l);break;default:s[t]=l}else null!=l&&""!==l&&(s[t]=l)}),r(p.properties&&p.properties.params&&"object"===p.properties.params.type&&p.properties.params.properties?{params:s}:s)},layout:"vertical",className:"space-y-3",children:["string"==typeof s.inputSchema?(0,t.jsx)("div",{className:"space-y-3",children:(0,t.jsx)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Input ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),name:"input",rules:[{required:!0,message:"Please enter input for this tool"}],className:"mb-3",children:(0,t.jsx)(M.o,{placeholder:"Enter input for this tool",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"})})}):void 0===g.properties?(0,t.jsx)("div",{className:"text-center py-6 bg-gray-50 rounded-lg border border-gray-200",children:(0,t.jsxs)("div",{className:"max-w-sm mx-auto",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"No Parameters Required"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"This tool can be called without any input parameters."})]})}):(0,t.jsx)("div",{className:"space-y-3",children:Object.entries(g.properties).map(e=>{var r,l,a,n;let[i,o]=e,c=sA(o),d="".concat(s.name,"-").concat(i);return(0,t.jsxs)(P.Z.Item,{label:(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-700 flex items-center",children:[i," ",(null===(r=g.required)||void 0===r?void 0:r.includes(i))&&(0,t.jsx)("span",{className:"text-red-500",children:"*"}),o.description&&(0,t.jsx)(v.Z,{title:o.description,children:(0,t.jsx)(T.Z,{className:"ml-2 text-gray-400 hover:text-gray-600"})})]}),name:i,initialValue:c,rules:[{required:null===(l=g.required)||void 0===l?void 0:l.includes(i),message:"Please enter ".concat(i)},..."object"===o.type||"array"===o.type?[{validator:(e,s)=>{var r;if((null==s||""===s)&&!(null===(r=g.required)||void 0===r?void 0:r.includes(i)))return Promise.resolve();try{let e="string"==typeof s?JSON.parse(s):s,r="object"===o.type&&null!==e&&"object"==typeof e&&!Array.isArray(e),t="array"===o.type&&Array.isArray(e);if("object"===o.type&&r||"array"===o.type&&t)return Promise.resolve();return Promise.reject(Error("object"===o.type?"Please enter a JSON object":"Please enter a JSON array"))}catch(e){return Promise.reject(Error("Invalid JSON"))}}}]:[]],className:"mb-3",children:["string"===o.type&&o.enum&&(0,t.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:null!=c?c:"",children:[!(null===(a=g.required)||void 0===a?void 0:a.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),o.enum.map(e=>(0,t.jsx)("option",{value:e,children:e},e))]}),"string"===o.type&&!o.enum&&(0,t.jsx)(M.o,{placeholder:o.description||"Enter ".concat(i),defaultValue:null!=c?c:"",className:"rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-500"}),("number"===o.type||"integer"===o.type)&&(0,t.jsx)("input",{type:"number",step:"integer"===o.type?1:"any",placeholder:o.description||"Enter ".concat(i),defaultValue:null!=c?c:0,className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors"}),"boolean"===o.type&&(0,t.jsxs)("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm transition-colors",defaultValue:(null!=c&&c).toString(),children:[!(null===(n=g.required)||void 0===n?void 0:n.includes(i))&&(0,t.jsxs)("option",{value:"",children:["Select ",i]}),(0,t.jsx)("option",{value:"true",children:"True"}),(0,t.jsx)("option",{value:"false",children:"False"})]}),("object"===o.type||"array"===o.type)&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("textarea",{rows:"object"===o.type?6:4,placeholder:o.description||("object"===o.type?"Enter JSON object for ".concat(i):"Enter JSON array for ".concat(i)),defaultValue:null!=c?c:"object"===o.type?"{}":"[]",spellCheck:!1,"data-testid":"textarea-".concat(i),className:"w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm font-mono"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"object"===o.type?"Provide a valid JSON object.":"Provide a valid JSON array."})]})]},d)})}),(0,t.jsx)("div",{className:"pt-3 border-t border-gray-100",children:(0,t.jsx)(M.z,{onClick:()=>o.submit(),disabled:l,variant:"primary",className:"w-full",loading:l,children:l?"Calling Tool...":a||n?"Call Again":"Call Tool"})})]})})]}),(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"border-b border-gray-100 px-4 py-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Tool Result"})}),(0,t.jsx)("div",{className:"p-4",children:a||n||l?(0,t.jsxs)("div",{className:"space-y-3",children:[a&&!l&&!n&&(0,t.jsx)("div",{className:"p-2 bg-green-50 border border-green-200 rounded-lg",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("svg",{className:"h-4 w-4 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,t.jsx)("h4",{className:"text-xs font-medium text-green-900",children:"Tool executed successfully"}),null!==x&&(0,t.jsxs)("span",{className:"text-xs text-green-600 ml-1",children:["• ",(x/1e3).toFixed(2),"s"]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,t.jsxs)("div",{className:"flex bg-white rounded border border-green-300 p-0.5",children:[(0,t.jsx)("button",{onClick:()=>d("formatted"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("formatted"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"Formatted"}),(0,t.jsx)("button",{onClick:()=>d("json"),className:"px-2 py-1 text-xs font-medium rounded transition-colors ".concat("json"===c?"bg-green-100 text-green-800":"text-green-600 hover:text-green-800"),children:"JSON"})]}),(0,t.jsx)("button",{onClick:b,className:"p-1 hover:bg-green-100 rounded text-green-700",title:"Copy response",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,t.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})}),(0,t.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[l&&(0,t.jsxs)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-sm font-medium mt-3",children:"Calling tool..."}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"Please wait while we process your request"})]}),n&&(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-4 w-4 text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-red-900",children:"Tool Call Failed"}),null!==x&&(0,t.jsxs)("span",{className:"text-xs text-red-600",children:["• ",(x/1e3).toFixed(2),"s"]})]}),(0,t.jsx)("div",{className:"bg-white border border-red-200 rounded p-2 max-h-48 overflow-y-auto",children:(0,t.jsx)("pre",{className:"text-xs whitespace-pre-wrap text-red-700 font-mono",children:n.message})})]})]})}),a&&!l&&!n&&(0,t.jsx)("div",{className:"space-y-3",children:"formatted"===c?a.map((e,s)=>(0,t.jsxs)("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:["text"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Text Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200 max-h-64 overflow-y-auto",children:(0,t.jsx)("div",{className:"p-3 space-y-2",children:e.text.split("\n\n").map((e,s)=>{if(""===e.trim())return null;if(e.startsWith("##")){let r=e.replace(/^#+\s/,"");return(0,t.jsx)("div",{className:"border-b border-gray-200 pb-1 mb-2",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:r})},s)}let r=/(https?:\/\/[^\s\)]+)/g;if(r.test(e)){let l=e.split(r);return(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded p-2",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap",children:l.map((e,s)=>r.test(e)?(0,t.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-800 underline break-all",children:e},s):e)})},s)}return e.includes("Score:")?(0,t.jsx)("div",{className:"bg-green-50 border-l-4 border-green-400 p-2 rounded-r",children:(0,t.jsx)("p",{className:"text-xs text-green-800 font-medium whitespace-pre-wrap",children:e})},s):(0,t.jsx)("div",{className:"bg-gray-50 rounded p-2 border border-gray-200",children:(0,t.jsx)("div",{className:"text-xs text-gray-700 leading-relaxed whitespace-pre-wrap font-mono",children:e})},s)}).filter(Boolean)})})})]}),"image"===e.type&&e.url&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Image Response"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsx)("div",{className:"bg-gray-50 rounded p-3 border border-gray-200",children:(0,t.jsx)("img",{src:e.url,alt:"Tool result",className:"max-w-full h-auto rounded shadow-sm"})})})]}),"embedded_resource"===e.type&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"bg-gray-50 px-3 py-1 border-b border-gray-200",children:(0,t.jsx)("span",{className:"text-xs font-medium text-gray-700 uppercase tracking-wide",children:"Embedded Resource"})}),(0,t.jsx)("div",{className:"p-3",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2 p-3 bg-blue-50 border border-blue-200 rounded",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-blue-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("p",{className:"text-xs font-medium text-blue-900",children:["Resource Type: ",e.resource_type]}),e.url&&(0,t.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-xs text-blue-600 hover:text-blue-800 hover:underline mt-1 transition-colors",children:["View Resource",(0,t.jsxs)("svg",{className:"ml-1 h-3 w-3",fill:"currentColor",viewBox:"0 0 20 20",children:[(0,t.jsx)("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),(0,t.jsx)("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"})]})]})]})]})})]})]},s)):(0,t.jsx)("div",{className:"bg-white rounded border border-gray-200",children:(0,t.jsx)("div",{className:"p-3 overflow-auto max-h-80 bg-gray-50",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all text-gray-800",children:JSON.stringify(a,null,2)})})})})]})]}):(0,t.jsx)("div",{className:"flex flex-col justify-center items-center h-48 text-gray-500",children:(0,t.jsxs)("div",{className:"text-center max-w-sm",children:[(0,t.jsx)("div",{className:"mb-3",children:(0,t.jsx)("svg",{className:"mx-auto h-12 w-12 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-900 mb-1",children:"Ready to Call Tool"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 leading-relaxed",children:'Configure the input parameters and click "Call Tool" to see the results here.'})]})})})]})]})]})}var sM=r(69993),sI=e=>{let{serverId:s,accessToken:r,auth_type:l,userRole:a,userID:n,serverAlias:i}=e,[o,c]=(0,j.useState)(null),[d,u]=(0,j.useState)(null),[m,x]=(0,j.useState)(null),{data:h,isLoading:p,error:g}=(0,y.a)({queryKey:["mcpTools",s],queryFn:()=>{if(!r)throw Error("Access Token required");return(0,_.listMCPTools)(r,s)},enabled:!!r,staleTime:3e4}),{mutate:f,isPending:v}=(0,e7.D)({mutationFn:async e=>{if(!r)throw Error("Access Token required");try{return await (0,_.callMCPTool)(r,s,e.tool.name,e.arguments)}catch(e){throw e}},onSuccess:e=>{u(e.content),x(null)},onError:e=>{x(e),u(null)}}),b=(null==h?void 0:h.tools)||[];return(0,t.jsx)("div",{className:"w-full h-screen p-4 bg-white",children:(0,t.jsx)(H.Zb,{className:"w-full rounded-xl shadow-md overflow-hidden",children:(0,t.jsxs)("div",{className:"flex h-auto w-full gap-4",children:[(0,t.jsxs)("div",{className:"w-1/4 p-4 bg-gray-50 flex flex-col",children:[(0,t.jsx)(H.Dx,{className:"text-xl font-semibold mb-6 mt-2",children:"MCP Tools"}),(0,t.jsx)("div",{className:"flex flex-col flex-1",children:(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,t.jsxs)(H.xv,{className:"font-medium block mb-3 text-gray-700 flex items-center",children:[(0,t.jsx)(K.Z,{className:"mr-2"})," Available Tools",b.length>0&&(0,t.jsx)("span",{className:"ml-2 bg-blue-100 text-blue-800 text-xs font-medium px-2 py-0.5 rounded-full",children:b.length})]}),p&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 bg-white border border-gray-200 rounded-lg",children:[(0,t.jsxs)("div",{className:"relative mb-3",children:[(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-gray-200"}),(0,t.jsx)("div",{className:"animate-spin rounded-full h-6 w-6 border-2 border-blue-600 border-t-transparent absolute top-0"})]}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-700",children:"Loading tools..."})]}),(null==h?void 0:h.error)&&!p&&!b.length&&(0,t.jsx)("div",{className:"p-3 text-xs text-red-800 rounded-lg bg-red-50 border border-red-200",children:(0,t.jsxs)("p",{className:"font-medium",children:["Error: ",h.message]})}),!p&&!(null==h?void 0:h.error)&&(!b||0===b.length)&&(0,t.jsxs)("div",{className:"p-4 text-center bg-white border border-gray-200 rounded-lg",children:[(0,t.jsx)("div",{className:"mx-auto w-8 h-8 bg-gray-200 rounded-full flex items-center justify-center mb-2",children:(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 8.172V5L8 4z"})})}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-700 mb-1",children:"No tools available"}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:"No tools found for this server"})]}),!p&&!(null==h?void 0:h.error)&&b.length>0&&(0,t.jsx)("div",{className:"space-y-2 flex-1 overflow-y-auto min-h-0 mcp-tools-scrollable",style:{maxHeight:"400px",scrollbarWidth:"auto",scrollbarColor:"#cbd5e0 #f7fafc"},children:b.map(e=>(0,t.jsxs)("div",{className:"border rounded-lg p-3 cursor-pointer transition-all hover:shadow-sm ".concat((null==o?void 0:o.name)===e.name?"border-blue-500 bg-blue-50 ring-1 ring-blue-200":"border-gray-200 bg-white hover:border-gray-300"),onClick:()=>{c(e),u(null),x(null)},children:[(0,t.jsxs)("div",{className:"flex items-start space-x-2",children:[e.mcp_info.logo_url&&(0,t.jsx)("img",{src:e.mcp_info.logo_url,alt:"".concat(e.mcp_info.server_name," logo"),className:"w-4 h-4 object-contain flex-shrink-0 mt-0.5"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h4",{className:"font-mono text-xs font-medium text-gray-900 truncate",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-gray-500 truncate",children:e.mcp_info.server_name}),(0,t.jsx)("p",{className:"text-xs text-gray-600 mt-1 line-clamp-2 leading-relaxed",children:e.description})]})]}),(null==o?void 0:o.name)===e.name&&(0,t.jsx)("div",{className:"mt-2 pt-2 border-t border-blue-200",children:(0,t.jsxs)("div",{className:"flex items-center text-xs font-medium text-blue-700",children:[(0,t.jsx)("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Selected"]})})]},e.name))})]})})]}),(0,t.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,t.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,t.jsx)(H.Dx,{className:"text-xl font-semibold mb-0",children:"Tool Testing Playground"})}),(0,t.jsx)("div",{className:"flex-1 overflow-auto p-4",children:o?(0,t.jsx)("div",{className:"h-full",children:(0,t.jsx)(sT,{tool:o,onSubmit:e=>{f({tool:o,arguments:e})},result:d,error:m,isLoading:v,onClose:()=>c(null)})}):(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,t.jsx)(sM.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,t.jsx)(H.xv,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select a Tool to Test"}),(0,t.jsx)(H.xv,{className:"text-center text-gray-500 max-w-md",children:"Choose a tool from the left sidebar to start testing its functionality with custom inputs."})]})})]})]})})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/11383a8b78399079.js b/litellm/proxy/_experimental/out/_next/static/chunks/11383a8b78399079.js new file mode 100644 index 00000000000..43d56c85417 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/11383a8b78399079.js @@ -0,0 +1,8 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,629569,e=>{"use strict";var t=e.i(290571),r=e.i(95779),o=e.i(444755),a=e.i(673706),i=e.i(271645);let n=i.default.forwardRef((e,n)=>{let{color:l,children:s,className:d}=e,c=(0,t.__rest)(e,["color","children","className"]);return i.default.createElement("p",Object.assign({ref:n,className:(0,o.tremorTwMerge)("font-medium text-tremor-title",l?(0,a.getColorClassNames)(l,r.colorPalette.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",d)},c),s)});n.displayName="Title",e.s(["Title",()=>n],629569)},599724,936325,e=>{"use strict";var t=e.i(95779),r=e.i(444755),o=e.i(673706),a=e.i(271645);let i=a.default.forwardRef((e,i)=>{let{color:n,className:l,children:s}=e;return a.default.createElement("p",{ref:i,className:(0,r.tremorTwMerge)("text-tremor-default",n?(0,o.getColorClassNames)(n,t.colorPalette.text).textColor:(0,r.tremorTwMerge)("text-tremor-content","dark:text-dark-tremor-content"),l)},s)});i.displayName="Text",e.s(["default",()=>i],936325),e.s(["Text",()=>i],599724)},304967,e=>{"use strict";var t=e.i(290571),r=e.i(271645),o=e.i(480731),a=e.i(95779),i=e.i(444755),n=e.i(673706);let l=(0,n.makeClassName)("Card"),s=r.default.forwardRef((e,s)=>{let{decoration:d="",decorationColor:c,children:m,className:u}=e,g=(0,t.__rest)(e,["decoration","decorationColor","children","className"]);return r.default.createElement("div",Object.assign({ref:s,className:(0,i.tremorTwMerge)(l("root"),"relative w-full text-left ring-1 rounded-tremor-default p-6","bg-tremor-background ring-tremor-ring shadow-tremor-card","dark:bg-dark-tremor-background dark:ring-dark-tremor-ring dark:shadow-dark-tremor-card",c?(0,n.getColorClassNames)(c,a.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",(e=>{if(!e)return"";switch(e){case o.HorizontalPositions.Left:return"border-l-4";case o.VerticalPositions.Top:return"border-t-4";case o.HorizontalPositions.Right:return"border-r-4";case o.VerticalPositions.Bottom:return"border-b-4";default:return""}})(d),u)},g),m)});s.displayName="Card",e.s(["Card",()=>s],304967)},994388,e=>{"use strict";var t=e.i(290571),r=e.i(829087),o=e.i(271645);let a=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],i=e=>({_s:e,status:a[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),n=e=>e?6:5,l=(e,t,r,o,a)=>{clearTimeout(o.current);let n=i(e);t(n),r.current=n,a&&a({current:n})};var s=e.i(480731),d=e.i(444755),c=e.i(673706);let m=e=>{var r=(0,t.__rest)(e,[]);return o.default.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),o.default.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),o.default.createElement("path",{d:"M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z"}))};var u=e.i(95779);let g={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},p=(e,t)=>{switch(e){case"primary":return{textColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?(0,c.getColorClassNames)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,c.getColorClassNames)(t,u.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,hoverBgColor:t?(0,d.tremorTwMerge)((0,c.getColorClassNames)(t,u.colorPalette.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:t?(0,c.getColorClassNames)(t,u.colorPalette.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?(0,c.getColorClassNames)(t,u.colorPalette.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?(0,c.getColorClassNames)(t,u.colorPalette.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,c.getColorClassNames)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},h=(0,c.makeClassName)("Button"),b=({loading:e,iconSize:t,iconPosition:r,Icon:a,needMargin:i,transitionStatus:n})=>{let l=i?r===s.HorizontalPositions.Left?(0,d.tremorTwMerge)("-ml-1","mr-1.5"):(0,d.tremorTwMerge)("-mr-1","ml-1.5"):"",c=(0,d.tremorTwMerge)("w-0 h-0"),u={default:c,entering:c,entered:t,exiting:t,exited:c};return e?o.default.createElement(m,{className:(0,d.tremorTwMerge)(h("icon"),"animate-spin shrink-0",l,u.default,u[n]),style:{transition:"width 150ms"}}):o.default.createElement(a,{className:(0,d.tremorTwMerge)(h("icon"),"shrink-0",t,l)})},f=o.default.forwardRef((e,a)=>{let{icon:m,iconPosition:u=s.HorizontalPositions.Left,size:f=s.Sizes.SM,color:v,variant:C="primary",disabled:$,loading:x=!1,loadingText:k,children:w,tooltip:y,className:S}=e,N=(0,t.__rest)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),z=x||$,E=void 0!==m||x,O=x&&k,j=!(!w&&!O),T=(0,d.tremorTwMerge)(g[f].height,g[f].width),M="light"!==C?(0,d.tremorTwMerge)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",P=p(C,v),q=("light"!==C?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}})[f],{tooltipProps:B,getReferenceProps:R}=(0,r.useTooltip)(300),[I,D]=(({enter:e=!0,exit:t=!0,preEnter:r,preExit:a,timeout:s,initialEntered:d,mountOnEnter:c,unmountOnExit:m,onStateChange:u}={})=>{let[g,p]=(0,o.useState)(()=>i(d?2:n(c))),h=(0,o.useRef)(g),b=(0,o.useRef)(0),[f,v]="object"==typeof s?[s.enter,s.exit]:[s,s],C=(0,o.useCallback)(()=>{let e=((e,t)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return n(t)}})(h.current._s,m);e&&l(e,p,h,b,u)},[u,m]);return[g,(0,o.useCallback)(o=>{let i=e=>{switch(l(e,p,h,b,u),e){case 1:f>=0&&(b.current=((...e)=>setTimeout(...e))(C,f));break;case 4:v>=0&&(b.current=((...e)=>setTimeout(...e))(C,v));break;case 0:case 3:b.current=((...e)=>setTimeout(...e))(()=>{isNaN(document.body.offsetTop)||i(e+1)},0)}},s=h.current.isEnter;"boolean"!=typeof o&&(o=!s),o?s||i(e?+!r:2):s&&i(t?a?3:4:n(m))},[C,u,e,t,r,a,f,v,m]),C]})({timeout:50});return(0,o.useEffect)(()=>{D(x)},[x]),o.default.createElement("button",Object.assign({ref:(0,c.mergeRefs)([a,B.refs.setReference]),className:(0,d.tremorTwMerge)(h("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",M,q.paddingX,q.paddingY,q.fontSize,P.textColor,P.bgColor,P.borderColor,P.hoverBorderColor,z?"opacity-50 cursor-not-allowed":(0,d.tremorTwMerge)(p(C,v).hoverTextColor,p(C,v).hoverBgColor,p(C,v).hoverBorderColor),S),disabled:z},R,N),o.default.createElement(r.default,Object.assign({text:y},B)),E&&u!==s.HorizontalPositions.Right?o.default.createElement(b,{loading:x,iconSize:T,iconPosition:u,Icon:m,transitionStatus:I.status,needMargin:j}):null,O||w?o.default.createElement("span",{className:(0,d.tremorTwMerge)(h("text"),"text-tremor-default whitespace-nowrap")},O?k:w):null,E&&u===s.HorizontalPositions.Right?o.default.createElement(b,{loading:x,iconSize:T,iconPosition:u,Icon:m,transitionStatus:I.status,needMargin:j}):null)});f.displayName="Button",e.s(["Button",()=>f],994388)},185793,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),o=e.i(242064),a=e.i(529681);let i=e=>{let{prefixCls:o,className:a,style:i,size:n,shape:l}=e,s=(0,r.default)({[`${o}-lg`]:"large"===n,[`${o}-sm`]:"small"===n}),d=(0,r.default)({[`${o}-circle`]:"circle"===l,[`${o}-square`]:"square"===l,[`${o}-round`]:"round"===l}),c=t.useMemo(()=>"number"==typeof n?{width:n,height:n,lineHeight:`${n}px`}:{},[n]);return t.createElement("span",{className:(0,r.default)(o,s,d,a),style:Object.assign(Object.assign({},c),i)})};e.i(296059);var n=e.i(694758),l=e.i(915654),s=e.i(246422),d=e.i(838378);let c=new n.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),m=e=>({height:e,lineHeight:(0,l.unit)(e)}),u=e=>Object.assign({width:e},m(e)),g=(e,t)=>Object.assign({width:t(e).mul(5).equal(),minWidth:t(e).mul(5).equal()},m(e)),p=e=>Object.assign({width:e},m(e)),h=(e,t,r)=>{let{skeletonButtonCls:o}=e;return{[`${r}${o}-circle`]:{width:t,minWidth:t,borderRadius:"50%"},[`${r}${o}-round`]:{borderRadius:t}}},b=(e,t)=>Object.assign({width:t(e).mul(2).equal(),minWidth:t(e).mul(2).equal()},m(e)),f=(0,s.genStyleHooks)("Skeleton",e=>{let{componentCls:t,calc:r}=e;return(e=>{let{componentCls:t,skeletonAvatarCls:r,skeletonTitleCls:o,skeletonParagraphCls:a,skeletonButtonCls:i,skeletonInputCls:n,skeletonImageCls:l,controlHeight:s,controlHeightLG:d,controlHeightSM:m,gradientFromColor:f,padding:v,marginSM:C,borderRadius:$,titleHeight:x,blockRadius:k,paragraphLiHeight:w,controlHeightXS:y,paragraphMarginTop:S}=e;return{[t]:{display:"table",width:"100%",[`${t}-header`]:{display:"table-cell",paddingInlineEnd:v,verticalAlign:"top",[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:f},u(s)),[`${r}-circle`]:{borderRadius:"50%"},[`${r}-lg`]:Object.assign({},u(d)),[`${r}-sm`]:Object.assign({},u(m))},[`${t}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[o]:{width:"100%",height:x,background:f,borderRadius:k,[`+ ${a}`]:{marginBlockStart:m}},[a]:{padding:0,"> li":{width:"100%",height:w,listStyle:"none",background:f,borderRadius:k,"+ li":{marginBlockStart:y}}},[`${a}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${t}-content`]:{[`${o}, ${a} > li`]:{borderRadius:$}}},[`${t}-with-avatar ${t}-content`]:{[o]:{marginBlockStart:C,[`+ ${a}`]:{marginBlockStart:S}}},[`${t}${t}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},(e=>{let{borderRadiusSM:t,skeletonButtonCls:r,controlHeight:o,controlHeightLG:a,controlHeightSM:i,gradientFromColor:n,calc:l}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[r]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:t,width:l(o).mul(2).equal(),minWidth:l(o).mul(2).equal()},b(o,l))},h(e,o,r)),{[`${r}-lg`]:Object.assign({},b(a,l))}),h(e,a,`${r}-lg`)),{[`${r}-sm`]:Object.assign({},b(i,l))}),h(e,i,`${r}-sm`))})(e)),(e=>{let{skeletonAvatarCls:t,gradientFromColor:r,controlHeight:o,controlHeightLG:a,controlHeightSM:i}=e;return{[t]:Object.assign({display:"inline-block",verticalAlign:"top",background:r},u(o)),[`${t}${t}-circle`]:{borderRadius:"50%"},[`${t}${t}-lg`]:Object.assign({},u(a)),[`${t}${t}-sm`]:Object.assign({},u(i))}})(e)),(e=>{let{controlHeight:t,borderRadiusSM:r,skeletonInputCls:o,controlHeightLG:a,controlHeightSM:i,gradientFromColor:n,calc:l}=e;return{[o]:Object.assign({display:"inline-block",verticalAlign:"top",background:n,borderRadius:r},g(t,l)),[`${o}-lg`]:Object.assign({},g(a,l)),[`${o}-sm`]:Object.assign({},g(i,l))}})(e)),(e=>{let{skeletonImageCls:t,imageSizeBase:r,gradientFromColor:o,borderRadiusSM:a,calc:i}=e;return{[t]:Object.assign(Object.assign({display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"middle",background:o,borderRadius:a},p(i(r).mul(2).equal())),{[`${t}-path`]:{fill:"#bfbfbf"},[`${t}-svg`]:Object.assign(Object.assign({},p(r)),{maxWidth:i(r).mul(4).equal(),maxHeight:i(r).mul(4).equal()}),[`${t}-svg${t}-svg-circle`]:{borderRadius:"50%"}}),[`${t}${t}-circle`]:{borderRadius:"50%"}}})(e)),[`${t}${t}-block`]:{width:"100%",[i]:{width:"100%"},[n]:{width:"100%"}},[`${t}${t}-active`]:{[` + ${o}, + ${a} > li, + ${r}, + ${i}, + ${n}, + ${l} + `]:Object.assign({},{background:e.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:c,animationDuration:e.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"})}}})((0,d.mergeToken)(e,{skeletonAvatarCls:`${t}-avatar`,skeletonTitleCls:`${t}-title`,skeletonParagraphCls:`${t}-paragraph`,skeletonButtonCls:`${t}-button`,skeletonInputCls:`${t}-input`,skeletonImageCls:`${t}-image`,imageSizeBase:r(e.controlHeight).mul(1.5).equal(),borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${e.gradientFromColor} 25%, ${e.gradientToColor} 37%, ${e.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"}))},e=>{let{colorFillContent:t,colorFill:r}=e;return{color:t,colorGradientEnd:r,gradientFromColor:t,gradientToColor:r,titleHeight:e.controlHeight/2,blockRadius:e.borderRadiusSM,paragraphMarginTop:e.marginLG+e.marginXXS,paragraphLiHeight:e.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),v=e=>{let{prefixCls:o,className:a,style:i,rows:n=0}=e,l=Array.from({length:n}).map((r,o)=>t.createElement("li",{key:o,style:{width:((e,t)=>{let{width:r,rows:o=2}=t;return Array.isArray(r)?r[e]:o-1===e?r:void 0})(o,e)}}));return t.createElement("ul",{className:(0,r.default)(o,a),style:i},l)},C=({prefixCls:e,className:o,width:a,style:i})=>t.createElement("h3",{className:(0,r.default)(e,o),style:Object.assign({width:a},i)});function $(e){return e&&"object"==typeof e?e:{}}let x=e=>{let{prefixCls:a,loading:n,className:l,rootClassName:s,style:d,children:c,avatar:m=!1,title:u=!0,paragraph:g=!0,active:p,round:h}=e,{getPrefixCls:b,direction:x,className:k,style:w}=(0,o.useComponentConfig)("skeleton"),y=b("skeleton",a),[S,N,z]=f(y);if(n||!("loading"in e)){let e,o,a=!!m,n=!!u,c=!!g;if(a){let r=Object.assign(Object.assign({prefixCls:`${y}-avatar`},n&&!c?{size:"large",shape:"square"}:{size:"large",shape:"circle"}),$(m));e=t.createElement("div",{className:`${y}-header`},t.createElement(i,Object.assign({},r)))}if(n||c){let e,r;if(n){let r=Object.assign(Object.assign({prefixCls:`${y}-title`},!a&&c?{width:"38%"}:a&&c?{width:"50%"}:{}),$(u));e=t.createElement(C,Object.assign({},r))}if(c){let e,o=Object.assign(Object.assign({prefixCls:`${y}-paragraph`},(e={},a&&n||(e.width="61%"),!a&&n?e.rows=3:e.rows=2,e)),$(g));r=t.createElement(v,Object.assign({},o))}o=t.createElement("div",{className:`${y}-content`},e,r)}let b=(0,r.default)(y,{[`${y}-with-avatar`]:a,[`${y}-active`]:p,[`${y}-rtl`]:"rtl"===x,[`${y}-round`]:h},k,l,s,N,z);return S(t.createElement("div",{className:b,style:Object.assign(Object.assign({},w),d)},e,o))}return null!=c?c:null};x.Button=e=>{let{prefixCls:n,className:l,rootClassName:s,active:d,block:c=!1,size:m="default"}=e,{getPrefixCls:u}=t.useContext(o.ConfigContext),g=u("skeleton",n),[p,h,b]=f(g),v=(0,a.default)(e,["prefixCls"]),C=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},l,s,h,b);return p(t.createElement("div",{className:C},t.createElement(i,Object.assign({prefixCls:`${g}-button`,size:m},v))))},x.Avatar=e=>{let{prefixCls:n,className:l,rootClassName:s,active:d,shape:c="circle",size:m="default"}=e,{getPrefixCls:u}=t.useContext(o.ConfigContext),g=u("skeleton",n),[p,h,b]=f(g),v=(0,a.default)(e,["prefixCls","className"]),C=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d},l,s,h,b);return p(t.createElement("div",{className:C},t.createElement(i,Object.assign({prefixCls:`${g}-avatar`,shape:c,size:m},v))))},x.Input=e=>{let{prefixCls:n,className:l,rootClassName:s,active:d,block:c,size:m="default"}=e,{getPrefixCls:u}=t.useContext(o.ConfigContext),g=u("skeleton",n),[p,h,b]=f(g),v=(0,a.default)(e,["prefixCls"]),C=(0,r.default)(g,`${g}-element`,{[`${g}-active`]:d,[`${g}-block`]:c},l,s,h,b);return p(t.createElement("div",{className:C},t.createElement(i,Object.assign({prefixCls:`${g}-input`,size:m},v))))},x.Image=e=>{let{prefixCls:a,className:i,rootClassName:n,style:l,active:s}=e,{getPrefixCls:d}=t.useContext(o.ConfigContext),c=d("skeleton",a),[m,u,g]=f(c),p=(0,r.default)(c,`${c}-element`,{[`${c}-active`]:s},i,n,u,g);return m(t.createElement("div",{className:p},t.createElement("div",{className:(0,r.default)(`${c}-image`,i),style:l},t.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${c}-image-svg`},t.createElement("title",null,"Image placeholder"),t.createElement("path",{d:"M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z",className:`${c}-image-path`})))))},x.Node=e=>{let{prefixCls:a,className:i,rootClassName:n,style:l,active:s,children:d}=e,{getPrefixCls:c}=t.useContext(o.ConfigContext),m=c("skeleton",a),[u,g,p]=f(m),h=(0,r.default)(m,`${m}-element`,{[`${m}-active`]:s},g,i,n,p);return u(t.createElement("div",{className:h},t.createElement("div",{className:(0,r.default)(`${m}-image`,i),style:l},d)))},e.s(["default",0,x],185793)},244451,e=>{"use strict";let t;e.i(247167);var r=e.i(271645),o=e.i(343794),a=e.i(242064),i=e.i(763731),n=e.i(174428);let l=80*Math.PI,s=e=>{let{dotClassName:t,style:a,hasCircleCls:i}=e;return r.createElement("circle",{className:(0,o.default)(`${t}-circle`,{[`${t}-circle-bg`]:i}),r:40,cx:50,cy:50,strokeWidth:20,style:a})},d=({percent:e,prefixCls:t})=>{let a=`${t}-dot`,i=`${a}-holder`,d=`${i}-hidden`,[c,m]=r.useState(!1);(0,n.default)(()=>{0!==e&&m(!0)},[0!==e]);let u=Math.max(Math.min(e,100),0);if(!c)return null;let g={strokeDashoffset:`${l/4}`,strokeDasharray:`${l*u/100} ${l*(100-u)/100}`};return r.createElement("span",{className:(0,o.default)(i,`${a}-progress`,u<=0&&d)},r.createElement("svg",{viewBox:"0 0 100 100",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":u},r.createElement(s,{dotClassName:a,hasCircleCls:!0}),r.createElement(s,{dotClassName:a,style:g})))};function c(e){let{prefixCls:t,percent:a=0}=e,i=`${t}-dot`,n=`${i}-holder`,l=`${n}-hidden`;return r.createElement(r.Fragment,null,r.createElement("span",{className:(0,o.default)(n,a>0&&l)},r.createElement("span",{className:(0,o.default)(i,`${t}-dot-spin`)},[1,2,3,4].map(e=>r.createElement("i",{className:`${t}-dot-item`,key:e})))),r.createElement(d,{prefixCls:t,percent:a}))}function m(e){var t;let{prefixCls:a,indicator:n,percent:l}=e,s=`${a}-dot`;return n&&r.isValidElement(n)?(0,i.cloneElement)(n,{className:(0,o.default)(null==(t=n.props)?void 0:t.className,s),percent:l}):r.createElement(c,{prefixCls:a,percent:l})}e.i(296059);var u=e.i(694758),g=e.i(183293),p=e.i(246422),h=e.i(838378);let b=new u.Keyframes("antSpinMove",{to:{opacity:1}}),f=new u.Keyframes("antRotate",{to:{transform:"rotate(405deg)"}}),v=(0,p.genStyleHooks)("Spin",e=>(e=>{let{componentCls:t,calc:r}=e;return{[t]:Object.assign(Object.assign({},(0,g.resetComponent)(e)),{position:"absolute",display:"none",color:e.colorPrimary,fontSize:0,textAlign:"center",verticalAlign:"middle",opacity:0,transition:`transform ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`,"&-spinning":{position:"relative",display:"inline-block",opacity:1},[`${t}-text`]:{fontSize:e.fontSize,paddingTop:r(r(e.dotSize).sub(e.fontSize)).div(2).add(2).equal()},"&-fullscreen":{position:"fixed",width:"100vw",height:"100vh",backgroundColor:e.colorBgMask,zIndex:e.zIndexPopupBase,inset:0,display:"flex",alignItems:"center",flexDirection:"column",justifyContent:"center",opacity:0,visibility:"hidden",transition:`all ${e.motionDurationMid}`,"&-show":{opacity:1,visibility:"visible"},[t]:{[`${t}-dot-holder`]:{color:e.colorWhite},[`${t}-text`]:{color:e.colorTextLightSolid}}},"&-nested-loading":{position:"relative",[`> div > ${t}`]:{position:"absolute",top:0,insetInlineStart:0,zIndex:4,display:"block",width:"100%",height:"100%",maxHeight:e.contentHeight,[`${t}-dot`]:{position:"absolute",top:"50%",insetInlineStart:"50%",margin:r(e.dotSize).mul(-1).div(2).equal()},[`${t}-text`]:{position:"absolute",top:"50%",width:"100%",textShadow:`0 1px 2px ${e.colorBgContainer}`},[`&${t}-show-text ${t}-dot`]:{marginTop:r(e.dotSize).div(2).mul(-1).sub(10).equal()},"&-sm":{[`${t}-dot`]:{margin:r(e.dotSizeSM).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:r(r(e.dotSizeSM).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:r(e.dotSizeSM).div(2).mul(-1).sub(10).equal()}},"&-lg":{[`${t}-dot`]:{margin:r(e.dotSizeLG).mul(-1).div(2).equal()},[`${t}-text`]:{paddingTop:r(r(e.dotSizeLG).sub(e.fontSize)).div(2).add(2).equal()},[`&${t}-show-text ${t}-dot`]:{marginTop:r(e.dotSizeLG).div(2).mul(-1).sub(10).equal()}}},[`${t}-container`]:{position:"relative",transition:`opacity ${e.motionDurationSlow}`,"&::after":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:10,width:"100%",height:"100%",background:e.colorBgContainer,opacity:0,transition:`all ${e.motionDurationSlow}`,content:'""',pointerEvents:"none"}},[`${t}-blur`]:{clear:"both",opacity:.5,userSelect:"none",pointerEvents:"none","&::after":{opacity:.4,pointerEvents:"auto"}}},"&-tip":{color:e.spinDotDefault},[`${t}-dot-holder`]:{width:"1em",height:"1em",fontSize:e.dotSize,display:"inline-block",transition:`transform ${e.motionDurationSlow} ease, opacity ${e.motionDurationSlow} ease`,transformOrigin:"50% 50%",lineHeight:1,color:e.colorPrimary,"&-hidden":{transform:"scale(0.3)",opacity:0}},[`${t}-dot-progress`]:{position:"absolute",inset:0},[`${t}-dot`]:{position:"relative",display:"inline-block",fontSize:e.dotSize,width:"1em",height:"1em","&-item":{position:"absolute",display:"block",width:r(e.dotSize).sub(r(e.marginXXS).div(2)).div(2).equal(),height:r(e.dotSize).sub(r(e.marginXXS).div(2)).div(2).equal(),background:"currentColor",borderRadius:"100%",transform:"scale(0.75)",transformOrigin:"50% 50%",opacity:.3,animationName:b,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear",animationDirection:"alternate","&:nth-child(1)":{top:0,insetInlineStart:0,animationDelay:"0s"},"&:nth-child(2)":{top:0,insetInlineEnd:0,animationDelay:"0.4s"},"&:nth-child(3)":{insetInlineEnd:0,bottom:0,animationDelay:"0.8s"},"&:nth-child(4)":{bottom:0,insetInlineStart:0,animationDelay:"1.2s"}},"&-spin":{transform:"rotate(45deg)",animationName:f,animationDuration:"1.2s",animationIterationCount:"infinite",animationTimingFunction:"linear"},"&-circle":{strokeLinecap:"round",transition:["stroke-dashoffset","stroke-dasharray","stroke","stroke-width","opacity"].map(t=>`${t} ${e.motionDurationSlow} ease`).join(","),fillOpacity:0,stroke:"currentcolor"},"&-circle-bg":{stroke:e.colorFillSecondary}},[`&-sm ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeSM}},[`&-sm ${t}-dot-holder`]:{i:{width:r(r(e.dotSizeSM).sub(r(e.marginXXS).div(2))).div(2).equal(),height:r(r(e.dotSizeSM).sub(r(e.marginXXS).div(2))).div(2).equal()}},[`&-lg ${t}-dot`]:{"&, &-holder":{fontSize:e.dotSizeLG}},[`&-lg ${t}-dot-holder`]:{i:{width:r(r(e.dotSizeLG).sub(e.marginXXS)).div(2).equal(),height:r(r(e.dotSizeLG).sub(e.marginXXS)).div(2).equal()}},[`&${t}-show-text ${t}-text`]:{display:"block"}})}})((0,h.mergeToken)(e,{spinDotDefault:e.colorTextDescription})),e=>{let{controlHeightLG:t,controlHeight:r}=e;return{contentHeight:400,dotSize:t/2,dotSizeSM:.35*t,dotSizeLG:r}}),C=[[30,.05],[70,.03],[96,.01]];var $=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);at.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(r[o[a]]=e[o[a]]);return r};let x=e=>{var i;let{prefixCls:n,spinning:l=!0,delay:s=0,className:d,rootClassName:c,size:u="default",tip:g,wrapperClassName:p,style:h,children:b,fullscreen:f=!1,indicator:x,percent:k}=e,w=$(e,["prefixCls","spinning","delay","className","rootClassName","size","tip","wrapperClassName","style","children","fullscreen","indicator","percent"]),{getPrefixCls:y,direction:S,className:N,style:z,indicator:E}=(0,a.useComponentConfig)("spin"),O=y("spin",n),[j,T,M]=v(O),[P,q]=r.useState(()=>l&&(!l||!s||!!Number.isNaN(Number(s)))),B=function(e,t){let[o,a]=r.useState(0),i=r.useRef(null),n="auto"===t;return r.useEffect(()=>(n&&e&&(a(0),i.current=setInterval(()=>{a(e=>{let t=100-e;for(let r=0;r{i.current&&(clearInterval(i.current),i.current=null)}),[n,e]),n?o:t}(P,k);r.useEffect(()=>{if(l){let e=function(e,t,r){var o,a=r||{},i=a.noTrailing,n=void 0!==i&&i,l=a.noLeading,s=void 0!==l&&l,d=a.debounceMode,c=void 0===d?void 0:d,m=!1,u=0;function g(){o&&clearTimeout(o)}function p(){for(var r=arguments.length,a=Array(r),i=0;ie?s?(u=Date.now(),n||(o=setTimeout(c?h:p,e))):p():!0!==n&&(o=setTimeout(c?h:p,void 0===c?e-d:e)))}return p.cancel=function(e){var t=(e||{}).upcomingOnly;g(),m=!(void 0!==t&&t)},p}(s,()=>{q(!0)},{debounceMode:false});return e(),()=>{var t;null==(t=null==e?void 0:e.cancel)||t.call(e)}}q(!1)},[s,l]);let R=r.useMemo(()=>void 0!==b&&!f,[b,f]),I=(0,o.default)(O,N,{[`${O}-sm`]:"small"===u,[`${O}-lg`]:"large"===u,[`${O}-spinning`]:P,[`${O}-show-text`]:!!g,[`${O}-rtl`]:"rtl"===S},d,!f&&c,T,M),D=(0,o.default)(`${O}-container`,{[`${O}-blur`]:P}),H=null!=(i=null!=x?x:E)?i:t,X=Object.assign(Object.assign({},z),h),L=r.createElement("div",Object.assign({},w,{style:X,className:I,"aria-live":"polite","aria-busy":P}),r.createElement(m,{prefixCls:O,indicator:H,percent:B}),g&&(R||f)?r.createElement("div",{className:`${O}-text`},g):null);return j(R?r.createElement("div",Object.assign({},w,{className:(0,o.default)(`${O}-nested-loading`,p,T,M)}),P&&r.createElement("div",{key:"loading"},L),r.createElement("div",{className:D,key:"container"},b)):f?r.createElement("div",{className:(0,o.default)(`${O}-fullscreen`,{[`${O}-fullscreen-show`]:P},c,T,M)},L):L)};x.setDefaultIndicator=e=>{t=e},e.s(["default",0,x],244451)},482725,e=>{"use strict";var t=e.i(244451);e.s(["Spin",()=>t.default])},689020,e=>{"use strict";var t=e.i(764205);let r=async e=>{try{let r=await (0,t.modelHubCall)(e);if(console.log("model_info:",r),r?.data.length>0){let e=r.data.map(e=>({model_group:e.model_group,mode:e?.mode}));return e.sort((e,t)=>e.model_group.localeCompare(t.model_group)),e}return[]}catch(e){throw console.error("Error fetching model info:",e),e}};e.s(["fetchAvailableModels",0,r])},983561,e=>{"use strict";e.i(247167);var t=e.i(931067),r=e.i(271645);let o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"};var a=e.i(9583),i=r.forwardRef(function(e,i){return r.createElement(a.default,(0,t.default)({},e,{ref:i,icon:o}))});e.s(["RobotOutlined",0,i],983561)}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/115-9b3af056f550fde4.js b/litellm/proxy/_experimental/out/_next/static/chunks/115-9b3af056f550fde4.js deleted file mode 100644 index 8f7ae603275..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/115-9b3af056f550fde4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[115],{11894:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"},c=r(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},62670:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm47.7-395.2l-25.4-5.9V348.6c38 5.2 61.5 29 65.5 58.2.5 4 3.9 6.9 7.9 6.9h44.9c4.7 0 8.4-4.1 8-8.8-6.1-62.3-57.4-102.3-125.9-109.2V263c0-4.4-3.6-8-8-8h-28.1c-4.4 0-8 3.6-8 8v33c-70.8 6.9-126.2 46-126.2 119 0 67.6 49.8 100.2 102.1 112.7l24.7 6.3v142.7c-44.2-5.9-69-29.5-74.1-61.3-.6-3.8-4-6.6-7.9-6.6H363c-4.7 0-8.4 4-8 8.7 4.5 55 46.2 105.6 135.2 112.1V761c0 4.4 3.6 8 8 8h28.4c4.4 0 8-3.6 8-8.1l-.2-31.7c78.3-6.9 134.3-48.8 134.3-124-.1-69.4-44.2-100.4-109-116.4zm-68.6-16.2c-5.6-1.6-10.3-3.1-15-5-33.8-12.2-49.5-31.9-49.5-57.3 0-36.3 27.5-57 64.5-61.7v124zM534.3 677V543.3c3.1.9 5.9 1.6 8.8 2.2 47.3 14.4 63.2 34.4 63.2 65.1 0 39.1-29.4 62.6-72 66.4z"}}]},name:"dollar",theme:"outlined"},c=r(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},45246:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"}},{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}}]},name:"minus-circle",theme:"outlined"},c=r(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},28595:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"},c=r(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},89245:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"},c=r(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},77565:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},c=r(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},69993:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"}}]},name:"robot",theme:"outlined"},c=r(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},78355:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"},c=r(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},58630:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 01144-53.5L537 318.9a32.05 32.05 0 000 45.3l124.5 124.5a32.05 32.05 0 0045.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z"}}]},name:"tool",theme:"outlined"},c=r(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},47323:function(e,t,r){r.d(t,{Z:function(){return f}});var n=r(5853),o=r(2265),a=r(47187),c=r(7084),l=r(13241),i=r(1153),s=r(26898);let d={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},u={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},m={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},g=(e,t)=>{switch(e){case"simple":return{textColor:t?(0,i.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,i.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,l.q)((0,i.bM)(t,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,i.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,l.q)((0,i.bM)(t,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?(0,i.bM)(t,s.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,l.q)((0,i.bM)(t,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?(0,i.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,l.q)((0,i.bM)(t,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,i.bM)(t,s.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,l.q)((0,i.bM)(t,s.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},p=(0,i.fn)("Icon"),f=o.forwardRef((e,t)=>{let{icon:r,variant:s="simple",tooltip:f,size:h=c.u8.SM,color:b,className:v}=e,y=(0,n._T)(e,["icon","variant","tooltip","size","color","className"]),k=g(s,b),{tooltipProps:w,getReferenceProps:x}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,i.lq)([t,w.refs.setReference]),className:(0,l.q)(p("root"),"inline-flex shrink-0 items-center justify-center",k.bgColor,k.textColor,k.borderColor,k.ringColor,m[s].rounded,m[s].border,m[s].shadow,m[s].ring,d[h].paddingX,d[h].paddingY,v)},x,y),o.createElement(a.Z,Object.assign({text:f},w)),o.createElement(r,{className:(0,l.q)(p("icon"),"shrink-0",u[h].height,u[h].width)}))});f.displayName="Icon"},67101:function(e,t,r){r.d(t,{Z:function(){return d}});var n=r(5853),o=r(13241),a=r(1153),c=r(2265),l=r(9496);let i=(0,a.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",d=c.forwardRef((e,t)=>{let{numItems:r=1,numItemsSm:a,numItemsMd:d,numItemsLg:u,children:m,className:g}=e,p=(0,n._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=s(r,l._m),h=s(a,l.LH),b=s(d,l.l5),v=s(u,l.N4),y=(0,o.q)(f,h,b,v);return c.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),"grid",y,g)},p),m)});d.displayName="Grid"},9496:function(e,t,r){r.d(t,{LH:function(){return o},N4:function(){return c},PT:function(){return l},SP:function(){return i},VS:function(){return s},_m:function(){return n},_w:function(){return d},l5:function(){return a}});let n={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},o={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},a={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},c={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},l={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},i={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},s={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},d={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"}},84264:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(26898),o=r(13241),a=r(1153),c=r(2265);let l=c.forwardRef((e,t)=>{let{color:r,className:l,children:i}=e;return c.createElement("p",{ref:t,className:(0,o.q)("text-tremor-default",r?(0,a.bM)(r,n.K.text).textColor:(0,o.q)("text-tremor-content","dark:text-dark-tremor-content"),l)},i)});l.displayName="Text"},96761:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(5853),o=r(26898),a=r(13241),c=r(1153),l=r(2265);let i=l.forwardRef((e,t)=>{let{color:r,children:i,className:s}=e,d=(0,n._T)(e,["color","children","className"]);return l.createElement("p",Object.assign({ref:t,className:(0,a.q)("font-medium text-tremor-title",r?(0,c.bM)(r,o.K.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",s)},d),i)});i.displayName="Title"},78380:function(e,t,r){function n(e){return["small","middle","large"].includes(e)}function o(e){return!!e&&"number"==typeof e&&!Number.isNaN(e)}r.d(t,{T:function(){return o},n:function(){return n}})},69410:function(e,t,r){var n=r(54998);t.Z=n.Z},47451:function(e,t,r){var n=r(77774);t.Z=n.Z},55590:function(e,t,r){r.d(t,{Z:function(){return O}});var n=r(2265),o=r(36760),a=r.n(o),c=r(45287),l=r(78380),i=r(71744),s=r(77685),d=r(17691),u=r(99320);let m=e=>{let{componentCls:t,borderRadius:r,paddingSM:n,colorBorder:o,paddingXS:a,fontSizeLG:c,fontSizeSM:l,borderRadiusLG:i,borderRadiusSM:s,colorBgContainerDisabled:u,lineWidth:m}=e;return{[t]:[{display:"inline-flex",alignItems:"center",gap:0,paddingInline:n,margin:0,background:u,borderWidth:m,borderStyle:"solid",borderColor:o,borderRadius:r,"&-large":{fontSize:c,borderRadius:i},"&-small":{paddingInline:a,borderRadius:s,fontSize:l},"&-compact-last-item":{borderEndStartRadius:0,borderStartStartRadius:0},"&-compact-first-item":{borderEndEndRadius:0,borderStartEndRadius:0},"&-compact-item:not(:first-child):not(:last-child)":{borderRadius:0},"&-compact-item:not(:last-child)":{borderInlineEndWidth:0}},(0,d.c)(e,{focus:!1})]}};var g=(0,u.I$)(["Space","Addon"],e=>[m(e)]),p=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let f=n.forwardRef((e,t)=>{let{className:r,children:o,style:c,prefixCls:l}=e,d=p(e,["className","children","style","prefixCls"]),{getPrefixCls:u,direction:m}=n.useContext(i.E_),f=u("space-addon",l),[h,b,v]=g(f),{compactItemClassnames:y,compactSize:k}=(0,s.ri)(f,m),w=a()(f,b,y,v,{["".concat(f,"-").concat(k)]:k},r);return h(n.createElement("div",Object.assign({ref:t,className:w,style:c},d),o))}),h=n.createContext({latestIndex:0}),b=h.Provider;var v=e=>{let{className:t,index:r,children:o,split:a,style:c}=e,{latestIndex:l}=n.useContext(h);return null==o?null:n.createElement(n.Fragment,null,n.createElement("div",{className:t,style:c},o),r{let{componentCls:t,antCls:r}=e;return{[t]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},["".concat(t,"-item:empty")]:{display:"none"},["".concat(t,"-item > ").concat(r,"-badge-not-a-wrapper:only-child")]:{display:"block"}}}},w=e=>{let{componentCls:t}=e;return{[t]:{"&-gap-row-small":{rowGap:e.spaceGapSmallSize},"&-gap-row-middle":{rowGap:e.spaceGapMiddleSize},"&-gap-row-large":{rowGap:e.spaceGapLargeSize},"&-gap-col-small":{columnGap:e.spaceGapSmallSize},"&-gap-col-middle":{columnGap:e.spaceGapMiddleSize},"&-gap-col-large":{columnGap:e.spaceGapLargeSize}}}};var x=(0,u.I$)("Space",e=>{let t=(0,y.IX)(e,{spaceGapSmallSize:e.paddingXS,spaceGapMiddleSize:e.padding,spaceGapLargeSize:e.paddingLG});return[k(t),w(t)]},()=>({}),{resetStyle:!1}),C=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let M=n.forwardRef((e,t)=>{var r;let{getPrefixCls:o,direction:s,size:d,className:u,style:m,classNames:g,styles:p}=(0,i.dj)("space"),{size:f=null!=d?d:"small",align:h,className:y,rootClassName:k,children:w,direction:M="horizontal",prefixCls:O,split:Z,style:E,wrap:S=!1,classNames:z,styles:j}=e,N=C(e,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[R,L]=Array.isArray(f)?f:[f,f],I=(0,l.n)(L),B=(0,l.n)(R),P=(0,l.T)(L),H=(0,l.T)(R),q=(0,c.Z)(w,{keepEmpty:!0}),A=void 0===h&&"horizontal"===M?"center":h,V=o("space",O),[T,G,K]=x(V),W=a()(V,u,G,"".concat(V,"-").concat(M),{["".concat(V,"-rtl")]:"rtl"===s,["".concat(V,"-align-").concat(A)]:A,["".concat(V,"-gap-row-").concat(L)]:I,["".concat(V,"-gap-col-").concat(R)]:B},y,k,K),_=a()("".concat(V,"-item"),null!==(r=null==z?void 0:z.item)&&void 0!==r?r:g.item),X=Object.assign(Object.assign({},p.item),null==j?void 0:j.item),Y=q.map((e,t)=>{let r=(null==e?void 0:e.key)||"".concat(_,"-").concat(t);return n.createElement(v,{className:_,key:r,index:t,split:Z,style:X},e)}),U=n.useMemo(()=>({latestIndex:q.reduce((e,t,r)=>null!=t?r:e,0)}),[q]);if(0===q.length)return null;let D={};return S&&(D.flexWrap="wrap"),!B&&H&&(D.columnGap=R),!I&&P&&(D.rowGap=L),T(n.createElement("div",Object.assign({ref:t,className:W,style:Object.assign(Object.assign(Object.assign({},D),m),E)},N),n.createElement(b,{value:U},Y)))});M.Compact=s.ZP,M.Addon=f;var O=M},3810:function(e,t,r){r.d(t,{Z:function(){return j}});var n=r(2265),o=r(36760),a=r.n(o),c=r(18694),l=r(93350),i=r(53445),s=r(19722),d=r(6694),u=r(71744),m=r(93463),g=r(54558),p=r(12918),f=r(71140),h=r(99320);let b=e=>{let{paddingXXS:t,lineWidth:r,tagPaddingHorizontal:n,componentCls:o,calc:a}=e,c=a(n).sub(r).equal(),l=a(t).sub(r).equal();return{[o]:Object.assign(Object.assign({},(0,p.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:c,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:"".concat((0,m.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,opacity:1,transition:"all ".concat(e.motionDurationMid),textAlign:"start",position:"relative",["&".concat(o,"-rtl")]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},["".concat(o,"-close-icon")]:{marginInlineStart:l,fontSize:e.tagIconSize,color:e.colorIcon,cursor:"pointer",transition:"all ".concat(e.motionDurationMid),"&:hover":{color:e.colorTextHeading}},["&".concat(o,"-has-color")]:{borderColor:"transparent",["&, a, a:hover, ".concat(e.iconCls,"-close, ").concat(e.iconCls,"-close:hover")]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",["&:not(".concat(o,"-checkable-checked):hover")]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},["> ".concat(e.iconCls," + span, > span + ").concat(e.iconCls)]:{marginInlineStart:c}}),["".concat(o,"-borderless")]:{borderColor:"transparent",background:e.tagBorderlessBg}}},v=e=>{let{lineWidth:t,fontSizeIcon:r,calc:n}=e,o=e.fontSizeSM;return(0,f.IX)(e,{tagFontSize:o,tagLineHeight:(0,m.bf)(n(e.lineHeightSM).mul(o).equal()),tagIconSize:n(r).sub(n(t).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},y=e=>({defaultBg:new g.t(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText});var k=(0,h.I$)("Tag",e=>b(v(e)),y),w=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let x=n.forwardRef((e,t)=>{let{prefixCls:r,style:o,className:c,checked:l,children:i,icon:s,onChange:d,onClick:m}=e,g=w(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:p,tag:f}=n.useContext(u.E_),h=p("tag",r),[b,v,y]=k(h),x=a()(h,"".concat(h,"-checkable"),{["".concat(h,"-checkable-checked")]:l},null==f?void 0:f.className,c,v,y);return b(n.createElement("span",Object.assign({},g,{ref:t,style:Object.assign(Object.assign({},o),null==f?void 0:f.style),className:x,onClick:e=>{null==d||d(!l),null==m||m(e)}}),s,n.createElement("span",null,i)))});var C=r(18536);let M=e=>(0,C.Z)(e,(t,r)=>{let{textColor:n,lightBorderColor:o,lightColor:a,darkColor:c}=r;return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(t)]:{color:n,background:a,borderColor:o,"&-inverse":{color:e.colorTextLightSolid,background:c,borderColor:c},["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}});var O=(0,h.bk)(["Tag","preset"],e=>M(v(e)),y);let Z=(e,t,r)=>{let n="string"!=typeof r?r:r.charAt(0).toUpperCase()+r.slice(1);return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(t)]:{color:e["color".concat(r)],background:e["color".concat(n,"Bg")],borderColor:e["color".concat(n,"Border")],["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}};var E=(0,h.bk)(["Tag","status"],e=>{let t=v(e);return[Z(t,"success","Success"),Z(t,"processing","Info"),Z(t,"error","Error"),Z(t,"warning","Warning")]},y),S=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let z=n.forwardRef((e,t)=>{let{prefixCls:r,className:o,rootClassName:m,style:g,children:p,icon:f,color:h,onClose:b,bordered:v=!0,visible:y}=e,w=S(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:x,direction:C,tag:M}=n.useContext(u.E_),[Z,z]=n.useState(!0),j=(0,c.Z)(w,["closeIcon","closable"]);n.useEffect(()=>{void 0!==y&&z(y)},[y]);let N=(0,l.o2)(h),R=(0,l.yT)(h),L=N||R,I=Object.assign(Object.assign({backgroundColor:h&&!L?h:void 0},null==M?void 0:M.style),g),B=x("tag",r),[P,H,q]=k(B),A=a()(B,null==M?void 0:M.className,{["".concat(B,"-").concat(h)]:L,["".concat(B,"-has-color")]:h&&!L,["".concat(B,"-hidden")]:!Z,["".concat(B,"-rtl")]:"rtl"===C,["".concat(B,"-borderless")]:!v},o,m,H,q),V=e=>{e.stopPropagation(),null==b||b(e),e.defaultPrevented||z(!1)},[,T]=(0,i.b)((0,i.w)(e),(0,i.w)(M),{closable:!1,closeIconRender:e=>{let t=n.createElement("span",{className:"".concat(B,"-close-icon"),onClick:V},e);return(0,s.wm)(e,t,e=>({onClick:t=>{var r;null===(r=null==e?void 0:e.onClick)||void 0===r||r.call(e,t),V(t)},className:a()(null==e?void 0:e.className,"".concat(B,"-close-icon"))}))}}),G="function"==typeof w.onClick||p&&"a"===p.type,K=f||null,W=K?n.createElement(n.Fragment,null,K,p&&n.createElement("span",null,p)):p,_=n.createElement("span",Object.assign({},j,{ref:t,className:A,style:I}),W,T,N&&n.createElement(O,{key:"preset",prefixCls:B}),R&&n.createElement(E,{key:"status",prefixCls:B}));return P(G?n.createElement(d.Z,{component:"Tag"},_):_)});z.CheckableTag=x;var j=z},79205:function(e,t,r){r.d(t,{Z:function(){return u}});var n=r(2265);let o=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),c=e=>{let t=a(e);return t.charAt(0).toUpperCase()+t.slice(1)},l=function(){for(var e=arguments.length,t=Array(e),r=0;r!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()},i=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var s={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let d=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:o=24,strokeWidth:a=2,absoluteStrokeWidth:c,className:d="",children:u,iconNode:m,...g}=e;return(0,n.createElement)("svg",{ref:t,...s,width:o,height:o,stroke:r,strokeWidth:c?24*Number(a)/Number(o):a,className:l("lucide",d),...!u&&!i(g)&&{"aria-hidden":"true"},...g},[...m.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(u)?u:[u]])}),u=(e,t)=>{let r=(0,n.forwardRef)((r,a)=>{let{className:i,...s}=r;return(0,n.createElement)(d,{ref:a,iconNode:t,className:l("lucide-".concat(o(c(e))),"lucide-".concat(e),i),...s})});return r.displayName=c(e),r}},30401:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},64935:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]])},78867:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},96362:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},29202:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},54001:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},96137:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},80221:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]])},11239:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},10900:function(e,t,r){var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=o},71437:function(e,t,r){var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"}))});t.Z=o},82376:function(e,t,r){var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"}))});t.Z=o},53410:function(e,t,r){var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"}))});t.Z=o},74998:function(e,t,r){var n=r(2265);let o=n.forwardRef(function(e,t){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"}))});t.Z=o},21770:function(e,t,r){r.d(t,{D:function(){return d}});var n=r(2265),o=r(2894),a=r(18238),c=r(24112),l=r(45345),i=class extends c.l{#e;#t=void 0;#r;#n;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#o()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,l.VS)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,l.Ym)(t.mutationKey)!==(0,l.Ym)(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(e){this.#o(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#o(),this.#a()}mutate(e,t){return this.#n=t,this.#r?.removeObserver(this),this.#r=this.#e.getMutationCache().build(this.#e,this.options),this.#r.addObserver(this),this.#r.execute(e)}#o(){let e=this.#r?.state??(0,o.R)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#a(e){a.Vr.batch(()=>{if(this.#n&&this.hasListeners()){let t=this.#t.variables,r=this.#t.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type==="success"?(this.#n.onSuccess?.(e.data,t,r,n),this.#n.onSettled?.(e.data,null,t,r,n)):e?.type==="error"&&(this.#n.onError?.(e.error,t,r,n),this.#n.onSettled?.(void 0,e.error,t,r,n))}this.listeners.forEach(e=>{e(this.#t)})})}},s=r(29827);function d(e,t){let r=(0,s.NL)(t),[o]=n.useState(()=>new i(r,e));n.useEffect(()=>{o.setOptions(e)},[o,e]);let c=n.useSyncExternalStore(n.useCallback(e=>o.subscribe(a.Vr.batchCalls(e)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),d=n.useCallback((e,t)=>{o.mutate(e,t).catch(l.ZT)},[o]);if(c.error&&(0,l.L3)(o.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:d,mutateAsync:c.mutate}}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1208-c73262bafe09e8d7.js b/litellm/proxy/_experimental/out/_next/static/chunks/1208-c73262bafe09e8d7.js deleted file mode 100644 index a3fc56c6794..00000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1208-c73262bafe09e8d7.js +++ /dev/null @@ -1,8 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1208],{96434:function(e){!function(){var t={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],s=t[1];return(r+s)*3/4-s},t.toByteArray=function(e){var t,r,i=l(e),a=i[0],o=i[1],u=new n((a+o)*3/4-o),c=0,h=o>0?a-4:a;for(r=0;r>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===o&&(t=s[e.charCodeAt(r)]<<2|s[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===o&&(t=s[e.charCodeAt(r)]<<10|s[e.charCodeAt(r+1)]<<4|s[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,s=e.length,n=s%3,i=[],a=0,o=s-n;a>18&63]+r[n>>12&63]+r[n>>6&63]+r[63&n]);return i.join("")}(e,a,a+16383>o?o:a+16383));return 1===n?i.push(r[(t=e[s-1])>>2]+r[t<<4&63]+"=="):2===n&&i.push(r[(t=(e[s-2]<<8)+e[s-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),i.join("")};for(var r=[],s=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=i.length;a0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var s=r===t?0:4-r%4;return[r,s]}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},72:function(e,t,r){"use strict";var s=r(675),n=r(783),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!o.isEncoding(t))throw TypeError("Unknown encoding: "+t);var r=0|d(e,t),s=a(r),n=s.write(e,t);return n!==r&&(s=s.slice(0,n)),s}(e,t);if(ArrayBuffer.isView(e))return h(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if($(e,ArrayBuffer)||e&&$(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&($(e,SharedArrayBuffer)||e&&$(e.buffer,SharedArrayBuffer)))return function(e,t,r){var s;if(t<0||e.byteLength=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function d(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||$(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,s=arguments.length>2&&!0===arguments[2];if(!s&&0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return E(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return R(e).length;default:if(n)return s?-1:E(e).length;t=(""+t).toLowerCase(),n=!0}}function p(e,t,r){var n,i,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var s=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>s)&&(r=s);for(var n="",i=t;i2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(i=r=+r)!=i&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return -1;r=e.length-1}else if(r<0){if(!n)return -1;r=0}if("string"==typeof t&&(t=o.from(t,s)),o.isBuffer(t))return 0===t.length?-1:y(e,t,r,s,n);if("number"==typeof t)return(t&=255,"function"==typeof Uint8Array.prototype.indexOf)?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,s,n);throw TypeError("val must be string, number or Buffer")}function y(e,t,r,s,n){var i,a=1,o=e.length,l=t.length;if(void 0!==s&&("ucs2"===(s=String(s).toLowerCase())||"ucs-2"===s||"utf16le"===s||"utf-16le"===s)){if(e.length<2||t.length<2)return -1;a=2,o/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){var c=-1;for(i=r;io&&(r=o-l),i=r;i>=0;i--){for(var h=!0,f=0;f239?4:u>223?3:u>191?2:1;if(n+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:(192&(i=e[n+1]))==128&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[n+1],a=e[n+2],(192&i)==128&&(192&a)==128&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[n+1],a=e[n+2],o=e[n+3],(192&i)==128&&(192&a)==128&&(192&o)==128&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,s.push(c>>>10&1023|55296),c=56320|1023&c),s.push(c),n+=h}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",s=0;sr)throw RangeError("Trying to access beyond buffer length")}function _(e,t,r,s,n,i){if(!o.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>n||te.length)throw RangeError("Index out of range")}function v(e,t,r,s,n,i){if(r+s>e.length||r<0)throw RangeError("Index out of range")}function x(e,t,r,s,i){return t=+t,r>>>=0,i||v(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,s,23,4),r+4}function A(e,t,r,s,i){return t=+t,r>>>=0,i||v(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,s,52,8),r+8}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=2147483647,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(u(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if($(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),$(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,s=t.length,n=0,i=Math.min(r,s);nr&&(e+=" ... "),""},i&&(o.prototype[i]=o.prototype.inspect),o.prototype.compare=function(e,t,r,s,n){if($(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===s&&(s=0),void 0===n&&(n=this.length),t<0||r>e.length||s<0||n>this.length)throw RangeError("out of range index");if(s>=n&&t>=r)return 0;if(s>=n)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,s>>>=0,n>>>=0,this===e)return 0;for(var i=n-s,a=r-t,l=Math.min(i,a),u=this.slice(s,n),c=e.slice(t,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===s&&(s="utf8")):(s=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var n,i,a,o,l,u,c,h,f,d,p,m,g=this.length-t;if((void 0===r||r>g)&&(r=g),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");s||(s="utf8");for(var y=!1;;)switch(s){case"hex":return function(e,t,r,s){r=Number(r)||0;var n=e.length-r;s?(s=Number(s))>n&&(s=n):s=n;var i=t.length;s>i/2&&(s=i/2);for(var a=0;a>8,n.push(r%256),n.push(s);return n}(e,this.length-p),this,p,m);default:if(y)throw TypeError("Unknown encoding: "+s);s=(""+s).toLowerCase(),y=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||b(e,t,this.length);for(var s=this[e],n=1,i=0;++i>>=0,t>>>=0,r||b(e,t,this.length);for(var s=this[e+--t],n=1;t>0&&(n*=256);)s+=this[e+--t]*n;return s},o.prototype.readUInt8=function(e,t){return e>>>=0,t||b(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||b(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var s=this[e],n=1,i=0;++i=(n*=128)&&(s-=Math.pow(2,8*t)),s},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||b(e,t,this.length);for(var s=t,n=1,i=this[e+--s];s>0&&(n*=256);)i+=this[e+--s]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},o.prototype.readInt8=function(e,t){return(e>>>=0,t||b(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||b(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||b(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||b(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||b(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||b(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||b(e,8,this.length),n.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,s){if(e=+e,t>>>=0,r>>>=0,!s){var n=Math.pow(2,8*r)-1;_(this,e,t,r,n,0)}var i=1,a=0;for(this[t]=255&e;++a>>=0,r>>>=0,!s){var n=Math.pow(2,8*r)-1;_(this,e,t,r,n,0)}var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,r,s){if(e=+e,t>>>=0,!s){var n=Math.pow(2,8*r-1);_(this,e,t,r,n-1,-n)}var i=0,a=1,o=0;for(this[t]=255&e;++i>0)-o&255;return t+r},o.prototype.writeIntBE=function(e,t,r,s){if(e=+e,t>>>=0,!s){var n=Math.pow(2,8*r-1);_(this,e,t,r,n-1,-n)}var i=r-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||_(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return A(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return A(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,s){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),s||0===s||(s=this.length),t>=e.length&&(t=e.length),t||(t=0),s>0&&s=this.length)throw RangeError("Index out of range");if(s<0)throw RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,s),t);return n},o.prototype.fill=function(e,t,r,s){if("string"==typeof e){if("string"==typeof t?(s=t,t=0,r=this.length):"string"==typeof r&&(s=r,r=this.length),void 0!==s&&"string"!=typeof s)throw TypeError("encoding must be a string");if("string"==typeof s&&!o.isEncoding(s))throw TypeError("Unknown encoding: "+s);if(1===e.length){var n,i=e.charCodeAt(0);("utf8"===s&&i<128||"latin1"===s)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n55295&&r<57344){if(!n){if(r>56319||a+1===s){(t-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return i}function I(e){for(var t=[],r=0;r=t.length)&&!(n>=e.length);++n)t[n+r]=e[n];return n}function $(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var O=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var s=16*r,n=0;n<16;++n)t[s+n]=e[r]+e[n];return t}()},783:function(e,t){t.read=function(e,t,r,s,n){var i,a,o=8*n-s-1,l=(1<>1,c=-7,h=r?n-1:0,f=r?-1:1,d=e[t+h];for(h+=f,i=d&(1<<-c)-1,d>>=-c,c+=o;c>0;i=256*i+e[t+h],h+=f,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=s;c>0;a=256*a+e[t+h],h+=f,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,s),i-=u}return(d?-1:1)*a*Math.pow(2,i-s)},t.write=function(e,t,r,s,n,i){var a,o,l,u=8*i-n-1,c=(1<>1,f=23===n?5960464477539062e-23:0,d=s?0:i-1,p=s?1:-1,m=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(o=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+h>=1?t+=f/l:t+=f*Math.pow(2,1-h),t*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(t*l-1)*Math.pow(2,n),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,n),a=0));n>=8;e[r+d]=255&o,d+=p,o/=256,n-=8);for(a=a<0;e[r+d]=255&a,d+=p,a/=256,u-=8);e[r+d-p]|=128*m}}},r={};function s(e){var n=r[e];if(void 0!==n)return n.exports;var i=r[e]={exports:{}},a=!0;try{t[e](i,i.exports,s),a=!1}finally{a&&delete r[e]}return i.exports}s.ab="//";var n=s(72);e.exports=n}()},7271:function(e,t,r){"use strict";let s,n,i,a,o,l,u,c,h,f;r.d(t,{ZP:function(){return sO}});let d="RFC3986",p={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:e=>String(e)};Object.prototype.hasOwnProperty;let m=Array.isArray,g=(()=>{let e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})();function y(e,t){if(m(e)){let r=[];for(let s=0;sString(e)+"[]",comma:"comma",indices:(e,t)=>String(e)+"["+t+"]",repeat:e=>String(e)},_=Array.isArray,v=Array.prototype.push,x=function(e,t){v.apply(e,_(t)?t:[t])},A=Date.prototype.toISOString,S={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:(e,t,r,s,n)=>{if(0===e.length)return e;let i=e;if("symbol"==typeof e?i=Symbol.prototype.toString.call(e):"string"!=typeof e&&(i=String(e)),"iso-8859-1"===r)return escape(i).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});let a="";for(let e=0;e=1024?i.slice(e,e+1024):i,r=[];for(let e=0;e=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||"RFC1738"===n&&(40===s||41===s)){r[r.length]=t.charAt(e);continue}if(s<128){r[r.length]=g[s];continue}if(s<2048){r[r.length]=g[192|s>>6]+g[128|63&s];continue}if(s<55296||s>=57344){r[r.length]=g[224|s>>12]+g[128|s>>6&63]+g[128|63&s];continue}e+=1,s=65536+((1023&s)<<10|1023&t.charCodeAt(e)),r[r.length]=g[240|s>>18]+g[128|s>>12&63]+g[128|s>>6&63]+g[128|63&s]}a+=r.join("")}return a},encodeValuesOnly:!1,format:d,formatter:p[d],indices:!1,serializeDate:e=>A.call(e),skipNulls:!1,strictNullHandling:!1},E={},I="4.104.0",R=!1;class P{constructor(e){this.body=e}get[Symbol.toStringTag](){return"MultipartBody"}}let $=()=>{n||function(e,t={auto:!1}){if(R)throw Error(`you must \`import 'openai/shims/${e.kind}'\` before importing anything else from openai`);if(n)throw Error(`can't \`import 'openai/shims/${e.kind}'\` after \`import 'openai/shims/${n}'\``);R=t.auto,n=e.kind,i=e.fetch,e.Request,e.Response,e.Headers,a=e.FormData,e.Blob,o=e.File,l=e.ReadableStream,u=e.getMultipartRequestOptions,c=e.getDefaultAgent,h=e.fileFromPath,f=e.isFsReadStream}(function({manuallyImported:e}={}){let t,r,s,n;let i=e?"You may need to use polyfills":`Add one of these imports before your first \`import … from 'openai'\`: -- \`import 'openai/shims/node'\` (if you're running on Node) -- \`import 'openai/shims/web'\` (otherwise) -`;try{t=fetch,r=Request,s=Response,n=Headers}catch(e){throw Error(`this environment is missing the following Web Fetch API type: ${e.message}. ${i}`)}return{kind:"web",fetch:t,Request:r,Response:s,Headers:n,FormData:"undefined"!=typeof FormData?FormData:class{constructor(){throw Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${i}`)}},Blob:"undefined"!=typeof Blob?Blob:class{constructor(){throw Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${i}`)}},File:"undefined"!=typeof File?File:class{constructor(){throw Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${i}`)}},ReadableStream:"undefined"!=typeof ReadableStream?ReadableStream:class{constructor(){throw Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${i}`)}},getMultipartRequestOptions:async(e,t)=>({...t,body:new P(e)}),getDefaultAgent:e=>void 0,fileFromPath:()=>{throw Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads")},isFsReadStream:e=>!1}}(),{auto:!0})};$();class O extends Error{}class C extends O{constructor(e,t,r,s){super(`${C.makeMessage(e,t,r)}`),this.status=e,this.headers=s,this.request_id=s?.["x-request-id"],this.error=t,this.code=t?.code,this.param=t?.param,this.type=t?.type}static makeMessage(e,t,r){let s=t?.message?"string"==typeof t.message?t.message:JSON.stringify(t.message):t?JSON.stringify(t):r;return e&&s?`${e} ${s}`:e?`${e} status code (no body)`:s||"(no status code or body)"}static generate(e,t,r,s){if(!e||!s)return new T({message:r,cause:tj(t)});let n=t?.error;return 400===e?new M(e,n,r,s):401===e?new N(e,n,r,s):403===e?new j(e,n,r,s):404===e?new L(e,n,r,s):409===e?new U(e,n,r,s):422===e?new D(e,n,r,s):429===e?new F(e,n,r,s):e>=500?new W(e,n,r,s):new C(e,n,r,s)}}class k extends C{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class T extends C{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}}class B extends T{constructor({message:e}={}){super({message:e??"Request timed out."})}}class M extends C{}class N extends C{}class j extends C{}class L extends C{}class U extends C{}class D extends C{}class F extends C{}class W extends C{}class q extends O{constructor(){super("Could not parse response content as the length limit was reached")}}class X extends O{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}var J,H,V,K,z,Y,Q,G,Z,ee,et,er,es,en,ei,ea,eo,el,eu,ec,eh,ef,ed,ep,em,eg,ey,ew,eb,e_,ev,ex,eA,eS,eE,eI,eR,eP,e$,eO,eC,ek,eT,eB,eM,eN,ej,eL,eU,eD,eF,eW,eq,eX,eJ,eH,eV,eK,ez,eY,eQ,eG,eZ,e0,e1,e2=r(96434).Buffer,e6=function(e,t,r,s,n){if("m"===s)throw TypeError("Private method is not writable");if("a"===s&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},e8=function(e,t,r,s){if("a"===r&&!s)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};class e5{constructor(){J.set(this,void 0),this.buffer=new Uint8Array,e6(this,J,null,"f")}decode(e){let t;if(null==e)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):"string"==typeof e?new TextEncoder().encode(e):e,s=new Uint8Array(this.buffer.length+r.length);s.set(this.buffer),s.set(r,this.buffer.length),this.buffer=s;let n=[];for(;null!=(t=function(e,t){for(let r=t??0;r({next:()=>{if(0===s.length){let s=r.next();e.push(s),t.push(s)}return s.shift()}});return[new e3(()=>s(e),this.controller),new e3(()=>s(t),this.controller)]}toReadableStream(){let e;let t=this,r=new TextEncoder;return new l({async start(){e=t[Symbol.asyncIterator]()},async pull(t){try{let{value:s,done:n}=await e.next();if(n)return t.close();let i=r.encode(JSON.stringify(s)+"\n");t.enqueue(i)}catch(e){t.error(e)}},async cancel(){await e.return?.()}})}}async function*e9(e,t){if(!e.body)throw t.abort(),new O("Attempted to iterate over a response with no body");let r=new te,s=new e5;for await(let t of e7(e4(e.body)))for(let e of s.decode(t)){let t=r.decode(e);t&&(yield t)}for(let e of s.flush()){let t=r.decode(e);t&&(yield t)}}async function*e7(e){let t=new Uint8Array;for await(let r of e){let e;if(null==r)continue;let s=r instanceof ArrayBuffer?new Uint8Array(r):"string"==typeof r?new TextEncoder().encode(r):r,n=new Uint8Array(t.length+s.length);for(n.set(t),n.set(s,t.length),t=n;-1!==(e=function(e){for(let t=0;t0&&(yield t)}class te{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join("\n"),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],e}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,r,s]=function(e,t){let r=e.indexOf(":");return -1!==r?[e.substring(0,r),":",e.substring(r+t.length)]:[e,"",""]}(e,":");return s.startsWith(" ")&&(s=s.substring(1)),"event"===t?this.event=s:"data"===t&&this.data.push(s),null}}var tt=r(96434).Buffer;let tr=e=>null!=e&&"object"==typeof e&&"string"==typeof e.url&&"function"==typeof e.blob,ts=e=>null!=e&&"object"==typeof e&&"string"==typeof e.name&&"number"==typeof e.lastModified&&tn(e),tn=e=>null!=e&&"object"==typeof e&&"number"==typeof e.size&&"string"==typeof e.type&&"function"==typeof e.text&&"function"==typeof e.slice&&"function"==typeof e.arrayBuffer,ti=e=>ts(e)||tr(e)||f(e);async function ta(e,t,r){var s;if(ts(e=await e))return e;if(tr(e)){let s=await e.blob();t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()??"unknown_file");let n=tn(s)?[await s.arrayBuffer()]:[s];return new o(n,t,r)}let n=await to(e);if(t||(t=(tl((s=e).name)||tl(s.filename)||tl(s.path)?.split(/[\\/]/).pop())??"unknown_file"),!r?.type){let e=n[0]?.type;"string"==typeof e&&(r={...r,type:e})}return new o(n,t,r)}async function to(e){let t=[];if("string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(tn(e))t.push(await e.arrayBuffer());else if(tu(e))for await(let r of e)t.push(r);else throw Error(`Unexpected data type: ${typeof e}; constructor: ${e?.constructor?.name}; props: ${function(e){let t=Object.getOwnPropertyNames(e);return`[${t.map(e=>`"${e}"`).join(", ")}]`}(e)}`);return t}let tl=e=>"string"==typeof e?e:void 0!==tt&&e instanceof tt?String(e):void 0,tu=e=>null!=e&&"object"==typeof e&&"function"==typeof e[Symbol.asyncIterator],tc=e=>e&&"object"==typeof e&&e.body&&"MultipartBody"===e[Symbol.toStringTag],th=async e=>{let t=await tf(e.body);return u(t,e)},tf=async e=>{let t=new a;return await Promise.all(Object.entries(e||{}).map(([e,r])=>tp(t,e,r))),t},td=e=>{if(ti(e))return!0;if(Array.isArray(e))return e.some(td);if(e&&"object"==typeof e){for(let t in e)if(td(e[t]))return!0}return!1},tp=async(e,t,r)=>{if(void 0!==r){if(null==r)throw TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if("string"==typeof r||"number"==typeof r||"boolean"==typeof r)e.append(t,String(r));else if(ti(r)){let s=await ta(r);e.append(t,s)}else if(Array.isArray(r))await Promise.all(r.map(r=>tp(e,t+"[]",r)));else if("object"==typeof r)await Promise.all(Object.entries(r).map(([r,s])=>tp(e,`${t}[${r}]`,s)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var tm=r(96434).Buffer,tg=r(40257),ty=function(e,t,r,s,n){if("m"===s)throw TypeError("Private method is not writable");if("a"===s&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},tw=function(e,t,r,s){if("a"===r&&!s)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};async function tb(e){let{response:t}=e;if(e.options.stream)return(tq("response",t.status,t.url,t.headers,t.body),e.options.__streamClass)?e.options.__streamClass.fromSSEResponse(t,e.controller):e3.fromSSEResponse(t,e.controller);if(204===t.status)return null;if(e.options.__binaryResponse)return t;let r=t.headers.get("content-type"),s=r?.split(";")[0]?.trim();if(s?.includes("application/json")||s?.endsWith("+json")){let e=await t.json();return tq("response",t.status,t.url,t.headers,e),t_(e,t)}let n=await t.text();return tq("response",t.status,t.url,t.headers,n),n}function t_(e,t){return!e||"object"!=typeof e||Array.isArray(e)?e:Object.defineProperty(e,"_request_id",{value:t.headers.get("x-request-id"),enumerable:!1})}$();class tv extends Promise{constructor(e,t=tb){super(e=>{e(null)}),this.responsePromise=e,this.parseResponse=t}_thenUnwrap(e){return new tv(this.responsePromise,async t=>t_(e(await this.parseResponse(t),t),t.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t,request_id:t.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(this.parseResponse)),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}}class tx{constructor({baseURL:e,maxRetries:t=2,timeout:r=6e5,httpAgent:s,fetch:n}){this.baseURL=e,this.maxRetries=tN("maxRetries",t),this.timeout=tN("timeout",r),this.httpAgent=s,this.fetch=n??i}authHeaders(e){return{}}defaultHeaders(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...tC(),...this.authHeaders(e)}}validateHeaders(e,t){}defaultIdempotencyKey(){return`stainless-node-retry-${tX()}`}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,r){return this.request(Promise.resolve(r).then(async r=>{let s=r&&tn(r?.body)?new DataView(await r.body.arrayBuffer()):r?.body instanceof DataView?r.body:r?.body instanceof ArrayBuffer?new DataView(r.body):r&&ArrayBuffer.isView(r?.body)?new DataView(r.body.buffer):r?.body;return{method:e,path:t,...r,body:s}}))}getAPIList(e,t,r){return this.requestAPIList(t,{method:"get",path:e,...r})}calculateContentLength(e){if("string"==typeof e){if(void 0!==tm)return tm.byteLength(e,"utf8").toString();if("undefined"!=typeof TextEncoder)return new TextEncoder().encode(e).length.toString()}else if(ArrayBuffer.isView(e))return e.byteLength.toString();return null}buildRequest(e,{retryCount:t=0}={}){let r={...e},{method:s,path:n,query:i,headers:a={}}=r,o=ArrayBuffer.isView(r.body)||r.__binaryRequest&&"string"==typeof r.body?r.body:tc(r.body)?r.body.body:r.body?JSON.stringify(r.body,null,2):null,l=this.calculateContentLength(o),u=this.buildURL(n,i);"timeout"in r&&tN("timeout",r.timeout),r.timeout=r.timeout??this.timeout;let h=r.httpAgent??this.httpAgent??c(u),f=r.timeout+1e3;"number"==typeof h?.options?.timeout&&f>(h.options.timeout??0)&&(h.options.timeout=f),this.idempotencyHeader&&"get"!==s&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),a[this.idempotencyHeader]=e.idempotencyKey);let d=this.buildHeaders({options:r,headers:a,contentLength:l,retryCount:t});return{req:{method:s,...o&&{body:o},headers:d,...h&&{agent:h},signal:r.signal??null},url:u,timeout:r.timeout}}buildHeaders({options:e,headers:t,contentLength:r,retryCount:s}){let i={};r&&(i["content-length"]=r);let a=this.defaultHeaders(e);return tF(i,a),tF(i,t),tc(e.body)&&"node"!==n&&delete i["content-type"],void 0===tV(a,"x-stainless-retry-count")&&void 0===tV(t,"x-stainless-retry-count")&&(i["x-stainless-retry-count"]=String(s)),void 0===tV(a,"x-stainless-timeout")&&void 0===tV(t,"x-stainless-timeout")&&e.timeout&&(i["x-stainless-timeout"]=String(Math.trunc(e.timeout/1e3))),this.validateHeaders(i,t),i}async prepareOptions(e){}async prepareRequest(e,{url:t,options:r}){}parseHeaders(e){return e?Symbol.iterator in e?Object.fromEntries(Array.from(e).map(e=>[...e])):{...e}:{}}makeStatusError(e,t,r,s){return C.generate(e,t,r,s)}request(e,t=null){return new tv(this.makeRequest(e,t))}async makeRequest(e,t){let r=await e,s=r.maxRetries??this.maxRetries;null==t&&(t=s),await this.prepareOptions(r);let{req:n,url:i,timeout:a}=this.buildRequest(r,{retryCount:s-t});if(await this.prepareRequest(n,{url:i,options:r}),tq("request",i,r,n.headers),r.signal?.aborted)throw new k;let o=new AbortController,l=await this.fetchWithTimeout(i,n,a,o).catch(tj);if(l instanceof Error){if(r.signal?.aborted)throw new k;if(t)return this.retryRequest(r,t);if("AbortError"===l.name)throw new B;throw new T({cause:l})}let u=tE(l.headers);if(!l.ok){if(t&&this.shouldRetry(l)){let e=`retrying, ${t} attempts remaining`;return tq(`response (error; ${e})`,l.status,i,u),this.retryRequest(r,t,u)}let e=await l.text().catch(e=>tj(e).message),s=tk(e),n=s?void 0:e,a=t?"(error; no more retries left)":"(error; not retryable)";throw tq(`response (error; ${a})`,l.status,i,u,n),this.makeStatusError(l.status,s,n,u)}return{response:l,options:r,controller:o}}requestAPIList(e,t){return new tS(this,this.makeRequest(t,null),e)}buildURL(e,t){let r=new URL(tB(e)?e:this.baseURL+(this.baseURL.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery();return tU(s)||(t={...s,...t}),"object"==typeof t&&t&&!Array.isArray(t)&&(r.search=this.stringifyQuery(t)),r.toString()}stringifyQuery(e){return Object.entries(e).filter(([e,t])=>void 0!==t).map(([e,t])=>{if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(null===t)return`${encodeURIComponent(e)}=`;throw new O(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout(e,t,r,s){let{signal:n,...i}=t||{};n&&n.addEventListener("abort",()=>s.abort());let a=setTimeout(()=>s.abort(),r),o={signal:s.signal,...i};return o.method&&(o.method=o.method.toUpperCase()),this.fetch.call(void 0,e,o).finally(()=>{clearTimeout(a)})}shouldRetry(e){let t=e.headers.get("x-should-retry");return"true"===t||"false"!==t&&(408===e.status||409===e.status||429===e.status||e.status>=500)}async retryRequest(e,t,r){let s;let n=r?.["retry-after-ms"];if(n){let e=parseFloat(n);Number.isNaN(e)||(s=e)}let i=r?.["retry-after"];if(i&&!s){let e=parseFloat(i);s=Number.isNaN(e)?Date.parse(i)-Date.now():1e3*e}if(!(s&&0<=s&&s<6e4)){let r=e.maxRetries??this.maxRetries;s=this.calculateDefaultRetryTimeoutMillis(t,r)}return await tM(s),this.makeRequest(e,t-1)}calculateDefaultRetryTimeoutMillis(e,t){return Math.min(.5*Math.pow(2,t-e),8)*(1-.25*Math.random())*1e3}getUserAgent(){return`${this.constructor.name}/JS ${I}`}}class tA{constructor(e,t,r,s){H.set(this,void 0),ty(this,H,e,"f"),this.options=s,this.response=t,this.body=r}hasNextPage(){return!!this.getPaginatedItems().length&&null!=this.nextPageInfo()}async getNextPage(){let e=this.nextPageInfo();if(!e)throw new O("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let t={...this.options};if("params"in e&&"object"==typeof t.query)t.query={...t.query,...e.params};else if("url"in e){for(let[r,s]of[...Object.entries(t.query||{}),...e.url.searchParams.entries()])e.url.searchParams.set(r,s);t.query=void 0,t.path=e.url.toString()}return await tw(this,H,"f").requestAPIList(this.constructor,t)}async *iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async *[(H=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let t of e.getPaginatedItems())yield t}}class tS extends tv{constructor(e,t,r){super(t,async t=>new r(e,t.response,await tb(t),t.options))}async *[Symbol.asyncIterator](){for await(let e of(await this))yield e}}let tE=e=>new Proxy(Object.fromEntries(e.entries()),{get(e,t){let r=t.toString();return e[r.toLowerCase()]||e[r]}}),tI={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__metadata:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},tR=e=>"object"==typeof e&&null!==e&&!tU(e)&&Object.keys(e).every(e=>tD(tI,e)),tP=()=>{if("undefined"!=typeof Deno&&null!=Deno.build)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I,"X-Stainless-OS":tO(Deno.build.os),"X-Stainless-Arch":t$(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":"string"==typeof Deno.version?Deno.version:Deno.version?.deno??"unknown"};if("undefined"!=typeof EdgeRuntime)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":tg.version};if("[object process]"===Object.prototype.toString.call(void 0!==tg?tg:0))return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I,"X-Stainless-OS":tO(tg.platform),"X-Stainless-Arch":t$(tg.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":tg.version};let e=function(){if("undefined"==typeof navigator||!navigator)return null;for(let{key:e,pattern:t}of[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let r=t.exec(navigator.userAgent);if(r){let t=r[1]||0,s=r[2]||0,n=r[3]||0;return{browser:e,version:`${t}.${s}.${n}`}}}return null}();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":I,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},t$=e=>"x32"===e?"x32":"x86_64"===e||"x64"===e?"x64":"arm"===e?"arm":"aarch64"===e||"arm64"===e?"arm64":e?`other:${e}`:"unknown",tO=e=>(e=e.toLowerCase()).includes("ios")?"iOS":"android"===e?"Android":"darwin"===e?"MacOS":"win32"===e?"Windows":"freebsd"===e?"FreeBSD":"openbsd"===e?"OpenBSD":"linux"===e?"Linux":e?`Other:${e}`:"Unknown",tC=()=>s??(s=tP()),tk=e=>{try{return JSON.parse(e)}catch(e){return}},tT=/^[a-z][a-z0-9+.-]*:/i,tB=e=>tT.test(e),tM=e=>new Promise(t=>setTimeout(t,e)),tN=(e,t)=>{if("number"!=typeof t||!Number.isInteger(t))throw new O(`${e} must be an integer`);if(t<0)throw new O(`${e} must be a positive integer`);return t},tj=e=>{if(e instanceof Error)return e;if("object"==typeof e&&null!==e)try{return Error(JSON.stringify(e))}catch{}return Error(e)},tL=e=>void 0!==tg?tg.env?.[e]?.trim()??void 0:"undefined"!=typeof Deno?Deno.env?.get?.(e)?.trim():void 0;function tU(e){if(!e)return!0;for(let t in e)return!1;return!0}function tD(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function tF(e,t){for(let r in t){if(!tD(t,r))continue;let s=r.toLowerCase();if(!s)continue;let n=t[r];null===n?delete e[s]:void 0!==n&&(e[s]=n)}}let tW=new Set(["authorization","api-key"]);function tq(e,...t){void 0!==tg&&tg?.env?.DEBUG==="true"&&console.log(`OpenAI:DEBUG:${e}`,...t.map(e=>{if(!e)return e;if(e.headers){let t={...e,headers:{...e.headers}};for(let r in e.headers)tW.has(r.toLowerCase())&&(t.headers[r]="REDACTED");return t}let t=null;for(let r in e)tW.has(r.toLowerCase())&&(t??(t={...e}),t[r]="REDACTED");return t??e}))}let tX=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),tJ=()=>"undefined"!=typeof window&&void 0!==window.document&&"undefined"!=typeof navigator,tH=e=>"function"==typeof e?.get,tV=(e,t)=>{let r=t.toLowerCase();if(tH(e)){let s=t[0]?.toUpperCase()+t.substring(1).replace(/([^\w])(\w)/g,(e,t,r)=>t+r.toUpperCase());for(let n of[t,r,t.toUpperCase(),s]){let t=e.get(n);if(t)return t}}for(let[s,n]of Object.entries(e))if(s.toLowerCase()===r){if(Array.isArray(n)){if(n.length<=1)return n[0];return console.warn(`Received ${n.length} entries for the ${t} header, using the first entry.`),n[0]}return n}},tK=e=>{if(void 0!==tm){let t=tm.from(e,"base64");return Array.from(new Float32Array(t.buffer,t.byteOffset,t.length/Float32Array.BYTES_PER_ELEMENT))}{let t=atob(e),r=t.length,s=new Uint8Array(r);for(let e=0;e(e&&e.data&&e.data.forEach(e=>{let t=e.embedding;e.embedding=tK(t)}),e)))}}class t4 extends tY{create(e,t){return this._client.post("/files",th({body:e,...t}))}retrieve(e,t){return this._client.get(`/files/${e}`,t)}list(e={},t){return tR(e)?this.list({},e):this._client.getAPIList("/files",t3,{query:e,...t})}del(e,t){return this._client.delete(`/files/${e}`,t)}content(e,t){return this._client.get(`/files/${e}/content`,{...t,headers:{Accept:"application/binary",...t?.headers},__binaryResponse:!0})}retrieveContent(e,t){return this._client.get(`/files/${e}/content`,t)}async waitForProcessing(e,{pollInterval:t=5e3,maxWait:r=18e5}={}){let s=new Set(["processed","error","deleted"]),n=Date.now(),i=await this.retrieve(e);for(;!i.status||!s.has(i.status);)if(await tM(t),i=await this.retrieve(e),Date.now()-n>r)throw new B({message:`Giving up on waiting for file ${e} to finish processing after ${r} milliseconds.`});return i}}class t3 extends t0{}t4.FileObjectsPage=t3;class t9 extends tY{createVariation(e,t){return this._client.post("/images/variations",th({body:e,...t}))}edit(e,t){return this._client.post("/images/edits",th({body:e,...t}))}generate(e,t){return this._client.post("/images/generations",{body:e,...t})}}class t7 extends tY{create(e,t){return this._client.post("/audio/speech",{body:e,...t,headers:{Accept:"application/octet-stream",...t?.headers},__binaryResponse:!0})}}class re extends tY{create(e,t){return this._client.post("/audio/transcriptions",th({body:e,...t,stream:e.stream??!1,__metadata:{model:e.model}}))}}class rt extends tY{create(e,t){return this._client.post("/audio/translations",th({body:e,...t,__metadata:{model:e.model}}))}}class rr extends tY{constructor(){super(...arguments),this.transcriptions=new re(this._client),this.translations=new rt(this._client),this.speech=new t7(this._client)}}rr.Transcriptions=re,rr.Translations=rt,rr.Speech=t7;class rs extends tY{create(e,t){return this._client.post("/moderations",{body:e,...t})}}class rn extends tY{retrieve(e,t){return this._client.get(`/models/${e}`,t)}list(e){return this._client.getAPIList("/models",ri,e)}del(e,t){return this._client.delete(`/models/${e}`,t)}}class ri extends tZ{}rn.ModelsPage=ri;class ra extends tY{}class ro extends tY{run(e,t){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...t})}validate(e,t){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...t})}}class rl extends tY{constructor(){super(...arguments),this.graders=new ro(this._client)}}rl.Graders=ro;class ru extends tY{create(e,t,r){return this._client.getAPIList(`/fine_tuning/checkpoints/${e}/permissions`,rc,{body:t,method:"post",...r})}retrieve(e,t={},r){return tR(t)?this.retrieve(e,{},t):this._client.get(`/fine_tuning/checkpoints/${e}/permissions`,{query:t,...r})}del(e,t,r){return this._client.delete(`/fine_tuning/checkpoints/${e}/permissions/${t}`,r)}}class rc extends tZ{}ru.PermissionCreateResponsesPage=rc;class rh extends tY{constructor(){super(...arguments),this.permissions=new ru(this._client)}}rh.Permissions=ru,rh.PermissionCreateResponsesPage=rc;class rf extends tY{list(e,t={},r){return tR(t)?this.list(e,{},t):this._client.getAPIList(`/fine_tuning/jobs/${e}/checkpoints`,rd,{query:t,...r})}}class rd extends t0{}rf.FineTuningJobCheckpointsPage=rd;class rp extends tY{constructor(){super(...arguments),this.checkpoints=new rf(this._client)}create(e,t){return this._client.post("/fine_tuning/jobs",{body:e,...t})}retrieve(e,t){return this._client.get(`/fine_tuning/jobs/${e}`,t)}list(e={},t){return tR(e)?this.list({},e):this._client.getAPIList("/fine_tuning/jobs",rm,{query:e,...t})}cancel(e,t){return this._client.post(`/fine_tuning/jobs/${e}/cancel`,t)}listEvents(e,t={},r){return tR(t)?this.listEvents(e,{},t):this._client.getAPIList(`/fine_tuning/jobs/${e}/events`,rg,{query:t,...r})}pause(e,t){return this._client.post(`/fine_tuning/jobs/${e}/pause`,t)}resume(e,t){return this._client.post(`/fine_tuning/jobs/${e}/resume`,t)}}class rm extends t0{}class rg extends t0{}rp.FineTuningJobsPage=rm,rp.FineTuningJobEventsPage=rg,rp.Checkpoints=rf,rp.FineTuningJobCheckpointsPage=rd;class ry extends tY{constructor(){super(...arguments),this.methods=new ra(this._client),this.jobs=new rp(this._client),this.checkpoints=new rh(this._client),this.alpha=new rl(this._client)}}ry.Methods=ra,ry.Jobs=rp,ry.FineTuningJobsPage=rm,ry.FineTuningJobEventsPage=rg,ry.Checkpoints=rh,ry.Alpha=rl;class rw extends tY{}class rb extends tY{constructor(){super(...arguments),this.graderModels=new rw(this._client)}}rb.GraderModels=rw;let r_=async e=>{let t=await Promise.allSettled(e),r=t.filter(e=>"rejected"===e.status);if(r.length){for(let e of r)console.error(e.reason);throw Error(`${r.length} promise(s) failed - see the above errors`)}let s=[];for(let e of t)"fulfilled"===e.status&&s.push(e.value);return s};class rv extends tY{create(e,t,r){return this._client.post(`/vector_stores/${e}/files`,{body:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,t,r){return this._client.get(`/vector_stores/${e}/files/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,t,r,s){return this._client.post(`/vector_stores/${e}/files/${t}`,{body:r,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers}})}list(e,t={},r){return tR(t)?this.list(e,{},t):this._client.getAPIList(`/vector_stores/${e}/files`,rx,{query:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(e,t,r){return this._client.delete(`/vector_stores/${e}/files/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}async createAndPoll(e,t,r){let s=await this.create(e,t,r);return await this.poll(e,s.id,r)}async poll(e,t,r){let s={...r?.headers,"X-Stainless-Poll-Helper":"true"};for(r?.pollIntervalMs&&(s["X-Stainless-Custom-Poll-Interval"]=r.pollIntervalMs.toString());;){let n=await this.retrieve(e,t,{...r,headers:s}).withResponse(),i=n.data;switch(i.status){case"in_progress":let a=5e3;if(r?.pollIntervalMs)a=r.pollIntervalMs;else{let e=n.response.headers.get("openai-poll-after-ms");if(e){let t=parseInt(e);isNaN(t)||(a=t)}}await tM(a);break;case"failed":case"completed":return i}}}async upload(e,t,r){let s=await this._client.files.create({file:t,purpose:"assistants"},r);return this.create(e,{file_id:s.id},r)}async uploadAndPoll(e,t,r){let s=await this.upload(e,t,r);return await this.poll(e,s.id,r)}content(e,t,r){return this._client.getAPIList(`/vector_stores/${e}/files/${t}/content`,rA,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}class rx extends t0{}class rA extends tZ{}rv.VectorStoreFilesPage=rx,rv.FileContentResponsesPage=rA;class rS extends tY{create(e,t,r){return this._client.post(`/vector_stores/${e}/file_batches`,{body:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,t,r){return this._client.get(`/vector_stores/${e}/file_batches/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}cancel(e,t,r){return this._client.post(`/vector_stores/${e}/file_batches/${t}/cancel`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}async createAndPoll(e,t,r){let s=await this.create(e,t);return await this.poll(e,s.id,r)}listFiles(e,t,r={},s){return tR(r)?this.listFiles(e,t,{},r):this._client.getAPIList(`/vector_stores/${e}/file_batches/${t}/files`,rx,{query:r,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers}})}async poll(e,t,r){let s={...r?.headers,"X-Stainless-Poll-Helper":"true"};for(r?.pollIntervalMs&&(s["X-Stainless-Custom-Poll-Interval"]=r.pollIntervalMs.toString());;){let{data:n,response:i}=await this.retrieve(e,t,{...r,headers:s}).withResponse();switch(n.status){case"in_progress":let a=5e3;if(r?.pollIntervalMs)a=r.pollIntervalMs;else{let e=i.headers.get("openai-poll-after-ms");if(e){let t=parseInt(e);isNaN(t)||(a=t)}}await tM(a);break;case"failed":case"cancelled":case"completed":return n}}}async uploadAndPoll(e,{files:t,fileIds:r=[]},s){if(null==t||0==t.length)throw Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let n=Math.min(s?.maxConcurrency??5,t.length),i=this._client,a=t.values(),o=[...r];async function l(e){for(let t of e){let e=await i.files.create({file:t,purpose:"assistants"},s);o.push(e.id)}}let u=Array(n).fill(a).map(l);return await r_(u),await this.createAndPoll(e,{file_ids:o})}}class rE extends tY{constructor(){super(...arguments),this.files=new rv(this._client),this.fileBatches=new rS(this._client)}create(e,t){return this._client.post("/vector_stores",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}retrieve(e,t){return this._client.get(`/vector_stores/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}update(e,t,r){return this._client.post(`/vector_stores/${e}`,{body:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}list(e={},t){return tR(e)?this.list({},e):this._client.getAPIList("/vector_stores",rI,{query:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}del(e,t){return this._client.delete(`/vector_stores/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}search(e,t,r){return this._client.getAPIList(`/vector_stores/${e}/search`,rR,{body:t,method:"post",...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}class rI extends t0{}class rR extends tZ{}rE.VectorStoresPage=rI,rE.VectorStoreSearchResponsesPage=rR,rE.Files=rv,rE.VectorStoreFilesPage=rx,rE.FileContentResponsesPage=rA,rE.FileBatches=rS;class rP extends tY{create(e,t){return this._client.post("/assistants",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}retrieve(e,t){return this._client.get(`/assistants/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}update(e,t,r){return this._client.post(`/assistants/${e}`,{body:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}list(e={},t){return tR(e)?this.list({},e):this._client.getAPIList("/assistants",r$,{query:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}del(e,t){return this._client.delete(`/assistants/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}}class r$ extends t0{}function rO(e){return"function"==typeof e.parse}rP.AssistantsPage=r$;let rC=e=>e?.role==="assistant",rk=e=>e?.role==="function",rT=e=>e?.role==="tool";var rB=function(e,t,r,s,n){if("m"===s)throw TypeError("Private method is not writable");if("a"===s&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},rM=function(e,t,r,s){if("a"===r&&!s)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};class rN{constructor(){V.add(this),this.controller=new AbortController,K.set(this,void 0),z.set(this,()=>{}),Y.set(this,()=>{}),Q.set(this,void 0),G.set(this,()=>{}),Z.set(this,()=>{}),ee.set(this,{}),et.set(this,!1),er.set(this,!1),es.set(this,!1),en.set(this,!1),rB(this,K,new Promise((e,t)=>{rB(this,z,e,"f"),rB(this,Y,t,"f")}),"f"),rB(this,Q,new Promise((e,t)=>{rB(this,G,e,"f"),rB(this,Z,t,"f")}),"f"),rM(this,K,"f").catch(()=>{}),rM(this,Q,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},rM(this,V,"m",ei).bind(this))},0)}_connected(){this.ended||(rM(this,z,"f").call(this),this._emit("connect"))}get ended(){return rM(this,et,"f")}get errored(){return rM(this,er,"f")}get aborted(){return rM(this,es,"f")}abort(){this.controller.abort()}on(e,t){return(rM(this,ee,"f")[e]||(rM(this,ee,"f")[e]=[])).push({listener:t}),this}off(e,t){let r=rM(this,ee,"f")[e];if(!r)return this;let s=r.findIndex(e=>e.listener===t);return s>=0&&r.splice(s,1),this}once(e,t){return(rM(this,ee,"f")[e]||(rM(this,ee,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,r)=>{rB(this,en,!0,"f"),"error"!==e&&this.once("error",r),this.once(e,t)})}async done(){rB(this,en,!0,"f"),await rM(this,Q,"f")}_emit(e,...t){if(rM(this,et,"f"))return;"end"===e&&(rB(this,et,!0,"f"),rM(this,G,"f").call(this));let r=rM(this,ee,"f")[e];if(r&&(rM(this,ee,"f")[e]=r.filter(e=>!e.once),r.forEach(({listener:e})=>e(...t))),"abort"===e){let e=t[0];rM(this,en,"f")||r?.length||Promise.reject(e),rM(this,Y,"f").call(this,e),rM(this,Z,"f").call(this,e),this._emit("end");return}if("error"===e){let e=t[0];rM(this,en,"f")||r?.length||Promise.reject(e),rM(this,Y,"f").call(this,e),rM(this,Z,"f").call(this,e),this._emit("end")}}_emitFinal(){}}function rj(e){return e?.$brand==="auto-parseable-response-format"}function rL(e){return e?.$brand==="auto-parseable-tool"}function rU(e,t){let r=e.choices.map(e=>{var r;if("length"===e.finish_reason)throw new q;if("content_filter"===e.finish_reason)throw new X;return{...e,message:{...e.message,...e.message.tool_calls?{tool_calls:e.message.tool_calls?.map(e=>(function(e,t){let r=e.tools?.find(e=>e.function?.name===t.function.name);return{...t,function:{...t.function,parsed_arguments:rL(r)?r.$parseRaw(t.function.arguments):r?.function.strict?JSON.parse(t.function.arguments):null}}})(t,e))??void 0}:void 0,parsed:e.message.content&&!e.message.refusal?(r=e.message.content,t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(r):JSON.parse(r):null):null}}});return{...e,choices:r}}function rD(e){return!!rj(e.response_format)||(e.tools?.some(e=>rL(e)||"function"===e.type&&!0===e.function.strict)??!1)}K=new WeakMap,z=new WeakMap,Y=new WeakMap,Q=new WeakMap,G=new WeakMap,Z=new WeakMap,ee=new WeakMap,et=new WeakMap,er=new WeakMap,es=new WeakMap,en=new WeakMap,V=new WeakSet,ei=function(e){if(rB(this,er,!0,"f"),e instanceof Error&&"AbortError"===e.name&&(e=new k),e instanceof k)return rB(this,es,!0,"f"),this._emit("abort",e);if(e instanceof O)return this._emit("error",e);if(e instanceof Error){let t=new O(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new O(String(e)))};var rF=function(e,t,r,s){if("a"===r&&!s)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};class rW extends rN{constructor(){super(...arguments),ea.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let t=e.choices[0]?.message;return t&&this._addMessage(t),e}_addMessage(e,t=!0){if("content"in e||(e.content=null),this.messages.push(e),t){if(this._emit("message",e),(rk(e)||rT(e))&&e.content)this._emit("functionCallResult",e.content);else if(rC(e)&&e.function_call)this._emit("functionCall",e.function_call);else if(rC(e)&&e.tool_calls)for(let t of e.tool_calls)"function"===t.type&&this._emit("functionCall",t.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new O("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),rF(this,ea,"m",eo).call(this)}async finalMessage(){return await this.done(),rF(this,ea,"m",el).call(this)}async finalFunctionCall(){return await this.done(),rF(this,ea,"m",eu).call(this)}async finalFunctionCallResult(){return await this.done(),rF(this,ea,"m",ec).call(this)}async totalUsage(){return await this.done(),rF(this,ea,"m",eh).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let t=rF(this,ea,"m",el).call(this);t&&this._emit("finalMessage",t);let r=rF(this,ea,"m",eo).call(this);r&&this._emit("finalContent",r);let s=rF(this,ea,"m",eu).call(this);s&&this._emit("finalFunctionCall",s);let n=rF(this,ea,"m",ec).call(this);null!=n&&this._emit("finalFunctionCallResult",n),this._chatCompletions.some(e=>e.usage)&&this._emit("totalUsage",rF(this,ea,"m",eh).call(this))}async _createChatCompletion(e,t,r){let s=r?.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort())),rF(this,ea,"m",ef).call(this,t);let n=await e.chat.completions.create({...t,stream:!1},{...r,signal:this.controller.signal});return this._connected(),this._addChatCompletion(rU(n,t))}async _runChatCompletion(e,t,r){for(let e of t.messages)this._addMessage(e,!1);return await this._createChatCompletion(e,t,r)}async _runFunctions(e,t,r){let s="function",{function_call:n="auto",stream:i,...a}=t,o="string"!=typeof n&&n?.name,{maxChatCompletions:l=10}=r||{},u={};for(let e of t.functions)u[e.name||e.function.name]=e;let c=t.functions.map(e=>({name:e.name||e.function.name,parameters:e.parameters,description:e.description}));for(let e of t.messages)this._addMessage(e,!1);for(let t=0;tJSON.stringify(e.name)).join(", ")}. Please try again`;this._addMessage({role:s,name:h,content:e});continue}try{t=rO(d)?await d.parse(f):f}catch(e){this._addMessage({role:s,name:h,content:e instanceof Error?e.message:String(e)});continue}let p=await d.function(t,this),m=rF(this,ea,"m",ed).call(this,p);if(this._addMessage({role:s,name:h,content:m}),o)return}}async _runTools(e,t,r){let s="tool",{tool_choice:n="auto",stream:i,...a}=t,o="string"!=typeof n&&n?.function?.name,{maxChatCompletions:l=10}=r||{},u=t.tools.map(e=>{if(rL(e)){if(!e.$callback)throw new O("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:e.$callback,name:e.function.name,description:e.function.description||"",parameters:e.function.parameters,parse:e.$parseRaw,strict:!0}}}return e}),c={};for(let e of u)"function"===e.type&&(c[e.function.name||e.function.function.name]=e.function);let h="tools"in t?u.map(e=>"function"===e.type?{type:"function",function:{name:e.function.name||e.function.function.name,parameters:e.function.parameters,description:e.function.description,strict:e.function.strict}}:e):void 0;for(let e of t.messages)this._addMessage(e,!1);for(let t=0;tJSON.stringify(e)).join(", ")}. Please try again`;this._addMessage({role:s,tool_call_id:r,content:e});continue}try{t=rO(a)?await a.parse(i):i}catch(t){let e=t instanceof Error?t.message:String(t);this._addMessage({role:s,tool_call_id:r,content:e});continue}let l=await a.function(t,this),u=rF(this,ea,"m",ed).call(this,l);if(this._addMessage({role:s,tool_call_id:r,content:u}),o)return}}}}ea=new WeakSet,eo=function(){return rF(this,ea,"m",el).call(this).content??null},el=function(){let e=this.messages.length;for(;e-- >0;){let t=this.messages[e];if(rC(t)){let{function_call:e,...r}=t,s={...r,content:t.content??null,refusal:t.refusal??null};return e&&(s.function_call=e),s}}throw new O("stream ended without producing a ChatCompletionMessage with role=assistant")},eu=function(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(rC(t)&&t?.function_call)return t.function_call;if(rC(t)&&t?.tool_calls?.length)return t.tool_calls.at(-1)?.function}},ec=function(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(rk(t)&&null!=t.content||rT(t)&&null!=t.content&&"string"==typeof t.content&&this.messages.some(e=>"assistant"===e.role&&e.tool_calls?.some(e=>"function"===e.type&&e.id===t.tool_call_id)))return t.content}},eh=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:t}of this._chatCompletions)t&&(e.completion_tokens+=t.completion_tokens,e.prompt_tokens+=t.prompt_tokens,e.total_tokens+=t.total_tokens);return e},ef=function(e){if(null!=e.n&&e.n>1)throw new O("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},ed=function(e){return"string"==typeof e?e:void 0===e?"undefined":JSON.stringify(e)};class rq extends rW{static runFunctions(e,t,r){let s=new rq,n={...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return s._run(()=>s._runFunctions(e,t,n)),s}static runTools(e,t,r){let s=new rq,n={...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"runTools"}};return s._run(()=>s._runTools(e,t,n)),s}_addMessage(e,t=!0){super._addMessage(e,t),rC(e)&&e.content&&this._emit("content",e.content)}}let rX={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,ALL:511};class rJ extends Error{}class rH extends Error{}let rV=(e,t)=>{let r=e.length,s=0,n=e=>{throw new rJ(`${e} at position ${s}`)},i=e=>{throw new rH(`${e} at position ${s}`)},a=()=>(h(),s>=r&&n("Unexpected end of input"),'"'===e[s])?o():"{"===e[s]?l():"["===e[s]?u():"null"===e.substring(s,s+4)||rX.NULL&t&&r-s<4&&"null".startsWith(e.substring(s))?(s+=4,null):"true"===e.substring(s,s+4)||rX.BOOL&t&&r-s<4&&"true".startsWith(e.substring(s))?(s+=4,!0):"false"===e.substring(s,s+5)||rX.BOOL&t&&r-s<5&&"false".startsWith(e.substring(s))?(s+=5,!1):"Infinity"===e.substring(s,s+8)||rX.INFINITY&t&&r-s<8&&"Infinity".startsWith(e.substring(s))?(s+=8,1/0):"-Infinity"===e.substring(s,s+9)||rX.MINUS_INFINITY&t&&1{let a=s,o=!1;for(s++;s{s++,h();let i={};try{for(;"}"!==e[s];){if(h(),s>=r&&rX.OBJ&t)return i;let n=o();h(),s++;try{let e=a();Object.defineProperty(i,n,{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){if(rX.OBJ&t)return i;throw e}h(),","===e[s]&&s++}}catch(e){if(rX.OBJ&t)return i;n("Expected '}' at end of object")}return s++,i},u=()=>{s++;let r=[];try{for(;"]"!==e[s];)r.push(a()),h(),","===e[s]&&s++}catch(e){if(rX.ARR&t)return r;n("Expected ']' at end of array")}return s++,r},c=()=>{if(0===s){"-"===e&&rX.NUM&t&&n("Not sure what '-' is");try{return JSON.parse(e)}catch(r){if(rX.NUM&t)try{if("."===e[e.length-1])return JSON.parse(e.substring(0,e.lastIndexOf(".")));return JSON.parse(e.substring(0,e.lastIndexOf("e")))}catch(e){}i(String(r))}}let a=s;for("-"===e[s]&&s++;e[s]&&!",]}".includes(e[s]);)s++;s!=r||rX.NUM&t||n("Unterminated number literal");try{return JSON.parse(e.substring(a,s))}catch(r){"-"===e.substring(a,s)&&rX.NUM&t&&n("Not sure what '-' is");try{return JSON.parse(e.substring(a,e.lastIndexOf("e")))}catch(e){i(String(e))}}},h=()=>{for(;s(function(e,t=rX.ALL){if("string"!=typeof e)throw TypeError(`expecting str, got ${typeof e}`);if(!e.trim())throw Error(`${e} is empty`);return rV(e.trim(),t)})(e,rX.ALL^rX.NUM);var rz=function(e,t,r,s,n){if("m"===s)throw TypeError("Private method is not writable");if("a"===s&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},rY=function(e,t,r,s){if("a"===r&&!s)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};class rQ extends rW{constructor(e){super(),ep.add(this),em.set(this,void 0),eg.set(this,void 0),ey.set(this,void 0),rz(this,em,e,"f"),rz(this,eg,[],"f")}get currentChatCompletionSnapshot(){return rY(this,ey,"f")}static fromReadableStream(e){let t=new rQ(null);return t._run(()=>t._fromReadableStream(e)),t}static createChatCompletion(e,t,r){let s=new rQ(t);return s._run(()=>s._runChatCompletion(e,{...t,stream:!0},{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),s}async _createChatCompletion(e,t,r){super._createChatCompletion;let s=r?.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort())),rY(this,ep,"m",ew).call(this);let n=await e.chat.completions.create({...t,stream:!0},{...r,signal:this.controller.signal});for await(let e of(this._connected(),n))rY(this,ep,"m",e_).call(this,e);if(n.controller.signal?.aborted)throw new k;return this._addChatCompletion(rY(this,ep,"m",eA).call(this))}async _fromReadableStream(e,t){let r;let s=t?.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort())),rY(this,ep,"m",ew).call(this),this._connected();let n=e3.fromReadableStream(e,this.controller);for await(let e of n)r&&r!==e.id&&this._addChatCompletion(rY(this,ep,"m",eA).call(this)),rY(this,ep,"m",e_).call(this,e),r=e.id;if(n.controller.signal?.aborted)throw new k;return this._addChatCompletion(rY(this,ep,"m",eA).call(this))}[(em=new WeakMap,eg=new WeakMap,ey=new WeakMap,ep=new WeakSet,ew=function(){this.ended||rz(this,ey,void 0,"f")},eb=function(e){let t=rY(this,eg,"f")[e.index];return t||(t={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},rY(this,eg,"f")[e.index]=t),t},e_=function(e){if(this.ended)return;let t=rY(this,ep,"m",eE).call(this,e);for(let r of(this._emit("chunk",e,t),e.choices)){let e=t.choices[r.index];null!=r.delta.content&&e.message?.role==="assistant"&&e.message?.content&&(this._emit("content",r.delta.content,e.message.content),this._emit("content.delta",{delta:r.delta.content,snapshot:e.message.content,parsed:e.message.parsed})),null!=r.delta.refusal&&e.message?.role==="assistant"&&e.message?.refusal&&this._emit("refusal.delta",{delta:r.delta.refusal,snapshot:e.message.refusal}),r.logprobs?.content!=null&&e.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:r.logprobs?.content,snapshot:e.logprobs?.content??[]}),r.logprobs?.refusal!=null&&e.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:r.logprobs?.refusal,snapshot:e.logprobs?.refusal??[]});let s=rY(this,ep,"m",eb).call(this,e);for(let t of(e.finish_reason&&(rY(this,ep,"m",ex).call(this,e),null!=s.current_tool_call_index&&rY(this,ep,"m",ev).call(this,e,s.current_tool_call_index)),r.delta.tool_calls??[]))s.current_tool_call_index!==t.index&&(rY(this,ep,"m",ex).call(this,e),null!=s.current_tool_call_index&&rY(this,ep,"m",ev).call(this,e,s.current_tool_call_index)),s.current_tool_call_index=t.index;for(let t of r.delta.tool_calls??[]){let r=e.message.tool_calls?.[t.index];r?.type&&(r?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:r.function?.name,index:t.index,arguments:r.function.arguments,parsed_arguments:r.function.parsed_arguments,arguments_delta:t.function?.arguments??""}):r?.type)}}},ev=function(e,t){if(rY(this,ep,"m",eb).call(this,e).done_tool_calls.has(t))return;let r=e.message.tool_calls?.[t];if(!r)throw Error("no tool call snapshot");if(!r.type)throw Error("tool call snapshot missing `type`");if("function"===r.type){let e=rY(this,em,"f")?.tools?.find(e=>"function"===e.type&&e.function.name===r.function.name);this._emit("tool_calls.function.arguments.done",{name:r.function.name,index:t,arguments:r.function.arguments,parsed_arguments:rL(e)?e.$parseRaw(r.function.arguments):e?.function.strict?JSON.parse(r.function.arguments):null})}else r.type},ex=function(e){let t=rY(this,ep,"m",eb).call(this,e);if(e.message.content&&!t.content_done){t.content_done=!0;let r=rY(this,ep,"m",eS).call(this);this._emit("content.done",{content:e.message.content,parsed:r?r.$parseRaw(e.message.content):null})}e.message.refusal&&!t.refusal_done&&(t.refusal_done=!0,this._emit("refusal.done",{refusal:e.message.refusal})),e.logprobs?.content&&!t.logprobs_content_done&&(t.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:e.logprobs.content})),e.logprobs?.refusal&&!t.logprobs_refusal_done&&(t.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:e.logprobs.refusal}))},eA=function(){if(this.ended)throw new O("stream has ended, this shouldn't happen");let e=rY(this,ey,"f");if(!e)throw new O("request ended without sending any chunks");return rz(this,ey,void 0,"f"),rz(this,eg,[],"f"),function(e,t){var r;let{id:s,choices:n,created:i,model:a,system_fingerprint:o,...l}=e;return r={...l,id:s,choices:n.map(({message:t,finish_reason:r,index:s,logprobs:n,...i})=>{if(!r)throw new O(`missing finish_reason for choice ${s}`);let{content:a=null,function_call:o,tool_calls:l,...u}=t,c=t.role;if(!c)throw new O(`missing role for choice ${s}`);if(o){let{arguments:e,name:l}=o;if(null==e)throw new O(`missing function_call.arguments for choice ${s}`);if(!l)throw new O(`missing function_call.name for choice ${s}`);return{...i,message:{content:a,function_call:{arguments:e,name:l},role:c,refusal:t.refusal??null},finish_reason:r,index:s,logprobs:n}}return l?{...i,index:s,finish_reason:r,logprobs:n,message:{...u,role:c,content:a,refusal:t.refusal??null,tool_calls:l.map((t,r)=>{let{function:n,type:i,id:a,...o}=t,{arguments:l,name:u,...c}=n||{};if(null==a)throw new O(`missing choices[${s}].tool_calls[${r}].id -${rG(e)}`);if(null==i)throw new O(`missing choices[${s}].tool_calls[${r}].type -${rG(e)}`);if(null==u)throw new O(`missing choices[${s}].tool_calls[${r}].function.name -${rG(e)}`);if(null==l)throw new O(`missing choices[${s}].tool_calls[${r}].function.arguments -${rG(e)}`);return{...o,id:a,type:i,function:{...c,name:u,arguments:l}}})}}:{...i,message:{...u,content:a,role:c,refusal:t.refusal??null},finish_reason:r,index:s,logprobs:n}}),created:i,model:a,object:"chat.completion",...o?{system_fingerprint:o}:{}},t&&rD(t)?rU(r,t):{...r,choices:r.choices.map(e=>({...e,message:{...e.message,parsed:null,...e.message.tool_calls?{tool_calls:e.message.tool_calls}:void 0}}))}}(e,rY(this,em,"f"))},eS=function(){let e=rY(this,em,"f")?.response_format;return rj(e)?e:null},eE=function(e){var t,r,s,n;let i=rY(this,ey,"f"),{choices:a,...o}=e;for(let{delta:a,finish_reason:l,index:u,logprobs:c=null,...h}of(i?Object.assign(i,o):i=rz(this,ey,{...o,choices:[]},"f"),e.choices)){let e=i.choices[u];if(e||(e=i.choices[u]={finish_reason:l,index:u,message:{},logprobs:c,...h}),c){if(e.logprobs){let{content:s,refusal:n,...i}=c;Object.assign(e.logprobs,i),s&&((t=e.logprobs).content??(t.content=[]),e.logprobs.content.push(...s)),n&&((r=e.logprobs).refusal??(r.refusal=[]),e.logprobs.refusal.push(...n))}else e.logprobs=Object.assign({},c)}if(l&&(e.finish_reason=l,rY(this,em,"f")&&rD(rY(this,em,"f")))){if("length"===l)throw new q;if("content_filter"===l)throw new X}if(Object.assign(e,h),!a)continue;let{content:o,refusal:f,function_call:d,role:p,tool_calls:m,...g}=a;if(Object.assign(e.message,g),f&&(e.message.refusal=(e.message.refusal||"")+f),p&&(e.message.role=p),d&&(e.message.function_call?(d.name&&(e.message.function_call.name=d.name),d.arguments&&((s=e.message.function_call).arguments??(s.arguments=""),e.message.function_call.arguments+=d.arguments)):e.message.function_call=d),o&&(e.message.content=(e.message.content||"")+o,!e.message.refusal&&rY(this,ep,"m",eS).call(this)&&(e.message.parsed=rK(e.message.content))),m)for(let{index:t,id:r,type:s,function:i,...a}of(e.message.tool_calls||(e.message.tool_calls=[]),m)){let o=(n=e.message.tool_calls)[t]??(n[t]={});Object.assign(o,a),r&&(o.id=r),s&&(o.type=s),i&&(o.function??(o.function={name:i.name??"",arguments:""})),i?.name&&(o.function.name=i.name),i?.arguments&&(o.function.arguments+=i.arguments,function(e,t){if(!e)return!1;let r=e.tools?.find(e=>e.function?.name===t.function.name);return rL(r)||r?.function.strict||!1}(rY(this,em,"f"),o)&&(o.function.parsed_arguments=rK(o.function.arguments)))}}return i},Symbol.asyncIterator)](){let e=[],t=[],r=!1;return this.on("chunk",r=>{let s=t.shift();s?s.resolve(r):e.push(r)}),this.on("end",()=>{for(let e of(r=!0,t))e.resolve(void 0);t.length=0}),this.on("abort",e=>{for(let s of(r=!0,t))s.reject(e);t.length=0}),this.on("error",e=>{for(let s of(r=!0,t))s.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:r?{value:void 0,done:!0}:new Promise((e,r)=>t.push({resolve:e,reject:r})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new e3(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function rG(e){return JSON.stringify(e)}class rZ extends rQ{static fromReadableStream(e){let t=new rZ(null);return t._run(()=>t._fromReadableStream(e)),t}static runFunctions(e,t,r){let s=new rZ(null),n={...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"runFunctions"}};return s._run(()=>s._runFunctions(e,t,n)),s}static runTools(e,t,r){let s=new rZ(t),n={...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"runTools"}};return s._run(()=>s._runTools(e,t,n)),s}}class r0 extends tY{parse(e,t){return!function(e){for(let t of e??[]){if("function"!==t.type)throw new O(`Currently only \`function\` tool types support auto-parsing; Received \`${t.type}\``);if(!0!==t.function.strict)throw new O(`The \`${t.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}(e.tools),this._client.chat.completions.create(e,{...t,headers:{...t?.headers,"X-Stainless-Helper-Method":"beta.chat.completions.parse"}})._thenUnwrap(t=>rU(t,e))}runFunctions(e,t){return e.stream?rZ.runFunctions(this._client,e,t):rq.runFunctions(this._client,e,t)}runTools(e,t){return e.stream?rZ.runTools(this._client,e,t):rq.runTools(this._client,e,t)}stream(e,t){return rQ.createChatCompletion(this._client,e,t)}}class r1 extends tY{constructor(){super(...arguments),this.completions=new r0(this._client)}}(r1||(r1={})).Completions=r0;class r2 extends tY{create(e,t){return this._client.post("/realtime/sessions",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}}class r6 extends tY{create(e,t){return this._client.post("/realtime/transcription_sessions",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}}class r8 extends tY{constructor(){super(...arguments),this.sessions=new r2(this._client),this.transcriptionSessions=new r6(this._client)}}r8.Sessions=r2,r8.TranscriptionSessions=r6;var r5=function(e,t,r,s){if("a"===r&&!s)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)},r4=function(e,t,r,s,n){if("m"===s)throw TypeError("Private method is not writable");if("a"===s&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r};class r3 extends rN{constructor(){super(...arguments),eI.add(this),eR.set(this,[]),eP.set(this,{}),e$.set(this,{}),eO.set(this,void 0),eC.set(this,void 0),ek.set(this,void 0),eT.set(this,void 0),eB.set(this,void 0),eM.set(this,void 0),eN.set(this,void 0),ej.set(this,void 0),eL.set(this,void 0)}[(eR=new WeakMap,eP=new WeakMap,e$=new WeakMap,eO=new WeakMap,eC=new WeakMap,ek=new WeakMap,eT=new WeakMap,eB=new WeakMap,eM=new WeakMap,eN=new WeakMap,ej=new WeakMap,eL=new WeakMap,eI=new WeakSet,Symbol.asyncIterator)](){let e=[],t=[],r=!1;return this.on("event",r=>{let s=t.shift();s?s.resolve(r):e.push(r)}),this.on("end",()=>{for(let e of(r=!0,t))e.resolve(void 0);t.length=0}),this.on("abort",e=>{for(let s of(r=!0,t))s.reject(e);t.length=0}),this.on("error",e=>{for(let s of(r=!0,t))s.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:r?{value:void 0,done:!0}:new Promise((e,r)=>t.push({resolve:e,reject:r})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let t=new r3;return t._run(()=>t._fromReadableStream(e)),t}async _fromReadableStream(e,t){let r=t?.signal;r&&(r.aborted&&this.controller.abort(),r.addEventListener("abort",()=>this.controller.abort())),this._connected();let s=e3.fromReadableStream(e,this.controller);for await(let e of s)r5(this,eI,"m",eU).call(this,e);if(s.controller.signal?.aborted)throw new k;return this._addRun(r5(this,eI,"m",eD).call(this))}toReadableStream(){return new e3(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,t,r,s,n){let i=new r3;return i._run(()=>i._runToolAssistantStream(e,t,r,s,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),i}async _createToolAssistantStream(e,t,r,s,n){let i=n?.signal;i&&(i.aborted&&this.controller.abort(),i.addEventListener("abort",()=>this.controller.abort()));let a={...s,stream:!0},o=await e.submitToolOutputs(t,r,a,{...n,signal:this.controller.signal});for await(let e of(this._connected(),o))r5(this,eI,"m",eU).call(this,e);if(o.controller.signal?.aborted)throw new k;return this._addRun(r5(this,eI,"m",eD).call(this))}static createThreadAssistantStream(e,t,r){let s=new r3;return s._run(()=>s._threadAssistantStream(e,t,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),s}static createAssistantStream(e,t,r,s){let n=new r3;return n._run(()=>n._runAssistantStream(e,t,r,{...s,headers:{...s?.headers,"X-Stainless-Helper-Method":"stream"}})),n}currentEvent(){return r5(this,eN,"f")}currentRun(){return r5(this,ej,"f")}currentMessageSnapshot(){return r5(this,eO,"f")}currentRunStepSnapshot(){return r5(this,eL,"f")}async finalRunSteps(){return await this.done(),Object.values(r5(this,eP,"f"))}async finalMessages(){return await this.done(),Object.values(r5(this,e$,"f"))}async finalRun(){if(await this.done(),!r5(this,eC,"f"))throw Error("Final run was not received.");return r5(this,eC,"f")}async _createThreadAssistantStream(e,t,r){let s=r?.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort()));let n={...t,stream:!0},i=await e.createAndRun(n,{...r,signal:this.controller.signal});for await(let e of(this._connected(),i))r5(this,eI,"m",eU).call(this,e);if(i.controller.signal?.aborted)throw new k;return this._addRun(r5(this,eI,"m",eD).call(this))}async _createAssistantStream(e,t,r,s){let n=s?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort()));let i={...r,stream:!0},a=await e.create(t,i,{...s,signal:this.controller.signal});for await(let e of(this._connected(),a))r5(this,eI,"m",eU).call(this,e);if(a.controller.signal?.aborted)throw new k;return this._addRun(r5(this,eI,"m",eD).call(this))}static accumulateDelta(e,t){for(let[r,s]of Object.entries(t)){if(!e.hasOwnProperty(r)){e[r]=s;continue}let t=e[r];if(null==t||"index"===r||"type"===r){e[r]=s;continue}if("string"==typeof t&&"string"==typeof s)t+=s;else if("number"==typeof t&&"number"==typeof s)t+=s;else if(tz(t)&&tz(s))t=this.accumulateDelta(t,s);else if(Array.isArray(t)&&Array.isArray(s)){if(t.every(e=>"string"==typeof e||"number"==typeof e)){t.push(...s);continue}for(let e of s){if(!tz(e))throw Error(`Expected array delta entry to be an object but got: ${e}`);let r=e.index;if(null==r)throw console.error(e),Error("Expected array delta entry to have an `index` property");if("number"!=typeof r)throw Error(`Expected array delta entry \`index\` property to be a number but got ${r}`);let s=t[r];null==s?t.push(e):t[r]=this.accumulateDelta(s,e)}continue}else throw Error(`Unhandled record type: ${r}, deltaValue: ${s}, accValue: ${t}`);e[r]=t}return e}_addRun(e){return e}async _threadAssistantStream(e,t,r){return await this._createThreadAssistantStream(t,e,r)}async _runAssistantStream(e,t,r,s){return await this._createAssistantStream(t,e,r,s)}async _runToolAssistantStream(e,t,r,s,n){return await this._createToolAssistantStream(r,e,t,s,n)}}eU=function(e){if(!this.ended)switch(r4(this,eN,e,"f"),r5(this,eI,"m",eq).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":r5(this,eI,"m",eV).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":r5(this,eI,"m",eW).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":r5(this,eI,"m",eF).call(this,e);break;case"error":throw Error("Encountered an error event in event processing - errors should be processed earlier")}},eD=function(){if(this.ended)throw new O("stream has ended, this shouldn't happen");if(!r5(this,eC,"f"))throw Error("Final run has not been received");return r5(this,eC,"f")},eF=function(e){let[t,r]=r5(this,eI,"m",eJ).call(this,e,r5(this,eO,"f"));for(let e of(r4(this,eO,t,"f"),r5(this,e$,"f")[t.id]=t,r)){let r=t.content[e.index];r?.type=="text"&&this._emit("textCreated",r.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,t),e.data.delta.content)for(let r of e.data.delta.content){if("text"==r.type&&r.text){let e=r.text,s=t.content[r.index];if(s&&"text"==s.type)this._emit("textDelta",e,s.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(r.index!=r5(this,ek,"f")){if(r5(this,eT,"f"))switch(r5(this,eT,"f").type){case"text":this._emit("textDone",r5(this,eT,"f").text,r5(this,eO,"f"));break;case"image_file":this._emit("imageFileDone",r5(this,eT,"f").image_file,r5(this,eO,"f"))}r4(this,ek,r.index,"f")}r4(this,eT,t.content[r.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(void 0!==r5(this,ek,"f")){let t=e.data.content[r5(this,ek,"f")];if(t)switch(t.type){case"image_file":this._emit("imageFileDone",t.image_file,r5(this,eO,"f"));break;case"text":this._emit("textDone",t.text,r5(this,eO,"f"))}}r5(this,eO,"f")&&this._emit("messageDone",e.data),r4(this,eO,void 0,"f")}},eW=function(e){let t=r5(this,eI,"m",eX).call(this,e);switch(r4(this,eL,t,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let r=e.data.delta;if(r.step_details&&"tool_calls"==r.step_details.type&&r.step_details.tool_calls&&"tool_calls"==t.step_details.type)for(let e of r.step_details.tool_calls)e.index==r5(this,eB,"f")?this._emit("toolCallDelta",e,t.step_details.tool_calls[e.index]):(r5(this,eM,"f")&&this._emit("toolCallDone",r5(this,eM,"f")),r4(this,eB,e.index,"f"),r4(this,eM,t.step_details.tool_calls[e.index],"f"),r5(this,eM,"f")&&this._emit("toolCallCreated",r5(this,eM,"f")));this._emit("runStepDelta",e.data.delta,t);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":r4(this,eL,void 0,"f"),"tool_calls"==e.data.step_details.type&&r5(this,eM,"f")&&(this._emit("toolCallDone",r5(this,eM,"f")),r4(this,eM,void 0,"f")),this._emit("runStepDone",e.data,t)}},eq=function(e){r5(this,eR,"f").push(e),this._emit("event",e)},eX=function(e){switch(e.event){case"thread.run.step.created":return r5(this,eP,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let t=r5(this,eP,"f")[e.data.id];if(!t)throw Error("Received a RunStepDelta before creation of a snapshot");let r=e.data;if(r.delta){let s=r3.accumulateDelta(t,r.delta);r5(this,eP,"f")[e.data.id]=s}return r5(this,eP,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":r5(this,eP,"f")[e.data.id]=e.data}if(r5(this,eP,"f")[e.data.id])return r5(this,eP,"f")[e.data.id];throw Error("No snapshot available")},eJ=function(e,t){let r=[];switch(e.event){case"thread.message.created":return[e.data,r];case"thread.message.delta":if(!t)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let s=e.data;if(s.delta.content)for(let e of s.delta.content)if(e.index in t.content){let r=t.content[e.index];t.content[e.index]=r5(this,eI,"m",eH).call(this,e,r)}else t.content[e.index]=e,r.push(e);return[t,r];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(t)return[t,r];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},eH=function(e,t){return r3.accumulateDelta(t,e)},eV=function(e){switch(r4(this,ej,e.data,"f"),e.event){case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":r4(this,eC,e.data,"f"),r5(this,eM,"f")&&(this._emit("toolCallDone",r5(this,eM,"f")),r4(this,eM,void 0,"f"))}};class r9 extends tY{create(e,t,r){return this._client.post(`/threads/${e}/messages`,{body:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}retrieve(e,t,r){return this._client.get(`/threads/${e}/messages/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,t,r,s){return this._client.post(`/threads/${e}/messages/${t}`,{body:r,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers}})}list(e,t={},r){return tR(t)?this.list(e,{},t):this._client.getAPIList(`/threads/${e}/messages`,r7,{query:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(e,t,r){return this._client.delete(`/threads/${e}/messages/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}}class r7 extends t0{}r9.MessagesPage=r7;class se extends tY{retrieve(e,t,r,s={},n){return tR(s)?this.retrieve(e,t,r,{},s):this._client.get(`/threads/${e}/runs/${t}/steps/${r}`,{query:s,...n,headers:{"OpenAI-Beta":"assistants=v2",...n?.headers}})}list(e,t,r={},s){return tR(r)?this.list(e,t,{},r):this._client.getAPIList(`/threads/${e}/runs/${t}/steps`,st,{query:r,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers}})}}class st extends t0{}se.RunStepsPage=st;class sr extends tY{constructor(){super(...arguments),this.steps=new se(this._client)}create(e,t,r){let{include:s,...n}=t;return this._client.post(`/threads/${e}/runs`,{query:{include:s},body:n,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers},stream:t.stream??!1})}retrieve(e,t,r){return this._client.get(`/threads/${e}/runs/${t}`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}update(e,t,r,s){return this._client.post(`/threads/${e}/runs/${t}`,{body:r,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers}})}list(e,t={},r){return tR(t)?this.list(e,{},t):this._client.getAPIList(`/threads/${e}/runs`,ss,{query:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}cancel(e,t,r){return this._client.post(`/threads/${e}/runs/${t}/cancel`,{...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}async createAndPoll(e,t,r){let s=await this.create(e,t,r);return await this.poll(e,s.id,r)}createAndStream(e,t,r){return r3.createAssistantStream(e,this._client.beta.threads.runs,t,r)}async poll(e,t,r){let s={...r?.headers,"X-Stainless-Poll-Helper":"true"};for(r?.pollIntervalMs&&(s["X-Stainless-Custom-Poll-Interval"]=r.pollIntervalMs.toString());;){let{data:n,response:i}=await this.retrieve(e,t,{...r,headers:{...r?.headers,...s}}).withResponse();switch(n.status){case"queued":case"in_progress":case"cancelling":let a=5e3;if(r?.pollIntervalMs)a=r.pollIntervalMs;else{let e=i.headers.get("openai-poll-after-ms");if(e){let t=parseInt(e);isNaN(t)||(a=t)}}await tM(a);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return n}}}stream(e,t,r){return r3.createAssistantStream(e,this._client.beta.threads.runs,t,r)}submitToolOutputs(e,t,r,s){return this._client.post(`/threads/${e}/runs/${t}/submit_tool_outputs`,{body:r,...s,headers:{"OpenAI-Beta":"assistants=v2",...s?.headers},stream:r.stream??!1})}async submitToolOutputsAndPoll(e,t,r,s){let n=await this.submitToolOutputs(e,t,r,s);return await this.poll(e,n.id,s)}submitToolOutputsStream(e,t,r,s){return r3.createToolAssistantStream(e,t,this._client.beta.threads.runs,r,s)}}class ss extends t0{}sr.RunsPage=ss,sr.Steps=se,sr.RunStepsPage=st;class sn extends tY{constructor(){super(...arguments),this.runs=new sr(this._client),this.messages=new r9(this._client)}create(e={},t){return tR(e)?this.create({},e):this._client.post("/threads",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}retrieve(e,t){return this._client.get(`/threads/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}update(e,t,r){return this._client.post(`/threads/${e}`,{body:t,...r,headers:{"OpenAI-Beta":"assistants=v2",...r?.headers}})}del(e,t){return this._client.delete(`/threads/${e}`,{...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers}})}createAndRun(e,t){return this._client.post("/threads/runs",{body:e,...t,headers:{"OpenAI-Beta":"assistants=v2",...t?.headers},stream:e.stream??!1})}async createAndRunPoll(e,t){let r=await this.createAndRun(e,t);return await this.runs.poll(r.thread_id,r.id,t)}createAndRunStream(e,t){return r3.createThreadAssistantStream(e,this._client.beta.threads,t)}}sn.Runs=sr,sn.RunsPage=ss,sn.Messages=r9,sn.MessagesPage=r7;class si extends tY{constructor(){super(...arguments),this.realtime=new r8(this._client),this.chat=new r1(this._client),this.assistants=new rP(this._client),this.threads=new sn(this._client)}}si.Realtime=r8,si.Assistants=rP,si.AssistantsPage=r$,si.Threads=sn;class sa extends tY{create(e,t){return this._client.post("/batches",{body:e,...t})}retrieve(e,t){return this._client.get(`/batches/${e}`,t)}list(e={},t){return tR(e)?this.list({},e):this._client.getAPIList("/batches",so,{query:e,...t})}cancel(e,t){return this._client.post(`/batches/${e}/cancel`,t)}}class so extends t0{}sa.BatchesPage=so;class sl extends tY{create(e,t,r){return this._client.post(`/uploads/${e}/parts`,th({body:t,...r}))}}class su extends tY{constructor(){super(...arguments),this.parts=new sl(this._client)}create(e,t){return this._client.post("/uploads",{body:e,...t})}cancel(e,t){return this._client.post(`/uploads/${e}/cancel`,t)}complete(e,t,r){return this._client.post(`/uploads/${e}/complete`,{body:t,...r})}}function sc(e,t){let r=e.output.map(e=>{if("function_call"===e.type)return{...e,parsed_arguments:function(e,t){var r,s;let n=(r=e.tools??[],s=t.name,r.find(e=>"function"===e.type&&e.name===s));return{...t,...t,parsed_arguments:n?.$brand==="auto-parseable-tool"?n.$parseRaw(t.arguments):n?.strict?JSON.parse(t.arguments):null}}(t,e)};if("message"===e.type){let r=e.content.map(e=>{var r;return"output_text"===e.type?{...e,parsed:(r=e.text,t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(r):JSON.parse(r))}:e});return{...e,content:r}}return e}),s=Object.assign({},e,{output:r});return Object.getOwnPropertyDescriptor(e,"output_text")||sh(s),Object.defineProperty(s,"output_parsed",{enumerable:!0,get(){for(let e of s.output)if("message"===e.type){for(let t of e.content)if("output_text"===t.type&&null!==t.parsed)return t.parsed}return null}}),s}function sh(e){let t=[];for(let r of e.output)if("message"===r.type)for(let e of r.content)"output_text"===e.type&&t.push(e.text);e.output_text=t.join("")}su.Parts=sl;class sf extends tY{list(e,t={},r){return tR(t)?this.list(e,{},t):this._client.getAPIList(`/responses/${e}/input_items`,sy,{query:t,...r})}}var sd=function(e,t,r,s,n){if("m"===s)throw TypeError("Private method is not writable");if("a"===s&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(e,r):n?n.value=r:t.set(e,r),r},sp=function(e,t,r,s){if("a"===r&&!s)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?s:"a"===r?s.call(e):s?s.value:t.get(e)};class sm extends rN{constructor(e){super(),eK.add(this),ez.set(this,void 0),eY.set(this,void 0),eQ.set(this,void 0),sd(this,ez,e,"f")}static createResponse(e,t,r){let s=new sm(t);return s._run(()=>s._createOrRetrieveResponse(e,t,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"stream"}})),s}async _createOrRetrieveResponse(e,t,r){let s;let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),sp(this,eK,"m",eG).call(this);let i=null;for await(let n of("response_id"in t?(s=await e.responses.retrieve(t.response_id,{stream:!0},{...r,signal:this.controller.signal,stream:!0}),i=t.starting_after??null):s=await e.responses.create({...t,stream:!0},{...r,signal:this.controller.signal}),this._connected(),s))sp(this,eK,"m",eZ).call(this,n,i);if(s.controller.signal?.aborted)throw new k;return sp(this,eK,"m",e0).call(this)}[(ez=new WeakMap,eY=new WeakMap,eQ=new WeakMap,eK=new WeakSet,eG=function(){this.ended||sd(this,eY,void 0,"f")},eZ=function(e,t){if(this.ended)return;let r=(e,r)=>{(null==t||r.sequence_number>t)&&this._emit(e,r)},s=sp(this,eK,"m",e1).call(this,e);switch(r("event",e),e.type){case"response.output_text.delta":{let t=s.output[e.output_index];if(!t)throw new O(`missing output at index ${e.output_index}`);if("message"===t.type){let s=t.content[e.content_index];if(!s)throw new O(`missing content at index ${e.content_index}`);if("output_text"!==s.type)throw new O(`expected content to be 'output_text', got ${s.type}`);r("response.output_text.delta",{...e,snapshot:s.text})}break}case"response.function_call_arguments.delta":{let t=s.output[e.output_index];if(!t)throw new O(`missing output at index ${e.output_index}`);"function_call"===t.type&&r("response.function_call_arguments.delta",{...e,snapshot:t.arguments});break}default:r(e.type,e)}},e0=function(){if(this.ended)throw new O("stream has ended, this shouldn't happen");let e=sp(this,eY,"f");if(!e)throw new O("request ended without sending any events");sd(this,eY,void 0,"f");let t=function(e,t){return t&&rj(t.text?.format)?sc(e,t):{...e,output_parsed:null,output:e.output.map(e=>"function_call"===e.type?{...e,parsed_arguments:null}:"message"===e.type?{...e,content:e.content.map(e=>({...e,parsed:null}))}:e)}}(e,sp(this,ez,"f"));return sd(this,eQ,t,"f"),t},e1=function(e){let t=sp(this,eY,"f");if(!t){if("response.created"!==e.type)throw new O(`When snapshot hasn't been set yet, expected 'response.created' event, got ${e.type}`);return sd(this,eY,e.response,"f")}switch(e.type){case"response.output_item.added":t.output.push(e.item);break;case"response.content_part.added":{let r=t.output[e.output_index];if(!r)throw new O(`missing output at index ${e.output_index}`);"message"===r.type&&r.content.push(e.part);break}case"response.output_text.delta":{let r=t.output[e.output_index];if(!r)throw new O(`missing output at index ${e.output_index}`);if("message"===r.type){let t=r.content[e.content_index];if(!t)throw new O(`missing content at index ${e.content_index}`);if("output_text"!==t.type)throw new O(`expected content to be 'output_text', got ${t.type}`);t.text+=e.delta}break}case"response.function_call_arguments.delta":{let r=t.output[e.output_index];if(!r)throw new O(`missing output at index ${e.output_index}`);"function_call"===r.type&&(r.arguments+=e.delta);break}case"response.completed":sd(this,eY,e.response,"f")}return t},Symbol.asyncIterator)](){let e=[],t=[],r=!1;return this.on("event",r=>{let s=t.shift();s?s.resolve(r):e.push(r)}),this.on("end",()=>{for(let e of(r=!0,t))e.resolve(void 0);t.length=0}),this.on("abort",e=>{for(let s of(r=!0,t))s.reject(e);t.length=0}),this.on("error",e=>{for(let s of(r=!0,t))s.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:r?{value:void 0,done:!0}:new Promise((e,r)=>t.push({resolve:e,reject:r})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=sp(this,eQ,"f");if(!e)throw new O("stream ended without producing a ChatCompletion");return e}}class sg extends tY{constructor(){super(...arguments),this.inputItems=new sf(this._client)}create(e,t){return this._client.post("/responses",{body:e,...t,stream:e.stream??!1})._thenUnwrap(e=>("object"in e&&"response"===e.object&&sh(e),e))}retrieve(e,t={},r){return this._client.get(`/responses/${e}`,{query:t,...r,stream:t?.stream??!1})}del(e,t){return this._client.delete(`/responses/${e}`,{...t,headers:{Accept:"*/*",...t?.headers}})}parse(e,t){return this._client.responses.create(e,t)._thenUnwrap(t=>sc(t,e))}stream(e,t){return sm.createResponse(this._client,e,t)}cancel(e,t){return this._client.post(`/responses/${e}/cancel`,{...t,headers:{Accept:"*/*",...t?.headers}})}}class sy extends t0{}sg.InputItems=sf;class sw extends tY{retrieve(e,t,r,s){return this._client.get(`/evals/${e}/runs/${t}/output_items/${r}`,s)}list(e,t,r={},s){return tR(r)?this.list(e,t,{},r):this._client.getAPIList(`/evals/${e}/runs/${t}/output_items`,sb,{query:r,...s})}}class sb extends t0{}sw.OutputItemListResponsesPage=sb;class s_ extends tY{constructor(){super(...arguments),this.outputItems=new sw(this._client)}create(e,t,r){return this._client.post(`/evals/${e}/runs`,{body:t,...r})}retrieve(e,t,r){return this._client.get(`/evals/${e}/runs/${t}`,r)}list(e,t={},r){return tR(t)?this.list(e,{},t):this._client.getAPIList(`/evals/${e}/runs`,sv,{query:t,...r})}del(e,t,r){return this._client.delete(`/evals/${e}/runs/${t}`,r)}cancel(e,t,r){return this._client.post(`/evals/${e}/runs/${t}`,r)}}class sv extends t0{}s_.RunListResponsesPage=sv,s_.OutputItems=sw,s_.OutputItemListResponsesPage=sb;class sx extends tY{constructor(){super(...arguments),this.runs=new s_(this._client)}create(e,t){return this._client.post("/evals",{body:e,...t})}retrieve(e,t){return this._client.get(`/evals/${e}`,t)}update(e,t,r){return this._client.post(`/evals/${e}`,{body:t,...r})}list(e={},t){return tR(e)?this.list({},e):this._client.getAPIList("/evals",sA,{query:e,...t})}del(e,t){return this._client.delete(`/evals/${e}`,t)}}class sA extends t0{}sx.EvalListResponsesPage=sA,sx.Runs=s_,sx.RunListResponsesPage=sv;class sS extends tY{retrieve(e,t,r){return this._client.get(`/containers/${e}/files/${t}/content`,{...r,headers:{Accept:"application/binary",...r?.headers},__binaryResponse:!0})}}class sE extends tY{constructor(){super(...arguments),this.content=new sS(this._client)}create(e,t,r){return this._client.post(`/containers/${e}/files`,th({body:t,...r}))}retrieve(e,t,r){return this._client.get(`/containers/${e}/files/${t}`,r)}list(e,t={},r){return tR(t)?this.list(e,{},t):this._client.getAPIList(`/containers/${e}/files`,sI,{query:t,...r})}del(e,t,r){return this._client.delete(`/containers/${e}/files/${t}`,{...r,headers:{Accept:"*/*",...r?.headers}})}}class sI extends t0{}sE.FileListResponsesPage=sI,sE.Content=sS;class sR extends tY{constructor(){super(...arguments),this.files=new sE(this._client)}create(e,t){return this._client.post("/containers",{body:e,...t})}retrieve(e,t){return this._client.get(`/containers/${e}`,t)}list(e={},t){return tR(e)?this.list({},e):this._client.getAPIList("/containers",sP,{query:e,...t})}del(e,t){return this._client.delete(`/containers/${e}`,{...t,headers:{Accept:"*/*",...t?.headers}})}}class sP extends t0{}sR.ContainerListResponsesPage=sP,sR.Files=sE,sR.FileListResponsesPage=sI,r(40257);class s$ extends tx{constructor({baseURL:e=tL("OPENAI_BASE_URL"),apiKey:t=tL("OPENAI_API_KEY"),organization:r=tL("OPENAI_ORG_ID")??null,project:s=tL("OPENAI_PROJECT_ID")??null,...n}={}){if(void 0===t)throw new O("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");let i={apiKey:t,organization:r,project:s,...n,baseURL:e||"https://api.openai.com/v1"};if(!i.dangerouslyAllowBrowser&&tJ())throw new O("It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew OpenAI({ apiKey, dangerouslyAllowBrowser: true });\n\nhttps://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety\n");super({baseURL:i.baseURL,timeout:i.timeout??6e5,httpAgent:i.httpAgent,maxRetries:i.maxRetries,fetch:i.fetch}),this.completions=new tQ(this),this.chat=new t8(this),this.embeddings=new t5(this),this.files=new t4(this),this.images=new t9(this),this.audio=new rr(this),this.moderations=new rs(this),this.models=new rn(this),this.fineTuning=new ry(this),this.graders=new rb(this),this.vectorStores=new rE(this),this.beta=new si(this),this.batches=new sa(this),this.uploads=new su(this),this.responses=new sg(this),this.evals=new sx(this),this.containers=new sR(this),this._options=i,this.apiKey=t,this.organization=r,this.project=s}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project,...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}stringifyQuery(e){return function(e,t={}){let r,s=e,n=function(e=S){let t;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw TypeError("Encoder has to be a function.");let r=e.charset||S.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let s=d;if(void 0!==e.format){if(!w.call(p,e.format))throw TypeError("Unknown format option provided.");s=e.format}let n=p[s],i=S.filter;if(("function"==typeof e.filter||_(e.filter))&&(i=e.filter),t=e.arrayFormat&&e.arrayFormat in b?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":S.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw TypeError("`commaRoundTrip` must be a boolean, or absent");let a=void 0===e.allowDots?!0==!!e.encodeDotInKeys||S.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:S.addQueryPrefix,allowDots:a,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:S.allowEmptyArrays,arrayFormat:t,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:S.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?S.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:S.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:S.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:S.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:S.encodeValuesOnly,filter:i,format:s,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:S.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:S.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:S.strictNullHandling}}(t);"function"==typeof n.filter?s=(0,n.filter)("",s):_(n.filter)&&(r=n.filter);let i=[];if("object"!=typeof s||null===s)return"";let a=b[n.arrayFormat],o="comma"===a&&n.commaRoundTrip;r||(r=Object.keys(s)),n.sort&&r.sort(n.sort);let l=new WeakMap;for(let e=0;e0?R.join(",")||null:void 0}];else if(_(c))I=c;else{let e=Object.keys(R);I=h?e.sort(h):e}let k=l?String(r).replace(/\./g,"%2E"):String(r),T=n&&_(R)&&1===R.length?k+"[]":k;if(i&&_(R)&&0===R.length)return T+"[]";for(let r=0;r0?c+u:""}(e,{arrayFormat:"brackets"})}}s$.OpenAI=s$,s$.DEFAULT_TIMEOUT=6e5,s$.OpenAIError=O,s$.APIError=C,s$.APIConnectionError=T,s$.APIConnectionTimeoutError=B,s$.APIUserAbortError=k,s$.NotFoundError=L,s$.ConflictError=U,s$.RateLimitError=F,s$.BadRequestError=M,s$.AuthenticationError=N,s$.InternalServerError=W,s$.PermissionDeniedError=j,s$.UnprocessableEntityError=D,s$.toFile=ta,s$.fileFromPath=h,s$.Completions=tQ,s$.Chat=t8,s$.ChatCompletionsPage=t2,s$.Embeddings=t5,s$.Files=t4,s$.FileObjectsPage=t3,s$.Images=t9,s$.Audio=rr,s$.Moderations=rs,s$.Models=rn,s$.ModelsPage=ri,s$.FineTuning=ry,s$.Graders=rb,s$.VectorStores=rE,s$.VectorStoresPage=rI,s$.VectorStoreSearchResponsesPage=rR,s$.Beta=si,s$.Batches=sa,s$.BatchesPage=so,s$.Uploads=su,s$.Responses=sg,s$.Evals=sx,s$.EvalListResponsesPage=sA,s$.Containers=sR,s$.ContainerListResponsesPage=sP;var sO=s$}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/120d96e5e05ab994.js b/litellm/proxy/_experimental/out/_next/static/chunks/120d96e5e05ab994.js new file mode 100644 index 00000000000..cc35a06c260 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/120d96e5e05ab994.js @@ -0,0 +1,2 @@ +(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,829672,836938,310730,e=>{"use strict";e.i(247167);var t=e.i(271645),r=e.i(343794),n=e.i(914949),o=e.i(404948);let i=e=>e?"function"==typeof e?e():e:null;e.s(["getRenderPropValue",0,i],836938);var s=e.i(613541),a=e.i(763731),l=e.i(242064),u=e.i(491816);e.i(793154);var c=e.i(880476),d=e.i(183293),p=e.i(717356),m=e.i(320560),f=e.i(307358),h=e.i(246422),g=e.i(838378),v=e.i(617933);let b=(0,h.genStyleHooks)("Popover",e=>{let{colorBgElevated:t,colorText:r}=e,n=(0,g.mergeToken)(e,{popoverBg:t,popoverColor:r});return[(e=>{let{componentCls:t,popoverColor:r,titleMinWidth:n,fontWeightStrong:o,innerPadding:i,boxShadowSecondary:s,colorTextHeading:a,borderRadiusLG:l,zIndexPopup:u,titleMarginBottom:c,colorBgElevated:p,popoverBg:f,titleBorderBottom:h,innerContentPadding:g,titlePadding:v}=e;return[{[t]:Object.assign(Object.assign({},(0,d.resetComponent)(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:u,fontWeight:"normal",whiteSpace:"normal",textAlign:"start",cursor:"auto",userSelect:"text","--valid-offset-x":"var(--arrow-offset-horizontal, var(--arrow-x))",transformOrigin:"var(--valid-offset-x, 50%) var(--arrow-y, 50%)","--antd-arrow-background-color":p,width:"max-content",maxWidth:"100vw","&-rtl":{direction:"rtl"},"&-hidden":{display:"none"},[`${t}-content`]:{position:"relative"},[`${t}-inner`]:{backgroundColor:f,backgroundClip:"padding-box",borderRadius:l,boxShadow:s,padding:i},[`${t}-title`]:{minWidth:n,marginBottom:c,color:a,fontWeight:o,borderBottom:h,padding:v},[`${t}-inner-content`]:{color:r,padding:g}})},(0,m.default)(e,"var(--antd-arrow-background-color)"),{[`${t}-pure`]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",[`${t}-content`]:{display:"inline-block"}}}]})(n),(e=>{let{componentCls:t}=e;return{[t]:v.PresetColors.map(r=>{let n=e[`${r}6`];return{[`&${t}-${r}`]:{"--antd-arrow-background-color":n,[`${t}-inner`]:{backgroundColor:n},[`${t}-arrow`]:{background:"transparent"}}}})}})(n),(0,p.initZoomMotion)(n,"zoom-big")]},e=>{let{lineWidth:t,controlHeight:r,fontHeight:n,padding:o,wireframe:i,zIndexPopupBase:s,borderRadiusLG:a,marginXS:l,lineType:u,colorSplit:c,paddingSM:d}=e,p=r-n;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:s+30},(0,f.getArrowToken)(e)),(0,m.getArrowOffsetToken)({contentRadius:a,limitVerticalRadius:!0})),{innerPadding:12*!i,titleMarginBottom:i?0:l,titlePadding:i?`${p/2}px ${o}px ${p/2-t}px`:0,titleBorderBottom:i?`${t}px ${u} ${c}`:"none",innerContentPadding:i?`${d}px ${o}px`:0})},{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]});var y=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let C=({title:e,content:r,prefixCls:n})=>e||r?t.createElement(t.Fragment,null,e&&t.createElement("div",{className:`${n}-title`},e),r&&t.createElement("div",{className:`${n}-inner-content`},r)):null,x=e=>{let{hashId:n,prefixCls:o,className:s,style:a,placement:l="top",title:u,content:d,children:p}=e,m=i(u),f=i(d),h=(0,r.default)(n,o,`${o}-pure`,`${o}-placement-${l}`,s);return t.createElement("div",{className:h,style:a},t.createElement("div",{className:`${o}-arrow`}),t.createElement(c.Popup,Object.assign({},e,{className:n,prefixCls:o}),p||t.createElement(C,{prefixCls:o,title:m,content:f})))},E=e=>{let{prefixCls:n,className:o}=e,i=y(e,["prefixCls","className"]),{getPrefixCls:s}=t.useContext(l.ConfigContext),a=s("popover",n),[u,c,d]=b(a);return u(t.createElement(x,Object.assign({},i,{prefixCls:a,hashId:c,className:(0,r.default)(o,d)})))};e.s(["Overlay",0,C,"default",0,E],310730);var O=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r};let k=t.forwardRef((e,c)=>{var d,p;let{prefixCls:m,title:f,content:h,overlayClassName:g,placement:v="top",trigger:y="hover",children:x,mouseEnterDelay:E=.1,mouseLeaveDelay:k=.1,onOpenChange:w,overlayStyle:P={},styles:S,classNames:j}=e,M=O(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:R,className:N,style:T,classNames:F,styles:D}=(0,l.useComponentConfig)("popover"),$=R("popover",m),[I,A,L]=b($),B=R(),H=(0,r.default)(g,A,L,N,F.root,null==j?void 0:j.root),K=(0,r.default)(F.body,null==j?void 0:j.body),[W,V]=(0,n.default)(!1,{value:null!=(d=e.open)?d:e.visible,defaultValue:null!=(p=e.defaultOpen)?p:e.defaultVisible}),U=(e,t)=>{V(e,!0),null==w||w(e,t)},z=i(f),q=i(h);return I(t.createElement(u.default,Object.assign({placement:v,trigger:y,mouseEnterDelay:E,mouseLeaveDelay:k},M,{prefixCls:$,classNames:{root:H,body:K},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},D.root),T),P),null==S?void 0:S.root),body:Object.assign(Object.assign({},D.body),null==S?void 0:S.body)},ref:c,open:W,onOpenChange:e=>{U(e)},overlay:z||q?t.createElement(C,{prefixCls:$,title:z,content:q}):null,transitionName:(0,s.getTransitionName)(B,"zoom-big",M.transitionName),"data-popover-inject":!0}),(0,a.cloneElement)(x,{onKeyDown:e=>{var r,n;(0,t.isValidElement)(x)&&(null==(n=null==x?void 0:(r=x.props).onKeyDown)||n.call(r,e)),e.keyCode===o.default.ESC&&U(!1,e)}})))});k._InternalPanelDoNotUseOrYouWillBeFired=E,e.s(["default",0,k],829672)},793130,e=>{"use strict";var t=e.i(290571),r=e.i(429427),n=e.i(371330),o=e.i(271645),i=e.i(394487),s=e.i(503269),a=e.i(214520),l=e.i(746725),u=e.i(914189),c=e.i(144279),d=e.i(294316),p=e.i(601893),m=e.i(140721),f=e.i(942803),h=e.i(233538),g=e.i(694421),v=e.i(700020),b=e.i(35889),y=e.i(998348),C=e.i(722678);let x=(0,o.createContext)(null);x.displayName="GroupContext";let E=o.Fragment,O=Object.assign((0,v.forwardRefWithAs)(function(e,t){var E;let O=(0,o.useId)(),k=(0,f.useProvidedId)(),w=(0,p.useDisabled)(),{id:P=k||`headlessui-switch-${O}`,disabled:S=w||!1,checked:j,defaultChecked:M,onChange:R,name:N,value:T,form:F,autoFocus:D=!1,...$}=e,I=(0,o.useContext)(x),[A,L]=(0,o.useState)(null),B=(0,o.useRef)(null),H=(0,d.useSyncRefs)(B,t,null===I?null:I.setSwitch,L),K=(0,a.useDefaultValue)(M),[W,V]=(0,s.useControllable)(j,R,null!=K&&K),U=(0,l.useDisposables)(),[z,q]=(0,o.useState)(!1),G=(0,u.useEvent)(()=>{q(!0),null==V||V(!W),U.nextFrame(()=>{q(!1)})}),_=(0,u.useEvent)(e=>{if((0,h.isDisabledReactIssue7711)(e.currentTarget))return e.preventDefault();e.preventDefault(),G()}),Y=(0,u.useEvent)(e=>{e.key===y.Keys.Space?(e.preventDefault(),G()):e.key===y.Keys.Enter&&(0,g.attemptSubmit)(e.currentTarget)}),Q=(0,u.useEvent)(e=>e.preventDefault()),Z=(0,C.useLabelledBy)(),J=(0,b.useDescribedBy)(),{isFocusVisible:X,focusProps:ee}=(0,r.useFocusRing)({autoFocus:D}),{isHovered:et,hoverProps:er}=(0,n.useHover)({isDisabled:S}),{pressed:en,pressProps:eo}=(0,i.useActivePress)({disabled:S}),ei=(0,o.useMemo)(()=>({checked:W,disabled:S,hover:et,focus:X,active:en,autofocus:D,changing:z}),[W,et,X,en,S,z,D]),es=(0,v.mergeProps)({id:P,ref:H,role:"switch",type:(0,c.useResolveButtonType)(e,A),tabIndex:-1===e.tabIndex?0:null!=(E=e.tabIndex)?E:0,"aria-checked":W,"aria-labelledby":Z,"aria-describedby":J,disabled:S||void 0,autoFocus:D,onClick:_,onKeyUp:Y,onKeyPress:Q},ee,er,eo),ea=(0,o.useCallback)(()=>{if(void 0!==K)return null==V?void 0:V(K)},[V,K]),el=(0,v.useRender)();return o.default.createElement(o.default.Fragment,null,null!=N&&o.default.createElement(m.FormFields,{disabled:S,data:{[N]:T||"on"},overrides:{type:"checkbox",checked:W},form:F,onReset:ea}),el({ourProps:es,theirProps:$,slot:ei,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,o.useState)(null),[i,s]=(0,C.useLabels)(),[a,l]=(0,b.useDescriptions)(),u=(0,o.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),c=(0,v.useRender)();return o.default.createElement(l,{name:"Switch.Description",value:a},o.default.createElement(s,{name:"Switch.Label",value:i,props:{htmlFor:null==(t=u.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},o.default.createElement(x.Provider,{value:u},c({ourProps:{},theirProps:e,slot:{},defaultTag:E,name:"Switch.Group"}))))},Label:C.Label,Description:b.Description});var k=e.i(888288),w=e.i(95779),P=e.i(444755),S=e.i(673706),j=e.i(829087);let M=(0,S.makeClassName)("Switch"),R=o.default.forwardRef((e,r)=>{let{checked:n,defaultChecked:i=!1,onChange:s,color:a,name:l,error:u,errorMessage:c,disabled:d,required:p,tooltip:m,id:f}=e,h=(0,t.__rest)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:a?(0,S.getColorClassNames)(a,w.colorPalette.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:a?(0,S.getColorClassNames)(a,w.colorPalette.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[v,b]=(0,k.default)(i,n),[y,C]=(0,o.useState)(!1),{tooltipProps:x,getReferenceProps:E}=(0,j.useTooltip)(300);return o.default.createElement("div",{className:"flex flex-row items-center justify-start"},o.default.createElement(j.default,Object.assign({text:m},x)),o.default.createElement("div",Object.assign({ref:(0,S.mergeRefs)([r,x.refs.setReference]),className:(0,P.tremorTwMerge)(M("root"),"flex flex-row relative h-5")},h,E),o.default.createElement("input",{type:"checkbox",className:(0,P.tremorTwMerge)(M("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:l,required:p,checked:v,onChange:e=>{e.preventDefault()}}),o.default.createElement(O,{checked:v,onChange:e=>{b(e),null==s||s(e)},disabled:d,className:(0,P.tremorTwMerge)(M("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",d?"cursor-not-allowed":""),onFocus:()=>C(!0),onBlur:()=>C(!1),id:f},o.default.createElement("span",{className:(0,P.tremorTwMerge)(M("sr-only"),"sr-only")},"Switch ",v?"on":"off"),o.default.createElement("span",{"aria-hidden":"true",className:(0,P.tremorTwMerge)(M("background"),v?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),o.default.createElement("span",{"aria-hidden":"true",className:(0,P.tremorTwMerge)(M("round"),v?(0,P.tremorTwMerge)(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",y?(0,P.tremorTwMerge)("ring-2",g.ringColor):"")}))),u&&c?o.default.createElement("p",{className:(0,P.tremorTwMerge)(M("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});R.displayName="Switch",e.s(["Switch",()=>R],793130)},220508,e=>{"use strict";var t=e.i(271645);let r=t.forwardRef(function(e,r){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:r},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.s(["CheckCircleIcon",0,r],220508)},83733,233137,e=>{"use strict";let t,r;var n,o,i=e.i(247167),s=e.i(271645),a=e.i(544508),l=e.i(746725),u=e.i(835696);void 0!==i.default&&"u">typeof globalThis&&"u">typeof Element&&(null==(n=null==i.default?void 0:i.default.env)?void 0:n.NODE_ENV)==="test"&&void 0===(null==(o=null==Element?void 0:Element.prototype)?void 0:o.getAnimations)&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(` +`)),[]});var c=((t=c||{})[t.None=0]="None",t[t.Closed=1]="Closed",t[t.Enter=2]="Enter",t[t.Leave=4]="Leave",t);function d(e){let t={};for(let r in e)!0===e[r]&&(t[`data-${r}`]="");return t}function p(e,t,r,n){let[o,i]=(0,s.useState)(r),{hasFlag:c,addFlag:d,removeFlag:p}=function(e=0){let[t,r]=(0,s.useState)(e),n=(0,s.useCallback)(e=>r(e),[t]),o=(0,s.useCallback)(e=>r(t=>t|e),[t]),i=(0,s.useCallback)(e=>(t&e)===e,[t]);return{flags:t,setFlag:n,addFlag:o,hasFlag:i,removeFlag:(0,s.useCallback)(e=>r(t=>t&~e),[r]),toggleFlag:(0,s.useCallback)(e=>r(t=>t^e),[r])}}(e&&o?3:0),m=(0,s.useRef)(!1),f=(0,s.useRef)(!1),h=(0,l.useDisposables)();return(0,u.useIsoMorphicEffect)(()=>{var o;if(e){if(r&&i(!0),!t){r&&d(3);return}return null==(o=null==n?void 0:n.start)||o.call(n,r),function(e,{prepare:t,run:r,done:n,inFlight:o}){let i=(0,a.disposables)();return function(e,{inFlight:t,prepare:r}){if(null!=t&&t.current)return r();let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}(e,{prepare:t,inFlight:o}),i.nextFrame(()=>{r(),i.requestAnimationFrame(()=>{i.add(function(e,t){var r,n;let o=(0,a.disposables)();if(!e)return o.dispose;let i=!1;o.add(()=>{i=!0});let s=null!=(n=null==(r=e.getAnimations)?void 0:r.call(e).filter(e=>e instanceof CSSTransition))?n:[];return 0===s.length?t():Promise.allSettled(s.map(e=>e.finished)).then(()=>{i||t()}),o.dispose}(e,n))})}),i.dispose}(t,{inFlight:m,prepare(){f.current?f.current=!1:f.current=m.current,m.current=!0,f.current||(r?(d(3),p(4)):(d(4),p(2)))},run(){f.current?r?(p(3),d(4)):(p(4),d(3)):r?p(1):d(1)},done(){var e;f.current&&"function"==typeof t.getAnimations&&t.getAnimations().length>0||(m.current=!1,p(7),r||i(!1),null==(e=null==n?void 0:n.end)||e.call(n,r))}})}},[e,r,t,h]),e?[o,{closed:c(1),enter:c(2),leave:c(4),transition:c(2)||c(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}e.s(["transitionDataAttributes",()=>d,"useTransition",()=>p],83733);let m=(0,s.createContext)(null);m.displayName="OpenClosedContext";var f=((r=f||{})[r.Open=1]="Open",r[r.Closed=2]="Closed",r[r.Closing=4]="Closing",r[r.Opening=8]="Opening",r);function h(){return(0,s.useContext)(m)}function g({value:e,children:t}){return s.default.createElement(m.Provider,{value:e},t)}function v({children:e}){return s.default.createElement(m.Provider,{value:null},e)}e.s(["OpenClosedProvider",()=>g,"ResetOpenClosedProvider",()=>v,"State",()=>f,"useOpenClosed",()=>h],233137)},888288,e=>{"use strict";var t=e.i(271645);let r=(e,r)=>{let n=void 0!==r,[o,i]=(0,t.useState)(e);return[n?r:o,e=>{n||i(e)}]};e.s(["default",()=>r])},233538,e=>{"use strict";function t(e){let t=e.parentElement,r=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(r=t),t=t.parentElement;let n=(null==t?void 0:t.getAttribute("disabled"))==="";return!(n&&function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(r))&&n}e.s(["isDisabledReactIssue7711",()=>t])},503269,214520,601893,694421,140721,942803,35889,722678,e=>{"use strict";var t=e.i(271645),r=e.i(914189);function n(e,n,o){let[i,s]=(0,t.useState)(o),a=void 0!==e,l=(0,t.useRef)(a),u=(0,t.useRef)(!1),c=(0,t.useRef)(!1);return!a||l.current||u.current?a||!l.current||c.current||(c.current=!0,l.current=a,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(u.current=!0,l.current=a,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[a?e:i,(0,r.useEvent)(e=>(a||s(e),null==n?void 0:n(e)))]}function o(e){let[r]=(0,t.useState)(e);return r}e.s(["useControllable",()=>n],503269),e.s(["useDefaultValue",()=>o],214520);let i=(0,t.createContext)(void 0);function s(){return(0,t.useContext)(i)}e.s(["useDisabled",()=>s],601893);var a=e.i(174080),l=e.i(746725);function u(e={},t=null,r=[]){for(let[n,o]of Object.entries(e))!function e(t,r,n){if(Array.isArray(n))for(let[o,i]of n.entries())e(t,c(r,o.toString()),i);else n instanceof Date?t.push([r,n.toISOString()]):"boolean"==typeof n?t.push([r,n?"1":"0"]):"string"==typeof n?t.push([r,n]):"number"==typeof n?t.push([r,`${n}`]):null==n?t.push([r,""]):u(n,r,t)}(r,c(t,n),o);return r}function c(e,t){return e?e+"["+t+"]":t}function d(e){var t,r;let n=null!=(t=null==e?void 0:e.form)?t:e.closest("form");if(n){for(let t of n.elements)if(t!==e&&("INPUT"===t.tagName&&"submit"===t.type||"BUTTON"===t.tagName&&"submit"===t.type||"INPUT"===t.nodeName&&"image"===t.type))return void t.click();null==(r=n.requestSubmit)||r.call(n)}}e.s(["attemptSubmit",()=>d,"objectToFormEntries",()=>u],694421);var p=e.i(700020),m=e.i(2788);let f=(0,t.createContext)(null);function h({children:e}){let r=(0,t.useContext)(f);if(!r)return t.default.createElement(t.default.Fragment,null,e);let{target:n}=r;return n?(0,a.createPortal)(t.default.createElement(t.default.Fragment,null,e),n):null}function g({data:e,form:r,disabled:n,onReset:o,overrides:i}){let[s,a]=(0,t.useState)(null),c=(0,l.useDisposables)();return(0,t.useEffect)(()=>{if(o&&s)return c.addEventListener(s,"reset",o)},[s,r,o]),t.default.createElement(h,null,t.default.createElement(v,{setForm:a,formId:r}),u(e).map(([e,o])=>t.default.createElement(m.Hidden,{features:m.HiddenFeatures.Hidden,...(0,p.compact)({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:r,disabled:n,name:e,value:o,...i})})))}function v({setForm:e,formId:r}){return(0,t.useEffect)(()=>{if(r){let t=document.getElementById(r);t&&e(t)}},[e,r]),r?null:t.default.createElement(m.Hidden,{features:m.HiddenFeatures.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let r=t.closest("form");r&&e(r)}})}e.s(["FormFields",()=>g],140721);let b=(0,t.createContext)(void 0);function y(){return(0,t.useContext)(b)}e.s(["useProvidedId",()=>y],942803);var C=e.i(835696),x=e.i(294316);let E=(0,t.createContext)(null);function O(){var e,r;return null!=(r=null==(e=(0,t.useContext)(E))?void 0:e.value)?r:void 0}function k(){let[e,n]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)(()=>function(e){let o=(0,r.useEvent)(e=>(n(t=>[...t,e]),()=>n(t=>{let r=t.slice(),n=r.indexOf(e);return -1!==n&&r.splice(n,1),r}))),i=(0,t.useMemo)(()=>({register:o,slot:e.slot,name:e.name,props:e.props,value:e.value}),[o,e.slot,e.name,e.props,e.value]);return t.default.createElement(E.Provider,{value:i},e.children)},[n])]}E.displayName="DescriptionContext";let w=Object.assign((0,p.forwardRefWithAs)(function(e,r){let n=(0,t.useId)(),o=s(),{id:i=`headlessui-description-${n}`,...a}=e,l=function e(){let r=(0,t.useContext)(E);if(null===r){let t=Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,e),t}return r}(),u=(0,x.useSyncRefs)(r);(0,C.useIsoMorphicEffect)(()=>l.register(i),[i,l.register]);let c=o||!1,d=(0,t.useMemo)(()=>({...l.slot,disabled:c}),[l.slot,c]),m={ref:u,...l.props,id:i};return(0,p.useRender)()({ourProps:m,theirProps:a,slot:d,defaultTag:"p",name:l.name||"Description"})}),{});e.s(["Description",()=>w,"useDescribedBy",()=>O,"useDescriptions",()=>k],35889);let P=(0,t.createContext)(null);function S(e){var r,n,o;let i=null!=(n=null==(r=(0,t.useContext)(P))?void 0:r.value)?n:void 0;return(null!=(o=null==e?void 0:e.length)?o:0)>0?[i,...e].filter(Boolean).join(" "):i}function j({inherit:e=!1}={}){let n=S(),[o,i]=(0,t.useState)([]),s=e?[n,...o].filter(Boolean):o;return[s.length>0?s.join(" "):void 0,(0,t.useMemo)(()=>function(e){let n=(0,r.useEvent)(e=>(i(t=>[...t,e]),()=>i(t=>{let r=t.slice(),n=r.indexOf(e);return -1!==n&&r.splice(n,1),r}))),o=(0,t.useMemo)(()=>({register:n,slot:e.slot,name:e.name,props:e.props,value:e.value}),[n,e.slot,e.name,e.props,e.value]);return t.default.createElement(P.Provider,{value:o},e.children)},[i])]}P.displayName="LabelContext";let M=Object.assign((0,p.forwardRefWithAs)(function(e,n){var o;let i=(0,t.useId)(),a=function e(){let r=(0,t.useContext)(P);if(null===r){let t=Error("You used a