diff --git a/.circleci/config.yml b/.circleci/config.yml index 2edc35e985..133a7184f9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2036,6 +2036,7 @@ jobs: - run: python ./tests/code_coverage_tests/info_log_check.py - run: python ./tests/code_coverage_tests/test_ban_set_verbose.py - run: python ./tests/code_coverage_tests/code_qa_check_tests.py + - run: python ./tests/code_coverage_tests/check_get_model_cost_key_performance.py - run: python ./tests/code_coverage_tests/test_proxy_types_import.py - run: python ./tests/code_coverage_tests/callback_manager_test.py - run: python ./tests/code_coverage_tests/recursive_detector.py @@ -2054,39 +2055,6 @@ jobs: - run: python ./tests/code_coverage_tests/memory_test.py - run: helm lint ./deploy/charts/litellm-helm - memory_leak_tests: - docker: - - image: cimg/python:3.11 - auth: - username: ${DOCKERHUB_USERNAME} - password: ${DOCKERHUB_PASSWORD} - working_directory: ~/project - resource_class: large - steps: - - setup_litellm_test_deps - - run: - name: Install Memory Test Dependencies - command: | - pip install "psutil>=5.9.0" - pip install "fastapi>=0.100.0" - pip install "httpx>=0.24.0" - pip install "uvicorn>=0.23.0" - - run: - name: Run Linear Memory Growth Tests - command: | - echo "Running memory leak tests individually to avoid baseline drift..." - echo "Running test_memory_baseline_1k..." - python -m pytest tests/load_tests/test_linear_memory_growth.py::test_memory_baseline_1k -v -s --tb=short - echo "Running test_memory_baseline_2k..." - python -m pytest tests/load_tests/test_linear_memory_growth.py::test_memory_baseline_2k -v -s --tb=short - echo "Running test_memory_baseline_4k..." - python -m pytest tests/load_tests/test_linear_memory_growth.py::test_memory_baseline_4k -v -s --tb=short - echo "Running test_memory_baseline_10k..." - python -m pytest tests/load_tests/test_linear_memory_growth.py::test_memory_baseline_10k -v -s --tb=short - echo "Running test_memory_baseline_30k..." - python -m pytest tests/load_tests/test_linear_memory_growth.py::test_memory_baseline_30k -v -s --tb=short - no_output_timeout: 60m - db_migration_disable_update_check: machine: image: ubuntu-2204:2023.10.1 @@ -3837,12 +3805,6 @@ workflows: only: - main - /litellm_.*/ - - memory_leak_tests: - filters: - branches: - only: - - main - - /litellm_.*/ - ui_build: filters: branches: diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index a3da5a85c6..bbe4b76775 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -7,6 +7,16 @@ body: attributes: value: | Thanks for taking the time to fill out this bug report! + + **💡 Tip:** See our [Troubleshooting Guide](https://docs.litellm.ai/docs/troubleshoot) for what information to include. + - type: checkboxes + id: duplicate-check + attributes: + label: Check for existing issues + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues and checked that my issue is not a duplicate. + required: true - type: textarea id: what-happened attributes: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index e575db7302..4cc4290189 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -7,6 +7,14 @@ body: attributes: value: | Thanks for making LiteLLM better! + - type: checkboxes + id: duplicate-check + attributes: + label: Check for existing issues + description: Please search to see if an issue already exists for the feature you are requesting. + options: + - label: I have searched the existing issues and checked that my issue is not a duplicate. + required: true - type: textarea id: the-feature attributes: diff --git a/.github/workflows/check_duplicate_issues.yml b/.github/workflows/check_duplicate_issues.yml new file mode 100644 index 0000000000..14d6964fcd --- /dev/null +++ b/.github/workflows/check_duplicate_issues.yml @@ -0,0 +1,29 @@ +name: Check Duplicate Issues + +on: + issues: + types: [opened, edited] + +jobs: + check-duplicate: + runs-on: ubuntu-latest + permissions: + issues: write + contents: read + steps: + - name: Check for potential duplicates + uses: wow-actions/potential-duplicates@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + label: potential-duplicate + threshold: 0.6 + reaction: eyes + comment: | + **⚠️ Potential duplicate detected** + + This issue appears similar to existing issue(s): + {{#issues}} + - [#{{number}}]({{html_url}}) - {{title}} ({{accuracy}}% similar) + {{/issues}} + + Please review the linked issue(s) to see if they address your concern. If this is not a duplicate, please provide additional context to help us understand the difference. diff --git a/.github/workflows/label-component.yml b/.github/workflows/label-component.yml index 76b8316790..fd079fce6c 100644 --- a/.github/workflows/label-component.yml +++ b/.github/workflows/label-component.yml @@ -80,3 +80,37 @@ jobs: break; } } + + // Check for 'claude code' keyword (can be applied alongside component labels) + if (/claude code/i.test(body)) { + const claudeLabel = { + name: 'claude code', + color: '7c3aed', + description: 'Issues related to Claude Code usage' + }; + + try { + await github.rest.issues.getLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: claudeLabel.name + }); + } catch (error) { + if (error.status === 404) { + await github.rest.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: claudeLabel.name, + color: claudeLabel.color, + description: claudeLabel.description + }); + } + } + + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: [claudeLabel.name] + }); + } diff --git a/.github/workflows/test-litellm.yml b/.github/workflows/test-litellm.yml index a38a29491e..ba32dc1bf5 100644 --- a/.github/workflows/test-litellm.yml +++ b/.github/workflows/test-litellm.yml @@ -35,6 +35,7 @@ jobs: poetry run pip install "google-cloud-aiplatform>=1.38" poetry run pip install "fastapi-offline==1.7.3" poetry run pip install "python-multipart==0.0.18" + poetry run pip install "openapi-core" - name: Setup litellm-enterprise as local package run: | cd enterprise diff --git a/.gitignore b/.gitignore index fafacd874a..9d9e28dc46 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ litellm/proxy/_super_secret_config.yaml litellm/proxy/myenv/bin/activate litellm/proxy/myenv/bin/Activate.ps1 myenv/* +litellm/proxy/_experimental/out/_next/ litellm/proxy/_experimental/out/404/index.html litellm/proxy/_experimental/out/model_hub/index.html litellm/proxy/_experimental/out/onboarding/index.html diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md new file mode 100644 index 0000000000..c114a838d6 --- /dev/null +++ b/ARCHITECTURE.md @@ -0,0 +1,398 @@ +# LiteLLM Architecture - LiteLLM SDK + AI Gateway + +This document helps contributors understand where to make changes in LiteLLM. + +--- + +## How It Works + +The LiteLLM AI Gateway (Proxy) uses the LiteLLM SDK internally for all LLM calls: + +``` +OpenAI SDK (client) ──▶ LiteLLM AI Gateway (proxy/) ──▶ LiteLLM SDK (litellm/) ──▶ LLM API +Anthropic SDK (client) ──▶ LiteLLMAI Gateway (proxy/) ──▶ LiteLLM SDK (litellm/) ──▶ LLM API +Any HTTP client ──▶ LiteLLMAI Gateway (proxy/) ──▶ LiteLLM SDK (litellm/) ──▶ LLM API +``` + +The **AI Gateway** adds authentication, rate limiting, budgets, and routing on top of the SDK. +The **SDK** handles the actual LLM provider calls, request/response transformations, and streaming. + +--- + +## 1. AI Gateway (Proxy) Request Flow + +The AI Gateway (`litellm/proxy/`) wraps the SDK with authentication, rate limiting, and management features. + +```mermaid +sequenceDiagram + participant Client + participant ProxyServer as proxy/proxy_server.py + participant Auth as proxy/auth/user_api_key_auth.py + participant Redis as Redis Cache + participant Hooks as proxy/hooks/ + participant Router as router.py + participant Main as main.py + utils.py + participant Handler as llms/custom_httpx/llm_http_handler.py + participant Transform as llms/{provider}/chat/transformation.py + participant Provider as LLM Provider API + participant CostCalc as cost_calculator.py + participant LoggingObj as litellm_logging.py + participant DBWriter as db/db_spend_update_writer.py + participant Postgres as PostgreSQL + + %% Request Flow + Client->>ProxyServer: POST /v1/chat/completions + ProxyServer->>Auth: user_api_key_auth() + Auth->>Redis: Check API key cache + Redis-->>Auth: Key info + spend limits + ProxyServer->>Hooks: max_budget_limiter, parallel_request_limiter + Hooks->>Redis: Check/increment rate limit counters + ProxyServer->>Router: route_request() + Router->>Main: litellm.acompletion() + Main->>Handler: BaseLLMHTTPHandler.completion() + Handler->>Transform: ProviderConfig.transform_request() + Handler->>Provider: HTTP Request + Provider-->>Handler: Response + Handler->>Transform: ProviderConfig.transform_response() + Transform-->>Handler: ModelResponse + Handler-->>Main: ModelResponse + + %% Cost Attribution (in utils.py wrapper) + Main->>LoggingObj: update_response_metadata() + LoggingObj->>CostCalc: _response_cost_calculator() + CostCalc->>CostCalc: completion_cost(tokens × price) + CostCalc-->>LoggingObj: response_cost + LoggingObj-->>Main: Set response._hidden_params["response_cost"] + Main-->>ProxyServer: ModelResponse (with cost in _hidden_params) + + %% Response Headers + Async Logging + ProxyServer->>ProxyServer: Extract cost from hidden_params + ProxyServer->>LoggingObj: async_success_handler() + LoggingObj->>Hooks: async_log_success_event() + Hooks->>DBWriter: update_database(response_cost) + DBWriter->>Redis: Queue spend increment + DBWriter->>Postgres: Batch write spend logs (async) + ProxyServer-->>Client: ModelResponse + x-litellm-response-cost header +``` + +### Proxy Components + +```mermaid +graph TD + subgraph "Incoming Request" + Client["POST /v1/chat/completions"] + end + + subgraph "proxy/proxy_server.py" + Endpoint["chat_completion()"] + end + + subgraph "proxy/auth/" + Auth["user_api_key_auth()"] + end + + subgraph "proxy/" + PreCall["litellm_pre_call_utils.py"] + RouteRequest["route_llm_request.py"] + end + + subgraph "litellm/" + Router["router.py"] + Main["main.py"] + end + + subgraph "Infrastructure" + DualCache["DualCache
(in-memory + Redis)"] + Postgres["PostgreSQL
(keys, teams, spend logs)"] + end + + Client --> Endpoint + Endpoint --> Auth + Auth --> DualCache + DualCache -.->|cache miss| Postgres + Auth --> PreCall + PreCall --> RouteRequest + RouteRequest --> Router + Router --> DualCache + Router --> Main + Main --> Client +``` + +**Key proxy files:** +- `proxy/proxy_server.py` - Main API endpoints +- `proxy/auth/` - Authentication (API keys, JWT, OAuth2) +- `proxy/hooks/` - Proxy-level callbacks +- `router.py` - Load balancing, fallbacks +- `router_strategy/` - Routing algorithms (`lowest_latency.py`, `simple_shuffle.py`, etc.) + +**LLM-specific proxy endpoints:** + +| Endpoint | Directory | Purpose | +|----------|-----------|---------| +| `/v1/messages` | `proxy/anthropic_endpoints/` | Anthropic Messages API | +| `/vertex-ai/*` | `proxy/vertex_ai_endpoints/` | Vertex AI passthrough | +| `/gemini/*` | `proxy/google_endpoints/` | Google AI Studio passthrough | +| `/v1/images/*` | `proxy/image_endpoints/` | Image generation | +| `/v1/batches` | `proxy/batches_endpoints/` | Batch processing | +| `/v1/files` | `proxy/openai_files_endpoints/` | File uploads | +| `/v1/fine_tuning` | `proxy/fine_tuning_endpoints/` | Fine-tuning jobs | +| `/v1/rerank` | `proxy/rerank_endpoints/` | Reranking | +| `/v1/responses` | `proxy/response_api_endpoints/` | OpenAI Responses API | +| `/v1/vector_stores` | `proxy/vector_store_endpoints/` | Vector stores | +| `/*` (passthrough) | `proxy/pass_through_endpoints/` | Direct provider passthrough | + +**Proxy Hooks** (`proxy/hooks/__init__.py`): + +| Hook | File | Purpose | +|------|------|---------| +| `max_budget_limiter` | `proxy/hooks/max_budget_limiter.py` | Enforce budget limits | +| `parallel_request_limiter` | `proxy/hooks/parallel_request_limiter_v3.py` | Rate limiting per key/user | +| `cache_control_check` | `proxy/hooks/cache_control_check.py` | Cache validation | +| `responses_id_security` | `proxy/hooks/responses_id_security.py` | Response ID validation | +| `litellm_skills` | `proxy/hooks/skills_injection.py` | Skills injection | + +To add a new proxy hook, implement `CustomLogger` and register in `PROXY_HOOKS`. + +### Infrastructure Components + +The AI Gateway uses external infrastructure for persistence and caching: + +```mermaid +graph LR + subgraph "AI Gateway (proxy/)" + Proxy["proxy_server.py"] + Auth["auth/user_api_key_auth.py"] + DBWriter["db/db_spend_update_writer.py
DBSpendUpdateWriter"] + InternalCache["utils.py
InternalUsageCache"] + CostCallback["hooks/proxy_track_cost_callback.py
_ProxyDBLogger"] + Scheduler["APScheduler
ProxyStartupEvent"] + end + + subgraph "SDK (litellm/)" + Router["router.py
Router.cache (DualCache)"] + LLMCache["caching/caching_handler.py
LLMCachingHandler"] + CacheClass["caching/caching.py
Cache"] + end + + subgraph "Redis (caching/redis_cache.py)" + RateLimit["Rate Limit Counters"] + SpendQueue["Spend Increment Queue"] + KeyCache["API Key Cache"] + TPM_RPM["TPM/RPM Tracking"] + Cooldowns["Deployment Cooldowns"] + LLMResponseCache["LLM Response Cache"] + end + + subgraph "PostgreSQL (proxy/schema.prisma)" + Keys["LiteLLM_VerificationToken"] + Teams["LiteLLM_TeamTable"] + SpendLogs["LiteLLM_SpendLogs"] + Users["LiteLLM_UserTable"] + end + + Auth --> InternalCache + InternalCache --> KeyCache + InternalCache -.->|cache miss| Keys + InternalCache --> RateLimit + Router --> TPM_RPM + Router --> Cooldowns + LLMCache --> CacheClass + CacheClass --> LLMResponseCache + CostCallback --> DBWriter + DBWriter --> SpendQueue + DBWriter --> SpendLogs + Scheduler --> SpendLogs + Scheduler --> Keys +``` + +| Component | Purpose | Key Files/Classes | +|-----------|---------|-------------------| +| **Redis** | Rate limiting, API key caching, TPM/RPM tracking, cooldowns, LLM response caching, spend queuing | `caching/redis_cache.py` (`RedisCache`), `caching/dual_cache.py` (`DualCache`) | +| **PostgreSQL** | API keys, teams, users, spend logs | `proxy/utils.py` (`PrismaClient`), `proxy/schema.prisma` | +| **InternalUsageCache** | Proxy-level cache for rate limits + API keys (in-memory + Redis) | `proxy/utils.py` (`InternalUsageCache`) | +| **Router.cache** | TPM/RPM tracking, deployment cooldowns, client caching (in-memory + Redis) | `router.py` (`Router.cache: DualCache`) | +| **LLMCachingHandler** | SDK-level LLM response/embedding caching | `caching/caching_handler.py` (`LLMCachingHandler`), `caching/caching.py` (`Cache`) | +| **DBSpendUpdateWriter** | Batches spend updates to reduce DB writes | `proxy/db/db_spend_update_writer.py` (`DBSpendUpdateWriter`) | +| **Cost Tracking** | Calculates and logs response costs | `proxy/hooks/proxy_track_cost_callback.py` (`_ProxyDBLogger`) | + +**Background Jobs** (APScheduler, initialized in `proxy/proxy_server.py` → `ProxyStartupEvent.initialize_scheduled_background_jobs()`): + +| Job | Interval | Purpose | Key Files | +|-----|----------|---------|-----------| +| `update_spend` | 60s | Batch write spend logs to PostgreSQL | `proxy/db/db_spend_update_writer.py` | +| `reset_budget` | 10-12min | Reset budgets for keys/users/teams | `proxy/management_helpers/budget_reset_job.py` | +| `add_deployment` | 10s | Sync new model deployments from DB | `proxy/proxy_server.py` (`ProxyConfig`) | +| `cleanup_old_spend_logs` | cron/interval | Delete old spend logs | `proxy/management_helpers/spend_log_cleanup.py` | +| `check_batch_cost` | 30min | Calculate costs for batch jobs | `proxy/management_helpers/check_batch_cost_job.py` | +| `check_responses_cost` | 30min | Calculate costs for responses API | `proxy/management_helpers/check_responses_cost_job.py` | +| `process_rotations` | 1hr | Auto-rotate API keys | `proxy/management_helpers/key_rotation_manager.py` | +| `_run_background_health_check` | continuous | Health check model deployments | `proxy/proxy_server.py` | +| `send_weekly_spend_report` | weekly | Slack spend alerts | `proxy/utils.py` (`SlackAlerting`) | +| `send_monthly_spend_report` | monthly | Slack spend alerts | `proxy/utils.py` (`SlackAlerting`) | + +**Cost Attribution Flow:** +1. LLM response returns to `utils.py` wrapper after `litellm.acompletion()` completes +2. `update_response_metadata()` (`llm_response_utils/response_metadata.py`) is called +3. `logging_obj._response_cost_calculator()` (`litellm_logging.py`) calculates cost via `litellm.completion_cost()` (`cost_calculator.py`) +4. Cost is stored in `response._hidden_params["response_cost"]` +5. `proxy/common_request_processing.py` extracts cost from `hidden_params` and adds to response headers (`x-litellm-response-cost`) +6. `logging_obj.async_success_handler()` triggers callbacks including `_ProxyDBLogger.async_log_success_event()` +7. `DBSpendUpdateWriter.update_database()` queues spend increments to Redis +8. Background job `update_spend` flushes queued spend to PostgreSQL every 60s + +--- + +## 2. SDK Request Flow + +The SDK (`litellm/`) provides the core LLM calling functionality used by both direct SDK users and the AI Gateway. + +```mermaid +graph TD + subgraph "SDK Entry Points" + Completion["litellm.completion()"] + Messages["litellm.messages()"] + end + + subgraph "main.py" + Main["completion()
acompletion()"] + end + + subgraph "utils.py" + GetProvider["get_llm_provider()"] + end + + subgraph "llms/custom_httpx/" + Handler["llm_http_handler.py
BaseLLMHTTPHandler"] + HTTP["http_handler.py
HTTPHandler / AsyncHTTPHandler"] + end + + subgraph "llms/{provider}/chat/" + TransformReq["transform_request()"] + TransformResp["transform_response()"] + end + + subgraph "litellm_core_utils/" + Streaming["streaming_handler.py"] + end + + subgraph "integrations/ (async, off main thread)" + Callbacks["custom_logger.py
Langfuse, Datadog, etc."] + end + + Completion --> Main + Messages --> Main + Main --> GetProvider + GetProvider --> Handler + Handler --> TransformReq + TransformReq --> HTTP + HTTP --> Provider["LLM Provider API"] + Provider --> HTTP + HTTP --> TransformResp + TransformResp --> Streaming + Streaming --> Response["ModelResponse"] + Response -.->|async| Callbacks +``` + +**Key SDK files:** +- `main.py` - Entry points: `completion()`, `acompletion()`, `embedding()` +- `utils.py` - `get_llm_provider()` resolves model → provider +- `llms/custom_httpx/llm_http_handler.py` - Central HTTP orchestrator +- `llms/custom_httpx/http_handler.py` - Low-level HTTP client +- `llms/{provider}/chat/transformation.py` - Provider-specific transformations +- `litellm_core_utils/streaming_handler.py` - Streaming response handling +- `integrations/` - Async callbacks (Langfuse, Datadog, etc.) + +--- + +## 3. Translation Layer + +When a request comes in, it goes through a **translation layer** that converts between API formats. +Each translation is isolated in its own file, making it easy to test and modify independently. + +### Where to find translations + +| Incoming API | Provider | Translation File | +|--------------|----------|------------------| +| `/v1/chat/completions` | Anthropic | `llms/anthropic/chat/transformation.py` | +| `/v1/chat/completions` | Bedrock Converse | `llms/bedrock/chat/converse_transformation.py` | +| `/v1/chat/completions` | Bedrock Invoke | `llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py` | +| `/v1/chat/completions` | Gemini | `llms/gemini/chat/transformation.py` | +| `/v1/chat/completions` | Vertex AI | `llms/vertex_ai/gemini/transformation.py` | +| `/v1/chat/completions` | OpenAI | `llms/openai/chat/gpt_transformation.py` | +| `/v1/messages` (passthrough) | Anthropic | `llms/anthropic/experimental_pass_through/messages/transformation.py` | +| `/v1/messages` (passthrough) | Bedrock | `llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py` | +| `/v1/messages` (passthrough) | Vertex AI | `llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py` | +| Passthrough endpoints | All | `proxy/pass_through_endpoints/llm_provider_handlers/` | + +### Example: Debugging prompt caching + +If `/v1/messages` → Bedrock Converse prompt caching isn't working but Bedrock Invoke works: + +1. **Bedrock Converse translation**: `llms/bedrock/chat/converse_transformation.py` +2. **Bedrock Invoke translation**: `llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py` +3. Compare how each handles `cache_control` in `transform_request()` + +### How translations work + +Each provider has a `Config` class that inherits from `BaseConfig` (`llms/base_llm/chat/transformation.py`): + +```python +class ProviderConfig(BaseConfig): + def transform_request(self, model, messages, optional_params, litellm_params, headers): + # Convert OpenAI format → Provider format + return {"messages": transformed_messages, ...} + + def transform_response(self, model, raw_response, model_response, logging_obj, ...): + # Convert Provider format → OpenAI format + return ModelResponse(choices=[...], usage=Usage(...)) +``` + +The `BaseLLMHTTPHandler` (`llms/custom_httpx/llm_http_handler.py`) calls these methods - you never need to modify the handler itself. + +--- + +## 4. Adding/Modifying Providers + +### To add a new provider: + +1. Create `llms/{provider}/chat/transformation.py` +2. Implement `Config` class with `transform_request()` and `transform_response()` +3. Add tests in `tests/llm_translation/test_{provider}.py` + +### To add a feature (e.g., prompt caching): + +1. Find the translation file from the table above +2. Modify `transform_request()` to handle the new parameter +3. Add unit tests that verify the transformation + +### Testing checklist + +When adding a feature, verify it works across all paths: + +| Test | File Pattern | +|------|--------------| +| OpenAI passthrough | `tests/llm_translation/test_openai*.py` | +| Anthropic direct | `tests/llm_translation/test_anthropic*.py` | +| Bedrock Invoke | `tests/llm_translation/test_bedrock*.py` | +| Bedrock Converse | `tests/llm_translation/test_bedrock*converse*.py` | +| Vertex AI | `tests/llm_translation/test_vertex*.py` | +| Gemini | `tests/llm_translation/test_gemini*.py` | + +### Unit testing translations + +Translations are designed to be unit testable without making API calls: + +```python +from litellm.llms.bedrock.chat.converse_transformation import BedrockConverseConfig + +def test_prompt_caching_transform(): + config = BedrockConverseConfig() + result = config.transform_request( + model="anthropic.claude-3-opus", + messages=[{"role": "user", "content": "test", "cache_control": {"type": "ephemeral"}}], + optional_params={}, + litellm_params={}, + headers={} + ) + assert "cachePoint" in str(result) # Verify cache_control was translated +``` diff --git a/Makefile b/Makefile index 1614a58fc7..0da83c363c 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,7 @@ install-proxy-dev-ci: install-test-deps: install-proxy-dev poetry run pip install "pytest-retry==1.6.3" poetry run pip install pytest-xdist + poetry run pip install openapi-core cd enterprise && poetry run pip install -e . && cd .. install-helm-unittest: @@ -100,4 +101,4 @@ test-llm-translation-single: install-test-deps @mkdir -p test-results poetry run pytest tests/llm_translation/$(FILE) \ --junitxml=test-results/junit.xml \ - -v --tb=short --maxfail=100 --timeout=300 \ No newline at end of file + -v --tb=short --maxfail=100 --timeout=300 diff --git a/batch_small.jsonl b/batch_small.jsonl deleted file mode 100644 index 36792f79de..0000000000 --- a/batch_small.jsonl +++ /dev/null @@ -1,4 +0,0 @@ -{"custom_id": "request-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Hello, how are you?"}]}} -{"custom_id": "request-2", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "What is the weather today?"}]}} -{"custom_id": "request-3", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Tell me a short joke"}]}} - diff --git a/ci_cd/.grype.yaml b/ci_cd/.grype.yaml index e1068de8e3..642e2dd9d0 100644 --- a/ci_cd/.grype.yaml +++ b/ci_cd/.grype.yaml @@ -1,3 +1,3 @@ ignore: - - vulnerability: CVE-2019-1010022 - reason: no fixed glibc package is available yet in the Wolfi repositories, so this is ignored temporarily until an upstream release exists + - vulnerability: CVE-2026-22184 + reason: no fixed zlib package is available yet in the Wolfi repositories, so this is ignored temporarily until an upstream release exists diff --git a/ci_cd/security_scans.sh b/ci_cd/security_scans.sh index 17cf4c1817..9931730b7a 100755 --- a/ci_cd/security_scans.sh +++ b/ci_cd/security_scans.sh @@ -129,11 +129,14 @@ run_grype_scans() { "CVE-2025-13836" # Python 3.13 HTTP response reading OOM/DoS - no fix available in base image "CVE-2025-12084" # Python 3.13 xml.dom.minidom quadratic algorithm - no fix available in base image "CVE-2025-60876" # BusyBox wget HTTP request splitting - no fix available in Chainguard Wolfi base image + "CVE-2026-0861" # Wolfi glibc still flagged even on 2.42-r5; upstream patched build unavailable yet "CVE-2010-4756" # glibc glob DoS - awaiting patched Wolfi glibc build "CVE-2019-1010022" # glibc stack guard bypass - awaiting patched Wolfi glibc build "CVE-2019-1010023" # glibc ldd remap issue - awaiting patched Wolfi glibc build "CVE-2019-1010024" # glibc ASLR mitigation bypass - awaiting patched Wolfi glibc build "CVE-2019-1010025" # glibc pthread heap address leak - awaiting patched Wolfi glibc build + "CVE-2026-22184" # zlib untgz buffer overflow - untgz unused + no fixed Wolfi build yet + "GHSA-58pv-8j8x-9vj2" # jaraco.context path traversal - setuptools vendored only (v5.3.0), not used in application code (using v6.1.0+) ) # Build JSON array of allowlisted CVE IDs for jq diff --git a/cookbook/ai_coding_tool_guides/claude_code_quickstart/guide.md b/cookbook/ai_coding_tool_guides/claude_code_quickstart/guide.md new file mode 100644 index 0000000000..ad86c2b7b1 --- /dev/null +++ b/cookbook/ai_coding_tool_guides/claude_code_quickstart/guide.md @@ -0,0 +1,195 @@ +# Claude Code with LiteLLM Quickstart + +This guide shows how to call Claude models (and any LiteLLM-supported model) through LiteLLM proxy from Claude Code. + +> **Note:** This integration is based on [Anthropic's official LiteLLM configuration documentation](https://docs.anthropic.com/en/docs/claude-code/llm-gateway#litellm-configuration). It allows you to use any LiteLLM supported model through Claude Code with centralized authentication, usage tracking, and cost controls. + +## Video Walkthrough + +Watch the full tutorial: https://www.loom.com/embed/3c17d683cdb74d36a3698763cc558f56 + +## Prerequisites + +- [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) installed +- API keys for your chosen providers + +## Installation + +First, install LiteLLM with proxy support: + +```bash +pip install 'litellm[proxy]' +``` + +## Step 1: Setup config.yaml + +Create a secure configuration using environment variables: + +```yaml +model_list: + # Claude models + - model_name: claude-3-5-sonnet-20241022 + litellm_params: + model: anthropic/claude-3-5-sonnet-20241022 + api_key: os.environ/ANTHROPIC_API_KEY + + - model_name: claude-3-5-haiku-20241022 + litellm_params: + model: anthropic/claude-3-5-haiku-20241022 + api_key: os.environ/ANTHROPIC_API_KEY + + +litellm_settings: + master_key: os.environ/LITELLM_MASTER_KEY +``` + +Set your environment variables: + +```bash +export ANTHROPIC_API_KEY="your-anthropic-api-key" +export LITELLM_MASTER_KEY="sk-1234567890" # Generate a secure key +``` + +## Step 2: Start Proxy + +```bash +litellm --config /path/to/config.yaml + +# RUNNING on http://0.0.0.0:4000 +``` + +## Step 3: Verify Setup + +Test that your proxy is working correctly: + +```bash +curl -X POST http://0.0.0.0:4000/v1/messages \ +-H "Authorization: Bearer $LITELLM_MASTER_KEY" \ +-H "Content-Type: application/json" \ +-d '{ + "model": "claude-3-5-sonnet-20241022", + "max_tokens": 1000, + "messages": [{"role": "user", "content": "What is the capital of France?"}] +}' +``` + +## Step 4: Configure Claude Code + +### Method 1: Unified Endpoint (Recommended) + +Configure Claude Code to use LiteLLM's unified endpoint. Either a virtual key or master key can be used here: + +```bash +export ANTHROPIC_BASE_URL="http://0.0.0.0:4000" +export ANTHROPIC_AUTH_TOKEN="$LITELLM_MASTER_KEY" +``` + +> **Tip:** LITELLM_MASTER_KEY gives Claude access to all proxy models, whereas a virtual key would be limited to the models set in the UI. + +### Method 2: Provider-specific Pass-through Endpoint + +Alternatively, use the Anthropic pass-through endpoint: + +```bash +export ANTHROPIC_BASE_URL="http://0.0.0.0:4000/anthropic" +export ANTHROPIC_AUTH_TOKEN="$LITELLM_MASTER_KEY" +``` + +## Step 5: Use Claude Code + +Start Claude Code and it will automatically use your configured models: + +```bash +# Claude Code will use the models configured in your LiteLLM proxy +claude + +# Or specify a model if you have multiple configured +claude --model claude-3-5-sonnet-20241022 +claude --model claude-3-5-haiku-20241022 +``` + +## Troubleshooting + +Common issues and solutions: + +**Claude Code not connecting:** +- Verify your proxy is running: `curl http://0.0.0.0:4000/health` +- Check that `ANTHROPIC_BASE_URL` is set correctly +- Ensure your `ANTHROPIC_AUTH_TOKEN` matches your LiteLLM master key + +**Authentication errors:** +- Verify your environment variables are set: `echo $LITELLM_MASTER_KEY` +- Check that your API keys are valid and have sufficient credits +- Ensure the `ANTHROPIC_AUTH_TOKEN` matches your LiteLLM master key + +**Model not found:** +- Ensure the model name in Claude Code matches exactly with your `config.yaml` +- Check LiteLLM logs for detailed error messages + +## Using Multiple Models and Providers + +Expand your configuration to support multiple providers and models: + +```yaml +model_list: + # OpenAI models + - model_name: codex-mini + litellm_params: + model: openai/codex-mini + api_key: os.environ/OPENAI_API_KEY + api_base: https://api.openai.com/v1 + + - model_name: o3-pro + litellm_params: + model: openai/o3-pro + api_key: os.environ/OPENAI_API_KEY + api_base: https://api.openai.com/v1 + + - model_name: gpt-4o + litellm_params: + model: openai/gpt-4o + api_key: os.environ/OPENAI_API_KEY + api_base: https://api.openai.com/v1 + + # Anthropic models + - model_name: claude-3-5-sonnet-20241022 + litellm_params: + model: anthropic/claude-3-5-sonnet-20241022 + api_key: os.environ/ANTHROPIC_API_KEY + + - model_name: claude-3-5-haiku-20241022 + litellm_params: + model: anthropic/claude-3-5-haiku-20241022 + api_key: os.environ/ANTHROPIC_API_KEY + + # AWS Bedrock + - model_name: claude-bedrock + litellm_params: + model: bedrock/anthropic.claude-3-5-sonnet-20241022-v2:0 + aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID + aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY + aws_region_name: us-east-1 + +litellm_settings: + master_key: os.environ/LITELLM_MASTER_KEY +``` + +Switch between models seamlessly: + +```bash +# Use Claude for complex reasoning +claude --model claude-3-5-sonnet-20241022 + +# Use Haiku for fast responses +claude --model claude-3-5-haiku-20241022 + +# Use Bedrock deployment +claude --model claude-bedrock +``` + +## Additional Resources + +- [LiteLLM Documentation](https://docs.litellm.ai/) +- [Claude Code Documentation](https://docs.anthropic.com/en/docs/claude-code/overview) +- [Anthropic's LiteLLM Configuration Guide](https://docs.anthropic.com/en/docs/claude-code/llm-gateway#litellm-configuration) + diff --git a/cookbook/ai_coding_tool_guides/index.json b/cookbook/ai_coding_tool_guides/index.json new file mode 100644 index 0000000000..f879292aef --- /dev/null +++ b/cookbook/ai_coding_tool_guides/index.json @@ -0,0 +1,134 @@ +[{ + "title": "Claude Code Quickstart", + "description": "This is a quickstart guide to using Claude Code with LiteLLM.", + "url": "https://docs.litellm.ai/docs/tutorials/claude_responses_api", + "date": "2026-01-15", + "version": "1.0.0", + "tags": [ + "Claude Code", + "LiteLLM" + ] +}, +{ + "title": "Claude Code with MCPs", + "description": "This is a guide to using Claude Code with MCPs via LiteLLM Proxy.", + "url": "https://docs.litellm.ai/docs/tutorials/claude_mcp", + "date": "2026-01-15", + "version": "1.0.0", + "tags": [ + "Claude Code", + "LiteLLM", + "MCP" + ] +}, +{ + "title": "Claude Code with Non-Anthropic Models", + "description": "This is a guide to using Claude Code with non-Anthropic models via LiteLLM Proxy.", + "url": "https://docs.litellm.ai/docs/tutorials/claude_non_anthropic_models", + "date": "2026-01-16", + "version": "1.0.0", + "tags": [ + "Claude Code", + "LiteLLM", + "OpenAI", + "Gemini" + ] +}, +{ + "title": "Cursor Quickstart", + "description": "This is a quickstart guide to using Cursor with LiteLLM.", + "url": "https://docs.litellm.ai/docs/tutorials/cursor_integration", + "date": "2026-01-16", + "version": "1.0.0", + "tags": [ + "Cursor", + "LiteLLM", + "Quickstart" + ] +}, +{ + "title": "Github Copilot Quickstart", + "description": "This is a quickstart guide to using Github Copilot with LiteLLM.", + "url": "https://docs.litellm.ai/docs/tutorials/github_copilot_integration", + "date": "2026-01-16", + "version": "1.0.0", + "tags": [ + "Github Copilot", + "LiteLLM", + "Quickstart" + ] +}, +{ + "title": "LiteLLM Gemini CLI Quickstart", + "description": "This is a quickstart guide to using LiteLLM Gemini CLI.", + "url": "https://docs.litellm.ai/docs/tutorials/litellm_gemini_cli", + "date": "2026-01-16", + "version": "1.0.0", + "tags": [ + "Gemini CLI", + "Gemini", + "LiteLLM", + "Quickstart" + ] +}, +{ + "title": "OpenAI Codex CLI Quickstart", + "description": "This is a quickstart guide to using OpenAI Codex CLI.", + "url": "https://docs.litellm.ai/docs/tutorials/openai_codex", + "date": "2026-01-16", + "version": "1.0.0", + "tags": [ + "OpenAI Codex CLI", + "OpenAI", + "LiteLLM", + "Quickstart" + ] +}, +{ + "title": "OpenWebUI Quickstart", + "description": "This is a quickstart guide to using OpenWebUI with LiteLLM.", + "url": "https://docs.litellm.ai/docs/tutorials/openweb_ui", + "date": "2026-01-16", + "version": "1.0.0", + "tags": [ + "OpenWebUI", + "LiteLLM", + "Quickstart" + ] +}, +{ + "title": "AI Coding Tool Usage Tracking", + "description": "This is a guide to tracking usage for AI coding tools monitor the use of Claude Code , Google Antigravity, OpenAI Codex, Roo Code etc. through LiteLLM.", + "url": "https://docs.litellm.ai/docs/tutorials/cost_tracking_coding", + "date": "2026-01-17", + "version": "1.0.0", + "tags": [ + "Claude Code", + "Gemini CLI", + "OpenAI Codex", + "LiteLLM" + ] +}, +{ + "title": "Use Web Search with Claude Code (across OpenAI/Anthropic/Gemini/etc.)", + "description": "This is a guide for using Web Search with Claude Code via LiteLLM.", + "url": "https://docs.litellm.ai/docs/tutorials/claude_code_websearch", + "date": "2026-01-17", + "version": "1.0.0", + "tags": [ + "Claude Code", + "LiteLLM", + "Web Search" + ] +}, +{ + "title": "Track Claude Code Usage per user via Custom Headers", + "description": "This is a guide for tracking claude code user usage by passing a customer ID header.", + "url": "https://docs.litellm.ai/docs/tutorials/claude_code_customer_tracking", + "date": "2026-01-17", + "version": "1.0.0", + "tags": [ + "Claude Code", + "LiteLLM" + ] +}] \ No newline at end of file diff --git a/deploy/charts/litellm-helm/templates/deployment.yaml b/deploy/charts/litellm-helm/templates/deployment.yaml index 19fa047909..682d97ae3b 100644 --- a/deploy/charts/litellm-helm/templates/deployment.yaml +++ b/deploy/charts/litellm-helm/templates/deployment.yaml @@ -170,7 +170,8 @@ spec: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: - name: litellm-config - mountPath: /etc/litellm/ + mountPath: /etc/litellm/config.yaml + subPath: config.yaml {{ if .Values.securityContext.readOnlyRootFilesystem }} - name: tmp mountPath: /tmp diff --git a/deploy/charts/litellm-helm/tests/deployment_tests.yaml b/deploy/charts/litellm-helm/tests/deployment_tests.yaml index 182a236239..f1229e1023 100644 --- a/deploy/charts/litellm-helm/tests/deployment_tests.yaml +++ b/deploy/charts/litellm-helm/tests/deployment_tests.yaml @@ -136,7 +136,8 @@ tests: path: spec.template.spec.containers[0].volumeMounts content: name: litellm-config - mountPath: /etc/litellm/ + mountPath: /etc/litellm/config.yaml + subPath: config.yaml - it: should work with lifecycle hooks template: deployment.yaml set: diff --git a/docs/my-website/docs/caching/all_caches.md b/docs/my-website/docs/caching/all_caches.md index 0548c331f8..37fb8bc360 100644 --- a/docs/my-website/docs/caching/all_caches.md +++ b/docs/my-website/docs/caching/all_caches.md @@ -105,6 +105,14 @@ Then simply initialize: litellm.cache = Cache(type="redis") ``` +:::info +Use `REDIS_*` environment variables as the primary mechanism for configuring all Redis client library parameters. This approach automatically maps environment variables to Redis client kwargs and is the suggested way to toggle Redis settings. +::: + +:::warning +If you need to pass non-string Redis parameters (integers, booleans, complex objects), avoid `REDIS_*` environment variables as they may fail during Redis client initialization. Instead, pass them directly as kwargs to the `Cache()` constructor. +::: + diff --git a/docs/my-website/docs/image_generation.md b/docs/my-website/docs/image_generation.md index b4eaef3652..7f27f48f91 100644 --- a/docs/my-website/docs/image_generation.md +++ b/docs/my-website/docs/image_generation.md @@ -15,7 +15,7 @@ import TabItem from '@theme/TabItem'; | Fallbacks | ✅ | Works between supported models | | Loadbalancing | ✅ | Works between supported models | | Guardrails | ✅ | Applies to input prompts (non-streaming only) | -| Supported Providers | OpenAI, Azure, Google AI Studio, Vertex AI, AWS Bedrock, Recraft, Xinference, Nscale | | +| Supported Providers | OpenAI, Azure, Google AI Studio, Vertex AI, AWS Bedrock, Recraft, OpenRouter, Xinference, Nscale | | ## Quick Start @@ -238,6 +238,27 @@ print(response) See Recraft usage with LiteLLM [here](./providers/recraft.md#image-generation) +## OpenRouter Image Generation Models + +Use this for image generation models available through OpenRouter (e.g., Google Gemini image generation models) + +#### Usage + +```python showLineNumbers +from litellm import image_generation +import os + +os.environ['OPENROUTER_API_KEY'] = "your-api-key" + +response = image_generation( + model="openrouter/google/gemini-2.5-flash-image", + prompt="A beautiful sunset over a calm ocean", + size="1024x1024", + quality="high", +) +print(response) +``` + ## OpenAI Compatible Image Generation Models Use this for calling `/image_generation` endpoints on OpenAI Compatible Servers, example https://github.com/xorbitsai/inference @@ -301,5 +322,6 @@ print(f"response: {response}") | Vertex AI | [Vertex AI Image Generation →](./providers/vertex_image) | | AWS Bedrock | [Bedrock Image Generation →](./providers/bedrock) | | Recraft | [Recraft Image Generation →](./providers/recraft#image-generation) | +| OpenRouter | [OpenRouter Image Generation →](./providers/openrouter#image-generation) | | Xinference | [Xinference Image Generation →](./providers/xinference#image-generation) | | Nscale | [Nscale Image Generation →](./providers/nscale#image-generation) | \ No newline at end of file diff --git a/docs/my-website/docs/mcp.md b/docs/my-website/docs/mcp.md index d845860ff0..b7c1654dab 100644 --- a/docs/my-website/docs/mcp.md +++ b/docs/my-website/docs/mcp.md @@ -60,6 +60,8 @@ model_list: If `supported_db_objects` is not set, all object types are loaded from the database (default behavior). +For diagnosing connectivity problems after setup, see the [MCP Troubleshooting Guide](./mcp_troubleshoot.md). + @@ -326,6 +328,7 @@ litellm_settings: + ## Converting OpenAPI Specs to MCP Servers LiteLLM can automatically convert OpenAPI specifications into MCP servers, allowing you to expose any REST API as MCP tools. This is useful when you have existing APIs with OpenAPI/Swagger documentation and want to make them available as MCP tools. @@ -502,7 +505,7 @@ Your OpenAPI specification should follow standard OpenAPI/Swagger conventions: LiteLLM v 1.77.6 added support for OAuth 2.0 Client Credentials for MCP servers. -This configuration is currently available on the config.yaml, with UI support coming soon. +You can configure this either in `config.yaml` or directly from the LiteLLM UI (MCP Servers → Authentication → OAuth). ```yaml mcp_servers: @@ -1473,3 +1476,17 @@ async with stdio_client(server_params) as (read, write): + +## FAQ + +**Q: How do I use OAuth2 client_credentials (machine-to-machine) with MCP servers behind LiteLLM?** + +At the moment LiteLLM only forwards whatever `Authorization` header/value you configure for the MCP server; it does not issue OAuth2 tokens by itself. If your MCP requires the Client Credentials grant, obtain the access token directly from the authorization server and set that bearer token as the MCP server’s Authorization header value. LiteLLM does not yet fetch or refresh those machine-to-machine tokens on your behalf, but we plan to add first-class client_credentials support in a future release so the proxy can manage those tokens automatically. + +**Q: When I fetch an OAuth token from the LiteLLM UI, where is it stored?** + +The UI keeps only transient state in `sessionStorage` so the OAuth redirect flow can finish; the token is not persisted in the server or database. + +**Q: I'm seeing MCP connection errors—what should I check?** + +Walk through the [MCP Troubleshooting Guide](./mcp_troubleshoot.md) for step-by-step isolation (Client → LiteLLM vs. LiteLLM → MCP), log examples, and verification methods like MCP Inspector and `curl`. diff --git a/docs/my-website/docs/mcp_troubleshoot.md b/docs/my-website/docs/mcp_troubleshoot.md new file mode 100644 index 0000000000..27ba0e4d78 --- /dev/null +++ b/docs/my-website/docs/mcp_troubleshoot.md @@ -0,0 +1,99 @@ +import Image from '@theme/IdealImage'; + +# MCP Troubleshooting Guide + +When LiteLLM acts as an MCP proxy, traffic normally flows `Client → LiteLLM Proxy → MCP Server`, while OAuth-enabled setups add an authorization server for metadata discovery. + +For provisioning steps, transport options, and configuration fields, refer to [mcp.md](./mcp.md). + +## Locate the Error Source + +Pin down where the failure occurs before adjusting settings so you do not mix symptoms from separate hops. + +### LiteLLM UI / Playground Errors (LiteLLM → MCP) +Failures shown on the MCP creation form or within the MCP Tool Testing Playground mean the LiteLLM proxy cannot reach the MCP server. Typical causes are misconfiguration (transport, headers, credentials), MCP/server outages, network/firewall blocks, or inaccessible OAuth metadata. + + + +
+ +**Actions** +- Capture LiteLLM proxy logs alongside MCP-server logs (see [Error Log Example](./mcp_troubleshoot#error-log-example-failed-mcp-call)) to inspect the request/response pair and stack traces. +- From the LiteLLM server, run Method 2 ([`curl` smoke test](./mcp_troubleshoot#curl-smoke-test)) against the MCP endpoint to confirm basic connectivity. + +### Client Traffic Issues (Client → LiteLLM) +If only real client requests fail, determine whether LiteLLM ever reaches the MCP hop. + +#### MCP Protocol Sessions +Clients such as IDEs or agent runtimes speak the MCP protocol directly with LiteLLM. + +**Actions** +- Inspect LiteLLM access logs (see [Access Log Example](./mcp_troubleshoot#access-log-example-successful-mcp-call)) to verify the client request reached the proxy and which MCP server it targeted. +- Review LiteLLM error logs (see [Error Log Example](./mcp_troubleshoot#error-log-example-failed-mcp-call)) for TLS, authentication, or routing errors that block the request before the MCP call starts. +- Use the [MCP Inspector](./mcp_troubleshoot#mcp-inspector) to confirm the MCP server is reachable outside of the failing client. + +#### Responses/Completions with Embedded MCP Calls +During `/responses` or `/chat/completions`, LiteLLM may trigger MCP tool calls mid-request. An error could occur before the MCP call begins or after the MCP responds. + +**Actions** +- Check LiteLLM request logs (see [Access Log Example](./mcp_troubleshoot#access-log-example-successful-mcp-call)) to see whether an MCP attempt was recorded; if not, the problem lies in `Client → LiteLLM`. +- Validate MCP connectivity with the [MCP Inspector](./mcp_troubleshoot#mcp-inspector) to ensure the server responds. +- Reproduce the same MCP call via the LiteLLM Playground to confirm LiteLLM can complete the MCP hop independently. + + + +### OAuth Metadata Discovery +LiteLLM performs metadata discovery per the MCP spec ([section 2.3](https://modelcontextprotocol.info/specification/draft/basic/authorization/#23-server-metadata-discovery)). When OAuth is enabled, confirm the authorization server exposes the metadata URL and that LiteLLM can fetch it. + +**Actions** +- Use `curl ` (or similar) from the LiteLLM host to ensure the discovery document is reachable and contains the expected authorization/token endpoints. +- Record the exact metadata URL, requested scopes, and any static client credentials so support can replay the discovery step if needed. + +## Verify Connectivity + +Run lightweight validations before impacting production traffic. + +### MCP Inspector +Use the MCP Inspector when you need to test both `Client → LiteLLM` and `Client → MCP` communications in one place; it makes isolating the failing hop straightforward. + +1. Execute `npx @modelcontextprotocol/inspector` on your workstation. +2. Configure and connect: + - **Transport Type:** choose the transport the client uses (Streamable HTTP for LiteLLM). + - **URL:** the endpoint under test (LiteLLM MCP URL for `Client → LiteLLM`, or the MCP server URL for `Client → MCP`). + - **Custom Headers:** e.g., `Authorization: Bearer `. +3. Open the **Tools** tab and click **List Tools** to verify the MCP alias responds. + +### `curl` Smoke Test +`curl` is ideal on servers where installing the Inspector is impractical. It replicates the MCP tool call LiteLLM would make—swap in the domain of the system under test (LiteLLM or the MCP server). + +```bash +curl -X POST https://your-target-domain.example.com/mcp \ + -H "Content-Type: application/json" \ + -H "Accept: application/json, text/event-stream" \ + -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' +``` + +Add `-H "Authorization: Bearer "` when the target is a LiteLLM endpoint that requires authentication. Adjust the headers, or payload to target other MCP methods. Matching failures between `curl` and LiteLLM confirm that the MCP server or network/OAuth layer is the culprit. + +## Review Logs + +Well-scoped logs make it clear whether LiteLLM reached the MCP server and what happened next. + +### Access Log Example (successful MCP call) +```text +INFO: 127.0.0.1:57230 - "POST /everything/mcp HTTP/1.1" 200 OK +``` + +### Error Log Example (failed MCP call) +```text +07:22:00 - LiteLLM:ERROR: client.py:224 - MCP client list_tools failed - Error Type: ExceptionGroup, Error: unhandled errors in a TaskGroup (1 sub-exception), Server: http://localhost:3001/mcp, Transport: MCPTransport.http + httpcore.ConnectError: All connection attempts failed +ERROR:LiteLLM:MCP client list_tools failed - Error Type: ExceptionGroup, Error: unhandled errors in a TaskGroup (1 sub-exception)... + httpx.ConnectError: All connection attempts failed +``` diff --git a/docs/my-website/docs/observability/logfire_integration.md b/docs/my-website/docs/observability/logfire_integration.md index b75c5bfd49..a1bd43a4bc 100644 --- a/docs/my-website/docs/observability/logfire_integration.md +++ b/docs/my-website/docs/observability/logfire_integration.md @@ -40,6 +40,10 @@ import os # from https://logfire.pydantic.dev/ os.environ["LOGFIRE_TOKEN"] = "" +# Optionally customize the base url +# from https://logfire.pydantic.dev/ +os.environ["LOGFIRE_BASE_URL"] = "" + # LLM API Keys os.environ['OPENAI_API_KEY']="" diff --git a/docs/my-website/docs/providers/azure_ai/azure_model_router.md b/docs/my-website/docs/providers/azure_ai/azure_model_router.md new file mode 100644 index 0000000000..5e14c7283f --- /dev/null +++ b/docs/my-website/docs/providers/azure_ai/azure_model_router.md @@ -0,0 +1,232 @@ +# Azure Model Router + +Azure Model Router is a feature in Azure AI Foundry that automatically routes your requests to the best available model based on your requirements. This allows you to use a single endpoint that intelligently selects the optimal model for each request. + +## Key Features + +- **Automatic Model Selection**: Azure Model Router dynamically selects the best model for your request +- **Cost Tracking**: LiteLLM automatically tracks costs based on the actual model used (e.g., `gpt-4.1-nano`), not the router endpoint +- **Streaming Support**: Full support for streaming responses with accurate cost calculation + +## LiteLLM Python SDK + +### Basic Usage + +```python +import litellm +import os + +response = litellm.completion( + model="azure_ai/azure-model-router", + messages=[{"role": "user", "content": "Hello!"}], + api_base="https://your-endpoint.cognitiveservices.azure.com/openai/v1/", + api_key=os.getenv("AZURE_MODEL_ROUTER_API_KEY"), +) + +print(response) +``` + +### Streaming with Usage Tracking + +```python +import litellm +import os + +response = await litellm.acompletion( + model="azure_ai/azure-model-router", + messages=[{"role": "user", "content": "hi"}], + api_base="https://your-endpoint.cognitiveservices.azure.com/openai/v1/", + api_key=os.getenv("AZURE_MODEL_ROUTER_API_KEY"), + stream=True, + stream_options={"include_usage": True}, +) + +async for chunk in response: + print(chunk) +``` + +## LiteLLM Proxy (AI Gateway) + +### config.yaml + +```yaml +model_list: + - model_name: azure-model-router + litellm_params: + model: azure_ai/azure-model-router + api_base: https://your-endpoint.cognitiveservices.azure.com/openai/v1/ + api_key: os.environ/AZURE_MODEL_ROUTER_API_KEY +``` + +### Start Proxy + +```bash +litellm --config config.yaml +``` + +### Test Request + +```bash +curl -X POST http://localhost:4000/chat/completions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer sk-1234" \ + -d '{ + "model": "azure-model-router", + "messages": [{"role": "user", "content": "Hello!"}] + }' +``` + +## Add Azure Model Router via LiteLLM UI + +This walkthrough shows how to add an Azure Model Router endpoint to LiteLLM using the Admin Dashboard. + +### Select Provider + +Navigate to the Models page and select "Azure AI Foundry (Studio)" as the provider. + +#### Navigate to Models Page + +![Navigate to Models](./img/azure_model_router_01.jpeg) + +#### Click Provider Dropdown + +![Click Provider](./img/azure_model_router_02.jpeg) + +#### Choose Azure AI Foundry + +![Select Azure AI Foundry](./img/azure_model_router_03.jpeg) + +### Configure Model Name + +Set up the model name by entering `azure_ai/` followed by your model router deployment name from Azure. + +#### Click Model Name Field + +![Click Model Field](./img/azure_model_router_04.jpeg) + +#### Select Custom Model Name + +![Select Custom Model](./img/azure_model_router_05.jpeg) + +#### Enter LiteLLM Model Name + +![LiteLLM Model Name](./img/azure_model_router_06.jpeg) + +#### Click Custom Model Name Field + +![Enter Custom Name Field](./img/azure_model_router_07.jpeg) + +#### Type Model Prefix + +Type `azure_ai/` as the prefix. + +![Type azure_ai prefix](./img/azure_model_router_08.jpeg) + +#### Copy Model Name from Azure Portal + +Switch to Azure AI Foundry and copy your model router deployment name. + +![Azure Portal Model Name](./img/azure_model_router_09.jpeg) + +![Copy Model Name](./img/azure_model_router_10.jpeg) + +#### Paste Model Name + +Paste to get `azure_ai/azure-model-router`. + +![Paste Model Name](./img/azure_model_router_11.jpeg) + +### Configure API Base and Key + +Copy the endpoint URL and API key from Azure portal. + +#### Copy API Base URL from Azure + +![Copy API Base](./img/azure_model_router_12.jpeg) + +#### Enter API Base in LiteLLM + +![Click API Base Field](./img/azure_model_router_13.jpeg) + +![Paste API Base](./img/azure_model_router_14.jpeg) + +#### Copy API Key from Azure + +![Copy API Key](./img/azure_model_router_15.jpeg) + +#### Enter API Key in LiteLLM + +![Enter API Key](./img/azure_model_router_16.jpeg) + +### Test and Add Model + +Verify your configuration works and save the model. + +#### Test Connection + +![Test Connection](./img/azure_model_router_17.jpeg) + +#### Close Test Dialog + +![Close Dialog](./img/azure_model_router_18.jpeg) + +#### Add Model + +![Add Model](./img/azure_model_router_19.jpeg) + +### Verify in Playground + +Test your model and verify cost tracking is working. + +#### Open Playground + +![Go to Playground](./img/azure_model_router_20.jpeg) + +#### Select Model + +![Select Model](./img/azure_model_router_21.jpeg) + +#### Send Test Message + +![Send Message](./img/azure_model_router_22.jpeg) + +#### View Logs + +![View Logs](./img/azure_model_router_23.jpeg) + +#### Verify Cost Tracking + +Cost is tracked based on the actual model used (e.g., `gpt-4.1-nano`). + +![Verify Cost](./img/azure_model_router_24.jpeg) + +## Cost Tracking + +LiteLLM automatically handles cost tracking for Azure Model Router by: + +1. **Detecting the actual model**: When Azure Model Router routes your request to a specific model (e.g., `gpt-4.1-nano-2025-04-14`), LiteLLM extracts this from the response +2. **Calculating accurate costs**: Costs are calculated based on the actual model used, not the router endpoint name +3. **Streaming support**: Cost tracking works correctly for both streaming and non-streaming requests + +### Example Response with Cost + +```python +import litellm + +response = litellm.completion( + model="azure_ai/azure-model-router", + messages=[{"role": "user", "content": "Hello!"}], + api_base="https://your-endpoint.cognitiveservices.azure.com/openai/v1/", + api_key="your-api-key", +) + +# The response will show the actual model used +print(f"Model used: {response.model}") # e.g., "gpt-4.1-nano-2025-04-14" + +# Get cost +from litellm import completion_cost +cost = completion_cost(completion_response=response) +print(f"Cost: ${cost}") +``` + + diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_01.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_01.jpeg new file mode 100644 index 0000000000..42654600f7 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_01.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_02.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_02.jpeg new file mode 100644 index 0000000000..b9feab050e Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_02.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_03.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_03.jpeg new file mode 100644 index 0000000000..3f55ebf012 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_03.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_04.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_04.jpeg new file mode 100644 index 0000000000..1626c78bd1 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_04.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_05.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_05.jpeg new file mode 100644 index 0000000000..bef736e361 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_05.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_06.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_06.jpeg new file mode 100644 index 0000000000..bfeb767eea Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_06.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_07.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_07.jpeg new file mode 100644 index 0000000000..eed742a8c6 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_07.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_08.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_08.jpeg new file mode 100644 index 0000000000..e72a6e92e7 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_08.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_09.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_09.jpeg new file mode 100644 index 0000000000..5fe1421c2a Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_09.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_10.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_10.jpeg new file mode 100644 index 0000000000..60aa80063f Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_10.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_11.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_11.jpeg new file mode 100644 index 0000000000..98694fbb9b Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_11.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_12.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_12.jpeg new file mode 100644 index 0000000000..77922ccea0 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_12.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_13.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_13.jpeg new file mode 100644 index 0000000000..2cb80d0826 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_13.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_14.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_14.jpeg new file mode 100644 index 0000000000..8225023658 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_14.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_15.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_15.jpeg new file mode 100644 index 0000000000..7bd7285288 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_15.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_16.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_16.jpeg new file mode 100644 index 0000000000..e3dbd75aca Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_16.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_17.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_17.jpeg new file mode 100644 index 0000000000..ba5fd53913 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_17.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_18.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_18.jpeg new file mode 100644 index 0000000000..1ead4bee96 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_18.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_19.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_19.jpeg new file mode 100644 index 0000000000..ec7fa9c3bc Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_19.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_20.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_20.jpeg new file mode 100644 index 0000000000..2999fcd678 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_20.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_21.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_21.jpeg new file mode 100644 index 0000000000..1226e29d64 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_21.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_22.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_22.jpeg new file mode 100644 index 0000000000..4455b552b8 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_22.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_23.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_23.jpeg new file mode 100644 index 0000000000..4fa88bdb96 Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_23.jpeg differ diff --git a/docs/my-website/docs/providers/azure_ai/img/azure_model_router_24.jpeg b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_24.jpeg new file mode 100644 index 0000000000..7fb61d1cce Binary files /dev/null and b/docs/my-website/docs/providers/azure_ai/img/azure_model_router_24.jpeg differ diff --git a/docs/my-website/docs/providers/chatgpt.md b/docs/my-website/docs/providers/chatgpt.md new file mode 100644 index 0000000000..156bbf99df --- /dev/null +++ b/docs/my-website/docs/providers/chatgpt.md @@ -0,0 +1,84 @@ +# ChatGPT Subscription + +Use ChatGPT Pro/Max subscription models through LiteLLM with OAuth device flow authentication. + +| Property | Details | +|-------|-------| +| Description | ChatGPT subscription access (Codex + GPT-5.2 family) via ChatGPT backend API | +| Provider Route on LiteLLM | `chatgpt/` | +| Supported Endpoints | `/responses`, `/chat/completions` (bridged to Responses for supported models) | +| API Reference | https://chatgpt.com | + +ChatGPT subscription access is native to the Responses API. Chat Completions requests are bridged to Responses for supported models (for example `chatgpt/gpt-5.2`). + +Notes: +- The ChatGPT subscription backend rejects token limit fields (`max_tokens`, `max_output_tokens`, `max_completion_tokens`) and `metadata`. LiteLLM strips these fields for this provider. +- `/v1/chat/completions` honors `stream`. When `stream` is false (default), LiteLLM aggregates the Responses stream into a single JSON response. + +## Authentication + +ChatGPT subscription access uses an OAuth device code flow: + +1. LiteLLM prints a device code and verification URL +2. Open the URL, sign in, and enter the code +3. Tokens are stored locally for reuse + +## Usage - LiteLLM Python SDK + +### Responses (recommended for Codex models) + +```python showLineNumbers title="ChatGPT Responses" +import litellm + +response = litellm.responses( + model="chatgpt/gpt-5.2-codex", + input="Write a Python hello world" +) + +print(response) +``` + +### Chat Completions (bridged to Responses) + +```python showLineNumbers title="ChatGPT Chat Completions" +import litellm + +response = litellm.completion( + model="chatgpt/gpt-5.2", + messages=[{"role": "user", "content": "Write a Python hello world"}] +) + +print(response) +``` + +## Usage - LiteLLM Proxy + +```yaml showLineNumbers title="config.yaml" +model_list: + - model_name: chatgpt/gpt-5.2 + model_info: + mode: responses + litellm_params: + model: chatgpt/gpt-5.2 + - model_name: chatgpt/gpt-5.2-codex + model_info: + mode: responses + litellm_params: + model: chatgpt/gpt-5.2-codex +``` + +```bash showLineNumbers title="Start LiteLLM Proxy" +litellm --config config.yaml +``` + +## Configuration + +### Environment Variables + +- `CHATGPT_TOKEN_DIR`: Custom token storage directory +- `CHATGPT_AUTH_FILE`: Auth file name (default: `auth.json`) +- `CHATGPT_API_BASE`: Override API base (default: `https://chatgpt.com/backend-api/codex`) +- `OPENAI_CHATGPT_API_BASE`: Alias for `CHATGPT_API_BASE` +- `CHATGPT_ORIGINATOR`: Override the `originator` header value +- `CHATGPT_USER_AGENT`: Override the `User-Agent` header value +- `CHATGPT_USER_AGENT_SUFFIX`: Optional suffix appended to the `User-Agent` header diff --git a/docs/my-website/docs/providers/openrouter.md b/docs/my-website/docs/providers/openrouter.md index a1ed6c4466..38eb998c98 100644 --- a/docs/my-website/docs/providers/openrouter.md +++ b/docs/my-website/docs/providers/openrouter.md @@ -93,3 +93,120 @@ response = embedding( ) print(response) ``` + +## Image Generation + +OpenRouter supports image generation through select models like Google Gemini image generation models. LiteLLM transforms standard image generation requests to OpenRouter's chat completion format. + +### Supported Parameters + +- `size`: Maps to OpenRouter's `aspect_ratio` format + - `1024x1024` → `1:1` (square) + - `1536x1024` → `3:2` (landscape) + - `1024x1536` → `2:3` (portrait) + - `1792x1024` → `16:9` (wide landscape) + - `1024x1792` → `9:16` (tall portrait) + +- `quality`: Maps to OpenRouter's `image_size` format (Gemini models) + - `low` or `standard` → `1K` + - `medium` → `2K` + - `high` or `hd` → `4K` + +- `n`: Number of images to generate + +### Usage + +```python +from litellm import image_generation +import os + +os.environ["OPENROUTER_API_KEY"] = "your-api-key" + +# Basic image generation +response = image_generation( + model="openrouter/google/gemini-2.5-flash-image", + prompt="A beautiful sunset over a calm ocean", +) +print(response) +``` + +### Advanced Usage with Parameters + +```python +from litellm import image_generation +import os + +os.environ["OPENROUTER_API_KEY"] = "your-api-key" + +# Generate high-quality landscape image +response = image_generation( + model="openrouter/google/gemini-2.5-flash-image", + prompt="A serene mountain landscape with a lake", + size="1536x1024", # Landscape format + quality="high", # High quality (4K) +) + +# Access the generated image +image_data = response.data[0] +if image_data.b64_json: + # Base64 encoded image + print(f"Generated base64 image: {image_data.b64_json[:50]}...") +elif image_data.url: + # Image URL + print(f"Generated image URL: {image_data.url}") +``` + +### Using OpenRouter-Specific Parameters + +You can also pass OpenRouter-specific parameters directly using `image_config`: + +```python +from litellm import image_generation +import os + +os.environ["OPENROUTER_API_KEY"] = "your-api-key" + +response = image_generation( + model="openrouter/google/gemini-2.5-flash-image", + prompt="A futuristic cityscape at night", + image_config={ + "aspect_ratio": "16:9", # OpenRouter native format + "image_size": "4K" # OpenRouter native format + } +) +print(response) +``` + +### Response Format + +The response follows the standard LiteLLM ImageResponse format: + +```python +{ + "created": 1703658209, + "data": [{ + "b64_json": "iVBORw0KGgoAAAANSUhEUgAA...", # Base64 encoded image + "url": None, + "revised_prompt": None + }], + "usage": { + "input_tokens": 10, + "output_tokens": 1290, + "total_tokens": 1300 + } +} +``` + +### Cost Tracking + +OpenRouter provides cost information in the response, which LiteLLM automatically tracks: + +```python +response = image_generation( + model="openrouter/google/gemini-2.5-flash-image", + prompt="A cute baby sea otter", +) + +# Cost is available in the response metadata +print(f"Request cost: ${response._hidden_params['additional_headers']['llm_provider-x-litellm-response-cost']}") +``` diff --git a/docs/my-website/docs/providers/sap.md b/docs/my-website/docs/providers/sap.md index 4bc72c2704..16f30a2e99 100644 --- a/docs/my-website/docs/providers/sap.md +++ b/docs/my-website/docs/providers/sap.md @@ -12,100 +12,340 @@ LiteLLM supports SAP Generative AI Hub's Orchestration Service. | Supported Endpoints | `/chat/completions`, `/embeddings` | | API Reference | [SAP AI Core Documentation](https://help.sap.com/docs/sap-ai-core) | +## Prerequisites + +Before you begin, ensure you have: + +1. **SAP BTP Account** with access to SAP AI Core +2. **AI Core Service Instance** provisioned in your subaccount +3. **Service Key** created for your AI Core instance (this contains your credentials) +4. **Resource Group** with deployed AI models (check with your SAP administrator) + +:::tip Where to Find Your Credentials +Your credentials come from the **Service Key** you create in SAP BTP Cockpit: + +1. Navigate to your **Subaccount** → **Instances and Subscriptions** +2. Find your **AI Core** instance and click on it +3. Go to **Service Keys** and create one (or use existing) +4. The JSON contains all values needed below + +The service key JSON looks like this: + +```json +{ + "clientid": "sb-abc123...", + "clientsecret": "xyz789...", + "url": "https://myinstance.authentication.eu10.hana.ondemand.com", + "serviceurls": { + "AI_API_URL": "https://api.ai.prod.eu-central-1.aws.ml.hana.ondemand.com" + } +} +``` + +:::info Resource Group +The resource group is typically configured separately in your AI Core deployment, not in the service key itself. You can set it via the `AICORE_RESOURCE_GROUP` environment variable (defaults to "default"). +::: + +## Quick Start + +### Step 1: Install LiteLLM + +```bash +pip install litellm +``` + +### Step 2: Set Your Credentials + +Choose **one** of these authentication methods: + + + + +The simplest approach - paste your entire service key as a single environment variable. The service key must be wrapped in a `credentials` object: + +```bash +export AICORE_SERVICE_KEY='{ + "credentials": { + "clientid": "your-client-id", + "clientsecret": "your-client-secret", + "url": "https://.authentication.sap.hana.ondemand.com", + "serviceurls": { + "AI_API_URL": "https://api.ai..aws.ml.hana.ondemand.com" + } + } +}' +export AICORE_RESOURCE_GROUP="default" +``` + + + + +Alternatively, instead of using the service key above, you could set each credential separately: + +```bash +export AICORE_AUTH_URL="https://.authentication.sap.hana.ondemand.com/oauth/token" +export AICORE_CLIENT_ID="your-client-id" +export AICORE_CLIENT_SECRET="your-client-secret" +export AICORE_RESOURCE_GROUP="default" +export AICORE_BASE_URL="https://api.ai..aws.ml.hana.ondemand.com/v2" +``` + + + + +### Step 3: Make Your First Request + +```python title="test_sap.py" +from litellm import completion + +response = completion( + model="sap/gpt-4o", + messages=[{"role": "user", "content": "Hello from LiteLLM!"}] +) +print(response.choices[0].message.content) +``` + +Run it: + +```bash +python test_sap.py +``` + +**Expected output:** + +```text +Hello! How can I assist you today? +``` + +### Step 4: Verify Your Setup (Optional) + +Test that everything is working with this diagnostic script: + +```python title="verify_sap_setup.py" +import os +import litellm + +# Enable debug logging to see what's happening +import os +os.environ["LITELLM_LOG"] = "DEBUG" + +# Either use AICORE_SERVICE_KEY (contains all credentials including resourcegroup) +# OR use individual variables (all required together) +individual_vars = ["AICORE_AUTH_URL", "AICORE_CLIENT_ID", "AICORE_CLIENT_SECRET", "AICORE_BASE_URL", "AICORE_RESOURCE_GROUP"] + +print("=== SAP Gen AI Hub Setup Verification ===\n") + +# Check for service key method +if os.environ.get("AICORE_SERVICE_KEY"): + print("✓ Using AICORE_SERVICE_KEY authentication (includes resource group)") +else: + # Check individual variables + missing = [v for v in individual_vars if not os.environ.get(v)] + if missing: + print(f"✗ Missing environment variables: {missing}") + else: + print("✓ Using individual variable authentication") + print(f"✓ Resource group: {os.environ.get('AICORE_RESOURCE_GROUP')}") + +# Test API connection +print("\n=== Testing API Connection ===\n") +try: + response = litellm.completion( + model="sap/gpt-4o", + messages=[{"role": "user", "content": "Say 'Connection successful!' and nothing else."}], + max_tokens=20 + ) + print(f"✓ API Response: {response.choices[0].message.content}") + print("\n🎉 Setup complete! You're ready to use SAP Gen AI Hub with LiteLLM.") +except Exception as e: + print(f"✗ API Error: {e}") + print("\nTroubleshooting tips:") + print(" 1. Verify your service key credentials are correct") + print(" 2. Check that 'gpt-4o' is deployed in your resource group") + print(" 3. Ensure your SAP AI Core instance is running") +``` + +Run the verification: + +```bash +python verify_sap_setup.py +``` + +**Expected output on success:** + +```text +=== SAP Gen AI Hub Setup Verification === + +✓ Using AICORE_SERVICE_KEY authentication +✓ Resource group: default + +=== Testing API Connection === + +✓ API Response: Connection successful! + +🎉 Setup complete! You're ready to use SAP Gen AI Hub with LiteLLM. +``` + ## Authentication -SAP Generative AI Hub uses service key authentication. You can provide credentials via: +SAP Generative AI Hub uses OAuth2 service keys for authentication. See [Quick Start](#quick-start) for setup instructions. -1. **Environment variable** - Set `AICORE_SERVICE_KEY` with your service key JSON -2. **Direct parameter** - Pass `api_key` with the service key JSON string +### Environment Variables Reference -```python showLineNumbers title="Environment Variable" -import os -os.environ["AICORE_SERVICE_KEY"] = '{"clientid": "...", "clientsecret": "...", ...}' +| Variable | Required | Description | +|----------|----------|-------------| +| `AICORE_SERVICE_KEY` | Yes* | Complete service key JSON (recommended method) | +| `AICORE_RESOURCE_GROUP` | Yes | Your AI Core resource group name | +| `AICORE_AUTH_URL` | Yes* | OAuth token URL (alternative to service key) | +| `AICORE_CLIENT_ID` | Yes* | OAuth client ID (alternative to service key) | +| `AICORE_CLIENT_SECRET` | Yes* | OAuth client secret (alternative to service key) | +| `AICORE_BASE_URL` | Yes* | AI Core API base URL (alternative to service key) | + +*Choose either `AICORE_SERVICE_KEY` OR the individual variables (`AICORE_AUTH_URL`, `AICORE_CLIENT_ID`, `AICORE_CLIENT_SECRET`, `AICORE_BASE_URL`). + +## Model Naming Conventions + +Understanding model naming is crucial for using SAP Gen AI Hub correctly. The naming pattern differs depending on whether you're using the SDK directly or through the proxy. + +### Direct SDK Usage + +When calling LiteLLM's SDK directly, you **must** include the `sap/` prefix in the model name: + +```python +# Correct - includes sap/ prefix +model="sap/gpt-4o" +model="sap/anthropic--claude-4.5-sonnet" +model="sap/gemini-2.5-pro" + +# Incorrect - missing prefix +model="gpt-4o" # ❌ Won't work ``` -3. **Environment variables** - Set the following list of credentials in .env file -
-AICORE_AUTH_URL = "https://* * * .authentication.sap.hana.ondemand.com/oauth/token",
-AICORE_CLIENT_ID  = " *** ",
-AICORE_CLIENT_SECRET = " *** ",
-AICORE_RESOURCE_GROUP = " *** ",
-AICORE_BASE_URL = "https://api.ai.***.cfapps.sap.hana.ondemand.com/v2"
-
-## Usage - LiteLLM Python SDK -```python showLineNumbers title="SAP Chat Completion" -from litellm import completion -import os +### Proxy Usage -os.environ["AICORE_SERVICE_KEY"] = '{"clientid": "...", "clientsecret": "...", ...}' +When using the LiteLLM Proxy, you use the **friendly `model_name`** defined in your configuration. The proxy automatically handles the `sap/` prefix routing. -response = completion( - model="sap/gpt-4", - messages=[{"role": "user", "content": "Hello from LiteLLM"}] +```yaml +# In config.yaml, define the mapping +model_list: + - model_name: gpt-4o # ← Use this name in client requests + litellm_params: + model: sap/gpt-4o # ← Proxy handles the sap/ prefix +``` + +```python +# Client request - no sap/ prefix needed +client.chat.completions.create( + model="gpt-4o", # ✓ Correct for proxy usage + messages=[...] ) -print(response) ``` -```python showLineNumbers title="SAP Chat Completion - Streaming" +### Anthropic Models Special Syntax + +Anthropic models use a double-dash (`--`) prefix convention: + +| Provider | Model Example | LiteLLM Format | +|----------|---------------|----------------| +| OpenAI | GPT-4o | `sap/gpt-4o` | +| Anthropic | Claude 4.5 Sonnet | `sap/anthropic--claude-4.5-sonnet` | +| Google | Gemini 2.5 Pro | `sap/gemini-2.5-pro` | +| Mistral | Mistral Large | `sap/mistral-large` | + +### Quick Reference Table + +| Usage Type | Model Format | Example | +|------------|--------------|---------| +| Direct SDK | `sap/` | `sap/gpt-4o` | +| Direct SDK (Anthropic) | `sap/anthropic--` | `sap/anthropic--claude-4.5-sonnet` | +| Proxy Client | `` | `gpt-4o` or `claude-sonnet` | + +## Using the Python SDK + +The LiteLLM Python SDK automatically detects your authentication method. Simply set your environment variables and make requests. + +```python showLineNumbers title="Basic Completion" from litellm import completion -import os - -os.environ["AICORE_SERVICE_KEY"] = '{"clientid": "...", "clientsecret": "...", ...}' +# Assumes AICORE_AUTH_URL, AICORE_CLIENT_ID, etc. are set response = completion( - model="sap/gpt-4", - messages=[{"role": "user", "content": "Hello from LiteLLM"}], - stream=True + model="sap/anthropic--claude-4.5-sonnet", + messages=[{"role": "user", "content": "Explain quantum computing"}] ) - -for chunk in response: - print(chunk.choices[0].delta.content or "", end="") +print(response.choices[0].message.content) ``` -```python showLineNumbers title="SAP Embedding" -from litellm import embedding -import os +Both authentication methods (individual variables or service key JSON) work automatically - no code changes required. -os.environ["AICORE_SERVICE_KEY"] = '{"clientid": "...", "clientsecret": "...", ...}' +## Using the Proxy Server -result = embedding( - model="sap/text-embedding-3-small", - input="Answer to the ultimate question of life, the universe, and everything is 42") -print(result.data[0]) -``` +The LiteLLM Proxy provides a unified OpenAI-compatible API for your SAP models. -## Usage - LiteLLM Proxy +### Configuration -Add to your LiteLLM Proxy config: +Create a `config.yaml` file in your project directory with your model mappings and credentials: ```yaml showLineNumbers title="config.yaml" model_list: - - model_name: "sap/*" + # OpenAI models + - model_name: gpt-5 litellm_params: - model: "sap/*" + model: sap/gpt-5 -general_settings: - master_key: your-proxy-api-key + # Anthropic models (note the double-dash) + - model_name: claude-sonnet + litellm_params: + model: sap/anthropic--claude-4.5-sonnet + - model_name: claude-opus + litellm_params: + model: sap/anthropic--claude-4.5-opus + + # Embeddings + - model_name: text-embedding-3-small + litellm_params: + model: sap/text-embedding-3-small + +litellm_settings: + drop_params: true + set_verbose: false + request_timeout: 600 + num_retries: 2 + forward_client_headers_to_llm_api: ["anthropic-version"] + +general_settings: + master_key: "sk-1234" # Enter here your desired master key starting with 'sk-'. + + # UI Admin is not required but helpful including the management of keys for your team(s). If you are using a database, these parameters are required: + database_url: "Enter you database URL." + UI_USERNAME: "Your desired UI admin account name" + UI_PASSWORD: "Your desired and strong pwd" + +# Authentication environment_variables: - AICORE_SERVICE_KEY: '{"clientid": "...", "clientsecret": "...", ...}' + AICORE_SERVICE_KEY: '{"credentials": {"clientid": "...", "clientsecret": "...", "url": "...", "serviceurls": {"AI_API_URL": "..."}}}' + AICORE_RESOURCE_GROUP: "default" ``` -Start the proxy: +### Starting the Proxy ```bash showLineNumbers title="Start Proxy" litellm --config config.yaml ``` +The proxy will start on `http://localhost:4000` by default. + +### Making Requests + ```bash showLineNumbers title="Test Request" curl http://localhost:4000/v1/chat/completions \ -H "Content-Type: application/json" \ - -H "Authorization: Bearer your-proxy-api-key" \ + -H "Authorization: Bearer sk-1234" \ -d '{ - "model": "sap/gpt-4", + "model": "gpt-4o", "messages": [{"role": "user", "content": "Hello"}] }' ``` @@ -118,11 +358,11 @@ from openai import OpenAI client = OpenAI( base_url="http://localhost:4000", - api_key="your-proxy-api-key" + api_key="sk-1234" ) response = client.chat.completions.create( - model="sap/gpt-4", + model="gpt-4o", messages=[{"role": "user", "content": "Hello"}] ) print(response.choices[0].message.content) @@ -134,12 +374,14 @@ print(response.choices[0].message.content) ```python showLineNumbers title="LiteLLM SDK" import os import litellm -os.environ["LITELLM_PROXY_API_KEY"] = "your-proxy-api-key" -litellm.use_litellm_proxy = True # it is important to set this parameter + +os.environ["LITELLM_PROXY_API_KEY"] = "sk-1234" +litellm.use_litellm_proxy = True + response = litellm.completion( - model="sap/gpt-4o", - messages=[{ "content": "Hello, how are you?","role": "user"}], - api_base="http://your-proxy-api-base" + model="claude-sonnet", + messages=[{"content": "Hello, how are you?", "role": "user"}], + api_base="http://localhost:4000" ) print(response) @@ -148,15 +390,170 @@ print(response) -## Supported Parameters +## Features -| Parameter | Description | -|-----------|-------------| -| `temperature` | Controls randomness | -| `max_tokens` | Maximum tokens in response | -| `top_p` | Nucleus sampling | -| `tools` | Function calling tools | -| `tool_choice` | Tool selection behavior | -| `response_format` | Output format (json_object, json_schema) | -| `stream` | Enable streaming | +### Streaming Responses +Stream responses in real-time for better user experience: + +```python showLineNumbers title="Streaming Chat Completion" +from litellm import completion + +response = completion( + model="sap/gpt-4o", + messages=[{"role": "user", "content": "Count from 1 to 10"}], + stream=True +) + +for chunk in response: + if chunk.choices[0].delta.content: + print(chunk.choices[0].delta.content, end="", flush=True) +``` + +### Structured Output + +#### JSON Schema (Recommended) + +Use JSON Schema for structured output with strict validation: + +```python showLineNumbers title="JSON Schema Response" +from litellm import completion + +response = completion( + model="sap/gpt-4o", + messages=[{ + "role": "user", + "content": "Generate info about Tokyo" + }], + response_format={ + "type": "json_schema", + "json_schema": { + "name": "city_info", + "schema": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "population": {"type": "number"}, + "country": {"type": "string"} + }, + "required": ["name", "population", "country"], + "additionalProperties": False + }, + "strict": True + } + } +) + +print(response.choices[0].message.content) +# Output: {"name":"Tokyo","population":37000000,"country":"Japan"} +``` + +#### JSON Object Format + +For flexible JSON output without schema validation: + +```python showLineNumbers title="JSON Object Response" +from litellm import completion + +response = completion( + model="sap/gpt-4o", + messages=[{ + "role": "user", + "content": "Generate a person object in JSON format with name and age" + }], + response_format={"type": "json_object"} +) + +print(response.choices[0].message.content) +``` + +:::note SAP Platform Requirement +When using `json_object` type, SAP's orchestration service requires the word "json" to appear in your prompt. This ensures explicit intent for JSON formatting. For schema-validated output without this requirement, use `json_schema` instead (recommended). +::: + +### Multi-turn Conversations + +Maintain conversation context across multiple turns: + +```python showLineNumbers title="Multi-turn Conversation" +from litellm import completion + +response = completion( + model="sap/gpt-4o", + messages=[ + {"role": "user", "content": "My name is Alice"}, + {"role": "assistant", "content": "Hello Alice! Nice to meet you."}, + {"role": "user", "content": "What is my name?"} + ] +) + +print(response.choices[0].message.content) +# Output: Your name is Alice. +``` + +### Embeddings + +Generate vector embeddings for semantic search and retrieval: + +```python showLineNumbers title="Create Embeddings" +from litellm import embedding + +response = embedding( + model="sap/text-embedding-3-small", + input=["Hello world", "Machine learning is fascinating"] +) + +print(response.data[0]["embedding"]) # Vector representation +``` + +## Reference + +### Supported Parameters + +| Parameter | Type | Description | +|-----------|------|-------------| +| `model` | string | Model identifier (with `sap/` prefix for SDK) | +| `messages` | array | Conversation messages | +| `temperature` | float | Controls randomness (0-2) | +| `max_tokens` | integer | Maximum tokens in response | +| `top_p` | float | Nucleus sampling threshold | +| `stream` | boolean | Enable streaming responses | +| `response_format` | object | Output format (`json_object`, `json_schema`) | +| `tools` | array | Function calling tool definitions | +| `tool_choice` | string/object | Tool selection behavior | + +### Supported Models + +For the complete and up-to-date list of available models provided by SAP Gen AI Hub, please refer to the [SAP AI Core Generative AI Hub documentation](https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/models-and-scenarios-in-generative-ai-hub). + +:::info Model Availability +Model availability varies by SAP deployment region and your subscription. Contact your SAP administrator to confirm which models are available in your environment. +::: + +### Troubleshooting + +**Authentication Errors** + +If you receive authentication errors: + +1. Verify all required environment variables are set correctly +2. Check that your service key hasn't expired +3. Confirm your resource group has access to the desired models +4. Ensure the `AICORE_AUTH_URL` and `AICORE_BASE_URL` match your SAP region + +**Model Not Found** + +If a model returns "not found": + +1. Verify the model is available in your SAP deployment +2. Check you're using the correct model name format (`sap/` prefix for SDK) +3. Confirm your resource group has access to that specific model +4. For Anthropic models, ensure you're using the `anthropic--` double-dash prefix + +**Rate Limiting** + +SAP Gen AI Hub enforces rate limits based on your subscription. If you hit limits: + +1. Implement exponential backoff retry logic +2. Consider using the proxy's built-in rate limiting features +3. Contact your SAP administrator to review quota allocations diff --git a/docs/my-website/docs/providers/stability.md b/docs/my-website/docs/providers/stability.md index 6b340267e6..62a8ab43cd 100644 --- a/docs/my-website/docs/providers/stability.md +++ b/docs/my-website/docs/providers/stability.md @@ -416,7 +416,6 @@ response = image_edit( image=open("original_image.png", "rb"), mask=open("mask_image.png", "rb"), prompt="Add flowers in the masked area", - size="1024x1024", ) print(response) ``` diff --git a/docs/my-website/docs/proxy/caching.md b/docs/my-website/docs/proxy/caching.md index 87e6a6fdb6..3cb9e9f3fe 100644 --- a/docs/my-website/docs/proxy/caching.md +++ b/docs/my-website/docs/proxy/caching.md @@ -282,6 +282,10 @@ Set either `REDIS_URL` or the `REDIS_HOST` in your os environment, to enable cac ``` **Additional kwargs** +:::info +Use `REDIS_*` environment variables to configure all Redis client library parameters. This is the suggested mechanism for toggling Redis settings as it automatically maps environment variables to Redis client kwargs. +::: + You can pass in any additional redis.Redis arg, by storing the variable + value in your os environment, like this: @@ -289,6 +293,17 @@ environment, like this: REDIS_ = "" ``` +For example: +```shell +REDIS_SSL = "True" +REDIS_SSL_CERT_REQS = "None" +REDIS_CONNECTION_POOL_KWARGS = '{"max_connections": 20}' +``` + +:::warning +**Note**: For non-string Redis parameters (like integers, booleans, or complex objects), avoid using `REDIS_*` environment variables as they may fail during Redis client initialization. Instead, use `cache_kwargs` in your router configuration for such parameters. +::: + [**See how it's read from the environment**](https://github.com/BerriAI/litellm/blob/4d7ff1b33b9991dcf38d821266290631d9bcd2dd/litellm/_redis.py#L40) #### Step 3: Run proxy with config diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md index 6c5c45dc90..b941f21b33 100644 --- a/docs/my-website/docs/proxy/config_settings.md +++ b/docs/my-website/docs/proxy/config_settings.md @@ -339,7 +339,7 @@ router_settings: | stream_timeout | Optional[float] | The default timeout for a streaming request. If not set, the 'timeout' value is used. | | debug_level | Literal["DEBUG", "INFO"] | The debug level for the logging library in the router. Defaults to "INFO". | | client_ttl | int | Time-to-live for cached clients in seconds. Defaults to 3600. | -| cache_kwargs | dict | Additional keyword arguments for the cache initialization. | +| cache_kwargs | dict | Additional keyword arguments for the cache initialization. Use this for non-string Redis parameters that may fail when set via `REDIS_*` environment variables. | | routing_strategy_args | dict | Additional keyword arguments for the routing strategy - e.g. lowest latency routing default ttl | | model_group_alias | dict | Model group alias mapping. E.g. `{"claude-3-haiku": "claude-3-haiku-20240229"}` | | num_retries | int | Number of retries for a request. Defaults to 3. | @@ -744,6 +744,7 @@ router_settings: | LITELLM_PRINT_STANDARD_LOGGING_PAYLOAD | If true, prints the standard logging payload to the console - useful for debugging | LITELM_ENVIRONMENT | Environment for LiteLLM Instance. This is currently only logged to DeepEval to determine the environment for DeepEval integration. | LOGFIRE_TOKEN | Token for Logfire logging service +| LOGFIRE_BASE_URL | Base URL for Logfire logging service (useful for self hosted deployments) | LOGGING_WORKER_CONCURRENCY | Maximum number of concurrent coroutine slots for the logging worker on the asyncio event loop. Default is 100. Setting too high will flood the event loop with logging tasks which will lower the overall latency of the requests. | LOGGING_WORKER_MAX_QUEUE_SIZE | Maximum size of the logging worker queue. When the queue is full, the worker aggressively clears tasks to make room instead of dropping logs. Default is 50,000 | LOGGING_WORKER_MAX_TIME_PER_COROUTINE | Maximum time in seconds allowed for each coroutine in the logging worker before timing out. Default is 20.0 @@ -754,6 +755,7 @@ router_settings: | LOGGING_WORKER_AGGRESSIVE_CLEAR_COOLDOWN_SECONDS | Cooldown time in seconds before allowing another aggressive clear operation when the queue is full. Default is 0.5 | MAX_STRING_LENGTH_PROMPT_IN_DB | Maximum length for strings in spend logs when sanitizing request bodies. Strings longer than this will be truncated. Default is 1000 | MAX_IN_MEMORY_QUEUE_FLUSH_COUNT | Maximum count for in-memory queue flush operations. Default is 1000 +| MAX_IMAGE_URL_DOWNLOAD_SIZE_MB | Maximum size in MB for downloading images from URLs. Prevents memory issues from downloading very large images. Images exceeding this limit will be rejected before download. Set to 0 to completely disable image URL handling (all image_url requests will be blocked). Default is 50MB (matching [OpenAI's limit](https://platform.openai.com/docs/guides/images-vision?api-mode=chat#image-input-requirements)) | MAX_LONG_SIDE_FOR_IMAGE_HIGH_RES | Maximum length for the long side of high-resolution images. Default is 2000 | MAX_REDIS_BUFFER_DEQUEUE_COUNT | Maximum count for Redis buffer dequeue operations. Default is 100 | MAX_SHORT_SIDE_FOR_IMAGE_HIGH_RES | Maximum length for the short side of high-resolution images. Default is 768 diff --git a/docs/my-website/docs/proxy/custom_pricing.md b/docs/my-website/docs/proxy/custom_pricing.md index b5fbd0b6c2..f6762f5e45 100644 --- a/docs/my-website/docs/proxy/custom_pricing.md +++ b/docs/my-website/docs/proxy/custom_pricing.md @@ -9,7 +9,6 @@ LiteLLM provides flexible cost tracking and pricing customization for all LLM pr - **Custom Pricing** - Override default model costs or set pricing for custom models - **Cost Per Token** - Track costs based on input/output tokens (most common) - **Cost Per Second** - Track costs based on runtime (e.g., Sagemaker) -- **Zero-Cost Models** - Bypass budget checks for free/on-premises models by setting costs to 0 - **[Provider Discounts](./provider_discounts.md)** - Apply percentage-based discounts to specific providers - **[Provider Margins](./provider_margins.md)** - Add fees/margins to LLM costs for internal billing - **Base Model Mapping** - Ensure accurate cost tracking for Azure deployments @@ -107,51 +106,6 @@ There are other keys you can use to specify costs for different scenarios and mo These keys evolve based on how new models handle multimodality. The latest version can be found at [https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json). -## Zero-Cost Models (Bypass Budget Checks) - -**Use Case**: You have on-premises or free models that should be accessible even when users exceed their budget limits. - -**Solution** ✅: Set both `input_cost_per_token` and `output_cost_per_token` to `0` (explicitly) to bypass all budget checks for that model. - -:::info - -When a model is configured with zero cost, LiteLLM will automatically skip ALL budget checks (user, team, team member, end-user, organization, and global proxy budget) for requests to that model. - -**Important**: Both costs must be **explicitly set to 0**. If costs are `null` or undefined, the model will be treated as having cost and budget checks will apply. - -::: - -### Configuration Example - -```yaml -model_list: - # On-premises model - free to use - - model_name: on-prem-llama - litellm_params: - model: ollama/llama3 - api_base: http://localhost:11434 - model_info: - input_cost_per_token: 0 # 👈 Explicitly set to 0 - output_cost_per_token: 0 # 👈 Explicitly set to 0 - - # Paid cloud model - budget checks apply - - model_name: gpt-4 - litellm_params: - model: gpt-4 - api_key: os.environ/OPENAI_API_KEY - # No model_info - uses default pricing from cost map -``` - -### Behavior - -With the above configuration: - -- **User over budget** → Can still use `on-prem-llama` ✅, but blocked from `gpt-4` ❌ -- **Team over budget** → Can still use `on-prem-llama` ✅, but blocked from `gpt-4` ❌ -- **End-user over budget** → Can still use `on-prem-llama` ✅, but blocked from `gpt-4` ❌ - -This ensures your free/on-premises models remain accessible regardless of budget constraints, while paid models are still properly governed. - ## Set 'base_model' for Cost Tracking (e.g. Azure deployments) **Problem**: Azure returns `gpt-4` in the response when `azure/gpt-4-1106-preview` is used. This leads to inaccurate cost tracking diff --git a/docs/my-website/docs/proxy/customer_usage.md b/docs/my-website/docs/proxy/customer_usage.md index 8e366586b1..5a6c06fdc8 100644 --- a/docs/my-website/docs/proxy/customer_usage.md +++ b/docs/my-website/docs/proxy/customer_usage.md @@ -22,19 +22,22 @@ Customer Usage enables you to track spend and usage for individual customers (en ## How to Track Spend -Track customer spend by including a `user` field in your API requests. The customer ID will be automatically tracked and associated with all spend from that request. +Track customer spend by including a `user` field in your API requests or by passing a customer ID header. The customer ID will be automatically tracked and associated with all spend from that request. -### Example using cURL + + + +### Using Request Body Make a `/chat/completions` call with the `user` field containing your customer ID: -```bash showLineNumbers title="Track spend with customer ID" +```bash showLineNumbers title="Track spend with customer ID in body" curl -X POST 'http://0.0.0.0:4000/chat/completions' \ --header 'Content-Type: application/json' \ - --header 'Authorization: Bearer sk-1234' \ # 👈 YOUR PROXY KEY + --header 'Authorization: Bearer sk-1234' \ --data '{ "model": "gpt-3.5-turbo", - "user": "customer-123", # 👈 CUSTOMER ID + "user": "customer-123", "messages": [ { "role": "user", @@ -44,7 +47,49 @@ curl -X POST 'http://0.0.0.0:4000/chat/completions' \ }' ``` -The customer ID (`customer-123`) will be automatically upserted into the database with the new spend. If the customer ID already exists, spend will be incremented. + + + +### Using Request Headers + +You can also pass the customer ID via HTTP headers. This is useful for tools that support custom headers but don't allow modifying the request body (like Claude Code with `ANTHROPIC_CUSTOM_HEADERS`). + +LiteLLM automatically recognizes these standard headers (no configuration required): +- `x-litellm-customer-id` +- `x-litellm-end-user-id` + +```bash showLineNumbers title="Track spend with customer ID in header" +curl -X POST 'http://0.0.0.0:4000/chat/completions' \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer sk-1234' \ + --header 'x-litellm-customer-id: customer-123' \ + --data '{ + "model": "gpt-3.5-turbo", + "messages": [ + { + "role": "user", + "content": "What is the capital of France?" + } + ] + }' +``` + +#### Using with Claude Code + +Claude Code supports custom headers via the `ANTHROPIC_CUSTOM_HEADERS` environment variable. Set it to pass your customer ID: + +```bash title="Configure Claude Code with customer tracking" +export ANTHROPIC_BASE_URL="http://0.0.0.0:4000/v1/messages" +export ANTHROPIC_API_KEY="sk-1234" +export ANTHROPIC_CUSTOM_HEADERS="x-litellm-customer-id: my-customer-id" +``` + +Now all requests from Claude Code will automatically track spend under `my-customer-id`. + + + + +The customer ID will be automatically upserted into the database with the new spend. If the customer ID already exists, spend will be incremented. ### Example using OpenWebUI diff --git a/docs/my-website/docs/proxy/deleted_keys_teams.md b/docs/my-website/docs/proxy/deleted_keys_teams.md new file mode 100644 index 0000000000..a4736ed5ed --- /dev/null +++ b/docs/my-website/docs/proxy/deleted_keys_teams.md @@ -0,0 +1,106 @@ +import Image from '@theme/IdealImage'; + +# Deleted Keys & Teams Audit Logs + + + +View deleted API keys and teams along with their spend and budget information at the time of deletion for auditing and compliance purposes. + +## Overview + +The Deleted Keys & Teams feature provides a comprehensive audit trail for deleted entities in your LiteLLM proxy. This feature was implemented to easily allow audits of which key or team was deleted along with the spend/budget at the time of deletion. + +When a key or team is deleted, LiteLLM automatically captures: + +- **Deletion timestamp** - When the entity was deleted +- **Deleted by** - Who performed the deletion action +- **Spend at deletion** - The total spend accumulated at the time of deletion +- **Original budget** - The budget that was set for the entity before deletion +- **Entity details** - Key or team identification information + +This information is preserved even after deletion, allowing you to maintain accurate financial records and audit trails for compliance purposes. + +## Viewing Deleted Keys + +### Step 1: Navigate to API Keys Page + +Navigate to the API Keys page in the LiteLLM UI: + +``` +http://localhost:4000/ui/?login=success&page=api-keys +``` + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-17/73b97ba9-0ab5-4140-aee2-05fa90463461/ascreenshot_5e6d9f05d452405c83d7a368349d087d_text_export.jpeg) + +### Step 2: Access Logs Section + +Click on the "Logs" menu item in the navigation. + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-17/73b97ba9-0ab5-4140-aee2-05fa90463461/ascreenshot_8ebab354b1e542e59e1082e519927edd_text_export.jpeg) + +### Step 3: View Deleted Keys + +Click on "Deleted Keys" to view the table of all deleted API keys. + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-17/00668558-9326-4a6f-8e87-159d54b17a72/ascreenshot_d0e50e49e9aa43d4a22ada6f12a78b12_text_export.jpeg) + +### Step 4: Review Deletion Information + +The Deleted Keys table includes comprehensive information about each deleted key: + +- **When** the key was deleted (timestamp) +- **Who** deleted the key (user/admin information) +- **Key identification** details + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-17/8538f7c4-634e-44c8-8d7d-fafbd6da0b02/ascreenshot_6b73f9c6a52d4e40a2368ef441cf6c8f_text_export.jpeg) + +### Step 5: View Financial Information + +The table also displays financial information captured at the time of deletion: + +- **Spend at deletion** - Total spend accumulated when the key was deleted +- **Original budget** - The budget limit that was set for the key + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-17/f8b03850-b17c-490c-a507-c3b0b6c050ab/ascreenshot_070b139f111844bba38fbed8835b097b_text_export.jpeg) + +## Viewing Deleted Teams + +### Step 1: Access Deleted Teams + +From the Logs section, click on "Deleted Teams" to view all deleted teams. + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-17/716ce26f-09af-4a6d-99c5-921d6b6a8555/ascreenshot_d36c16f1cf894340aa8bc20ada5922ac_text_export.jpeg) + +### Step 2: Review Team Deletion Information + +The Deleted Teams table provides detailed information about each deleted team: + +- **When** the team was deleted (timestamp) +- **Who** deleted the team (user/admin information) +- **Team identification** details + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-17/0a3f2d3f-179a-4ad7-916e-b77a13dca01d/ascreenshot_ded5970762d54528ae656421148116c4_text_export.jpeg) + +### Step 3: View Team Financial Information + +Similar to deleted keys, the Deleted Teams table shows financial information: + +- **Spend at deletion** - Total spend accumulated when the team was deleted +- **Original budget** - The budget limit that was set for the team + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-17/5b24871f-b57e-404d-8fbe-a4b27cb2a6a0/ascreenshot_3121fbafbd6b4abf90993ce6c03c608d_text_export.jpeg) + +## Use Cases + +This feature is particularly useful for: + +- **Financial Auditing** - Track spend and budgets for deleted entities +- **Compliance** - Maintain records of who deleted what and when +- **Cost Analysis** - Understand spending patterns before deletion +- **Accountability** - Identify which admin or user performed deletions +- **Historical Records** - Preserve financial data even after entity deletion + +## Related Features + +- [Audit Logs](./multiple_admins.md) - View comprehensive audit logs for all entity changes +- [UI Logs](./ui_logs.md) - View request logs and spend tracking diff --git a/docs/my-website/docs/proxy/fallback_management.md b/docs/my-website/docs/proxy/fallback_management.md new file mode 100644 index 0000000000..9e565fee13 --- /dev/null +++ b/docs/my-website/docs/proxy/fallback_management.md @@ -0,0 +1,267 @@ +# [New] Fallback Management Endpoints + +Dedicated endpoints for managing model fallbacks separately from the general configuration. + +## Overview + +These endpoints allow you to configure, retrieve, and delete fallback models without modifying the entire proxy configuration. This provides a cleaner and safer way to manage fallbacks compared to using the `/config/update` endpoint. + +## Prerequisites + +- Database storage must be enabled: Set `STORE_MODEL_IN_DB=True` in your environment +- Models must exist in the router before configuring fallbacks + +## Endpoints + +### POST /fallback + +Create or update fallbacks for a specific model. + +**Request Body:** +```json +{ + "model": "gpt-3.5-turbo", + "fallback_models": ["gpt-4", "claude-3-haiku"], + "fallback_type": "general" +} +``` + +**Parameters:** +- `model` (string, required): The primary model name to configure fallbacks for +- `fallback_models` (array of strings, required): List of fallback model names in priority order +- `fallback_type` (string, optional): Type of fallback. Options: + - `"general"` (default): Standard fallbacks for any error + - `"context_window"`: Fallbacks for context window exceeded errors + - `"content_policy"`: Fallbacks for content policy violations + +**Response:** +```json +{ + "model": "gpt-3.5-turbo", + "fallback_models": ["gpt-4", "claude-3-haiku"], + "fallback_type": "general", + "message": "Fallback configuration created successfully" +} +``` + +**Example using cURL:** +```bash +curl -X POST "http://localhost:4000/fallback" \ + -H "Authorization: Bearer sk-1234" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "gpt-3.5-turbo", + "fallback_models": ["gpt-4", "claude-3-haiku"], + "fallback_type": "general" + }' +``` + +**Example using Python:** +```python +import requests + +response = requests.post( + "http://localhost:4000/fallback", + headers={ + "Authorization": "Bearer sk-1234", + "Content-Type": "application/json" + }, + json={ + "model": "gpt-3.5-turbo", + "fallback_models": ["gpt-4", "claude-3-haiku"], + "fallback_type": "general" + } +) + +print(response.json()) +``` + +### GET /fallback/\{model\} + +Get fallback configuration for a specific model. + +**Parameters:** +- `model` (path parameter, required): The model name to get fallbacks for +- `fallback_type` (query parameter, optional): Type of fallback to retrieve (default: "general") + +**Response:** +```json +{ + "model": "gpt-3.5-turbo", + "fallback_models": ["gpt-4", "claude-3-haiku"], + "fallback_type": "general" +} +``` + +**Example using cURL:** +```bash +curl -X GET "http://localhost:4000/fallback/gpt-3.5-turbo?fallback_type=general" \ + -H "Authorization: Bearer sk-1234" +``` + +**Example using Python:** +```python +import requests + +response = requests.get( + "http://localhost:4000/fallback/gpt-3.5-turbo", + headers={"Authorization": "Bearer sk-1234"}, + params={"fallback_type": "general"} +) + +print(response.json()) +``` + +### DELETE /fallback/\{model\} + +Delete fallback configuration for a specific model. + +**Parameters:** +- `model` (path parameter, required): The model name to delete fallbacks for +- `fallback_type` (query parameter, optional): Type of fallback to delete (default: "general") + +**Response:** +```json +{ + "model": "gpt-3.5-turbo", + "fallback_type": "general", + "message": "Fallback configuration deleted successfully" +} +``` + +**Example using cURL:** +```bash +curl -X DELETE "http://localhost:4000/fallback/gpt-3.5-turbo?fallback_type=general" \ + -H "Authorization: Bearer sk-1234" +``` + +**Example using Python:** +```python +import requests + +response = requests.delete( + "http://localhost:4000/fallback/gpt-3.5-turbo", + headers={"Authorization": "Bearer sk-1234"}, + params={"fallback_type": "general"} +) + +print(response.json()) +``` + +### Test fallback + +```bash +curl -X POST 'http://0.0.0.0:4000/chat/completions' \ +-H 'Content-Type: application/json' \ +-H 'Authorization: Bearer sk-1234' \ +-d '{ + "model": "gpt-3.5-turbo", + "messages": [ + { + "role": "user", + "content": "ping" + } + ], + "mock_testing_fallbacks": true +} +' +``` + + + +## Validation + +The endpoints perform the following validations: + +1. **Model Existence**: Verifies that the primary model exists in the router +2. **Fallback Model Existence**: Ensures all fallback models exist in the router +3. **No Self-Fallback**: Prevents a model from being its own fallback +4. **No Duplicates**: Ensures no duplicate models in the fallback list +5. **Database Enabled**: Requires `STORE_MODEL_IN_DB=True` to be set + +## Error Responses + +### 400 Bad Request +```json +{ + "detail": { + "error": "Invalid fallback models: ['non-existent-model']", + "available_models": ["gpt-3.5-turbo", "gpt-4", "claude-3-haiku"] + } +} +``` + +### 404 Not Found +```json +{ + "detail": { + "error": "Model 'gpt-3.5-turbo' not found in router", + "available_models": ["gpt-4", "claude-3-haiku"] + } +} +``` + +### 500 Internal Server Error +```json +{ + "detail": { + "error": "Router not initialized" + } +} +``` + +## Fallback Types Explained + +### General Fallbacks +Used for any type of error that occurs during model invocation. This is the most common type of fallback. + +**Use Case:** When a model is unavailable, rate-limited, or returns an error. + +```json +{ + "model": "gpt-3.5-turbo", + "fallback_models": ["gpt-4", "claude-3-haiku"], + "fallback_type": "general" +} +``` + +### Context Window Fallbacks +Specifically triggered when a context window exceeded error occurs. + +**Use Case:** When the input is too long for the primary model, fallback to a model with a larger context window. + +```json +{ + "model": "gpt-3.5-turbo", + "fallback_models": ["gpt-4-32k", "claude-3-opus"], + "fallback_type": "context_window" +} +``` + +### Content Policy Fallbacks +Specifically triggered when content policy violations occur. + +**Use Case:** When the primary model rejects content due to safety filters, fallback to a model with different content policies. + +```json +{ + "model": "gpt-4", + "fallback_models": ["claude-3-haiku"], + "fallback_type": "content_policy" +} +``` + +## Benefits Over /config/update + +1. **Safety**: Only modifies fallback configuration, won't accidentally change other settings +2. **Simplicity**: Focused API with clear validation messages +3. **Granularity**: Manage fallbacks per model and per type +4. **Validation**: Comprehensive checks ensure configuration is valid before applying +5. **Clarity**: Clear error messages with available models listed + +## Notes + +- Fallbacks are triggered after the configured number of retries fails +- Fallbacks are attempted in the order specified in `fallback_models` +- The maximum number of fallbacks attempted is controlled by the router's `max_fallbacks` setting +- Changes take effect immediately and are persisted to the database diff --git a/docs/my-website/docs/proxy/guardrails/panw_prisma_airs.md b/docs/my-website/docs/proxy/guardrails/panw_prisma_airs.md index 53f8a03f5b..e3273a01c1 100644 --- a/docs/my-website/docs/proxy/guardrails/panw_prisma_airs.md +++ b/docs/my-website/docs/proxy/guardrails/panw_prisma_airs.md @@ -206,6 +206,7 @@ Expected successful response: | `mode` | No | When to run the guardrail | `pre_call` | | `fallback_on_error` | No | Action when PANW API is unavailable: `"block"` (fail-closed, default) or `"allow"` (fail-open). Config errors always block. | `block` | | `timeout` | No | PANW API call timeout in seconds (1-60) | `10.0` | +| `violation_message_template` | No | Custom template for error message when request is blocked. Supports `{guardrail_name}`, `{category}`, `{action_type}`, `{default_message}` placeholders. | - | ### Regional Endpoints @@ -449,6 +450,33 @@ LiteLLM does not alter or configure your PANW security profile. To change what c The guardrail is **fail-closed** by default - if the PANW API is unavailable, requests are blocked to ensure no unscanned content reaches your LLM. This provides maximum security. ::: +### Custom Violation Messages + +You can customize the error message returned to the user when a request is blocked by configuring the `violation_message_template` parameter. This is useful for providing user-friendly feedback instead of technical details. + +```yaml +guardrails: + - guardrail_name: "panw-custom-message" + litellm_params: + guardrail: panw_prisma_airs + api_key: os.environ/PANW_PRISMA_AIRS_API_KEY + # Simple message + violation_message_template: "Your request was blocked by our AI Security Policy." + + - guardrail_name: "panw-detailed-message" + litellm_params: + guardrail: panw_prisma_airs + api_key: os.environ/PANW_PRISMA_AIRS_API_KEY + # Message with placeholders + violation_message_template: "{action_type} blocked due to {category} violation. Please contact support." +``` + +**Supported Placeholders:** +- `{guardrail_name}`: Name of the guardrail (e.g. "panw-custom-message") +- `{category}`: Violation category (e.g. "malicious", "injection", "dlp") +- `{action_type}`: "Prompt" or "Response" +- `{default_message}`: The original technical error message + ### Fail-Open Configuration By default, the PANW guardrail operates in **fail-closed** mode for maximum security. If the PANW API is unavailable (timeout, rate limit, network error), requests are blocked. You can configure **fail-open** mode for high-availability scenarios where service continuity is critical. diff --git a/docs/my-website/docs/proxy/logging.md b/docs/my-website/docs/proxy/logging.md index a27b6dcf08..80474a55af 100644 --- a/docs/my-website/docs/proxy/logging.md +++ b/docs/my-website/docs/proxy/logging.md @@ -1827,6 +1827,64 @@ This approach allows you to: - Share callbacks across different environments - Version control callback files in cloud storage +#### Step 2c - Mounting Custom Callbacks in Helm/Kubernetes (Alternative) + +When deploying with Helm or Kubernetes, you can mount custom callback Python files alongside your `config.yaml` using `subPath` to avoid overwriting the config directory. + +**The Problem:** +Mounting a volume to a directory (e.g., `/app/`) would normally hide all existing files in that directory, including your `config.yaml`. + +**The Solution:** +Use `subPath` in your `volumeMounts` to mount individual files without overwriting the entire directory. + +**Example - Helm values.yaml:** + +```yaml +# values.yaml +volumes: + - name: callback-files + configMap: + name: litellm-callback-files + +volumeMounts: + - name: callback-files + mountPath: /app/custom_callbacks.py # Mount to specific FILE path + subPath: custom_callbacks.py # Required to avoid overwriting directory +``` + +**Create the ConfigMap with your callback file:** + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: litellm-callback-files +data: + custom_callbacks.py: | + from litellm.integrations.custom_logger import CustomLogger + + class MyCustomHandler(CustomLogger): + async def async_log_success_event(self, kwargs, response_obj, start_time, end_time): + print(f"Success! Model: {kwargs.get('model')}") + + proxy_handler_instance = MyCustomHandler() +``` + +**Reference in your config.yaml:** + +```yaml +litellm_settings: + callbacks: custom_callbacks.proxy_handler_instance +``` + +**How it works:** +1. The `subPath` parameter tells Kubernetes to mount only the specific file +2. This places `custom_callbacks.py` in `/app/` alongside your existing `config.yaml` +3. LiteLLM automatically finds the callback file in the same directory as the config +4. No files are overwritten or hidden + +**Note:** You can mount multiple callback files by adding more `volumeMounts` entries, each with its own `subPath`. + #### Step 3 - Start proxy + test request ```shell diff --git a/docs/my-website/docs/proxy/spend_logs_deletion.md b/docs/my-website/docs/proxy/spend_logs_deletion.md index 05627c0774..b021457173 100644 --- a/docs/my-website/docs/proxy/spend_logs_deletion.md +++ b/docs/my-website/docs/proxy/spend_logs_deletion.md @@ -30,6 +30,9 @@ general_settings: # Optional: set how frequently cleanup should run - default is daily maximum_spend_logs_retention_interval: "1d" # Run cleanup daily + # Optional: set exact time for cleanup (Cron syntax) + maximum_spend_logs_cleanup_cron: "0 4 * * *" # Run at 04:00 AM daily + litellm_settings: cache: true cache_params: @@ -51,6 +54,15 @@ How long logs should be kept before deletion. Supported formats: How often the cleanup job should run. Uses the same format as above. If not set, cleanup will run every 24 hours if and only if `maximum_spend_logs_retention_period` is set. +#### `maximum_spend_logs_cleanup_cron` (optional) + +Schedule the cleanup using standard cron syntax. This takes precedence over `maximum_spend_logs_retention_interval`. + +Examples: +- `"0 4 * * *"` – Run at 04:00 AM daily +- `"0 0 * * 0"` – Run at midnight every Sunday +- `"*/30 * * * *"` – Run every 30 minutes + ## How it works ### Step 1. Lock Acquisition (Optional with Redis) diff --git a/docs/my-website/docs/routing.md b/docs/my-website/docs/routing.md index 8ac56463d5..47967775e1 100644 --- a/docs/my-website/docs/routing.md +++ b/docs/my-website/docs/routing.md @@ -1333,6 +1333,10 @@ router = Router(model_list: Optional[list] = None, cache_responses=True) ``` +:::info +When configuring Redis caching in router settings, use `cache_kwargs` to pass additional Redis parameters, especially for non-string values that may fail when set via `REDIS_*` environment variables. +::: + ## Pre-Call Checks (Context Window, EU-Regions) Enable pre-call checks to filter out: diff --git a/docs/my-website/docs/troubleshoot.md b/docs/my-website/docs/troubleshoot.md index 9aa9985e07..f9ed47972e 100644 --- a/docs/my-website/docs/troubleshoot.md +++ b/docs/my-website/docs/troubleshoot.md @@ -1,12 +1,60 @@ -# Support & Talk with founders +# Troubleshooting & Support + +## Information to Provide When Seeking Help + +When reporting issues, please include as much of the following as possible. It's okay if you can't provide everything—especially in production scenarios where the trigger might be unknown. Sharing most of this information will help us assist you more effectively. + +### 1. LiteLLM Configuration File + +Your `config.yaml` file (redact sensitive info like API keys). Include number of workers if not in config. + +### 2. Initialization Command + +The command used to start LiteLLM (e.g., `litellm --config config.yaml --num_workers 8 --detailed_debug`). + +### 3. LiteLLM Version + +- Current version +- Version when the issue first appeared (if different) +- If upgraded, the version changed from → to + +### 4. Environment Variables + +Non-sensitive environment variables not in your config (e.g., `NUM_WORKERS`, `LITELLM_LOG`, `LITELLM_MODE`). Do not include passwords or API keys. + +### 5. Server Specifications + +CPU cores, RAM, OS, number of instances/replicas, etc. + +### 6. Database and Redis Usage + +- **Database:** Using database? (`DATABASE_URL` set), database type and version +- **Redis:** Using Redis? Redis version, configuration type (Standalone/Cluster/Sentinel). + +### 7. Endpoints + +The endpoint(s) you're using that are experiencing issues (e.g., `/chat/completions`, `/embeddings`). + +### 8. Request Example + +A realistic example of the request causing issues, including expected vs. actual response and any error messages. + +### 9. Error Logs, Stack Traces, and Metrics + +Full error logs, stack traces, and any images from service metrics (CPU, memory, request rates, etc.) that might help diagnose the issue. + +--- + +## Support Channels + [Schedule Demo 👋](https://calendly.com/d/4mp-gd3-k5k/berriai-1-1-onboarding-litellm-hosted-version) [Community Discord 💭](https://discord.gg/wuPM9dRgDw) [Community Slack 💭](https://www.litellm.ai/support) -Our numbers 📞 +1 (770) 8783-106 / ‭+1 (412) 618-6238‬ +Our numbers 📞 +1 (770) 8783-106 / +1 (412) 618-6238 Our emails ✉️ ishaan@berri.ai / krrish@berri.ai -[![Chat on WhatsApp](https://img.shields.io/static/v1?label=Chat%20on&message=WhatsApp&color=success&logo=WhatsApp&style=flat-square)](https://wa.link/huol9n) [![Chat on Discord](https://img.shields.io/static/v1?label=Chat%20on&message=Discord&color=blue&logo=Discord&style=flat-square)](https://discord.gg/wuPM9dRgDw) +[![Chat on WhatsApp](https://img.shields.io/static/v1?label=Chat%20on&message=WhatsApp&color=success&logo=WhatsApp&style=flat-square)](https://wa.link/huol9n) [![Chat on Discord](https://img.shields.io/static/v1?label=Chat%20on&message=Discord&color=blue&logo=Discord&style=flat-square)](https://discord.gg/wuPM9dRgDw) diff --git a/docs/my-website/docs/troubleshoot/cpu_issues.md b/docs/my-website/docs/troubleshoot/cpu_issues.md new file mode 100644 index 0000000000..8a9a8abe92 --- /dev/null +++ b/docs/my-website/docs/troubleshoot/cpu_issues.md @@ -0,0 +1,31 @@ +# CPU Issue Classification & Reproduction + +## 1. Classify the CPU Issue + +Select the options that best describes the CPU behavior observed. + +- [ ] CPU scales with traffic (RPS-driven) +- [ ] CPU increases without a traffic increase +- [ ] CPU increases after a LiteLLM upgrade + +## 2. Can you reproduce the issue? + +Before escalating, verify whether the CPU issue can be reproduced in a test environment that mirrors your production setup. + +If reproducible, provide **detailed reproduction steps** along with any relevant requests or configuration used. +For guidance on the type of information we're looking for, see the [LiteLLM Troubleshooting Guide](../troubleshoot). + +## 3. Issue Cannot Be Reproduced + +If the CPU issue cannot be reproduced in a test environment that mirrors your production setup, please provide: + +1. **Information from Section 1 and 2** + - CPU classification (Section 1) + - Reproduction attempts and environment details (Section 2) + +2. **Additional context** to help investigate: + - **Workload:** A realistic sample of requests processed before and during the spike, including any recent configuration changes. + - **Metrics:** CPU usage, P50/P99 latency, memory usage. Please include **screenshots** of the metrics whenever possible. + - **Logs / Alerts:** Any relevant logs or alerts captured **before and during the spike**. + +> Providing this information allows the team to analyze patterns, correlate spikes with traffic or configuration, and attempt to reproduce the issue internally. Without it, our engineers won't have enough information to look into the problem. diff --git a/docs/my-website/docs/troubleshoot/memory_issues.md b/docs/my-website/docs/troubleshoot/memory_issues.md new file mode 100644 index 0000000000..1a3eb53f1c --- /dev/null +++ b/docs/my-website/docs/troubleshoot/memory_issues.md @@ -0,0 +1,37 @@ +# Memory Issue Classification & Reproduction + +## 1. Classify the Memory Issue + +Select the option(s) that best describe the memory behavior observed: + +- [ ] Memory scales with traffic (RPS-driven) +- [ ] Memory increases without a traffic increase +- [ ] Memory increases after a LiteLLM upgrade +- [ ] Memory leak (memory continuously grows over time) +- [ ] Out of Memory (OOM) events or pod restarts + +--- + +## 2. Can you reproduce the issue? + +Before escalating, verify whether the memory or OOM issue can be reproduced in a test environment that mirrors your production deployment. + +If reproducible, provide **detailed reproduction steps** along with any relevant requests, workloads, or configuration used. +For guidance on the type of information we’re looking for, see the [LiteLLM Troubleshooting Guide](../troubleshoot). + +--- + +## 3. Issue Cannot Be Reproduced + +If the memory or OOM issue cannot be reproduced in a test environment that mirrors production, please provide: + +1. **Information from Sections 1 and 2** + - Memory/issue classification (Section 1) + - Reproduction attempts and environment details (Section 2) + +2. **Additional context** to help investigate: + - **Workload:** A realistic sample of requests processed before and during the spike, including any recent configuration changes. + - **Metrics:** Memory usage, CPU usage, P50/P99 latency, and any pod restarts or OOM events. Please include **screenshots** of the metrics whenever possible. + - **Logs / Alerts:** Any relevant logs or alerts captured **before and during the spike**, including OOM errors or stack traces if available. + +> Providing this information allows the team to analyze patterns, correlate memory spikes or OOMs with traffic or configuration, and attempt to reproduce the issue internally. Without it, our engineers will not have enough information to investigate the problem. diff --git a/docs/my-website/docs/tutorials/claude_code_customer_tracking.md b/docs/my-website/docs/tutorials/claude_code_customer_tracking.md new file mode 100644 index 0000000000..fc6a3ccc9b --- /dev/null +++ b/docs/my-website/docs/tutorials/claude_code_customer_tracking.md @@ -0,0 +1,99 @@ +# Claude Code - Granular Cost Tracking + +Track Claude Code usage by customer or tags using LiteLLM proxy. This enables granular cost attribution for billing, budgeting, and analytics. + +## How It Works + +Claude Code supports custom headers via `ANTHROPIC_CUSTOM_HEADERS`. LiteLLM automatically tracks requests with specific headers for cost attribution. + +## Tracking Options + +Choose how you want to attribute costs: + +| Track By | Header | Use Case | +|----------|--------|----------| +| Customer | `x-litellm-customer-id` | Bill customers, per-user budgets | +| Tags | `x-litellm-tags` | Project tracking, cost centers, environments | + +## Environment Variables + +| Variable | Description | Example | +|----------|-------------|---------| +| `ANTHROPIC_BASE_URL` | LiteLLM proxy URL | `http://localhost:4000` | +| `ANTHROPIC_API_KEY` | LiteLLM API key | `sk-1234` | +| `ANTHROPIC_CUSTOM_HEADERS` | Custom headers (`header-name: value` format) | See examples below | + +## Option 1: Track by Customer + +Use this to attribute costs to specific customers or end-users. + +```bash +export ANTHROPIC_BASE_URL=http://localhost:4000 +export ANTHROPIC_API_KEY=sk-1234 +export ANTHROPIC_CUSTOM_HEADERS="x-litellm-customer-id: claude-ishaan-local" +``` + +## Option 2: Track by Tags + +Use this to attribute costs to projects, cost centers, or environments. Pass comma-separated tags. + +```bash +export ANTHROPIC_BASE_URL=http://localhost:4000 +export ANTHROPIC_API_KEY=sk-1234 +export ANTHROPIC_CUSTOM_HEADERS="x-litellm-tags: project:acme,env:prod,team:backend" +``` + + +## Quick Start + +### 1. Set Environment Variables + +```bash +export ANTHROPIC_BASE_URL=http://localhost:4000 +export ANTHROPIC_API_KEY=sk-1234 +export ANTHROPIC_CUSTOM_HEADERS="x-litellm-customer-id: claude-ishaan-local" +``` + +### 2. Use Claude Code + +```bash +claude +``` + +All requests will now be tracked under the customer ID `claude-ishaan-local`. + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-16/8f45872e-2d00-4d01-bf3d-4d6ae11d1396/ascreenshot_d2a745b8da4f4a56aaf2cac02871ef53_text_export.jpeg) + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-16/dd41eae3-2592-4bc9-a8d2-d6d02614cd2d/ascreenshot_43ec9ee48ad946cca49732f007e786fc_text_export.jpeg) + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-16/0c30309e-7117-4999-a3df-d22a2d5629c1/ascreenshot_d76a48c53b9a4fad8f6727baf4aa6a9c_text_export.jpeg) + +### 3. View Usage in LiteLLM UI + +Navigate to the **Logs** tab in the LiteLLM UI. + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-16/ff774392-69f5-483e-83e2-fb749c94ee90/ascreenshot_d264fc04c9ee47edb047f61b6eb8c4d7_text_export.jpeg) + +Click on a request to see details. + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-16/5f71589b-5fdd-4759-9b6e-e6874be0eb21/ascreenshot_92dd86dadccb4764b1169c29c10dfe65_text_export.jpeg) + +Filter by customer ID to see all requests for that customer. + +![](https://colony-recorder.s3.amazonaws.com/files/2026-01-16/dd1c8aba-e75b-4714-9eee-c785e9db99af/ascreenshot_36aaec0fe12f4189b64f704a551e6729_text_export.jpeg) + +## Supported Headers + +| Header | Description | +|--------|-------------| +| `x-litellm-customer-id` | Track by customer/end-user ID | +| `x-litellm-end-user-id` | Alternative customer ID header | +| `x-litellm-tags` | Comma-separated tags for cost attribution | + +## Related + +- [Claude Code Quickstart](./claude_responses_api.md) +- [Customer Budgets](../proxy/customers.md) +- [Tag Budgets](../proxy/tag_budgets.md) +- [Track Usage for Coding Tools](./cost_tracking_coding.md) + diff --git a/docs/my-website/docs/tutorials/claude_code_websearch.md b/docs/my-website/docs/tutorials/claude_code_websearch.md new file mode 100644 index 0000000000..478fc96034 --- /dev/null +++ b/docs/my-website/docs/tutorials/claude_code_websearch.md @@ -0,0 +1,203 @@ +import Image from '@theme/IdealImage'; + +# Claude Code - WebSearch Across All Providers + +Enable Claude Code's web search tool to work with any provider (Bedrock, Azure, Vertex, etc.). LiteLLM automatically intercepts web search requests and executes them server-side. + + + +## Proxy Configuration + +Add WebSearch interception to your `litellm_config.yaml`: + +```yaml showLineNumbers title="litellm_config.yaml" +model_list: + - model_name: bedrock-sonnet + litellm_params: + model: bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0 + aws_region_name: us-east-1 + +# Enable WebSearch interception for providers +litellm_settings: + callbacks: + - websearch_interception: + enabled_providers: + - bedrock + - azure + - vertex_ai + search_tool_name: perplexity-search # Optional: specific search tool + +# Configure search provider +search_tools: + - search_tool_name: perplexity-search + litellm_params: + search_provider: perplexity + api_key: os.environ/PERPLEXITY_API_KEY +``` + +## Quick Start + +### 1. Configure LiteLLM Proxy + +Create `config.yaml`: + +```yaml showLineNumbers title="config.yaml" +model_list: + - model_name: bedrock-sonnet + litellm_params: + model: bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0 + aws_region_name: us-east-1 + +litellm_settings: + callbacks: + - websearch_interception: + enabled_providers: [bedrock] + +search_tools: + - search_tool_name: perplexity-search + litellm_params: + search_provider: perplexity + api_key: os.environ/PERPLEXITY_API_KEY +``` + +### 2. Start Proxy + +```bash showLineNumbers title="Start LiteLLM Proxy" +export PERPLEXITY_API_KEY=your-key +litellm --config config.yaml +``` + +### 3. Use with Claude Code + +```bash showLineNumbers title="Configure Claude Code" +export ANTHROPIC_BASE_URL=http://localhost:4000 +export ANTHROPIC_API_KEY=sk-1234 +claude +``` + +Now use web search in Claude Code - it works with any provider! + +## How It Works + +When Claude Code sends a web search request, LiteLLM: +1. Intercepts the native `web_search` tool +2. Converts it to LiteLLM's standard format +3. Executes the search via Perplexity/Tavily +4. Returns the final answer to Claude Code + +```mermaid +sequenceDiagram + participant CC as Claude Code + participant LP as LiteLLM Proxy + participant B as Bedrock/Azure/etc + participant P as Perplexity/Tavily + + CC->>LP: Request with web_search tool + Note over LP: Convert native tool
to LiteLLM format + LP->>B: Request with converted tool + B-->>LP: Response: tool_use + Note over LP: Detect web search
tool_use + LP->>P: Execute search + P-->>LP: Search results + LP->>B: Follow-up with results + B-->>LP: Final answer + LP-->>CC: Final answer with search results +``` + +**Result**: One API call from Claude Code → Complete answer with search results + +## Supported Providers + +| Provider | Native Web Search | With LiteLLM | +|----------|-------------------|--------------| +| **Anthropic** | ✅ Yes | ✅ Yes | +| **Bedrock** | ❌ No | ✅ Yes | +| **Azure** | ❌ No | ✅ Yes | +| **Vertex AI** | ❌ No | ✅ Yes | +| **Other Providers** | ❌ No | ✅ Yes | + +## Search Providers + +Configure which search provider to use. LiteLLM supports multiple search providers: + +| Provider | `search_provider` Value | Environment Variable | +|----------|------------------------|----------------------| +| **Perplexity AI** | `perplexity` | `PERPLEXITYAI_API_KEY` | +| **Tavily** | `tavily` | `TAVILY_API_KEY` | +| **Exa AI** | `exa_ai` | `EXA_API_KEY` | +| **Parallel AI** | `parallel_ai` | `PARALLEL_AI_API_KEY` | +| **Google PSE** | `google_pse` | `GOOGLE_PSE_API_KEY`, `GOOGLE_PSE_ENGINE_ID` | +| **DataForSEO** | `dataforseo` | `DATAFORSEO_LOGIN`, `DATAFORSEO_PASSWORD` | +| **Firecrawl** | `firecrawl` | `FIRECRAWL_API_KEY` | +| **SearXNG** | `searxng` | `SEARXNG_API_BASE` (required) | +| **Linkup** | `linkup` | `LINKUP_API_KEY` | + +See [all supported search providers](../search/index.md) for detailed setup instructions and provider-specific parameters. + +## Configuration Options + +### WebSearch Interception Parameters + +| Parameter | Type | Required | Description | Example | +|-----------|------|----------|-------------|---------| +| `enabled_providers` | List[String] | Yes | List of providers to enable web search interception for | `[bedrock, azure, vertex_ai]` | +| `search_tool_name` | String | No | Specific search tool from `search_tools` config. If not set, uses first available search tool. | `perplexity-search` | + +### Supported Provider Values + +Use these values in `enabled_providers`: + +| Provider | Value | Description | +|----------|-------|-------------| +| AWS Bedrock | `bedrock` | Amazon Bedrock Claude models | +| Azure OpenAI | `azure` | Azure-hosted models | +| Google Vertex AI | `vertex_ai` | Google Cloud Vertex AI | +| Any Other | Provider name | Any LiteLLM-supported provider | + +### Complete Configuration Example + +```yaml showLineNumbers title="Complete config.yaml" +model_list: + - model_name: bedrock-sonnet + litellm_params: + model: bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0 + aws_region_name: us-east-1 + + - model_name: azure-gpt4 + litellm_params: + model: azure/gpt-4 + api_base: https://my-azure.openai.azure.com + api_key: os.environ/AZURE_API_KEY + +litellm_settings: + callbacks: + - websearch_interception: + enabled_providers: + - bedrock # Enable for AWS Bedrock + - azure # Enable for Azure OpenAI + - vertex_ai # Enable for Google Vertex + search_tool_name: perplexity-search # Optional: use specific search tool + +# Configure search tools +search_tools: + - search_tool_name: perplexity-search + litellm_params: + search_provider: perplexity + api_key: os.environ/PERPLEXITY_API_KEY + + - search_tool_name: tavily-search + litellm_params: + search_provider: tavily + api_key: os.environ/TAVILY_API_KEY +``` + +**How search tool selection works:** +- If `search_tool_name` is specified → Uses that specific search tool +- If `search_tool_name` is not specified → Uses first search tool in `search_tools` list +- In example above: Without `search_tool_name`, would use `perplexity-search` (first in list) + +## Related + +- [Claude Code Quickstart](./claude_responses_api.md) +- [Claude Code Cost Tracking](./claude_code_customer_tracking.md) +- [Using Non-Anthropic Models](./claude_non_anthropic_models.md) diff --git a/docs/my-website/docs/tutorials/claude_mcp.md b/docs/my-website/docs/tutorials/claude_mcp.md new file mode 100644 index 0000000000..07c3cead0b --- /dev/null +++ b/docs/my-website/docs/tutorials/claude_mcp.md @@ -0,0 +1,93 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Use Claude Code with MCPs + +This tutorial shows how to connect MCP servers to Claude Code via LiteLLM Proxy. + +Note: LiteLLM supports OAuth for MCP servers as well. [Learn more](https://docs.litellm.ai/docs/mcp#mcp-oauth) + +## Connecting MCP Servers + +You can also connect MCP servers to Claude Code via LiteLLM Proxy. + + +1. Add the MCP server to your `config.yaml` + + + + +In this example, we'll add the Github MCP server to our `config.yaml` + +```yaml title="config.yaml" showLineNumbers +mcp_servers: + github_mcp: + url: "https://api.githubcopilot.com/mcp" + auth_type: oauth2 + client_id: os.environ/GITHUB_OAUTH_CLIENT_ID + client_secret: os.environ/GITHUB_OAUTH_CLIENT_SECRET +``` + + + + +In this example, we'll add the Atlassian MCP server to our `config.yaml` + +```yaml title="config.yaml" showLineNumbers +atlassian_mcp: + server_id: atlassian_mcp_id + url: "https://mcp.atlassian.com/v1/sse" + transport: "sse" + auth_type: oauth2 +``` + + + + +2. Start LiteLLM Proxy + +```bash +litellm --config /path/to/config.yaml + +# RUNNING on http://0.0.0.0:4000 +``` + +3. Use the MCP server in Claude Code + +```bash +claude mcp add --transport http litellm_proxy http://0.0.0.0:4000/github_mcp/mcp --header "Authorization: Bearer sk-LITELLM_VIRTUAL_KEY" +``` + +For MCP servers that require dynamic client registration (such as Atlassian), please set `x-litellm-api-key: Bearer sk-LITELLM_VIRTUAL_KEY` instead of using `Authorization: Bearer LITELLM_VIRTUAL_KEY`. + +4. Authenticate via Claude Code + +a. Start Claude Code + +```bash +claude +``` + +b. Authenticate via Claude Code + +```bash +/mcp +``` + +c. Select the MCP server + +```bash +> litellm_proxy +``` + +d. Start Oauth flow via Claude Code + +```bash +> 1. Authenticate + 2. Reconnect + 3. Disable +``` + +e. Once completed, you should see this success message: + +OAuth 2.0 Success diff --git a/docs/my-website/docs/tutorials/claude_non_anthropic_models.md b/docs/my-website/docs/tutorials/claude_non_anthropic_models.md new file mode 100644 index 0000000000..75ac08e309 --- /dev/null +++ b/docs/my-website/docs/tutorials/claude_non_anthropic_models.md @@ -0,0 +1,316 @@ +import Image from '@theme/IdealImage'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Use Claude Code with Non-Anthropic Models + +This tutorial shows how to use Claude Code with non-Anthropic models like OpenAI, Gemini, and other LLM providers through LiteLLM proxy. + +:::info + +LiteLLM automatically translates between different provider formats, allowing you to use any supported LLM provider with Claude Code while maintaining the Anthropic Messages API format. + +::: + +## Prerequisites + +- [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) installed +- API keys for your chosen providers (OpenAI, Vertex AI, etc.) + +## Installation + +First, install LiteLLM with proxy support: + +```bash +pip install 'litellm[proxy]' +``` + +## Configuration + +### 1. Setup config.yaml + +Create a configuration file with your preferred non-Anthropic models: + + + + +```yaml +model_list: + # OpenAI GPT-4o + - model_name: gpt-4o + litellm_params: + model: openai/gpt-4o + api_key: os.environ/OPENAI_API_KEY + + # OpenAI GPT-4o-mini + - model_name: gpt-4o-mini + litellm_params: + model: openai/gpt-4o-mini + api_key: os.environ/OPENAI_API_KEY +``` + +Set your environment variables: + +```bash +export OPENAI_API_KEY="your-openai-api-key" +export LITELLM_MASTER_KEY="sk-1234567890" # Generate a secure key +``` + + + + +```yaml +model_list: + # Google Gemini + - model_name: gemini-3.0-flash-exp + litellm_params: + model: gemini/gemini-3.0-flash-exp + api_key: os.environ/GEMINI_API_KEY +``` + +Set your environment variables: + +```bash +export GEMINI_API_KEY="your-gemini-api-key" +export LITELLM_MASTER_KEY="sk-1234567890" # Generate a secure key +``` + + + + +```yaml +model_list: + # Google Gemini + - model_name: vertex-gemini-3-flash-preview + litellm_params: + model: vertex_ai/gemini-3-flash-preview + vertex_credentials: os.environ/VERTEX_FILE_PATH_ENV_VAR # os.environ["VERTEX_FILE_PATH_ENV_VAR"] = "/path/to/service_account.json" + vertex_project: "my-test-project" + vertex_location: "us-east-1" + + # Anthropic Claude + - model_name: anthropic-vertex + litellm_params: + model: vertex_ai/claude-3-sonnet@20240229 + vertex_ai_project: "my-test-project" + vertex_ai_location: "us-east-1" + vertex_credentials: os.environ/VERTEX_FILE_PATH_ENV_VAR # os.environ["VERTEX_FILE_PATH_ENV_VAR"] = "/path/to/service_account.json" +``` + +Set your environment variables: + +```bash +export VERTEX_FILE_PATH_ENV_VAR="/path/to/service_account.json" +export LITELLM_MASTER_KEY="sk-1234567890" +``` + + + + +```yaml +model_list: + # Azure OpenAI + - model_name: azure-gpt-4 + litellm_params: + model: azure/gpt-4 + api_key: os.environ/AZURE_API_KEY + api_base: os.environ/AZURE_API_BASE + api_version: "2024-02-01" +``` + +Set your environment variables: + +```bash +export AZURE_API_KEY="your-azure-api-key" +export AZURE_API_BASE="https://your-resource.openai.azure.com" +export LITELLM_MASTER_KEY="sk-1234567890" +``` + + + + +### 2. Start LiteLLM Proxy + +```bash +litellm --config /path/to/config.yaml + +# RUNNING on http://0.0.0.0:4000 +``` + +### 3. Verify Setup + +Test that your proxy is working correctly: + + + + +```bash +curl -X POST http://0.0.0.0:4000/v1/messages \ +-H "Authorization: Bearer $LITELLM_MASTER_KEY" \ +-H "Content-Type: application/json" \ +-d '{ + "model": "gpt-4o", + "max_tokens": 1000, + "messages": [{"role": "user", "content": "What is the capital of France?"}] +}' +``` + + + + +```bash +curl -X POST http://0.0.0.0:4000/v1/messages \ +-H "Authorization: Bearer $LITELLM_MASTER_KEY" \ +-H "Content-Type: application/json" \ +-d '{ + "model": "gemini-3.0-flash-exp", + "max_tokens": 1000, + "messages": [{"role": "user", "content": "What is the capital of France?"}] +}' +``` + + + + +```bash +curl -X POST http://0.0.0.0:4000/v1/messages \ +-H "Authorization: Bearer $LITELLM_MASTER_KEY" \ +-H "Content-Type: application/json" \ +-d '{ + "model": "gemini-3.0-flash-exp", + "max_tokens": 1000, + "messages": [{"role": "user", "content": "What is the capital of France?"}] +}' +``` + + + + +```bash +curl -X POST http://0.0.0.0:4000/v1/messages \ +-H "Authorization: Bearer $LITELLM_MASTER_KEY" \ +-H "Content-Type: application/json" \ +-d '{ + "model": "azure-gpt-4", + "max_tokens": 1000, + "messages": [{"role": "user", "content": "What is the capital of France?"}] +}' +``` + + + + +### 4. Configure Claude Code + +Configure Claude Code to use your LiteLLM proxy: + +```bash +export ANTHROPIC_BASE_URL="http://0.0.0.0:4000" +export ANTHROPIC_AUTH_TOKEN="$LITELLM_MASTER_KEY" +``` + +:::tip +The `LITELLM_MASTER_KEY` gives Claude Code access to all proxy models. You can also create virtual keys in the LiteLLM UI to limit access to specific models. +::: + +### 5. Use Claude Code with Non-Anthropic Models + +Start Claude Code and specify which model to use: + +```bash +# Use OpenAI GPT-4o +claude --model gpt-4o + +# Use OpenAI GPT-4o-mini for faster responses +claude --model gpt-4o-mini + +# Use Google Gemini +claude --model gemini-3.0-flash-exp + +# Use Vertex AI Gemini +claude --model vertex-gemini-3-flash-preview + +# Use Vertex AI Anthropic Claude +claude --model anthropic-vertex + +# Use Azure OpenAI +claude --model azure-gpt-4 +``` + +## How It Works + +LiteLLM acts as a unified interface that: + +1. **Receives requests** from Claude Code in Anthropic Messages API format +2. **Translates** the request to the target provider's format (OpenAI, Gemini, etc.) +3. **Forwards** the request to the actual provider +4. **Translates** the response back to Anthropic Messages API format +5. **Returns** the response to Claude Code + +This allows you to use Claude Code's interface with any LLM provider supported by LiteLLM. + +## Advanced Features + +### Load Balancing and Fallbacks + +Configure multiple deployments with automatic fallback: + +```yaml +model_list: + - model_name: gpt-4o # virtual model name + litellm_params: + model: openai/gpt-4o + api_key: os.environ/OPENAI_API_KEY + + - model_name: gpt-4o # same virtual name + litellm_params: + model: azure/gpt-4o + api_key: os.environ/AZURE_API_KEY + api_base: os.environ/AZURE_API_BASE + +router_settings: + routing_strategy: simple-shuffle # Load balance between deployments + num_retries: 2 + timeout: 30 +``` + +### Usage Tracking and Budgets + +Track usage and set budgets through the LiteLLM UI: + +```yaml +litellm_settings: + master_key: os.environ/LITELLM_MASTER_KEY + database_url: "postgresql://..." # Enable database for tracking + +general_settings: + store_model_in_db: true +``` + +Start the proxy with the UI: + +```bash +litellm --config /path/to/config.yaml --detailed_debug +``` + +Access the UI at `http://0.0.0.0:4000/ui` to: +- View usage analytics +- Set budget limits per user/key +- Monitor costs across different providers +- Create virtual keys with specific permissions + + +## Supported Providers + +LiteLLM supports 100+ providers. Here are some popular ones for use with Claude Code: + +- **OpenAI**: GPT-4o, GPT-4o-mini, o1, o3-mini +- **Google**: Gemini 2.0 Flash, Gemini 1.5 Pro/Flash +- **Azure OpenAI**: All OpenAI models via Azure +- **AWS Bedrock**: Llama, Mistral, and other models +- **Vertex AI**: Gemini, Claude, and other models on Google Cloud +- **Groq**: Fast inference for Llama and Mixtral +- **Together AI**: Llama, Mixtral, and other open source models +- **Deepseek**: Deepseek-chat, Deepseek-coder + +[View full list of supported providers →](https://docs.litellm.ai/docs/providers) diff --git a/docs/my-website/docs/tutorials/claude_responses_api.md b/docs/my-website/docs/tutorials/claude_responses_api.md index aafeccceaf..6b681d93a8 100644 --- a/docs/my-website/docs/tutorials/claude_responses_api.md +++ b/docs/my-website/docs/tutorials/claude_responses_api.md @@ -2,7 +2,7 @@ import Image from '@theme/IdealImage'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -# Claude Code +# Claude Code Quickstart This tutorial shows how to call Claude models through LiteLLM proxy from Claude Code. @@ -142,7 +142,7 @@ Common issues and solutions: - Ensure the model name in Claude Code matches exactly with your `config.yaml` - Check LiteLLM logs for detailed error messages -## Using Multiple Models +## Using Bedrock/Vertex AI/Azure Foundry Models Expand your configuration to support multiple providers and models: @@ -151,25 +151,6 @@ Expand your configuration to support multiple providers and models: ```yaml model_list: - # OpenAI models - - model_name: codex-mini - litellm_params: - model: openai/codex-mini - api_key: os.environ/OPENAI_API_KEY - api_base: https://api.openai.com/v1 - - - model_name: o3-pro - litellm_params: - model: openai/o3-pro - api_key: os.environ/OPENAI_API_KEY - api_base: https://api.openai.com/v1 - - - model_name: gpt-4o - litellm_params: - model: openai/gpt-4o - api_key: os.environ/OPENAI_API_KEY - api_base: https://api.openai.com/v1 - # Anthropic models - model_name: claude-3-5-sonnet-20241022 litellm_params: @@ -189,6 +170,24 @@ model_list: aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY aws_region_name: us-east-1 + # Azure Foundry + - model_name: claude-4-azure + litellm_params: + model: azure_ai/claude-opus-4-1 + api_key: os.environ/AZURE_AI_API_KEY + api_base: os.environ/AZURE_AI_API_BASE # https://my-resource.services.ai.azure.com/anthropic + + # Google Vertex AI + - model_name: anthropic-vertex + litellm_params: + model: vertex_ai/claude-haiku-4-5@20251001 + vertex_ai_project: "my-test-project" + vertex_ai_location: "us-east-1" + vertex_credentials: os.environ/VERTEX_FILE_PATH_ENV_VAR # os.environ["VERTEX_FILE_PATH_ENV_VAR"] = "/path/to/service_account.json" + + + + litellm_settings: master_key: os.environ/LITELLM_MASTER_KEY ``` @@ -204,6 +203,12 @@ claude --model claude-3-5-haiku-20241022 # Use Bedrock deployment claude --model claude-bedrock + +# Use Azure Foundry deployment +claude --model claude-4-azure + +# Use Vertex AI deployment +claude --model anthropic-vertex ``` @@ -211,96 +216,3 @@ claude --model claude-bedrock - -## Connecting MCP Servers - -You can also connect MCP servers to Claude Code via LiteLLM Proxy. - -:::note - -Limitations: - -- Currently, only HTTP MCP servers are supported - -::: - -1. Add the MCP server to your `config.yaml` - - - - -In this example, we'll add the Github MCP server to our `config.yaml` - -```yaml title="config.yaml" showLineNumbers -mcp_servers: - github_mcp: - url: "https://api.githubcopilot.com/mcp" - auth_type: oauth2 - client_id: os.environ/GITHUB_OAUTH_CLIENT_ID - client_secret: os.environ/GITHUB_OAUTH_CLIENT_SECRET -``` - - - - -In this example, we'll add the Atlassian MCP server to our `config.yaml` - -```yaml title="config.yaml" showLineNumbers -atlassian_mcp: - server_id: atlassian_mcp_id - url: "https://mcp.atlassian.com/v1/sse" - transport: "sse" - auth_type: oauth2 -``` - - - - -2. Start LiteLLM Proxy - -```bash -litellm --config /path/to/config.yaml - -# RUNNING on http://0.0.0.0:4000 -``` - -3. Use the MCP server in Claude Code - -```bash -claude mcp add --transport http litellm_proxy http://0.0.0.0:4000/github_mcp/mcp --header "Authorization: Bearer sk-LITELLM_VIRTUAL_KEY" -``` - -For MCP servers that require dynamic client registration (such as Atlassian), please set `x-litellm-api-key: Bearer sk-LITELLM_VIRTUAL_KEY` instead of using `Authorization: Bearer LITELLM_VIRTUAL_KEY`. - -4. Authenticate via Claude Code - -a. Start Claude Code - -```bash -claude -``` - -b. Authenticate via Claude Code - -```bash -/mcp -``` - -c. Select the MCP server - -```bash -> litellm_proxy -``` - -d. Start Oauth flow via Claude Code - -```bash -> 1. Authenticate - 2. Reconnect - 3. Disable -``` - -e. Once completed, you should see this success message: - - - diff --git a/docs/my-website/docs/tutorials/cursor_integration.md b/docs/my-website/docs/tutorials/cursor_integration.md index 3f462e1ee5..49f88bd048 100644 --- a/docs/my-website/docs/tutorials/cursor_integration.md +++ b/docs/my-website/docs/tutorials/cursor_integration.md @@ -1,3 +1,5 @@ +import Image from '@theme/IdealImage'; + # Cursor Integration Route Cursor IDE requests through LiteLLM for unified logging, budget controls, and access to any model. @@ -76,6 +78,34 @@ Send a message. All requests now route through LiteLLM. --- +## Connecting MCP Servers + +You can also connect MCP servers to Cursor via LiteLLM Proxy. + +For official instructions on configuring MCP integration with Cursor, please refer to the Cursor documentation here: [https://cursor.com/en-US/docs/context/mcp](https://cursor.com/en-US/docs/context/mcp). + +1. In Cursor Settings, go to the "Tools & MCP" tab and click "New MCP Server". + +2. In your `mcp.json`, add the following configuration: + +``` +{ + "mcpServers": { + "litellm": { + "url": "http://localhost:4000/everything/mcp", + "type": "http", + "headers": { + "Authorization": "Bearer sk-LITELLM_VIRTUAL_KEY" + } + } + } +} +``` + +3. LiteLLM's MCP will now appear under "Installed MCP Servers" in Cursor. + + + ## Troubleshooting | Issue | Solution | diff --git a/docs/my-website/img/claude_code_websearch.png b/docs/my-website/img/claude_code_websearch.png new file mode 100644 index 0000000000..a0d8a3ba85 Binary files /dev/null and b/docs/my-website/img/claude_code_websearch.png differ diff --git a/docs/my-website/img/cursor_mcp_installed.png b/docs/my-website/img/cursor_mcp_installed.png new file mode 100644 index 0000000000..f2339bcec3 Binary files /dev/null and b/docs/my-website/img/cursor_mcp_installed.png differ diff --git a/docs/my-website/img/mcp_playground.png b/docs/my-website/img/mcp_playground.png new file mode 100644 index 0000000000..dac8854436 Binary files /dev/null and b/docs/my-website/img/mcp_playground.png differ diff --git a/docs/my-website/img/mcp_tool_testing_playground.png b/docs/my-website/img/mcp_tool_testing_playground.png new file mode 100644 index 0000000000..56b526a20c Binary files /dev/null and b/docs/my-website/img/mcp_tool_testing_playground.png differ diff --git a/docs/my-website/img/release_notes/claude_code_websearch.png b/docs/my-website/img/release_notes/claude_code_websearch.png new file mode 100644 index 0000000000..eec4b6d70e Binary files /dev/null and b/docs/my-website/img/release_notes/claude_code_websearch.png differ diff --git a/docs/my-website/img/ui_deleted_keys_table.png b/docs/my-website/img/ui_deleted_keys_table.png new file mode 100644 index 0000000000..9d7cf8455b Binary files /dev/null and b/docs/my-website/img/ui_deleted_keys_table.png differ diff --git a/docs/my-website/img/ui_endpoint_activity.png b/docs/my-website/img/ui_endpoint_activity.png index e2550066a0..fc0a90ca44 100644 Binary files a/docs/my-website/img/ui_endpoint_activity.png and b/docs/my-website/img/ui_endpoint_activity.png differ diff --git a/docs/my-website/release_notes/v1.80.15/index.md b/docs/my-website/release_notes/v1.80.15/index.md index 33c01973b1..4037a0d9b5 100644 --- a/docs/my-website/release_notes/v1.80.15/index.md +++ b/docs/my-website/release_notes/v1.80.15/index.md @@ -1,5 +1,5 @@ --- -title: "[Preview] v1.80.15.rc.1 - Manus API Support" +title: "v1.80.15-stable - Manus API Support" slug: "v1-80-15" date: 2026-01-10T10:00:00 authors: @@ -27,7 +27,7 @@ import TabItem from '@theme/TabItem'; docker run \ -e STORE_MODEL_IN_DB=True \ -p 4000:4000 \ -docker.litellm.ai/berriai/litellm:v1.80.15.rc.1 +docker.litellm.ai/berriai/litellm:v1.80.15-stable.1 ``` @@ -638,6 +638,6 @@ Users can now see Endpoint Activity Metrics in the UI. ## Full Changelog -**[View complete changelog on GitHub](https://github.com/BerriAI/litellm/compare/v1.80.11.rc.1...v1.80.14.rc.1)** +**[View complete changelog on GitHub](https://github.com/BerriAI/litellm/compare/v1.80.11.rc.1...v1.80.15-stable.1)** diff --git a/docs/my-website/release_notes/v1.81.0/index.md b/docs/my-website/release_notes/v1.81.0/index.md new file mode 100644 index 0000000000..edd720f6bf --- /dev/null +++ b/docs/my-website/release_notes/v1.81.0/index.md @@ -0,0 +1,517 @@ +--- +title: "v1.81.0 - Claude Code - Web Search Across All Providers" +slug: "v1-81-0" +date: 2026-01-18T10:00:00 +authors: + - name: Krrish Dholakia + title: CEO, LiteLLM + url: https://www.linkedin.com/in/krish-d/ + image_url: https://pbs.twimg.com/profile_images/1298587542745358340/DZv3Oj-h_400x400.jpg + - name: Ishaan Jaff + title: CTO, LiteLLM + url: https://www.linkedin.com/in/reffajnaahsi/ + image_url: https://pbs.twimg.com/profile_images/1613813310264340481/lz54oEiB_400x400.jpg +hide_table_of_contents: false +--- + +import Image from '@theme/IdealImage'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +## Deploy this version + + + + +``` showLineNumbers title="docker run litellm" +docker run \ +-e STORE_MODEL_IN_DB=True \ +-p 4000:4000 \ +docker.litellm.ai/berriai/litellm:v1.81.0 +``` + + + + + +``` showLineNumbers title="pip install litellm" +pip install litellm==1.81.0 +``` + + + + +--- + +## Key Highlights + +- **Claude Code** - Support for using web search across Bedrock, Vertex AI, and all LiteLLM providers +- **Major Change** - [50MB limit on image URL downloads](#major-change---chatcompletions-image-url-download-size-limit) to improve reliability +- **Performance** - [25% CPU Usage Reduction](#performance---25-cpu-usage-reduction) by removing premature model.dump() calls from the hot path +- **Deleted Keys Audit Table on UI** - [View deleted keys and teams for audit purposes](../../docs/proxy/deleted_keys_teams.md) with spend and budget information at the time of deletion + +--- + +## Claude Code - Web Search Across All Providers + + + +This release brings web search support to Claude Code across all LiteLLM providers (Bedrock, Azure, Vertex AI, and more), enabling AI coding assistants to search the web for real-time information. + +This means you can now use Claude Code's web search tool with any provider, not just Anthropic's native API. LiteLLM automatically intercepts web search requests and executes them server-side using your configured search provider (Perplexity, Tavily, Exa AI, and more). + +Proxy Admins can configure web search interception in their LiteLLM proxy config to enable this capability for their teams using Claude Code with Bedrock, Azure, or any other supported provider. + +[**Learn more →**](../../docs/tutorials/claude_code_websearch.md) + +--- + +## Major Change - /chat/completions Image URL Download Size Limit + +To improve reliability and prevent memory issues, LiteLLM now includes a configurable **50MB limit** on image URL downloads by default. Previously, there was no limit on image downloads, which could occasionally cause memory issues with very large images. + +### How It Works + +Requests with image URLs exceeding 50MB will receive a helpful error message: + +```bash +curl -X POST 'https://your-litellm-proxy.com/chat/completions' \ + -H 'Content-Type: application/json' \ + -H 'Authorization: Bearer sk-1234' \ + -d '{ + "model": "gpt-4o", + "messages": [ + { + "role": "user", + "content": [ + { + "type": "text", + "text": "What is in this image?" + }, + { + "type": "image_url", + "image_url": { + "url": "https://example.com/very-large-image.jpg" + } + } + ] + } + ] + }' +``` + +**Error Response:** + +```json +{ + "error": { + "message": "Error: Image size (75.50MB) exceeds maximum allowed size (50.0MB). url=https://example.com/very-large-image.jpg", + "type": "ImageFetchError" + } +} +``` + +### Configuring the Limit + +The default 50MB limit works well for most use cases, but you can easily adjust it if needed: + +**Increase the limit (e.g., to 100MB):** + +```bash +export MAX_IMAGE_URL_DOWNLOAD_SIZE_MB=100 +``` + +**Disable image URL downloads (for security):** + +```bash +export MAX_IMAGE_URL_DOWNLOAD_SIZE_MB=0 +``` + +**Docker Configuration:** + +```bash +docker run \ + -e MAX_IMAGE_URL_DOWNLOAD_SIZE_MB=100 \ + -p 4000:4000 \ + docker.litellm.ai/berriai/litellm:v1.81.0 +``` + +**Proxy Config (config.yaml):** + +```yaml +general_settings: + master_key: sk-1234 + +# Set via environment variable +environment_variables: + MAX_IMAGE_URL_DOWNLOAD_SIZE_MB: "100" +``` + +### Why Add This? + +This feature improves reliability by: +- Preventing memory issues from very large images +- Aligning with OpenAI's 50MB payload limit +- Validating image sizes early (when Content-Length header is available) + +--- + +## Performance - 25% CPU Usage Reduction + +LiteLLM now reduces CPU usage by removing premature `model.dump()` calls from the hot path in request processing. Previously, Pydantic model serialization was performed earlier and more frequently than necessary, causing unnecessary CPU overhead on every request. By deferring serialization until it is actually needed, LiteLLM reduces CPU usage and improves request throughput under high load. + +--- + +## Deleted Keys Audit Table on UI + + + +LiteLLM now provides a comprehensive audit table for deleted API keys and teams directly in the UI. This feature allows you to easily track the spend of deleted keys, view their associated team information, and maintain accurate financial records for auditing and compliance purposes. The table displays key details including key aliases, team associations, and spend information captured at the time of deletion. For more information on how to use this feature, see the [Deleted Keys & Teams documentation](../../docs/proxy/deleted_keys_teams.md). + +--- + +## New Models / Updated Models + +#### New Model Support + +| Provider | Model | Features | +| -------- | ----- | -------- | +| OpenAI | `gpt-5.2-codex` | Code generation | +| Azure | `azure/gpt-5.2-codex` | Code generation | +| Cerebras | `cerebras/zai-glm-4.7` | Reasoning, function calling | +| Replicate | All chat models | Full support for all Replicate chat models | + +#### Features + +- **[Anthropic](../../docs/providers/anthropic)** + - Add missing anthropic tool results in response - [PR #18945](https://github.com/BerriAI/litellm/pull/18945) + - Preserve web_fetch_tool_result in multi-turn conversations - [PR #18142](https://github.com/BerriAI/litellm/pull/18142) + +- **[Gemini](../../docs/providers/gemini)** + - Add presence_penalty support for Google AI Studio - [PR #18154](https://github.com/BerriAI/litellm/pull/18154) + - Forward extra_headers in generateContent adapter - [PR #18935](https://github.com/BerriAI/litellm/pull/18935) + - Add medium value support for detail param - [PR #19187](https://github.com/BerriAI/litellm/pull/19187) + +- **[Vertex AI](../../docs/providers/vertex)** + - Improve passthrough endpoint URL parsing and construction - [PR #17526](https://github.com/BerriAI/litellm/pull/17526) + - Add type object to tool schemas missing type field - [PR #19103](https://github.com/BerriAI/litellm/pull/19103) + - Keep type field in Gemini schema when properties is empty - [PR #18979](https://github.com/BerriAI/litellm/pull/18979) + +- **[Bedrock](../../docs/providers/bedrock)** + - Add OpenAI-compatible service_tier parameter translation - [PR #18091](https://github.com/BerriAI/litellm/pull/18091) + - Add user auth in standard logging object for Bedrock passthrough - [PR #19140](https://github.com/BerriAI/litellm/pull/19140) + - Strip throughput tier suffixes from model names - [PR #19147](https://github.com/BerriAI/litellm/pull/19147) + +- **[OCI](../../docs/providers/oci)** + - Handle OpenAI-style image_url object in multimodal messages - [PR #18272](https://github.com/BerriAI/litellm/pull/18272) + +- **[Ollama](../../docs/providers/ollama)** + - Set finish_reason to tool_calls and remove broken capability check - [PR #18924](https://github.com/BerriAI/litellm/pull/18924) + +- **[Watsonx](../../docs/providers/watsonx/index)** + - Allow passing scope ID for Watsonx inferencing - [PR #18959](https://github.com/BerriAI/litellm/pull/18959) + +- **[Replicate](../../docs/providers/replicate)** + - Add all chat Replicate models support - [PR #18954](https://github.com/BerriAI/litellm/pull/18954) + +- **[OpenRouter](../../docs/providers/openrouter)** + - Add OpenRouter support for image/generation endpoints - [PR #19059](https://github.com/BerriAI/litellm/pull/19059) + +- **[Volcengine](../../docs/providers/volcano)** + - Add max_tokens settings for Volcengine models (deepseek-v3-2, glm-4-7, kimi-k2-thinking) - [PR #19076](https://github.com/BerriAI/litellm/pull/19076) + +- **Azure Model Router** + - New Model - Azure Model Router on LiteLLM AI Gateway - [PR #19054](https://github.com/BerriAI/litellm/pull/19054) + +- **GPT-5 Models** + - Correct context window sizes for GPT-5 model variants - [PR #18928](https://github.com/BerriAI/litellm/pull/18928) + - Correct max_input_tokens for GPT-5 models - [PR #19056](https://github.com/BerriAI/litellm/pull/19056) + +- **Text Completion** + - Support token IDs (list of integers) as prompt - [PR #18011](https://github.com/BerriAI/litellm/pull/18011) + +### Bug Fixes + +- **[Anthropic](../../docs/providers/anthropic)** + - Prevent dropping thinking when any message has thinking_blocks - [PR #18929](https://github.com/BerriAI/litellm/pull/18929) + - Fix anthropic token counter with thinking - [PR #19067](https://github.com/BerriAI/litellm/pull/19067) + - Add better error handling for Anthropic - [PR #18955](https://github.com/BerriAI/litellm/pull/18955) + - Fix Anthropic during call error - [PR #19060](https://github.com/BerriAI/litellm/pull/19060) + +- **[Gemini](../../docs/providers/gemini)** + - Fix missing `completion_tokens_details` in Gemini 3 Flash when reasoning_effort is not used - [PR #18898](https://github.com/BerriAI/litellm/pull/18898) + - Fix Gemini Image Generation imageConfig parameters - [PR #18948](https://github.com/BerriAI/litellm/pull/18948) + +- **[Vertex AI](../../docs/providers/vertex)** + - Fix Vertex AI 400 Error with CachedContent model mismatch - [PR #19193](https://github.com/BerriAI/litellm/pull/19193) + - Fix Vertex AI doesn't support structured output - [PR #19201](https://github.com/BerriAI/litellm/pull/19201) + +- **[Bedrock](../../docs/providers/bedrock)** + - Fix Claude Code (`/messages`) Bedrock Invoke usage and request signing - [PR #19111](https://github.com/BerriAI/litellm/pull/19111) + - Fix model ID encoding for Bedrock passthrough - [PR #18944](https://github.com/BerriAI/litellm/pull/18944) + - Respect max_completion_tokens in thinking feature - [PR #18946](https://github.com/BerriAI/litellm/pull/18946) + - Fix header forwarding in Bedrock passthrough - [PR #19007](https://github.com/BerriAI/litellm/pull/19007) + - Fix Bedrock stability model usage issues - [PR #19199](https://github.com/BerriAI/litellm/pull/19199) + +--- + +## LLM API Endpoints + +#### Features + +- **[/messages (Claude Code)](../../docs/providers/anthropic)** + - Add support for Tool Search on `/messages` API across Azure, Bedrock, and Anthropic API - [PR #19165](https://github.com/BerriAI/litellm/pull/19165) + - Track end-users with Claude Code (`/messages`) for better analytics and monitoring - [PR #19171](https://github.com/BerriAI/litellm/pull/19171) + - Add web search support using LiteLLM `/search` endpoint with Claude Code (`/messages`) - [PR #19263](https://github.com/BerriAI/litellm/pull/19263), [PR #19294](https://github.com/BerriAI/litellm/pull/19294) + +- **[/messages (Claude Code) - Bedrock](../../docs/providers/bedrock)** + - Add support for Prompt Caching with Bedrock Converse on `/messages` - [PR #19123](https://github.com/BerriAI/litellm/pull/19123) + - Ensure budget tokens are passed to Bedrock Converse API correctly on `/messages` - [PR #19107](https://github.com/BerriAI/litellm/pull/19107) + +- **[Responses API](../../docs/response_api)** + - Add support for caching for responses API - [PR #19068](https://github.com/BerriAI/litellm/pull/19068) + - Add retry policy support to responses API - [PR #19074](https://github.com/BerriAI/litellm/pull/19074) + +- **Realtime API** + - Use non-streaming method for endpoint v1/a2a/message/send - [PR #19025](https://github.com/BerriAI/litellm/pull/19025) + +- **Batch API** + - Fix batch deletion and retrieve - [PR #18340](https://github.com/BerriAI/litellm/pull/18340) + +#### Bugs + +- **General** + - Fix responses content can't be none - [PR #19064](https://github.com/BerriAI/litellm/pull/19064) + - Fix model name from query param in realtime request - [PR #19135](https://github.com/BerriAI/litellm/pull/19135) + - Fix video status/content credential injection for wildcard models - [PR #18854](https://github.com/BerriAI/litellm/pull/18854) + +--- + +## Management Endpoints / UI + +#### Features + +**Virtual Keys** +- View deleted keys for audit purposes - [PR #18228](https://github.com/BerriAI/litellm/pull/18228), [PR #19268](https://github.com/BerriAI/litellm/pull/19268) +- Add status query parameter for keys list - [PR #19260](https://github.com/BerriAI/litellm/pull/19260) +- Refetch keys after key creation - [PR #18994](https://github.com/BerriAI/litellm/pull/18994) +- Refresh keys list on delete - [PR #19262](https://github.com/BerriAI/litellm/pull/19262) +- Simplify key generate permission error - [PR #18997](https://github.com/BerriAI/litellm/pull/18997) +- Add search to key edit team dropdown - [PR #19119](https://github.com/BerriAI/litellm/pull/19119) + +**Teams & Organizations** +- View deleted teams for audit purposes - [PR #18228](https://github.com/BerriAI/litellm/pull/18228), [PR #19268](https://github.com/BerriAI/litellm/pull/19268) +- Add filters to organization table - [PR #18916](https://github.com/BerriAI/litellm/pull/18916) +- Add query parameters to `/organization/list` - [PR #18910](https://github.com/BerriAI/litellm/pull/18910) +- Add status query parameter for teams list - [PR #19260](https://github.com/BerriAI/litellm/pull/19260) +- Show internal users their spend only - [PR #19227](https://github.com/BerriAI/litellm/pull/19227) +- Allow preventing team admins from deleting members from teams - [PR #19128](https://github.com/BerriAI/litellm/pull/19128) +- Refactor team member icon buttons - [PR #19192](https://github.com/BerriAI/litellm/pull/19192) + +**Models + Endpoints** +- Display health information in public model hub - [PR #19256](https://github.com/BerriAI/litellm/pull/19256), [PR #19258](https://github.com/BerriAI/litellm/pull/19258) +- Quality of life improvements for Anthropic models - [PR #19058](https://github.com/BerriAI/litellm/pull/19058) +- Create reusable model select component - [PR #19164](https://github.com/BerriAI/litellm/pull/19164) +- Edit settings model dropdown - [PR #19186](https://github.com/BerriAI/litellm/pull/19186) +- Fix model hub client side exception - [PR #19045](https://github.com/BerriAI/litellm/pull/19045) + +**Usage & Analytics** +- Allow top virtual keys and models to show more entries - [PR #19050](https://github.com/BerriAI/litellm/pull/19050) +- Fix Y axis on model activity chart - [PR #19055](https://github.com/BerriAI/litellm/pull/19055) +- Add Team ID and Team Name in export report - [PR #19047](https://github.com/BerriAI/litellm/pull/19047) +- Add user metrics for Prometheus - [PR #18785](https://github.com/BerriAI/litellm/pull/18785) + +**SSO & Auth** +- Allow setting custom MSFT Base URLs - [PR #18977](https://github.com/BerriAI/litellm/pull/18977) +- Allow overriding env var attribute names - [PR #18998](https://github.com/BerriAI/litellm/pull/18998) +- Fix SCIM GET /Users error and enforce SCIM 2.0 compliance - [PR #17420](https://github.com/BerriAI/litellm/pull/17420) +- Feature flag for SCIM compliance fix - [PR #18878](https://github.com/BerriAI/litellm/pull/18878) + +**General UI** +- Add allowClear to dropdown components for better UX - [PR #18778](https://github.com/BerriAI/litellm/pull/18778) +- Add community engagement buttons - [PR #19114](https://github.com/BerriAI/litellm/pull/19114) +- UI Feedback Form - why LiteLLM - [PR #18999](https://github.com/BerriAI/litellm/pull/18999) +- Refactor user and team table filters to reusable component - [PR #19010](https://github.com/BerriAI/litellm/pull/19010) +- Adjusting new badges - [PR #19278](https://github.com/BerriAI/litellm/pull/19278) + +#### Bugs + +- Container API routes return 401 for non-admin users - routes missing from openai_routes - [PR #19115](https://github.com/BerriAI/litellm/pull/19115) +- Allow routing to regional endpoints for Containers API - [PR #19118](https://github.com/BerriAI/litellm/pull/19118) +- Fix Azure Storage circular reference error - [PR #19120](https://github.com/BerriAI/litellm/pull/19120) +- Fix prompt deletion fails with Prisma FieldNotFoundError - [PR #18966](https://github.com/BerriAI/litellm/pull/18966) + +--- + +## AI Integrations + +### Logging + +- **[OpenTelemetry](../../docs/proxy/logging#opentelemetry)** + - Update semantic conventions to 1.38 (gen_ai attributes) - [PR #18793](https://github.com/BerriAI/litellm/pull/18793) + +- **[LangSmith](../../docs/proxy/logging#langsmith)** + - Hoist thread grouping metadata (session_id, thread) - [PR #18982](https://github.com/BerriAI/litellm/pull/18982) + +- **[Langfuse](../../docs/proxy/logging#langfuse)** + - Include Langfuse logger in JSON logging when Langfuse callback is used - [PR #19162](https://github.com/BerriAI/litellm/pull/19162) + +- **[Logfire](../../docs/observability/logfire)** + - Add ability to customize Logfire base URL through env var - [PR #19148](https://github.com/BerriAI/litellm/pull/19148) + +- **General Logging** + - Enable JSON logging via configuration and add regression test - [PR #19037](https://github.com/BerriAI/litellm/pull/19037) + - Fix header forwarding for embeddings endpoint - [PR #18960](https://github.com/BerriAI/litellm/pull/18960) + - Preserve llm_provider-* headers in error responses - [PR #19020](https://github.com/BerriAI/litellm/pull/19020) + - Fix turn_off_message_logging not redacting request messages in proxy_server_request field - [PR #18897](https://github.com/BerriAI/litellm/pull/18897) + +### Guardrails + +- **[Grayswan](../../docs/proxy/guardrails/grayswan)** + - Implement fail-open option (default: True) - [PR #18266](https://github.com/BerriAI/litellm/pull/18266) + +- **[Pangea](../../docs/proxy/guardrails/pangea)** + - Respect `default_on` during initialization - [PR #18912](https://github.com/BerriAI/litellm/pull/18912) + +- **[Panw Prisma AIRS](../../docs/proxy/guardrails/panw_prisma_airs)** + - Add custom violation message support - [PR #19272](https://github.com/BerriAI/litellm/pull/19272) + +- **General Guardrails** + - Fix SerializationIterator error and pass tools to guardrail - [PR #18932](https://github.com/BerriAI/litellm/pull/18932) + - Properly handle custom guardrails parameters - [PR #18978](https://github.com/BerriAI/litellm/pull/18978) + - Use clean error messages for blocked requests - [PR #19023](https://github.com/BerriAI/litellm/pull/19023) + - Guardrail moderation support with responses API - [PR #18957](https://github.com/BerriAI/litellm/pull/18957) + - Fix model-level guardrails not taking effect - [PR #18895](https://github.com/BerriAI/litellm/pull/18895) + +--- + +## Spend Tracking, Budgets and Rate Limiting + +- **Cost Calculation Fixes** + - Include IMAGE token count in cost calculation for Gemini models - [PR #18876](https://github.com/BerriAI/litellm/pull/18876) + - Fix negative text_tokens when using cache with images - [PR #18768](https://github.com/BerriAI/litellm/pull/18768) + - Fix image tokens spend logging for `/images/generations` - [PR #19009](https://github.com/BerriAI/litellm/pull/19009) + - Fix incorrect `prompt_tokens_details` in Gemini Image Generation - [PR #19070](https://github.com/BerriAI/litellm/pull/19070) + - Fix case-insensitive model cost map lookup - [PR #18208](https://github.com/BerriAI/litellm/pull/18208) + +- **Pricing Updates** + - Correct pricing for `openrouter/openai/gpt-oss-20b` - [PR #18899](https://github.com/BerriAI/litellm/pull/18899) + - Add pricing for `azure_ai/claude-opus-4-5` - [PR #19003](https://github.com/BerriAI/litellm/pull/19003) + - Update Novita models prices - [PR #19005](https://github.com/BerriAI/litellm/pull/19005) + - Fix Azure Grok prices - [PR #19102](https://github.com/BerriAI/litellm/pull/19102) + - Fix GCP GLM-4.7 pricing - [PR #19172](https://github.com/BerriAI/litellm/pull/19172) + - Sync DeepSeek chat/reasoner to V3.2 pricing - [PR #18884](https://github.com/BerriAI/litellm/pull/18884) + - Correct cache_read pricing for gemini-2.5-pro models - [PR #18157](https://github.com/BerriAI/litellm/pull/18157) + +- **Budget & Rate Limiting** + - Correct budget limit validation operator (>=) for team members - [PR #19207](https://github.com/BerriAI/litellm/pull/19207) + - Fix TPM 25% limiting by ensuring priority queue logic - [PR #19092](https://github.com/BerriAI/litellm/pull/19092) + - Cleanup spend logs cron verification, fix, and docs - [PR #19085](https://github.com/BerriAI/litellm/pull/19085) + +--- + +## MCP Gateway + +- Prevent duplicate MCP reload scheduler registration - [PR #18934](https://github.com/BerriAI/litellm/pull/18934) +- Forward MCP extra headers case-insensitively - [PR #18940](https://github.com/BerriAI/litellm/pull/18940) +- Fix MCP REST auth checks - [PR #19051](https://github.com/BerriAI/litellm/pull/19051) +- Fix generating two telemetry events in responses - [PR #18938](https://github.com/BerriAI/litellm/pull/18938) +- Fix MCP chat completions - [PR #19129](https://github.com/BerriAI/litellm/pull/19129) + +--- + +## Performance / Loadbalancing / Reliability improvements + +- **Performance Improvements** + - Remove bottleneck causing high CPU usage & overhead under heavy load - [PR #19049](https://github.com/BerriAI/litellm/pull/19049) + - Add CI enforcement for O(1) operations in `_get_model_cost_key` to prevent performance regressions - [PR #19052](https://github.com/BerriAI/litellm/pull/19052) + - Fix Azure embeddings JSON parsing to prevent connection leaks and ensure proper router cooldown - [PR #19167](https://github.com/BerriAI/litellm/pull/19167) + - Do not fallback to token counter if `disable_token_counter` is enabled - [PR #19041](https://github.com/BerriAI/litellm/pull/19041) + +- **Reliability** + - Add fallback endpoints support - [PR #19185](https://github.com/BerriAI/litellm/pull/19185) + - Fix stream_timeout parameter functionality - [PR #19191](https://github.com/BerriAI/litellm/pull/19191) + - Fix model matching priority in configuration - [PR #19012](https://github.com/BerriAI/litellm/pull/19012) + - Fix num_retries in litellm_params as per config - [PR #18975](https://github.com/BerriAI/litellm/pull/18975) + - Handle exceptions without response parameter - [PR #18919](https://github.com/BerriAI/litellm/pull/18919) + +- **Infrastructure** + - Add Custom CA certificates to boto3 clients - [PR #18942](https://github.com/BerriAI/litellm/pull/18942) + - Update boto3 to 1.40.15 and aioboto3 to 15.5.0 - [PR #19090](https://github.com/BerriAI/litellm/pull/19090) + - Make keepalive_timeout parameter work for Gunicorn - [PR #19087](https://github.com/BerriAI/litellm/pull/19087) + +- **Helm Chart** + - Fix mount config.yaml as single file in Helm chart - [PR #19146](https://github.com/BerriAI/litellm/pull/19146) + - Sync Helm chart versioning with production standards and Docker versions - [PR #18868](https://github.com/BerriAI/litellm/pull/18868) + +--- + +## Database Changes + +### Schema Updates + +| Table | Change Type | Description | PR | +| ----- | ----------- | ----------- | -- | +| `LiteLLM_ProxyModelTable` | New Columns | Added `created_at` and `updated_at` timestamp fields | [PR #18937](https://github.com/BerriAI/litellm/pull/18937) | + +--- + +## Documentation Updates + +- Add LiteLLM architecture md doc - [PR #19057](https://github.com/BerriAI/litellm/pull/19057), [PR #19252](https://github.com/BerriAI/litellm/pull/19252) +- Add troubleshooting guide - [PR #19096](https://github.com/BerriAI/litellm/pull/19096), [PR #19097](https://github.com/BerriAI/litellm/pull/19097), [PR #19099](https://github.com/BerriAI/litellm/pull/19099) +- Add structured issue reporting guides for CPU and memory issues - [PR #19117](https://github.com/BerriAI/litellm/pull/19117) +- Add Redis requirement warning for high-traffic deployments - [PR #18892](https://github.com/BerriAI/litellm/pull/18892) +- Update load balancing and routing with enable_pre_call_checks - [PR #18888](https://github.com/BerriAI/litellm/pull/18888) +- Updated pass_through with guided param - [PR #18886](https://github.com/BerriAI/litellm/pull/18886) +- Update message content types link and add content types table - [PR #18209](https://github.com/BerriAI/litellm/pull/18209) +- Add Redis initialization with kwargs - [PR #19183](https://github.com/BerriAI/litellm/pull/19183) +- Improve documentation for routing LLM calls via SAP Gen AI Hub - [PR #19166](https://github.com/BerriAI/litellm/pull/19166) +- Deleted Keys and Teams docs - [PR #19291](https://github.com/BerriAI/litellm/pull/19291) +- Claude Code end user tracking guide - [PR #19176](https://github.com/BerriAI/litellm/pull/19176) +- Add MCP troubleshooting guide - [PR #19122](https://github.com/BerriAI/litellm/pull/19122) +- Add auth message UI documentation - [PR #19063](https://github.com/BerriAI/litellm/pull/19063) +- Add guide for mounting custom callbacks in Helm/K8s - [PR #19136](https://github.com/BerriAI/litellm/pull/19136) + +--- + +## Bug Fixes + +- Fix Swagger UI path execute error with server_root_path in OpenAPI schema - [PR #18947](https://github.com/BerriAI/litellm/pull/18947) +- Normalize OpenAI SDK BaseModel choices/messages to avoid Pydantic serializer warnings - [PR #18972](https://github.com/BerriAI/litellm/pull/18972) +- Add contextual gap checks and word-form digits - [PR #18301](https://github.com/BerriAI/litellm/pull/18301) +- Clean up orphaned files from repository root - [PR #19150](https://github.com/BerriAI/litellm/pull/19150) +- Include proxy/prisma_migration.py in non-root - [PR #18971](https://github.com/BerriAI/litellm/pull/18971) +- Update prisma_migration.py - [PR #19083](https://github.com/BerriAI/litellm/pull/19083) + +--- + +## New Contributors + +* @yogeshwaran10 made their first contribution in [PR #18898](https://github.com/BerriAI/litellm/pull/18898) +* @theonlypal made their first contribution in [PR #18937](https://github.com/BerriAI/litellm/pull/18937) +* @jonmagic made their first contribution in [PR #18935](https://github.com/BerriAI/litellm/pull/18935) +* @houdataali made their first contribution in [PR #19025](https://github.com/BerriAI/litellm/pull/19025) +* @hummat made their first contribution in [PR #18972](https://github.com/BerriAI/litellm/pull/18972) +* @berkeyalciin made their first contribution in [PR #18966](https://github.com/BerriAI/litellm/pull/18966) +* @MateuszOssGit made their first contribution in [PR #18959](https://github.com/BerriAI/litellm/pull/18959) +* @xfan001 made their first contribution in [PR #18947](https://github.com/BerriAI/litellm/pull/18947) +* @nulone made their first contribution in [PR #18884](https://github.com/BerriAI/litellm/pull/18884) +* @debnil-mercor made their first contribution in [PR #18919](https://github.com/BerriAI/litellm/pull/18919) +* @hakhundov made their first contribution in [PR #17420](https://github.com/BerriAI/litellm/pull/17420) +* @rohanwinsor made their first contribution in [PR #19078](https://github.com/BerriAI/litellm/pull/19078) +* @pgolm made their first contribution in [PR #19020](https://github.com/BerriAI/litellm/pull/19020) +* @vikigenius made their first contribution in [PR #19148](https://github.com/BerriAI/litellm/pull/19148) +* @burnerburnerburnerman made their first contribution in [PR #19090](https://github.com/BerriAI/litellm/pull/19090) +* @yfge made their first contribution in [PR #19076](https://github.com/BerriAI/litellm/pull/19076) +* @danielnyari-seon made their first contribution in [PR #19083](https://github.com/BerriAI/litellm/pull/19083) +* @guilherme-segantini made their first contribution in [PR #19166](https://github.com/BerriAI/litellm/pull/19166) +* @jgreek made their first contribution in [PR #19147](https://github.com/BerriAI/litellm/pull/19147) +* @anand-kamble made their first contribution in [PR #19193](https://github.com/BerriAI/litellm/pull/19193) +* @neubig made their first contribution in [PR #19162](https://github.com/BerriAI/litellm/pull/19162) + +--- + +## Full Changelog + +**[View complete changelog on GitHub](https://github.com/BerriAI/litellm/compare/v1.80.15.rc.1...v1.81.0.rc.1)** diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index 2e8ea07ab7..d1abe45332 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -108,15 +108,31 @@ const sidebars = { { type: "category", label: "AI Tools (OpenWebUI, Claude Code, etc.)", + link: { + type: "generated-index", + title: "AI Tools", + description: "Integrate LiteLLM with AI tools like OpenWebUI, Claude Code, and more", + slug: "/ai_tools" + }, items: [ - "tutorials/claude_responses_api", + "tutorials/openweb_ui", + { + type: "category", + label: "Claude Code", + items: [ + "tutorials/claude_responses_api", + "tutorials/claude_code_customer_tracking", + "tutorials/claude_code_websearch", + "tutorials/claude_mcp", + "tutorials/claude_non_anthropic_models", + ] + }, "tutorials/cost_tracking_coding", "tutorials/cursor_integration", "tutorials/github_copilot_integration", "tutorials/litellm_gemini_cli", "tutorials/litellm_qwen_code_cli", - "tutorials/openai_codex", - "tutorials/openweb_ui" + "tutorials/openai_codex" ] }, @@ -259,12 +275,21 @@ const sidebars = { "proxy/ui/bulk_edit_users", "proxy/ui_credentials", "tutorials/scim_litellm", + { + type: "category", + label: "UI Usage Tracking", + items: [ + "proxy/customer_usage", + "proxy/endpoint_activity" + ] + }, { type: "category", label: "UI Logs", items: [ "proxy/ui_logs", - "proxy/ui_logs_sessions" + "proxy/ui_logs_sessions", + "proxy/deleted_keys_teams" ] } ], @@ -314,7 +339,6 @@ const sidebars = { "proxy/team_budgets", "proxy/tag_budgets", "proxy/customers", - "proxy/customer_usage", "proxy/dynamic_rate_limit", "proxy/rate_limit_tiers", "proxy/temporary_budget_increase", @@ -488,6 +512,7 @@ const sidebars = { "mcp_control", "mcp_cost", "mcp_guardrail", + "mcp_troubleshoot", ] }, "anthropic_unified", @@ -602,6 +627,7 @@ const sidebars = { label: "Azure AI", items: [ "providers/azure_ai", + "providers/azure_ai/azure_model_router", "providers/azure_ai_agents", "providers/azure_ocr", "providers/azure_document_intelligence", @@ -691,6 +717,7 @@ const sidebars = { "providers/galadriel", "providers/github", "providers/github_copilot", + "providers/chatgpt", "providers/gradient_ai", "providers/groq", "providers/helicone", @@ -841,6 +868,7 @@ const sidebars = { "proxy/load_balancing", "proxy/provider_budget_routing", "proxy/reliability", + "proxy/fallback_management", "proxy/tag_routing", "proxy/timeout", "wildcard_routing" @@ -860,10 +888,11 @@ const sidebars = { type: "category", label: "Tutorials", items: [ - "tutorials/openweb_ui", - "tutorials/openai_codex", - "tutorials/litellm_gemini_cli", - "tutorials/litellm_qwen_code_cli", + { + type: "link", + label: "AI Coding Tools (OpenWebUI, Claude Code, Gemini CLI, OpenAI Codex, etc.)", + href: "/docs/ai_tools", + }, "tutorials/anthropic_file_usage", "tutorials/default_team_self_serve", "tutorials/msft_sso", @@ -873,7 +902,6 @@ const sidebars = { "tutorials/presidio_pii_masking", "tutorials/elasticsearch_logging", "tutorials/gemini_realtime_with_audio", - "tutorials/claude_responses_api", { type: "category", label: "LiteLLM Python SDK Tutorials", @@ -970,6 +998,14 @@ const sidebars = { ], }, "troubleshoot", + { + type: "category", + label: "Issue Reporting", + items: [ + "troubleshoot/cpu_issues", + "troubleshoot/memory_issues", + ], + }, ], }; diff --git a/document.txt b/document.txt deleted file mode 100644 index 4a91207970..0000000000 --- a/document.txt +++ /dev/null @@ -1,19 +0,0 @@ -LiteLLM provides a unified interface for calling 100+ different LLM providers. - -Key capabilities: -- Translate requests to provider-specific formats -- Consistent OpenAI-compatible responses -- Retry and fallback logic across deployments -- Proxy server with authentication and rate limiting -- Support for streaming, function calling, and embeddings - -Popular providers supported: -- OpenAI (GPT-4, GPT-3.5) -- Anthropic (Claude) -- AWS Bedrock -- Azure OpenAI -- Google Vertex AI -- Cohere -- And 95+ more - -This allows developers to easily switch between providers without code changes. diff --git a/enterprise/litellm_enterprise/proxy/__init__.py b/enterprise/litellm_enterprise/proxy/__init__.py new file mode 100644 index 0000000000..52b74882bc --- /dev/null +++ b/enterprise/litellm_enterprise/proxy/__init__.py @@ -0,0 +1 @@ +# Package marker for enterprise proxy components. diff --git a/enterprise/litellm_enterprise/proxy/common_utils/__init__.py b/enterprise/litellm_enterprise/proxy/common_utils/__init__.py new file mode 100644 index 0000000000..fe8384c892 --- /dev/null +++ b/enterprise/litellm_enterprise/proxy/common_utils/__init__.py @@ -0,0 +1 @@ +# Package marker for enterprise proxy common utilities. diff --git a/enterprise/pyproject.toml b/enterprise/pyproject.toml index 1f3da43257..0d86460a64 100644 --- a/enterprise/pyproject.toml +++ b/enterprise/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "litellm-enterprise" -version = "0.1.27" +version = "0.1.28" description = "Package for LiteLLM Enterprise features" authors = ["BerriAI"] readme = "README.md" @@ -22,7 +22,7 @@ requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.commitizen] -version = "0.1.27" +version = "0.1.28" version_files = [ "pyproject.toml:version", "../requirements.txt:litellm-enterprise==", diff --git a/flux2_test_image.png b/flux2_test_image.png deleted file mode 100644 index d40fa1a65f..0000000000 Binary files a/flux2_test_image.png and /dev/null differ diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.15-py3-none-any.whl b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.15-py3-none-any.whl new file mode 100644 index 0000000000..ba2e5e5fce Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.15-py3-none-any.whl differ diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.15.tar.gz b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.15.tar.gz new file mode 100644 index 0000000000..7d01b3de6f Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.15.tar.gz differ diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.22-py3-none-any.whl b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.22-py3-none-any.whl new file mode 100644 index 0000000000..1e2f6967dc Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.22-py3-none-any.whl differ diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.22.tar.gz b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.22.tar.gz new file mode 100644 index 0000000000..1864c77ddd Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.22.tar.gz differ diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.23-py3-none-any.whl b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.23-py3-none-any.whl new file mode 100644 index 0000000000..54fb2d23cd Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.23-py3-none-any.whl differ diff --git a/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.23.tar.gz b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.23.tar.gz new file mode 100644 index 0000000000..9c1a2625f7 Binary files /dev/null and b/litellm-proxy-extras/dist/litellm_proxy_extras-0.4.23.tar.gz differ diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251115120021_baseline_diff/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251115120021_baseline_diff/migration.sql deleted file mode 100644 index 2f725d8380..0000000000 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251115120021_baseline_diff/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- This is an empty migration. - diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251115120539_baseline_diff/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251115120539_baseline_diff/migration.sql deleted file mode 100644 index 2f725d8380..0000000000 --- a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251115120539_baseline_diff/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- This is an empty migration. - diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20251219110931_add_deleted_keys_and_deleted_teams_tables/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251219110931_add_deleted_keys_and_deleted_teams_tables/migration.sql new file mode 100644 index 0000000000..6ca66ddaad --- /dev/null +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20251219110931_add_deleted_keys_and_deleted_teams_tables/migration.sql @@ -0,0 +1,117 @@ +-- CreateTable +CREATE TABLE "LiteLLM_DeletedTeamTable" ( + "id" TEXT NOT NULL, + "team_id" TEXT NOT NULL, + "team_alias" TEXT, + "organization_id" TEXT, + "object_permission_id" TEXT, + "admins" TEXT[], + "members" TEXT[], + "members_with_roles" JSONB NOT NULL DEFAULT '{}', + "metadata" JSONB NOT NULL DEFAULT '{}', + "max_budget" DOUBLE PRECISION, + "spend" DOUBLE PRECISION NOT NULL DEFAULT 0.0, + "models" TEXT[], + "max_parallel_requests" INTEGER, + "tpm_limit" BIGINT, + "rpm_limit" BIGINT, + "budget_duration" TEXT, + "budget_reset_at" TIMESTAMP(3), + "blocked" BOOLEAN NOT NULL DEFAULT false, + "model_spend" JSONB NOT NULL DEFAULT '{}', + "model_max_budget" JSONB NOT NULL DEFAULT '{}', + "team_member_permissions" TEXT[] DEFAULT ARRAY[]::TEXT[], + "model_id" INTEGER, + "created_at" TIMESTAMP(3), + "updated_at" TIMESTAMP(3), + "deleted_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "deleted_by" TEXT, + "deleted_by_api_key" TEXT, + "litellm_changed_by" TEXT, + + CONSTRAINT "LiteLLM_DeletedTeamTable_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "LiteLLM_DeletedVerificationToken" ( + "id" TEXT NOT NULL, + "token" TEXT NOT NULL, + "key_name" TEXT, + "key_alias" TEXT, + "soft_budget_cooldown" BOOLEAN NOT NULL DEFAULT false, + "spend" DOUBLE PRECISION NOT NULL DEFAULT 0.0, + "expires" TIMESTAMP(3), + "models" TEXT[], + "aliases" JSONB NOT NULL DEFAULT '{}', + "config" JSONB NOT NULL DEFAULT '{}', + "user_id" TEXT, + "team_id" TEXT, + "permissions" JSONB NOT NULL DEFAULT '{}', + "max_parallel_requests" INTEGER, + "metadata" JSONB NOT NULL DEFAULT '{}', + "blocked" BOOLEAN, + "tpm_limit" BIGINT, + "rpm_limit" BIGINT, + "max_budget" DOUBLE PRECISION, + "budget_duration" TEXT, + "budget_reset_at" TIMESTAMP(3), + "allowed_cache_controls" TEXT[] DEFAULT ARRAY[]::TEXT[], + "allowed_routes" TEXT[] DEFAULT ARRAY[]::TEXT[], + "model_spend" JSONB NOT NULL DEFAULT '{}', + "model_max_budget" JSONB NOT NULL DEFAULT '{}', + "budget_id" TEXT, + "organization_id" TEXT, + "object_permission_id" TEXT, + "created_at" TIMESTAMP(3), + "created_by" TEXT, + "updated_at" TIMESTAMP(3), + "updated_by" TEXT, + "rotation_count" INTEGER DEFAULT 0, + "auto_rotate" BOOLEAN DEFAULT false, + "rotation_interval" TEXT, + "last_rotation_at" TIMESTAMP(3), + "key_rotation_at" TIMESTAMP(3), + "deleted_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "deleted_by" TEXT, + "deleted_by_api_key" TEXT, + "litellm_changed_by" TEXT, + + CONSTRAINT "LiteLLM_DeletedVerificationToken_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedTeamTable_team_id_idx" ON "LiteLLM_DeletedTeamTable"("team_id"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedTeamTable_deleted_at_idx" ON "LiteLLM_DeletedTeamTable"("deleted_at"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedTeamTable_organization_id_idx" ON "LiteLLM_DeletedTeamTable"("organization_id"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedTeamTable_team_alias_idx" ON "LiteLLM_DeletedTeamTable"("team_alias"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedTeamTable_created_at_idx" ON "LiteLLM_DeletedTeamTable"("created_at"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedVerificationToken_token_idx" ON "LiteLLM_DeletedVerificationToken"("token"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedVerificationToken_deleted_at_idx" ON "LiteLLM_DeletedVerificationToken"("deleted_at"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedVerificationToken_user_id_idx" ON "LiteLLM_DeletedVerificationToken"("user_id"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedVerificationToken_team_id_idx" ON "LiteLLM_DeletedVerificationToken"("team_id"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedVerificationToken_organization_id_idx" ON "LiteLLM_DeletedVerificationToken"("organization_id"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedVerificationToken_key_alias_idx" ON "LiteLLM_DeletedVerificationToken"("key_alias"); + +-- CreateIndex +CREATE INDEX "LiteLLM_DeletedVerificationToken_created_at_idx" ON "LiteLLM_DeletedVerificationToken"("created_at"); + diff --git a/litellm-proxy-extras/litellm_proxy_extras/migrations/20260116142756_update_deleted_keys_teams_table_routing_settings/migration.sql b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260116142756_update_deleted_keys_teams_table_routing_settings/migration.sql new file mode 100644 index 0000000000..9426bed0da --- /dev/null +++ b/litellm-proxy-extras/litellm_proxy_extras/migrations/20260116142756_update_deleted_keys_teams_table_routing_settings/migration.sql @@ -0,0 +1,6 @@ +-- AlterTable +ALTER TABLE "LiteLLM_DeletedTeamTable" ADD COLUMN "router_settings" JSONB DEFAULT '{}'; + +-- AlterTable +ALTER TABLE "LiteLLM_DeletedVerificationToken" ADD COLUMN "router_settings" JSONB DEFAULT '{}'; + diff --git a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma index 56fe093a8b..71b398c59a 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/schema.prisma +++ b/litellm-proxy-extras/litellm_proxy_extras/schema.prisma @@ -132,6 +132,49 @@ model LiteLLM_TeamTable { object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id]) } +// Audit table for deleted teams - preserves spend and team information for historical tracking +model LiteLLM_DeletedTeamTable { + id String @id @default(uuid()) + team_id String // Original team_id + team_alias String? + organization_id String? + object_permission_id String? + admins String[] + members String[] + members_with_roles Json @default("{}") + metadata Json @default("{}") + max_budget Float? + spend Float @default(0.0) + models String[] + max_parallel_requests Int? + tpm_limit BigInt? + rpm_limit BigInt? + budget_duration String? + budget_reset_at DateTime? + blocked Boolean @default(false) + model_spend Json @default("{}") + model_max_budget Json @default("{}") + router_settings Json? @default("{}") + team_member_permissions String[] @default([]) + model_id Int? // id for LiteLLM_ModelTable -> stores team-level model aliases + + // Original timestamps from team creation/updates + created_at DateTime? @map("created_at") + updated_at DateTime? @map("updated_at") + + // Deletion metadata + deleted_at DateTime @default(now()) @map("deleted_at") + deleted_by String? @map("deleted_by") // User who deleted the team + deleted_by_api_key String? @map("deleted_by_api_key") // API key hash that performed the deletion + litellm_changed_by String? @map("litellm_changed_by") // From litellm-changed-by header if provided + + @@index([team_id]) + @@index([deleted_at]) + @@index([organization_id]) + @@index([team_alias]) + @@index([created_at]) +} + // Track spend, rate limit, budget Users model LiteLLM_UserTable { user_id String @id @@ -259,6 +302,62 @@ model LiteLLM_VerificationToken { object_permission LiteLLM_ObjectPermissionTable? @relation(fields: [object_permission_id], references: [object_permission_id]) } +// Audit table for deleted keys - preserves spend and key information for historical tracking +model LiteLLM_DeletedVerificationToken { + id String @id @default(uuid()) + token String // Original token (hashed) + key_name String? + key_alias String? + soft_budget_cooldown Boolean @default(false) + spend Float @default(0.0) + expires DateTime? + models String[] + aliases Json @default("{}") + config Json @default("{}") + user_id String? + team_id String? + permissions Json @default("{}") + max_parallel_requests Int? + metadata Json @default("{}") + blocked Boolean? + tpm_limit BigInt? + rpm_limit BigInt? + max_budget Float? + budget_duration String? + budget_reset_at DateTime? + allowed_cache_controls String[] @default([]) + allowed_routes String[] @default([]) + model_spend Json @default("{}") + model_max_budget Json @default("{}") + router_settings Json? @default("{}") + budget_id String? + organization_id String? + object_permission_id String? + created_at DateTime? // Original creation timestamp + created_by String? // Original creator + updated_at DateTime? // Last update timestamp before deletion + updated_by String? // Last user who updated before deletion + rotation_count Int? @default(0) + auto_rotate Boolean? @default(false) + rotation_interval String? + last_rotation_at DateTime? + key_rotation_at DateTime? + + // Deletion metadata + deleted_at DateTime @default(now()) @map("deleted_at") + deleted_by String? @map("deleted_by") // User who deleted the key + deleted_by_api_key String? @map("deleted_by_api_key") // API key hash that performed the deletion + litellm_changed_by String? @map("litellm_changed_by") // From litellm-changed-by header if provided + + @@index([token]) + @@index([deleted_at]) + @@index([user_id]) + @@index([team_id]) + @@index([organization_id]) + @@index([key_alias]) + @@index([created_at]) +} + model LiteLLM_EndUserTable { user_id String @id alias String? // admin-facing alias diff --git a/litellm-proxy-extras/litellm_proxy_extras/utils.py b/litellm-proxy-extras/litellm_proxy_extras/utils.py index 7ffbe95be1..4e95267d8a 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/utils.py +++ b/litellm-proxy-extras/litellm_proxy_extras/utils.py @@ -11,6 +11,11 @@ from typing import Optional from litellm_proxy_extras._logging import logger +try: + from litellm.caching.redis_cache import RedisCache +except ImportError: + RedisCache = None # type: ignore + def str_to_bool(value: Optional[str]) -> bool: if value is None: @@ -18,6 +23,154 @@ def str_to_bool(value: Optional[str]) -> bool: return value.lower() in ("true", "1", "t", "y", "yes") +class MigrationLockManager: + """Redis-based lock manager for database migrations. + + Prevents concurrent Prisma migrations in multi-pod deployments by using + a distributed lock. Only one pod can hold the lock and run migrations at a time. + """ + + MIGRATION_LOCK_KEY = "migration_lock" + LOCK_TTL_SECONDS = 300 # 5 minutes TTL + + def __init__(self, redis_cache: Optional["RedisCache"] = None): + """Initialize the migration lock manager. + + Args: + redis_cache: Optional RedisCache instance for distributed locking. + If None, migrations run without lock protection (single instance mode). + """ + self.redis_cache = redis_cache + self.lock_acquired = False + self.pod_id = f"pod_{os.getpid()}_{int(time.time())}" + + def _get_redis_lock_key(self) -> str: + """Get Redis lock key for migration.""" + return f"migration_lock:{self.MIGRATION_LOCK_KEY}" + + def acquire_lock(self) -> bool: + """Acquire migration lock using Redis SET NX. + + Returns: + bool: True if lock acquired, False otherwise. + """ + if self.redis_cache is None: + logger.warning( + "Redis cache is not available, running migration without lock protection" + ) + self.lock_acquired = True + return True + + try: + lock_key = self._get_redis_lock_key() + + # FIX: Use native Redis SET NX instead of RedisCache.set_cache() + # Original bug: set_cache() doesn't support nx parameter and returns None + # Fixed: Use redis_client.set() directly which returns True/False + acquired = self.redis_cache.redis_client.set( + name=lock_key, + value=self.pod_id, + nx=True, # Only set if key doesn't exist + ex=self.LOCK_TTL_SECONDS, # Set expiration time + ) + + if acquired: + self.lock_acquired = True + logger.info(f"Migration lock acquired by pod {self.pod_id}") + return True + else: + logger.info("Migration lock is already held by another pod") + return False + + except Exception as e: + logger.warning(f"Failed to acquire migration lock: {e}") + return False + + def wait_for_lock_release( + self, check_interval: int = 5, max_wait: int = 300 + ) -> bool: + """Wait for another process to release the lock. + + Args: + check_interval: Seconds to wait between lock acquisition attempts. + max_wait: Maximum seconds to wait for lock release. + + Returns: + bool: True if lock acquired after waiting, False if timeout. + """ + if self.redis_cache is None: + logger.warning("Redis cache is not available, cannot wait for lock") + return False + + logger.info(f"Waiting for migration lock to be released (max {max_wait}s)...") + start_time = time.time() + + while time.time() - start_time < max_wait: + # Try to acquire lock using the public acquire_lock method + if self.acquire_lock(): + logger.info( + f"Migration lock acquired after waiting by pod {self.pod_id}" + ) + return True + + time.sleep(check_interval) + + logger.warning(f"Failed to acquire migration lock within {max_wait} seconds") + return False + + def release_lock(self): + """Release migration lock atomically using Lua script. + + FIX: Use Lua script for atomic compare-and-delete to prevent race conditions. + Original bug: Non-atomic GET then DELETE allows another pod to acquire lock + between the GET and DELETE operations. + """ + if not self.lock_acquired or self.redis_cache is None: + return + + try: + lock_key = self._get_redis_lock_key() + + # FIX: Use Lua script for atomic compare-and-delete + # This prevents race condition where: + # 1. Pod A reads lock value (sees its own pod_id) + # 2. Lock TTL expires + # 3. Pod B acquires lock + # 4. Pod A deletes lock (deletes Pod B's lock!) + lua_script = """ + if redis.call("GET", KEYS[1]) == ARGV[1] then + return redis.call("DEL", KEYS[1]) + else + return 0 + end + """ + + result = self.redis_cache.redis_client.eval( + lua_script, + 1, # Number of keys + lock_key, # KEYS[1] + self.pod_id, # ARGV[1] + ) + + if result == 1: + logger.info(f"Migration lock released by pod {self.pod_id}") + else: + logger.warning(f"Pod {self.pod_id} cannot release lock (not owner)") + + except Exception as e: + logger.warning(f"Failed to release migration lock: {e}") + finally: + self.lock_acquired = False + + def __enter__(self): + """Context manager entry - acquire lock when entering with statement.""" + self.acquire_lock() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + """Context manager exit - release lock when exiting with statement.""" + self.release_lock() + def _get_prisma_env() -> dict: """Get environment variables for Prisma, handling offline mode if configured.""" @@ -25,7 +178,9 @@ def _get_prisma_env() -> dict: if str_to_bool(os.getenv("PRISMA_OFFLINE_MODE")): # These env vars prevent Prisma from attempting downloads prisma_env["NPM_CONFIG_PREFER_OFFLINE"] = "true" - prisma_env["NPM_CONFIG_CACHE"] = os.getenv("NPM_CONFIG_CACHE", "/app/.cache/npm") + prisma_env["NPM_CONFIG_CACHE"] = os.getenv( + "NPM_CONFIG_CACHE", "/app/.cache/npm" + ) return prisma_env @@ -34,29 +189,28 @@ def _get_prisma_command() -> str: if str_to_bool(os.getenv("PRISMA_OFFLINE_MODE")): # Primary location where Prisma Python package installs the CLI default_cli_path = "/app/.cache/prisma-python/binaries/node_modules/.bin/prisma" - + # Check if custom path is provided (for flexibility) custom_cli_path = os.getenv("PRISMA_CLI_PATH") if custom_cli_path and os.path.exists(custom_cli_path): logger.info(f"Using custom Prisma CLI at {custom_cli_path}") return custom_cli_path - + # Check the default location if os.path.exists(default_cli_path): logger.info(f"Using cached Prisma CLI at {default_cli_path}") return default_cli_path - + # If not found, log warning and fall back logger.warning( f"Prisma CLI not found at {default_cli_path}. " "Falling back to Python wrapper (may attempt downloads)" ) - + # Fall back to the Python wrapper (will work in online mode) return "prisma" - class ProxyExtrasDBManager: @staticmethod def _get_prisma_dir() -> str: @@ -119,7 +273,7 @@ class ProxyExtrasDBManager: stdout=open(migration_file, "w"), check=True, timeout=30, - env=prisma_env + env=prisma_env, ) # 3. Mark the migration as applied since it represents current state @@ -134,7 +288,7 @@ class ProxyExtrasDBManager: ], check=True, timeout=30, - env=prisma_env + env=prisma_env, ) return True @@ -159,14 +313,20 @@ class ProxyExtrasDBManager: @staticmethod def _roll_back_migration(migration_name: str): """Mark a specific migration as rolled back""" - # Set up environment for offline mode if configured + # Set up environment for offline mode if configured prisma_env = _get_prisma_env() subprocess.run( - [_get_prisma_command(), "migrate", "resolve", "--rolled-back", migration_name], + [ + _get_prisma_command(), + "migrate", + "resolve", + "--rolled-back", + migration_name, + ], timeout=60, check=True, capture_output=True, - env=prisma_env + env=prisma_env, ) @staticmethod @@ -178,7 +338,7 @@ class ProxyExtrasDBManager: timeout=60, check=True, capture_output=True, - env=prisma_env + env=prisma_env, ) @staticmethod @@ -248,7 +408,7 @@ class ProxyExtrasDBManager: if not database_url: logger.error("DATABASE_URL not set") return - + diff_dir = ( Path(migrations_dir) / "migrations" @@ -283,7 +443,7 @@ class ProxyExtrasDBManager: check=True, timeout=60, stdout=f, - env=_get_prisma_env() + env=_get_prisma_env(), ) except subprocess.CalledProcessError as e: logger.warning(f"Failed to generate migration diff: {e.stderr}") @@ -313,7 +473,7 @@ class ProxyExtrasDBManager: check=True, capture_output=True, text=True, - env=_get_prisma_env() + env=_get_prisma_env(), ) logger.info(f"prisma db execute stdout: {result.stdout}") logger.info("✅ Migration diff applied successfully") @@ -331,12 +491,18 @@ class ProxyExtrasDBManager: try: logger.info(f"Resolving migration: {migration_name}") subprocess.run( - [_get_prisma_command(), "migrate", "resolve", "--applied", migration_name], + [ + _get_prisma_command(), + "migrate", + "resolve", + "--applied", + migration_name, + ], timeout=60, check=True, capture_output=True, text=True, - env=_get_prisma_env() + env=_get_prisma_env(), ) logger.debug(f"Resolved migration: {migration_name}") except subprocess.CalledProcessError as e: @@ -346,19 +512,57 @@ class ProxyExtrasDBManager: ) @staticmethod - def setup_database(use_migrate: bool = False) -> bool: + def setup_database( + use_migrate: bool = False, redis_cache: Optional["RedisCache"] = None + ) -> bool: """ - Set up the database using either prisma migrate or prisma db push - Uses migrations from litellm-proxy-extras package + Set up the database using either prisma migrate or prisma db push. + Uses migrations from litellm-proxy-extras package. + In multi-instance environment, use redis lock to prevent concurrent execution. Args: - schema_path (str): Path to the Prisma schema file use_migrate (bool): Whether to use prisma migrate instead of db push + redis_cache: Redis cache instance for distributed locking Returns: bool: True if setup was successful, False otherwise """ schema_path = ProxyExtrasDBManager._get_prisma_dir() + "/schema.prisma" + + database_url = os.getenv("DATABASE_URL") + if not database_url: + logger.error("DATABASE_URL environment variable is not set") + return False + + # Use MigrationLockManager to prevent concurrent migration execution + with MigrationLockManager(redis_cache) as lock_manager: + # Lock is already acquired in __enter__, check if it was successful + if not lock_manager.lock_acquired: + # Cannot acquire lock, another process is running migration + logger.info( + "Another pod is running migration, waiting for completion..." + ) + + # Wait for other process to complete migration + if not lock_manager.wait_for_lock_release(): + logger.error("Failed to acquire migration lock after waiting") + return False + + # Successfully acquired lock, proceed with migration + logger.info("Acquired migration lock, proceeding with migration") + return ProxyExtrasDBManager._execute_migration(use_migrate, schema_path) + + @staticmethod + def _execute_migration(use_migrate: bool, schema_path: str) -> bool: + """Execute the actual migration. + + Args: + use_migrate: Whether to use prisma migrate instead of db push + schema_path: Path to the Prisma schema file + + Returns: + bool: True if migration was successful, False otherwise + """ for attempt in range(4): original_dir = os.getcwd() migrations_dir = ProxyExtrasDBManager._get_prisma_dir() @@ -375,7 +579,7 @@ class ProxyExtrasDBManager: check=True, capture_output=True, text=True, - env=_get_prisma_env() + env=_get_prisma_env(), ) logger.info(f"prisma migrate deploy stdout: {result.stdout}") @@ -413,7 +617,7 @@ class ProxyExtrasDBManager: check=True, capture_output=True, text=True, - env=_get_prisma_env() + env=_get_prisma_env(), ) logger.info( f"✅ Migration {failed_migration} marked as rolled back... retrying" diff --git a/litellm-proxy-extras/pyproject.toml b/litellm-proxy-extras/pyproject.toml index 2952aa6c97..52258ebe2e 100644 --- a/litellm-proxy-extras/pyproject.toml +++ b/litellm-proxy-extras/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "litellm-proxy-extras" -version = "0.4.21" +version = "0.4.23" description = "Additional files for the LiteLLM Proxy. Reduces the size of the main litellm package." authors = ["BerriAI"] readme = "README.md" @@ -22,7 +22,7 @@ requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" [tool.commitizen] -version = "0.4.21" +version = "0.4.23" version_files = [ "pyproject.toml:version", "../requirements.txt:litellm-proxy-extras==", diff --git a/litellm/__init__.py b/litellm/__init__.py index 2b7d26de12..83cbcfda3f 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -9,7 +9,7 @@ warnings.filterwarnings("ignore", message=".*conflict with protected namespace.* warnings.filterwarnings( "ignore", message=".*Accessing the.*attribute on the instance is deprecated.*" ) -### INIT VARIABLES ######################## +### INIT VARIABLES ######################### import threading import os from typing import ( @@ -557,6 +557,7 @@ docker_model_runner_models: Set = set() amazon_nova_models: Set = set() stability_models: Set = set() github_copilot_models: Set = set() +chatgpt_models: Set = set() minimax_models: Set = set() aws_polly_models: Set = set() gigachat_models: Set = set() @@ -812,6 +813,8 @@ def add_known_models(): stability_models.add(key) elif value.get("litellm_provider") == "github_copilot": github_copilot_models.add(key) + elif value.get("litellm_provider") == "chatgpt": + chatgpt_models.add(key) elif value.get("litellm_provider") == "minimax": minimax_models.add(key) elif value.get("litellm_provider") == "aws_polly": @@ -1025,6 +1028,7 @@ models_by_provider: dict = { "amazon_nova": amazon_nova_models, "stability": stability_models, "github_copilot": github_copilot_models, + "chatgpt": chatgpt_models, "minimax": minimax_models, "aws_polly": aws_polly_models, "gigachat": gigachat_models, @@ -1458,6 +1462,8 @@ if TYPE_CHECKING: from .llms.github_copilot.chat.transformation import GithubCopilotConfig as GithubCopilotConfig from .llms.github_copilot.responses.transformation import GithubCopilotResponsesAPIConfig as GithubCopilotResponsesAPIConfig from .llms.github_copilot.embedding.transformation import GithubCopilotEmbeddingConfig as GithubCopilotEmbeddingConfig + from .llms.chatgpt.chat.transformation import ChatGPTConfig as ChatGPTConfig + from .llms.chatgpt.responses.transformation import ChatGPTResponsesAPIConfig as ChatGPTResponsesAPIConfig from .llms.gigachat.chat.transformation import GigaChatConfig as GigaChatConfig from .llms.gigachat.embedding.transformation import GigaChatEmbeddingConfig as GigaChatEmbeddingConfig from .llms.nebius.chat.transformation import NebiusConfig as NebiusConfig diff --git a/litellm/_lazy_imports_registry.py b/litellm/_lazy_imports_registry.py index f37c4dc6d0..46abde4eb5 100644 --- a/litellm/_lazy_imports_registry.py +++ b/litellm/_lazy_imports_registry.py @@ -253,6 +253,8 @@ LLM_CONFIG_NAMES = ( "IBMWatsonXAudioTranscriptionConfig", "GithubCopilotConfig", "GithubCopilotResponsesAPIConfig", + "ChatGPTConfig", + "ChatGPTResponsesAPIConfig", "ManusResponsesAPIConfig", "GithubCopilotEmbeddingConfig", "NebiusConfig", @@ -648,6 +650,8 @@ _LLM_CONFIGS_IMPORT_MAP = { "GithubCopilotConfig": (".llms.github_copilot.chat.transformation", "GithubCopilotConfig"), "GithubCopilotResponsesAPIConfig": (".llms.github_copilot.responses.transformation", "GithubCopilotResponsesAPIConfig"), "GithubCopilotEmbeddingConfig": (".llms.github_copilot.embedding.transformation", "GithubCopilotEmbeddingConfig"), + "ChatGPTConfig": (".llms.chatgpt.chat.transformation", "ChatGPTConfig"), + "ChatGPTResponsesAPIConfig": (".llms.chatgpt.responses.transformation", "ChatGPTResponsesAPIConfig"), "NebiusConfig": (".llms.nebius.chat.transformation", "NebiusConfig"), "WandbConfig": (".llms.wandb.chat.transformation", "WandbConfig"), "GigaChatConfig": (".llms.gigachat.chat.transformation", "GigaChatConfig"), diff --git a/litellm/_logging.py b/litellm/_logging.py index 73902d2fc5..b3156b15ba 100644 --- a/litellm/_logging.py +++ b/litellm/_logging.py @@ -133,6 +133,26 @@ ALL_LOGGERS = [ ] +def _get_loggers_to_initialize(): + """ + Get all loggers that should be initialized with the JSON handler. + + Includes third-party integration loggers (like langfuse) if they are + configured as callbacks. + """ + import litellm + + loggers = list(ALL_LOGGERS) + + # Add langfuse logger if langfuse is being used as a callback + langfuse_callbacks = {"langfuse", "langfuse_otel"} + all_callbacks = set(litellm.success_callback + litellm.failure_callback) + if langfuse_callbacks & all_callbacks: + loggers.append(logging.getLogger("langfuse")) + + return loggers + + def _initialize_loggers_with_handler(handler: logging.Handler): """ Initialize all loggers with a handler @@ -140,7 +160,7 @@ def _initialize_loggers_with_handler(handler: logging.Handler): - Adds a handler to each logger - Prevents bubbling to parent/root (critical to prevent duplicate JSON logs) """ - for lg in ALL_LOGGERS: + for lg in _get_loggers_to_initialize(): lg.handlers.clear() # remove any existing handlers lg.addHandler(handler) # add JSON formatter handler lg.propagate = False # prevent bubbling to parent/root diff --git a/litellm/_service_logger.py b/litellm/_service_logger.py index 3128f02f40..b67d0d8606 100644 --- a/litellm/_service_logger.py +++ b/litellm/_service_logger.py @@ -145,16 +145,19 @@ class ServiceLogging(CustomLogger): event_metadata=event_metadata, ) elif callback == "otel" or isinstance(callback, OpenTelemetry): - from litellm.proxy.proxy_server import open_telemetry_logger + _otel_logger_to_use: Optional[OpenTelemetry] = None + if isinstance(callback, OpenTelemetry): + _otel_logger_to_use = callback + else: + from litellm.proxy.proxy_server import open_telemetry_logger - await self.init_otel_logger_if_none() + if open_telemetry_logger is not None and isinstance( + open_telemetry_logger, OpenTelemetry + ): + _otel_logger_to_use = open_telemetry_logger - if ( - parent_otel_span is not None - and open_telemetry_logger is not None - and isinstance(open_telemetry_logger, OpenTelemetry) - ): - await self.otel_logger.async_service_success_hook( + if _otel_logger_to_use is not None and parent_otel_span is not None: + await _otel_logger_to_use.async_service_success_hook( payload=payload, parent_otel_span=parent_otel_span, start_time=start_time, @@ -253,20 +256,24 @@ class ServiceLogging(CustomLogger): event_metadata=event_metadata, ) elif callback == "otel" or isinstance(callback, OpenTelemetry): - from litellm.proxy.proxy_server import open_telemetry_logger + _otel_logger_to_use: Optional[OpenTelemetry] = None + if isinstance(callback, OpenTelemetry): + _otel_logger_to_use = callback + else: + from litellm.proxy.proxy_server import open_telemetry_logger - await self.init_otel_logger_if_none() + if open_telemetry_logger is not None and isinstance( + open_telemetry_logger, OpenTelemetry + ): + _otel_logger_to_use = open_telemetry_logger if not isinstance(error, str): error = str(error) - if ( - parent_otel_span is not None - and open_telemetry_logger is not None - and isinstance(open_telemetry_logger, OpenTelemetry) - ): - await self.otel_logger.async_service_success_hook( + if _otel_logger_to_use is not None and parent_otel_span is not None: + await _otel_logger_to_use.async_service_failure_hook( payload=payload, + error=error, parent_otel_span=parent_otel_span, start_time=start_time, end_time=end_time, diff --git a/litellm/anthropic_interface/exceptions/__init__.py b/litellm/anthropic_interface/exceptions/__init__.py new file mode 100644 index 0000000000..875b09e3da --- /dev/null +++ b/litellm/anthropic_interface/exceptions/__init__.py @@ -0,0 +1,19 @@ +"""Anthropic error format utilities.""" + +from .exception_mapping_utils import ( + ANTHROPIC_ERROR_TYPE_MAP, + AnthropicExceptionMapping, +) +from .exceptions import ( + AnthropicErrorDetail, + AnthropicErrorResponse, + AnthropicErrorType, +) + +__all__ = [ + "AnthropicErrorType", + "AnthropicErrorDetail", + "AnthropicErrorResponse", + "ANTHROPIC_ERROR_TYPE_MAP", + "AnthropicExceptionMapping", +] diff --git a/litellm/anthropic_interface/exceptions/exception_mapping_utils.py b/litellm/anthropic_interface/exceptions/exception_mapping_utils.py new file mode 100644 index 0000000000..b8a5079a4e --- /dev/null +++ b/litellm/anthropic_interface/exceptions/exception_mapping_utils.py @@ -0,0 +1,168 @@ +""" +Utilities for mapping exceptions to Anthropic error format. + +Similar to litellm/litellm_core_utils/exception_mapping_utils.py but for Anthropic response format. +""" + +from litellm.litellm_core_utils.safe_json_loads import safe_json_loads +from typing import Dict, Optional + +from .exceptions import AnthropicErrorResponse, AnthropicErrorType + + +# HTTP status code -> Anthropic error type +# Source: https://docs.anthropic.com/en/api/errors +ANTHROPIC_ERROR_TYPE_MAP: Dict[int, AnthropicErrorType] = { + 400: "invalid_request_error", + 401: "authentication_error", + 403: "permission_error", + 404: "not_found_error", + 413: "request_too_large", + 429: "rate_limit_error", + 500: "api_error", + 529: "overloaded_error", +} + + +class AnthropicExceptionMapping: + """ + Helper class for mapping exceptions to Anthropic error format. + + Similar pattern to ExceptionCheckers in litellm_core_utils/exception_mapping_utils.py + """ + + @staticmethod + def get_error_type(status_code: int) -> AnthropicErrorType: + """Map HTTP status code to Anthropic error type.""" + return ANTHROPIC_ERROR_TYPE_MAP.get(status_code, "api_error") + + @staticmethod + def create_error_response( + status_code: int, + message: str, + request_id: Optional[str] = None, + ) -> AnthropicErrorResponse: + """ + Create an Anthropic-formatted error response dict. + + Anthropic error format: + { + "type": "error", + "error": {"type": "...", "message": "..."}, + "request_id": "req_..." + } + """ + error_type = AnthropicExceptionMapping.get_error_type(status_code) + + response: AnthropicErrorResponse = { + "type": "error", + "error": { + "type": error_type, + "message": message, + }, + } + + if request_id: + response["request_id"] = request_id + + return response + + @staticmethod + def extract_error_message(raw_message: str) -> str: + """ + Extract error message from various provider response formats. + + Handles: + - Bedrock: {"detail": {"message": "..."}} + - AWS: {"Message": "..."} + - Generic: {"message": "..."} + - Plain strings + """ + parsed = safe_json_loads(raw_message) + if isinstance(parsed, dict): + # Bedrock format + if "detail" in parsed and isinstance(parsed["detail"], dict): + return parsed["detail"].get("message", raw_message) + # AWS/generic format + return parsed.get("Message") or parsed.get("message") or raw_message + return raw_message + + @staticmethod + def _is_anthropic_error_dict(parsed: dict) -> bool: + """ + Check if a parsed dict is in Anthropic error format. + + Anthropic error format: + { + "type": "error", + "error": {"type": "...", "message": "..."} + } + """ + return ( + parsed.get("type") == "error" + and isinstance(parsed.get("error"), dict) + and "type" in parsed["error"] + and "message" in parsed["error"] + ) + + @staticmethod + def _extract_message_from_dict(parsed: dict, raw_message: str) -> str: + """ + Extract error message from a parsed provider-specific dict. + + Handles: + - Bedrock: {"detail": {"message": "..."}} + - AWS: {"Message": "..."} + - Generic: {"message": "..."} + """ + # Bedrock format + if "detail" in parsed and isinstance(parsed["detail"], dict): + return parsed["detail"].get("message", raw_message) + # AWS/generic format + return parsed.get("Message") or parsed.get("message") or raw_message + + @staticmethod + def transform_to_anthropic_error( + status_code: int, + raw_message: str, + request_id: Optional[str] = None, + ) -> AnthropicErrorResponse: + """ + Transform an error message to Anthropic format. + + - If already in Anthropic format: passthrough unchanged + - Otherwise: extract message and create Anthropic error + + Parses JSON only once for efficiency. + + Args: + status_code: HTTP status code + raw_message: Raw error message (may be JSON string or plain text) + request_id: Optional request ID to include + + Returns: + AnthropicErrorResponse dict + """ + # Try to parse as JSON once + parsed: Optional[dict] = safe_json_loads(raw_message) + if not isinstance(parsed, dict): + parsed = None + + # If parsed and already in Anthropic format - passthrough + if parsed is not None and AnthropicExceptionMapping._is_anthropic_error_dict(parsed): + # Optionally add request_id if provided and not present + if request_id and "request_id" not in parsed: + parsed["request_id"] = request_id + return parsed # type: ignore + + # Extract message - use parsed dict if available, otherwise raw string + if parsed is not None: + message = AnthropicExceptionMapping._extract_message_from_dict(parsed, raw_message) + else: + message = raw_message + + return AnthropicExceptionMapping.create_error_response( + status_code=status_code, + message=message, + request_id=request_id, + ) diff --git a/litellm/anthropic_interface/exceptions/exceptions.py b/litellm/anthropic_interface/exceptions/exceptions.py new file mode 100644 index 0000000000..984390fa70 --- /dev/null +++ b/litellm/anthropic_interface/exceptions/exceptions.py @@ -0,0 +1,41 @@ +"""Anthropic error format type definitions.""" + +from typing_extensions import Literal, Required, TypedDict + + +# Known Anthropic error types +# Source: https://docs.anthropic.com/en/api/errors +AnthropicErrorType = Literal[ + "invalid_request_error", + "authentication_error", + "permission_error", + "not_found_error", + "request_too_large", + "rate_limit_error", + "api_error", + "overloaded_error", +] + + +class AnthropicErrorDetail(TypedDict): + """Inner error detail in Anthropic format.""" + + type: AnthropicErrorType + message: str + + +class AnthropicErrorResponse(TypedDict, total=False): + """ + Anthropic-formatted error response. + + Format: + { + "type": "error", + "error": {"type": "...", "message": "..."}, + "request_id": "req_..." # optional + } + """ + + type: Required[Literal["error"]] + error: Required[AnthropicErrorDetail] + request_id: str diff --git a/litellm/caching/caching.py b/litellm/caching/caching.py index 82fc37e0cb..a03bff6068 100644 --- a/litellm/caching/caching.py +++ b/litellm/caching/caching.py @@ -78,6 +78,8 @@ class Cache: "text_completion", "arerank", "rerank", + "responses", + "aresponses", ], # s3 Bucket, boto3 configuration azure_account_url: Optional[str] = None, @@ -796,6 +798,8 @@ def enable_cache( "text_completion", "arerank", "rerank", + "responses", + "aresponses", ], **kwargs, ): @@ -854,6 +858,8 @@ def update_cache( "text_completion", "arerank", "rerank", + "responses", + "aresponses", ], **kwargs, ): diff --git a/litellm/caching/caching_handler.py b/litellm/caching/caching_handler.py index 628ee118e9..4e97197a9d 100644 --- a/litellm/caching/caching_handler.py +++ b/litellm/caching/caching_handler.py @@ -44,6 +44,7 @@ from litellm.litellm_core_utils.logging_utils import ( _assemble_complete_response_from_streaming_chunks, ) from litellm.types.caching import CachedEmbedding +from litellm.types.llms.openai import ResponsesAPIResponse from litellm.types.rerank import RerankResponse from litellm.types.utils import ( CachingDetails, @@ -727,6 +728,12 @@ class LLMCachingHandler: response_type="audio_transcription", hidden_params=hidden_params, ) + elif ( + call_type == "aresponses" + or call_type == "responses" + ) and isinstance(cached_result, dict): + # Convert cached dict back to ResponsesAPIResponse object + cached_result = ResponsesAPIResponse(**cached_result) if ( hasattr(cached_result, "_hidden_params") @@ -826,6 +833,7 @@ class LLMCachingHandler: or isinstance(result, litellm.EmbeddingResponse) or isinstance(result, TranscriptionResponse) or isinstance(result, RerankResponse) + or isinstance(result, ResponsesAPIResponse) ): if ( isinstance(result, EmbeddingResponse) diff --git a/litellm/completion_extras/litellm_responses_transformation/handler.py b/litellm/completion_extras/litellm_responses_transformation/handler.py index 6ec49ce062..5c051797e8 100644 --- a/litellm/completion_extras/litellm_responses_transformation/handler.py +++ b/litellm/completion_extras/litellm_responses_transformation/handler.py @@ -2,10 +2,12 @@ Handler for transforming /chat/completions api requests to litellm.responses requests """ -from typing import TYPE_CHECKING, Any, Coroutine, Union +from typing import TYPE_CHECKING, Any, Coroutine, Optional, Union from typing_extensions import TypedDict +from litellm.types.llms.openai import ResponsesAPIResponse + if TYPE_CHECKING: from litellm import CustomStreamWrapper, LiteLLMLoggingObj, ModelResponse @@ -28,6 +30,71 @@ class ResponsesToCompletionBridgeHandler: super().__init__() self.transformation_handler = LiteLLMResponsesTransformationHandler() + @staticmethod + def _resolve_stream_flag(optional_params: dict, litellm_params: dict) -> bool: + stream = optional_params.get("stream") + if stream is None: + stream = litellm_params.get("stream", False) + return bool(stream) + + @staticmethod + def _coerce_response_object( + response_obj: Any, + hidden_params: Optional[dict], + ) -> "ResponsesAPIResponse": + if isinstance(response_obj, ResponsesAPIResponse): + response = response_obj + elif isinstance(response_obj, dict): + try: + response = ResponsesAPIResponse(**response_obj) + except Exception: + response = ResponsesAPIResponse.model_construct(**response_obj) + else: + raise ValueError("Unexpected responses stream payload") + + if hidden_params: + existing = getattr(response, "_hidden_params", None) + if not isinstance(existing, dict) or not existing: + setattr(response, "_hidden_params", dict(hidden_params)) + else: + for key, value in hidden_params.items(): + existing.setdefault(key, value) + return response + + def _collect_response_from_stream( + self, stream_iter: Any + ) -> "ResponsesAPIResponse": + for _ in stream_iter: + pass + + completed = getattr(stream_iter, "completed_response", None) + response_obj = getattr(completed, "response", None) if completed else None + if response_obj is None: + raise ValueError("Stream ended without a completed response") + + hidden_params = getattr(stream_iter, "_hidden_params", None) + response = self._coerce_response_object(response_obj, hidden_params) + if not isinstance(response, ResponsesAPIResponse): + raise ValueError("Stream completed response is invalid") + return response + + async def _collect_response_from_stream_async( + self, stream_iter: Any + ) -> "ResponsesAPIResponse": + async for _ in stream_iter: + pass + + completed = getattr(stream_iter, "completed_response", None) + response_obj = getattr(completed, "response", None) if completed else None + if response_obj is None: + raise ValueError("Stream ended without a completed response") + + hidden_params = getattr(stream_iter, "_hidden_params", None) + response = self._coerce_response_object(response_obj, hidden_params) + if not isinstance(response, ResponsesAPIResponse): + raise ValueError("Stream completed response is invalid") + return response + def validate_input_kwargs( self, kwargs: dict ) -> ResponsesToCompletionBridgeHandlerInputKwargs: @@ -87,7 +154,6 @@ class ResponsesToCompletionBridgeHandler: from litellm import responses from litellm.litellm_core_utils.streaming_handler import CustomStreamWrapper - from litellm.types.llms.openai import ResponsesAPIResponse validated_kwargs = self.validate_input_kwargs(kwargs) model = validated_kwargs["model"] @@ -113,6 +179,7 @@ class ResponsesToCompletionBridgeHandler: **request_data, ) + stream = self._resolve_stream_flag(optional_params, litellm_params) if isinstance(result, ResponsesAPIResponse): return self.transformation_handler.transform_response( model=model, @@ -127,6 +194,21 @@ class ResponsesToCompletionBridgeHandler: api_key=kwargs.get("api_key"), json_mode=kwargs.get("json_mode"), ) + elif not stream: + responses_api_response = self._collect_response_from_stream(result) + return self.transformation_handler.transform_response( + model=model, + raw_response=responses_api_response, + model_response=model_response, + logging_obj=logging_obj, + request_data=request_data, + messages=messages, + optional_params=optional_params, + litellm_params=litellm_params, + encoding=kwargs.get("encoding"), + api_key=kwargs.get("api_key"), + json_mode=kwargs.get("json_mode"), + ) else: completion_stream = self.transformation_handler.get_model_response_iterator( streaming_response=result, # type: ignore @@ -146,7 +228,6 @@ class ResponsesToCompletionBridgeHandler: ) -> Union["ModelResponse", "CustomStreamWrapper"]: from litellm import aresponses from litellm.litellm_core_utils.streaming_handler import CustomStreamWrapper - from litellm.types.llms.openai import ResponsesAPIResponse validated_kwargs = self.validate_input_kwargs(kwargs) model = validated_kwargs["model"] @@ -175,6 +256,7 @@ class ResponsesToCompletionBridgeHandler: aresponses=True, ) + stream = self._resolve_stream_flag(optional_params, litellm_params) if isinstance(result, ResponsesAPIResponse): return self.transformation_handler.transform_response( model=model, @@ -189,6 +271,23 @@ class ResponsesToCompletionBridgeHandler: api_key=kwargs.get("api_key"), json_mode=kwargs.get("json_mode"), ) + elif not stream: + responses_api_response = await self._collect_response_from_stream_async( + result + ) + return self.transformation_handler.transform_response( + model=model, + raw_response=responses_api_response, + model_response=model_response, + logging_obj=logging_obj, + request_data=request_data, + messages=messages, + optional_params=optional_params, + litellm_params=litellm_params, + encoding=kwargs.get("encoding"), + api_key=kwargs.get("api_key"), + json_mode=kwargs.get("json_mode"), + ) else: completion_stream = self.transformation_handler.get_model_response_iterator( streaming_response=result, # type: ignore diff --git a/litellm/completion_extras/litellm_responses_transformation/transformation.py b/litellm/completion_extras/litellm_responses_transformation/transformation.py index af8185aa21..c98799d254 100644 --- a/litellm/completion_extras/litellm_responses_transformation/transformation.py +++ b/litellm/completion_extras/litellm_responses_transformation/transformation.py @@ -779,10 +779,10 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge): @staticmethod def _convert_annotations_to_chat_format( annotations: Optional[List[Any]], - ) -> Optional[List["ChatCompletionAnnotation"]]: + ) -> Optional[List[ChatCompletionAnnotation]]: """ Convert annotations from Responses API to Chat Completions format. - + Annotations are already in compatible format between both APIs, so we just need to convert Pydantic models to dicts. """ diff --git a/litellm/constants.py b/litellm/constants.py index 4ea0be247b..f21e751748 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -48,6 +48,11 @@ DEFAULT_REPLICATE_POLLING_DELAY_SECONDS = int( DEFAULT_IMAGE_TOKEN_COUNT = int(os.getenv("DEFAULT_IMAGE_TOKEN_COUNT", 250)) DEFAULT_IMAGE_WIDTH = int(os.getenv("DEFAULT_IMAGE_WIDTH", 300)) DEFAULT_IMAGE_HEIGHT = int(os.getenv("DEFAULT_IMAGE_HEIGHT", 300)) +# Maximum size for image URL downloads in MB (default 50MB, set to 0 to disable limit) +# This prevents memory issues from downloading very large images +# Maps to OpenAI's 50 MB payload limit - requests with images exceeding this size will be rejected +# Set MAX_IMAGE_URL_DOWNLOAD_SIZE_MB=0 to disable image URL handling entirely +MAX_IMAGE_URL_DOWNLOAD_SIZE_MB = float(os.getenv("MAX_IMAGE_URL_DOWNLOAD_SIZE_MB", 50)) MAX_SIZE_PER_ITEM_IN_MEMORY_CACHE_IN_KB = int( os.getenv("MAX_SIZE_PER_ITEM_IN_MEMORY_CACHE_IN_KB", 1024) ) # 1MB = 1024KB @@ -324,6 +329,11 @@ ANTHROPIC_WEB_SEARCH_TOOL_MAX_USES = { "medium": 5, "high": 10, } + +# LiteLLM standard web search tool name +# Used for web search interception across providers +LITELLM_WEB_SEARCH_TOOL_NAME = "litellm_web_search" + DEFAULT_IMAGE_ENDPOINT_MODEL = "dall-e-2" DEFAULT_VIDEO_ENDPOINT_MODEL = "sora-2" @@ -405,6 +415,7 @@ LITELLM_CHAT_PROVIDERS = [ "galadriel", "gradient_ai", "github_copilot", # GitHub Copilot Chat API + "chatgpt", # ChatGPT subscription API "novita", "meta_llama", "featherless_ai", @@ -603,6 +614,7 @@ openai_compatible_providers: List = [ "lm_studio", "galadriel", "github_copilot", # GitHub Copilot Chat API + "chatgpt", # ChatGPT subscription API "novita", "meta_llama", "publicai", # PublicAI - JSON-configured provider @@ -1073,6 +1085,13 @@ LITELLM_TRUNCATED_PAYLOAD_FIELD = "litellm_truncated" ########################### LiteLLM Proxy Specific Constants ########################### ######################################################################################## + +# Standard headers that are always checked for customer/end-user ID (no configuration required) +# These headers work out-of-the-box for tools like Claude Code that support custom headers +STANDARD_CUSTOMER_ID_HEADERS = [ + "x-litellm-customer-id", + "x-litellm-end-user-id", +] MAX_SPENDLOG_ROWS_TO_QUERY = int( os.getenv("MAX_SPENDLOG_ROWS_TO_QUERY", 1_000_000) ) # if spendLogs has more than 1M rows, do not query the DB diff --git a/litellm/containers/main.py b/litellm/containers/main.py index 625a291fb5..105e999ffe 100644 --- a/litellm/containers/main.py +++ b/litellm/containers/main.py @@ -199,7 +199,13 @@ def create_container( return response # get llm provider logic - litellm_params = GenericLiteLLMParams(**kwargs) + # Pass credential params explicitly since they're named args, not in kwargs + litellm_params = GenericLiteLLMParams( + api_key=api_key, + api_base=api_base, + api_version=api_version, + **kwargs, + ) # get provider config container_provider_config: Optional[BaseContainerConfig] = ( ProviderConfigManager.get_provider_container_config( @@ -406,7 +412,13 @@ def list_containers( return response # get llm provider logic - litellm_params = GenericLiteLLMParams(**kwargs) + # Pass credential params explicitly since they're named args, not in kwargs + litellm_params = GenericLiteLLMParams( + api_key=api_key, + api_base=api_base, + api_version=api_version, + **kwargs, + ) # get provider config container_provider_config: Optional[BaseContainerConfig] = ( ProviderConfigManager.get_provider_container_config( @@ -594,7 +606,13 @@ def retrieve_container( return response # get llm provider logic - litellm_params = GenericLiteLLMParams(**kwargs) + # Pass credential params explicitly since they're named args, not in kwargs + litellm_params = GenericLiteLLMParams( + api_key=api_key, + api_base=api_base, + api_version=api_version, + **kwargs, + ) # get provider config container_provider_config: Optional[BaseContainerConfig] = ( ProviderConfigManager.get_provider_container_config( @@ -774,7 +792,13 @@ def delete_container( return response # get llm provider logic - litellm_params = GenericLiteLLMParams(**kwargs) + # Pass credential params explicitly since they're named args, not in kwargs + litellm_params = GenericLiteLLMParams( + api_key=api_key, + api_base=api_base, + api_version=api_version, + **kwargs, + ) # get provider config container_provider_config: Optional[BaseContainerConfig] = ( ProviderConfigManager.get_provider_container_config( @@ -968,7 +992,13 @@ def list_container_files( return response # get llm provider logic - litellm_params = GenericLiteLLMParams(**kwargs) + # Pass credential params explicitly since they're named args, not in kwargs + litellm_params = GenericLiteLLMParams( + api_key=api_key, + api_base=api_base, + api_version=api_version, + **kwargs, + ) # get provider config container_provider_config: Optional[BaseContainerConfig] = ( ProviderConfigManager.get_provider_container_config( @@ -1203,7 +1233,13 @@ def upload_container_file( return response # get llm provider logic - litellm_params = GenericLiteLLMParams(**kwargs) + # Pass credential params explicitly since they're named args, not in kwargs + litellm_params = GenericLiteLLMParams( + api_key=api_key, + api_base=api_base, + api_version=api_version, + **kwargs, + ) # get provider config container_provider_config: Optional[BaseContainerConfig] = ( ProviderConfigManager.get_provider_container_config( diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py index af7dd07810..f18e8d62aa 100644 --- a/litellm/cost_calculator.py +++ b/litellm/cost_calculator.py @@ -587,6 +587,24 @@ def _model_contains_known_llm_provider(model: str) -> bool: return _provider_prefix in LlmProvidersSet +def _get_response_model(completion_response: Any) -> Optional[str]: + """ + Extract the model name from a completion response object. + + Used as a fallback for cost calculation when the input model name + doesn't exist in model_cost (e.g., Azure Model Router). + """ + if completion_response is None: + return None + + if isinstance(completion_response, BaseModel): + return getattr(completion_response, "model", None) + elif isinstance(completion_response, dict): + return completion_response.get("model", None) + + return None + + def _get_usage_object( completion_response: Any, ) -> Optional[Usage]: @@ -933,7 +951,7 @@ def completion_cost( # noqa: PLR0915 router_model_id=router_model_id, ) - potential_model_names = [selected_model] + potential_model_names = [selected_model, _get_response_model(completion_response)] if model is not None: potential_model_names.append(model) diff --git a/litellm/exceptions.py b/litellm/exceptions.py index d963cac754..c2443626b8 100644 --- a/litellm/exceptions.py +++ b/litellm/exceptions.py @@ -125,16 +125,20 @@ class BadRequestError(openai.BadRequestError): # type: ignore self.model = model self.llm_provider = llm_provider self.litellm_debug_info = litellm_debug_info - response = httpx.Response( + self.max_retries = max_retries + self.num_retries = num_retries + _response_headers = ( + getattr(response, "headers", None) if response is not None else None + ) + self.response = httpx.Response( status_code=self.status_code, + headers=_response_headers, request=httpx.Request( method="GET", url="https://litellm.ai" ), # mock request object ) - self.max_retries = max_retries - self.num_retries = num_retries super().__init__( - self.message, response=response, body=body + self.message, response=self.response, body=body ) # Call the base class constructor with the parameters it needs def __str__(self): @@ -368,13 +372,11 @@ class ContextWindowExceededError(BadRequestError): # type: ignore self.model = model self.llm_provider = llm_provider self.litellm_debug_info = litellm_debug_info - request = httpx.Request(method="POST", url="https://api.openai.com/v1") - self.response = httpx.Response(status_code=400, request=request) super().__init__( message=message, model=self.model, # type: ignore llm_provider=self.llm_provider, # type: ignore - response=self.response, + response=response, litellm_debug_info=self.litellm_debug_info, ) # Call the base class constructor with the parameters it needs @@ -457,18 +459,14 @@ class ContentPolicyViolationError(BadRequestError): # type: ignore self.model = model self.llm_provider = llm_provider self.litellm_debug_info = litellm_debug_info - request = httpx.Request(method="POST", url="https://api.openai.com/v1") - self.response = httpx.Response(status_code=400, request=request) self.provider_specific_fields = provider_specific_fields - super().__init__( message=self.message, model=self.model, # type: ignore llm_provider=self.llm_provider, # type: ignore - response=self.response, + response=response, litellm_debug_info=self.litellm_debug_info, ) # Call the base class constructor with the parameters it needs - def __str__(self): return self._transform_error_to_string() @@ -898,9 +896,15 @@ class LiteLLMUnknownProvider(BadRequestError): class GuardrailRaisedException(Exception): - def __init__(self, guardrail_name: Optional[str] = None, message: str = ""): + def __init__( + self, + guardrail_name: Optional[str] = None, + message: str = "", + should_wrap_with_default_message: bool = True, + ): + default_message = f"Guardrail raised an exception, Guardrail: {guardrail_name}, Message: {message}" self.guardrail_name = guardrail_name - self.message = f"Guardrail raised an exception, Guardrail: {guardrail_name}, Message: {message}" + self.message = default_message if should_wrap_with_default_message else message super().__init__(self.message) diff --git a/litellm/images/main.py b/litellm/images/main.py index cf588cbcf0..1b09c20d35 100644 --- a/litellm/images/main.py +++ b/litellm/images/main.py @@ -404,6 +404,7 @@ def image_generation( # noqa: PLR0915 litellm.LlmProviders.STABILITY, litellm.LlmProviders.RUNWAYML, litellm.LlmProviders.VERTEX_AI, + litellm.LlmProviders.OPENROUTER ): if image_generation_config is None: raise ValueError( diff --git a/litellm/integrations/azure_storage/azure_storage.py b/litellm/integrations/azure_storage/azure_storage.py index b4362665a4..85f91199c1 100644 --- a/litellm/integrations/azure_storage/azure_storage.py +++ b/litellm/integrations/azure_storage/azure_storage.py @@ -1,5 +1,4 @@ import asyncio -import json import os import time from litellm._uuid import uuid @@ -15,6 +14,7 @@ from litellm.llms.custom_httpx.http_handler import ( get_async_httpx_client, httpxSpecialProvider, ) +from litellm.litellm_core_utils.safe_json_dumps import safe_dumps from litellm.types.utils import StandardLoggingPayload @@ -168,7 +168,7 @@ class AzureBlobStorageLogger(CustomBatchLogger): llm_provider=httpxSpecialProvider.LoggingCallback ) json_payload = ( - json.dumps(payload) + "\n" + safe_dumps(payload) + "\n" ) # Add newline for each log entry payload_bytes = json_payload.encode("utf-8") filename = f"{payload.get('id') or str(uuid.uuid4())}.json" @@ -384,7 +384,7 @@ class AzureBlobStorageLogger(CustomBatchLogger): await file_client.create_file() # Content to append - content = json.dumps(payload).encode("utf-8") + content = safe_dumps(payload).encode("utf-8") # Append content to the file await file_client.append_data(data=content, offset=0, length=len(content)) diff --git a/litellm/integrations/custom_logger.py b/litellm/integrations/custom_logger.py index 4c4e6fa634..12243a1918 100644 --- a/litellm/integrations/custom_logger.py +++ b/litellm/integrations/custom_logger.py @@ -33,10 +33,9 @@ from litellm.types.utils import ( if TYPE_CHECKING: from fastapi import HTTPException - - from litellm.caching.caching import DualCache from opentelemetry.trace import Span as _Span + from litellm.caching.caching import DualCache from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj from litellm.proxy._types import UserAPIKeyAuth from litellm.types.mcp import ( @@ -144,6 +143,34 @@ class CustomLogger: # https://docs.litellm.ai/docs/observability/custom_callbac async def async_log_pre_api_call(self, model, messages, kwargs): pass + async def async_pre_request_hook( + self, model: str, messages: List, kwargs: Dict + ) -> Optional[Dict]: + """ + Hook called before making the API request to allow modifying request parameters. + + This is specifically designed for modifying the request before it's sent to the provider. + Unlike async_log_pre_api_call (which is for logging), this hook is meant for transformations. + + Args: + model: The model name + messages: The messages list + kwargs: The request parameters (tools, stream, temperature, etc.) + + Returns: + Optional[Dict]: Modified kwargs to use for the request, or None if no modifications + + Example: + ```python + async def async_pre_request_hook(self, model, messages, kwargs): + # Convert native tools to standard format + if kwargs.get("tools"): + kwargs["tools"] = convert_tools(kwargs["tools"]) + return kwargs + ``` + """ + pass + async def async_log_success_event(self, kwargs, response_obj, start_time, end_time): pass @@ -484,6 +511,138 @@ class CustomLogger: # https://docs.litellm.ai/docs/observability/custom_callbac """ return None + ######################################################### + # AGENTIC LOOP HOOKS (for litellm.messages + future completion support) + ######################################################### + + async def async_should_run_agentic_loop( + self, + response: Any, + model: str, + messages: List[Dict], + tools: Optional[List[Dict]], + stream: bool, + custom_llm_provider: str, + kwargs: Dict, + ) -> Tuple[bool, Dict]: + """ + Hook to determine if agentic loop should be executed. + + Called after receiving response from model, before returning to user. + + USE CASE: Enables transparent server-side tool execution for models that + don't natively support server-side tools. User makes ONE API call and gets + back the final answer - the agentic loop happens transparently on the server. + + Example use cases: + - WebSearch: Intercept WebSearch tool calls for Bedrock/Claude, execute + litellm.search(), return final answer with search results + - Code execution: Execute code in sandboxed environment, return results + - Database queries: Execute queries server-side, return data to model + - API calls: Make external API calls and inject responses back into context + + Flow: + 1. User calls litellm.messages.acreate(tools=[...]) + 2. Model responds with tool_use + 3. THIS HOOK checks if tool should run server-side + 4. If True, async_run_agentic_loop executes the tool + 5. User receives final answer (never sees intermediate tool_use) + + Args: + response: Response from model (AnthropicMessagesResponse or AsyncIterator) + model: Model name + messages: Original messages sent to model + tools: List of tool definitions from request + stream: Whether response is streaming + custom_llm_provider: Provider name (e.g., "bedrock", "anthropic") + kwargs: Additional request parameters + + Returns: + (should_run, tools): + should_run: True if agentic loop should execute + tools: Dict with tool_calls and metadata for execution + + Example: + # Detect WebSearch tool call + if has_websearch_tool_use(response): + return True, { + "tool_calls": extract_tool_calls(response), + "tool_type": "websearch" + } + return False, {} + """ + return False, {} + + async def async_run_agentic_loop( + self, + tools: Dict, + model: str, + messages: List[Dict], + response: Any, + anthropic_messages_provider_config: Any, + anthropic_messages_optional_request_params: Dict, + logging_obj: "LiteLLMLoggingObj", + stream: bool, + kwargs: Dict, + ) -> Any: + """ + Hook to execute agentic loop based on context from should_run hook. + + Called only if async_messages_should_run_agentic_loop returns True. + + USE CASE: Execute server-side tools and orchestrate the agentic loop to + return a complete answer to the user in a single API call. + + What to do here: + 1. Extract tool calls from tools dict + 2. Execute the tools (litellm.search, code execution, DB queries, etc.) + 3. Build assistant message with tool_use blocks + 4. Build user message with tool_result blocks containing results + 5. Make follow-up litellm.messages.acreate() call with results + 6. Return the final response + + Args: + tools: Dict from async_should_run_agentic_loop + Contains tool_calls and metadata + model: Model name + messages: Original messages sent to model + response: Original response from model (with tool_use) + anthropic_messages_provider_config: Provider config for making requests + anthropic_messages_optional_request_params: Request parameters (tools, etc.) + logging_obj: LiteLLM logging object + stream: Whether response is streaming + kwargs: Additional request parameters + + Returns: + Final response after executing agentic loop + (AnthropicMessagesResponse with final answer) + + Example: + # Extract tool calls + tool_calls = agentic_context["tool_calls"] + + # Execute searches in parallel + search_results = await asyncio.gather( + *[litellm.asearch(tc["input"]["query"]) for tc in tool_calls] + ) + + # Build messages with tool results + assistant_msg = {"role": "assistant", "content": [...tool_use blocks...]} + user_msg = {"role": "user", "content": [...tool_result blocks...]} + + # Make follow-up request + from litellm.anthropic_interface import messages + final_response = await messages.acreate( + model=model, + messages=messages + [assistant_msg, user_msg], + max_tokens=anthropic_messages_optional_request_params.get("max_tokens"), + **anthropic_messages_optional_request_params + ) + + return final_response + """ + pass + # Useful helpers for custom logger classes def truncate_standard_logging_payload_content( diff --git a/litellm/integrations/langfuse/langfuse_otel.py b/litellm/integrations/langfuse/langfuse_otel.py index 6992ea17cc..08493a0e8e 100644 --- a/litellm/integrations/langfuse/langfuse_otel.py +++ b/litellm/integrations/langfuse/langfuse_otel.py @@ -156,7 +156,11 @@ class LangfuseOtelLogger(OpenTelemetry): "arguments": arguments_obj, } transformed_tool_calls.append(langfuse_tool_call) - safe_set_attribute(span, LangfuseSpanAttributes.OBSERVATION_OUTPUT.value, safe_dumps(transformed_tool_calls)) + safe_set_attribute( + span, + LangfuseSpanAttributes.OBSERVATION_OUTPUT.value, + safe_dumps(transformed_tool_calls), + ) else: output_data = {} if message.get("role"): @@ -164,7 +168,11 @@ class LangfuseOtelLogger(OpenTelemetry): if message.get("content") is not None: output_data["content"] = message.get("content") if output_data: - safe_set_attribute(span, LangfuseSpanAttributes.OBSERVATION_OUTPUT.value, safe_dumps(output_data)) + safe_set_attribute( + span, + LangfuseSpanAttributes.OBSERVATION_OUTPUT.value, + safe_dumps(output_data), + ) output = response_obj.get("output", []) if output: @@ -175,15 +183,28 @@ class LangfuseOtelLogger(OpenTelemetry): if item_type == "reasoning" and hasattr(item, "summary"): for summary in item.summary: if hasattr(summary, "text"): - output_items_data.append({"role": "reasoning_summary", "content": summary.text}) + output_items_data.append( + { + "role": "reasoning_summary", + "content": summary.text, + } + ) elif item_type == "message": - output_items_data.append({ - "role": getattr(item, "role", "assistant"), - "content": getattr(getattr(item, "content", [{}])[0], "text", "") - }) + output_items_data.append( + { + "role": getattr(item, "role", "assistant"), + "content": getattr( + getattr(item, "content", [{}])[0], "text", "" + ), + } + ) elif item_type == "function_call": arguments_str = getattr(item, "arguments", "{}") - arguments_obj = json.loads(arguments_str) if isinstance(arguments_str, str) else arguments_str + arguments_obj = ( + json.loads(arguments_str) + if isinstance(arguments_str, str) + else arguments_str + ) langfuse_tool_call = { "id": getattr(item, "id", ""), "name": getattr(item, "name", ""), @@ -193,7 +214,11 @@ class LangfuseOtelLogger(OpenTelemetry): } output_items_data.append(langfuse_tool_call) if output_items_data: - safe_set_attribute(span, LangfuseSpanAttributes.OBSERVATION_OUTPUT.value, safe_dumps(output_items_data)) + safe_set_attribute( + span, + LangfuseSpanAttributes.OBSERVATION_OUTPUT.value, + safe_dumps(output_items_data), + ) @staticmethod def _set_langfuse_specific_attributes(span: Span, kwargs, response_obj): @@ -210,14 +235,22 @@ class LangfuseOtelLogger(OpenTelemetry): langfuse_environment = os.environ.get("LANGFUSE_TRACING_ENVIRONMENT") if langfuse_environment: - safe_set_attribute(span, LangfuseSpanAttributes.LANGFUSE_ENVIRONMENT.value, langfuse_environment) + safe_set_attribute( + span, + LangfuseSpanAttributes.LANGFUSE_ENVIRONMENT.value, + langfuse_environment, + ) metadata = LangfuseOtelLogger._extract_langfuse_metadata(kwargs) LangfuseOtelLogger._set_metadata_attributes(span=span, metadata=metadata) messages = kwargs.get("messages") if messages: - safe_set_attribute(span, LangfuseSpanAttributes.OBSERVATION_INPUT.value, safe_dumps(messages)) + safe_set_attribute( + span, + LangfuseSpanAttributes.OBSERVATION_INPUT.value, + safe_dumps(messages), + ) LangfuseOtelLogger._set_observation_output(span=span, response_obj=response_obj) @@ -319,3 +352,15 @@ class LangfuseOtelLogger(OpenTelemetry): dynamic_headers["Authorization"] = auth_header return dynamic_headers + + async def async_service_success_hook(self, *args, **kwargs): + """ + Langfuse should not receive service success logs. + """ + pass + + async def async_service_failure_hook(self, *args, **kwargs): + """ + Langfuse should not receive service failure logs. + """ + pass diff --git a/litellm/integrations/langsmith.py b/litellm/integrations/langsmith.py index 570b78f292..5893f14105 100644 --- a/litellm/integrations/langsmith.py +++ b/litellm/integrations/langsmith.py @@ -134,6 +134,13 @@ class LangsmithLogger(CustomBatchLogger): "metadata" ] # ensure logged metadata is json serializable + extra_metadata = dict(metadata) + requester_metadata = extra_metadata.get("requester_metadata") + if requester_metadata and isinstance(requester_metadata, dict): + for key in ("session_id", "thread_id", "conversation_id"): + if key in requester_metadata and key not in extra_metadata: + extra_metadata[key] = requester_metadata[key] + data = { "name": run_name, "run_type": "llm", # this should always be llm, since litellm always logs llm calls. Langsmith allow us to log "chain" @@ -143,7 +150,7 @@ class LangsmithLogger(CustomBatchLogger): "start_time": payload["startTime"], "end_time": payload["endTime"], "tags": payload["request_tags"], - "extra": metadata, + "extra": extra_metadata, } if payload["error_str"] is not None and payload["status"] == "failure": @@ -439,9 +446,9 @@ class LangsmithLogger(CustomBatchLogger): return log_queue_by_credentials def _get_sampling_rate_to_use_for_request(self, kwargs: Dict[str, Any]) -> float: - standard_callback_dynamic_params: Optional[StandardCallbackDynamicParams] = ( - kwargs.get("standard_callback_dynamic_params", None) - ) + standard_callback_dynamic_params: Optional[ + StandardCallbackDynamicParams + ] = kwargs.get("standard_callback_dynamic_params", None) sampling_rate: float = self.sampling_rate if standard_callback_dynamic_params is not None: _sampling_rate = standard_callback_dynamic_params.get( @@ -461,9 +468,9 @@ class LangsmithLogger(CustomBatchLogger): Otherwise, use the default credentials. """ - standard_callback_dynamic_params: Optional[StandardCallbackDynamicParams] = ( - kwargs.get("standard_callback_dynamic_params", None) - ) + standard_callback_dynamic_params: Optional[ + StandardCallbackDynamicParams + ] = kwargs.get("standard_callback_dynamic_params", None) if standard_callback_dynamic_params is not None: credentials = self.get_credentials_from_env( langsmith_api_key=standard_callback_dynamic_params.get( diff --git a/litellm/integrations/prometheus.py b/litellm/integrations/prometheus.py index 2385edc529..b490c21174 100644 --- a/litellm/integrations/prometheus.py +++ b/litellm/integrations/prometheus.py @@ -21,7 +21,12 @@ from typing import ( import litellm from litellm._logging import print_verbose, verbose_logger from litellm.integrations.custom_logger import CustomLogger -from litellm.proxy._types import LiteLLM_TeamTable, UserAPIKeyAuth +from litellm.proxy._types import ( + LiteLLM_DeletedVerificationToken, + LiteLLM_TeamTable, + LiteLLM_UserTable, + UserAPIKeyAuth, +) from litellm.types.integrations.prometheus import * from litellm.types.integrations.prometheus import _sanitize_prometheus_label_name from litellm.types.utils import StandardLoggingPayload @@ -52,7 +57,7 @@ def _get_cached_end_user_id_for_cost_tracking(): class PrometheusLogger(CustomLogger): # Class variables or attributes - def __init__( + def __init__( # noqa: PLR0915 self, **kwargs, ): @@ -193,6 +198,30 @@ class PrometheusLogger(CustomLogger): ), ) + # Remaining Budget for User + self.litellm_remaining_user_budget_metric = self._gauge_factory( + "litellm_remaining_user_budget_metric", + "Remaining budget for user", + labelnames=self.get_labels_for_metric( + "litellm_remaining_user_budget_metric" + ), + ) + + # Max Budget for User + self.litellm_user_max_budget_metric = self._gauge_factory( + "litellm_user_max_budget_metric", + "Maximum budget set for user", + labelnames=self.get_labels_for_metric("litellm_user_max_budget_metric"), + ) + + self.litellm_user_budget_remaining_hours_metric = self._gauge_factory( + "litellm_user_budget_remaining_hours_metric", + "Remaining hours for user budget to be reset", + labelnames=self.get_labels_for_metric( + "litellm_user_budget_remaining_hours_metric" + ), + ) + ######################################## # LiteLLM Virtual API KEY metrics ######################################## @@ -960,6 +989,7 @@ class PrometheusLogger(CustomLogger): user_api_key_alias=user_api_key_alias, litellm_params=litellm_params, response_cost=response_cost, + user_id=user_id, ) # set proxy virtual key rpm/tpm metrics @@ -1120,6 +1150,7 @@ class PrometheusLogger(CustomLogger): user_api_key_alias: Optional[str], litellm_params: dict, response_cost: float, + user_id: Optional[str] = None, ): _team_spend = litellm_params.get("metadata", {}).get( "user_api_key_team_spend", None @@ -1134,6 +1165,14 @@ class PrometheusLogger(CustomLogger): _api_key_max_budget = litellm_params.get("metadata", {}).get( "user_api_key_max_budget", None ) + + _user_spend = litellm_params.get("metadata", {}).get( + "user_api_key_user_spend", None + ) + _user_max_budget = litellm_params.get("metadata", {}).get( + "user_api_key_user_max_budget", None + ) + await self._set_api_key_budget_metrics_after_api_request( user_api_key=user_api_key, user_api_key_alias=user_api_key_alias, @@ -1150,6 +1189,13 @@ class PrometheusLogger(CustomLogger): response_cost=response_cost, ) + await self._set_user_budget_metrics_after_api_request( + user_id=user_id, + user_spend=_user_spend, + user_max_budget=_user_max_budget, + response_cost=response_cost, + ) + def _increment_top_level_request_and_spend_metrics( self, end_user_id: Optional[str], @@ -2112,7 +2158,7 @@ class PrometheusLogger(CustomLogger): self, data_fetch_function: Callable[..., Awaitable[Tuple[List[Any], Optional[int]]]], set_metrics_function: Callable[[List[Any]], Awaitable[None]], - data_type: Literal["teams", "keys"], + data_type: Literal["teams", "keys", "users"], ): """ Generic method to initialize budget metrics for teams or API keys. @@ -2204,7 +2250,7 @@ class PrometheusLogger(CustomLogger): async def fetch_keys( page_size: int, page: int - ) -> Tuple[List[Union[str, UserAPIKeyAuth]], Optional[int]]: + ) -> Tuple[List[Union[str, UserAPIKeyAuth, LiteLLM_DeletedVerificationToken]], Optional[int]]: key_list_response = await _list_key_helper( prisma_client=prisma_client, page=page, @@ -2229,6 +2275,37 @@ class PrometheusLogger(CustomLogger): data_type="keys", ) + async def _initialize_user_budget_metrics(self): + """ + Initialize user budget metrics by reusing the generic pagination logic. + """ + from litellm.proxy._types import LiteLLM_UserTable + from litellm.proxy.proxy_server import prisma_client + + if prisma_client is None: + verbose_logger.debug( + "Prometheus: skipping user metrics initialization, DB not initialized" + ) + return + + async def fetch_users( + page_size: int, page: int + ) -> Tuple[List[LiteLLM_UserTable], Optional[int]]: + skip = (page - 1) * page_size + users = await prisma_client.db.litellm_usertable.find_many( + skip=skip, + take=page_size, + order={"created_at": "desc"}, + ) + total_count = await prisma_client.db.litellm_usertable.count() + return users, total_count + + await self._initialize_budget_metrics( + data_fetch_function=fetch_users, + set_metrics_function=self._set_user_list_budget_metrics, + data_type="users", + ) + async def initialize_remaining_budget_metrics(self): """ Handler for initializing remaining budget metrics for all teams to avoid metric discrepancies. @@ -2261,11 +2338,12 @@ class PrometheusLogger(CustomLogger): async def _initialize_remaining_budget_metrics(self): """ - Helper to initialize remaining budget metrics for all teams and API keys. + Helper to initialize remaining budget metrics for all teams, API keys, and users. """ - verbose_logger.debug("Emitting key, team budget metrics....") + verbose_logger.debug("Emitting key, team, user budget metrics....") await self._initialize_team_budget_metrics() await self._initialize_api_key_budget_metrics() + await self._initialize_user_budget_metrics() async def _set_key_list_budget_metrics( self, keys: List[Union[str, UserAPIKeyAuth]] @@ -2280,6 +2358,11 @@ class PrometheusLogger(CustomLogger): for team in teams: self._set_team_budget_metrics(team) + async def _set_user_list_budget_metrics(self, users: List[LiteLLM_UserTable]): + """Helper function to set budget metrics for a list of users""" + for user in users: + self._set_user_budget_metrics(user) + async def _set_team_budget_metrics_after_api_request( self, user_api_team: Optional[str], @@ -2497,6 +2580,122 @@ class PrometheusLogger(CustomLogger): return user_api_key_dict + async def _set_user_budget_metrics_after_api_request( + self, + user_id: Optional[str], + user_spend: Optional[float], + user_max_budget: Optional[float], + response_cost: float, + ): + """ + Set user budget metrics after an LLM API request + + - Assemble a LiteLLM_UserTable object + - looks up user info from db if not available in metadata + - Set user budget metrics + """ + if user_id: + user_object = await self._assemble_user_object( + user_id=user_id, + spend=user_spend, + max_budget=user_max_budget, + response_cost=response_cost, + ) + + self._set_user_budget_metrics(user_object) + + async def _assemble_user_object( + self, + user_id: str, + spend: Optional[float], + max_budget: Optional[float], + response_cost: float, + ) -> LiteLLM_UserTable: + """ + Assemble a LiteLLM_UserTable object + + for fields not available in metadata, we fetch from db + Fields not available in metadata: + - `budget_reset_at` + """ + from litellm.proxy.auth.auth_checks import get_user_object + from litellm.proxy.proxy_server import prisma_client, user_api_key_cache + + _total_user_spend = (spend or 0) + response_cost + user_object = LiteLLM_UserTable( + user_id=user_id, + spend=_total_user_spend, + max_budget=max_budget, + ) + try: + user_info = await get_user_object( + user_id=user_id, + prisma_client=prisma_client, + user_api_key_cache=user_api_key_cache, + user_id_upsert=False, + check_db_only=True, + ) + except Exception as e: + verbose_logger.debug( + f"[Non-Blocking] Prometheus: Error getting user info: {str(e)}" + ) + return user_object + + if user_info: + user_object.budget_reset_at = user_info.budget_reset_at + + return user_object + + def _set_user_budget_metrics( + self, + user: LiteLLM_UserTable, + ): + """ + Set user budget metrics for a single user + + - Remaining Budget + - Max Budget + - Budget Reset At + """ + enum_values = UserAPIKeyLabelValues( + user=user.user_id, + ) + + _labels = prometheus_label_factory( + supported_enum_labels=self.get_labels_for_metric( + metric_name="litellm_remaining_user_budget_metric" + ), + enum_values=enum_values, + ) + self.litellm_remaining_user_budget_metric.labels(**_labels).set( + self._safe_get_remaining_budget( + max_budget=user.max_budget, + spend=user.spend, + ) + ) + + if user.max_budget is not None: + _labels = prometheus_label_factory( + supported_enum_labels=self.get_labels_for_metric( + metric_name="litellm_user_max_budget_metric" + ), + enum_values=enum_values, + ) + self.litellm_user_max_budget_metric.labels(**_labels).set(user.max_budget) + + if user.budget_reset_at is not None: + _labels = prometheus_label_factory( + supported_enum_labels=self.get_labels_for_metric( + metric_name="litellm_user_budget_remaining_hours_metric" + ), + enum_values=enum_values, + ) + self.litellm_user_budget_remaining_hours_metric.labels(**_labels).set( + self._get_remaining_hours_for_budget_reset( + budget_reset_at=user.budget_reset_at + ) + ) + def _get_remaining_hours_for_budget_reset(self, budget_reset_at: datetime) -> float: """ Get remaining hours for budget reset diff --git a/litellm/integrations/websearch_interception/ARCHITECTURE.md b/litellm/integrations/websearch_interception/ARCHITECTURE.md new file mode 100644 index 0000000000..3aa0a1558d --- /dev/null +++ b/litellm/integrations/websearch_interception/ARCHITECTURE.md @@ -0,0 +1,292 @@ +# WebSearch Interception Architecture + +Server-side WebSearch tool execution for models that don't natively support it (e.g., Bedrock/Claude). + +## How It Works + +User makes **ONE** `litellm.messages.acreate()` call → Gets final answer with search results. +The agentic loop happens transparently on the server. + +## LiteLLM Standard Web Search Tool + +LiteLLM defines a standard web search tool format (`litellm_web_search`) that all native provider tools are converted to. This enables consistent interception across providers. + +**Standard Tool Definition** (defined in `tools.py`): +```python +{ + "name": "litellm_web_search", + "description": "Search the web for information...", + "input_schema": { + "type": "object", + "properties": { + "query": {"type": "string", "description": "The search query"} + }, + "required": ["query"] + } +} +``` + +**Tool Name Constant**: `LITELLM_WEB_SEARCH_TOOL_NAME = "litellm_web_search"` (defined in `litellm/constants.py`) + +### Supported Tool Formats + +The interception system automatically detects and handles: + +| Tool Format | Example | Provider | Detection Method | Future-Proof | +|-------------|---------|----------|------------------|-------------| +| **LiteLLM Standard** | `name="litellm_web_search"` | Any | Direct name match | N/A | +| **Anthropic Native** | `type="web_search_20250305"` | Bedrock, Claude API | Type prefix: `startswith("web_search_")` | ✅ Yes (web_search_2026, etc.) | +| **Claude Code CLI** | `name="web_search"`, `type="web_search_20250305"` | Claude Code | Name + type check | ✅ Yes (version-agnostic) | +| **Legacy** | `name="WebSearch"` | Custom | Name match | N/A (backwards compat) | + +**Future Compatibility**: The `startswith("web_search_")` check in `tools.py` automatically supports future Anthropic web search versions. + +### Claude Code CLI Integration + +Claude Code (Anthropic's official CLI) sends web search requests using Anthropic's native tool format: + +```python +{ + "type": "web_search_20250305", + "name": "web_search", + "max_uses": 8 +} +``` + +**What Happens:** +1. Claude Code sends native `web_search_20250305` tool to LiteLLM proxy +2. LiteLLM intercepts and converts to `litellm_web_search` standard format +3. Bedrock receives converted tool (NOT native format) +4. Model returns `tool_use` block for `litellm_web_search` (not `server_tool_use`) +5. LiteLLM's agentic loop intercepts the `tool_use` +6. Executes `litellm.asearch()` using configured provider (Perplexity, Tavily, etc.) +7. Returns final answer to Claude Code user + +**Without Interception**: Bedrock would receive native tool → try to execute natively → return `web_search_tool_result_error` with `invalid_tool_input` + +**With Interception**: LiteLLM converts → Bedrock returns tool_use → LiteLLM executes search → Returns final answer ✅ + +### Native Tool Conversion + +Native tools are converted to LiteLLM standard format **before** sending to the provider: + +1. **Conversion Point** (`litellm/llms/anthropic/experimental_pass_through/messages/handler.py`): + - In `anthropic_messages()` function (lines 60-127) + - Runs BEFORE the API request is made + - Detects native web search tools using `is_web_search_tool()` + - Converts to `litellm_web_search` format using `get_litellm_web_search_tool()` + - Prevents provider from executing search natively (avoids `web_search_tool_result_error`) + +2. **Response Detection** (`transformation.py`): + - Detects `tool_use` blocks with any web search tool name + - Handles: `litellm_web_search`, `WebSearch`, `web_search` + - Extracts search queries for execution + +**Example Conversion**: +```python +# Input (Claude Code's native tool) +{ + "type": "web_search_20250305", + "name": "web_search", + "max_uses": 8 +} + +# Output (LiteLLM standard) +{ + "name": "litellm_web_search", + "description": "Search the web for information...", + "input_schema": {...} +} +``` + +--- + +## Request Flow + +### Without Interception (Client-Side) +User manually handles tool execution: +1. User calls `litellm.messages.acreate()` → Gets `tool_use` response +2. User executes `litellm.asearch()` +3. User calls `litellm.messages.acreate()` again with results +4. User gets final answer + +**Result**: 2 API calls, manual tool execution + +### With Interception (Server-Side) +Server handles tool execution automatically: + +```mermaid +sequenceDiagram + participant User + participant Messages as litellm.messages.acreate() + participant Handler as llm_http_handler.py + participant Logger as WebSearchInterceptionLogger + participant Router as proxy_server.llm_router + participant Search as litellm.asearch() + participant Provider as Bedrock API + + User->>Messages: acreate(tools=[WebSearch]) + Messages->>Handler: async_anthropic_messages_handler() + Handler->>Provider: Request + Provider-->>Handler: Response (tool_use) + Handler->>Logger: async_should_run_agentic_loop() + Logger->>Logger: Detect WebSearch tool_use + Logger-->>Handler: (True, tools) + Handler->>Logger: async_run_agentic_loop(tools) + Logger->>Router: Get search_provider from search_tools + Router-->>Logger: search_provider + Logger->>Search: asearch(query, provider) + Search-->>Logger: Search results + Logger->>Logger: Build tool_result message + Logger->>Messages: acreate() with results + Messages->>Provider: Request with search results + Provider-->>Messages: Final answer + Messages-->>Logger: Final response + Logger-->>Handler: Final response + Handler-->>User: Final answer (with search results) +``` + +**Result**: 1 API call from user, server handles agentic loop + +--- + +## Key Components + +| Component | File | Purpose | +|-----------|------|---------| +| **WebSearchInterceptionLogger** | `handler.py` | CustomLogger that implements agentic loop hooks | +| **Tool Standardization** | `tools.py` | Standard tool definition, detection, and utilities | +| **Tool Name Constant** | `constants.py` | `LITELLM_WEB_SEARCH_TOOL_NAME = "litellm_web_search"` | +| **Tool Conversion** | `anthropic/.../ handler.py` | Converts native tools to LiteLLM standard before API call | +| **Transformation Logic** | `transformation.py` | Detect tool_use, build tool_result messages, format search responses | +| **Agentic Loop Hooks** | `integrations/custom_logger.py` | Base hooks: `async_should_run_agentic_loop()`, `async_run_agentic_loop()` | +| **Hook Orchestration** | `llms/custom_httpx/llm_http_handler.py` | `_call_agentic_completion_hooks()` - calls hooks after response | +| **Router Search Tools** | `proxy/proxy_server.py` | `llm_router.search_tools` - configured search providers | +| **Search Endpoints** | `proxy/search_endpoints/endpoints.py` | Router logic for selecting search provider | + +--- + +## Configuration + +```python +from litellm.integrations.websearch_interception import ( + WebSearchInterceptionLogger, + get_litellm_web_search_tool, +) +from litellm.types.utils import LlmProviders + +# Enable for Bedrock with specific search tool +litellm.callbacks = [ + WebSearchInterceptionLogger( + enabled_providers=[LlmProviders.BEDROCK], + search_tool_name="my-perplexity-tool" # Optional: uses router's first tool if None + ) +] + +# Make request with LiteLLM standard tool (recommended) +response = await litellm.messages.acreate( + model="bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0", + messages=[{"role": "user", "content": "What is LiteLLM?"}], + tools=[get_litellm_web_search_tool()], # LiteLLM standard + max_tokens=1024, + stream=True # Auto-converted to non-streaming +) + +# OR send native tools - they're auto-converted to LiteLLM standard +response = await litellm.messages.acreate( + model="bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0", + messages=[{"role": "user", "content": "What is LiteLLM?"}], + tools=[{ + "type": "web_search_20250305", # Native Anthropic format + "name": "web_search", + "max_uses": 8 + }], + max_tokens=1024, +) +``` + +--- + +## Streaming Support + +WebSearch interception works transparently with both streaming and non-streaming requests. + +**How streaming is handled:** +1. User makes request with `stream=True` and WebSearch tool +2. Before API call, `anthropic_messages()` detects WebSearch + interception enabled +3. Converts `stream=True` → `stream=False` internally +4. Agentic loop executes with non-streaming responses +5. Final response returned to user (non-streaming) + +**Why this approach:** +- Server-side agentic loops require consuming full responses to detect tool_use +- User opts into this behavior by enabling WebSearch interception +- Provides seamless experience without client changes + +**Testing:** +- **Non-streaming**: `test_websearch_interception_e2e.py` +- **Streaming**: `test_websearch_interception_streaming_e2e.py` + +--- + +## Search Provider Selection + +1. If `search_tool_name` specified → Look up in `llm_router.search_tools` +2. If not found or None → Use first available search tool +3. If no router or no tools → Fallback to `perplexity` + +Example router config: +```yaml +search_tools: + - search_tool_name: "my-perplexity-tool" + litellm_params: + search_provider: "perplexity" + - search_tool_name: "my-tavily-tool" + litellm_params: + search_provider: "tavily" +``` + +--- + +## Message Flow + +### Initial Request +```python +messages = [{"role": "user", "content": "What is LiteLLM?"}] +tools = [{"name": "WebSearch", ...}] +``` + +### First API Call (Internal) +**Response**: `tool_use` with `name="WebSearch"`, `input={"query": "what is litellm"}` + +### Server Processing +1. Logger detects WebSearch tool_use +2. Looks up search provider from router +3. Executes `litellm.asearch(query="what is litellm", search_provider="perplexity")` +4. Gets results: `"Title: LiteLLM Docs\nURL: docs.litellm.ai\n..."` + +### Follow-Up Request (Internal) +```python +messages = [ + {"role": "user", "content": "What is LiteLLM?"}, + {"role": "assistant", "content": [{"type": "tool_use", ...}]}, + {"role": "user", "content": [{"type": "tool_result", "content": "search results..."}]} +] +``` + +### User Receives +```python +response.content[0].text +# "Based on the search results, LiteLLM is a unified interface..." +``` + +--- + +## Testing + +**E2E Tests**: +- `test_websearch_interception_e2e.py` - Non-streaming real API calls to Bedrock +- `test_websearch_interception_streaming_e2e.py` - Streaming real API calls to Bedrock + +**Unit Tests**: `test_websearch_interception.py` +Mocked tests for tool detection, provider filtering, edge cases. diff --git a/litellm/integrations/websearch_interception/__init__.py b/litellm/integrations/websearch_interception/__init__.py new file mode 100644 index 0000000000..f5b1963c1c --- /dev/null +++ b/litellm/integrations/websearch_interception/__init__.py @@ -0,0 +1,20 @@ +""" +WebSearch Interception Module + +Provides server-side WebSearch tool execution for models that don't natively +support server-side tool calling (e.g., Bedrock/Claude). +""" + +from litellm.integrations.websearch_interception.handler import ( + WebSearchInterceptionLogger, +) +from litellm.integrations.websearch_interception.tools import ( + get_litellm_web_search_tool, + is_web_search_tool, +) + +__all__ = [ + "WebSearchInterceptionLogger", + "get_litellm_web_search_tool", + "is_web_search_tool", +] diff --git a/litellm/integrations/websearch_interception/handler.py b/litellm/integrations/websearch_interception/handler.py new file mode 100644 index 0000000000..943a2bb4f3 --- /dev/null +++ b/litellm/integrations/websearch_interception/handler.py @@ -0,0 +1,553 @@ +""" +WebSearch Interception Handler + +CustomLogger that intercepts WebSearch tool calls for models that don't +natively support web search (e.g., Bedrock/Claude) and executes them +server-side using litellm router's search tools. +""" + +import asyncio +from typing import Any, Dict, List, Optional, Tuple, Union, cast + +import litellm +from litellm._logging import verbose_logger +from litellm.anthropic_interface import messages as anthropic_messages +from litellm.constants import LITELLM_WEB_SEARCH_TOOL_NAME +from litellm.integrations.custom_logger import CustomLogger +from litellm.integrations.websearch_interception.tools import ( + get_litellm_web_search_tool, + is_web_search_tool, +) +from litellm.integrations.websearch_interception.transformation import ( + WebSearchTransformation, +) +from litellm.types.integrations.websearch_interception import ( + WebSearchInterceptionConfig, +) +from litellm.types.utils import LlmProviders + + +class WebSearchInterceptionLogger(CustomLogger): + """ + CustomLogger that intercepts WebSearch tool calls for models that don't + natively support web search. + + Implements agentic loop: + 1. Detects WebSearch tool_use in model response + 2. Executes litellm.asearch() for each query using router's search tools + 3. Makes follow-up request with search results + 4. Returns final response + """ + + def __init__( + self, + enabled_providers: Optional[List[Union[LlmProviders, str]]] = None, + search_tool_name: Optional[str] = None, + ): + """ + Args: + enabled_providers: List of LLM providers to enable interception for. + Use LlmProviders enum values (e.g., [LlmProviders.BEDROCK]) + Default: [LlmProviders.BEDROCK] + search_tool_name: Name of search tool configured in router's search_tools. + If None, will attempt to use first available search tool. + """ + super().__init__() + # Convert enum values to strings for comparison + if enabled_providers is None: + self.enabled_providers = [LlmProviders.BEDROCK.value] + else: + self.enabled_providers = [ + p.value if isinstance(p, LlmProviders) else p + for p in enabled_providers + ] + self.search_tool_name = search_tool_name + self._request_has_websearch = False # Track if current request has web search + + async def async_pre_call_deployment_hook( + self, kwargs: Dict[str, Any], call_type: Optional[Any] + ) -> Optional[dict]: + """ + Pre-call hook to convert native Anthropic web_search tools to regular tools. + + This prevents Bedrock from trying to execute web search server-side (which fails). + Instead, we convert it to a regular tool so the model returns tool_use blocks + that we can intercept and execute ourselves. + """ + # Check if this is for an enabled provider + custom_llm_provider = kwargs.get("litellm_params", {}).get("custom_llm_provider", "") + if custom_llm_provider not in self.enabled_providers: + return None + + # Check if request has tools with native web_search + tools = kwargs.get("tools") + if not tools: + return None + + # Check if any tool is a web search tool (native or already LiteLLM standard) + has_websearch = any(is_web_search_tool(t) for t in tools) + + if not has_websearch: + return None + + verbose_logger.debug( + "WebSearchInterception: Converting native web_search tools to LiteLLM standard" + ) + + # Convert native/custom web_search tools to LiteLLM standard + converted_tools = [] + for tool in tools: + if is_web_search_tool(tool): + # Convert to LiteLLM standard web search tool + converted_tool = get_litellm_web_search_tool() + converted_tools.append(converted_tool) + verbose_logger.debug( + f"WebSearchInterception: Converted {tool.get('name', 'unknown')} " + f"(type={tool.get('type', 'none')}) to {LITELLM_WEB_SEARCH_TOOL_NAME}" + ) + else: + # Keep other tools as-is + converted_tools.append(tool) + + # Return modified kwargs with converted tools + return {"tools": converted_tools} + + @classmethod + def from_config_yaml( + cls, config: WebSearchInterceptionConfig + ) -> "WebSearchInterceptionLogger": + """ + Initialize WebSearchInterceptionLogger from proxy config.yaml parameters. + + Args: + config: Configuration dictionary from litellm_settings.websearch_interception_params + + Returns: + Configured WebSearchInterceptionLogger instance + + Example: + From proxy_config.yaml: + litellm_settings: + websearch_interception_params: + enabled_providers: ["bedrock"] + search_tool_name: "my-perplexity-search" + + Usage: + config = litellm_settings.get("websearch_interception_params", {}) + logger = WebSearchInterceptionLogger.from_config_yaml(config) + """ + # Extract parameters from config + enabled_providers_str = config.get("enabled_providers", None) + search_tool_name = config.get("search_tool_name", None) + + # Convert string provider names to LlmProviders enum values + enabled_providers: Optional[List[Union[LlmProviders, str]]] = None + if enabled_providers_str is not None: + enabled_providers = [] + for provider in enabled_providers_str: + try: + # Try to convert string to LlmProviders enum + provider_enum = LlmProviders(provider) + enabled_providers.append(provider_enum) + except ValueError: + # If conversion fails, keep as string + enabled_providers.append(provider) + + return cls( + enabled_providers=enabled_providers, + search_tool_name=search_tool_name, + ) + + async def async_pre_request_hook( + self, model: str, messages: List[Dict], kwargs: Dict + ) -> Optional[Dict]: + """ + Pre-request hook to convert native web search tools to LiteLLM standard. + + This hook is called before the API request is made, allowing us to: + 1. Detect native web search tools (web_search_20250305, etc.) + 2. Convert them to LiteLLM standard format (litellm_web_search) + 3. Convert stream=True to stream=False for interception + + This prevents providers like Bedrock from trying to execute web search + natively (which fails), and ensures our agentic loop can intercept tool_use. + + Returns: + Modified kwargs dict with converted tools, or None if no modifications needed + """ + # Check if this request is for an enabled provider + custom_llm_provider = kwargs.get("litellm_params", {}).get( + "custom_llm_provider", "" + ) + + verbose_logger.debug( + f"WebSearchInterception: Pre-request hook called" + f" - custom_llm_provider={custom_llm_provider}" + f" - enabled_providers={self.enabled_providers}" + ) + + if custom_llm_provider not in self.enabled_providers: + verbose_logger.debug( + f"WebSearchInterception: Skipping - provider {custom_llm_provider} not in {self.enabled_providers}" + ) + return None + + # Check if request has tools + tools = kwargs.get("tools") + if not tools: + return None + + # Check if any tool is a web search tool + has_websearch = any(is_web_search_tool(t) for t in tools) + if not has_websearch: + return None + + verbose_logger.debug( + f"WebSearchInterception: Pre-request hook triggered for provider={custom_llm_provider}" + ) + + # Convert native web search tools to LiteLLM standard + converted_tools = [] + for tool in tools: + if is_web_search_tool(tool): + standard_tool = get_litellm_web_search_tool() + converted_tools.append(standard_tool) + verbose_logger.debug( + f"WebSearchInterception: Converted {tool.get('name', 'unknown')} " + f"(type={tool.get('type', 'none')}) to {LITELLM_WEB_SEARCH_TOOL_NAME}" + ) + else: + converted_tools.append(tool) + + # Update kwargs with converted tools + kwargs["tools"] = converted_tools + verbose_logger.debug( + f"WebSearchInterception: Tools after conversion: {[t.get('name') for t in converted_tools]}" + ) + + # Convert stream=True to stream=False for WebSearch interception + if kwargs.get("stream"): + verbose_logger.debug( + "WebSearchInterception: Converting stream=True to stream=False" + ) + kwargs["stream"] = False + kwargs["_websearch_interception_converted_stream"] = True + + return kwargs + + async def async_should_run_agentic_loop( + self, + response: Any, + model: str, + messages: List[Dict], + tools: Optional[List[Dict]], + stream: bool, + custom_llm_provider: str, + kwargs: Dict, + ) -> Tuple[bool, Dict]: + """Check if WebSearch tool interception is needed""" + + verbose_logger.debug(f"WebSearchInterception: Hook called! provider={custom_llm_provider}, stream={stream}") + verbose_logger.debug(f"WebSearchInterception: Response type: {type(response)}") + + # Check if provider should be intercepted + # Note: custom_llm_provider is already normalized by get_llm_provider() + # (e.g., "bedrock/invoke/..." -> "bedrock") + if custom_llm_provider not in self.enabled_providers: + verbose_logger.debug( + f"WebSearchInterception: Skipping provider {custom_llm_provider} (not in enabled list: {self.enabled_providers})" + ) + return False, {} + + # Check if tools include any web search tool (LiteLLM standard or native) + has_websearch_tool = any(is_web_search_tool(t) for t in (tools or [])) + if not has_websearch_tool: + verbose_logger.debug( + "WebSearchInterception: No web search tool in request" + ) + return False, {} + + # Detect WebSearch tool_use in response + should_intercept, tool_calls = WebSearchTransformation.transform_request( + response=response, + stream=stream, + ) + + if not should_intercept: + verbose_logger.debug( + "WebSearchInterception: No WebSearch tool_use detected in response" + ) + return False, {} + + verbose_logger.debug( + f"WebSearchInterception: Detected {len(tool_calls)} WebSearch tool call(s), executing agentic loop" + ) + + # Return tools dict with tool calls + tools_dict = { + "tool_calls": tool_calls, + "tool_type": "websearch", + "provider": custom_llm_provider, + } + return True, tools_dict + + async def async_run_agentic_loop( + self, + tools: Dict, + model: str, + messages: List[Dict], + response: Any, + anthropic_messages_provider_config: Any, + anthropic_messages_optional_request_params: Dict, + logging_obj: Any, + stream: bool, + kwargs: Dict, + ) -> Any: + """Execute agentic loop with WebSearch execution""" + + tool_calls = tools["tool_calls"] + + verbose_logger.debug( + f"WebSearchInterception: Executing agentic loop for {len(tool_calls)} search(es)" + ) + + return await self._execute_agentic_loop( + model=model, + messages=messages, + tool_calls=tool_calls, + anthropic_messages_optional_request_params=anthropic_messages_optional_request_params, + logging_obj=logging_obj, + stream=stream, + kwargs=kwargs, + ) + + async def _execute_agentic_loop( + self, + model: str, + messages: List[Dict], + tool_calls: List[Dict], + anthropic_messages_optional_request_params: Dict, + logging_obj: Any, + stream: bool, + kwargs: Dict, + ) -> Any: + """Execute litellm.search() and make follow-up request""" + + # Extract search queries from tool_use blocks + search_tasks = [] + for tool_call in tool_calls: + query = tool_call["input"].get("query") + if query: + verbose_logger.debug( + f"WebSearchInterception: Queuing search for query='{query}'" + ) + search_tasks.append(self._execute_search(query)) + else: + verbose_logger.warning( + f"WebSearchInterception: Tool call {tool_call['id']} has no query" + ) + # Add empty result for tools without query + search_tasks.append(self._create_empty_search_result()) + + # Execute searches in parallel + verbose_logger.debug( + f"WebSearchInterception: Executing {len(search_tasks)} search(es) in parallel" + ) + search_results = await asyncio.gather(*search_tasks, return_exceptions=True) + + # Handle any exceptions in search results + final_search_results: List[str] = [] + for i, result in enumerate(search_results): + if isinstance(result, Exception): + verbose_logger.error( + f"WebSearchInterception: Search {i} failed with error: {str(result)}" + ) + final_search_results.append( + f"Search failed: {str(result)}" + ) + elif isinstance(result, str): + # Explicitly cast to str for type checker + final_search_results.append(cast(str, result)) + else: + # Should never happen, but handle for type safety + verbose_logger.warning( + f"WebSearchInterception: Unexpected result type {type(result)} at index {i}" + ) + final_search_results.append(str(result)) + + # Build assistant and user messages using transformation + assistant_message, user_message = WebSearchTransformation.transform_response( + tool_calls=tool_calls, + search_results=final_search_results, + ) + + # Make follow-up request with search results + follow_up_messages = messages + [assistant_message, user_message] + + verbose_logger.debug( + "WebSearchInterception: Making follow-up request with search results" + ) + verbose_logger.debug( + f"WebSearchInterception: Follow-up messages count: {len(follow_up_messages)}" + ) + verbose_logger.debug( + f"WebSearchInterception: Last message (tool_result): {user_message}" + ) + + # Use anthropic_messages.acreate for follow-up request + try: + # Extract max_tokens from optional params or kwargs + # max_tokens is a required parameter for anthropic_messages.acreate() + max_tokens = anthropic_messages_optional_request_params.get( + "max_tokens", + kwargs.get("max_tokens", 1024) # Default to 1024 if not found + ) + + verbose_logger.debug( + f"WebSearchInterception: Using max_tokens={max_tokens} for follow-up request" + ) + + # Create a copy of optional params without max_tokens (since we pass it explicitly) + optional_params_without_max_tokens = { + k: v for k, v in anthropic_messages_optional_request_params.items() + if k != 'max_tokens' + } + + # Get model from logging_obj.model_call_details["agentic_loop_params"] + # This preserves the full model name with provider prefix (e.g., "bedrock/invoke/...") + full_model_name = model + if logging_obj is not None: + agentic_params = logging_obj.model_call_details.get("agentic_loop_params", {}) + full_model_name = agentic_params.get("model", model) + verbose_logger.debug( + f"WebSearchInterception: Using model name: {full_model_name}" + ) + + final_response = await anthropic_messages.acreate( + max_tokens=max_tokens, + messages=follow_up_messages, + model=full_model_name, + **optional_params_without_max_tokens, + **kwargs, + ) + verbose_logger.debug( + f"WebSearchInterception: Follow-up request completed, response type: {type(final_response)}" + ) + verbose_logger.debug( + f"WebSearchInterception: Final response: {final_response}" + ) + return final_response + except Exception as e: + verbose_logger.exception( + f"WebSearchInterception: Follow-up request failed: {str(e)}" + ) + raise + + async def _execute_search(self, query: str) -> str: + """Execute a single web search using router's search tools""" + try: + # Import router from proxy_server + try: + from litellm.proxy.proxy_server import llm_router + except ImportError: + verbose_logger.warning( + "WebSearchInterception: Could not import llm_router from proxy_server, " + "falling back to direct litellm.asearch() with perplexity" + ) + llm_router = None + + # Determine search provider from router's search_tools + search_provider: Optional[str] = None + if llm_router is not None and hasattr(llm_router, "search_tools"): + if self.search_tool_name: + # Find specific search tool by name + matching_tools = [ + tool for tool in llm_router.search_tools + if tool.get("search_tool_name") == self.search_tool_name + ] + if matching_tools: + search_tool = matching_tools[0] + search_provider = search_tool.get("litellm_params", {}).get("search_provider") + verbose_logger.debug( + f"WebSearchInterception: Found search tool '{self.search_tool_name}' " + f"with provider '{search_provider}'" + ) + else: + verbose_logger.warning( + f"WebSearchInterception: Search tool '{self.search_tool_name}' not found in router, " + "falling back to first available or perplexity" + ) + + # If no specific tool or not found, use first available + if not search_provider and llm_router.search_tools: + first_tool = llm_router.search_tools[0] + search_provider = first_tool.get("litellm_params", {}).get("search_provider") + verbose_logger.debug( + f"WebSearchInterception: Using first available search tool with provider '{search_provider}'" + ) + + # Fallback to perplexity if no router or no search tools configured + if not search_provider: + search_provider = "perplexity" + verbose_logger.debug( + "WebSearchInterception: No search tools configured in router, " + f"using default provider '{search_provider}'" + ) + + verbose_logger.debug( + f"WebSearchInterception: Executing search for '{query}' using provider '{search_provider}'" + ) + result = await litellm.asearch( + query=query, search_provider=search_provider + ) + + # Format using transformation function + search_result_text = WebSearchTransformation.format_search_response(result) + + verbose_logger.debug( + f"WebSearchInterception: Search completed for '{query}', got {len(search_result_text)} chars" + ) + return search_result_text + except Exception as e: + verbose_logger.error( + f"WebSearchInterception: Search failed for '{query}': {str(e)}" + ) + raise + + async def _create_empty_search_result(self) -> str: + """Create an empty search result for tool calls without queries""" + return "No search query provided" + + @staticmethod + def initialize_from_proxy_config( + litellm_settings: Dict[str, Any], + callback_specific_params: Dict[str, Any], + ) -> "WebSearchInterceptionLogger": + """ + Static method to initialize WebSearchInterceptionLogger from proxy config. + + Used in callback_utils.py to simplify initialization logic. + + Args: + litellm_settings: Dictionary containing litellm_settings from proxy_config.yaml + callback_specific_params: Dictionary containing callback-specific parameters + + Returns: + Configured WebSearchInterceptionLogger instance + + Example: + From callback_utils.py: + websearch_obj = WebSearchInterceptionLogger.initialize_from_proxy_config( + litellm_settings=litellm_settings, + callback_specific_params=callback_specific_params + ) + """ + # Get websearch_interception_params from litellm_settings or callback_specific_params + websearch_params: WebSearchInterceptionConfig = {} + if "websearch_interception_params" in litellm_settings: + websearch_params = litellm_settings["websearch_interception_params"] + elif "websearch_interception" in callback_specific_params: + websearch_params = callback_specific_params["websearch_interception"] + + # Use classmethod to initialize from config + return WebSearchInterceptionLogger.from_config_yaml(websearch_params) diff --git a/litellm/integrations/websearch_interception/tools.py b/litellm/integrations/websearch_interception/tools.py new file mode 100644 index 0000000000..4f8b7372fe --- /dev/null +++ b/litellm/integrations/websearch_interception/tools.py @@ -0,0 +1,95 @@ +""" +LiteLLM Web Search Tool Definition + +This module defines the standard web search tool used across LiteLLM. +Native provider tools (like Anthropic's web_search_20250305) are converted +to this format for consistent interception and execution. +""" + +from typing import Any, Dict + +from litellm.constants import LITELLM_WEB_SEARCH_TOOL_NAME + + +def get_litellm_web_search_tool() -> Dict[str, Any]: + """ + Get the standard LiteLLM web search tool definition. + + This is the canonical tool definition that all native web search tools + (like Anthropic's web_search_20250305, Claude Code's web_search, etc.) + are converted to for interception. + + Returns: + Dict containing the Anthropic-style tool definition with: + - name: Tool name + - description: What the tool does + - input_schema: JSON schema for tool parameters + + Example: + >>> tool = get_litellm_web_search_tool() + >>> tool['name'] + 'litellm_web_search' + """ + return { + "name": LITELLM_WEB_SEARCH_TOOL_NAME, + "description": ( + "Search the web for information. Use this when you need current " + "information or answers to questions that require up-to-date data." + ), + "input_schema": { + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "The search query to execute" + } + }, + "required": ["query"] + } + } + + +def is_web_search_tool(tool: Dict[str, Any]) -> bool: + """ + Check if a tool is a web search tool (native or LiteLLM standard). + + Detects: + - LiteLLM standard: name == "litellm_web_search" + - Anthropic native: type starts with "web_search_" (e.g., "web_search_20250305") + - Claude Code: name == "web_search" with a type field + - Custom: name == "WebSearch" (legacy format) + + Args: + tool: Tool dictionary to check + + Returns: + True if tool is a web search tool + + Example: + >>> is_web_search_tool({"name": "litellm_web_search"}) + True + >>> is_web_search_tool({"type": "web_search_20250305", "name": "web_search"}) + True + >>> is_web_search_tool({"name": "calculator"}) + False + """ + tool_name = tool.get("name", "") + tool_type = tool.get("type", "") + + # Check for LiteLLM standard tool + if tool_name == LITELLM_WEB_SEARCH_TOOL_NAME: + return True + + # Check for native Anthropic web_search_* types + if tool_type.startswith("web_search_"): + return True + + # Check for Claude Code's web_search with a type field + if tool_name == "web_search" and tool_type: + return True + + # Check for legacy WebSearch format + if tool_name == "WebSearch": + return True + + return False diff --git a/litellm/integrations/websearch_interception/transformation.py b/litellm/integrations/websearch_interception/transformation.py new file mode 100644 index 0000000000..313358822a --- /dev/null +++ b/litellm/integrations/websearch_interception/transformation.py @@ -0,0 +1,189 @@ +""" +WebSearch Tool Transformation + +Transforms between Anthropic tool_use format and LiteLLM search format. +""" + +from typing import Any, Dict, List, Tuple + +from litellm._logging import verbose_logger +from litellm.constants import LITELLM_WEB_SEARCH_TOOL_NAME +from litellm.llms.base_llm.search.transformation import SearchResponse + + +class WebSearchTransformation: + """ + Transformation class for WebSearch tool interception. + + Handles transformation between: + - Anthropic tool_use format → LiteLLM search requests + - LiteLLM SearchResponse → Anthropic tool_result format + """ + + @staticmethod + def transform_request( + response: Any, + stream: bool, + ) -> Tuple[bool, List[Dict]]: + """ + Transform Anthropic response to extract WebSearch tool calls. + + Detects if response contains WebSearch tool_use blocks and extracts + the search queries for execution. + + Args: + response: Model response (dict or AnthropicMessagesResponse) + stream: Whether response is streaming + + Returns: + (has_websearch, tool_calls): + has_websearch: True if WebSearch tool_use found + tool_calls: List of tool_use dicts with id, name, input + + Note: + Streaming requests are handled by converting stream=True to stream=False + in the WebSearchInterceptionLogger.async_log_pre_api_call hook before + the API request is made. This means by the time this method is called, + streaming requests have already been converted to non-streaming. + """ + if stream: + # This should not happen in practice since we convert streaming to non-streaming + # in async_log_pre_api_call, but keep this check for safety + verbose_logger.warning( + "WebSearchInterception: Unexpected streaming response, skipping interception" + ) + return False, [] + + # Parse non-streaming response + return WebSearchTransformation._detect_from_non_streaming_response(response) + + @staticmethod + def _detect_from_non_streaming_response( + response: Any, + ) -> Tuple[bool, List[Dict]]: + """Parse non-streaming response for WebSearch tool_use""" + + # Handle both dict and object responses + if isinstance(response, dict): + content = response.get("content", []) + else: + if not hasattr(response, "content"): + verbose_logger.debug( + "WebSearchInterception: Response has no content attribute" + ) + return False, [] + content = response.content or [] + + if not content: + verbose_logger.debug( + "WebSearchInterception: Response has empty content" + ) + return False, [] + + # Find all WebSearch tool_use blocks + tool_calls = [] + for block in content: + # Handle both dict and object blocks + if isinstance(block, dict): + block_type = block.get("type") + block_name = block.get("name") + block_id = block.get("id") + block_input = block.get("input", {}) + else: + block_type = getattr(block, "type", None) + block_name = getattr(block, "name", None) + block_id = getattr(block, "id", None) + block_input = getattr(block, "input", {}) + + # Check for LiteLLM standard or legacy web search tools + # Handles: litellm_web_search, WebSearch, web_search + if block_type == "tool_use" and block_name in ( + LITELLM_WEB_SEARCH_TOOL_NAME, "WebSearch", "web_search" + ): + # Convert to dict for easier handling + tool_call = { + "id": block_id, + "type": "tool_use", + "name": block_name, # Preserve original name + "input": block_input, + } + tool_calls.append(tool_call) + verbose_logger.debug( + f"WebSearchInterception: Found {block_name} tool_use with id={tool_call['id']}" + ) + + return len(tool_calls) > 0, tool_calls + + @staticmethod + def transform_response( + tool_calls: List[Dict], + search_results: List[str], + ) -> Tuple[Dict, Dict]: + """ + Transform LiteLLM search results to Anthropic tool_result format. + + Builds the assistant and user messages needed for the agentic loop + follow-up request. + + Args: + tool_calls: List of tool_use dicts from transform_request + search_results: List of search result strings (one per tool_call) + + Returns: + (assistant_message, user_message): + assistant_message: Message with tool_use blocks + user_message: Message with tool_result blocks + """ + # Build assistant message with tool_use blocks + assistant_message = { + "role": "assistant", + "content": [ + { + "type": "tool_use", + "id": tc["id"], + "name": tc["name"], + "input": tc["input"], + } + for tc in tool_calls + ], + } + + # Build user message with tool_result blocks + user_message = { + "role": "user", + "content": [ + { + "type": "tool_result", + "tool_use_id": tool_calls[i]["id"], + "content": search_results[i], + } + for i in range(len(tool_calls)) + ], + } + + return assistant_message, user_message + + @staticmethod + def format_search_response(result: SearchResponse) -> str: + """ + Format SearchResponse as text for tool_result content. + + Args: + result: SearchResponse from litellm.asearch() + + Returns: + Formatted text with Title, URL, Snippet for each result + """ + # Convert SearchResponse to string + if hasattr(result, "results") and result.results: + # Format results as text + search_result_text = "\n\n".join( + [ + f"Title: {r.title}\nURL: {r.url}\nSnippet: {r.snippet}" + for r in result.results + ] + ) + else: + search_result_text = str(result) + + return search_result_text diff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.py index 1517d1e776..107cdf39bf 100644 --- a/litellm/litellm_core_utils/exception_mapping_utils.py +++ b/litellm/litellm_core_utils/exception_mapping_utils.py @@ -197,12 +197,22 @@ def extract_and_raise_litellm_exception( exception_name = exception_name.strip().replace("litellm.", "") raised_exception_obj = getattr(litellm, exception_name, None) if raised_exception_obj: - raise raised_exception_obj( - message=error_str, - llm_provider=custom_llm_provider, - model=model, - response=response, - ) + # Try with response parameter first, fall back to without it + # Some exceptions (e.g., APIConnectionError) don't accept response param + try: + raise raised_exception_obj( + message=error_str, + llm_provider=custom_llm_provider, + model=model, + response=response, + ) + except TypeError: + # Exception doesn't accept response parameter + raise raised_exception_obj( + message=error_str, + llm_provider=custom_llm_provider, + model=model, + ) def exception_type( # type: ignore # noqa: PLR0915 diff --git a/litellm/litellm_core_utils/get_llm_provider_logic.py b/litellm/litellm_core_utils/get_llm_provider_logic.py index 21d6917733..807b66faec 100644 --- a/litellm/litellm_core_utils/get_llm_provider_logic.py +++ b/litellm/litellm_core_utils/get_llm_provider_logic.py @@ -768,6 +768,14 @@ def _get_openai_compatible_provider_info( # noqa: PLR0915 ) = litellm.GithubCopilotConfig()._get_openai_compatible_provider_info( model, api_base, api_key, custom_llm_provider ) + elif custom_llm_provider == "chatgpt": + ( + api_base, + dynamic_api_key, + custom_llm_provider, + ) = litellm.ChatGPTConfig()._get_openai_compatible_provider_info( + model, api_base, api_key, custom_llm_provider + ) elif custom_llm_provider == "novita": api_base = ( api_base diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index e0a799d8e5..9cef21bfdf 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -1853,6 +1853,14 @@ class Logging(LiteLLMLoggingBaseClass): cache_hit=cache_hit, standard_logging_object=kwargs.get("standard_logging_object", None), ) + litellm_params = self.model_call_details.get("litellm_params", {}) + is_sync_request = ( + litellm_params.get(CallTypes.acompletion.value, False) is not True + and litellm_params.get(CallTypes.aresponses.value, False) is not True + and litellm_params.get(CallTypes.aembedding.value, False) is not True + and litellm_params.get(CallTypes.aimage_generation.value, False) is not True + and litellm_params.get(CallTypes.atranscription.value, False) is not True + ) try: ## BUILD COMPLETE STREAMED RESPONSE complete_streaming_response: Optional[ @@ -1889,6 +1897,14 @@ class Logging(LiteLLMLoggingBaseClass): status="success", standard_built_in_tools_params=self.standard_built_in_tools_params, ) + if ( + standard_logging_payload := self.model_call_details.get( + "standard_logging_object" + ) + ) is not None: + # Only emit for sync requests (async_success_handler handles async) + if is_sync_request: + emit_standard_logging_payload(standard_logging_payload) callbacks = self.get_combined_callback_list( dynamic_success_callbacks=self.dynamic_success_callbacks, global_callbacks=litellm.success_callback, @@ -1915,7 +1931,6 @@ class Logging(LiteLLMLoggingBaseClass): self.has_run_logging(event_type="sync_success") for callback in callbacks: try: - litellm_params = self.model_call_details.get("litellm_params", {}) should_run = self.should_run_callback( callback=callback, litellm_params=litellm_params, @@ -2183,25 +2198,7 @@ class Logging(LiteLLMLoggingBaseClass): print_verbose=print_verbose, ) - if ( - callback == "openmeter" - and self.model_call_details.get("litellm_params", {}).get( - "acompletion", False - ) - is not True - and self.model_call_details.get("litellm_params", {}).get( - "aembedding", False - ) - is not True - and self.model_call_details.get("litellm_params", {}).get( - "aimage_generation", False - ) - is not True - and self.model_call_details.get("litellm_params", {}).get( - "atranscription", False - ) - is not True - ): + if callback == "openmeter" and is_sync_request: global openMeterLogger if openMeterLogger is None: print_verbose("Instantiates openmeter client") @@ -2229,22 +2226,7 @@ class Logging(LiteLLMLoggingBaseClass): ) if ( isinstance(callback, CustomLogger) - and self.model_call_details.get("litellm_params", {}).get( - "acompletion", False - ) - is not True - and self.model_call_details.get("litellm_params", {}).get( - "aembedding", False - ) - is not True - and self.model_call_details.get("litellm_params", {}).get( - "aimage_generation", False - ) - is not True - and self.model_call_details.get("litellm_params", {}).get( - "atranscription", False - ) - is not True + and is_sync_request and self.call_type != CallTypes.pass_through.value # pass-through endpoints call async_log_success_event ): # custom logger class @@ -2272,22 +2254,7 @@ class Logging(LiteLLMLoggingBaseClass): ) if ( callable(callback) is True - and self.model_call_details.get("litellm_params", {}).get( - "acompletion", False - ) - is not True - and self.model_call_details.get("litellm_params", {}).get( - "aembedding", False - ) - is not True - and self.model_call_details.get("litellm_params", {}).get( - "aimage_generation", False - ) - is not True - and self.model_call_details.get("litellm_params", {}).get( - "atranscription", False - ) - is not True + and is_sync_request and customLogger is not None ): # custom logger functions print_verbose( @@ -2443,6 +2410,14 @@ class Logging(LiteLLMLoggingBaseClass): status="success", standard_built_in_tools_params=self.standard_built_in_tools_params, ) + + # print standard logging payload + if ( + standard_logging_payload := self.model_call_details.get( + "standard_logging_object" + ) + ) is not None: + emit_standard_logging_payload(standard_logging_payload) callbacks = self.get_combined_callback_list( dynamic_success_callbacks=self.dynamic_async_success_callbacks, global_callbacks=litellm._async_success_callback, @@ -2737,6 +2712,15 @@ class Logging(LiteLLMLoggingBaseClass): event_type="sync_failure" ): # prevent double logging return + litellm_params = self.model_call_details.get("litellm_params", {}) + is_sync_request = ( + litellm_params.get(CallTypes.acompletion.value, False) is not True + and litellm_params.get(CallTypes.aresponses.value, False) is not True + and litellm_params.get(CallTypes.aembedding.value, False) is not True + and litellm_params.get(CallTypes.aimage_generation.value, False) is not True + and litellm_params.get(CallTypes.atranscription.value, False) is not True + ) + try: start_time, end_time = self._failure_handler_helper_fn( exception=exception, @@ -2762,7 +2746,6 @@ class Logging(LiteLLMLoggingBaseClass): self.has_run_logging(event_type="sync_failure") for callback in callbacks: try: - litellm_params = self.model_call_details.get("litellm_params", {}) should_run = self.should_run_callback( callback=callback, litellm_params=litellm_params, @@ -2829,15 +2812,7 @@ class Logging(LiteLLMLoggingBaseClass): callback_func=callback, ) if ( - isinstance(callback, CustomLogger) - and self.model_call_details.get("litellm_params", {}).get( - "acompletion", False - ) - is not True - and self.model_call_details.get("litellm_params", {}).get( - "aembedding", False - ) - is not True + isinstance(callback, CustomLogger) and is_sync_request ): # custom logger class callback.log_failure_event( start_time=start_time, @@ -3781,9 +3756,12 @@ def _init_custom_logger_compatible_class( # noqa: PLR0915 OpenTelemetryConfig, ) + logfire_base_url = os.getenv( + "LOGFIRE_BASE_URL", "https://logfire-api.pydantic.dev" + ) otel_config = OpenTelemetryConfig( exporter="otlp_http", - endpoint="https://logfire-api.pydantic.dev/v1/traces", + endpoint=f"{logfire_base_url.rstrip('/')}/v1/traces", headers=f"Authorization={os.getenv('LOGFIRE_TOKEN')}", ) for callback in _in_memory_loggers: @@ -4375,6 +4353,44 @@ class StandardLoggingPayloadSetup: return messages + @staticmethod + def merge_litellm_metadata(litellm_params: dict) -> dict: + """ + Merge both litellm_metadata and metadata from litellm_params. + + litellm_metadata contains model-related fields, metadata contains user API key fields. + We need both for complete standard logging payload. + + Args: + litellm_params: Dictionary containing metadata and litellm_metadata + + Returns: + dict: Merged metadata with user API key fields taking precedence + """ + merged_metadata: dict = {} + + # Start with metadata (user API key fields) - but skip non-serializable objects + if litellm_params.get("metadata") and isinstance( + litellm_params.get("metadata"), dict + ): + for key, value in litellm_params["metadata"].items(): + # Skip non-serializable objects like UserAPIKeyAuth + if key == "user_api_key_auth": + continue + merged_metadata[key] = value + + # Then merge litellm_metadata (model-related fields) - this will NOT overwrite existing keys + if litellm_params.get("litellm_metadata") and isinstance( + litellm_params.get("litellm_metadata"), dict + ): + for key, value in litellm_params["litellm_metadata"].items(): + if ( + key not in merged_metadata + ): # Don't overwrite existing keys from metadata + merged_metadata[key] = value + + return merged_metadata + @staticmethod def get_standard_logging_metadata( metadata: Optional[Dict[str, Any]], @@ -4815,7 +4831,9 @@ class StandardLoggingPayloadSetup: """ Extract additional header tags for spend tracking based on config. """ - extra_headers: List[str] = getattr(litellm, "extra_spend_tag_headers", None) or [] + extra_headers: List[str] = ( + getattr(litellm, "extra_spend_tag_headers", None) or [] + ) if not extra_headers: return None @@ -4963,10 +4981,9 @@ def get_standard_logging_object_payload( litellm_params = kwargs.get("litellm_params", {}) or {} proxy_server_request = litellm_params.get("proxy_server_request") or {} - metadata: dict = ( - litellm_params.get("litellm_metadata") - or litellm_params.get("metadata", None) - or {} + # Merge both litellm_metadata and metadata to get complete metadata + metadata: dict = StandardLoggingPayloadSetup.merge_litellm_metadata( + litellm_params ) completion_start_time = kwargs.get("completion_start_time", end_time) @@ -5137,7 +5154,8 @@ def get_standard_logging_object_payload( standard_built_in_tools_params=standard_built_in_tools_params, ) - emit_standard_logging_payload(payload) + # emit_standard_logging_payload(payload) - Moved to success_handler to prevent double emitting + return payload except Exception as e: verbose_logger.exception( diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py index 4320f75645..43ed23587d 100644 --- a/litellm/litellm_core_utils/prompt_templates/factory.py +++ b/litellm/litellm_core_utils/prompt_templates/factory.py @@ -903,11 +903,11 @@ def convert_to_anthropic_image_obj( media_type=media_type, data=base64_data, ) + except litellm.ImageFetchError: + raise except Exception as e: - if "Error: Unable to fetch image from URL" in str(e): - raise e raise Exception( - """Image url not in expected format. Example Expected input - "image_url": "data:image/jpeg;base64,{base64_image}". Supported formats - ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].""" + f"""Image url not in expected format. Example Expected input - "image_url": "data:image/jpeg;base64,{{base64_image}}". Supported formats - ['image/jpeg', 'image/png', 'image/gif', 'image/webp']. Error: {str(e)}""" ) @@ -1555,8 +1555,6 @@ def convert_to_gemini_tool_call_result( # For Computer Use, the response should contain structured data like {"url": "..."} response_data: dict try: - import json - if content_str.strip().startswith("{") or content_str.strip().startswith("["): # Try to parse as JSON (for Computer Use structured responses) parsed = json.loads(content_str) @@ -1672,7 +1670,7 @@ def convert_to_anthropic_tool_result( anthropic_content_element=_anthropic_image_param, original_content_element=content, ) - anthropic_content_list.append(_anthropic_image_param) + anthropic_content_list.append(cast(AnthropicMessagesImageParam, _anthropic_image_param)) anthropic_content = anthropic_content_list anthropic_tool_result: Optional[AnthropicMessagesToolResultParam] = None diff --git a/litellm/litellm_core_utils/prompt_templates/image_handling.py b/litellm/litellm_core_utils/prompt_templates/image_handling.py index 4fa10e4211..5d0bedb776 100644 --- a/litellm/litellm_core_utils/prompt_templates/image_handling.py +++ b/litellm/litellm_core_utils/prompt_templates/image_handling.py @@ -9,6 +9,7 @@ from httpx import Response import litellm from litellm import verbose_logger from litellm.caching.caching import InMemoryCache +from litellm.constants import MAX_IMAGE_URL_DOWNLOAD_SIZE_MB MAX_IMGS_IN_MEMORY = 10 @@ -21,7 +22,25 @@ def _process_image_response(response: Response, url: str) -> str: f"Error: Unable to fetch image from URL. Status code: {response.status_code}, url={url}" ) + # Check size before downloading if Content-Length header is present + content_length = response.headers.get("Content-Length") + if content_length is not None: + size_mb = int(content_length) / (1024 * 1024) + if size_mb > MAX_IMAGE_URL_DOWNLOAD_SIZE_MB: + raise litellm.ImageFetchError( + f"Error: Image size ({size_mb:.2f}MB) exceeds maximum allowed size ({MAX_IMAGE_URL_DOWNLOAD_SIZE_MB}MB). url={url}" + ) + image_bytes = response.content + + # Check actual size after download if Content-Length was not available + if content_length is None: + size_mb = len(image_bytes) / (1024 * 1024) + if size_mb > MAX_IMAGE_URL_DOWNLOAD_SIZE_MB: + raise litellm.ImageFetchError( + f"Error: Image size ({size_mb:.2f}MB) exceeds maximum allowed size ({MAX_IMAGE_URL_DOWNLOAD_SIZE_MB}MB). url={url}" + ) + base64_image = base64.b64encode(image_bytes).decode("utf-8") image_type = response.headers.get("Content-Type") @@ -48,6 +67,12 @@ def _process_image_response(response: Response, url: str) -> str: async def async_convert_url_to_base64(url: str) -> str: + # If MAX_IMAGE_URL_DOWNLOAD_SIZE_MB is 0, block all image downloads + if MAX_IMAGE_URL_DOWNLOAD_SIZE_MB == 0: + raise litellm.ImageFetchError( + f"Error: Image URL download is disabled (MAX_IMAGE_URL_DOWNLOAD_SIZE_MB=0). url={url}" + ) + cached_result = in_memory_cache.get_cache(url) if cached_result: return cached_result @@ -67,6 +92,12 @@ async def async_convert_url_to_base64(url: str) -> str: def convert_url_to_base64(url: str) -> str: + # If MAX_IMAGE_URL_DOWNLOAD_SIZE_MB is 0, block all image downloads + if MAX_IMAGE_URL_DOWNLOAD_SIZE_MB == 0: + raise litellm.ImageFetchError( + f"Error: Image URL download is disabled (MAX_IMAGE_URL_DOWNLOAD_SIZE_MB=0). url={url}" + ) + cached_result = in_memory_cache.get_cache(url) if cached_result: return cached_result diff --git a/litellm/litellm_core_utils/streaming_chunk_builder_utils.py b/litellm/litellm_core_utils/streaming_chunk_builder_utils.py index c332e5f88f..53252df0a2 100644 --- a/litellm/litellm_core_utils/streaming_chunk_builder_utils.py +++ b/litellm/litellm_core_utils/streaming_chunk_builder_utils.py @@ -17,8 +17,8 @@ from litellm.types.utils import ( ModelResponse, ModelResponseStream, PromptTokensDetailsWrapper, + ServerToolUse, Usage, - ServerToolUse ) from litellm.utils import print_verbose, token_counter @@ -68,12 +68,31 @@ class ChunkProcessor: return chunk["id"] return "" + @staticmethod + def _get_model_from_chunks(chunks: List[Dict[str, Any]], first_chunk_model: str) -> str: + """ + Get the actual model from chunks, preferring a model that differs from the first chunk. + + For Azure Model Router, the first chunk may have the request model (e.g., 'azure-model-router') + while subsequent chunks have the actual model (e.g., 'gpt-4.1-nano-2025-04-14'). + This method finds the actual model for accurate cost calculation. + """ + # Look for a model in chunks that differs from the first chunk's model + for chunk in chunks: + chunk_model = chunk.get("model") + if chunk_model and chunk_model != first_chunk_model: + return chunk_model + # Fall back to first chunk's model if no different model found + return first_chunk_model + def build_base_response(self, chunks: List[Dict[str, Any]]) -> ModelResponse: chunk = self.first_chunk id = ChunkProcessor._get_chunk_id(chunks) object = chunk["object"] created = chunk["created"] - model = chunk["model"] + first_chunk_model = chunk["model"] + # Get the actual model - for Azure Model Router, this finds the real model from later chunks + model = ChunkProcessor._get_model_from_chunks(chunks, first_chunk_model) system_fingerprint = chunk.get("system_fingerprint", None) role = chunk["choices"][0]["delta"]["role"] @@ -113,7 +132,7 @@ class ChunkProcessor: ) return response - def get_combined_tool_content( + def get_combined_tool_content( # noqa: PLR0915 self, tool_call_chunks: List[Dict[str, Any]] ) -> List[ChatCompletionMessageToolCall]: tool_calls_list: List[ChatCompletionMessageToolCall] = [] @@ -128,10 +147,26 @@ class ChunkProcessor: tool_calls = delta.get("tool_calls", []) for tool_call in tool_calls: - if not tool_call or not hasattr(tool_call, "function"): + # Handle both dict and object formats + if not tool_call: + continue + + # Check if tool_call has function (either as attribute or dict key) + has_function = False + if isinstance(tool_call, dict): + has_function = "function" in tool_call and tool_call["function"] is not None + else: + has_function = hasattr(tool_call, "function") and tool_call.function is not None + + if not has_function: continue - index = getattr(tool_call, "index", 0) + # Get index (handle both dict and object) + if isinstance(tool_call, dict): + index = tool_call.get("index", 0) + else: + index = getattr(tool_call, "index", 0) + if index not in tool_call_map: tool_call_map[index] = { "id": None, @@ -141,30 +176,56 @@ class ChunkProcessor: "provider_specific_fields": None, } - if hasattr(tool_call, "id") and tool_call.id: - tool_call_map[index]["id"] = tool_call.id - if hasattr(tool_call, "type") and tool_call.type: - tool_call_map[index]["type"] = tool_call.type - if hasattr(tool_call, "function"): - if ( - hasattr(tool_call.function, "name") - and tool_call.function.name - ): - tool_call_map[index]["name"] = tool_call.function.name - if ( - hasattr(tool_call.function, "arguments") - and tool_call.function.arguments - ): - tool_call_map[index]["arguments"].append( - tool_call.function.arguments - ) + # Extract id, type, and function data (handle both dict and object) + if isinstance(tool_call, dict): + if tool_call.get("id"): + tool_call_map[index]["id"] = tool_call["id"] + if tool_call.get("type"): + tool_call_map[index]["type"] = tool_call["type"] + + function = tool_call.get("function", {}) + if isinstance(function, dict): + if function.get("name"): + tool_call_map[index]["name"] = function["name"] + if function.get("arguments"): + tool_call_map[index]["arguments"].append(function["arguments"]) + else: + # function is an object + if hasattr(function, "name") and function.name: + tool_call_map[index]["name"] = function.name + if hasattr(function, "arguments") and function.arguments: + tool_call_map[index]["arguments"].append(function.arguments) + else: + # tool_call is an object + if hasattr(tool_call, "id") and tool_call.id: + tool_call_map[index]["id"] = tool_call.id + if hasattr(tool_call, "type") and tool_call.type: + tool_call_map[index]["type"] = tool_call.type + if hasattr(tool_call, "function"): + if ( + hasattr(tool_call.function, "name") + and tool_call.function.name + ): + tool_call_map[index]["name"] = tool_call.function.name + if ( + hasattr(tool_call.function, "arguments") + and tool_call.function.arguments + ): + tool_call_map[index]["arguments"].append( + tool_call.function.arguments + ) # Preserve provider_specific_fields from streaming chunks provider_fields = None - if hasattr(tool_call, "provider_specific_fields") and tool_call.provider_specific_fields: - provider_fields = tool_call.provider_specific_fields - elif hasattr(tool_call, "function") and hasattr(tool_call.function, "provider_specific_fields") and tool_call.function.provider_specific_fields: - provider_fields = tool_call.function.provider_specific_fields + if isinstance(tool_call, dict): + provider_fields = tool_call.get("provider_specific_fields") + if not provider_fields and isinstance(tool_call.get("function"), dict): + provider_fields = tool_call["function"].get("provider_specific_fields") + else: + if hasattr(tool_call, "provider_specific_fields") and tool_call.provider_specific_fields: + provider_fields = tool_call.provider_specific_fields + elif hasattr(tool_call, "function") and hasattr(tool_call.function, "provider_specific_fields") and tool_call.function.provider_specific_fields: + provider_fields = tool_call.function.provider_specific_fields if provider_fields: # Merge provider_specific_fields if multiple chunks have them @@ -203,6 +264,7 @@ class ChunkProcessor: return tool_calls_list + def get_combined_function_call_content( self, function_call_chunks: List[Dict[str, Any]] ) -> FunctionCall: diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.py index 6baaae7ae3..3093a37c26 100644 --- a/litellm/litellm_core_utils/streaming_handler.py +++ b/litellm/litellm_core_utils/streaming_handler.py @@ -25,6 +25,7 @@ from litellm.types.utils import ( ) from litellm.types.utils import GenericStreamingChunk as GChunk from litellm.types.utils import ( + LlmProviders, ModelResponse, ModelResponseStream, StreamingChoices, @@ -1301,7 +1302,7 @@ class CustomStreamWrapper: if response_obj["is_finished"]: self.received_finish_reason = response_obj["finish_reason"] else: # openai / azure chat model - if self.custom_llm_provider == "azure": + if self.custom_llm_provider in [LlmProviders.AZURE.value, LlmProviders.AZURE_AI.value]: if isinstance(chunk, BaseModel) and hasattr(chunk, "model"): # for azure, we need to pass the model from the original chunk self.model = getattr(chunk, "model", self.model) diff --git a/litellm/litellm_core_utils/token_counter.py b/litellm/litellm_core_utils/token_counter.py index a21ebd56f6..a99bd1cd0f 100644 --- a/litellm/litellm_core_utils/token_counter.py +++ b/litellm/litellm_core_utils/token_counter.py @@ -719,6 +719,12 @@ def _count_content_list( use_default_image_token_count, default_token_count, ) + elif c["type"] == "thinking": + # Claude extended thinking content block + # Count the thinking text and skip signature (opaque signature blob) + thinking_text = c.get("thinking", "") + if thinking_text: + num_tokens += count_function(thinking_text) else: raise ValueError( f"Invalid content item type: {type(c).__name__}. " diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py index ecad7a5001..24524233dd 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py @@ -2,11 +2,11 @@ ## Translates OpenAI call to Anthropic `/v1/messages` format import json import traceback -from litellm._uuid import uuid from collections import deque from typing import TYPE_CHECKING, Any, AsyncIterator, Iterator, Literal, Optional from litellm import verbose_logger +from litellm._uuid import uuid from litellm.types.llms.anthropic import UsageDelta from litellm.types.utils import AdapterCompletionStreamWrapper @@ -48,6 +48,27 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper): super().__init__(completion_stream) self.model = model + def _create_initial_usage_delta(self) -> UsageDelta: + """ + Create the initial UsageDelta for the message_start event. + + Initializes cache token fields (cache_creation_input_tokens, cache_read_input_tokens) + to 0 to indicate to clients (like Claude Code) that prompt caching is supported. + + The actual cache token values will be provided in the message_delta event at the + end of the stream, since Bedrock Converse API only returns usage data in the final + response chunk. + + Returns: + UsageDelta with all token counts initialized to 0. + """ + return UsageDelta( + input_tokens=0, + output_tokens=0, + cache_creation_input_tokens=0, + cache_read_input_tokens=0, + ) + def __next__(self): from .transformation import LiteLLMAnthropicMessagesAdapter @@ -64,7 +85,7 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper): "model": self.model, "stop_reason": None, "stop_sequence": None, - "usage": UsageDelta(input_tokens=0, output_tokens=0), + "usage": self._create_initial_usage_delta(), }, } if self.sent_content_block_start is False: @@ -169,7 +190,7 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper): "model": self.model, "stop_reason": None, "stop_sequence": None, - "usage": UsageDelta(input_tokens=0, output_tokens=0), + "usage": self._create_initial_usage_delta(), }, } ) @@ -211,10 +232,16 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper): merged_chunk["delta"] = {} # Add usage to the held chunk - merged_chunk["usage"] = { + usage_dict: UsageDelta = { "input_tokens": chunk.usage.prompt_tokens or 0, "output_tokens": chunk.usage.completion_tokens or 0, } + # Add cache tokens if available (for prompt caching support) + if hasattr(chunk.usage, "_cache_creation_input_tokens") and chunk.usage._cache_creation_input_tokens > 0: + usage_dict["cache_creation_input_tokens"] = chunk.usage._cache_creation_input_tokens + if hasattr(chunk.usage, "_cache_read_input_tokens") and chunk.usage._cache_read_input_tokens > 0: + usage_dict["cache_read_input_tokens"] = chunk.usage._cache_read_input_tokens + merged_chunk["usage"] = usage_dict # Queue the merged chunk and reset self.chunk_queue.append(merged_chunk) diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py index 06092755b1..877e47a9ae 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py @@ -17,7 +17,6 @@ from openai.types.chat.chat_completion_chunk import Choice as OpenAIStreamingCho from litellm.litellm_core_utils.prompt_templates.common_utils import ( parse_tool_call_arguments, ) - from litellm.types.llms.anthropic import ( AllAnthropicToolsValues, AnthopicMessagesAssistantMessageParam, @@ -183,6 +182,7 @@ class LiteLLMAnthropicMessagesAdapter: AnthopicMessagesAssistantMessageParam, ] ], + model: Optional[str] = None, ) -> List: new_messages: List[AllMessageValues] = [] for m in messages: @@ -205,12 +205,17 @@ class LiteLLMAnthropicMessagesAdapter: text_obj = ChatCompletionTextObject( type="text", text=content.get("text", "") ) + # Preserve cache_control if present (for prompt caching) + # Only for Anthropic models that support prompt caching + cache_control = content.get("cache_control") + if cache_control and model and self.is_anthropic_claude_model(model): + text_obj["cache_control"] = cache_control # type: ignore new_user_content_list.append(text_obj) elif content.get("type") == "image": # Convert Anthropic image format to OpenAI format source = content.get("source", {}) openai_image_url = ( - self._translate_anthropic_image_to_openai(source) + self._translate_anthropic_image_to_openai(cast(dict, source)) ) if openai_image_url: @@ -240,7 +245,7 @@ class LiteLLMAnthropicMessagesAdapter: # Combine all content items into a single tool message # to avoid creating multiple tool_result blocks with the same ID # (each tool_use must have exactly one tool_result) - content_items = content.get("content", []) + content_items = list(content.get("content", [])) # For single-item content, maintain backward compatibility with string/url format if len(content_items) == 1: @@ -266,7 +271,7 @@ class LiteLLMAnthropicMessagesAdapter: source = c.get("source", {}) openai_image_url = ( self._translate_anthropic_image_to_openai( - source + cast(dict, source) ) or "" ) @@ -306,7 +311,7 @@ class LiteLLMAnthropicMessagesAdapter: source = c.get("source", {}) openai_image_url = ( self._translate_anthropic_image_to_openai( - source + cast(dict, source) ) or "" ) @@ -363,7 +368,7 @@ class LiteLLMAnthropicMessagesAdapter: } signature = ( self._extract_signature_from_tool_use_content( - content + cast(Dict[str, Any], content) ) ) @@ -424,14 +429,21 @@ class LiteLLMAnthropicMessagesAdapter: return new_messages - def translate_anthropic_thinking_to_openai( - self, thinking: Dict[str, Any] + @staticmethod + def translate_anthropic_thinking_to_reasoning_effort( + thinking: Dict[str, Any] ) -> Optional[str]: """ Translate Anthropic's thinking parameter to OpenAI's reasoning_effort. Anthropic thinking format: {'type': 'enabled'|'disabled', 'budget_tokens': int} OpenAI reasoning_effort: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'default' + + Mapping: + - budget_tokens >= 10000 -> 'high' + - budget_tokens >= 5000 -> 'medium' + - budget_tokens >= 2000 -> 'low' + - budget_tokens < 2000 -> 'minimal' """ if not isinstance(thinking, dict): return None @@ -453,6 +465,53 @@ class LiteLLMAnthropicMessagesAdapter: return None + @staticmethod + def is_anthropic_claude_model(model: str) -> bool: + """ + Check if the model is an Anthropic Claude model that supports the thinking parameter. + + Returns True for: + - anthropic/* models + - bedrock/*anthropic* models (including converse) + - vertex_ai/*claude* models + """ + model_lower = model.lower() + return ( + "anthropic" in model_lower + or "claude" in model_lower + ) + + @staticmethod + def translate_thinking_for_model( + thinking: Dict[str, Any], + model: str, + ) -> Dict[str, Any]: + """ + Translate Anthropic thinking parameter based on the target model. + + For Claude/Anthropic models: returns {'thinking': } + - Preserves exact budget_tokens value + + For non-Claude models: returns {'reasoning_effort': } + - Converts thinking to reasoning_effort to avoid UnsupportedParamsError + + Args: + thinking: Anthropic thinking dict with 'type' and 'budget_tokens' + model: The target model name + + Returns: + Dict with either 'thinking' or 'reasoning_effort' key + """ + if LiteLLMAnthropicMessagesAdapter.is_anthropic_claude_model(model): + return {"thinking": thinking} + else: + reasoning_effort = LiteLLMAnthropicMessagesAdapter.translate_anthropic_thinking_to_reasoning_effort( + thinking + ) + if reasoning_effort: + return {"reasoning_effort": reasoning_effort} + return {} + def translate_anthropic_tool_choice_to_openai( self, tool_choice: AnthropicMessagesToolChoice ) -> ChatCompletionToolChoiceValues: @@ -519,7 +578,8 @@ class LiteLLMAnthropicMessagesAdapter: anthropic_message_request["messages"], ) new_messages = self.translate_anthropic_messages_to_openai( - messages=messages_list + messages=messages_list, + model=anthropic_message_request.get("model"), ) ## ADD SYSTEM MESSAGE TO MESSAGES if "system" in anthropic_message_request: @@ -566,11 +626,15 @@ class LiteLLMAnthropicMessagesAdapter: if "thinking" in anthropic_message_request: thinking = anthropic_message_request["thinking"] if thinking: - reasoning_effort = self.translate_anthropic_thinking_to_openai( - thinking=cast(Dict[str, Any], thinking) - ) - if reasoning_effort: - new_kwargs["reasoning_effort"] = reasoning_effort + model = new_kwargs.get("model", "") + if self.is_anthropic_claude_model(model): + new_kwargs["thinking"] = thinking # type: ignore + else: + reasoning_effort = self.translate_anthropic_thinking_to_reasoning_effort( + cast(Dict[str, Any], thinking) + ) + if reasoning_effort: + new_kwargs["reasoning_effort"] = reasoning_effort translatable_params = self.translatable_anthropic_params() for k, v in anthropic_message_request.items(): @@ -721,6 +785,12 @@ class LiteLLMAnthropicMessagesAdapter: input_tokens=usage.prompt_tokens or 0, output_tokens=usage.completion_tokens or 0, ) + # Add cache tokens if available (for prompt caching support) + if hasattr(usage, "_cache_creation_input_tokens") and usage._cache_creation_input_tokens > 0: + anthropic_usage["cache_creation_input_tokens"] = usage._cache_creation_input_tokens + if hasattr(usage, "_cache_read_input_tokens") and usage._cache_read_input_tokens > 0: + anthropic_usage["cache_read_input_tokens"] = usage._cache_read_input_tokens + translated_obj = AnthropicMessagesResponse( id=response.id, type="message", @@ -868,6 +938,11 @@ class LiteLLMAnthropicMessagesAdapter: input_tokens=litellm_usage_chunk.prompt_tokens or 0, output_tokens=litellm_usage_chunk.completion_tokens or 0, ) + # Add cache tokens if available (for prompt caching support) + if hasattr(litellm_usage_chunk, "_cache_creation_input_tokens") and litellm_usage_chunk._cache_creation_input_tokens > 0: + usage_delta["cache_creation_input_tokens"] = litellm_usage_chunk._cache_creation_input_tokens + if hasattr(litellm_usage_chunk, "_cache_read_input_tokens") and litellm_usage_chunk._cache_read_input_tokens > 0: + usage_delta["cache_read_input_tokens"] = litellm_usage_chunk._cache_read_input_tokens else: usage_delta = UsageDelta(input_tokens=0, output_tokens=0) return MessageBlockDelta( diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/fake_stream_iterator.py b/litellm/llms/anthropic/experimental_pass_through/messages/fake_stream_iterator.py new file mode 100644 index 0000000000..542ae20b60 --- /dev/null +++ b/litellm/llms/anthropic/experimental_pass_through/messages/fake_stream_iterator.py @@ -0,0 +1,246 @@ +""" +Fake Streaming Iterator for Anthropic Messages + +This module provides a fake streaming iterator that converts non-streaming +Anthropic Messages responses into proper streaming format. + +Used when WebSearch interception converts stream=True to stream=False but +the LLM doesn't make a tool call, and we need to return a stream to the user. +""" + +import json +from typing import Any, Dict, List, cast + +from litellm.types.llms.anthropic_messages.anthropic_response import ( + AnthropicMessagesResponse, +) + + +class FakeAnthropicMessagesStreamIterator: + """ + Fake streaming iterator for Anthropic Messages responses. + + Used when we need to convert a non-streaming response to a streaming format, + such as when WebSearch interception converts stream=True to stream=False but + the LLM doesn't make a tool call. + + This creates a proper Anthropic-style streaming response with multiple events: + - message_start + - content_block_start (for each content block) + - content_block_delta (for text content, chunked) + - content_block_stop + - message_delta (for usage) + - message_stop + """ + + def __init__(self, response: AnthropicMessagesResponse): + self.response = response + self.chunks = self._create_streaming_chunks() + self.current_index = 0 + + def _create_streaming_chunks(self) -> List[bytes]: + """Convert the non-streaming response to streaming chunks""" + chunks = [] + + # Cast response to dict for easier access + response_dict = cast(Dict[str, Any], self.response) + + # 1. message_start event + usage = response_dict.get("usage", {}) + message_start = { + "type": "message_start", + "message": { + "id": response_dict.get("id"), + "type": "message", + "role": response_dict.get("role", "assistant"), + "model": response_dict.get("model"), + "content": [], + "stop_reason": None, + "stop_sequence": None, + "usage": { + "input_tokens": usage.get("input_tokens", 0) if usage else 0, + "output_tokens": 0 + } + } + } + chunks.append(f"event: message_start\ndata: {json.dumps(message_start)}\n\n".encode()) + + # 2-4. For each content block, send start/delta/stop events + content_blocks = response_dict.get("content", []) + if content_blocks: + for index, block in enumerate(content_blocks): + # Cast block to dict for easier access + block_dict = cast(Dict[str, Any], block) + block_type = block_dict.get("type") + + if block_type == "text": + # content_block_start + content_block_start = { + "type": "content_block_start", + "index": index, + "content_block": { + "type": "text", + "text": "" + } + } + chunks.append(f"event: content_block_start\ndata: {json.dumps(content_block_start)}\n\n".encode()) + + # content_block_delta (send full text as one delta for simplicity) + text = block_dict.get("text", "") + content_block_delta = { + "type": "content_block_delta", + "index": index, + "delta": { + "type": "text_delta", + "text": text + } + } + chunks.append(f"event: content_block_delta\ndata: {json.dumps(content_block_delta)}\n\n".encode()) + + # content_block_stop + content_block_stop = { + "type": "content_block_stop", + "index": index + } + chunks.append(f"event: content_block_stop\ndata: {json.dumps(content_block_stop)}\n\n".encode()) + + elif block_type == "thinking": + # content_block_start for thinking + content_block_start = { + "type": "content_block_start", + "index": index, + "content_block": { + "type": "thinking", + "thinking": "", + "signature": "" + } + } + chunks.append(f"event: content_block_start\ndata: {json.dumps(content_block_start)}\n\n".encode()) + + # content_block_delta for thinking text + thinking_text = block_dict.get("thinking", "") + if thinking_text: + content_block_delta = { + "type": "content_block_delta", + "index": index, + "delta": { + "type": "thinking_delta", + "thinking": thinking_text + } + } + chunks.append(f"event: content_block_delta\ndata: {json.dumps(content_block_delta)}\n\n".encode()) + + # content_block_delta for signature (if present) + signature = block_dict.get("signature", "") + if signature: + signature_delta = { + "type": "content_block_delta", + "index": index, + "delta": { + "type": "signature_delta", + "signature": signature + } + } + chunks.append(f"event: content_block_delta\ndata: {json.dumps(signature_delta)}\n\n".encode()) + + # content_block_stop + content_block_stop = { + "type": "content_block_stop", + "index": index + } + chunks.append(f"event: content_block_stop\ndata: {json.dumps(content_block_stop)}\n\n".encode()) + + elif block_type == "redacted_thinking": + # content_block_start for redacted_thinking + content_block_start = { + "type": "content_block_start", + "index": index, + "content_block": { + "type": "redacted_thinking" + } + } + chunks.append(f"event: content_block_start\ndata: {json.dumps(content_block_start)}\n\n".encode()) + + # content_block_stop (no delta for redacted thinking) + content_block_stop = { + "type": "content_block_stop", + "index": index + } + chunks.append(f"event: content_block_stop\ndata: {json.dumps(content_block_stop)}\n\n".encode()) + + elif block_type == "tool_use": + # content_block_start + content_block_start = { + "type": "content_block_start", + "index": index, + "content_block": { + "type": "tool_use", + "id": block_dict.get("id"), + "name": block_dict.get("name"), + "input": {} + } + } + chunks.append(f"event: content_block_start\ndata: {json.dumps(content_block_start)}\n\n".encode()) + + # content_block_delta (send input as JSON delta) + input_data = block_dict.get("input", {}) + content_block_delta = { + "type": "content_block_delta", + "index": index, + "delta": { + "type": "input_json_delta", + "partial_json": json.dumps(input_data) + } + } + chunks.append(f"event: content_block_delta\ndata: {json.dumps(content_block_delta)}\n\n".encode()) + + # content_block_stop + content_block_stop = { + "type": "content_block_stop", + "index": index + } + chunks.append(f"event: content_block_stop\ndata: {json.dumps(content_block_stop)}\n\n".encode()) + + # 5. message_delta event (with final usage and stop_reason) + message_delta = { + "type": "message_delta", + "delta": { + "stop_reason": response_dict.get("stop_reason"), + "stop_sequence": response_dict.get("stop_sequence") + }, + "usage": { + "output_tokens": usage.get("output_tokens", 0) if usage else 0 + } + } + chunks.append(f"event: message_delta\ndata: {json.dumps(message_delta)}\n\n".encode()) + + # 6. message_stop event + message_stop = { + "type": "message_stop", + "usage": usage if usage else {} + } + chunks.append(f"event: message_stop\ndata: {json.dumps(message_stop)}\n\n".encode()) + + return chunks + + def __aiter__(self): + return self + + async def __anext__(self): + if self.current_index >= len(self.chunks): + raise StopAsyncIteration + + chunk = self.chunks[self.current_index] + self.current_index += 1 + return chunk + + def __iter__(self): + return self + + def __next__(self): + if self.current_index >= len(self.chunks): + raise StopIteration + + chunk = self.chunks[self.current_index] + self.current_index += 1 + return chunk diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/handler.py b/litellm/llms/anthropic/experimental_pass_through/messages/handler.py index 908b46c11e..7e5a4f22a7 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/handler.py +++ b/litellm/llms/anthropic/experimental_pass_through/messages/handler.py @@ -33,6 +33,70 @@ base_llm_http_handler = BaseLLMHTTPHandler() ################################################# +async def _execute_pre_request_hooks( + model: str, + messages: List[Dict], + tools: Optional[List[Dict]], + stream: Optional[bool], + custom_llm_provider: Optional[str], + **kwargs, +) -> Dict: + """ + Execute pre-request hooks from CustomLogger callbacks. + + Allows CustomLoggers to modify request parameters before the API call. + Used for WebSearch tool conversion, stream modification, etc. + + Args: + model: Model name + messages: List of messages + tools: Optional tools list + stream: Optional stream flag + custom_llm_provider: Provider name (if not set, will be extracted from model) + **kwargs: Additional request parameters + + Returns: + Dict containing all (potentially modified) request parameters including tools, stream + """ + # If custom_llm_provider not provided, extract from model + if not custom_llm_provider: + try: + _, custom_llm_provider, _, _ = litellm.get_llm_provider(model=model) + except Exception: + # If extraction fails, continue without provider + pass + + # Build complete request kwargs dict + request_kwargs = { + "tools": tools, + "stream": stream, + "litellm_params": { + "custom_llm_provider": custom_llm_provider, + }, + **kwargs, + } + + if not litellm.callbacks: + return request_kwargs + + from litellm.integrations.custom_logger import CustomLogger as _CustomLogger + + for callback in litellm.callbacks: + if not isinstance(callback, _CustomLogger): + continue + + # Call the pre-request hook + modified_kwargs = await callback.async_pre_request_hook( + model, messages, request_kwargs + ) + + # If hook returned modified kwargs, use them + if modified_kwargs is not None: + request_kwargs = modified_kwargs + + return request_kwargs + + @client async def anthropic_messages( max_tokens: int, @@ -57,7 +121,24 @@ async def anthropic_messages( """ Async: Make llm api request in Anthropic /messages API spec """ - local_vars = locals() + # Execute pre-request hooks to allow CustomLoggers to modify request + request_kwargs = await _execute_pre_request_hooks( + model=model, + messages=messages, + tools=tools, + stream=stream, + custom_llm_provider=custom_llm_provider, + **kwargs, + ) + + # Extract modified parameters + tools = request_kwargs.pop("tools", tools) + stream = request_kwargs.pop("stream", stream) + # Remove litellm_params from kwargs (only needed for hooks) + request_kwargs.pop("litellm_params", None) + # Merge back any other modifications + kwargs.update(request_kwargs) + loop = asyncio.get_event_loop() kwargs["is_async"] = True @@ -145,6 +226,10 @@ def anthropic_messages_handler( # Use provided client or create a new one litellm_logging_obj: LiteLLMLoggingObj = kwargs.get("litellm_logging_obj") # type: ignore + # Store original model name before get_llm_provider strips the provider prefix + # This is needed by agentic hooks (e.g., websearch_interception) to make follow-up requests + original_model = model + litellm_params = GenericLiteLLMParams( **kwargs, api_key=api_key, @@ -162,6 +247,19 @@ def anthropic_messages_handler( api_base=litellm_params.api_base, api_key=litellm_params.api_key, ) + + # Store agentic loop params in logging object for agentic hooks + # This provides original request context needed for follow-up calls + if litellm_logging_obj is not None: + litellm_logging_obj.model_call_details["agentic_loop_params"] = { + "model": original_model, + "custom_llm_provider": custom_llm_provider, + } + + # Check if stream was converted for WebSearch interception + # This is set in the async wrapper above when stream=True is converted to stream=False + if kwargs.get("_websearch_interception_converted_stream", False): + litellm_logging_obj.model_call_details["websearch_interception_converted_stream"] = True if litellm_params.mock_response and isinstance(litellm_params.mock_response, str): diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py index 790e790196..f67e4c8382 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py @@ -2,7 +2,8 @@ from typing import Any, AsyncIterator, Dict, List, Optional, Tuple import httpx -from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj, verbose_logger +from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj +from litellm.litellm_core_utils.litellm_logging import verbose_logger from litellm.llms.base_llm.anthropic_messages.transformation import ( BaseAnthropicMessagesConfig, ) @@ -13,9 +14,10 @@ from litellm.types.llms.anthropic import ( from litellm.types.llms.anthropic_messages.anthropic_response import ( AnthropicMessagesResponse, ) +from litellm.types.llms.anthropic_tool_search import get_tool_search_beta_header from litellm.types.router import GenericLiteLLMParams -from ...common_utils import AnthropicError +from ...common_utils import AnthropicError, AnthropicModelInfo DEFAULT_ANTHROPIC_API_BASE = "https://api.anthropic.com" DEFAULT_ANTHROPIC_API_VERSION = "2023-06-01" @@ -75,9 +77,9 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig): if "content-type" not in headers: headers["content-type"] = "application/json" - headers = self._update_headers_with_optional_anthropic_beta( + headers = self._update_headers_with_anthropic_beta( headers=headers, - context_management=optional_params.get("context_management"), + optional_params=optional_params, ) return headers, api_base @@ -153,16 +155,44 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig): ) @staticmethod - def _update_headers_with_optional_anthropic_beta( - headers: dict, context_management: Optional[Dict] + def _update_headers_with_anthropic_beta( + headers: dict, + optional_params: dict, + custom_llm_provider: str = "anthropic", ) -> dict: - if context_management is None: - return headers - + """ + Auto-inject anthropic-beta headers based on features used. + + Handles: + - context_management: adds 'context-management-2025-06-27' + - tool_search: adds provider-specific tool search header + + Args: + headers: Request headers dict + optional_params: Optional parameters including tools, context_management + custom_llm_provider: Provider name for looking up correct tool search header + """ + beta_values: set = set() + + # Get existing beta headers if any existing_beta = headers.get("anthropic-beta") - beta_value = ANTHROPIC_BETA_HEADER_VALUES.CONTEXT_MANAGEMENT_2025_06_27.value - if existing_beta is None: - headers["anthropic-beta"] = beta_value - elif beta_value not in [beta.strip() for beta in existing_beta.split(",")]: - headers["anthropic-beta"] = f"{existing_beta}, {beta_value}" + if existing_beta: + beta_values.update(b.strip() for b in existing_beta.split(",")) + + # Check for context management + if optional_params.get("context_management") is not None: + beta_values.add(ANTHROPIC_BETA_HEADER_VALUES.CONTEXT_MANAGEMENT_2025_06_27.value) + + # Check for tool search tools + tools = optional_params.get("tools") + if tools: + anthropic_model_info = AnthropicModelInfo() + if anthropic_model_info.is_tool_search_used(tools): + # Use provider-specific tool search header + tool_search_header = get_tool_search_beta_header(custom_llm_provider) + beta_values.add(tool_search_header) + + if beta_values: + headers["anthropic-beta"] = ",".join(sorted(beta_values)) + return headers diff --git a/litellm/llms/azure/azure.py b/litellm/llms/azure/azure.py index ec4553fac4..3ef0186ba0 100644 --- a/litellm/llms/azure/azure.py +++ b/litellm/llms/azure/azure.py @@ -664,8 +664,29 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM): **data, timeout=timeout ) headers = dict(raw_response.headers) - response = raw_response.parse() + + # Convert json.JSONDecodeError to AzureOpenAIError for two critical reasons: + # + # 1. ROUTER BEHAVIOR: The router relies on exception.status_code to determine cooldown logic: + # - JSONDecodeError has no status_code → router skips cooldown evaluation + # - AzureOpenAIError has status_code → router properly evaluates for cooldown + # + # 2. CONNECTION CLEANUP: When response.parse() throws JSONDecodeError, the response + # body may not be fully consumed, preventing httpx from properly returning the + # connection to the pool. By catching the exception and accessing raw_response.status_code, + # we trigger httpx's internal cleanup logic. Without this: + # - parse() fails → JSONDecodeError bubbles up → httpx never knows response was acknowledged → connection leak + # This completely eliminates "Unclosed connection" warnings during high load. + try: + response = raw_response.parse() + except json.JSONDecodeError as json_error: + raise AzureOpenAIError( + status_code=raw_response.status_code or 500, + message=f"Failed to parse raw Azure embedding response: {str(json_error)}" + ) from json_error + stringified_response = response.model_dump() + ## LOGGING logging_obj.post_call( input=input, diff --git a/litellm/llms/azure/exception_mapping.py b/litellm/llms/azure/exception_mapping.py index 70c2609c6b..193f3d9995 100644 --- a/litellm/llms/azure/exception_mapping.py +++ b/litellm/llms/azure/exception_mapping.py @@ -7,6 +7,7 @@ class AzureOpenAIExceptionMapping: """ Class for creating Azure OpenAI specific exceptions """ + @staticmethod def create_content_policy_violation_error( message: str, @@ -16,18 +17,20 @@ class AzureOpenAIExceptionMapping: ) -> ContentPolicyViolationError: """ Create a content policy violation error - """ + """ raise ContentPolicyViolationError( - message=f"litellm.ContentPolicyViolationError: AzureException - {message}", + message=f"AzureException - {message}", llm_provider="azure", model=model, litellm_debug_info=extra_information, response=getattr(original_exception, "response", None), provider_specific_fields={ - "innererror": AzureOpenAIExceptionMapping._get_innererror_from_exception(original_exception) + "innererror": AzureOpenAIExceptionMapping._get_innererror_from_exception( + original_exception + ) }, ) - + @staticmethod def _get_innererror_from_exception(original_exception: Exception) -> Optional[dict]: """ @@ -39,4 +42,3 @@ class AzureOpenAIExceptionMapping: if isinstance(body_dict, dict): innererror = body_dict.get("innererror") return innererror - \ No newline at end of file diff --git a/litellm/llms/azure_ai/anthropic/messages_transformation.py b/litellm/llms/azure_ai/anthropic/messages_transformation.py index 55818cc07d..0d00c90703 100644 --- a/litellm/llms/azure_ai/anthropic/messages_transformation.py +++ b/litellm/llms/azure_ai/anthropic/messages_transformation.py @@ -62,10 +62,10 @@ class AzureAnthropicMessagesConfig(AnthropicMessagesConfig): if "content-type" not in headers: headers["content-type"] = "application/json" - # Update headers with optional anthropic beta features - headers = self._update_headers_with_optional_anthropic_beta( + # Update headers with anthropic beta features (context management, tool search, etc.) + headers = self._update_headers_with_anthropic_beta( headers=headers, - context_management=optional_params.get("context_management"), + optional_params=optional_params, ) return headers, api_base diff --git a/litellm/llms/azure_ai/image_edit/flux2_transformation.py b/litellm/llms/azure_ai/image_edit/flux2_transformation.py index caa3905667..87bae59ba0 100644 --- a/litellm/llms/azure_ai/image_edit/flux2_transformation.py +++ b/litellm/llms/azure_ai/image_edit/flux2_transformation.py @@ -87,7 +87,7 @@ class AzureFoundryFlux2ImageEditConfig(OpenAIImageEditConfig): def transform_image_edit_request( self, model: str, - prompt: str, + prompt: Optional[str], image: FileTypes, image_edit_optional_request_params: Dict, litellm_params: GenericLiteLLMParams, @@ -99,6 +99,9 @@ class AzureFoundryFlux2ImageEditConfig(OpenAIImageEditConfig): FLUX 2 uses the same endpoint for generation and editing, with the image passed as base64 in the JSON body. """ + if prompt is None: + raise ValueError("FLUX 2 image edit requires a prompt.") + image_b64 = self._convert_image_to_base64(image) # Build request body with required params diff --git a/litellm/llms/base_llm/image_edit/transformation.py b/litellm/llms/base_llm/image_edit/transformation.py index d522675296..cc72348037 100644 --- a/litellm/llms/base_llm/image_edit/transformation.py +++ b/litellm/llms/base_llm/image_edit/transformation.py @@ -92,7 +92,7 @@ class BaseImageEditConfig(ABC): def transform_image_edit_request( self, model: str, - prompt: str, + prompt: Optional[str], image: FileTypes, image_edit_optional_request_params: Dict, litellm_params: GenericLiteLLMParams, diff --git a/litellm/llms/bedrock/base_aws_llm.py b/litellm/llms/bedrock/base_aws_llm.py index 18e9deb53b..bfb25416cf 100644 --- a/litellm/llms/bedrock/base_aws_llm.py +++ b/litellm/llms/bedrock/base_aws_llm.py @@ -87,7 +87,7 @@ class BaseAWSLLM: """ import litellm from litellm.secret_managers.main import str_to_bool - + # Check environment variable first (highest priority) ssl_verify = os.getenv("SSL_VERIFY", litellm.ssl_verify) @@ -1232,15 +1232,20 @@ class BaseAWSLLM: else: headers = {"Content-Type": "application/json"} + aws_signature_headers = self._filter_headers_for_aws_signature(headers) request = AWSRequest( method="POST", url=api_base, data=json.dumps(request_data), - headers=headers, + headers=aws_signature_headers, ) sigv4.add_auth(request) request_headers_dict = dict(request.headers) + # Add back original headers after signing. Only headers in SignedHeaders + # are integrity-protected; forwarded headers (x-forwarded-*) must remain unsigned. + for header_name, header_value in headers.items(): + request_headers_dict[header_name] = header_value if ( headers is not None and "Authorization" in headers ): # prevent sigv4 from overwriting the auth header diff --git a/litellm/llms/bedrock/chat/agentcore/sse_iterator.py b/litellm/llms/bedrock/chat/agentcore/sse_iterator.py deleted file mode 100644 index 90c5ada769..0000000000 --- a/litellm/llms/bedrock/chat/agentcore/sse_iterator.py +++ /dev/null @@ -1,252 +0,0 @@ -""" -SSE Stream Iterator for Bedrock AgentCore. - -Handles Server-Sent Events (SSE) streaming responses from AgentCore. -""" - -import json -from typing import TYPE_CHECKING, Any, Optional - -import httpx - -from litellm._logging import verbose_logger -from litellm._uuid import uuid -from litellm.types.llms.bedrock_agentcore import AgentCoreUsage -from litellm.types.utils import Delta, ModelResponse, StreamingChoices, Usage - -if TYPE_CHECKING: - pass - - -class AgentCoreSSEStreamIterator: - """ - Iterator for AgentCore SSE streaming responses. - Supports both sync and async iteration. - - CRITICAL: The line iterators are created lazily on first access and reused. - We must NOT create new iterators in __aiter__/__iter__ because - CustomStreamWrapper calls __aiter__ on every call to its __anext__, - which would create new iterators and cause StreamConsumed errors. - """ - - def __init__(self, response: httpx.Response, model: str): - self.response = response - self.model = model - self.finished = False - self._sync_iter: Any = None - self._async_iter: Any = None - self._sync_iter_initialized = False - self._async_iter_initialized = False - - def __iter__(self): - """Initialize sync iteration - create iterator lazily on first call only.""" - if not self._sync_iter_initialized: - self._sync_iter = iter(self.response.iter_lines()) - self._sync_iter_initialized = True - return self - - def __aiter__(self): - """Initialize async iteration - create iterator lazily on first call only.""" - if not self._async_iter_initialized: - self._async_iter = self.response.aiter_lines().__aiter__() - self._async_iter_initialized = True - return self - - def _parse_sse_line(self, line: str) -> Optional[ModelResponse]: - """ - Parse a single SSE line and return a ModelResponse chunk if applicable. - - AgentCore SSE format: - - data: {"event": {"contentBlockDelta": {"delta": {"text": "..."}}}} - - data: {"event": {"metadata": {"usage": {...}}}} - - data: {"message": {...}} - """ - line = line.strip() - if not line or not line.startswith("data:"): - return None - - json_str = line[5:].strip() - if not json_str: - return None - - try: - data = json.loads(json_str) - - # Skip non-dict data (some lines contain Python repr strings) - if not isinstance(data, dict): - return None - - # Process content delta events - if "event" in data and isinstance(data["event"], dict): - event_payload = data["event"] - content_block_delta = event_payload.get("contentBlockDelta") - - if content_block_delta: - delta = content_block_delta.get("delta", {}) - text = delta.get("text", "") - - if text: - # Return chunk with text - chunk = ModelResponse( - id=f"chatcmpl-{uuid.uuid4()}", - created=0, - model=self.model, - object="chat.completion.chunk", - ) - - chunk.choices = [ - StreamingChoices( - finish_reason=None, - index=0, - delta=Delta(content=text, role="assistant"), - ) - ] - - return chunk - - # Check for metadata/usage - this signals the end - metadata = event_payload.get("metadata") - if metadata and "usage" in metadata: - chunk = ModelResponse( - id=f"chatcmpl-{uuid.uuid4()}", - created=0, - model=self.model, - object="chat.completion.chunk", - ) - - chunk.choices = [ - StreamingChoices( - finish_reason="stop", - index=0, - delta=Delta(), - ) - ] - - usage_data: AgentCoreUsage = metadata["usage"] # type: ignore - setattr( - chunk, - "usage", - Usage( - prompt_tokens=usage_data.get("inputTokens", 0), - completion_tokens=usage_data.get("outputTokens", 0), - total_tokens=usage_data.get("totalTokens", 0), - ), - ) - - self.finished = True - return chunk - - # Check for final message (alternative finish signal) - if "message" in data and isinstance(data["message"], dict): - if not self.finished: - chunk = ModelResponse( - id=f"chatcmpl-{uuid.uuid4()}", - created=0, - model=self.model, - object="chat.completion.chunk", - ) - - chunk.choices = [ - StreamingChoices( - finish_reason="stop", - index=0, - delta=Delta(), - ) - ] - - self.finished = True - return chunk - - except json.JSONDecodeError: - verbose_logger.debug(f"Skipping non-JSON SSE line: {line[:100]}") - - return None - - def _create_final_chunk(self) -> ModelResponse: - """Create a final chunk to signal stream completion.""" - chunk = ModelResponse( - id=f"chatcmpl-{uuid.uuid4()}", - created=0, - model=self.model, - object="chat.completion.chunk", - ) - - chunk.choices = [ - StreamingChoices( - finish_reason="stop", - index=0, - delta=Delta(), - ) - ] - - return chunk - - def __next__(self) -> ModelResponse: - """ - Sync iteration - parse SSE events and yield ModelResponse chunks. - - Uses next() on the stored iterator to properly resume between calls. - """ - try: - if self._sync_iter is None: - raise StopIteration - - # Keep getting lines until we have a result to return - while True: - try: - line = next(self._sync_iter) - except StopIteration: - # Stream ended - send final chunk if not already finished - if not self.finished: - self.finished = True - return self._create_final_chunk() - raise - - result = self._parse_sse_line(line) - if result is not None: - return result - - except StopIteration: - raise - except httpx.StreamConsumed: - raise StopIteration - except httpx.StreamClosed: - raise StopIteration - except Exception as e: - verbose_logger.error(f"Error in AgentCore SSE stream: {str(e)}") - raise StopIteration - - async def __anext__(self) -> ModelResponse: - """ - Async iteration - parse SSE events and yield ModelResponse chunks. - - Uses __anext__() on the stored iterator to properly resume between calls. - """ - try: - if self._async_iter is None: - raise StopAsyncIteration - - # Keep getting lines until we have a result to return - while True: - try: - line = await self._async_iter.__anext__() - except StopAsyncIteration: - # Stream ended - send final chunk if not already finished - if not self.finished: - self.finished = True - return self._create_final_chunk() - raise - - result = self._parse_sse_line(line) - if result is not None: - return result - - except StopAsyncIteration: - raise - except httpx.StreamConsumed: - raise StopAsyncIteration - except httpx.StreamClosed: - raise StopAsyncIteration - except Exception as e: - verbose_logger.error(f"Error in AgentCore SSE stream: {str(e)}") - raise StopAsyncIteration diff --git a/litellm/llms/bedrock/chat/agentcore/transformation.py b/litellm/llms/bedrock/chat/agentcore/transformation.py index 7c65cad94d..94e845e309 100644 --- a/litellm/llms/bedrock/chat/agentcore/transformation.py +++ b/litellm/llms/bedrock/chat/agentcore/transformation.py @@ -5,6 +5,7 @@ https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agentcore_InvokeAgen """ import json +from collections.abc import AsyncGenerator from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union, cast from urllib.parse import quote @@ -15,9 +16,9 @@ from litellm._uuid import uuid from litellm.litellm_core_utils.prompt_templates.common_utils import ( convert_content_list_to_str, ) +from litellm.litellm_core_utils.streaming_handler import CustomStreamWrapper from litellm.llms.base_llm.chat.transformation import BaseConfig, BaseLLMException from litellm.llms.bedrock.base_aws_llm import BaseAWSLLM -from litellm.llms.bedrock.chat.agentcore.sse_iterator import AgentCoreSSEStreamIterator from litellm.llms.bedrock.common_utils import BedrockError from litellm.types.llms.bedrock_agentcore import ( AgentCoreMessage, @@ -25,19 +26,17 @@ from litellm.types.llms.bedrock_agentcore import ( AgentCoreUsage, ) from litellm.types.llms.openai import AllMessageValues -from litellm.types.utils import Choices, Message, ModelResponse, Usage +from litellm.types.utils import Choices, Delta, Message, ModelResponse, StreamingChoices, Usage if TYPE_CHECKING: from litellm.litellm_core_utils.litellm_logging import Logging as _LiteLLMLoggingObj from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler - from litellm.utils import CustomStreamWrapper LiteLLMLoggingObj = _LiteLLMLoggingObj else: LiteLLMLoggingObj = Any HTTPHandler = Any AsyncHTTPHandler = Any - CustomStreamWrapper = Any class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): @@ -116,7 +115,8 @@ class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): fake_stream: Optional[bool] = None, ) -> Tuple[dict, Optional[bytes]]: # Check if api_key (bearer token) is provided for Cognito authentication - jwt_token = optional_params.get("api_key") + # Priority: api_key parameter first, then optional_params + jwt_token = api_key or optional_params.get("api_key") if jwt_token: verbose_logger.debug( f"AgentCore: Using Bearer token authentication (Cognito/JWT) - token: {jwt_token[:50]}..." @@ -437,22 +437,104 @@ class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): content=content, usage=usage_data, final_message=final_message ) - def get_streaming_response( + def _stream_agentcore_response_sync( self, + response: httpx.Response, model: str, - raw_response: httpx.Response, - ) -> AgentCoreSSEStreamIterator: + ): """ - Return a streaming iterator for SSE responses. - - Args: - model: The model name - raw_response: Raw HTTP response with streaming data - - Returns: - AgentCoreSSEStreamIterator: Iterator that yields ModelResponse chunks + Internal sync generator that parses SSE and yields ModelResponse chunks. """ - return AgentCoreSSEStreamIterator(response=raw_response, model=model) + buffer = "" + for text_chunk in response.iter_text(): + buffer += text_chunk + + # Process complete lines + while '\n' in buffer: + line, buffer = buffer.split('\n', 1) + line = line.strip() + + if not line or not line.startswith('data:'): + continue + + json_str = line[5:].strip() + if not json_str: + continue + + try: + data_obj = json.loads(json_str) + if not isinstance(data_obj, dict): + continue + + # Process contentBlockDelta events + if "event" in data_obj and isinstance(data_obj["event"], dict): + event_payload = data_obj["event"] + content_block_delta = event_payload.get("contentBlockDelta") + + if content_block_delta: + delta = content_block_delta.get("delta", {}) + text = delta.get("text", "") + + if text: + chunk = ModelResponse( + id=f"chatcmpl-{uuid.uuid4()}", + created=0, + model=model, + object="chat.completion.chunk", + ) + chunk.choices = [ + StreamingChoices( + finish_reason=None, + index=0, + delta=Delta(content=text, role="assistant"), + ) + ] + yield chunk + + # Process metadata/usage + metadata = event_payload.get("metadata") + if metadata and "usage" in metadata: + chunk = ModelResponse( + id=f"chatcmpl-{uuid.uuid4()}", + created=0, + model=model, + object="chat.completion.chunk", + ) + chunk.choices = [ + StreamingChoices( + finish_reason="stop", + index=0, + delta=Delta(), + ) + ] + usage_data: AgentCoreUsage = metadata["usage"] # type: ignore + setattr(chunk, "usage", Usage( + prompt_tokens=usage_data.get("inputTokens", 0), + completion_tokens=usage_data.get("outputTokens", 0), + total_tokens=usage_data.get("totalTokens", 0), + )) + yield chunk + + # Process final message + if "message" in data_obj and isinstance(data_obj["message"], dict): + chunk = ModelResponse( + id=f"chatcmpl-{uuid.uuid4()}", + created=0, + model=model, + object="chat.completion.chunk", + ) + chunk.choices = [ + StreamingChoices( + finish_reason="stop", + index=0, + delta=Delta(), + ) + ] + yield chunk + + except json.JSONDecodeError: + verbose_logger.debug(f"Skipping non-JSON SSE line: {line[:100]}") + continue def get_sync_custom_stream_wrapper( self, @@ -466,17 +548,14 @@ class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): client: Optional[Union[HTTPHandler, "AsyncHTTPHandler"]] = None, json_mode: Optional[bool] = None, signed_json_body: Optional[bytes] = None, - ) -> CustomStreamWrapper: + ) -> "CustomStreamWrapper": """ - Get a CustomStreamWrapper for synchronous streaming. - - This is called when stream=True is passed to completion(). + Simplified sync streaming - returns a generator that yields ModelResponse chunks. """ from litellm.llms.custom_httpx.http_handler import ( HTTPHandler, _get_httpx_client, ) - from litellm.utils import CustomStreamWrapper if client is None or not isinstance(client, HTTPHandler): client = _get_httpx_client(params={}) @@ -488,7 +567,7 @@ class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): api_base, headers=headers, data=signed_json_body if signed_json_body else json.dumps(data), - stream=True, # THIS IS KEY - tells httpx to not buffer + stream=True, logging_obj=logging_obj, ) @@ -497,18 +576,6 @@ class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): status_code=response.status_code, message=str(response.read()) ) - # Create iterator for SSE stream - completion_stream = self.get_streaming_response( - model=model, raw_response=response - ) - - streaming_response = CustomStreamWrapper( - completion_stream=completion_stream, - model=model, - custom_llm_provider=custom_llm_provider, - logging_obj=logging_obj, - ) - # LOGGING logging_obj.post_call( input=messages, @@ -517,7 +584,112 @@ class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): additional_args={"complete_input_dict": data}, ) - return streaming_response + # Wrap the generator in CustomStreamWrapper + return CustomStreamWrapper( + completion_stream=self._stream_agentcore_response_sync(response, model), + model=model, + custom_llm_provider="bedrock", + logging_obj=logging_obj, + ) + + async def _stream_agentcore_response( + self, + response: httpx.Response, + model: str, + ) -> AsyncGenerator[ModelResponse, None]: + """ + Internal async generator that parses SSE and yields ModelResponse chunks. + """ + buffer = "" + async for text_chunk in response.aiter_text(): + buffer += text_chunk + + # Process complete lines + while '\n' in buffer: + line, buffer = buffer.split('\n', 1) + line = line.strip() + + if not line or not line.startswith('data:'): + continue + + json_str = line[5:].strip() + if not json_str: + continue + + try: + data_obj = json.loads(json_str) + if not isinstance(data_obj, dict): + continue + + # Process contentBlockDelta events + if "event" in data_obj and isinstance(data_obj["event"], dict): + event_payload = data_obj["event"] + content_block_delta = event_payload.get("contentBlockDelta") + + if content_block_delta: + delta = content_block_delta.get("delta", {}) + text = delta.get("text", "") + + if text: + chunk = ModelResponse( + id=f"chatcmpl-{uuid.uuid4()}", + created=0, + model=model, + object="chat.completion.chunk", + ) + chunk.choices = [ + StreamingChoices( + finish_reason=None, + index=0, + delta=Delta(content=text, role="assistant"), + ) + ] + yield chunk + + # Process metadata/usage + metadata = event_payload.get("metadata") + if metadata and "usage" in metadata: + chunk = ModelResponse( + id=f"chatcmpl-{uuid.uuid4()}", + created=0, + model=model, + object="chat.completion.chunk", + ) + chunk.choices = [ + StreamingChoices( + finish_reason="stop", + index=0, + delta=Delta(), + ) + ] + usage_data: AgentCoreUsage = metadata["usage"] # type: ignore + setattr(chunk, "usage", Usage( + prompt_tokens=usage_data.get("inputTokens", 0), + completion_tokens=usage_data.get("outputTokens", 0), + total_tokens=usage_data.get("totalTokens", 0), + )) + yield chunk + + # Process final message + if "message" in data_obj and isinstance(data_obj["message"], dict): + chunk = ModelResponse( + id=f"chatcmpl-{uuid.uuid4()}", + created=0, + model=model, + object="chat.completion.chunk", + ) + chunk.choices = [ + StreamingChoices( + finish_reason="stop", + index=0, + delta=Delta(), + ) + ] + yield chunk + + except json.JSONDecodeError: + verbose_logger.debug(f"Skipping non-JSON SSE line: {line[:100]}") + continue async def get_async_custom_stream_wrapper( self, @@ -531,17 +703,14 @@ class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): client: Optional["AsyncHTTPHandler"] = None, json_mode: Optional[bool] = None, signed_json_body: Optional[bytes] = None, - ) -> CustomStreamWrapper: + ) -> "CustomStreamWrapper": """ - Get a CustomStreamWrapper for asynchronous streaming. - - This is called when stream=True is passed to acompletion(). + Simplified async streaming - returns an async generator that yields ModelResponse chunks. """ from litellm.llms.custom_httpx.http_handler import ( AsyncHTTPHandler, get_async_httpx_client, ) - from litellm.utils import CustomStreamWrapper if client is None or not isinstance(client, AsyncHTTPHandler): client = get_async_httpx_client( @@ -555,7 +724,7 @@ class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): api_base, headers=headers, data=signed_json_body if signed_json_body else json.dumps(data), - stream=True, # THIS IS KEY - tells httpx to not buffer + stream=True, logging_obj=logging_obj, ) @@ -564,18 +733,6 @@ class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): status_code=response.status_code, message=str(await response.aread()) ) - # Create iterator for SSE stream - completion_stream = self.get_streaming_response( - model=model, raw_response=response - ) - - streaming_response = CustomStreamWrapper( - completion_stream=completion_stream, - model=model, - custom_llm_provider=custom_llm_provider, - logging_obj=logging_obj, - ) - # LOGGING logging_obj.post_call( input=messages, @@ -584,7 +741,13 @@ class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): additional_args={"complete_input_dict": data}, ) - return streaming_response + # Wrap the async generator in CustomStreamWrapper + return CustomStreamWrapper( + completion_stream=self._stream_agentcore_response(response, model), + model=model, + custom_llm_provider="bedrock", + logging_obj=logging_obj, + ) @property def has_custom_stream_wrapper(self) -> bool: @@ -692,4 +855,5 @@ class AmazonAgentCoreConfig(BaseConfig, BaseAWSLLM): stream: Optional[bool], custom_llm_provider: Optional[str] = None, ) -> bool: - return True + # AgentCore supports true streaming - don't buffer + return False diff --git a/litellm/llms/bedrock/chat/invoke_handler.py b/litellm/llms/bedrock/chat/invoke_handler.py index ea612da52c..032283a2d2 100644 --- a/litellm/llms/bedrock/chat/invoke_handler.py +++ b/litellm/llms/bedrock/chat/invoke_handler.py @@ -751,8 +751,6 @@ class BedrockLLM(BaseAWSLLM): client: Optional[Union[AsyncHTTPHandler, HTTPHandler]] = None, ) -> Union[ModelResponse, CustomStreamWrapper]: try: - from botocore.auth import SigV4Auth - from botocore.awsrequest import AWSRequest from botocore.credentials import Credentials except ImportError: raise ImportError("Missing boto3 to call bedrock. Run 'pip install boto3'.") @@ -830,8 +828,6 @@ class BedrockLLM(BaseAWSLLM): endpoint_url = f"{endpoint_url}/model/{modelId}/invoke" proxy_endpoint_url = f"{proxy_endpoint_url}/model/{modelId}/invoke" - sigv4 = SigV4Auth(credentials, "bedrock", aws_region_name) - prompt, chat_history = self.convert_messages_to_prompt( model, messages, provider, custom_prompt_dict ) @@ -992,15 +988,14 @@ class BedrockLLM(BaseAWSLLM): headers = {"Content-Type": "application/json"} if extra_headers is not None: headers = {"Content-Type": "application/json", **extra_headers} - request = AWSRequest( - method="POST", url=endpoint_url, data=data, headers=headers + prepped = self.get_request_headers( + credentials=credentials, + aws_region_name=aws_region_name, + extra_headers=extra_headers, + endpoint_url=endpoint_url, + data=data, + headers=headers, ) - sigv4.add_auth(request) - if ( - extra_headers is not None and "Authorization" in extra_headers - ): # prevent sigv4 from overwriting the auth header - request.headers["Authorization"] = extra_headers["Authorization"] - prepped = request.prepare() ## LOGGING logging_obj.pre_call( @@ -1555,6 +1550,7 @@ class AWSEventStreamDecoder: ) ], id=self.response_id, + model=self.model, usage=usage, provider_specific_fields=model_response_provider_specific_fields, ) diff --git a/litellm/llms/bedrock/common_utils.py b/litellm/llms/bedrock/common_utils.py index f4b5de8f7c..bdcc8ab8c2 100644 --- a/litellm/llms/bedrock/common_utils.py +++ b/litellm/llms/bedrock/common_utils.py @@ -425,6 +425,15 @@ def strip_bedrock_routing_prefix(model: str) -> str: return model +def strip_bedrock_throughput_suffix(model: str) -> str: + """ Strip throughput tier suffixes from Bedrock model names. """ + import re + + # Pattern matches model:version:throughput where throughput is like 51k, 18k, etc. + # Keep the model:version part, strip the :throughput suffix + return re.sub(r"(:\d+):\d+k$", r"\1", model) + + def get_bedrock_base_model(model: str) -> str: """ Get the base model from the given model name. @@ -432,9 +441,11 @@ def get_bedrock_base_model(model: str) -> str: Handle model names like: - "us.meta.llama3-2-11b-instruct-v1:0" -> "meta.llama3-2-11b-instruct-v1" - "bedrock/converse/model" -> "model" + - "anthropic.claude-3-5-sonnet-20241022-v2:0:51k" -> "anthropic.claude-3-5-sonnet-20241022-v2:0" """ model = strip_bedrock_routing_prefix(model) model = extract_model_name_from_bedrock_arn(model) + model = strip_bedrock_throughput_suffix(model) potential_region = model.split(".", 1)[0] alt_potential_region = model.split("/", 1)[0] diff --git a/litellm/llms/bedrock/count_tokens/bedrock_token_counter.py b/litellm/llms/bedrock/count_tokens/bedrock_token_counter.py index b680bd046e..54f8a8dbd6 100644 --- a/litellm/llms/bedrock/count_tokens/bedrock_token_counter.py +++ b/litellm/llms/bedrock/count_tokens/bedrock_token_counter.py @@ -6,7 +6,7 @@ from typing import Any, Dict, List, Optional from litellm._logging import verbose_logger from litellm.llms.base_llm.base_utils import BaseTokenCounter -from litellm.llms.bedrock.common_utils import get_bedrock_base_model +from litellm.llms.bedrock.common_utils import BedrockError, get_bedrock_base_model from litellm.llms.bedrock.count_tokens.handler import BedrockCountTokensHandler from litellm.types.utils import LlmProviders, TokenCountResponse @@ -79,9 +79,31 @@ class BedrockTokenCounter(BaseTokenCounter): tokenizer_type="bedrock_api", original_response=result, ) + except BedrockError as e: + verbose_logger.warning( + f"Bedrock CountTokens API error: status={e.status_code}, message={e.message}" + ) + return TokenCountResponse( + total_tokens=0, + request_model=request_model, + model_used=model_to_use, + tokenizer_type="bedrock_api", + error=True, + error_message=e.message, + status_code=e.status_code, + ) except Exception as e: verbose_logger.warning( - f"Error calling Bedrock CountTokens API: {e}, falling back to default tokenizer" + f"Error calling Bedrock CountTokens API: {e}" + ) + return TokenCountResponse( + total_tokens=0, + request_model=request_model, + model_used=model_to_use, + tokenizer_type="bedrock_api", + error=True, + error_message=str(e), + status_code=500, ) return None diff --git a/litellm/llms/bedrock/count_tokens/handler.py b/litellm/llms/bedrock/count_tokens/handler.py index e8366165b6..9d2be6cca8 100644 --- a/litellm/llms/bedrock/count_tokens/handler.py +++ b/litellm/llms/bedrock/count_tokens/handler.py @@ -6,6 +6,8 @@ Simplified handler leveraging existing LiteLLM Bedrock infrastructure. from typing import Any, Dict +import httpx + import litellm from litellm._logging import verbose_logger from litellm.llms.bedrock.common_utils import BedrockError @@ -98,7 +100,7 @@ class BedrockCountTokensHandler(BedrockCountTokensConfig): verbose_logger.error(f"AWS Bedrock error: {error_text}") raise BedrockError( status_code=response.status_code, - message=f"AWS Bedrock error: {error_text}", + message=error_text, ) bedrock_response = response.json() @@ -117,6 +119,13 @@ class BedrockCountTokensHandler(BedrockCountTokensConfig): except BedrockError: # Re-raise Bedrock exceptions as-is raise + except httpx.HTTPStatusError as e: + # HTTP errors - preserve the actual status code + verbose_logger.error(f"HTTP error in CountTokens handler: {str(e)}") + raise BedrockError( + status_code=e.response.status_code, + message=e.response.text, + ) except Exception as e: verbose_logger.error(f"Error in CountTokens handler: {str(e)}") raise BedrockError( diff --git a/litellm/llms/bedrock/image_edit/handler.py b/litellm/llms/bedrock/image_edit/handler.py index b4b6c8d762..0f1dcff629 100644 --- a/litellm/llms/bedrock/image_edit/handler.py +++ b/litellm/llms/bedrock/image_edit/handler.py @@ -261,7 +261,7 @@ class BedrockImageEdit(BaseAWSLLM): """ config_class = self.get_config_class(model=model) config_instance = config_class() - request_body = config_instance.transform_image_edit_request( + request_body, _ = config_instance.transform_image_edit_request( model=model, prompt=prompt, image=image[0] if image else None, diff --git a/litellm/llms/bedrock/image_edit/stability_transformation.py b/litellm/llms/bedrock/image_edit/stability_transformation.py index bcaf0923f6..e8b7781298 100644 --- a/litellm/llms/bedrock/image_edit/stability_transformation.py +++ b/litellm/llms/bedrock/image_edit/stability_transformation.py @@ -21,18 +21,18 @@ Supported models: API Reference: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html """ -import json import base64 +import json from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple import httpx from litellm.llms.base_llm.image_edit.transformation import BaseImageEditConfig from litellm.types.images.main import ImageEditOptionalRequestParams -from litellm.types.router import GenericLiteLLMParams from litellm.types.llms.stability import ( OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO, ) +from litellm.types.router import GenericLiteLLMParams from litellm.types.utils import FileTypes, ImageObject, ImageResponse from litellm.utils import get_model_info @@ -153,7 +153,7 @@ class BedrockStabilityImageEditConfig(BaseImageEditConfig): def transform_image_edit_request( self, model: str, - prompt: str, + prompt: Optional[str], image: FileTypes, image_edit_optional_request_params: Dict, litellm_params: GenericLiteLLMParams, @@ -164,6 +164,9 @@ class BedrockStabilityImageEditConfig(BaseImageEditConfig): Returns the request body dict that will be JSON-encoded by the handler. """ + if prompt is None: + raise ValueError("Bedrock Stability image edit requires a prompt.") + # Build Bedrock Stability request data: Dict[str, Any] = { "prompt": prompt, diff --git a/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py b/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py index 81225159a7..fa5002fcad 100644 --- a/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py +++ b/litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py @@ -129,6 +129,37 @@ class AmazonAnthropicClaudeMessagesConfig( if isinstance(cache_control, dict) and "ttl" in cache_control: cache_control.pop("ttl", None) + def _get_tool_search_beta_header_for_bedrock( + self, + model: str, + tool_search_used: bool, + programmatic_tool_calling_used: bool, + input_examples_used: bool, + beta_set: set, + ) -> None: + """ + Adjust tool search beta header for Bedrock. + + Bedrock requires a different beta header for tool search on Opus 4 models + when tool search is used without programmatic tool calling or input examples. + + Note: On Amazon Bedrock, server-side tool search is only supported on Claude Opus 4 + with the `tool-search-tool-2025-10-19` beta header. + + Ref: https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool + + Args: + model: The model name + tool_search_used: Whether tool search is used + programmatic_tool_calling_used: Whether programmatic tool calling is used + input_examples_used: Whether input examples are used + beta_set: The set of beta headers to modify in-place + """ + if tool_search_used and not (programmatic_tool_calling_used or input_examples_used): + beta_set.discard(ANTHROPIC_TOOL_SEARCH_BETA_HEADER) + if "opus-4" in model.lower() or "opus_4" in model.lower(): + beta_set.add("tool-search-tool-2025-10-19") + def transform_anthropic_messages_request( self, model: str, @@ -189,13 +220,13 @@ class AmazonAnthropicClaudeMessagesConfig( ) beta_set.update(auto_betas) - if ( - tool_search_used - and not (programmatic_tool_calling_used or input_examples_used) - ): - beta_set.discard(ANTHROPIC_TOOL_SEARCH_BETA_HEADER) - if "opus-4" in model.lower() or "opus_4" in model.lower(): - beta_set.add("tool-search-tool-2025-10-19") + self._get_tool_search_beta_header_for_bedrock( + model=model, + tool_search_used=tool_search_used, + programmatic_tool_calling_used=programmatic_tool_calling_used, + input_examples_used=input_examples_used, + beta_set=beta_set, + ) if beta_set: anthropic_messages_request["anthropic_beta"] = list(beta_set) diff --git a/litellm/llms/bedrock/passthrough/transformation.py b/litellm/llms/bedrock/passthrough/transformation.py index 71c418757b..5efd3ba1d9 100644 --- a/litellm/llms/bedrock/passthrough/transformation.py +++ b/litellm/llms/bedrock/passthrough/transformation.py @@ -236,6 +236,7 @@ class BedrockPassthroughConfig( if len(all_translated_chunks) > 0: model_response = stream_chunk_builder( chunks=all_translated_chunks, + logging_obj=litellm_logging_obj, ) return model_response return None diff --git a/litellm/llms/chatgpt/authenticator.py b/litellm/llms/chatgpt/authenticator.py new file mode 100644 index 0000000000..ff053730c3 --- /dev/null +++ b/litellm/llms/chatgpt/authenticator.py @@ -0,0 +1,388 @@ +import base64 +import json +import os +import time +from typing import Any, Dict, Optional + +import httpx + +from litellm._logging import verbose_logger +from litellm.llms.custom_httpx.http_handler import _get_httpx_client + +from .common_utils import ( + CHATGPT_API_BASE, + CHATGPT_AUTH_BASE, + CHATGPT_CLIENT_ID, + CHATGPT_DEVICE_CODE_URL, + CHATGPT_DEVICE_TOKEN_URL, + CHATGPT_DEVICE_VERIFY_URL, + CHATGPT_OAUTH_TOKEN_URL, + GetAccessTokenError, + GetDeviceCodeError, + RefreshAccessTokenError, +) + +TOKEN_EXPIRY_SKEW_SECONDS = 60 +DEVICE_CODE_TIMEOUT_SECONDS = 15 * 60 +DEVICE_CODE_COOLDOWN_SECONDS = 5 * 60 +DEVICE_CODE_POLL_SLEEP_SECONDS = 5 + + +class Authenticator: + def __init__(self) -> None: + self.token_dir = os.getenv( + "CHATGPT_TOKEN_DIR", + os.path.expanduser("~/.config/litellm/chatgpt"), + ) + self.auth_file = os.path.join( + self.token_dir, os.getenv("CHATGPT_AUTH_FILE", "auth.json") + ) + self._ensure_token_dir() + + def get_api_base(self) -> str: + return ( + os.getenv("CHATGPT_API_BASE") + or os.getenv("OPENAI_CHATGPT_API_BASE") + or CHATGPT_API_BASE + ) + + def get_access_token(self) -> str: + auth_data = self._read_auth_file() + if auth_data: + access_token = auth_data.get("access_token") + if access_token and not self._is_token_expired(auth_data, access_token): + return access_token + refresh_token = auth_data.get("refresh_token") + if refresh_token: + try: + refreshed = self._refresh_tokens(refresh_token) + return refreshed["access_token"] + except RefreshAccessTokenError as exc: + verbose_logger.warning( + "ChatGPT refresh token failed, re-login required: %s", exc + ) + + cooldown_remaining = self._get_device_code_cooldown_remaining(auth_data) + if cooldown_remaining > 0: + token = self._wait_for_access_token(cooldown_remaining) + if token: + return token + + tokens = self._login_device_code() + return tokens["access_token"] + + def get_account_id(self) -> Optional[str]: + auth_data = self._read_auth_file() + if not auth_data: + return None + account_id = auth_data.get("account_id") + if account_id: + return account_id + id_token = auth_data.get("id_token") + access_token = auth_data.get("access_token") + derived = self._extract_account_id(id_token or access_token) + if derived: + auth_data["account_id"] = derived + self._write_auth_file(auth_data) + return derived + + def _ensure_token_dir(self) -> None: + if not os.path.exists(self.token_dir): + os.makedirs(self.token_dir, exist_ok=True) + + def _read_auth_file(self) -> Optional[Dict[str, Any]]: + try: + with open(self.auth_file, "r") as f: + return json.load(f) + except IOError: + return None + except json.JSONDecodeError as exc: + verbose_logger.warning("Invalid ChatGPT auth file: %s", exc) + return None + + def _write_auth_file(self, data: Dict[str, Any]) -> None: + try: + with open(self.auth_file, "w") as f: + json.dump(data, f) + except IOError as exc: + verbose_logger.error("Failed to write ChatGPT auth file: %s", exc) + + def _is_token_expired(self, auth_data: Dict[str, Any], access_token: str) -> bool: + expires_at = auth_data.get("expires_at") + if expires_at is None: + expires_at = self._get_expires_at(access_token) + if expires_at: + auth_data["expires_at"] = expires_at + self._write_auth_file(auth_data) + if expires_at is None: + return True + return time.time() >= float(expires_at) - TOKEN_EXPIRY_SKEW_SECONDS + + def _get_expires_at(self, token: str) -> Optional[int]: + claims = self._decode_jwt_claims(token) + exp = claims.get("exp") + if isinstance(exp, (int, float)): + return int(exp) + return None + + def _decode_jwt_claims(self, token: str) -> Dict[str, Any]: + try: + parts = token.split(".") + if len(parts) < 2: + return {} + payload_b64 = parts[1] + payload_b64 += "=" * (-len(payload_b64) % 4) + payload_bytes = base64.urlsafe_b64decode(payload_b64) + return json.loads(payload_bytes.decode("utf-8")) + except Exception: + return {} + + def _extract_account_id(self, token: Optional[str]) -> Optional[str]: + if not token: + return None + claims = self._decode_jwt_claims(token) + auth_claims = claims.get("https://api.openai.com/auth") + if isinstance(auth_claims, dict): + account_id = auth_claims.get("chatgpt_account_id") + if isinstance(account_id, str) and account_id: + return account_id + return None + + def _login_device_code(self) -> Dict[str, str]: + cooldown_remaining = self._get_device_code_cooldown_remaining( + self._read_auth_file() + ) + if cooldown_remaining > 0: + token = self._wait_for_access_token(cooldown_remaining) + if token: + return {"access_token": token} + + device_code = self._request_device_code() + self._record_device_code_request() + print( # noqa: T201 + "Sign in with ChatGPT using device code:\n" + f"1) Visit {CHATGPT_DEVICE_VERIFY_URL}\n" + f"2) Enter code: {device_code['user_code']}\n" + "Device codes are a common phishing target. Never share this code.", + flush=True, + ) + auth_code = self._poll_for_authorization_code(device_code) + tokens = self._exchange_code_for_tokens(auth_code) + auth_data = self._build_auth_record(tokens) + self._write_auth_file(auth_data) + return tokens + + def _request_device_code(self) -> Dict[str, str]: + try: + client = _get_httpx_client() + resp = client.post( + CHATGPT_DEVICE_CODE_URL, + json={"client_id": CHATGPT_CLIENT_ID}, + ) + resp.raise_for_status() + data = resp.json() + except httpx.HTTPStatusError as exc: + raise GetDeviceCodeError( + message=f"Failed to request device code: {exc}", + status_code=exc.response.status_code, + ) + except Exception as exc: + raise GetDeviceCodeError( + message=f"Failed to request device code: {exc}", + status_code=400, + ) + + device_auth_id = data.get("device_auth_id") + user_code = data.get("user_code") or data.get("usercode") + interval = data.get("interval") + if not device_auth_id or not user_code: + raise GetDeviceCodeError( + message=f"Device code response missing fields: {data}", + status_code=400, + ) + return { + "device_auth_id": device_auth_id, + "user_code": user_code, + "interval": str(interval or "5"), + } + + def _poll_for_authorization_code(self, device_code: Dict[str, str]) -> Dict[str, str]: + client = _get_httpx_client() + interval = int(device_code.get("interval", "5")) + start_time = time.time() + while time.time() - start_time < DEVICE_CODE_TIMEOUT_SECONDS: + try: + resp = client.post( + CHATGPT_DEVICE_TOKEN_URL, + json={ + "device_auth_id": device_code["device_auth_id"], + "user_code": device_code["user_code"], + }, + ) + if resp.status_code == 200: + data = resp.json() + if all( + key in data + for key in ( + "authorization_code", + "code_challenge", + "code_verifier", + ) + ): + return data + if resp.status_code in (403, 404): + time.sleep(max(interval, DEVICE_CODE_POLL_SLEEP_SECONDS)) + continue + resp.raise_for_status() + except httpx.HTTPStatusError as exc: + status_code = exc.response.status_code if exc.response else None + if status_code in (403, 404): + time.sleep(max(interval, DEVICE_CODE_POLL_SLEEP_SECONDS)) + continue + raise GetAccessTokenError( + message=f"Polling failed: {exc}", + status_code=exc.response.status_code, + ) + except Exception as exc: + raise GetAccessTokenError( + message=f"Polling failed: {exc}", + status_code=400, + ) + time.sleep(max(interval, DEVICE_CODE_POLL_SLEEP_SECONDS)) + + raise GetAccessTokenError( + message="Timed out waiting for device authorization", + status_code=408, + ) + + def _exchange_code_for_tokens(self, code_data: Dict[str, str]) -> Dict[str, str]: + try: + client = _get_httpx_client() + redirect_uri = f"{CHATGPT_AUTH_BASE}/deviceauth/callback" + body = ( + "grant_type=authorization_code" + f"&code={code_data['authorization_code']}" + f"&redirect_uri={redirect_uri}" + f"&client_id={CHATGPT_CLIENT_ID}" + f"&code_verifier={code_data['code_verifier']}" + ) + resp = client.post( + CHATGPT_OAUTH_TOKEN_URL, + headers={"Content-Type": "application/x-www-form-urlencoded"}, + content=body, + ) + resp.raise_for_status() + data = resp.json() + except httpx.HTTPStatusError as exc: + raise GetAccessTokenError( + message=f"Token exchange failed: {exc}", + status_code=exc.response.status_code, + ) + except Exception as exc: + raise GetAccessTokenError( + message=f"Token exchange failed: {exc}", + status_code=400, + ) + + if not all(key in data for key in ("access_token", "refresh_token", "id_token")): + raise GetAccessTokenError( + message=f"Token exchange response missing fields: {data}", + status_code=400, + ) + return { + "access_token": data["access_token"], + "refresh_token": data["refresh_token"], + "id_token": data["id_token"], + } + + def _refresh_tokens(self, refresh_token: str) -> Dict[str, str]: + try: + client = _get_httpx_client() + resp = client.post( + CHATGPT_OAUTH_TOKEN_URL, + json={ + "client_id": CHATGPT_CLIENT_ID, + "grant_type": "refresh_token", + "refresh_token": refresh_token, + "scope": "openid profile email", + }, + ) + resp.raise_for_status() + data = resp.json() + except httpx.HTTPStatusError as exc: + raise RefreshAccessTokenError( + message=f"Refresh token failed: {exc}", + status_code=exc.response.status_code, + ) + except Exception as exc: + raise RefreshAccessTokenError( + message=f"Refresh token failed: {exc}", + status_code=400, + ) + + access_token = data.get("access_token") + id_token = data.get("id_token") + if not access_token or not id_token: + raise RefreshAccessTokenError( + message=f"Refresh response missing fields: {data}", + status_code=400, + ) + + refreshed = { + "access_token": access_token, + "refresh_token": data.get("refresh_token", refresh_token), + "id_token": id_token, + } + auth_data = self._build_auth_record(refreshed) + self._write_auth_file(auth_data) + return refreshed + + def _build_auth_record(self, tokens: Dict[str, str]) -> Dict[str, Any]: + access_token = tokens.get("access_token") + id_token = tokens.get("id_token") + expires_at = self._get_expires_at(access_token) if access_token else None + account_id = self._extract_account_id(id_token or access_token) + return { + "access_token": access_token, + "refresh_token": tokens.get("refresh_token"), + "id_token": id_token, + "expires_at": expires_at, + "account_id": account_id, + } + + def _get_device_code_cooldown_remaining( + self, auth_data: Optional[Dict[str, Any]] + ) -> float: + if not auth_data: + return 0.0 + requested_at = auth_data.get("device_code_requested_at") + if not isinstance(requested_at, (int, float, str)): + return 0.0 + try: + requested_at = float(requested_at) + except (TypeError, ValueError): + return 0.0 + elapsed = time.time() - requested_at + remaining = DEVICE_CODE_COOLDOWN_SECONDS - elapsed + return max(0.0, remaining) + + def _record_device_code_request(self) -> None: + auth_data = self._read_auth_file() or {} + auth_data["device_code_requested_at"] = time.time() + self._write_auth_file(auth_data) + + def _wait_for_access_token(self, timeout_seconds: float) -> Optional[str]: + deadline = time.time() + timeout_seconds + while time.time() < deadline: + auth_data = self._read_auth_file() + if auth_data: + access_token = auth_data.get("access_token") + if access_token and not self._is_token_expired( + auth_data, access_token + ): + return access_token + sleep_for = min(DEVICE_CODE_POLL_SLEEP_SECONDS, max(0.0, deadline - time.time())) + if sleep_for <= 0: + break + time.sleep(sleep_for) + return None diff --git a/litellm/llms/chatgpt/chat/transformation.py b/litellm/llms/chatgpt/chat/transformation.py new file mode 100644 index 0000000000..2db5eb3c58 --- /dev/null +++ b/litellm/llms/chatgpt/chat/transformation.py @@ -0,0 +1,75 @@ +from typing import List, Optional, Tuple + +from litellm.exceptions import AuthenticationError +from litellm.llms.openai.openai import OpenAIConfig +from litellm.types.llms.openai import AllMessageValues + +from ..authenticator import Authenticator +from ..common_utils import ( + GetAccessTokenError, + ensure_chatgpt_session_id, + get_chatgpt_default_headers, +) + + +class ChatGPTConfig(OpenAIConfig): + def __init__( + self, + api_key: Optional[str] = None, + api_base: Optional[str] = None, + custom_llm_provider: str = "openai", + ) -> None: + super().__init__() + self.authenticator = Authenticator() + + def _get_openai_compatible_provider_info( + self, + model: str, + api_base: Optional[str], + api_key: Optional[str], + custom_llm_provider: str, + ) -> Tuple[Optional[str], Optional[str], str]: + dynamic_api_base = self.authenticator.get_api_base() + try: + dynamic_api_key = self.authenticator.get_access_token() + except GetAccessTokenError as e: + raise AuthenticationError( + model=model, + llm_provider=custom_llm_provider, + message=str(e), + ) + return dynamic_api_base, dynamic_api_key, custom_llm_provider + + def validate_environment( + self, + headers: dict, + model: str, + messages: List[AllMessageValues], + optional_params: dict, + litellm_params: dict, + api_key: Optional[str] = None, + api_base: Optional[str] = None, + ) -> dict: + validated_headers = super().validate_environment( + headers, model, messages, optional_params, litellm_params, api_key, api_base + ) + + account_id = self.authenticator.get_account_id() + session_id = ensure_chatgpt_session_id(litellm_params) + default_headers = get_chatgpt_default_headers( + api_key or "", account_id, session_id + ) + return {**default_headers, **validated_headers} + + def map_openai_params( + self, + non_default_params: dict, + optional_params: dict, + model: str, + drop_params: bool, + ) -> dict: + optional_params = super().map_openai_params( + non_default_params, optional_params, model, drop_params + ) + optional_params.setdefault("stream", False) + return optional_params diff --git a/litellm/llms/chatgpt/common_utils.py b/litellm/llms/chatgpt/common_utils.py new file mode 100644 index 0000000000..d80487cde2 --- /dev/null +++ b/litellm/llms/chatgpt/common_utils.py @@ -0,0 +1,301 @@ +""" +Constants and helpers for ChatGPT subscription OAuth. +""" +import os +import platform +from typing import Any, Optional, Union +from uuid import uuid4 + +import httpx + +from litellm.llms.base_llm.chat.transformation import BaseLLMException + +# OAuth + API constants (derived from openai/codex) +CHATGPT_AUTH_BASE = "https://auth.openai.com" +CHATGPT_DEVICE_CODE_URL = f"{CHATGPT_AUTH_BASE}/api/accounts/deviceauth/usercode" +CHATGPT_DEVICE_TOKEN_URL = f"{CHATGPT_AUTH_BASE}/api/accounts/deviceauth/token" +CHATGPT_OAUTH_TOKEN_URL = f"{CHATGPT_AUTH_BASE}/oauth/token" +CHATGPT_DEVICE_VERIFY_URL = f"{CHATGPT_AUTH_BASE}/codex/device" +CHATGPT_API_BASE = "https://chatgpt.com/backend-api/codex" +CHATGPT_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann" + +DEFAULT_ORIGINATOR = "codex_cli_rs" +DEFAULT_USER_AGENT = "codex_cli_rs/0.0.0 (Unknown 0; unknown) unknown" +CHATGPT_DEFAULT_INSTRUCTIONS = """You are Codex, based on GPT-5. You are running as a coding agent in the Codex CLI on a user's computer. + +## General + +- When searching for text or files, prefer using `rg` or `rg --files` respectively because `rg` is much faster than alternatives like `grep`. (If the `rg` command is not found, then use alternatives.) + +## Editing constraints + +- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them. +- Add succinct code comments that explain what is going on if code is not self-explanatory. You should not add comments like "Assigns the value to the variable", but a brief comment might be useful ahead of a complex code block that the user would otherwise have to spend time parsing out. Usage of these comments should be rare. +- Try to use apply_patch for single file edits, but it is fine to explore other options to make the edit if it does not work well. Do not use apply_patch for changes that are auto-generated (i.e. generating package.json or running a lint or format command like gofmt) or when scripting is more efficient (such as search and replacing a string across a codebase). +- You may be in a dirty git worktree. + * NEVER revert existing changes you did not make unless explicitly requested, since these changes were made by the user. + * If asked to make a commit or code edits and there are unrelated changes to your work or changes that you didn't make in those files, don't revert those changes. + * If the changes are in files you've touched recently, you should read carefully and understand how you can work with the changes rather than reverting them. + * If the changes are in unrelated files, just ignore them and don't revert them. +- Do not amend a commit unless explicitly requested to do so. +- While you are working, you might notice unexpected changes that you didn't make. If this happens, STOP IMMEDIATELY and ask the user how they would like to proceed. +- **NEVER** use destructive commands like `git reset --hard` or `git checkout --` unless specifically requested or approved by the user. + +## Plan tool + +When using the planning tool: +- Skip using the planning tool for straightforward tasks (roughly the easiest 25%). +- Do not make single-step plans. +- When you made a plan, update it after having performed one of the sub-tasks that you shared on the plan. + +## Special user requests + +- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as `date`), you should do so. +- If the user asks for a "review", default to a code review mindset: prioritise identifying bugs, risks, behavioural regressions, and missing tests. Findings must be the primary focus of the response - keep summaries or overviews brief and only after enumerating the issues. Present findings first (ordered by severity with file/line references), follow with open questions or assumptions, and offer a change-summary only as a secondary detail. If no findings are discovered, state that explicitly and mention any residual risks or testing gaps. + +## Frontend tasks +When doing frontend design tasks, avoid collapsing into "AI slop" or safe, average-looking layouts. +Aim for interfaces that feel intentional, bold, and a bit surprising. +- Typography: Use expressive, purposeful fonts and avoid default stacks (Inter, Roboto, Arial, system). +- Color & Look: Choose a clear visual direction; define CSS variables; avoid purple-on-white defaults. No purple bias or dark mode bias. +- Motion: Use a few meaningful animations (page-load, staggered reveals) instead of generic micro-motions. +- Background: Don't rely on flat, single-color backgrounds; use gradients, shapes, or subtle patterns to build atmosphere. +- Overall: Avoid boilerplate layouts and interchangeable UI patterns. Vary themes, type families, and visual languages across outputs. +- Ensure the page loads properly on both desktop and mobile + +Exception: If working within an existing website or design system, preserve the established patterns, structure, and visual language. + +## Presenting your work and final message + +You are producing plain text that will later be styled by the CLI. Follow these rules exactly. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value. + +- Default: be very concise; friendly coding teammate tone. +- Ask only when needed; suggest ideas; mirror the user's style. +- For substantial work, summarize clearly; follow final-answer formatting. +- Skip heavy formatting for simple confirmations. +- Don't dump large files you've written; reference paths only. +- No "save/copy this file" - User is on the same machine. +- Offer logical next steps (tests, commits, build) briefly; add verify steps if you couldn't do something. +- For code changes: + * Lead with a quick explanation of the change, and then give more details on the context covering where and why a change was made. Do not start this explanation with "summary", just jump right in. + * If there are natural next steps the user may want to take, suggest them at the end of your response. Do not make suggestions if there are no natural next steps. + * When suggesting multiple options, use numeric lists for the suggestions so the user can quickly respond with a single number. +- The user does not command execution outputs. When asked to show the output of a command (e.g. `git show`), relay the important details in your answer or summarize the key lines so the user understands the result. + +### Final answer structure and style guidelines + +- Plain text; CLI handles styling. Use structure only when it helps scanability. +- Headers: optional; short Title Case (1-3 words) wrapped in **...**; no blank line before the first bullet; add only if they truly help. +- Bullets: use - ; merge related points; keep to one line when possible; 4-6 per list ordered by importance; keep phrasing consistent. +- Monospace: backticks for commands/paths/env vars/code ids and inline examples; use for literal keyword bullets; never combine with **. +- Code samples or multi-line snippets should be wrapped in fenced code blocks; include an info string as often as possible. +- Structure: group related bullets; order sections general -> specific -> supporting; for subsections, start with a bolded keyword bullet, then items; match complexity to the task. +- Tone: collaborative, concise, factual; present tense, active voice; self-contained; no "above/below"; parallel wording. +- Don'ts: no nested bullets/hierarchies; no ANSI codes; don't cram unrelated keywords; keep keyword lists short--wrap/reformat if long; avoid naming formatting styles in answers. +- Adaptation: code explanations -> precise, structured with code refs; simple tasks -> lead with outcome; big changes -> logical walkthrough + rationale + next actions; casual one-offs -> plain sentences, no headers/bullets. +- File References: When referencing files in your response follow the below rules: + * Use inline code to make file paths clickable. + * Each reference should have a stand alone path. Even if it's the same file. + * Accepted: absolute, workspace-relative, a/ or b/ diff prefixes, or bare filename/suffix. + * Optionally include line/column (1-based): :line[:column] or #Lline[Ccolumn] (column defaults to 1). + * Do not use URIs like file://, vscode://, or https://. + * Do not provide range of lines + * Examples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\\repo\\project\\main.rs:12:5 +""" + + +class ChatGPTAuthError(BaseLLMException): + def __init__( + self, + status_code, + message, + request: Optional[httpx.Request] = None, + response: Optional[httpx.Response] = None, + headers: Optional[Union[httpx.Headers, dict]] = None, + body: Optional[dict] = None, + ): + super().__init__( + status_code=status_code, + message=message, + request=request, + response=response, + headers=headers, + body=body, + ) + + +class GetDeviceCodeError(ChatGPTAuthError): + pass + + +class GetAccessTokenError(ChatGPTAuthError): + pass + + +class RefreshAccessTokenError(ChatGPTAuthError): + pass + + +def _safe_header_value(value: str) -> str: + if not value: + return "" + return "".join(ch if 32 <= ord(ch) <= 126 else "_" for ch in value) + + +def _sanitize_user_agent_token(value: str) -> str: + if not value: + return "" + return "".join( + ch if (ch.isalnum() or ch in "-_./") else "_" for ch in value + ) + + +def _terminal_user_agent() -> str: + term_program = os.getenv("TERM_PROGRAM") + if term_program: + version = os.getenv("TERM_PROGRAM_VERSION") + token = f"{term_program}/{version}" if version else term_program + return _sanitize_user_agent_token(token) or "unknown" + + wezterm_version = os.getenv("WEZTERM_VERSION") + if wezterm_version is not None: + token = ( + f"WezTerm/{wezterm_version}" if wezterm_version else "WezTerm" + ) + return _sanitize_user_agent_token(token) or "WezTerm" + + if ( + os.getenv("ITERM_SESSION_ID") + or os.getenv("ITERM_PROFILE") + or os.getenv("ITERM_PROFILE_NAME") + ): + return "iTerm.app" + + if os.getenv("TERM_SESSION_ID"): + return "Apple_Terminal" + + if os.getenv("KITTY_WINDOW_ID") or "kitty" in (os.getenv("TERM") or ""): + return "kitty" + + if os.getenv("ALACRITTY_SOCKET") or os.getenv("TERM") == "alacritty": + return "Alacritty" + + konsole_version = os.getenv("KONSOLE_VERSION") + if konsole_version is not None: + token = ( + f"Konsole/{konsole_version}" if konsole_version else "Konsole" + ) + return _sanitize_user_agent_token(token) or "Konsole" + + if os.getenv("GNOME_TERMINAL_SCREEN"): + return "gnome-terminal" + + vte_version = os.getenv("VTE_VERSION") + if vte_version is not None: + token = f"VTE/{vte_version}" if vte_version else "VTE" + return _sanitize_user_agent_token(token) or "VTE" + + if os.getenv("WT_SESSION"): + return "WindowsTerminal" + + term = os.getenv("TERM") + if term: + return _sanitize_user_agent_token(term) or "unknown" + + return "unknown" + + +def _get_litellm_version() -> str: + try: + from importlib.metadata import version + + return version("litellm") + except Exception: + return "0.0.0" + + +def get_chatgpt_originator() -> str: + originator = os.getenv("CHATGPT_ORIGINATOR") or DEFAULT_ORIGINATOR + return _safe_header_value(originator) or DEFAULT_ORIGINATOR + + +def get_chatgpt_user_agent(originator: str) -> str: + override = os.getenv("CHATGPT_USER_AGENT") + if override: + return _safe_header_value(override) or DEFAULT_USER_AGENT + version = _get_litellm_version() + os_type = platform.system() or "Unknown" + os_version = platform.release() or "0" + arch = platform.machine() or "unknown" + terminal_ua = _terminal_user_agent() + suffix = os.getenv("CHATGPT_USER_AGENT_SUFFIX", "").strip() + suffix = f" ({suffix})" if suffix else "" + candidate = ( + f"{originator}/{version} ({os_type} {os_version}; {arch}) {terminal_ua}{suffix}" + ) + return _safe_header_value(candidate) or DEFAULT_USER_AGENT + + +def get_chatgpt_default_headers( + access_token: str, + account_id: Optional[str], + session_id: Optional[str] = None, +) -> dict: + originator = get_chatgpt_originator() + user_agent = get_chatgpt_user_agent(originator) + headers = { + "Authorization": f"Bearer {access_token}", + "content-type": "application/json", + "accept": "text/event-stream", + "originator": originator, + "user-agent": user_agent, + } + if session_id: + headers["session_id"] = session_id + if account_id: + headers["ChatGPT-Account-Id"] = account_id + return headers + + +def get_chatgpt_default_instructions() -> str: + return os.getenv("CHATGPT_DEFAULT_INSTRUCTIONS") or CHATGPT_DEFAULT_INSTRUCTIONS + + +def _normalize_litellm_params(litellm_params: Optional[Any]) -> dict: + if litellm_params is None: + return {} + if isinstance(litellm_params, dict): + return litellm_params + if hasattr(litellm_params, "model_dump"): + try: + return litellm_params.model_dump() + except Exception: + return {} + if hasattr(litellm_params, "dict"): + try: + return litellm_params.dict() + except Exception: + return {} + return {} + + +def get_chatgpt_session_id(litellm_params: Optional[Any]) -> Optional[str]: + params = _normalize_litellm_params(litellm_params) + for key in ("litellm_session_id", "session_id"): + value = params.get(key) + if value: + return str(value) + metadata = params.get("metadata") + if isinstance(metadata, dict): + value = metadata.get("session_id") + if value: + return str(value) + for key in ("litellm_trace_id", "litellm_call_id"): + value = params.get(key) + if value: + return str(value) + return None + + +def ensure_chatgpt_session_id(litellm_params: Optional[Any]) -> str: + return get_chatgpt_session_id(litellm_params) or str(uuid4()) diff --git a/litellm/llms/chatgpt/responses/transformation.py b/litellm/llms/chatgpt/responses/transformation.py new file mode 100644 index 0000000000..0ce24f63a8 --- /dev/null +++ b/litellm/llms/chatgpt/responses/transformation.py @@ -0,0 +1,191 @@ +import json +from typing import Any, Optional + +from litellm.exceptions import AuthenticationError +from litellm.constants import STREAM_SSE_DONE_STRING +from litellm.litellm_core_utils.core_helpers import process_response_headers +from litellm.llms.openai.common_utils import OpenAIError +from litellm.llms.openai.responses.transformation import OpenAIResponsesAPIConfig +from litellm.litellm_core_utils.llm_response_utils.convert_dict_to_response import ( + _safe_convert_created_field, +) +from litellm.types.llms.openai import ( + ResponsesAPIResponse, + ResponsesAPIStreamEvents, +) +from litellm.types.router import GenericLiteLLMParams +from litellm.types.utils import LlmProviders +from litellm.utils import CustomStreamWrapper + +from ..authenticator import Authenticator +from ..common_utils import ( + CHATGPT_API_BASE, + GetAccessTokenError, + ensure_chatgpt_session_id, + get_chatgpt_default_headers, + get_chatgpt_default_instructions, +) + + +class ChatGPTResponsesAPIConfig(OpenAIResponsesAPIConfig): + def __init__(self) -> None: + super().__init__() + self.authenticator = Authenticator() + + @property + def custom_llm_provider(self) -> LlmProviders: + return LlmProviders.CHATGPT + + def validate_environment( + self, + headers: dict, + model: str, + litellm_params: Optional[GenericLiteLLMParams], + ) -> dict: + try: + access_token = self.authenticator.get_access_token() + except GetAccessTokenError as e: + raise AuthenticationError( + model=model, + llm_provider="chatgpt", + message=str(e), + ) + + account_id = self.authenticator.get_account_id() + session_id = ensure_chatgpt_session_id(litellm_params) + default_headers = get_chatgpt_default_headers( + access_token, account_id, session_id + ) + return {**default_headers, **headers} + + def transform_responses_api_request( + self, + model: str, + input: Any, + response_api_optional_request_params: dict, + litellm_params: GenericLiteLLMParams, + headers: dict, + ) -> dict: + request = super().transform_responses_api_request( + model, + input, + response_api_optional_request_params, + litellm_params, + headers, + ) + request.pop("max_output_tokens", None) + request.pop("max_tokens", None) + request.pop("max_completion_tokens", None) + request.pop("metadata", None) + base_instructions = get_chatgpt_default_instructions() + existing_instructions = request.get("instructions") + if existing_instructions: + if base_instructions not in existing_instructions: + request["instructions"] = ( + f"{base_instructions}\n\n{existing_instructions}" + ) + else: + request["instructions"] = base_instructions + request["store"] = False + request["stream"] = True + include = list(request.get("include") or []) + if "reasoning.encrypted_content" not in include: + include.append("reasoning.encrypted_content") + request["include"] = include + return request + + def transform_response_api_response( + self, + model: str, + raw_response: Any, + logging_obj: Any, + ): + content_type = (raw_response.headers or {}).get("content-type", "") + body_text = raw_response.text or "" + if "text/event-stream" not in content_type.lower(): + trimmed_body = body_text.lstrip() + if not ( + trimmed_body.startswith("event:") + or trimmed_body.startswith("data:") + or "\nevent:" in body_text + or "\ndata:" in body_text + ): + return super().transform_response_api_response( + model=model, + raw_response=raw_response, + logging_obj=logging_obj, + ) + + logging_obj.post_call( + original_response=raw_response.text, + additional_args={"complete_input_dict": {}}, + ) + + completed_response = None + error_message = None + for chunk in body_text.splitlines(): + stripped_chunk = CustomStreamWrapper._strip_sse_data_from_chunk(chunk) + if not stripped_chunk: + continue + stripped_chunk = stripped_chunk.strip() + if not stripped_chunk: + continue + if stripped_chunk == STREAM_SSE_DONE_STRING: + break + try: + parsed_chunk = json.loads(stripped_chunk) + except json.JSONDecodeError: + continue + if not isinstance(parsed_chunk, dict): + continue + event_type = parsed_chunk.get("type") + if event_type == ResponsesAPIStreamEvents.RESPONSE_COMPLETED: + response_payload = parsed_chunk.get("response") + if isinstance(response_payload, dict): + response_payload = dict(response_payload) + if "created_at" in response_payload: + response_payload["created_at"] = _safe_convert_created_field( + response_payload["created_at"] + ) + try: + completed_response = ResponsesAPIResponse(**response_payload) + except Exception: + completed_response = ResponsesAPIResponse.model_construct( + **response_payload + ) + break + if event_type in ( + ResponsesAPIStreamEvents.RESPONSE_FAILED, + ResponsesAPIStreamEvents.ERROR, + ): + error_obj = parsed_chunk.get("error") or ( + parsed_chunk.get("response") or {} + ).get("error") + if error_obj is not None: + if isinstance(error_obj, dict): + error_message = error_obj.get("message") or str(error_obj) + else: + error_message = str(error_obj) + + if completed_response is None: + raise OpenAIError( + message=error_message or raw_response.text, + status_code=raw_response.status_code, + ) + + raw_headers = dict(raw_response.headers) + processed_headers = process_response_headers(raw_headers) + if not hasattr(completed_response, "_hidden_params"): + setattr(completed_response, "_hidden_params", {}) + completed_response._hidden_params["additional_headers"] = processed_headers + completed_response._hidden_params["headers"] = raw_headers + return completed_response + + def get_complete_url( + self, + api_base: Optional[str], + litellm_params: dict, + ) -> str: + api_base = api_base or self.authenticator.get_api_base() or CHATGPT_API_BASE + api_base = api_base.rstrip("/") + return f"{api_base}/responses" diff --git a/litellm/llms/custom_httpx/aiohttp_transport.py b/litellm/llms/custom_httpx/aiohttp_transport.py index f845bf7cb9..a7b83d8c80 100644 --- a/litellm/llms/custom_httpx/aiohttp_transport.py +++ b/litellm/llms/custom_httpx/aiohttp_transport.py @@ -245,7 +245,6 @@ class LiteLLMAiohttpTransport(AiohttpTransport): allow_redirects=False, auto_decompress=False, timeout=ClientTimeout( - total=timeout.get("read"), sock_connect=timeout.get("connect"), sock_read=timeout.get("read"), connect=timeout.get("pool"), diff --git a/litellm/llms/custom_httpx/llm_http_handler.py b/litellm/llms/custom_httpx/llm_http_handler.py index 1da6e61252..ab1e735fca 100644 --- a/litellm/llms/custom_httpx/llm_http_handler.py +++ b/litellm/llms/custom_httpx/llm_http_handler.py @@ -1929,6 +1929,7 @@ class BaseLLMHTTPHandler: # used for logging + cost tracking logging_obj.model_call_details["httpx_response"] = response + initial_response: Union[AsyncIterator, AnthropicMessagesResponse] if stream: completion_stream = anthropic_messages_provider_config.get_async_streaming_response_iterator( model=model, @@ -1936,14 +1937,29 @@ class BaseLLMHTTPHandler: request_body=request_body, litellm_logging_obj=logging_obj, ) - return completion_stream + initial_response = completion_stream else: - return anthropic_messages_provider_config.transform_anthropic_messages_response( + initial_response = anthropic_messages_provider_config.transform_anthropic_messages_response( model=model, raw_response=response, logging_obj=logging_obj, ) + # Call agentic completion hooks + final_response = await self._call_agentic_completion_hooks( + response=initial_response, + model=model, + messages=messages, + anthropic_messages_provider_config=anthropic_messages_provider_config, + anthropic_messages_optional_request_params=anthropic_messages_optional_request_params, + logging_obj=logging_obj, + stream=stream or False, + custom_llm_provider=custom_llm_provider, + kwargs=kwargs, + ) + + return final_response if final_response is not None else initial_response + def anthropic_messages_handler( self, model: str, @@ -4334,6 +4350,111 @@ class BaseLLMHTTPHandler: return stream, data return stream, data + async def _call_agentic_completion_hooks( + self, + response: Any, + model: str, + messages: List[Dict], + anthropic_messages_provider_config: "BaseAnthropicMessagesConfig", + anthropic_messages_optional_request_params: Dict, + logging_obj: "LiteLLMLoggingObj", + stream: bool, + custom_llm_provider: str, + kwargs: Dict, + ) -> Optional[Any]: + """ + Call agentic completion hooks for all custom loggers. + + 1. Call async_should_run_agentic_completion to check if agentic loop is needed + 2. If yes, call async_run_agentic_completion to execute the loop + + Returns the response from agentic loop, or None if no hook runs. + """ + from litellm._logging import verbose_logger + from litellm.integrations.custom_logger import CustomLogger + + callbacks = litellm.callbacks + ( + logging_obj.dynamic_success_callbacks or [] + ) + tools = anthropic_messages_optional_request_params.get("tools", []) + + for callback in callbacks: + try: + if isinstance(callback, CustomLogger): + # First: Check if agentic loop should run + should_run, tool_calls = ( + await callback.async_should_run_agentic_loop( + response=response, + model=model, + messages=messages, + tools=tools, + stream=stream, + custom_llm_provider=custom_llm_provider, + kwargs=kwargs, + ) + ) + + if should_run: + # Second: Execute agentic loop + # Add custom_llm_provider to kwargs so the agentic loop can reconstruct the full model name + kwargs_with_provider = kwargs.copy() if kwargs else {} + kwargs_with_provider["custom_llm_provider"] = custom_llm_provider + agentic_response = await callback.async_run_agentic_loop( + tools=tool_calls, + model=model, + messages=messages, + response=response, + anthropic_messages_provider_config=anthropic_messages_provider_config, + anthropic_messages_optional_request_params=anthropic_messages_optional_request_params, + logging_obj=logging_obj, + stream=stream, + kwargs=kwargs_with_provider, + ) + # First hook that runs agentic loop wins + return agentic_response + + except Exception as e: + verbose_logger.exception( + f"LiteLLM.AgenticHookError: Exception in agentic completion hooks: {str(e)}" + ) + + # Check if we need to convert response to fake stream + # This happens when: + # 1. Stream was originally True but converted to False for WebSearch interception + # 2. No agentic loop ran (LLM didn't use the tool) + # 3. We have a non-streaming response that needs to be converted to streaming + websearch_converted_stream = ( + logging_obj.model_call_details.get("websearch_interception_converted_stream", False) + if logging_obj is not None + else False + ) + + if websearch_converted_stream: + from typing import cast + + from litellm._logging import verbose_logger + from litellm.llms.anthropic.experimental_pass_through.messages.fake_stream_iterator import ( + FakeAnthropicMessagesStreamIterator, + ) + from litellm.types.llms.anthropic_messages.anthropic_response import ( + AnthropicMessagesResponse, + ) + + verbose_logger.debug( + "WebSearchInterception: No tool call made, converting non-streaming response to fake stream" + ) + + # Convert the non-streaming response to a fake stream + # The response should be an AnthropicMessagesResponse (dict) + if isinstance(response, dict): + # Create a fake streaming iterator + fake_stream = FakeAnthropicMessagesStreamIterator( + response=cast(AnthropicMessagesResponse, response) + ) + return fake_stream + + return None + def _handle_error( self, e: Exception, @@ -4453,7 +4574,7 @@ class BaseLLMHTTPHandler: self, model: str, image: Any, - prompt: str, + prompt: Optional[str], image_edit_provider_config: BaseImageEditConfig, image_edit_optional_request_params: Dict, custom_llm_provider: str, @@ -4572,7 +4693,7 @@ class BaseLLMHTTPHandler: self, model: str, image: FileTypes, - prompt: str, + prompt: Optional[str], image_edit_provider_config: BaseImageEditConfig, image_edit_optional_request_params: Dict, custom_llm_provider: str, diff --git a/litellm/llms/custom_llm.py b/litellm/llms/custom_llm.py index d235df30f2..a820ac7f34 100644 --- a/litellm/llms/custom_llm.py +++ b/litellm/llms/custom_llm.py @@ -201,7 +201,7 @@ class CustomLLM(BaseLLM): self, model: str, image: Any, - prompt: str, + prompt: Optional[str], model_response: ImageResponse, api_key: Optional[str], api_base: Optional[str], @@ -216,7 +216,7 @@ class CustomLLM(BaseLLM): self, model: str, image: Any, - prompt: str, + prompt: Optional[str], model_response: ImageResponse, api_key: Optional[str], api_base: Optional[str], diff --git a/litellm/llms/gemini/image_edit/transformation.py b/litellm/llms/gemini/image_edit/transformation.py index 78a7ff9546..0015155b47 100644 --- a/litellm/llms/gemini/image_edit/transformation.py +++ b/litellm/llms/gemini/image_edit/transformation.py @@ -80,7 +80,7 @@ class GeminiImageEditConfig(BaseImageEditConfig): def transform_image_edit_request( # type: ignore[override] self, model: str, - prompt: str, + prompt: Optional[str], image: FileTypes, image_edit_optional_request_params: Dict[str, Any], litellm_params: GenericLiteLLMParams, @@ -90,6 +90,9 @@ class GeminiImageEditConfig(BaseImageEditConfig): if not inline_parts: raise ValueError("Gemini image edit requires at least one image.") + if prompt is None: + raise ValueError("Gemini image edit requires a prompt.") + contents = [ { "parts": inline_parts + [{"text": prompt}], diff --git a/litellm/llms/ollama/chat/transformation.py b/litellm/llms/ollama/chat/transformation.py index 9c8700daf8..8c98cc5405 100644 --- a/litellm/llms/ollama/chat/transformation.py +++ b/litellm/llms/ollama/chat/transformation.py @@ -190,46 +190,14 @@ class OllamaChatConfig(BaseConfig): else: optional_params["think"] = value in {"low", "medium", "high"} ### FUNCTION CALLING LOGIC ### + # Ollama 0.4+ supports native tool calling - pass tools directly + # and let Ollama handle model capability detection + # Fixes: https://github.com/BerriAI/litellm/issues/18922 if param == "tools": - ## CHECK IF MODEL SUPPORTS TOOL CALLING ## - try: - model_info = litellm.get_model_info( - model=model, custom_llm_provider="ollama" - ) - if model_info.get("supports_function_calling") is True: - optional_params["tools"] = value - else: - raise Exception - except Exception: - optional_params["format"] = "json" - litellm.add_function_to_prompt = ( - True # so that main.py adds the function call to the prompt - ) - optional_params["functions_unsupported_model"] = value - - if len(optional_params["functions_unsupported_model"]) == 1: - optional_params["function_name"] = optional_params[ - "functions_unsupported_model" - ][0]["function"]["name"] + optional_params["tools"] = value if param == "functions": - ## CHECK IF MODEL SUPPORTS TOOL CALLING ## - try: - model_info = litellm.get_model_info( - model=model, custom_llm_provider="ollama" - ) - if model_info.get("supports_function_calling") is True: - optional_params["tools"] = value - else: - raise Exception - except Exception: - optional_params["format"] = "json" - litellm.add_function_to_prompt = ( - True # so that main.py adds the function call to the prompt - ) - optional_params["functions_unsupported_model"] = ( - non_default_params.get("functions") - ) + optional_params["tools"] = value non_default_params.pop("tool_choice", None) # causes ollama requests to hang non_default_params.pop("functions", None) # causes ollama requests to hang return optional_params @@ -431,6 +399,10 @@ class OllamaChatConfig(BaseConfig): _message = litellm.Message(**response_json_message) model_response.choices[0].message = _message # type: ignore + # Set finish_reason to "tool_calls" when tool_calls are present + # Fixes: https://github.com/BerriAI/litellm/issues/18922 + if _message.tool_calls: + model_response.choices[0].finish_reason = "tool_calls" model_response.created = int(time.time()) model_response.model = "ollama_chat/" + model prompt_tokens = response_json.get("prompt_eval_count", litellm.token_counter(messages=messages)) # type: ignore @@ -563,6 +535,10 @@ class OllamaChatCompletionResponseIterator(BaseModelResponseIterator): if chunk["done"] is True: finish_reason = chunk.get("done_reason", "stop") + # Override finish_reason when tool_calls are present + # Fixes: https://github.com/BerriAI/litellm/issues/18922 + if tool_calls is not None: + finish_reason = "tool_calls" choices = [ StreamingChoices( delta=delta, diff --git a/litellm/llms/openai/chat/guardrail_translation/handler.py b/litellm/llms/openai/chat/guardrail_translation/handler.py index e2cf9f4610..d0ed3f165c 100644 --- a/litellm/llms/openai/chat/guardrail_translation/handler.py +++ b/litellm/llms/openai/chat/guardrail_translation/handler.py @@ -362,7 +362,7 @@ class OpenAIChatCompletionsHandler(BaseTranslation): if has_stream_ended: # convert to model response model_response = cast( - ModelResponse, stream_chunk_builder(chunks=responses_so_far) + ModelResponse, stream_chunk_builder(chunks=responses_so_far, logging_obj=litellm_logging_obj) ) # run process_output_response await self.process_output_response( diff --git a/litellm/llms/openai/containers/transformation.py b/litellm/llms/openai/containers/transformation.py index 46718816f3..e67bfbe0c6 100644 --- a/litellm/llms/openai/containers/transformation.py +++ b/litellm/llms/openai/containers/transformation.py @@ -83,8 +83,13 @@ class OpenAIContainerConfig(BaseContainerConfig): ) -> str: """Get the complete URL for OpenAI container API. """ - if api_base is None: - api_base = "https://api.openai.com/v1" + api_base = ( + api_base + or litellm.api_base + or get_secret_str("OPENAI_BASE_URL") + or get_secret_str("OPENAI_API_BASE") + or "https://api.openai.com/v1" + ) return f"{api_base.rstrip('/')}/containers" diff --git a/litellm/llms/openai/image_edit/dalle2_transformation.py b/litellm/llms/openai/image_edit/dalle2_transformation.py index 37e92be17a..13531546d2 100644 --- a/litellm/llms/openai/image_edit/dalle2_transformation.py +++ b/litellm/llms/openai/image_edit/dalle2_transformation.py @@ -1,5 +1,5 @@ from io import BufferedReader -from typing import TYPE_CHECKING, Any, Dict, List, Tuple, cast +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, cast from httpx._types import RequestFiles @@ -30,7 +30,7 @@ class DallE2ImageEditConfig(OpenAIImageEditConfig): def transform_image_edit_request( self, model: str, - prompt: str, + prompt: Optional[str], image: FileTypes, image_edit_optional_request_params: Dict, litellm_params: GenericLiteLLMParams, @@ -41,6 +41,9 @@ class DallE2ImageEditConfig(OpenAIImageEditConfig): DALL-E-2 only accepts a single image with field name "image" (not "image[]"). """ + if prompt is None: + raise ValueError("DALL-E-2 image edit requires a prompt.") + request = ImageEditRequestParams( model=model, image=image, diff --git a/litellm/llms/openai/image_edit/transformation.py b/litellm/llms/openai/image_edit/transformation.py index 1b90d96fa9..9edad9ee2c 100644 --- a/litellm/llms/openai/image_edit/transformation.py +++ b/litellm/llms/openai/image_edit/transformation.py @@ -79,7 +79,7 @@ class OpenAIImageEditConfig(BaseImageEditConfig): def transform_image_edit_request( self, model: str, - prompt: str, + prompt: Optional[str], image: FileTypes, image_edit_optional_request_params: Dict, litellm_params: GenericLiteLLMParams, @@ -91,6 +91,9 @@ class OpenAIImageEditConfig(BaseImageEditConfig): Handles multipart/form-data for images. Uses "image[]" field name to support multiple images (e.g., for gpt-image-1). """ + if prompt is None: + raise ValueError("OpenAI image edit requires a prompt.") + request = ImageEditRequestParams( model=model, image=image, diff --git a/litellm/llms/openai/realtime/handler.py b/litellm/llms/openai/realtime/handler.py index 3ae4d2bc9f..6ab43ab31e 100644 --- a/litellm/llms/openai/realtime/handler.py +++ b/litellm/llms/openai/realtime/handler.py @@ -57,6 +57,19 @@ class OpenAIRealtime(OpenAIChatCompletion): try: ssl_context = get_shared_realtime_ssl_context() + # Log a masked request preview consistent with other endpoints. + logging_obj.pre_call( + input=None, + api_key=api_key, + additional_args={ + "api_base": url, + "headers": { + "Authorization": f"Bearer {api_key}", + "OpenAI-Beta": "realtime=v1", + }, + "complete_input_dict": {"query_params": query_params}, + }, + ) async with websockets.connect( # type: ignore url, additional_headers={ diff --git a/litellm/llms/openrouter/image_generation/__init__.py b/litellm/llms/openrouter/image_generation/__init__.py new file mode 100644 index 0000000000..f2d06439d4 --- /dev/null +++ b/litellm/llms/openrouter/image_generation/__init__.py @@ -0,0 +1,13 @@ +from litellm.llms.base_llm.image_generation.transformation import ( + BaseImageGenerationConfig, +) + +from .transformation import OpenRouterImageGenerationConfig + +__all__ = [ + "OpenRouterImageGenerationConfig", +] + + +def get_openrouter_image_generation_config(model: str) -> BaseImageGenerationConfig: + return OpenRouterImageGenerationConfig() \ No newline at end of file diff --git a/litellm/llms/openrouter/image_generation/transformation.py b/litellm/llms/openrouter/image_generation/transformation.py new file mode 100644 index 0000000000..92084b533a --- /dev/null +++ b/litellm/llms/openrouter/image_generation/transformation.py @@ -0,0 +1,414 @@ +""" +OpenRouter Image Generation Support + +OpenRouter provides image generation through chat completion endpoints. +Models like google/gemini-2.5-flash-image return images in the message content. + +Response format: +{ + "choices": [{ + "message": { + "content": "Here is a beautiful sunset for you! ", + "role": "assistant", + "images": [{ + "image_url": {"url": "data:image/png;base64,..."}, + "index": 0, + "type": "image_url" + }] + } + }], + "usage": { + "completion_tokens": 1299, + "prompt_tokens": 6, + "total_tokens": 1305, + "completion_tokens_details": {"image_tokens": 1290}, + "cost": 0.0387243 + } +} +""" + +from typing import TYPE_CHECKING, Any, List, Optional, Union + +import httpx + +import litellm +from litellm.llms.base_llm.chat.transformation import BaseLLMException +from litellm.llms.base_llm.image_generation.transformation import ( + BaseImageGenerationConfig, +) +from litellm.secret_managers.main import get_secret_str +from litellm.types.llms.openai import OpenAIImageGenerationOptionalParams, AllMessageValues +from litellm.types.utils import ImageObject, ImageResponse, ImageUsage, ImageUsageInputTokensDetails +from litellm.llms.openrouter.common_utils import OpenRouterException + + +if TYPE_CHECKING: + from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj +else: + LiteLLMLoggingObj = Any + + +class OpenRouterImageGenerationConfig(BaseImageGenerationConfig): + """ + Configuration for OpenRouter image generation via chat completions. + + OpenRouter uses chat completion endpoints for image generation, + so we need to transform image generation requests to chat format + and extract images from chat responses. + """ + + def get_supported_openai_params( + self, model: str + ) -> List[OpenAIImageGenerationOptionalParams]: + """ + Get supported OpenAI parameters for OpenRouter image generation. + + Since OpenRouter uses chat completions for image generation, + we support standard image generation params. + """ + return [ + "size", + "quality", + "n", + ] + + def map_openai_params( + self, + non_default_params: dict, + optional_params: dict, + model: str, + drop_params: bool, + ) -> dict: + """ + Map image generation params to OpenRouter chat completion format. + + Maps OpenAI parameters to OpenRouter's image_config format: + - size -> image_config.aspect_ratio + - quality -> image_config.image_size + """ + supported_params = self.get_supported_openai_params(model) + + for key, value in non_default_params.items(): + if key in supported_params: + if key == "size": + # Map OpenAI size to OpenRouter aspect_ratio + aspect_ratio = self._map_size_to_aspect_ratio(value) + if "image_config" not in optional_params: + optional_params["image_config"] = {} + optional_params["image_config"]["aspect_ratio"] = aspect_ratio + elif key == "quality": + # Map OpenAI quality to OpenRouter image_size + image_size = self._map_quality_to_image_size(value) + if image_size: + if "image_config" not in optional_params: + optional_params["image_config"] = {} + optional_params["image_config"]["image_size"] = image_size + else: + # Pass through other supported params (like n) + optional_params[key] = value + elif not drop_params: + # If not supported and drop_params is False, pass through + optional_params[key] = value + + return optional_params + + def _map_size_to_aspect_ratio(self, size: str) -> str: + """ + Map OpenAI size format to OpenRouter aspect_ratio format. + + OpenAI sizes: + - 1024x1024 (square) + - 1536x1024 (landscape) + - 1024x1536 (portrait) + - 1792x1024 (wide landscape, dall-e-3) + - 1024x1792 (tall portrait, dall-e-3) + - 256x256, 512x512 (dall-e-2) + - auto (default) + + OpenRouter aspect_ratios: + - 1:1 → 1024×1024 (default) + - 2:3 → 832×1248 + - 3:2 → 1248×832 + - 3:4 → 864×1184 + - 4:3 → 1184×864 + - 4:5 → 896×1152 + - 5:4 → 1152×896 + - 9:16 → 768×1344 + - 16:9 → 1344×768 + - 21:9 → 1536×672 + """ + size_to_aspect_ratio = { + # Square formats + "256x256": "1:1", + "512x512": "1:1", + "1024x1024": "1:1", + # Landscape formats + "1536x1024": "3:2", # 1.5:1 ratio, closest to 3:2 + "1792x1024": "16:9", # 1.75:1 ratio, closest to 16:9 + # Portrait formats + "1024x1536": "2:3", # 0.67:1 ratio, closest to 2:3 + "1024x1792": "9:16", # 0.57:1 ratio, closest to 9:16 + # Default + "auto": "1:1", + } + return size_to_aspect_ratio.get(size, "1:1") + + def _map_quality_to_image_size(self, quality: str) -> Optional[str]: + """ + Map OpenAI quality to OpenRouter image_size format. + + OpenAI quality values: + - auto (default) - automatically select best quality + - high, medium, low - for GPT image models + - hd, standard - for dall-e-3 + + OpenRouter image_size values (Gemini only): + - 1K → Standard resolution (default) + - 2K → Higher resolution + - 4K → Highest resolution + """ + quality_to_image_size = { + # OpenAI quality mappings + "low": "1K", + "standard": "1K", + "medium": "2K", + "high": "4K", + "hd": "4K", + # Auto defaults to standard + "auto": "1K", + } + return quality_to_image_size.get(quality) + + def _set_usage_and_cost( + self, + model_response: ImageResponse, + response_json: dict, + model: str, + ) -> None: + """ + Extract and set usage and cost information from OpenRouter response. + + Args: + model_response: ImageResponse object to populate + response_json: Parsed JSON response from OpenRouter + model: The model name + """ + usage_data = response_json.get("usage", {}) + if usage_data: + prompt_tokens = usage_data.get("prompt_tokens", 0) + total_tokens = usage_data.get("total_tokens", 0) + + completion_tokens_details = usage_data.get("completion_tokens_details", {}) + image_tokens = completion_tokens_details.get("image_tokens", 0) + + model_response.usage = ImageUsage( + input_tokens=prompt_tokens, + input_tokens_details=ImageUsageInputTokensDetails( + image_tokens=0, # Input doesn't contain images for generation + text_tokens=prompt_tokens, + ), + output_tokens=image_tokens, + total_tokens=total_tokens, + ) + + cost = usage_data.get("cost") + if cost is not None: + if not hasattr(model_response, "_hidden_params"): + model_response._hidden_params = {} + if "additional_headers" not in model_response._hidden_params: + model_response._hidden_params["additional_headers"] = {} + model_response._hidden_params["additional_headers"][ + "llm_provider-x-litellm-response-cost" + ] = float(cost) + + cost_details = usage_data.get("cost_details", {}) + if cost_details: + if "response_cost_details" not in model_response._hidden_params: + model_response._hidden_params["response_cost_details"] = {} + model_response._hidden_params["response_cost_details"].update(cost_details) + + model_response._hidden_params["model"] = response_json.get("model", model) + + def get_complete_url( + self, + api_base: Optional[str], + api_key: Optional[str], + model: str, + optional_params: dict, + litellm_params: dict, + stream: Optional[bool] = None, + ) -> str: + """ + Get the complete URL for OpenRouter image generation. + + OpenRouter uses chat completions endpoint for image generation. + Default: https://openrouter.ai/api/v1/chat/completions + """ + if api_base: + if not api_base.endswith("/chat/completions"): + api_base = api_base.rstrip("/") + return f"{api_base}/chat/completions" + return api_base + + return "https://openrouter.ai/api/v1/chat/completions" + + def validate_environment( + self, + headers: dict, + model: str, + messages: List[AllMessageValues], + optional_params: dict, + litellm_params: dict, + api_key: Optional[str] = None, + api_base: Optional[str] = None, + ) -> dict: + api_key = ( + api_key + or litellm.api_key + or get_secret_str("OPENROUTER_API_KEY") + ) + headers.update( + { + "Authorization": f"Bearer {api_key}", + } + ) + return headers + + def transform_image_generation_request( + self, + model: str, + prompt: str, + optional_params: dict, + litellm_params: dict, + headers: dict, + ) -> dict: + """ + Transform image generation request to OpenRouter chat completion format. + + Args: + model: The model name + prompt: The image generation prompt + optional_params: Optional parameters (including image_config) + litellm_params: LiteLLM parameters + headers: Request headers + + Returns: + dict: Request body in chat completion format with image_config + """ + request_body = { + "model": model, + "messages": [ + { + "role": "user", + "content": prompt + } + ] + } + + # These will be passed through to OpenRouter + for key, value in optional_params.items(): + if key not in ["model", "messages", "modalities"]: + request_body[key] = value + + return request_body + + def transform_image_generation_response( + self, + model: str, + raw_response: httpx.Response, + model_response: ImageResponse, + logging_obj: LiteLLMLoggingObj, + request_data: dict, + optional_params: dict, + litellm_params: dict, + encoding: Any, + api_key: Optional[str] = None, + json_mode: Optional[bool] = None, + ) -> ImageResponse: + """ + Transform OpenRouter chat completion response to ImageResponse format. + + Extracts images from the message content and maps usage/cost information. + + Args: + model: The model name + raw_response: Raw HTTP response from OpenRouter + model_response: ImageResponse object to populate + logging_obj: Logging object + request_data: Original request data + optional_params: Optional parameters + litellm_params: LiteLLM parameters + encoding: Encoding + api_key: API key + json_mode: JSON mode flag + + Returns: + ImageResponse: Populated image response + """ + try: + response_json = raw_response.json() + except Exception as e: + raise OpenRouterException( + message=f"Error parsing OpenRouter response: {str(e)}", + status_code=raw_response.status_code, + headers=raw_response.headers, + ) + + if not model_response.data: + model_response.data = [] + + try: + choices = response_json.get("choices", []) + + for choice in choices: + message = choice.get("message", {}) + images = message.get("images", []) + + for image_data in images: + image_url_obj = image_data.get("image_url", {}) + image_url = image_url_obj.get("url") + + if image_url: + if image_url.startswith("data:"): + # Extract base64 data + # Format: data:image/png;base64, + parts = image_url.split(",", 1) + b64_data = parts[1] if len(parts) > 1 else None + + model_response.data.append( + ImageObject( + b64_json=b64_data, + url=None, + revised_prompt=None, + ) + ) + else: + model_response.data.append( + ImageObject( + b64_json=None, + url=image_url, + revised_prompt=None, + ) + ) + + # Extract and set usage and cost information + self._set_usage_and_cost(model_response, response_json, model) + + return model_response + + except Exception as e: + raise OpenRouterException( + message=f"Error transforming OpenRouter image generation response: {str(e)}", + status_code=500, + headers={}, + ) + + def get_error_class( + self, error_message: str, status_code: int, headers: Union[dict, httpx.Headers] + ) -> BaseLLMException: + """Get the appropriate error class for OpenRouter errors.""" + return OpenRouterException( + message=error_message, + status_code=status_code, + headers=headers, + ) diff --git a/litellm/llms/recraft/image_edit/transformation.py b/litellm/llms/recraft/image_edit/transformation.py index 9444925769..9bf46704ed 100644 --- a/litellm/llms/recraft/image_edit/transformation.py +++ b/litellm/llms/recraft/image_edit/transformation.py @@ -101,7 +101,7 @@ class RecraftImageEditConfig(BaseImageEditConfig): def transform_image_edit_request( self, model: str, - prompt: str, + prompt: Optional[str], image: FileTypes, image_edit_optional_request_params: Dict, litellm_params: GenericLiteLLMParams, @@ -114,6 +114,9 @@ class RecraftImageEditConfig(BaseImageEditConfig): https://www.recraft.ai/docs#image-to-image """ + if prompt is None: + raise ValueError("Recraft image edit requires a prompt.") + request_body: RecraftImageEditRequestParams = RecraftImageEditRequestParams( model=model, prompt=prompt, @@ -124,7 +127,7 @@ class RecraftImageEditConfig(BaseImageEditConfig): ######################################################### # Reuse OpenAI logic: Separate images as `files` and send other parameters as `data` ######################################################### - files_list = self._get_image_files_for_request(image=image) + files_list = self._get_image_files_for_request(image=image) if image is not None else [] data_without_images = {k: v for k, v in request_dict.items() if k != "image"} return data_without_images, files_list @@ -132,7 +135,7 @@ class RecraftImageEditConfig(BaseImageEditConfig): def _get_image_files_for_request( self, - image: FileTypes, + image: Optional[FileTypes], ) -> List[Tuple[str, Any]]: files_list: List[Tuple[str, Any]] = [] diff --git a/litellm/llms/stability/image_edit/transformations.py b/litellm/llms/stability/image_edit/transformations.py index 173fae2d6f..013e3f27a0 100644 --- a/litellm/llms/stability/image_edit/transformations.py +++ b/litellm/llms/stability/image_edit/transformations.py @@ -14,11 +14,11 @@ from httpx._types import RequestFiles from litellm.llms.base_llm.image_edit.transformation import BaseImageEditConfig from litellm.secret_managers.main import get_secret_str from litellm.types.images.main import ImageEditOptionalRequestParams -from litellm.types.router import GenericLiteLLMParams from litellm.types.llms.stability import ( OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO, STABILITY_EDIT_ENDPOINTS, ) +from litellm.types.router import GenericLiteLLMParams from litellm.types.utils import FileTypes, ImageObject, ImageResponse from litellm.utils import get_model_info @@ -170,7 +170,7 @@ class StabilityImageEditConfig(BaseImageEditConfig): def transform_image_edit_request( self, model: str, - prompt: str, + prompt: Optional[str], image: FileTypes, image_edit_optional_request_params: Dict, litellm_params: GenericLiteLLMParams, @@ -186,9 +186,12 @@ class StabilityImageEditConfig(BaseImageEditConfig): # Populate multipart form-data as separate text fields (data) and files. # Stability expects prompt/output_format/etc. as normal form fields, not file parts. data: Dict[str, Any] = { - "prompt": prompt, "output_format": "png", # Default to PNG } + + # Add prompt only if provided (some Stability endpoints don't require it) + if prompt is not None: + data["prompt"] = prompt # Handle image parameter - could be a single file or list image_file = image[0] if isinstance(image, list) else image # type: ignore files: Dict[str, Any] = {"image": image_file} diff --git a/litellm/llms/vertex_ai/common_utils.py b/litellm/llms/vertex_ai/common_utils.py index 2aa6a00c72..5aa7662f17 100644 --- a/litellm/llms/vertex_ai/common_utils.py +++ b/litellm/llms/vertex_ai/common_utils.py @@ -655,16 +655,21 @@ def convert_anyof_null_to_nullable(schema, depth=0): def add_object_type(schema): + # Gemini requires all function parameters to be type OBJECT + # Handle case where schema has no properties and no type (e.g. tools with no arguments) + if "type" not in schema and "anyOf" not in schema and "oneOf" not in schema and "allOf" not in schema: + schema["type"] = "object" + properties = schema.get("properties", None) if properties is not None: if "required" in schema and schema["required"] is None: schema.pop("required", None) # Gemini doesn't accept empty properties for object types - # If properties is empty, remove it and the type field + # If properties is empty, remove it but keep type as object if not properties: schema.pop("properties", None) - schema.pop("type", None) schema.pop("required", None) + schema["type"] = "object" else: schema["type"] = "object" for name, value in properties.items(): @@ -771,6 +776,16 @@ def get_vertex_location_from_url(url: str) -> Optional[str]: return match.group(1) if match else None +def get_vertex_model_id_from_url(url: str) -> Optional[str]: + """ + Get the vertex model id from the url + + `https://${LOCATION}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}/publishers/google/models/${MODEL_ID}:streamGenerateContent` + """ + match = re.search(r"/models/([^/:]+)", url) + return match.group(1) if match else None + + def replace_project_and_location_in_route( requested_route: str, vertex_project: str, vertex_location: str ) -> str: @@ -820,6 +835,15 @@ def construct_target_url( if "cachedContent" in requested_route: vertex_version = "v1beta1" + # Check if the requested route starts with a version + # e.g. /v1beta1/publishers/google/models/gemini-3-pro-preview:streamGenerateContent + if requested_route.startswith("/v1/"): + vertex_version = "v1" + requested_route = requested_route.replace("/v1/", "/", 1) + elif requested_route.startswith("/v1beta1/"): + vertex_version = "v1beta1" + requested_route = requested_route.replace("/v1beta1/", "/", 1) + base_requested_route = "{}/projects/{}/locations/{}".format( vertex_version, vertex_project, vertex_location ) diff --git a/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py b/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py index cff1bebceb..289963e917 100644 --- a/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py +++ b/litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py @@ -304,7 +304,7 @@ class ContextCachingEndpoints(VertexBase): ## CHECK IF CACHED ALREADY generated_cache_key = local_cache_obj.get_cache_key( - messages=cached_messages, tools=tools + messages=cached_messages, tools=tools, model=model ) google_cache_name = self.check_cache( cache_key=generated_cache_key, @@ -433,7 +433,7 @@ class ContextCachingEndpoints(VertexBase): ## CHECK IF CACHED ALREADY generated_cache_key = local_cache_obj.get_cache_key( - messages=cached_messages, tools=tools + messages=cached_messages, tools=tools, model=model ) google_cache_name = await self.async_check_cache( cache_key=generated_cache_key, diff --git a/litellm/llms/vertex_ai/gemini/transformation.py b/litellm/llms/vertex_ai/gemini/transformation.py index 22042f7d64..8f1338db92 100644 --- a/litellm/llms/vertex_ai/gemini/transformation.py +++ b/litellm/llms/vertex_ai/gemini/transformation.py @@ -68,6 +68,8 @@ def _convert_detail_to_media_resolution_enum( ) -> Optional[Dict[str, str]]: if detail == "low": return {"level": "MEDIA_RESOLUTION_LOW"} + elif detail == "medium": + return {"level": "MEDIA_RESOLUTION_MEDIUM"} elif detail == "high": return {"level": "MEDIA_RESOLUTION_HIGH"} return None diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py index 7a37812bcf..f65a19ac46 100644 --- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py +++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py @@ -1535,9 +1535,10 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): f"usageMetadata not found in completion_response. Got={completion_response}" ) cached_tokens: Optional[int] = None - audio_tokens: Optional[int] = None - image_tokens: Optional[int] = None - text_tokens: Optional[int] = None + # Separate variables for prompt tokens by modality + prompt_audio_tokens: Optional[int] = None + prompt_image_tokens: Optional[int] = None + prompt_text_tokens: Optional[int] = None prompt_tokens_details: Optional[PromptTokensDetailsWrapper] = None reasoning_tokens: Optional[int] = None response_tokens: Optional[int] = None @@ -1580,10 +1581,10 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): if response_tokens_details is None: response_tokens_details = CompletionTokensDetailsWrapper() if response_tokens_details.text_tokens is None: - image_tokens = response_tokens_details.image_tokens or 0 - audio_tokens_candidate = response_tokens_details.audio_tokens or 0 + completion_image_tokens = response_tokens_details.image_tokens or 0 + completion_audio_tokens = response_tokens_details.audio_tokens or 0 calculated_text_tokens = ( - candidates_token_count - image_tokens - audio_tokens_candidate + candidates_token_count - completion_image_tokens - completion_audio_tokens ) response_tokens_details.text_tokens = calculated_text_tokens ######################################################### @@ -1592,11 +1593,11 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): if "promptTokensDetails" in usage_metadata: for detail in usage_metadata["promptTokensDetails"]: if detail["modality"] == "AUDIO": - audio_tokens = detail.get("tokenCount", 0) + prompt_audio_tokens = detail.get("tokenCount", 0) elif detail["modality"] == "TEXT": - text_tokens = detail.get("tokenCount", 0) + prompt_text_tokens = detail.get("tokenCount", 0) elif detail["modality"] == "IMAGE": - image_tokens = detail.get("tokenCount", 0) + prompt_image_tokens = detail.get("tokenCount", 0) ## Parse cacheTokensDetails (breakdown of cached tokens by modality) ## When explicit caching is used, Gemini provides this field to show which modalities were cached @@ -1616,12 +1617,12 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): ## Calculate non-cached tokens by subtracting cached from total (per modality) ## This is necessary because promptTokensDetails includes both cached and non-cached tokens ## See: https://github.com/BerriAI/litellm/issues/18750 - if cached_text_tokens is not None and text_tokens is not None: - text_tokens = text_tokens - cached_text_tokens - if cached_audio_tokens is not None and audio_tokens is not None: - audio_tokens = audio_tokens - cached_audio_tokens - if cached_image_tokens is not None and image_tokens is not None: - image_tokens = image_tokens - cached_image_tokens + if cached_text_tokens is not None and prompt_text_tokens is not None: + prompt_text_tokens = prompt_text_tokens - cached_text_tokens + if cached_audio_tokens is not None and prompt_audio_tokens is not None: + prompt_audio_tokens = prompt_audio_tokens - cached_audio_tokens + if cached_image_tokens is not None and prompt_image_tokens is not None: + prompt_image_tokens = prompt_image_tokens - cached_image_tokens if "thoughtsTokenCount" in usage_metadata: reasoning_tokens = usage_metadata["thoughtsTokenCount"] @@ -1632,9 +1633,9 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig): prompt_tokens_details = PromptTokensDetailsWrapper( cached_tokens=cached_tokens, - audio_tokens=audio_tokens, - text_tokens=text_tokens, - image_tokens=image_tokens, + audio_tokens=prompt_audio_tokens, + text_tokens=prompt_text_tokens, + image_tokens=prompt_image_tokens, ) completion_tokens = response_tokens or completion_response["usageMetadata"].get( diff --git a/litellm/llms/vertex_ai/image_edit/vertex_gemini_transformation.py b/litellm/llms/vertex_ai/image_edit/vertex_gemini_transformation.py index 174d05cf7c..154d5669eb 100644 --- a/litellm/llms/vertex_ai/image_edit/vertex_gemini_transformation.py +++ b/litellm/llms/vertex_ai/image_edit/vertex_gemini_transformation.py @@ -151,7 +151,7 @@ class VertexAIGeminiImageEditConfig(BaseImageEditConfig, VertexLLM): def transform_image_edit_request( # type: ignore[override] self, model: str, - prompt: str, + prompt: Optional[str], image: FileTypes, image_edit_optional_request_params: Dict[str, Any], litellm_params: GenericLiteLLMParams, @@ -161,6 +161,9 @@ class VertexAIGeminiImageEditConfig(BaseImageEditConfig, VertexLLM): if not inline_parts: raise ValueError("Vertex AI Gemini image edit requires at least one image.") + if prompt is None: + raise ValueError("Vertex AI Gemini image edit requires a prompt.") + # Correct format for Vertex AI Gemini image editing contents = { "role": "USER", diff --git a/litellm/llms/vertex_ai/image_edit/vertex_imagen_transformation.py b/litellm/llms/vertex_ai/image_edit/vertex_imagen_transformation.py index b61af6ffd3..337a4bd4dd 100644 --- a/litellm/llms/vertex_ai/image_edit/vertex_imagen_transformation.py +++ b/litellm/llms/vertex_ai/image_edit/vertex_imagen_transformation.py @@ -143,17 +143,22 @@ class VertexAIImagenImageEditConfig(BaseImageEditConfig, VertexLLM): def transform_image_edit_request( # type: ignore[override] self, model: str, - prompt: str, + prompt: Optional[str], image: FileTypes, image_edit_optional_request_params: Dict[str, Any], litellm_params: GenericLiteLLMParams, headers: dict, ) -> Tuple[Dict[str, Any], Optional[RequestFiles]]: # Prepare reference images in the correct Imagen format + if image is None: + raise ValueError("Vertex AI Imagen image edit requires at least one reference image.") reference_images = self._prepare_reference_images(image, image_edit_optional_request_params) if not reference_images: raise ValueError("Vertex AI Imagen image edit requires at least one reference image.") + if prompt is None: + raise ValueError("Vertex AI Imagen image edit requires a prompt.") + # Correct Imagen instances format instances = [ { diff --git a/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py b/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py index c22072af2f..0bedef3276 100644 --- a/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py +++ b/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py @@ -1,11 +1,16 @@ from typing import Any, Dict, List, Optional, Tuple +from litellm.llms.anthropic.common_utils import AnthropicModelInfo from litellm.llms.anthropic.experimental_pass_through.messages.transformation import ( AnthropicMessagesConfig, ) +from litellm.types.llms.anthropic import ( + ANTHROPIC_BETA_HEADER_VALUES, + ANTHROPIC_HOSTED_TOOLS, +) +from litellm.types.llms.anthropic_tool_search import get_tool_search_beta_header from litellm.types.llms.vertex_ai import VertexPartnerProvider from litellm.types.router import GenericLiteLLMParams -from litellm.types.llms.anthropic import ANTHROPIC_BETA_HEADER_VALUES, ANTHROPIC_HOSTED_TOOLS from ....vertex_llm_base import VertexBase @@ -51,13 +56,28 @@ class VertexAIPartnerModelsAnthropicMessagesConfig(AnthropicMessagesConfig, Vert headers["content-type"] = "application/json" - # Add web search beta header for Vertex AI only if not already set - if "anthropic-beta" not in headers: - tools = optional_params.get("tools", []) - for tool in tools: - if isinstance(tool, dict) and tool.get("type", "").startswith(ANTHROPIC_HOSTED_TOOLS.WEB_SEARCH.value): - headers["anthropic-beta"] = ANTHROPIC_BETA_HEADER_VALUES.WEB_SEARCH_2025_03_05.value - break + # Add beta headers for Vertex AI + tools = optional_params.get("tools", []) + beta_values: set[str] = set() + + # Get existing beta headers if any + existing_beta = headers.get("anthropic-beta") + if existing_beta: + beta_values.update(b.strip() for b in existing_beta.split(",")) + + # Check for web search tool + for tool in tools: + if isinstance(tool, dict) and tool.get("type", "").startswith(ANTHROPIC_HOSTED_TOOLS.WEB_SEARCH.value): + beta_values.add(ANTHROPIC_BETA_HEADER_VALUES.WEB_SEARCH_2025_03_05.value) + break + + # Check for tool search tools - Vertex AI uses different beta header + anthropic_model_info = AnthropicModelInfo() + if anthropic_model_info.is_tool_search_used(tools): + beta_values.add(get_tool_search_beta_header("vertex_ai")) + + if beta_values: + headers["anthropic-beta"] = ",".join(beta_values) return headers, api_base diff --git a/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/transformation.py b/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/transformation.py index 24425f08b5..1df07f405e 100644 --- a/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/transformation.py +++ b/litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/transformation.py @@ -69,6 +69,9 @@ class VertexAIAnthropicConfig(AnthropicConfig): data.pop("model", None) # vertex anthropic doesn't accept 'model' parameter + # VertexAI doesn't support output_format parameter, remove it if present + data.pop("output_format", None) + tools = optional_params.get("tools") tool_search_used = self.is_tool_search_used(tools) auto_betas = self.get_anthropic_beta_list( @@ -89,6 +92,37 @@ class VertexAIAnthropicConfig(AnthropicConfig): return data + def map_openai_params( + self, + non_default_params: dict, + optional_params: dict, + model: str, + drop_params: bool, + ) -> dict: + """ + Override parent method to ensure VertexAI always uses tool-based structured outputs. + VertexAI doesn't support the output_format parameter, so we force all models + to use the tool-based approach for structured outputs. + """ + # Temporarily override model name to force tool-based approach + # This ensures Claude Sonnet 4.5 uses tools instead of output_format + original_model = model + if "response_format" in non_default_params: + model = "claude-3-sonnet-20240229" # Use a model that will use tool-based approach + + # Call parent method with potentially modified model name + optional_params = super().map_openai_params( + non_default_params=non_default_params, + optional_params=optional_params, + model=model, + drop_params=drop_params, + ) + + # Restore original model name for any other processing + model = original_model + + return optional_params + def transform_response( self, model: str, diff --git a/litellm/llms/watsonx/audio_transcription/transformation.py b/litellm/llms/watsonx/audio_transcription/transformation.py index c7e6a77b96..5944705258 100644 --- a/litellm/llms/watsonx/audio_transcription/transformation.py +++ b/litellm/llms/watsonx/audio_transcription/transformation.py @@ -22,7 +22,7 @@ from ...base_llm.audio_transcription.transformation import ( from ...openai.transcriptions.whisper_transformation import ( OpenAIWhisperAudioTranscriptionConfig, ) -from ..common_utils import IBMWatsonXMixin, _get_api_params +from ..common_utils import IBMWatsonXMixin class IBMWatsonXAudioTranscriptionConfig( @@ -48,7 +48,7 @@ class IBMWatsonXAudioTranscriptionConfig( ) -> Dict: """ Validate environment for audio transcription. - + Removes Content-Type header so httpx can set multipart/form-data automatically. """ result = IBMWatsonXMixin.validate_environment( @@ -88,31 +88,37 @@ class IBMWatsonXAudioTranscriptionConfig( ) -> AudioTranscriptionRequestData: """ Transform the audio transcription request for WatsonX. - + WatsonX expects multipart/form-data with: - file: the audio file - model: the model name (without watsonx/ prefix) - project_id: the project ID (as form field, not query param) + - space_id: the space ID (as form field, not query param) - other optional params """ # Use common utility to process the audio file processed_audio = process_audio_file(audio_file) - - # Get API params to extract project_id - api_params = _get_api_params(params=optional_params.copy()) - + project_id = optional_params.get("project_id") or optional_params.get( + "watsonx_project" + ) + space_id = optional_params.get("space_id") + # api_params = _get_api_params(params=optional_params, model=model) + # Initialize form data with required fields - form_data: WatsonXAudioTranscriptionRequestBody = { - "model": model, - "project_id": api_params.get("project_id", ""), - } - + form_data: WatsonXAudioTranscriptionRequestBody = {"model": model} + + # Only add project_id or space_id if they were explicitly provided by the user + if project_id: + form_data["project_id"] = project_id + elif space_id: + form_data["space_id"] = space_id + # Add supported OpenAI params to form data supported_params = self.get_supported_openai_params(model) for key, value in optional_params.items(): if key in supported_params and value is not None: form_data[key] = value # type: ignore - + # Prepare files dict with the audio file files = { "file": ( @@ -121,10 +127,10 @@ class IBMWatsonXAudioTranscriptionConfig( processed_audio.content_type, ) } - + # Convert TypedDict to regular dict for AudioTranscriptionRequestData form_data_dict: Dict[str, Any] = dict(form_data) - + return AudioTranscriptionRequestData(data=form_data_dict, files=files) def get_complete_url( @@ -140,8 +146,8 @@ class IBMWatsonXAudioTranscriptionConfig( Construct the complete URL for WatsonX audio transcription. URL format: {api_base}/ml/v1/audio/transcriptions?version={version} - - Note: project_id is sent as form data, not as a query parameter + + Note: project_id or space_id is sent as form data, not as a query parameter """ # Get base URL url = self._get_base_url(api_base=api_base) @@ -151,9 +157,10 @@ class IBMWatsonXAudioTranscriptionConfig( url = f"{url}/ml/v1/audio/transcriptions" # Add version parameter (only version in query string, not project_id) - api_version = optional_params.get( - "api_version", None - ) or litellm.WATSONX_DEFAULT_API_VERSION + api_version = ( + optional_params.get("api_version", None) + or litellm.WATSONX_DEFAULT_API_VERSION + ) url = f"{url}?version={api_version}" return url @@ -164,7 +171,7 @@ class IBMWatsonXAudioTranscriptionConfig( ) -> TranscriptionResponse: """ Transform the audio transcription response from WatsonX. - + WatsonX may include a 'model' field in the response, which needs to be removed before creating the TranscriptionResponse object. """ @@ -179,26 +186,30 @@ class IBMWatsonXAudioTranscriptionConfig( # TranscriptionResponse only accepts 'text' and 'usage' in __init__() text = raw_response_json.get("text") usage = raw_response_json.get("usage") - + # Create response with only valid fields response_kwargs = {} if text is not None: response_kwargs["text"] = text if usage is not None: response_kwargs["usage"] = usage - + if not response_kwargs: raise ValueError( "Invalid response format. Received response does not match the expected format. Got: ", raw_response_json, ) - + response = TranscriptionResponse(**response_kwargs) - + # Add other fields using dictionary-style assignment (like duration, task, etc.) # Skip fields that TranscriptionResponse doesn't accept in __init__() for key, value in raw_response_json.items(): - if key not in ["text", "usage", "model"]: # text/usage already set, model should be excluded + if key not in [ + "text", + "usage", + "model", + ]: # text/usage already set, model should be excluded response[key] = value - + return response diff --git a/litellm/llms/watsonx/chat/handler.py b/litellm/llms/watsonx/chat/handler.py index bc0effe4a1..40ccc45497 100644 --- a/litellm/llms/watsonx/chat/handler.py +++ b/litellm/llms/watsonx/chat/handler.py @@ -40,7 +40,7 @@ class WatsonXChatHandler(OpenAILikeChatHandler): streaming_decoder: Optional[CustomStreamingDecoder] = None, fake_stream: bool = False, ): - api_params = _get_api_params(params=optional_params) + api_params = _get_api_params(params=optional_params, model=model) ## UPDATE HEADERS headers = watsonx_chat_transformation.validate_environment( diff --git a/litellm/llms/watsonx/chat/transformation.py b/litellm/llms/watsonx/chat/transformation.py index 0bb96673ef..157493a4ce 100644 --- a/litellm/llms/watsonx/chat/transformation.py +++ b/litellm/llms/watsonx/chat/transformation.py @@ -10,7 +10,6 @@ from litellm import verbose_logger from litellm.secret_managers.main import get_secret_str from litellm.types.llms.watsonx import ( WatsonXAIEndpoint, - WatsonXAPIParams, WatsonXModelPattern, ) @@ -115,18 +114,6 @@ class IBMWatsonXChatConfig(IBMWatsonXMixin, OpenAIGPTConfig): ) return url - def _prepare_payload(self, model: str, api_params: WatsonXAPIParams) -> dict: - """ - Prepare payload for deployment models. - Deployment models cannot have 'model_id' or 'model' in the request body. - """ - payload: dict = {} - payload["model_id"] = None if model.startswith("deployment/") else model - payload["project_id"] = ( - None if model.startswith("deployment/") else api_params["project_id"] - ) - return payload - @staticmethod def _apply_prompt_template_core( model: str, messages: List[Dict[str, str]], hf_template_fn diff --git a/litellm/llms/watsonx/common_utils.py b/litellm/llms/watsonx/common_utils.py index 0207020534..774f6dc1f3 100644 --- a/litellm/llms/watsonx/common_utils.py +++ b/litellm/llms/watsonx/common_utils.py @@ -80,9 +80,7 @@ def _generate_watsonx_token(api_key: Optional[str], token: Optional[str]) -> str return token -def _get_api_params( - params: dict, -) -> WatsonXAPIParams: +def _get_api_params(params: dict, model: Optional[str] = None) -> WatsonXAPIParams: """ Find watsonx.ai credentials in the params or environment variables and return the headers for authentication. """ @@ -118,10 +116,15 @@ def _get_api_params( or get_secret_str("SPACE_ID") ) - if project_id is None: + if ( + project_id is None + and space_id is None + and model is not None + and not model.startswith("deployment/") + ): raise WatsonXAIError( status_code=401, - message="Error: Watsonx project_id not set. Set WX_PROJECT_ID in environment variables or pass in as a parameter.", + message="Error: Watsonx project_id and space_id not set. Set WX_PROJECT_ID or WX_SPACE_ID in environment variables or pass in as a parameter.", ) return WatsonXAPIParams( @@ -146,7 +149,9 @@ async def _aconvert_watsonx_messages_core( model_prompt_dict = custom_prompt_dict[model] return ptf.custom_prompt( messages=messages, - role_dict=model_prompt_dict.get("role_dict", model_prompt_dict.get("roles")), + role_dict=model_prompt_dict.get( + "role_dict", model_prompt_dict.get("roles") + ), initial_prompt_value=model_prompt_dict.get("initial_prompt_value", ""), final_prompt_value=model_prompt_dict.get("final_prompt_value", ""), bos_token=model_prompt_dict.get("bos_token", ""), @@ -180,7 +185,9 @@ def _convert_watsonx_messages_core( model_prompt_dict = custom_prompt_dict[model] return ptf.custom_prompt( messages=messages, - role_dict=model_prompt_dict.get("role_dict", model_prompt_dict.get("roles")), + role_dict=model_prompt_dict.get( + "role_dict", model_prompt_dict.get("roles") + ), initial_prompt_value=model_prompt_dict.get("initial_prompt_value", ""), final_prompt_value=model_prompt_dict.get("final_prompt_value", ""), bos_token=model_prompt_dict.get("bos_token", ""), @@ -200,7 +207,10 @@ def _convert_watsonx_messages_core( async def aconvert_watsonx_messages_to_prompt( - model: str, messages: List[AllMessageValues], provider: str, custom_prompt_dict: Dict + model: str, + messages: List[AllMessageValues], + provider: str, + custom_prompt_dict: Dict, ) -> str: """Async version of convert_watsonx_messages_to_prompt""" from litellm.llms.watsonx.chat.transformation import IBMWatsonXChatConfig @@ -215,7 +225,10 @@ async def aconvert_watsonx_messages_to_prompt( def convert_watsonx_messages_to_prompt( - model: str, messages: List[AllMessageValues], provider: str, custom_prompt_dict: Dict + model: str, + messages: List[AllMessageValues], + provider: str, + custom_prompt_dict: Dict, ) -> str: """Sync version of convert_watsonx_messages_to_prompt""" from litellm.llms.watsonx.chat.transformation import IBMWatsonXChatConfig @@ -254,7 +267,8 @@ class IBMWatsonXMixin: ) zen_api_key = cast( Optional[str], - optional_params.pop("zen_api_key", None) or get_secret_str("WATSONX_ZENAPIKEY"), + optional_params.pop("zen_api_key", None) + or get_secret_str("WATSONX_ZENAPIKEY"), ) if token: headers["Authorization"] = f"Bearer {token}" @@ -360,5 +374,8 @@ class IBMWatsonXMixin: {} ) # Deployment models do not support 'space_id' or 'project_id' in their payload payload["model_id"] = model - payload["project_id"] = api_params["project_id"] + if api_params["project_id"] is not None: + payload["project_id"] = api_params["project_id"] + else: + payload["space_id"] = api_params["space_id"] return payload diff --git a/litellm/llms/watsonx/completion/transformation.py b/litellm/llms/watsonx/completion/transformation.py index 3c1229ecd2..7180e12162 100644 --- a/litellm/llms/watsonx/completion/transformation.py +++ b/litellm/llms/watsonx/completion/transformation.py @@ -228,13 +228,17 @@ class IBMWatsonXAIConfig(IBMWatsonXMixin, BaseConfig): "us-south", ] - def _build_request_payload(self, model: str, prompt: str, optional_params: Dict) -> Dict: + def _build_request_payload( + self, model: str, prompt: str, optional_params: Dict + ) -> Dict: """Shared logic to build request payload""" extra_body_params = optional_params.pop("extra_body", {}) optional_params.update(extra_body_params) - watsonx_api_params = _get_api_params(params=optional_params) - watsonx_auth_payload = self._prepare_payload(model=model, api_params=watsonx_api_params) - + watsonx_api_params = _get_api_params(params=optional_params, model=model) + watsonx_auth_payload = self._prepare_payload( + model=model, api_params=watsonx_api_params + ) + return { "input": prompt, "moderations": optional_params.pop("moderations", {}), @@ -242,21 +246,43 @@ class IBMWatsonXAIConfig(IBMWatsonXMixin, BaseConfig): **watsonx_auth_payload, } - async def atransform_request(self, model: str, messages: List[AllMessageValues], optional_params: Dict, litellm_params: Dict, headers: Dict) -> Dict: + async def atransform_request( + self, + model: str, + messages: List[AllMessageValues], + optional_params: Dict, + litellm_params: Dict, + headers: Dict, + ) -> Dict: """Async version of transform_request""" from litellm.llms.watsonx.common_utils import ( aconvert_watsonx_messages_to_prompt, ) - + provider = model.split("/")[0] - prompt = await aconvert_watsonx_messages_to_prompt(model=model, messages=messages, provider=provider, custom_prompt_dict={}) - return self._build_request_payload(model=model, prompt=prompt, optional_params=optional_params) - - def transform_request(self, model: str, messages: List[AllMessageValues], optional_params: Dict, litellm_params: Dict, headers: Dict) -> Dict: + prompt = await aconvert_watsonx_messages_to_prompt( + model=model, messages=messages, provider=provider, custom_prompt_dict={} + ) + return self._build_request_payload( + model=model, prompt=prompt, optional_params=optional_params + ) + + def transform_request( + self, + model: str, + messages: List[AllMessageValues], + optional_params: Dict, + litellm_params: Dict, + headers: Dict, + ) -> Dict: """Sync version of transform_request""" provider = model.split("/")[0] - prompt = convert_watsonx_messages_to_prompt(model=model, messages=messages, provider=provider, custom_prompt_dict={}) - return self._build_request_payload(model=model, prompt=prompt, optional_params=optional_params) + prompt = convert_watsonx_messages_to_prompt( + model=model, messages=messages, provider=provider, custom_prompt_dict={} + ) + return self._build_request_payload( + model=model, prompt=prompt, optional_params=optional_params + ) def transform_response( self, diff --git a/litellm/llms/watsonx/embed/transformation.py b/litellm/llms/watsonx/embed/transformation.py index 21f508da01..930212e3ef 100644 --- a/litellm/llms/watsonx/embed/transformation.py +++ b/litellm/llms/watsonx/embed/transformation.py @@ -37,7 +37,7 @@ class IBMWatsonXEmbeddingConfig(IBMWatsonXMixin, BaseEmbeddingConfig): optional_params: dict, headers: dict, ) -> dict: - watsonx_api_params = _get_api_params(params=optional_params) + watsonx_api_params = _get_api_params(params=optional_params, model=model) watsonx_auth_payload = self._prepare_payload( model=model, api_params=watsonx_api_params, diff --git a/litellm/main.py b/litellm/main.py index a1992752bd..969cf55a3d 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -28,6 +28,7 @@ from typing import ( Callable, Coroutine, Dict, + Iterable, List, Literal, Mapping, @@ -1094,23 +1095,68 @@ def completion( # type: ignore # noqa: PLR0915 # validate tool_choice tool_choice = validate_chat_completion_tool_choice(tool_choice=tool_choice) + ######### unpacking kwargs ##################### + args = locals() + skip_mcp_handler = kwargs.pop("_skip_mcp_handler", False) if not skip_mcp_handler and tools: from litellm.responses.mcp.chat_completions_handler import ( - handle_chat_completion_with_mcp, + acompletion_with_mcp, ) + from litellm.responses.mcp.litellm_proxy_mcp_handler import ( + LiteLLM_Proxy_MCP_Handler, + ) + from litellm.types.llms.openai import ToolParam - mcp_handler_context = locals().copy() - completion_callable = globals().get("acompletion") - mcp_result = run_async_function( - handle_chat_completion_with_mcp, - mcp_handler_context, - completion_callable, - ) - if mcp_result is not None: - return mcp_result - ######### unpacking kwargs ##################### - args = locals() + # Check if MCP tools are present (following responses pattern) + # Cast tools to Optional[Iterable[ToolParam]] for type checking + tools_for_mcp = cast(Optional[Iterable[ToolParam]], tools) + if LiteLLM_Proxy_MCP_Handler._should_use_litellm_mcp_gateway(tools=tools_for_mcp): + # Return coroutine - acompletion will await it + # completion() can return a coroutine when MCP tools are present, which acompletion() awaits + return acompletion_with_mcp( # type: ignore[return-value] + model=model, + messages=messages, + functions=functions, + function_call=function_call, + timeout=timeout, + temperature=temperature, + top_p=top_p, + n=n, + stream=stream, + stream_options=stream_options, + stop=stop, + max_tokens=max_tokens, + max_completion_tokens=max_completion_tokens, + modalities=modalities, + prediction=prediction, + audio=audio, + presence_penalty=presence_penalty, + frequency_penalty=frequency_penalty, + logit_bias=logit_bias, + user=user, + response_format=response_format, + seed=seed, + tools=tools, + tool_choice=tool_choice, + parallel_tool_calls=parallel_tool_calls, + logprobs=logprobs, + top_logprobs=top_logprobs, + deployment_id=deployment_id, + reasoning_effort=reasoning_effort, + verbosity=verbosity, + safety_identifier=safety_identifier, + service_tier=service_tier, + base_url=base_url, + api_version=api_version, + api_key=api_key, + model_list=model_list, + extra_headers=extra_headers, + thinking=thinking, + web_search_options=web_search_options, + shared_session=shared_session, + **kwargs, + ) api_base = kwargs.get("api_base", None) mock_response: Optional[MOCK_RESPONSE_TYPE] = kwargs.get("mock_response", None) mock_tool_calls = kwargs.get("mock_tool_calls", None) @@ -4227,6 +4273,71 @@ async def acompletion_with_retries(*args, **kwargs): return await retryer(original_function, *args, **kwargs) +def responses_with_retries(*args, **kwargs): + """ + Executes a litellm.responses() with retries + """ + try: + import tenacity + except Exception as e: + raise Exception( + f"tenacity import failed please run `pip install tenacity`. Error{e}" + ) + + from litellm.responses.main import responses + + num_retries = kwargs.pop("num_retries", 3) + # reset retries in .responses() + kwargs["max_retries"] = 0 + kwargs["num_retries"] = 0 + retry_strategy: Literal["exponential_backoff_retry", "constant_retry"] = kwargs.pop( + "retry_strategy", "constant_retry" + ) # type: ignore + original_function = kwargs.pop("original_function", responses) + if retry_strategy == "exponential_backoff_retry": + retryer = tenacity.Retrying( + wait=tenacity.wait_exponential(multiplier=1, max=10), + stop=tenacity.stop_after_attempt(num_retries), + reraise=True, + ) + else: + retryer = tenacity.Retrying( + stop=tenacity.stop_after_attempt(num_retries), reraise=True + ) + return retryer(original_function, *args, **kwargs) + + +async def aresponses_with_retries(*args, **kwargs): + """ + Executes a litellm.aresponses() with retries + """ + try: + import tenacity + except Exception as e: + raise Exception( + f"tenacity import failed please run `pip install tenacity`. Error{e}" + ) + + from litellm.responses.main import aresponses + + num_retries = kwargs.pop("num_retries", 3) + kwargs["max_retries"] = 0 + kwargs["num_retries"] = 0 + retry_strategy = kwargs.pop("retry_strategy", "constant_retry") + original_function = kwargs.pop("original_function", aresponses) + if retry_strategy == "exponential_backoff_retry": + retryer = tenacity.AsyncRetrying( + wait=tenacity.wait_exponential(multiplier=1, max=10), + stop=tenacity.stop_after_attempt(num_retries), + reraise=True, + ) + else: + retryer = tenacity.AsyncRetrying( + stop=tenacity.stop_after_attempt(num_retries), reraise=True + ) + return await retryer(original_function, *args, **kwargs) + + ### EMBEDDING ENDPOINTS #################### @client async def aembedding(*args, **kwargs) -> EmbeddingResponse: diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index f818a2c82e..cd4187ff77 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -1644,7 +1644,7 @@ "cache_read_input_token_cost": 1.4e-07, "input_cost_per_token": 1.38e-06, "litellm_provider": "azure", - "max_input_tokens": 272000, + "max_input_tokens": 128000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -1944,7 +1944,7 @@ "cache_read_input_token_cost": 1.25e-07, "input_cost_per_token": 1.25e-06, "litellm_provider": "azure", - "max_input_tokens": 272000, + "max_input_tokens": 128000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -3092,9 +3092,9 @@ "cache_read_input_token_cost": 1.25e-07, "input_cost_per_token": 1.25e-06, "litellm_provider": "azure", - "max_input_tokens": 272000, - "max_output_tokens": 128000, - "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 16384, + "max_tokens": 16384, "mode": "chat", "output_cost_per_token": 1e-05, "source": "https://azure.microsoft.com/en-us/blog/gpt-5-in-azure-ai-foundry-the-future-of-ai-apps-and-agents-starts-here/", @@ -3377,7 +3377,7 @@ "cache_read_input_token_cost": 1.25e-07, "input_cost_per_token": 1.25e-06, "litellm_provider": "azure", - "max_input_tokens": 272000, + "max_input_tokens": 128000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -3440,7 +3440,7 @@ "cache_read_input_token_cost": 1.25e-07, "input_cost_per_token": 1.25e-06, "litellm_provider": "azure", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "responses", @@ -3500,7 +3500,7 @@ "cache_read_input_token_cost": 1.75e-07, "input_cost_per_token": 1.75e-06, "litellm_provider": "azure", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -3535,7 +3535,7 @@ "input_cost_per_token": 1.75e-06, "input_cost_per_token_priority": 3.5e-06, "litellm_provider": "azure", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -3634,10 +3634,41 @@ "supports_tool_choice": true, "supports_vision": true }, + "azure/gpt-5.2-codex": { + "cache_read_input_token_cost": 1.75e-07, + "input_cost_per_token": 1.75e-06, + "litellm_provider": "azure", + "max_input_tokens": 128000, + "max_output_tokens": 16384, + "max_tokens": 16384, + "mode": "chat", + "output_cost_per_token": 1.4e-05, + "supported_endpoints": [ + "/v1/chat/completions", + "/v1/responses" + ], + "supported_modalities": [ + "text", + "image" + ], + "supported_output_modalities": [ + "text" + ], + "supports_function_calling": true, + "supports_native_streaming": true, + "supports_parallel_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_system_messages": true, + "supports_tool_choice": true, + "supports_vision": true + }, "azure/gpt-5.2-pro": { "input_cost_per_token": 2.1e-05, "litellm_provider": "azure", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "responses", @@ -3668,7 +3699,7 @@ "azure/gpt-5.2-pro-2025-12-11": { "input_cost_per_token": 2.1e-05, "litellm_provider": "azure", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "responses", @@ -4684,7 +4715,7 @@ "cache_read_input_token_cost": 1.4e-07, "input_cost_per_token": 1.38e-06, "litellm_provider": "azure", - "max_input_tokens": 272000, + "max_input_tokens": 128000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -5427,28 +5458,28 @@ "supports_web_search": true }, "azure_ai/grok-3": { - "input_cost_per_token": 3.3e-06, + "input_cost_per_token": 3e-06, "litellm_provider": "azure_ai", "max_input_tokens": 131072, "max_output_tokens": 131072, "max_tokens": 131072, "mode": "chat", - "output_cost_per_token": 1.65e-05, - "source": "https://devblogs.microsoft.com/foundry/announcing-grok-3-and-grok-3-mini-on-azure-ai-foundry/", + "output_cost_per_token": 1.5e-05, + "source": "https://azure.microsoft.com/en-us/pricing/details/ai-foundry-models/grok/", "supports_function_calling": true, "supports_response_schema": false, "supports_tool_choice": true, "supports_web_search": true }, "azure_ai/grok-3-mini": { - "input_cost_per_token": 2.75e-07, + "input_cost_per_token": 2.5e-07, "litellm_provider": "azure_ai", "max_input_tokens": 131072, "max_output_tokens": 131072, "max_tokens": 131072, "mode": "chat", - "output_cost_per_token": 1.38e-06, - "source": "https://devblogs.microsoft.com/foundry/announcing-grok-3-and-grok-3-mini-on-azure-ai-foundry/", + "output_cost_per_token": 1.27e-06, + "source": "https://azure.microsoft.com/en-us/pricing/details/ai-foundry-models/grok/", "supports_function_calling": true, "supports_reasoning": true, "supports_response_schema": false, @@ -5456,22 +5487,22 @@ "supports_web_search": true }, "azure_ai/grok-4": { - "input_cost_per_token": 5.5e-06, + "input_cost_per_token": 3e-06, "litellm_provider": "azure_ai", "max_input_tokens": 131072, "max_output_tokens": 131072, "max_tokens": 131072, "mode": "chat", - "output_cost_per_token": 2.75e-05, - "source": "https://azure.microsoft.com/en-us/blog/grok-4-is-now-available-in-azure-ai-foundry-unlock-frontier-intelligence-and-business-ready-capabilities/", + "output_cost_per_token": 1.5e-05, + "source": "https://azure.microsoft.com/en-us/pricing/details/ai-foundry-models/grok/", "supports_function_calling": true, "supports_response_schema": true, "supports_tool_choice": true, "supports_web_search": true }, "azure_ai/grok-4-fast-non-reasoning": { - "input_cost_per_token": 4.3e-07, - "output_cost_per_token": 1.73e-06, + "input_cost_per_token": 2e-07, + "output_cost_per_token": 5e-07, "litellm_provider": "azure_ai", "max_input_tokens": 131072, "max_output_tokens": 131072, @@ -5483,28 +5514,28 @@ "supports_web_search": true }, "azure_ai/grok-4-fast-reasoning": { - "input_cost_per_token": 4.3e-07, - "output_cost_per_token": 1.73e-06, + "input_cost_per_token": 2e-07, + "output_cost_per_token": 5e-07, "litellm_provider": "azure_ai", "max_input_tokens": 131072, "max_output_tokens": 131072, "max_tokens": 131072, "mode": "chat", - "source": "https://techcommunity.microsoft.com/blog/azure-ai-foundry-blog/announcing-the-grok-4-fast-models-from-xai-now-available-in-azure-ai-foundry/4456701", + "source": "https://azure.microsoft.com/en-us/pricing/details/ai-foundry-models/grok/", "supports_function_calling": true, "supports_response_schema": true, "supports_tool_choice": true, "supports_web_search": true }, "azure_ai/grok-code-fast-1": { - "input_cost_per_token": 3.5e-06, + "input_cost_per_token": 2e-07, "litellm_provider": "azure_ai", "max_input_tokens": 131072, "max_output_tokens": 131072, "max_tokens": 131072, "mode": "chat", - "output_cost_per_token": 1.75e-05, - "source": "https://azure.microsoft.com/en-us/blog/grok-4-is-now-available-in-azure-ai-foundry-unlock-frontier-intelligence-and-business-ready-capabilities/", + "output_cost_per_token": 1.5e-06, + "source": "https://azure.microsoft.com/en-us/pricing/details/ai-foundry-models/grok/", "supports_function_calling": true, "supports_response_schema": true, "supports_tool_choice": true, @@ -6616,6 +6647,20 @@ "supports_tool_choice": true }, "cerebras/zai-glm-4.6": { + "deprecation_date": "2026-01-20", + "input_cost_per_token": 2.25e-06, + "litellm_provider": "cerebras", + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 2.75e-06, + "source": "https://www.cerebras.ai/pricing", + "supports_function_calling": true, + "supports_reasoning": true, + "supports_tool_choice": true + }, + "cerebras/zai-glm-4.7": { "input_cost_per_token": 2.25e-06, "litellm_provider": "cerebras", "max_input_tokens": 128000, @@ -7813,14 +7858,14 @@ "supports_vision": true }, "deepseek-chat": { - "cache_read_input_token_cost": 6e-08, - "input_cost_per_token": 6e-07, + "cache_read_input_token_cost": 2.8e-08, + "input_cost_per_token": 2.8e-07, "litellm_provider": "deepseek", "max_input_tokens": 131072, "max_output_tokens": 8192, "max_tokens": 8192, "mode": "chat", - "output_cost_per_token": 1.7e-06, + "output_cost_per_token": 4.2e-07, "source": "https://api-docs.deepseek.com/quick_start/pricing", "supported_endpoints": [ "/v1/chat/completions" @@ -7834,14 +7879,14 @@ "supports_tool_choice": true }, "deepseek-reasoner": { - "cache_read_input_token_cost": 6e-08, - "input_cost_per_token": 6e-07, + "cache_read_input_token_cost": 2.8e-08, + "input_cost_per_token": 2.8e-07, "litellm_provider": "deepseek", "max_input_tokens": 131072, "max_output_tokens": 65536, "max_tokens": 65536, "mode": "chat", - "output_cost_per_token": 1.7e-06, + "output_cost_per_token": 4.2e-07, "source": "https://api-docs.deepseek.com/quick_start/pricing", "supported_endpoints": [ "/v1/chat/completions" @@ -8610,7 +8655,7 @@ "input_cost_per_token": 1.24999e-06, "input_dbu_cost_per_token": 1.7857e-05, "litellm_provider": "databricks", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "metadata": { @@ -8625,7 +8670,7 @@ "input_cost_per_token": 1.24999e-06, "input_dbu_cost_per_token": 1.7857e-05, "litellm_provider": "databricks", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "metadata": { @@ -8640,7 +8685,7 @@ "input_cost_per_token": 2.4997000000000006e-07, "input_dbu_cost_per_token": 3.571e-06, "litellm_provider": "databricks", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "metadata": { @@ -8655,7 +8700,7 @@ "input_cost_per_token": 4.998e-08, "input_dbu_cost_per_token": 7.14e-07, "litellm_provider": "databricks", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "metadata": { @@ -10045,15 +10090,15 @@ }, "deepseek/deepseek-chat": { "cache_creation_input_token_cost": 0.0, - "cache_read_input_token_cost": 7e-08, - "input_cost_per_token": 2.7e-07, - "input_cost_per_token_cache_hit": 7e-08, + "cache_read_input_token_cost": 2.8e-08, + "input_cost_per_token": 2.8e-07, + "input_cost_per_token_cache_hit": 2.8e-08, "litellm_provider": "deepseek", - "max_input_tokens": 65536, + "max_input_tokens": 128000, "max_output_tokens": 8192, "max_tokens": 8192, "mode": "chat", - "output_cost_per_token": 1.1e-06, + "output_cost_per_token": 4.2e-07, "supports_assistant_prefill": true, "supports_function_calling": true, "supports_prompt_caching": true, @@ -10089,14 +10134,15 @@ "supports_tool_choice": true }, "deepseek/deepseek-reasoner": { - "input_cost_per_token": 5.5e-07, - "input_cost_per_token_cache_hit": 1.4e-07, + "cache_read_input_token_cost": 2.8e-08, + "input_cost_per_token": 2.8e-07, + "input_cost_per_token_cache_hit": 2.8e-08, "litellm_provider": "deepseek", - "max_input_tokens": 65536, + "max_input_tokens": 128000, "max_output_tokens": 8192, "max_tokens": 8192, "mode": "chat", - "output_cost_per_token": 2.19e-06, + "output_cost_per_token": 4.2e-07, "supports_assistant_prefill": true, "supports_function_calling": true, "supports_prompt_caching": true, @@ -12996,6 +13042,7 @@ }, "gemini-2.5-pro": { "cache_read_input_token_cost": 1.25e-07, + "cache_read_input_token_cost_above_200k_tokens": 2.5e-07, "cache_creation_input_token_cost_above_200k_tokens": 2.5e-07, "input_cost_per_token": 1.25e-06, "input_cost_per_token_above_200k_tokens": 2.5e-06, @@ -13178,7 +13225,8 @@ "supports_web_search": true }, "gemini-2.5-pro-exp-03-25": { - "cache_read_input_token_cost": 3.125e-07, + "cache_read_input_token_cost": 1.25e-07, + "cache_read_input_token_cost_above_200k_tokens": 2.5e-07, "input_cost_per_token": 1.25e-06, "input_cost_per_token_above_200k_tokens": 2.5e-06, "litellm_provider": "vertex_ai-language-models", @@ -13222,7 +13270,8 @@ }, "gemini-2.5-pro-preview-03-25": { "deprecation_date": "2025-12-02", - "cache_read_input_token_cost": 3.125e-07, + "cache_read_input_token_cost": 1.25e-07, + "cache_read_input_token_cost_above_200k_tokens": 2.5e-07, "input_cost_per_audio_token": 1.25e-06, "input_cost_per_token": 1.25e-06, "input_cost_per_token_above_200k_tokens": 2.5e-06, @@ -13268,7 +13317,8 @@ }, "gemini-2.5-pro-preview-05-06": { "deprecation_date": "2025-12-02", - "cache_read_input_token_cost": 3.125e-07, + "cache_read_input_token_cost": 1.25e-07, + "cache_read_input_token_cost_above_200k_tokens": 2.5e-07, "input_cost_per_audio_token": 1.25e-06, "input_cost_per_token": 1.25e-06, "input_cost_per_token_above_200k_tokens": 2.5e-06, @@ -13316,7 +13366,8 @@ "supports_web_search": true }, "gemini-2.5-pro-preview-06-05": { - "cache_read_input_token_cost": 3.125e-07, + "cache_read_input_token_cost": 1.25e-07, + "cache_read_input_token_cost_above_200k_tokens": 2.5e-07, "input_cost_per_audio_token": 1.25e-06, "input_cost_per_token": 1.25e-06, "input_cost_per_token_above_200k_tokens": 2.5e-06, @@ -13361,7 +13412,8 @@ "supports_web_search": true }, "gemini-2.5-pro-preview-tts": { - "cache_read_input_token_cost": 3.125e-07, + "cache_read_input_token_cost": 1.25e-07, + "cache_read_input_token_cost_above_200k_tokens": 2.5e-07, "input_cost_per_audio_token": 7e-07, "input_cost_per_token": 1.25e-06, "input_cost_per_token_above_200k_tokens": 2.5e-06, @@ -14850,7 +14902,8 @@ "tpm": 250000 }, "gemini/gemini-2.5-pro": { - "cache_read_input_token_cost": 3.125e-07, + "cache_read_input_token_cost": 1.25e-07, + "cache_read_input_token_cost_above_200k_tokens": 2.5e-07, "input_cost_per_token": 1.25e-06, "input_cost_per_token_above_200k_tokens": 2.5e-06, "litellm_provider": "gemini", @@ -15112,7 +15165,8 @@ }, "gemini/gemini-2.5-pro-preview-03-25": { "deprecation_date": "2025-12-02", - "cache_read_input_token_cost": 3.125e-07, + "cache_read_input_token_cost": 1.25e-07, + "cache_read_input_token_cost_above_200k_tokens": 2.5e-07, "input_cost_per_audio_token": 7e-07, "input_cost_per_token": 1.25e-06, "input_cost_per_token_above_200k_tokens": 2.5e-06, @@ -15153,7 +15207,8 @@ }, "gemini/gemini-2.5-pro-preview-05-06": { "deprecation_date": "2025-12-02", - "cache_read_input_token_cost": 3.125e-07, + "cache_read_input_token_cost": 1.25e-07, + "cache_read_input_token_cost_above_200k_tokens": 2.5e-07, "input_cost_per_audio_token": 7e-07, "input_cost_per_token": 1.25e-06, "input_cost_per_token_above_200k_tokens": 2.5e-06, @@ -15194,7 +15249,8 @@ "tpm": 10000000 }, "gemini/gemini-2.5-pro-preview-06-05": { - "cache_read_input_token_cost": 3.125e-07, + "cache_read_input_token_cost": 1.25e-07, + "cache_read_input_token_cost_above_200k_tokens": 2.5e-07, "input_cost_per_audio_token": 7e-07, "input_cost_per_token": 1.25e-06, "input_cost_per_token_above_200k_tokens": 2.5e-06, @@ -15235,7 +15291,8 @@ "tpm": 10000000 }, "gemini/gemini-2.5-pro-preview-tts": { - "cache_read_input_token_cost": 3.125e-07, + "cache_read_input_token_cost": 1.25e-07, + "cache_read_input_token_cost_above_200k_tokens": 2.5e-07, "input_cost_per_audio_token": 7e-07, "input_cost_per_token": 1.25e-06, "input_cost_per_token_above_200k_tokens": 2.5e-06, @@ -15875,6 +15932,64 @@ "max_tokens": 8191, "mode": "embedding" }, + "chatgpt/gpt-5.2-codex": { + "litellm_provider": "chatgpt", + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "responses", + "supported_endpoints": [ + "/v1/responses" + ], + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_response_schema": true, + "supports_vision": true + }, + "chatgpt/gpt-5.1-codex-max": { + "litellm_provider": "chatgpt", + "max_input_tokens": 128000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "responses", + "supported_endpoints": [ + "/v1/responses" + ], + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_response_schema": true, + "supports_vision": true + }, + "chatgpt/gpt-5.1-codex-mini": { + "litellm_provider": "chatgpt", + "max_input_tokens": 128000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "responses", + "supported_endpoints": [ + "/v1/responses" + ], + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_response_schema": true, + "supports_vision": true + }, + "chatgpt/gpt-5.2": { + "litellm_provider": "chatgpt", + "max_input_tokens": 128000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "supported_endpoints": [ + "/v1/chat/completions", + "/v1/messages", + "/v1/responses" + ], + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_response_schema": true, + "supports_vision": true + }, "gigachat/GigaChat-2-Lite": { "input_cost_per_token": 0.0, "litellm_provider": "gigachat", @@ -17614,7 +17729,7 @@ "input_cost_per_token": 1.75e-06, "input_cost_per_token_priority": 3.5e-06, "litellm_provider": "openai", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -17651,7 +17766,7 @@ "input_cost_per_token": 1.75e-06, "input_cost_per_token_priority": 3.5e-06, "litellm_provider": "openai", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -17719,7 +17834,7 @@ "gpt-5.2-pro": { "input_cost_per_token": 2.1e-05, "litellm_provider": "openai", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "responses", @@ -17750,7 +17865,7 @@ "gpt-5.2-pro-2025-12-11": { "input_cost_per_token": 2.1e-05, "litellm_provider": "openai", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "responses", @@ -17782,7 +17897,7 @@ "input_cost_per_token": 1.5e-05, "input_cost_per_token_batches": 7.5e-06, "litellm_provider": "openai", - "max_input_tokens": 400000, + "max_input_tokens": 128000, "max_output_tokens": 272000, "max_tokens": 272000, "mode": "responses", @@ -17815,7 +17930,7 @@ "input_cost_per_token": 1.5e-05, "input_cost_per_token_batches": 7.5e-06, "litellm_provider": "openai", - "max_input_tokens": 400000, + "max_input_tokens": 128000, "max_output_tokens": 272000, "max_tokens": 272000, "mode": "responses", @@ -17887,9 +18002,9 @@ "cache_read_input_token_cost": 1.25e-07, "input_cost_per_token": 1.25e-06, "litellm_provider": "openai", - "max_input_tokens": 272000, - "max_output_tokens": 128000, - "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 16384, + "max_tokens": 16384, "mode": "chat", "output_cost_per_token": 1e-05, "supported_endpoints": [ @@ -18014,7 +18129,7 @@ "cache_read_input_token_cost": 1.25e-07, "input_cost_per_token": 1.25e-06, "litellm_provider": "openai", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "responses", @@ -18073,6 +18188,39 @@ "supports_tool_choice": true, "supports_vision": true }, + "gpt-5.2-codex": { + "cache_read_input_token_cost": 1.75e-07, + "cache_read_input_token_cost_priority": 3.5e-07, + "input_cost_per_token": 1.75e-06, + "input_cost_per_token_priority": 3.5e-06, + "litellm_provider": "openai", + "max_input_tokens": 400000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "responses", + "output_cost_per_token": 1.4e-05, + "output_cost_per_token_priority": 2.8e-05, + "supported_endpoints": [ + "/v1/responses" + ], + "supported_modalities": [ + "text", + "image" + ], + "supported_output_modalities": [ + "text" + ], + "supports_function_calling": true, + "supports_native_streaming": true, + "supports_parallel_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_system_messages": false, + "supports_tool_choice": true, + "supports_vision": true + }, "gpt-5-mini": { "cache_read_input_token_cost": 2.5e-08, "cache_read_input_token_cost_flex": 1.25e-08, @@ -23206,9 +23354,9 @@ "cache_read_input_token_cost": 1.25e-07, "input_cost_per_token": 1.25e-06, "litellm_provider": "openrouter", - "max_input_tokens": 272000, - "max_output_tokens": 128000, - "max_tokens": 128000, + "max_input_tokens": 128000, + "max_output_tokens": 16384, + "max_tokens": 16384, "mode": "chat", "output_cost_per_token": 1e-05, "supported_modalities": [ @@ -23240,6 +23388,25 @@ "supports_reasoning": true, "supports_tool_choice": true }, + "openrouter/openai/gpt-5.2-codex": { + "cache_read_input_token_cost": 1.75e-07, + "input_cost_per_token": 1.75e-06, + "litellm_provider": "openrouter", + "max_input_tokens": 400000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 1.4e-05, + "supported_modalities": [ + "text", + "image" + ], + "supported_output_modalities": [ + "text" + ], + "supports_reasoning": true, + "supports_tool_choice": true + }, "openrouter/openai/gpt-5": { "cache_read_input_token_cost": 1.25e-07, "input_cost_per_token": 1.25e-06, @@ -23302,7 +23469,7 @@ "cache_read_input_token_cost": 1.75e-07, "input_cost_per_token": 1.75e-06, "litellm_provider": "openrouter", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -23332,7 +23499,7 @@ "input_cost_per_image": 0, "input_cost_per_token": 2.1e-05, "litellm_provider": "openrouter", - "max_input_tokens": 400000, + "max_input_tokens": 272000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", @@ -24452,7 +24619,7 @@ }, "replicate/openai/gpt-5": { "input_cost_per_token": 1.25e-06, - "output_cost_per_token": 1.0e-05, + "output_cost_per_token": 1e-05, "litellm_provider": "replicate", "mode": "chat", "supports_function_calling": true, @@ -24463,7 +24630,7 @@ "supports_response_schema": true }, "replicateopenai/gpt-oss-20b": { - "input_cost_per_token": 9.0e-08, + "input_cost_per_token": 9e-08, "output_cost_per_token": 3.6e-07, "litellm_provider": "replicate", "mode": "chat", @@ -24471,8 +24638,8 @@ "supports_system_messages": true }, "replicate/anthropic/claude-4.5-haiku": { - "input_cost_per_token": 1.0e-06, - "output_cost_per_token": 5.0e-06, + "input_cost_per_token": 1e-06, + "output_cost_per_token": 5e-06, "litellm_provider": "replicate", "mode": "chat", "supports_function_calling": true, @@ -24484,7 +24651,7 @@ "supports_prompt_caching": true }, "replicate/ibm-granite/granite-3.3-8b-instruct": { - "input_cost_per_token": 3.0e-08, + "input_cost_per_token": 3e-08, "output_cost_per_token": 2.5e-07, "litellm_provider": "replicate", "mode": "chat", @@ -24493,7 +24660,7 @@ }, "replicate/openai/gpt-4o": { "input_cost_per_token": 2.5e-06, - "output_cost_per_token": 1.0e-05, + "output_cost_per_token": 1e-05, "litellm_provider": "replicate", "mode": "chat", "supports_function_calling": true, @@ -24506,9 +24673,9 @@ "supports_audio_output": true }, "replicate/openai/o4-mini": { - "input_cost_per_token": 1.0e-06, - "output_cost_per_token": 4.0e-06, - "output_cost_per_reasoning_token": 4.0e-06, + "input_cost_per_token": 1e-06, + "output_cost_per_token": 4e-06, + "output_cost_per_reasoning_token": 4e-06, "litellm_provider": "replicate", "mode": "chat", "supports_reasoning": true, @@ -24525,8 +24692,8 @@ }, "replicate/openai/o1": { "input_cost_per_token": 1.5e-05, - "output_cost_per_token": 6.0e-05, - "output_cost_per_reasoning_token": 6.0e-05, + "output_cost_per_token": 6e-05, + "output_cost_per_reasoning_token": 6e-05, "litellm_provider": "replicate", "mode": "chat", "supports_reasoning": true, @@ -24534,7 +24701,7 @@ }, "replicate/openai/gpt-4o-mini": { "input_cost_per_token": 1.5e-07, - "output_cost_per_token": 6.0e-07, + "output_cost_per_token": 6e-07, "litellm_provider": "replicate", "mode": "chat", "supports_function_calling": true, @@ -24553,7 +24720,7 @@ "supports_system_messages": true }, "replicate/anthropic/claude-4-sonnet": { - "input_cost_per_token": 3.0e-06, + "input_cost_per_token": 3e-06, "output_cost_per_token": 1.5e-05, "litellm_provider": "replicate", "mode": "chat", @@ -24577,7 +24744,7 @@ "supports_system_messages": true }, "replicate/anthropic/claude-3.7-sonnet": { - "input_cost_per_token": 3.0e-06, + "input_cost_per_token": 3e-06, "output_cost_per_token": 1.5e-05, "litellm_provider": "replicate", "mode": "chat", @@ -24590,8 +24757,8 @@ "supports_prompt_caching": true }, "replicate/anthropic/claude-3.5-haiku": { - "input_cost_per_token": 1.0e-06, - "output_cost_per_token": 5.0e-06, + "input_cost_per_token": 1e-06, + "output_cost_per_token": 5e-06, "litellm_provider": "replicate", "mode": "chat", "supports_function_calling": true, @@ -24616,7 +24783,7 @@ "supports_prompt_caching": true }, "replicate/google/gemini-3-pro": { - "input_cost_per_token": 2.0e-06, + "input_cost_per_token": 2e-06, "output_cost_per_token": 1.2e-05, "litellm_provider": "replicate", "mode": "chat", @@ -24628,7 +24795,7 @@ "supports_response_schema": true }, "replicate/anthropic/claude-4.5-sonnet": { - "input_cost_per_token": 3.0e-06, + "input_cost_per_token": 3e-06, "output_cost_per_token": 1.5e-05, "litellm_provider": "replicate", "mode": "chat", @@ -24641,8 +24808,8 @@ "supports_prompt_caching": true }, "replicate/openai/gpt-4.1": { - "input_cost_per_token": 2.0e-06, - "output_cost_per_token": 8.0e-06, + "input_cost_per_token": 2e-06, + "output_cost_per_token": 8e-06, "litellm_provider": "replicate", "mode": "chat", "supports_function_calling": true, @@ -24653,15 +24820,15 @@ "supports_response_schema": true }, "replicate/openai/gpt-4.1-nano": { - "input_cost_per_token": 1.0e-07, - "output_cost_per_token": 4.0e-07, + "input_cost_per_token": 1e-07, + "output_cost_per_token": 4e-07, "litellm_provider": "replicate", "mode": "chat", "supports_function_calling": true, "supports_system_messages": true }, "replicate/openai/gpt-4.1-mini": { - "input_cost_per_token": 4.0e-07, + "input_cost_per_token": 4e-07, "output_cost_per_token": 1.6e-06, "litellm_provider": "replicate", "mode": "chat", @@ -24673,8 +24840,8 @@ "supports_response_schema": true }, "replicate/openai/gpt-5-nano": { - "input_cost_per_token": 5.0e-08, - "output_cost_per_token": 4.0e-07, + "input_cost_per_token": 5e-08, + "output_cost_per_token": 4e-07, "litellm_provider": "replicate", "mode": "chat", "supports_function_calling": true, @@ -24682,7 +24849,7 @@ }, "replicate/openai/gpt-5-mini": { "input_cost_per_token": 2.5e-07, - "output_cost_per_token": 2.0e-06, + "output_cost_per_token": 2e-06, "litellm_provider": "replicate", "mode": "chat", "supports_function_calling": true, @@ -24734,8 +24901,8 @@ }, "replicate/deepseek-ai/deepseek-r1": { "input_cost_per_token": 3.75e-06, - "output_cost_per_token": 1.0e-05, - "output_cost_per_reasoning_token": 1.0e-05, + "output_cost_per_token": 1e-05, + "output_cost_per_reasoning_token": 1e-05, "litellm_provider": "replicate", "mode": "chat", "max_input_tokens": 65536, @@ -25448,13 +25615,13 @@ "litellm_provider": "bedrock", "max_input_tokens": 77, "mode": "image_edit", - "output_cost_per_image": 0.4 + "output_cost_per_image": 0.40 }, "stability.stable-creative-upscale-v1:0": { "litellm_provider": "bedrock", "max_input_tokens": 77, "mode": "image_edit", - "output_cost_per_image": 0.6 + "output_cost_per_image": 0.60 }, "stability.stable-fast-upscale-v1:0": { "litellm_provider": "bedrock", @@ -28704,13 +28871,13 @@ "supports_web_search": true }, "vertex_ai/zai-org/glm-4.7-maas": { - "input_cost_per_token": 3e-07, + "input_cost_per_token": 6e-07, "litellm_provider": "vertex_ai-zai_models", "max_input_tokens": 200000, "max_output_tokens": 128000, "max_tokens": 128000, "mode": "chat", - "output_cost_per_token": 1.2e-06, + "output_cost_per_token": 2.2e-06, "source": "https://cloud.google.com/vertex-ai/generative-ai/pricing#partner-models", "supports_function_calling": true, "supports_reasoning": true, @@ -32552,8 +32719,8 @@ "novita/deepseek/deepseek-v3.2": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.69e-03, - "output_cost_per_token": 4e-03, + "input_cost_per_token": 2.69e-07, + "output_cost_per_token": 4e-07, "max_input_tokens": 163840, "max_output_tokens": 65536, "max_tokens": 65536, @@ -32562,15 +32729,15 @@ "supports_tool_choice": true, "supports_system_messages": true, "supports_response_schema": true, - "cache_read_input_token_cost": 1.345e-03, - "input_cost_per_token_cache_hit": 1.345e-03, + "cache_read_input_token_cost": 1.345e-07, + "input_cost_per_token_cache_hit": 1.345e-07, "supports_reasoning": true }, "novita/minimax/minimax-m2.1": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 3e-03, - "output_cost_per_token": 1.2e-02, + "input_cost_per_token": 3e-07, + "output_cost_per_token": 1.2e-06, "max_input_tokens": 204800, "max_output_tokens": 131072, "max_tokens": 131072, @@ -32579,15 +32746,14 @@ "supports_tool_choice": true, "supports_system_messages": true, "supports_response_schema": true, - "cache_read_input_token_cost": 3e-04, - "input_cost_per_token_cache_hit": 3e-04, - "supports_reasoning": true + "cache_read_input_token_cost": 3e-08, + "input_cost_per_token_cache_hit": 3e-08 }, "novita/zai-org/glm-4.7": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 6e-03, - "output_cost_per_token": 2.2e-02, + "input_cost_per_token": 6e-07, + "output_cost_per_token": 2.2e-06, "max_input_tokens": 204800, "max_output_tokens": 131072, "max_tokens": 131072, @@ -32596,15 +32762,15 @@ "supports_tool_choice": true, "supports_system_messages": true, "supports_response_schema": true, - "cache_read_input_token_cost": 1.1e-03, - "input_cost_per_token_cache_hit": 1.1e-03, + "cache_read_input_token_cost": 1.1e-07, + "input_cost_per_token_cache_hit": 1.1e-07, "supports_reasoning": true }, "novita/xiaomimimo/mimo-v2-flash": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1e-03, - "output_cost_per_token": 3e-03, + "input_cost_per_token": 1e-07, + "output_cost_per_token": 3e-07, "max_input_tokens": 262144, "max_output_tokens": 32000, "max_tokens": 32000, @@ -32613,15 +32779,15 @@ "supports_tool_choice": true, "supports_system_messages": true, "supports_response_schema": true, - "cache_read_input_token_cost": 2e-04, - "input_cost_per_token_cache_hit": 2e-04, + "cache_read_input_token_cost": 2e-08, + "input_cost_per_token_cache_hit": 2e-08, "supports_reasoning": true }, "novita/zai-org/autoglm-phone-9b-multilingual": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 3.5e-04, - "output_cost_per_token": 1.38e-03, + "input_cost_per_token": 3.5e-08, + "output_cost_per_token": 1.38e-07, "max_input_tokens": 65536, "max_output_tokens": 65536, "max_tokens": 65536, @@ -32631,8 +32797,8 @@ "novita/moonshotai/kimi-k2-thinking": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 4.8e-03, - "output_cost_per_token": 2e-02, + "input_cost_per_token": 6e-07, + "output_cost_per_token": 2.5e-06, "max_input_tokens": 262144, "max_output_tokens": 262144, "max_tokens": 262144, @@ -32646,8 +32812,8 @@ "novita/minimax/minimax-m2": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.4e-03, - "output_cost_per_token": 9.6e-03, + "input_cost_per_token": 3e-07, + "output_cost_per_token": 1.2e-06, "max_input_tokens": 204800, "max_output_tokens": 131072, "max_tokens": 131072, @@ -32655,15 +32821,15 @@ "supports_parallel_function_calling": true, "supports_tool_choice": true, "supports_system_messages": true, - "cache_read_input_token_cost": 2.4e-04, - "input_cost_per_token_cache_hit": 2.4e-04, + "cache_read_input_token_cost": 3e-08, + "input_cost_per_token_cache_hit": 3e-08, "supports_reasoning": true }, "novita/paddlepaddle/paddleocr-vl": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.6e-04, - "output_cost_per_token": 1.6e-04, + "input_cost_per_token": 2e-08, + "output_cost_per_token": 2e-08, "max_input_tokens": 16384, "max_output_tokens": 16384, "max_tokens": 16384, @@ -32673,8 +32839,8 @@ "novita/deepseek/deepseek-v3.2-exp": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.16e-03, - "output_cost_per_token": 3.28e-03, + "input_cost_per_token": 2.7e-07, + "output_cost_per_token": 4.1e-07, "max_input_tokens": 163840, "max_output_tokens": 65536, "max_tokens": 65536, @@ -32688,8 +32854,8 @@ "novita/qwen/qwen3-vl-235b-a22b-thinking": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 7.84e-03, - "output_cost_per_token": 3.16e-02, + "input_cost_per_token": 9.8e-07, + "output_cost_per_token": 3.95e-06, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -32700,8 +32866,8 @@ "novita/zai-org/glm-4.6v": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 3e-03, - "output_cost_per_token": 9e-03, + "input_cost_per_token": 3e-07, + "output_cost_per_token": 9e-07, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -32711,15 +32877,15 @@ "supports_vision": true, "supports_system_messages": true, "supports_response_schema": true, - "cache_read_input_token_cost": 5.5e-04, - "input_cost_per_token_cache_hit": 5.5e-04, + "cache_read_input_token_cost": 5.5e-08, + "input_cost_per_token_cache_hit": 5.5e-08, "supports_reasoning": true }, "novita/zai-org/glm-4.6": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 4.4e-03, - "output_cost_per_token": 1.76e-02, + "input_cost_per_token": 5.5e-07, + "output_cost_per_token": 2.2e-06, "max_input_tokens": 204800, "max_output_tokens": 131072, "max_tokens": 131072, @@ -32728,15 +32894,31 @@ "supports_tool_choice": true, "supports_system_messages": true, "supports_response_schema": true, - "cache_read_input_token_cost": 8.8e-04, - "input_cost_per_token_cache_hit": 8.8e-04, + "cache_read_input_token_cost": 1.1e-07, + "input_cost_per_token_cache_hit": 1.1e-07, "supports_reasoning": true }, + "novita/kwaipilot/kat-coder-pro": { + "litellm_provider": "novita", + "mode": "chat", + "input_cost_per_token": 3e-07, + "output_cost_per_token": 1.2e-06, + "max_input_tokens": 256000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_tool_choice": true, + "supports_system_messages": true, + "supports_response_schema": true, + "cache_read_input_token_cost": 6e-08, + "input_cost_per_token_cache_hit": 6e-08 + }, "novita/qwen/qwen3-next-80b-a3b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.2e-03, - "output_cost_per_token": 1.2e-02, + "input_cost_per_token": 1.5e-07, + "output_cost_per_token": 1.5e-06, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -32749,8 +32931,8 @@ "novita/qwen/qwen3-next-80b-a3b-thinking": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.2e-03, - "output_cost_per_token": 1.2e-02, + "input_cost_per_token": 1.5e-07, + "output_cost_per_token": 1.5e-06, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -32764,8 +32946,8 @@ "novita/deepseek/deepseek-ocr": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.4e-04, - "output_cost_per_token": 2.4e-04, + "input_cost_per_token": 3e-08, + "output_cost_per_token": 3e-08, "max_input_tokens": 8192, "max_output_tokens": 8192, "max_tokens": 8192, @@ -32777,8 +32959,8 @@ "novita/deepseek/deepseek-v3.1-terminus": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.16e-03, - "output_cost_per_token": 8e-03, + "input_cost_per_token": 2.7e-07, + "output_cost_per_token": 1e-06, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -32787,15 +32969,15 @@ "supports_tool_choice": true, "supports_system_messages": true, "supports_response_schema": true, - "cache_read_input_token_cost": 1.08e-03, - "input_cost_per_token_cache_hit": 1.08e-03, + "cache_read_input_token_cost": 1.35e-07, + "input_cost_per_token_cache_hit": 1.35e-07, "supports_reasoning": true }, "novita/qwen/qwen3-vl-235b-a22b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.4e-03, - "output_cost_per_token": 1.2e-02, + "input_cost_per_token": 3e-07, + "output_cost_per_token": 1.5e-06, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -32809,8 +32991,8 @@ "novita/qwen/qwen3-max": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.688e-02, - "output_cost_per_token": 6.76e-02, + "input_cost_per_token": 2.11e-06, + "output_cost_per_token": 8.45e-06, "max_input_tokens": 262144, "max_output_tokens": 65536, "max_tokens": 65536, @@ -32823,8 +33005,8 @@ "novita/skywork/r1v4-lite": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2e-03, - "output_cost_per_token": 6e-03, + "input_cost_per_token": 2e-07, + "output_cost_per_token": 6e-07, "max_input_tokens": 262144, "max_output_tokens": 65536, "max_tokens": 65536, @@ -32836,8 +33018,8 @@ "novita/deepseek/deepseek-v3.1": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.16e-03, - "output_cost_per_token": 8e-03, + "input_cost_per_token": 2.7e-07, + "output_cost_per_token": 1e-06, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -32846,15 +33028,15 @@ "supports_tool_choice": true, "supports_system_messages": true, "supports_response_schema": true, - "cache_read_input_token_cost": 1.08e-03, - "input_cost_per_token_cache_hit": 1.08e-03, + "cache_read_input_token_cost": 1.35e-07, + "input_cost_per_token_cache_hit": 1.35e-07, "supports_reasoning": true }, "novita/moonshotai/kimi-k2-0905": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 4.8e-03, - "output_cost_per_token": 2e-02, + "input_cost_per_token": 6e-07, + "output_cost_per_token": 2.5e-06, "max_input_tokens": 262144, "max_output_tokens": 262144, "max_tokens": 262144, @@ -32867,8 +33049,8 @@ "novita/qwen/qwen3-coder-480b-a35b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.4e-03, - "output_cost_per_token": 1.04e-02, + "input_cost_per_token": 3e-07, + "output_cost_per_token": 1.3e-06, "max_input_tokens": 262144, "max_output_tokens": 65536, "max_tokens": 65536, @@ -32881,8 +33063,8 @@ "novita/qwen/qwen3-coder-30b-a3b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 7e-04, - "output_cost_per_token": 2.7e-03, + "input_cost_per_token": 7e-08, + "output_cost_per_token": 2.7e-07, "max_input_tokens": 160000, "max_output_tokens": 32768, "max_tokens": 32768, @@ -32895,8 +33077,8 @@ "novita/openai/gpt-oss-120b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 4e-04, - "output_cost_per_token": 2e-03, + "input_cost_per_token": 5e-08, + "output_cost_per_token": 2.5e-07, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -32911,8 +33093,8 @@ "novita/moonshotai/kimi-k2-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 4.56e-03, - "output_cost_per_token": 1.84e-02, + "input_cost_per_token": 5.7e-07, + "output_cost_per_token": 2.3e-06, "max_input_tokens": 131072, "max_output_tokens": 131072, "max_tokens": 131072, @@ -32925,8 +33107,8 @@ "novita/deepseek/deepseek-v3-0324": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.16e-03, - "output_cost_per_token": 8.96e-03, + "input_cost_per_token": 2.7e-07, + "output_cost_per_token": 1.12e-06, "max_input_tokens": 163840, "max_output_tokens": 163840, "max_tokens": 163840, @@ -32935,14 +33117,14 @@ "supports_tool_choice": true, "supports_system_messages": true, "supports_response_schema": true, - "cache_read_input_token_cost": 1.08e-03, - "input_cost_per_token_cache_hit": 1.08e-03 + "cache_read_input_token_cost": 1.35e-07, + "input_cost_per_token_cache_hit": 1.35e-07 }, "novita/zai-org/glm-4.5": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 4.8e-03, - "output_cost_per_token": 1.76e-02, + "input_cost_per_token": 6e-07, + "output_cost_per_token": 2.2e-06, "max_input_tokens": 131072, "max_output_tokens": 98304, "max_tokens": 98304, @@ -32950,15 +33132,15 @@ "supports_parallel_function_calling": true, "supports_tool_choice": true, "supports_system_messages": true, - "cache_read_input_token_cost": 8.8e-04, - "input_cost_per_token_cache_hit": 8.8e-04, + "cache_read_input_token_cost": 1.1e-07, + "input_cost_per_token_cache_hit": 1.1e-07, "supports_reasoning": true }, "novita/qwen/qwen3-235b-a22b-thinking-2507": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.4e-03, - "output_cost_per_token": 2.4e-02, + "input_cost_per_token": 3e-07, + "output_cost_per_token": 3e-06, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -32971,8 +33153,8 @@ "novita/meta-llama/llama-3.1-8b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2e-04, - "output_cost_per_token": 5e-04, + "input_cost_per_token": 2e-08, + "output_cost_per_token": 5e-08, "max_input_tokens": 16384, "max_output_tokens": 16384, "max_tokens": 16384, @@ -32981,8 +33163,8 @@ "novita/google/gemma-3-12b-it": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 4e-04, - "output_cost_per_token": 8e-04, + "input_cost_per_token": 5e-08, + "output_cost_per_token": 1e-07, "max_input_tokens": 131072, "max_output_tokens": 8192, "max_tokens": 8192, @@ -32994,8 +33176,8 @@ "novita/zai-org/glm-4.5v": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 4.8e-03, - "output_cost_per_token": 1.44e-02, + "input_cost_per_token": 6e-07, + "output_cost_per_token": 1.8e-06, "max_input_tokens": 65536, "max_output_tokens": 16384, "max_tokens": 16384, @@ -33005,15 +33187,15 @@ "supports_vision": true, "supports_system_messages": true, "supports_response_schema": true, - "cache_read_input_token_cost": 8.8e-04, - "input_cost_per_token_cache_hit": 8.8e-04, + "cache_read_input_token_cost": 1.1e-07, + "input_cost_per_token_cache_hit": 1.1e-07, "supports_reasoning": true }, "novita/openai/gpt-oss-20b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 3.2e-04, - "output_cost_per_token": 1.2e-03, + "input_cost_per_token": 4e-08, + "output_cost_per_token": 1.5e-07, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -33026,8 +33208,8 @@ "novita/qwen/qwen3-235b-a22b-instruct-2507": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 7.2e-04, - "output_cost_per_token": 4.64e-03, + "input_cost_per_token": 9e-08, + "output_cost_per_token": 5.8e-07, "max_input_tokens": 131072, "max_output_tokens": 16384, "max_tokens": 16384, @@ -33040,8 +33222,8 @@ "novita/deepseek/deepseek-r1-distill-qwen-14b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.2e-03, - "output_cost_per_token": 1.2e-03, + "input_cost_per_token": 1.5e-07, + "output_cost_per_token": 1.5e-07, "max_input_tokens": 32768, "max_output_tokens": 16384, "max_tokens": 16384, @@ -33053,8 +33235,8 @@ "novita/meta-llama/llama-3.3-70b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.08e-03, - "output_cost_per_token": 3.2e-03, + "input_cost_per_token": 1.35e-07, + "output_cost_per_token": 4e-07, "max_input_tokens": 131072, "max_output_tokens": 120000, "max_tokens": 120000, @@ -33066,8 +33248,8 @@ "novita/qwen/qwen-2.5-72b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 3.04e-03, - "output_cost_per_token": 3.2e-03, + "input_cost_per_token": 3.8e-07, + "output_cost_per_token": 4e-07, "max_input_tokens": 32000, "max_output_tokens": 8192, "max_tokens": 8192, @@ -33080,8 +33262,8 @@ "novita/mistralai/mistral-nemo": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 3.2e-04, - "output_cost_per_token": 1.36e-03, + "input_cost_per_token": 4e-08, + "output_cost_per_token": 1.7e-07, "max_input_tokens": 60288, "max_output_tokens": 16000, "max_tokens": 16000, @@ -33092,8 +33274,8 @@ "novita/minimaxai/minimax-m1-80k": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 4.4e-03, - "output_cost_per_token": 1.76e-02, + "input_cost_per_token": 5.5e-07, + "output_cost_per_token": 2.2e-06, "max_input_tokens": 1000000, "max_output_tokens": 40000, "max_tokens": 40000, @@ -33106,8 +33288,8 @@ "novita/deepseek/deepseek-r1-0528": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 5.6e-03, - "output_cost_per_token": 2e-02, + "input_cost_per_token": 7e-07, + "output_cost_per_token": 2.5e-06, "max_input_tokens": 163840, "max_output_tokens": 32768, "max_tokens": 32768, @@ -33116,15 +33298,15 @@ "supports_tool_choice": true, "supports_system_messages": true, "supports_response_schema": true, - "cache_read_input_token_cost": 2.8e-03, - "input_cost_per_token_cache_hit": 2.8e-03, + "cache_read_input_token_cost": 3.5e-07, + "input_cost_per_token_cache_hit": 3.5e-07, "supports_reasoning": true }, "novita/deepseek/deepseek-r1-distill-qwen-32b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.4e-03, - "output_cost_per_token": 2.4e-03, + "input_cost_per_token": 3e-07, + "output_cost_per_token": 3e-07, "max_input_tokens": 64000, "max_output_tokens": 32000, "max_tokens": 32000, @@ -33136,8 +33318,8 @@ "novita/meta-llama/llama-3-8b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 3.2e-04, - "output_cost_per_token": 3.2e-04, + "input_cost_per_token": 4e-08, + "output_cost_per_token": 4e-08, "max_input_tokens": 8192, "max_output_tokens": 8192, "max_tokens": 8192, @@ -33146,8 +33328,8 @@ "novita/microsoft/wizardlm-2-8x22b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 4.96e-03, - "output_cost_per_token": 4.96e-03, + "input_cost_per_token": 6.2e-07, + "output_cost_per_token": 6.2e-07, "max_input_tokens": 65535, "max_output_tokens": 8000, "max_tokens": 8000, @@ -33156,8 +33338,8 @@ "novita/deepseek/deepseek-r1-0528-qwen3-8b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 4.8e-04, - "output_cost_per_token": 7.2e-04, + "input_cost_per_token": 6e-08, + "output_cost_per_token": 9e-08, "max_input_tokens": 128000, "max_output_tokens": 32000, "max_tokens": 32000, @@ -33167,8 +33349,8 @@ "novita/deepseek/deepseek-r1-distill-llama-70b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 6.4e-03, - "output_cost_per_token": 6.4e-03, + "input_cost_per_token": 8e-07, + "output_cost_per_token": 8e-07, "max_input_tokens": 8192, "max_output_tokens": 8192, "max_tokens": 8192, @@ -33180,8 +33362,8 @@ "novita/meta-llama/llama-3-70b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 5.1e-03, - "output_cost_per_token": 7.4e-03, + "input_cost_per_token": 5.1e-07, + "output_cost_per_token": 7.4e-07, "max_input_tokens": 8192, "max_output_tokens": 8000, "max_tokens": 8000, @@ -33192,8 +33374,8 @@ "novita/qwen/qwen3-235b-a22b-fp8": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.6e-03, - "output_cost_per_token": 6.4e-03, + "input_cost_per_token": 2e-07, + "output_cost_per_token": 8e-07, "max_input_tokens": 40960, "max_output_tokens": 20000, "max_tokens": 20000, @@ -33203,8 +33385,8 @@ "novita/meta-llama/llama-4-maverick-17b-128e-instruct-fp8": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.6e-03, - "output_cost_per_token": 7.2e-03, + "input_cost_per_token": 2.7e-07, + "output_cost_per_token": 8.5e-07, "max_input_tokens": 1048576, "max_output_tokens": 8192, "max_tokens": 8192, @@ -33214,8 +33396,8 @@ "novita/meta-llama/llama-4-scout-17b-16e-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 8e-04, - "output_cost_per_token": 4e-03, + "input_cost_per_token": 1.8e-07, + "output_cost_per_token": 5.9e-07, "max_input_tokens": 131072, "max_output_tokens": 131072, "max_tokens": 131072, @@ -33225,8 +33407,8 @@ "novita/nousresearch/hermes-2-pro-llama-3-8b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.4e-03, - "output_cost_per_token": 1.4e-03, + "input_cost_per_token": 1.4e-07, + "output_cost_per_token": 1.4e-07, "max_input_tokens": 8192, "max_output_tokens": 8192, "max_tokens": 8192, @@ -33237,8 +33419,8 @@ "novita/qwen/qwen2.5-vl-72b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 6.4e-03, - "output_cost_per_token": 6.4e-03, + "input_cost_per_token": 8e-07, + "output_cost_per_token": 8e-07, "max_input_tokens": 32768, "max_output_tokens": 32768, "max_tokens": 32768, @@ -33248,8 +33430,8 @@ "novita/sao10k/l3-70b-euryale-v2.1": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.48e-02, - "output_cost_per_token": 1.48e-02, + "input_cost_per_token": 1.48e-06, + "output_cost_per_token": 1.48e-06, "max_input_tokens": 8192, "max_output_tokens": 8192, "max_tokens": 8192, @@ -33261,8 +33443,8 @@ "novita/baidu/ernie-4.5-21B-a3b-thinking": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 5.6e-04, - "output_cost_per_token": 2.24e-03, + "input_cost_per_token": 7e-08, + "output_cost_per_token": 2.8e-07, "max_input_tokens": 131072, "max_output_tokens": 65536, "max_tokens": 65536, @@ -33272,8 +33454,8 @@ "novita/sao10k/l3-8b-lunaris": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 5e-04, - "output_cost_per_token": 5e-04, + "input_cost_per_token": 5e-08, + "output_cost_per_token": 5e-08, "max_input_tokens": 8192, "max_output_tokens": 8192, "max_tokens": 8192, @@ -33284,33 +33466,18 @@ "novita/baichuan/baichuan-m2-32b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 5.6e-04, - "output_cost_per_token": 5.6e-04, + "input_cost_per_token": 7e-08, + "output_cost_per_token": 7e-08, "max_input_tokens": 131072, "max_output_tokens": 131072, "max_tokens": 131072, - "supports_tool_choice": true, - "supports_system_messages": true, - "supports_response_schema": true, - "supports_reasoning": true - }, - "novita/thudm/glm-4.1v-9b-thinking": { - "litellm_provider": "novita", - "mode": "chat", - "input_cost_per_token": 2.8e-04, - "output_cost_per_token": 1.104e-03, - "max_input_tokens": 65536, - "max_output_tokens": 8000, - "max_tokens": 8000, - "supports_vision": true, - "supports_system_messages": true, - "supports_reasoning": true + "supports_system_messages": true }, "novita/baidu/ernie-4.5-vl-424b-a47b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 3.36e-03, - "output_cost_per_token": 1e-02, + "input_cost_per_token": 4.2e-07, + "output_cost_per_token": 1.25e-06, "max_input_tokens": 123000, "max_output_tokens": 16000, "max_tokens": 16000, @@ -33321,8 +33488,8 @@ "novita/baidu/ernie-4.5-300b-a47b-paddle": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.24e-03, - "output_cost_per_token": 8.8e-03, + "input_cost_per_token": 2.8e-07, + "output_cost_per_token": 1.1e-06, "max_input_tokens": 123000, "max_output_tokens": 12000, "max_tokens": 12000, @@ -33333,8 +33500,8 @@ "novita/deepseek/deepseek-prover-v2-671b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 5.6e-03, - "output_cost_per_token": 2e-02, + "input_cost_per_token": 7e-07, + "output_cost_per_token": 2.5e-06, "max_input_tokens": 160000, "max_output_tokens": 160000, "max_tokens": 160000, @@ -33343,8 +33510,8 @@ "novita/qwen/qwen3-32b-fp8": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 8e-04, - "output_cost_per_token": 3.6e-03, + "input_cost_per_token": 1e-07, + "output_cost_per_token": 4.5e-07, "max_input_tokens": 40960, "max_output_tokens": 20000, "max_tokens": 20000, @@ -33354,8 +33521,8 @@ "novita/qwen/qwen3-30b-a3b-fp8": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 7.2e-04, - "output_cost_per_token": 3.6e-03, + "input_cost_per_token": 9e-08, + "output_cost_per_token": 4.5e-07, "max_input_tokens": 40960, "max_output_tokens": 20000, "max_tokens": 20000, @@ -33365,8 +33532,8 @@ "novita/google/gemma-3-27b-it": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 9.52e-04, - "output_cost_per_token": 1.6e-03, + "input_cost_per_token": 1.19e-07, + "output_cost_per_token": 2e-07, "max_input_tokens": 98304, "max_output_tokens": 16384, "max_tokens": 16384, @@ -33376,8 +33543,8 @@ "novita/deepseek/deepseek-v3-turbo": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 3.2e-03, - "output_cost_per_token": 1.04e-02, + "input_cost_per_token": 4e-07, + "output_cost_per_token": 1.3e-06, "max_input_tokens": 64000, "max_output_tokens": 16000, "max_tokens": 16000, @@ -33389,8 +33556,8 @@ "novita/deepseek/deepseek-r1-turbo": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 5.6e-03, - "output_cost_per_token": 2e-02, + "input_cost_per_token": 7e-07, + "output_cost_per_token": 2.5e-06, "max_input_tokens": 64000, "max_output_tokens": 16000, "max_tokens": 16000, @@ -33403,8 +33570,8 @@ "novita/Sao10K/L3-8B-Stheno-v3.2": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 5e-04, - "output_cost_per_token": 5e-04, + "input_cost_per_token": 5e-08, + "output_cost_per_token": 5e-08, "max_input_tokens": 8192, "max_output_tokens": 32000, "max_tokens": 32000, @@ -33416,8 +33583,8 @@ "novita/gryphe/mythomax-l2-13b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 7.2e-04, - "output_cost_per_token": 7.2e-04, + "input_cost_per_token": 9e-08, + "output_cost_per_token": 9e-08, "max_input_tokens": 4096, "max_output_tokens": 3200, "max_tokens": 3200, @@ -33426,8 +33593,8 @@ "novita/baidu/ernie-4.5-vl-28b-a3b-thinking": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 3.9e-03, - "output_cost_per_token": 3.9e-03, + "input_cost_per_token": 3.9e-07, + "output_cost_per_token": 3.9e-07, "max_input_tokens": 131072, "max_output_tokens": 65536, "max_tokens": 65536, @@ -33442,8 +33609,8 @@ "novita/qwen/qwen3-vl-8b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 6.4e-04, - "output_cost_per_token": 4e-03, + "input_cost_per_token": 8e-08, + "output_cost_per_token": 5e-07, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -33457,8 +33624,8 @@ "novita/zai-org/glm-4.5-air": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.04e-03, - "output_cost_per_token": 6.8e-03, + "input_cost_per_token": 1.3e-07, + "output_cost_per_token": 8.5e-07, "max_input_tokens": 131072, "max_output_tokens": 98304, "max_tokens": 98304, @@ -33471,8 +33638,8 @@ "novita/qwen/qwen3-vl-30b-a3b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.6e-03, - "output_cost_per_token": 5.6e-03, + "input_cost_per_token": 2e-07, + "output_cost_per_token": 7e-07, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -33486,8 +33653,8 @@ "novita/qwen/qwen3-vl-30b-a3b-thinking": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.6e-03, - "output_cost_per_token": 8e-03, + "input_cost_per_token": 2e-07, + "output_cost_per_token": 1e-06, "max_input_tokens": 131072, "max_output_tokens": 32768, "max_tokens": 32768, @@ -33498,11 +33665,45 @@ "supports_system_messages": true, "supports_response_schema": true }, + "novita/qwen/qwen3-omni-30b-a3b-thinking": { + "litellm_provider": "novita", + "mode": "chat", + "input_cost_per_token": 2.5e-07, + "output_cost_per_token": 9.7e-07, + "max_input_tokens": 65536, + "max_output_tokens": 16384, + "max_tokens": 16384, + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_system_messages": true, + "supports_response_schema": true, + "supports_reasoning": true, + "supports_audio_input": true + }, + "novita/qwen/qwen3-omni-30b-a3b-instruct": { + "litellm_provider": "novita", + "mode": "chat", + "input_cost_per_token": 2.5e-07, + "output_cost_per_token": 9.7e-07, + "max_input_tokens": 65536, + "max_output_tokens": 16384, + "max_tokens": 16384, + "supports_function_calling": true, + "supports_parallel_function_calling": true, + "supports_tool_choice": true, + "supports_vision": true, + "supports_system_messages": true, + "supports_response_schema": true, + "supports_audio_input": true, + "supports_audio_output": true + }, "novita/qwen/qwen-mt-plus": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2e-03, - "output_cost_per_token": 6e-03, + "input_cost_per_token": 2.5e-07, + "output_cost_per_token": 7.5e-07, "max_input_tokens": 16384, "max_output_tokens": 8192, "max_tokens": 8192, @@ -33511,8 +33712,8 @@ "novita/baidu/ernie-4.5-vl-28b-a3b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.12e-03, - "output_cost_per_token": 4.48e-03, + "input_cost_per_token": 1.4e-07, + "output_cost_per_token": 5.6e-07, "max_input_tokens": 30000, "max_output_tokens": 8000, "max_tokens": 8000, @@ -33526,8 +33727,8 @@ "novita/baidu/ernie-4.5-21B-a3b": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 5.6e-04, - "output_cost_per_token": 2.24e-03, + "input_cost_per_token": 7e-08, + "output_cost_per_token": 2.8e-07, "max_input_tokens": 120000, "max_output_tokens": 8000, "max_tokens": 8000, @@ -33539,8 +33740,8 @@ "novita/qwen/qwen3-8b-fp8": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.8e-04, - "output_cost_per_token": 1.104e-03, + "input_cost_per_token": 3.5e-08, + "output_cost_per_token": 1.38e-07, "max_input_tokens": 128000, "max_output_tokens": 20000, "max_tokens": 20000, @@ -33550,8 +33751,8 @@ "novita/qwen/qwen3-4b-fp8": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.4e-04, - "output_cost_per_token": 2.4e-04, + "input_cost_per_token": 3e-08, + "output_cost_per_token": 3e-08, "max_input_tokens": 128000, "max_output_tokens": 20000, "max_tokens": 20000, @@ -33561,8 +33762,8 @@ "novita/qwen/qwen2.5-7b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 5.6e-04, - "output_cost_per_token": 5.6e-04, + "input_cost_per_token": 7e-08, + "output_cost_per_token": 7e-08, "max_input_tokens": 32000, "max_output_tokens": 32000, "max_tokens": 32000, @@ -33575,8 +33776,8 @@ "novita/meta-llama/llama-3.2-3b-instruct": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 2.4e-04, - "output_cost_per_token": 4e-04, + "input_cost_per_token": 3e-08, + "output_cost_per_token": 5e-08, "max_input_tokens": 32768, "max_output_tokens": 32000, "max_tokens": 32000, @@ -33588,8 +33789,8 @@ "novita/sao10k/l31-70b-euryale-v2.2": { "litellm_provider": "novita", "mode": "chat", - "input_cost_per_token": 1.48e-02, - "output_cost_per_token": 1.48e-02, + "input_cost_per_token": 1.48e-06, + "output_cost_per_token": 1.48e-06, "max_input_tokens": 8192, "max_output_tokens": 8192, "max_tokens": 8192, @@ -33601,7 +33802,7 @@ "novita/qwen/qwen3-embedding-0.6b": { "litellm_provider": "novita", "mode": "embedding", - "input_cost_per_token": 5.6e-04, + "input_cost_per_token": 7e-08, "output_cost_per_token": 0, "max_input_tokens": 32768, "max_output_tokens": 32768, @@ -33610,7 +33811,7 @@ "novita/qwen/qwen3-embedding-8b": { "litellm_provider": "novita", "mode": "embedding", - "input_cost_per_token": 5.6e-04, + "input_cost_per_token": 7e-08, "output_cost_per_token": 0, "max_input_tokens": 32768, "max_output_tokens": 4096, @@ -33619,8 +33820,8 @@ "novita/baai/bge-m3": { "litellm_provider": "novita", "mode": "embedding", - "input_cost_per_token": 1e-04, - "output_cost_per_token": 1e-04, + "input_cost_per_token": 1e-08, + "output_cost_per_token": 1e-08, "max_input_tokens": 8192, "max_output_tokens": 96000, "max_tokens": 96000 @@ -33628,8 +33829,8 @@ "novita/qwen/qwen3-reranker-8b": { "litellm_provider": "novita", "mode": "rerank", - "input_cost_per_token": 4e-04, - "output_cost_per_token": 4e-04, + "input_cost_per_token": 5e-08, + "output_cost_per_token": 5e-08, "max_input_tokens": 32768, "max_output_tokens": 4096, "max_tokens": 4096 @@ -33637,8 +33838,8 @@ "novita/baai/bge-reranker-v2-m3": { "litellm_provider": "novita", "mode": "rerank", - "input_cost_per_token": 1e-04, - "output_cost_per_token": 1e-04, + "input_cost_per_token": 1e-08, + "output_cost_per_token": 1e-08, "max_input_tokens": 8000, "max_output_tokens": 8000, "max_tokens": 8000 diff --git a/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py b/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py index b43f421717..49d6ac7d89 100644 --- a/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py +++ b/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py @@ -516,7 +516,7 @@ class MCPRequestHandler: Check if the tool is allowed for the given user/key based on permissions """ if len(allowed_mcp_servers) == 0: - return True + return False elif server_name in allowed_mcp_servers: return True return False diff --git a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py b/litellm/proxy/_experimental/mcp_server/rest_endpoints.py index 642cb0cec2..48f7a8b0b7 100644 --- a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py +++ b/litellm/proxy/_experimental/mcp_server/rest_endpoints.py @@ -1,9 +1,13 @@ import importlib +from datetime import datetime from typing import Dict, List, Optional, Union -from fastapi import APIRouter, Depends, Query, Request +from fastapi import APIRouter, Depends, HTTPException, Query, Request from litellm._logging import verbose_logger +from litellm.proxy._experimental.mcp_server.ui_session_utils import ( + build_effective_auth_contexts, +) from litellm.proxy._types import UserAPIKeyAuth from litellm.proxy.auth.user_api_key_auth import user_api_key_auth from litellm.types.mcp import MCPAuth @@ -22,13 +26,14 @@ router = APIRouter( ) if MCP_AVAILABLE: - from litellm.experimental_mcp_client.client import MCPTool + from mcp.types import Tool as MCPTool from litellm.proxy._experimental.mcp_server.mcp_server_manager import ( global_mcp_server_manager, ) from litellm.proxy._experimental.mcp_server.server import ( ListMCPToolsRestAPIResponseObject, - call_mcp_tool, + MCPServer, + execute_mcp_tool, filter_tools_by_allowed_tools, ) @@ -134,11 +139,30 @@ if MCP_AVAILABLE: MCPRequestHandler._get_mcp_server_auth_headers_from_headers(headers) ) + auth_contexts = await build_effective_auth_contexts(user_api_key_dict) + + allowed_server_ids_set = set() + for auth_context in auth_contexts: + servers = await global_mcp_server_manager.get_allowed_mcp_servers( + user_api_key_auth=auth_context + ) + allowed_server_ids_set.update(servers) + + allowed_server_ids = list(allowed_server_ids_set) + list_tools_result = [] error_message = None # If server_id is specified, only query that specific server if server_id: + if server_id not in allowed_server_ids_set: + raise HTTPException( + status_code=403, + detail={ + "error": "access_denied", + "message": f"The key is not allowed to access server {server_id}", + }, + ) server = global_mcp_server_manager.get_mcp_server_by_id(server_id) if server is None: return { @@ -165,9 +189,24 @@ if MCP_AVAILABLE: "message": f"Failed to get tools from server {server.name}: {str(e)}", } else: - # Query all servers + if not allowed_server_ids: + raise HTTPException( + status_code=403, + detail={ + "error": "access_denied", + "message": "The key is not allowed to access any MCP servers.", + }, + ) + + # Query all servers the user has access to errors = [] - for server in global_mcp_server_manager.get_registry().values(): + for allowed_server_id in allowed_server_ids: + server = global_mcp_server_manager.get_mcp_server_by_id( + allowed_server_id + ) + if server is None: + continue + server_auth_header = _get_server_auth_header( server, mcp_server_auth_headers, mcp_auth_header ) @@ -225,6 +264,30 @@ if MCP_AVAILABLE: try: data = await request.json() + + # Validate required parameters early + server_id = data.get("server_id") + if not server_id: + raise HTTPException( + status_code=400, + detail={ + "error": "missing_parameter", + "message": "server_id is required in request body", + }, + ) + + tool_name = data.get("name") + if not tool_name: + raise HTTPException( + status_code=400, + detail={ + "error": "missing_parameter", + "message": "name is required in request body", + }, + ) + + tool_arguments = data.get("arguments") + data = await add_litellm_data_to_request( data=data, request=request, @@ -252,13 +315,55 @@ if MCP_AVAILABLE: if mcp_server_auth_headers: data["mcp_server_auth_headers"] = mcp_server_auth_headers data["raw_headers"] = raw_headers_from_request - + # Extract user_api_key_auth from metadata and add to top level # call_mcp_tool expects user_api_key_auth as a top-level parameter if "metadata" in data and "user_api_key_auth" in data["metadata"]: data["user_api_key_auth"] = data["metadata"]["user_api_key_auth"] - - result = await call_mcp_tool(**data) + + # Get all auth contexts + auth_contexts = await build_effective_auth_contexts(user_api_key_dict) + + # Collect allowed server IDs from all contexts + allowed_server_ids_set = set() + for auth_context in auth_contexts: + servers = await global_mcp_server_manager.get_allowed_mcp_servers( + user_api_key_auth=auth_context + ) + allowed_server_ids_set.update(servers) + + # Check if the specified server_id is allowed + if server_id not in allowed_server_ids_set: + raise HTTPException( + status_code=403, + detail={ + "error": "access_denied", + "message": f"The key is not allowed to access server {server_id}", + }, + ) + + # Build allowed_mcp_servers list (only include allowed servers) + allowed_mcp_servers: List[MCPServer] = [] + for allowed_server_id in allowed_server_ids_set: + server = global_mcp_server_manager.get_mcp_server_by_id( + allowed_server_id + ) + if server is not None: + allowed_mcp_servers.append(server) + + # Call execute_mcp_tool directly (permission checks already done) + result = await execute_mcp_tool( + name=tool_name, + arguments=tool_arguments, + allowed_mcp_servers=allowed_mcp_servers, + start_time=datetime.now(), + user_api_key_auth=data.get("user_api_key_auth"), + mcp_auth_header=data.get("mcp_auth_header"), + mcp_server_auth_headers=data.get("mcp_server_auth_headers"), + oauth2_headers=data.get("oauth2_headers"), + raw_headers=data.get("raw_headers"), + litellm_logging_obj=data.get("litellm_logging_obj"), + ) return result except BlockedPiiEntityError as e: verbose_logger.error(f"BlockedPiiEntityError in MCP tool call: {str(e)}") @@ -301,7 +406,6 @@ if MCP_AVAILABLE: # /health/tools/list -> List tools from MCP server # For these routes users will dynamically pass the MCP connection params, they don't need to be on the MCP registry ######################################################## - from litellm.proxy._experimental.mcp_server.server import MCPServer from litellm.proxy.management_endpoints.mcp_management_endpoints import ( NewMCPServerRequest, ) diff --git a/litellm/proxy/_experimental/mcp_server/server.py b/litellm/proxy/_experimental/mcp_server/server.py index 2adfe97c61..f22040a7dd 100644 --- a/litellm/proxy/_experimental/mcp_server/server.py +++ b/litellm/proxy/_experimental/mcp_server/server.py @@ -1200,47 +1200,38 @@ if MCP_AVAILABLE: return managed_resource_templates - @client - async def call_mcp_tool( + async def execute_mcp_tool( name: str, - arguments: Optional[Dict[str, Any]] = None, + arguments: Dict[str, Any], + allowed_mcp_servers: List[MCPServer], + start_time: datetime, user_api_key_auth: Optional[UserAPIKeyAuth] = None, mcp_auth_header: Optional[str] = None, - mcp_servers: Optional[List[str]] = None, mcp_server_auth_headers: Optional[Dict[str, Dict[str, str]]] = None, oauth2_headers: Optional[Dict[str, str]] = None, raw_headers: Optional[Dict[str, str]] = None, **kwargs: Any, ) -> CallToolResult: """ - Call a specific tool with the provided arguments (handles prefixed tool names) + Execute MCP tool. + + This function assumes permission checks have already been performed. + + Args: + name: Tool name (may include server prefix) + arguments: Tool arguments + allowed_mcp_servers: Pre-validated list of servers the user can access + start_time: Start time for logging + user_api_key_auth: Optional user API key auth for logging + mcp_auth_header: Optional MCP auth header + mcp_server_auth_headers: Optional server-specific auth headers + oauth2_headers: Optional OAuth2 headers + raw_headers: Optional raw HTTP headers + **kwargs: Additional arguments (e.g., litellm_logging_obj) + + Returns: + CallToolResult: Tool execution result """ - start_time = datetime.now() - if arguments is None: - raise HTTPException( - status_code=400, detail="Request arguments are required" - ) - - ## CHECK IF USER IS ALLOWED TO CALL THIS TOOL - allowed_mcp_server_ids = ( - await global_mcp_server_manager.get_allowed_mcp_servers( - user_api_key_auth=user_api_key_auth, - ) - ) - - allowed_mcp_servers: List[MCPServer] = [] - for allowed_mcp_server_id in allowed_mcp_server_ids: - allowed_server = global_mcp_server_manager.get_mcp_server_by_id( - allowed_mcp_server_id - ) - if allowed_server is not None: - allowed_mcp_servers.append(allowed_server) - - allowed_mcp_servers = await _get_allowed_mcp_servers_from_mcp_server_names( - mcp_servers=mcp_servers, - allowed_mcp_servers=allowed_mcp_servers, - ) - # Track resolved MCP server for both permission checks and dispatch mcp_server: Optional[MCPServer] = None @@ -1359,6 +1350,66 @@ if MCP_AVAILABLE: ) return response + @client + async def call_mcp_tool( + name: str, + arguments: Optional[Dict[str, Any]] = None, + user_api_key_auth: Optional[UserAPIKeyAuth] = None, + mcp_auth_header: Optional[str] = None, + mcp_servers: Optional[List[str]] = None, + mcp_server_auth_headers: Optional[Dict[str, Dict[str, str]]] = None, + oauth2_headers: Optional[Dict[str, str]] = None, + raw_headers: Optional[Dict[str, str]] = None, + **kwargs: Any, + ) -> CallToolResult: + """ + Call a specific tool with the provided arguments (handles prefixed tool names). + """ + start_time = datetime.now() + if arguments is None: + raise HTTPException( + status_code=400, detail="Request arguments are required" + ) + + ## CHECK IF USER IS ALLOWED TO CALL THIS TOOL + allowed_mcp_server_ids = ( + await global_mcp_server_manager.get_allowed_mcp_servers( + user_api_key_auth=user_api_key_auth, + ) + ) + + allowed_mcp_servers: List[MCPServer] = [] + for allowed_mcp_server_id in allowed_mcp_server_ids: + allowed_server = global_mcp_server_manager.get_mcp_server_by_id( + allowed_mcp_server_id + ) + if allowed_server is not None: + allowed_mcp_servers.append(allowed_server) + + allowed_mcp_servers = await _get_allowed_mcp_servers_from_mcp_server_names( + mcp_servers=mcp_servers, + allowed_mcp_servers=allowed_mcp_servers, + ) + if not allowed_mcp_servers: + raise HTTPException( + status_code=403, + detail="User not allowed to call this tool.", + ) + + # Delegate to execute_mcp_tool for execution + return await execute_mcp_tool( + name=name, + arguments=arguments, + allowed_mcp_servers=allowed_mcp_servers, + start_time=start_time, + user_api_key_auth=user_api_key_auth, + mcp_auth_header=mcp_auth_header, + mcp_server_auth_headers=mcp_server_auth_headers, + oauth2_headers=oauth2_headers, + raw_headers=raw_headers, + **kwargs, + ) + async def mcp_get_prompt( name: str, arguments: Optional[Dict[str, Any]] = None, diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1011-ebab1bc95b4aa615.js b/litellm/proxy/_experimental/out/_next/static/chunks/1011-ebab1bc95b4aa615.js deleted file mode 100644 index 2c722c865d..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1011-ebab1bc95b4aa615.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1011],{21011:function(e,l,s){s.d(l,{Z:function(){return eh},g:function(){return ex}});var i=s(57437),a=s(10012),r=s(4260),t=s(7310),n=s.n(t),o=s(2265);let d=e=>{let{placeholder:l,value:s,onChange:t,icon:d,className:c}=e,[m,u]=(0,o.useState)(s);(0,o.useEffect)(()=>{u(s)},[s]);let x=(0,o.useMemo)(()=>n()(e=>t(e),300),[t]);(0,o.useEffect)(()=>()=>{x.cancel()},[x]);let h=(0,o.useCallback)(e=>{let l=e.target.value;u(l),x(l)},[x]);return(0,i.jsx)(r.default,{placeholder:l,value:m,onChange:h,prefix:d?(0,i.jsx)(d,{size:16,className:"text-gray-500"}):void 0,className:(0,a.cx)("w-64",c)})};var c=s(33866),m=s(5545),u=s(3577);let x=e=>{let{onClick:l,active:s,hasActiveFilters:a,label:r="Filters"}=e;return(0,i.jsx)(c.Z,{color:"blue",dot:a,children:(0,i.jsx)(m.ZP,{type:"default",onClick:l,icon:(0,i.jsx)(u.Z,{size:16}),className:s?"bg-gray-100":"",children:r})})};var h=s(69076);let _=e=>{let{onClick:l,label:s="Reset Filters"}=e;return(0,i.jsx)(m.ZP,{type:"default",onClick:l,icon:(0,i.jsx)(h.Z,{size:16}),children:s})};var g=s(73247),j=s(92369),p=e=>{let{filters:l,showFilters:s,onToggleFilters:a,onChange:r,onReset:t}=e,n=!!(l.org_id||l.org_alias);return(0,i.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,i.jsx)(d,{placeholder:"Search by Organization Name",value:l.org_alias,onChange:e=>r("org_alias",e),icon:g.Z,className:"w-64"}),(0,i.jsx)(x,{onClick:()=>a(!s),active:s,hasActiveFilters:n}),(0,i.jsx)(_,{onClick:t})]}),s&&(0,i.jsx)("div",{className:"flex flex-wrap items-center gap-3 mt-3",children:(0,i.jsx)(d,{placeholder:"Search by Organization ID",value:l.org_id,onChange:e=>r("org_id",e),icon:j.Z,className:"w-64"})})]})},v=s(15424),Z=s(23628),b=s(86462),f=s(47686),w=s(41649),z=s(78489),y=s(12514),N=s(49804),C=s(67101),S=s(47323),O=s(12485),k=s(18135),M=s(35242),I=s(29706),P=s(77991),F=s(21626),A=s(97214),T=s(28241),D=s(58834),L=s(69552),E=s(71876),R=s(84264),U=s(49566),B=s(10032),V=s(99981),q=s(22116),G=s(37592),W=s(59872),$=s(21609),J=s(39957),Q=s(46468),Y=s(97492),H=s(9114),K=s(19250),X=s(10900),ee=s(53410),el=s(74998),es=s(96761),ei=s(30401),ea=s(78867),er=s(33860),et=s(60131),en=s(24199),eo=s(36894),ed=s(97415),ec=s(47359),em=s(29299),eu=e=>{var l,s,a,t;let{organizationId:n,onClose:d,accessToken:c,is_org_admin:u,is_proxy_admin:x,userModels:h,editOrg:_}=e,[g,j]=(0,o.useState)(null),[p,v]=(0,o.useState)(!0),[Z]=B.Z.useForm(),[b,f]=(0,o.useState)(!1),[N,V]=(0,o.useState)(!1),[q,$]=(0,o.useState)(!1),[J,eu]=(0,o.useState)(null),[ex,eh]=(0,o.useState)({}),[e_,eg]=(0,o.useState)(!1),ej=u||x,{data:ep}=(0,ec.y)(),ev=(0,o.useMemo)(()=>(0,em.O)(ep),[ep]),eZ=async()=>{try{if(v(!0),!c)return;let e=await (0,K.organizationInfoCall)(c,n);j(e)}catch(e){H.Z.fromBackend("Failed to load organization information"),console.error("Error fetching organization info:",e)}finally{v(!1)}};(0,o.useEffect)(()=>{eZ()},[n,c]);let eb=async e=>{try{if(null==c)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,K.organizationMemberAddCall)(c,n,l),H.Z.success("Organization member added successfully"),V(!1),Z.resetFields(),eZ()}catch(e){H.Z.fromBackend("Failed to add organization member"),console.error("Error adding organization member:",e)}},ef=async e=>{try{if(!c)return;let l={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,K.organizationMemberUpdateCall)(c,n,l),H.Z.success("Organization member updated successfully"),$(!1),Z.resetFields(),eZ()}catch(e){H.Z.fromBackend("Failed to update organization member"),console.error("Error updating organization member:",e)}},ew=async e=>{try{if(!c)return;await (0,K.organizationMemberDeleteCall)(c,n,e.user_id),H.Z.success("Organization member deleted successfully"),$(!1),Z.resetFields(),eZ()}catch(e){H.Z.fromBackend("Failed to delete organization member"),console.error("Error deleting organization member:",e)}},ez=async e=>{try{if(!c)return;eg(!0);let l={organization_id:n,organization_alias:e.organization_alias,models:e.models,litellm_budget_table:{tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit,max_budget:e.max_budget,budget_duration:e.budget_duration},metadata:e.metadata?JSON.parse(e.metadata):null};if((void 0!==e.vector_stores||void 0!==e.mcp_servers_and_groups)&&(l.object_permission={...null==g?void 0:g.object_permission,vector_stores:e.vector_stores||[]},void 0!==e.mcp_servers_and_groups)){let{servers:s,accessGroups:i}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]};s&&s.length>0&&(l.object_permission.mcp_servers=s),i&&i.length>0&&(l.object_permission.mcp_access_groups=i)}await (0,K.organizationUpdateCall)(c,l),H.Z.success("Organization settings updated successfully"),f(!1),eZ()}catch(e){H.Z.fromBackend("Failed to update organization settings"),console.error("Error updating organization:",e)}finally{eg(!1)}};if(p)return(0,i.jsx)("div",{className:"p-4",children:"Loading..."});if(!g)return(0,i.jsx)("div",{className:"p-4",children:"Organization not found"});let ey=async(e,l)=>{await (0,W.vQ)(e)&&(eh(e=>({...e,[l]:!0})),setTimeout(()=>{eh(e=>({...e,[l]:!1}))},2e3))};return(0,i.jsxs)("div",{className:"w-full h-screen p-4 bg-white",children:[(0,i.jsx)("div",{className:"flex justify-between items-center mb-6",children:(0,i.jsxs)("div",{children:[(0,i.jsx)(z.Z,{icon:X.Z,onClick:d,variant:"light",className:"mb-4",children:"Back to Organizations"}),(0,i.jsx)(es.Z,{children:g.organization_alias}),(0,i.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,i.jsx)(R.Z,{className:"text-gray-500 font-mono",children:g.organization_id}),(0,i.jsx)(m.ZP,{type:"text",size:"small",icon:ex["org-id"]?(0,i.jsx)(ei.Z,{size:12}):(0,i.jsx)(ea.Z,{size:12}),onClick:()=>ey(g.organization_id,"org-id"),className:"left-2 z-10 transition-all duration-200 ".concat(ex["org-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,i.jsxs)(k.Z,{defaultIndex:_?2:0,children:[(0,i.jsxs)(M.Z,{className:"mb-4",children:[(0,i.jsx)(O.Z,{children:"Overview"}),(0,i.jsx)(O.Z,{children:"Members"}),(0,i.jsx)(O.Z,{children:"Settings"})]}),(0,i.jsxs)(P.Z,{children:[(0,i.jsx)(I.Z,{children:(0,i.jsxs)(C.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,i.jsxs)(y.Z,{children:[(0,i.jsx)(R.Z,{children:"Organization Details"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(R.Z,{children:["Created: ",new Date(g.created_at).toLocaleDateString()]}),(0,i.jsxs)(R.Z,{children:["Updated: ",new Date(g.updated_at).toLocaleDateString()]}),(0,i.jsxs)(R.Z,{children:["Created By: ",g.created_by]})]})]}),(0,i.jsxs)(y.Z,{children:[(0,i.jsx)(R.Z,{children:"Budget Status"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(es.Z,{children:["$",(0,W.pw)(g.spend,4)]}),(0,i.jsxs)(R.Z,{children:["of"," ",null===g.litellm_budget_table.max_budget?"Unlimited":"$".concat((0,W.pw)(g.litellm_budget_table.max_budget,4))]}),g.litellm_budget_table.budget_duration&&(0,i.jsxs)(R.Z,{className:"text-gray-500",children:["Reset: ",g.litellm_budget_table.budget_duration]})]})]}),(0,i.jsxs)(y.Z,{children:[(0,i.jsx)(R.Z,{children:"Rate Limits"}),(0,i.jsxs)("div",{className:"mt-2",children:[(0,i.jsxs)(R.Z,{children:["TPM: ",g.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)(R.Z,{children:["RPM: ",g.litellm_budget_table.rpm_limit||"Unlimited"]}),g.litellm_budget_table.max_parallel_requests&&(0,i.jsxs)(R.Z,{children:["Max Parallel Requests: ",g.litellm_budget_table.max_parallel_requests]})]})]}),(0,i.jsxs)(y.Z,{children:[(0,i.jsx)(R.Z,{children:"Models"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===g.models.length?(0,i.jsx)(w.Z,{color:"red",children:"All proxy models"}):g.models.map((e,l)=>(0,i.jsx)(w.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)(y.Z,{children:[(0,i.jsx)(R.Z,{children:"Teams"}),(0,i.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:null===(l=g.teams)||void 0===l?void 0:l.map((e,l)=>(0,i.jsx)(w.Z,{color:"red",children:ev[e.team_id]||e.team_id},l))})]}),(0,i.jsx)(et.Z,{objectPermission:g.object_permission,variant:"card",accessToken:c})]})}),(0,i.jsx)(I.Z,{children:(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsx)(y.Z,{className:"w-full mx-auto flex-auto overflow-y-auto max-h-[75vh]",children:(0,i.jsxs)(F.Z,{children:[(0,i.jsx)(D.Z,{children:(0,i.jsxs)(E.Z,{children:[(0,i.jsx)(L.Z,{children:"User ID"}),(0,i.jsx)(L.Z,{children:"Role"}),(0,i.jsx)(L.Z,{children:"Spend"}),(0,i.jsx)(L.Z,{children:"Created At"}),(0,i.jsx)(L.Z,{})]})}),(0,i.jsx)(A.Z,{children:g.members&&g.members.length>0?g.members.map((e,l)=>(0,i.jsxs)(E.Z,{children:[(0,i.jsx)(T.Z,{children:(0,i.jsx)(R.Z,{className:"font-mono",children:e.user_id})}),(0,i.jsx)(T.Z,{children:(0,i.jsx)(R.Z,{className:"font-mono",children:e.user_role})}),(0,i.jsx)(T.Z,{children:(0,i.jsxs)(R.Z,{children:["$",(0,W.pw)(e.spend,4)]})}),(0,i.jsx)(T.Z,{children:(0,i.jsx)(R.Z,{children:new Date(e.created_at).toLocaleString()})}),(0,i.jsx)(T.Z,{children:ej&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(S.Z,{icon:ee.Z,size:"sm",onClick:()=>{eu({role:e.user_role,user_email:e.user_email,user_id:e.user_id}),$(!0)}}),(0,i.jsx)(S.Z,{icon:el.Z,size:"sm",onClick:()=>{ew(e)}})]})})]},l)):(0,i.jsx)(E.Z,{children:(0,i.jsx)(T.Z,{colSpan:5,className:"text-center py-8",children:(0,i.jsx)(R.Z,{className:"text-gray-500",children:"No members found"})})})})]})}),ej&&(0,i.jsx)(z.Z,{onClick:()=>{V(!0)},children:"Add Member"})]})}),(0,i.jsx)(I.Z,{children:(0,i.jsxs)(y.Z,{className:"overflow-y-auto max-h-[65vh]",children:[(0,i.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,i.jsx)(es.Z,{children:"Organization Settings"}),ej&&!b&&(0,i.jsx)(z.Z,{onClick:()=>f(!0),children:"Edit Settings"})]}),b?(0,i.jsxs)(B.Z,{form:Z,onFinish:ez,initialValues:{organization_alias:g.organization_alias,models:g.models,tpm_limit:g.litellm_budget_table.tpm_limit,rpm_limit:g.litellm_budget_table.rpm_limit,max_budget:g.litellm_budget_table.max_budget,budget_duration:g.litellm_budget_table.budget_duration,metadata:g.metadata?JSON.stringify(g.metadata,null,2):"",vector_stores:(null===(s=g.object_permission)||void 0===s?void 0:s.vector_stores)||[],mcp_servers_and_groups:{servers:(null===(a=g.object_permission)||void 0===a?void 0:a.mcp_servers)||[],accessGroups:(null===(t=g.object_permission)||void 0===t?void 0:t.mcp_access_groups)||[]}},layout:"vertical",children:[(0,i.jsx)(B.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(U.Z,{})}),(0,i.jsx)(B.Z.Item,{label:"Models",name:"models",children:(0,i.jsxs)(G.default,{mode:"multiple",placeholder:"Select models",children:[(0,i.jsx)(G.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),h.map(e=>(0,i.jsx)(G.default.Option,{value:e,children:(0,Q.W0)(e)},e))]})}),(0,i.jsx)(B.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(en.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,i.jsx)(B.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(G.default,{placeholder:"n/a",children:[(0,i.jsx)(G.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(G.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(G.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(B.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(en.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(B.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(en.Z,{step:1,style:{width:"100%"}})}),(0,i.jsx)(B.Z.Item,{label:"Vector Stores",name:"vector_stores",children:(0,i.jsx)(ed.Z,{onChange:e=>Z.setFieldValue("vector_stores",e),value:Z.getFieldValue("vector_stores"),accessToken:c||"",placeholder:"Select vector stores"})}),(0,i.jsx)(B.Z.Item,{label:"MCP Servers & Access Groups",name:"mcp_servers_and_groups",children:(0,i.jsx)(Y.Z,{onChange:e=>Z.setFieldValue("mcp_servers_and_groups",e),value:Z.getFieldValue("mcp_servers_and_groups"),accessToken:c||"",placeholder:"Select MCP servers and access groups"})}),(0,i.jsx)(B.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(r.default.TextArea,{rows:4})}),(0,i.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,i.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,i.jsx)(z.Z,{variant:"secondary",onClick:()=>f(!1),disabled:e_,children:"Cancel"}),(0,i.jsx)(z.Z,{type:"submit",loading:e_,children:"Save Changes"})]})})]}):(0,i.jsxs)("div",{className:"space-y-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)(R.Z,{className:"font-medium",children:"Organization Name"}),(0,i.jsx)("div",{children:g.organization_alias})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(R.Z,{className:"font-medium",children:"Organization ID"}),(0,i.jsx)("div",{className:"font-mono",children:g.organization_id})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(R.Z,{className:"font-medium",children:"Created At"}),(0,i.jsx)("div",{children:new Date(g.created_at).toLocaleString()})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(R.Z,{className:"font-medium",children:"Models"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:g.models.map((e,l)=>(0,i.jsx)(w.Z,{color:"red",children:e},l))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(R.Z,{className:"font-medium",children:"Rate Limits"}),(0,i.jsxs)("div",{children:["TPM: ",g.litellm_budget_table.tpm_limit||"Unlimited"]}),(0,i.jsxs)("div",{children:["RPM: ",g.litellm_budget_table.rpm_limit||"Unlimited"]})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)(R.Z,{className:"font-medium",children:"Budget"}),(0,i.jsxs)("div",{children:["Max:"," ",null!==g.litellm_budget_table.max_budget?"$".concat((0,W.pw)(g.litellm_budget_table.max_budget,4)):"No Limit"]}),(0,i.jsxs)("div",{children:["Reset: ",g.litellm_budget_table.budget_duration||"Never"]})]}),(0,i.jsx)(et.Z,{objectPermission:g.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:c})]})]})})]})]}),(0,i.jsx)(er.Z,{isVisible:N,onCancel:()=>V(!1),onSubmit:eb,accessToken:c,title:"Add Organization Member",roles:[{label:"org_admin",value:"org_admin",description:"Can add and remove members, and change their roles."},{label:"internal_user",value:"internal_user",description:"Can view/create keys for themselves within organization."},{label:"internal_user_viewer",value:"internal_user_viewer",description:"Can only view their keys within organization."}],defaultRole:"internal_user"}),(0,i.jsx)(eo.Z,{visible:q,onCancel:()=>$(!1),onSubmit:ef,initialData:J,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Org Admin",value:"org_admin"},{label:"Internal User",value:"internal_user"},{label:"Internal User Viewer",value:"internal_user_viewer"}]}})]})};let ex=async function(e,l){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;l(await (0,K.organizationListCall)(e,s,i))};var eh=e=>{let{organizations:l,userRole:s,userModels:a,accessToken:t,lastRefreshed:n,handleRefreshClick:d,currentOrg:c,guardrailsList:m=[],setOrganizations:u,premiumUser:x}=e,[h,_]=(0,o.useState)(null),[g,j]=(0,o.useState)(!1),[X,ee]=(0,o.useState)(!1),[el,es]=(0,o.useState)(null),[ei,ea]=(0,o.useState)(!1),[er,et]=(0,o.useState)(!1),[eo]=B.Z.useForm(),[ec,em]=(0,o.useState)({}),[eh,e_]=(0,o.useState)(!1),[eg,ej]=(0,o.useState)({org_id:"",org_alias:"",sort_by:"created_at",sort_order:"desc"}),ep=e=>{e&&(es(e),ee(!0))},ev=async()=>{if(el&&t)try{ea(!0),await (0,K.organizationDeleteCall)(t,el),H.Z.success("Organization deleted successfully"),ee(!1),es(null),await ex(t,u,eg.org_id||null,eg.org_alias||null)}catch(e){console.error("Error deleting organization:",e)}finally{ea(!1)}},eZ=async e=>{try{var l,s,i,a;if(!t)return;console.log("values in organizations new create call: ".concat(JSON.stringify(e))),(e.allowed_vector_store_ids&&e.allowed_vector_store_ids.length>0||e.allowed_mcp_servers_and_groups&&((null===(l=e.allowed_mcp_servers_and_groups.servers)||void 0===l?void 0:l.length)>0||(null===(s=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===s?void 0:s.length)>0))&&(e.object_permission={},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===(i=e.allowed_mcp_servers_and_groups.servers)||void 0===i?void 0:i.length)>0&&(e.object_permission.mcp_servers=e.allowed_mcp_servers_and_groups.servers),(null===(a=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===a?void 0:a.length)>0&&(e.object_permission.mcp_access_groups=e.allowed_mcp_servers_and_groups.accessGroups),delete e.allowed_mcp_servers_and_groups)),await (0,K.organizationCreateCall)(t,e),H.Z.success("Organization created successfully"),et(!1),eo.resetFields(),ex(t,u,eg.org_id||null,eg.org_alias||null)}catch(e){console.error("Error creating organization:",e)}};return x?(0,i.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[(0,i.jsx)(C.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,i.jsxs)(N.Z,{numColSpan:1,className:"flex flex-col gap-2",children:[("Admin"===s||"Org Admin"===s)&&(0,i.jsx)(z.Z,{className:"w-fit",onClick:()=>et(!0),children:"+ Create New Organization"}),h?(0,i.jsx)(eu,{organizationId:h,onClose:()=>{_(null),j(!1)},accessToken:t,is_org_admin:!0,is_proxy_admin:"Admin"===s,userModels:a,editOrg:g}):(0,i.jsxs)(k.Z,{className:"gap-2 h-[75vh] w-full",children:[(0,i.jsxs)(M.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,i.jsx)("div",{className:"flex",children:(0,i.jsx)(O.Z,{children:"Your Organizations"})}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[n&&(0,i.jsxs)(R.Z,{children:["Last Refreshed: ",n]}),(0,i.jsx)(S.Z,{icon:Z.Z,variant:"shadow",size:"xs",className:"self-center",onClick:d})]})]}),(0,i.jsx)(P.Z,{children:(0,i.jsxs)(I.Z,{children:[(0,i.jsx)(R.Z,{children:"Click on “Organization ID” to view organization details."}),(0,i.jsx)(C.Z,{numItems:1,className:"gap-2 pt-2 pb-2 h-[75vh] w-full mt-2",children:(0,i.jsx)(N.Z,{numColSpan:1,children:(0,i.jsxs)(y.Z,{className:"w-full mx-auto flex-auto overflow-hidden overflow-y-auto max-h-[50vh]",children:[(0,i.jsx)("div",{className:"border-b px-6 py-4",children:(0,i.jsx)("div",{className:"flex flex-col space-y-4",children:(0,i.jsx)(p,{filters:eg,showFilters:eh,onToggleFilters:e_,onChange:(e,l)=>{let s={...eg,[e]:l};ej(s),t&&(0,K.organizationListCall)(t,s.org_id||null,s.org_alias||null).then(e=>{e&&u(e)}).catch(e=>{console.error("Error fetching organizations:",e)})},onReset:()=>{ej({org_id:"",org_alias:"",sort_by:"created_at",sort_order:"desc"}),t&&(0,K.organizationListCall)(t,null,null).then(e=>{e&&u(e)}).catch(e=>{console.error("Error fetching organizations:",e)})}})})}),(0,i.jsxs)(F.Z,{children:[(0,i.jsx)(D.Z,{children:(0,i.jsxs)(E.Z,{children:[(0,i.jsx)(L.Z,{children:"Organization ID"}),(0,i.jsx)(L.Z,{children:"Organization Name"}),(0,i.jsx)(L.Z,{children:"Created"}),(0,i.jsx)(L.Z,{children:"Spend (USD)"}),(0,i.jsx)(L.Z,{children:"Budget (USD)"}),(0,i.jsx)(L.Z,{children:"Models"}),(0,i.jsx)(L.Z,{children:"TPM / RPM Limits"}),(0,i.jsx)(L.Z,{children:"Info"}),(0,i.jsx)(L.Z,{children:"Actions"})]})}),(0,i.jsx)(A.Z,{children:l&&l.length>0?l.sort((e,l)=>new Date(l.created_at).getTime()-new Date(e.created_at).getTime()).map(e=>{var l,a,r,t,n,o,d,c,m;return(0,i.jsxs)(E.Z,{children:[(0,i.jsx)(T.Z,{children:(0,i.jsx)("div",{className:"overflow-hidden",children:(0,i.jsx)(V.Z,{title:e.organization_id,children:(0,i.jsxs)(z.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 max-w-[200px]",onClick:()=>_(e.organization_id),children:[null===(l=e.organization_id)||void 0===l?void 0:l.slice(0,7),"..."]})})})}),(0,i.jsx)(T.Z,{children:e.organization_alias}),(0,i.jsx)(T.Z,{children:e.created_at?new Date(e.created_at).toLocaleDateString():"N/A"}),(0,i.jsx)(T.Z,{children:(0,W.pw)(e.spend,4)}),(0,i.jsx)(T.Z,{children:(null===(a=e.litellm_budget_table)||void 0===a?void 0:a.max_budget)!==null&&(null===(r=e.litellm_budget_table)||void 0===r?void 0:r.max_budget)!==void 0?null===(t=e.litellm_budget_table)||void 0===t?void 0:t.max_budget:"No limit"}),(0,i.jsx)(T.Z,{style:{maxWidth:"8-x",whiteSpace:"pre-wrap",overflow:"hidden"},className:e.models.length>3?"px-0":"",children:(0,i.jsx)("div",{className:"flex flex-col",children:Array.isArray(e.models)?(0,i.jsx)("div",{className:"flex flex-col",children:0===e.models.length?(0,i.jsx)(w.Z,{size:"xs",className:"mb-1",color:"red",children:(0,i.jsx)(R.Z,{children:"All Proxy Models"})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"flex items-start",children:[e.models.length>3&&(0,i.jsx)("div",{children:(0,i.jsx)(S.Z,{icon:ec[e.organization_id||""]?b.Z:f.Z,className:"cursor-pointer",size:"xs",onClick:()=>{em(l=>({...l,[e.organization_id||""]:!l[e.organization_id||""]}))}})}),(0,i.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.models.slice(0,3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(w.Z,{size:"xs",color:"red",children:(0,i.jsx)(R.Z,{children:"All Proxy Models"})},l):(0,i.jsx)(w.Z,{size:"xs",color:"blue",children:(0,i.jsx)(R.Z,{children:e.length>30?"".concat((0,Q.W0)(e).slice(0,30),"..."):(0,Q.W0)(e)})},l)),e.models.length>3&&!ec[e.organization_id||""]&&(0,i.jsx)(w.Z,{size:"xs",color:"gray",className:"cursor-pointer",children:(0,i.jsxs)(R.Z,{children:["+",e.models.length-3," ",e.models.length-3==1?"more model":"more models"]})}),ec[e.organization_id||""]&&(0,i.jsx)("div",{className:"flex flex-wrap gap-1",children:e.models.slice(3).map((e,l)=>"all-proxy-models"===e?(0,i.jsx)(w.Z,{size:"xs",color:"red",children:(0,i.jsx)(R.Z,{children:"All Proxy Models"})},l+3):(0,i.jsx)(w.Z,{size:"xs",color:"blue",children:(0,i.jsx)(R.Z,{children:e.length>30?"".concat((0,Q.W0)(e).slice(0,30),"..."):(0,Q.W0)(e)})},l+3))})]})]})})}):null})}),(0,i.jsx)(T.Z,{children:(0,i.jsxs)(R.Z,{children:["TPM:"," ",(null===(n=e.litellm_budget_table)||void 0===n?void 0:n.tpm_limit)?null===(o=e.litellm_budget_table)||void 0===o?void 0:o.tpm_limit:"Unlimited",(0,i.jsx)("br",{}),"RPM:"," ",(null===(d=e.litellm_budget_table)||void 0===d?void 0:d.rpm_limit)?null===(c=e.litellm_budget_table)||void 0===c?void 0:c.rpm_limit:"Unlimited"]})}),(0,i.jsx)(T.Z,{children:(0,i.jsxs)(R.Z,{children:[(null===(m=e.members)||void 0===m?void 0:m.length)||0," Members"]})}),(0,i.jsx)(T.Z,{children:"Admin"===s&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(J.Z,{variant:"Edit",tooltipText:"Edit organization",onClick:()=>{_(e.organization_id),j(!0)}}),(0,i.jsx)(J.Z,{variant:"Delete",tooltipText:"Delete organization",onClick:()=>ep(e.organization_id)})]})})]},e.organization_id)}):null})]})]})})})]})})]})]})}),(0,i.jsx)(q.Z,{title:"Create Organization",visible:er,width:800,footer:null,onCancel:()=>{et(!1),eo.resetFields()},children:(0,i.jsxs)(B.Z,{form:eo,onFinish:eZ,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,i.jsx)(B.Z.Item,{label:"Organization Name",name:"organization_alias",rules:[{required:!0,message:"Please input an organization name"}],children:(0,i.jsx)(U.Z,{placeholder:""})}),(0,i.jsx)(B.Z.Item,{label:"Models",name:"models",children:(0,i.jsxs)(G.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,i.jsx)(G.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),a&&a.length>0&&a.map(e=>(0,i.jsx)(G.default.Option,{value:e,children:(0,Q.W0)(e)},e))]})}),(0,i.jsx)(B.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,i.jsx)(en.Z,{step:.01,precision:2,width:200})}),(0,i.jsx)(B.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,i.jsxs)(G.default,{defaultValue:null,placeholder:"n/a",children:[(0,i.jsx)(G.default.Option,{value:"24h",children:"daily"}),(0,i.jsx)(G.default.Option,{value:"7d",children:"weekly"}),(0,i.jsx)(G.default.Option,{value:"30d",children:"monthly"})]})}),(0,i.jsx)(B.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,i.jsx)(en.Z,{step:1,width:400})}),(0,i.jsx)(B.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,i.jsx)(en.Z,{step:1,width:400})}),(0,i.jsx)(B.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,i.jsx)(V.Z,{title:"Select which vector stores this organization can access by default. Leave empty for access to all vector stores",children:(0,i.jsx)(v.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_vector_store_ids",className:"mt-4",help:"Select vector stores this organization can access. Leave empty for access to all vector stores",children:(0,i.jsx)(ed.Z,{onChange:e=>eo.setFieldValue("allowed_vector_store_ids",e),value:eo.getFieldValue("allowed_vector_store_ids"),accessToken:t||"",placeholder:"Select vector stores (optional)"})}),(0,i.jsx)(B.Z.Item,{label:(0,i.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,i.jsx)(V.Z,{title:"Select which MCP servers and access groups this organization can access by default.",children:(0,i.jsx)(v.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_mcp_servers_and_groups",className:"mt-4",help:"Select MCP servers and access groups this organization can access.",children:(0,i.jsx)(Y.Z,{onChange:e=>eo.setFieldValue("allowed_mcp_servers_and_groups",e),value:eo.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:t||"",placeholder:"Select MCP servers and access groups (optional)"})}),(0,i.jsx)(B.Z.Item,{label:"Metadata",name:"metadata",children:(0,i.jsx)(r.default.TextArea,{rows:4})}),(0,i.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,i.jsx)(z.Z,{type:"submit",children:"Create Organization"})})]})}),(0,i.jsx)($.Z,{isOpen:X,title:"Delete Organization?",message:"Are you sure you want to delete this organization? This action cannot be undone.",resourceInformationTitle:"Organization Information",resourceInformation:[{label:"Organization ID",value:el,code:!0}],onCancel:()=>{ee(!1),es(null)},onOk:ev,confirmLoading:ei})]}):(0,i.jsx)("div",{children:(0,i.jsxs)(R.Z,{children:["This is a LiteLLM Enterprise feature, and requires a valid key to use. Get a trial key"," ",(0,i.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",children:"here"}),"."]})})}},29299:function(e,l,s){s.d(l,{O:function(){return i},o:function(){return a}});let i=e=>e?e.reduce((e,l)=>(e[l.team_id]=l.team_alias,e),{}):{},a=(e,l)=>{let s=l.find(l=>l.team_id===e);return s?s.team_alias:null}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1098-c3e95c9684ff5e95.js b/litellm/proxy/_experimental/out/_next/static/chunks/1098-c3e95c9684ff5e95.js new file mode 100644 index 0000000000..6f31d1f084 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1098-c3e95c9684ff5e95.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1098],{30280:function(e,s,t){t.d(s,{EX:function(){return c},Km:function(){return o},Tv:function(){return u}});var a=t(11713),l=t(45345),r=t(90246),i=t(19250),n=t(80443);let o=(0,r.n)("keys"),d=async function(e,s,t){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};try{let l=(0,i.getProxyBaseUrl)(),r=new URLSearchParams(Object.entries({team_id:a.teamID,organization_id:a.organizationID,key_alias:a.selectedKeyAlias,key_hash:a.keyHash,user_id:a.userID,page:s,size:t,sort_by:a.sortBy,sort_order:a.sortOrder,expand:a.expand,status:a.status,return_full_object:"true",include_team_keys:"true",include_created_by_keys:"true"}).filter(e=>{let[,s]=e;return null!=s}).map(e=>{let[s,t]=e;return[s,String(t)]})),n="".concat(l?"".concat(l,"/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(),s=(0,i.deriveErrorMessage)(e);throw(0,i.handleError)(s),Error(s)}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=(e,s)=>{let{accessToken:t}=(0,n.Z)();return(0,a.a)({queryKey:o.list({page:e,limit:s}),queryFn:async()=>await d(t,e,s),enabled:!!t,staleTime:3e4,placeholderData:l.Wk})},m=(0,r.n)("deletedKeys"),u=function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{accessToken:r}=(0,n.Z)();return(0,a.a)({queryKey:m.list({page:e,limit:s,...t}),queryFn:async()=>await d(r,e,s,{...t,status:"deleted"}),enabled:!!r,staleTime:3e4,placeholderData:l.Wk})}},62099:function(e,s,t){var a=t(57437),l=t(2265),r=t(37592),i=t(99981),n=t(23496),o=t(63709),d=t(15424),c=t(31283);let{Option:m}=r.default;s.Z=e=>{var s;let{form:t,autoRotationEnabled:u,onAutoRotationChange:h,rotationInterval:p,onRotationIntervalChange:x}=e,g=p&&!["7d","30d","90d","180d","365d"].includes(p),[y,j]=(0,l.useState)(g),[f,b]=(0,l.useState)(g?p:""),[v,_]=(0,l.useState)((null==t?void 0:null===(s=t.getFieldValue)||void 0===s?void 0:s.call(t,"duration"))||"");return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Key Expiry Settings"}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,a.jsx)("span",{children:"Expire Key"}),(0,a.jsx)(i.Z,{title:"Set when this key should expire. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days). Use -1 to never expire.",children:(0,a.jsx)(d.Z,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,a.jsx)(c.o,{name:"duration",placeholder:"e.g., 30d or -1 to never expire",className:"w-full",value:v,onValueChange:e=>{_(e),t&&"function"==typeof t.setFieldValue?t.setFieldValue("duration",e):t&&"function"==typeof t.setFieldsValue&&t.setFieldsValue({duration:e})}})]})]}),(0,a.jsx)(n.Z,{}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Auto-Rotation Settings"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,a.jsx)("span",{children:"Enable Auto-Rotation"}),(0,a.jsx)(i.Z,{title:"Key will automatically regenerate at the specified interval for enhanced security.",children:(0,a.jsx)(d.Z,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,a.jsx)(o.Z,{checked:u,onChange:h,size:"default",className:u?"":"bg-gray-400"})]}),u&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"text-sm font-medium text-gray-700 flex items-center space-x-1",children:[(0,a.jsx)("span",{children:"Rotation Interval"}),(0,a.jsx)(i.Z,{title:"How often the key should be automatically rotated. Choose the interval that best fits your security requirements.",children:(0,a.jsx)(d.Z,{className:"text-gray-400 cursor-help text-xs"})})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)(r.default,{value:y?"custom":p,onChange:e=>{"custom"===e?j(!0):(j(!1),b(""),x(e))},className:"w-full",placeholder:"Select interval",children:[(0,a.jsx)(m,{value:"7d",children:"7 days"}),(0,a.jsx)(m,{value:"30d",children:"30 days"}),(0,a.jsx)(m,{value:"90d",children:"90 days"}),(0,a.jsx)(m,{value:"180d",children:"180 days"}),(0,a.jsx)(m,{value:"365d",children:"365 days"}),(0,a.jsx)(m,{value:"custom",children:"Custom interval"})]}),y&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(c.o,{value:f,onChange:e=>{let s=e.target.value;b(s),x(s)},placeholder:"e.g., 1s, 5m, 2h, 14d"}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:"Supported formats: seconds (s), minutes (m), hours (h), days (d)"})]})]})]})]}),u&&(0,a.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,s,t){var a=t(57437),l=t(2265),r=t(77355),i=t(93416),n=t(74998),o=t(95704),d=t(76593),c=t(9114);s.Z=e=>{let{accessToken:s,initialModelAliases:t={},onAliasUpdate:m,showExampleConfig:u=!0}=e,[h,p]=(0,l.useState)([]),[x,g]=(0,l.useState)({aliasName:"",targetModel:""}),[y,j]=(0,l.useState)(null);(0,l.useEffect)(()=>{p(Object.entries(t).map((e,s)=>{let[t,a]=e;return{id:"".concat(s,"-").concat(t),aliasName:t,targetModel:a}}))},[t]);let f=e=>{j({...e})},b=()=>{if(!y)return;if(!y.aliasName||!y.targetModel){c.Z.fromBackend("Please provide both alias name and target model");return}if(h.some(e=>e.id!==y.id&&e.aliasName===y.aliasName)){c.Z.fromBackend("An alias with this name already exists");return}let e=h.map(e=>e.id===y.id?y:e);p(e),j(null);let s={};e.forEach(e=>{s[e.aliasName]=e.targetModel}),m&&m(s),c.Z.success("Alias updated successfully")},v=()=>{j(null)},_=e=>{let s=h.filter(s=>s.id!==e);p(s);let t={};s.forEach(e=>{t[e.aliasName]=e.targetModel}),m&&m(t),c.Z.success("Alias deleted successfully")},w=h.reduce((e,s)=>(e[s.aliasName]=s.targetModel,e),{});return(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(o.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Alias"}),(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Alias Name"}),(0,a.jsx)("input",{type:"text",value:x.aliasName,onChange:e=>g({...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,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Target Model"}),(0,a.jsx)(d.Z,{accessToken:s,value:x.targetModel,placeholder:"Select target model",onChange:e=>g({...x,targetModel:e}),showLabel:!1})]}),(0,a.jsx)("div",{className:"flex items-end",children:(0,a.jsxs)("button",{onClick:()=>{if(!x.aliasName||!x.targetModel){c.Z.fromBackend("Please provide both alias name and target model");return}if(h.some(e=>e.aliasName===x.aliasName)){c.Z.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}];p(e),g({aliasName:"",targetModel:""});let s={};e.forEach(e=>{s[e.aliasName]=e.targetModel}),m&&m(s),c.Z.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,a.jsx)(r.Z,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,a.jsx)(o.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Manage Existing Aliases"}),(0,a.jsx)("div",{className:"rounded-lg custom-border relative mb-6",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(o.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,a.jsx)(o.ss,{children:(0,a.jsxs)(o.SC,{children:[(0,a.jsx)(o.xs,{className:"py-1 h-8",children:"Alias Name"}),(0,a.jsx)(o.xs,{className:"py-1 h-8",children:"Target Model"}),(0,a.jsx)(o.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,a.jsxs)(o.RM,{children:[h.map(e=>(0,a.jsx)(o.SC,{className:"h-8",children:y&&y.id===e.id?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.pj,{className:"py-0.5",children:(0,a.jsx)("input",{type:"text",value:y.aliasName,onChange:e=>j({...y,aliasName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,a.jsx)(o.pj,{className:"py-0.5",children:(0,a.jsx)(d.Z,{accessToken:s,value:y.targetModel,onChange:e=>j({...y,targetModel:e}),showLabel:!1,style:{height:"32px"}})}),(0,a.jsx)(o.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.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,a.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,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.pj,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,a.jsx)(o.pj,{className:"py-0.5 text-sm text-gray-500",children:e.targetModel}),(0,a.jsx)(o.pj,{className:"py-0.5 whitespace-nowrap",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.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,a.jsx)(i.Z,{className:"w-3 h-3"})}),(0,a.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,a.jsx)(n.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===h.length&&(0,a.jsx)(o.SC,{children:(0,a.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,a.jsxs)(o.Zb,{children:[(0,a.jsx)(o.Dx,{className:"mb-4",children:"Configuration Example"}),(0,a.jsx)(o.xv,{className:"text-gray-600 mb-4",children:"Here's how your current aliases would look in the config:"}),(0,a.jsx)("div",{className:"bg-gray-100 rounded-lg p-4 font-mono text-sm",children:(0,a.jsxs)("div",{className:"text-gray-700",children:["model_aliases:",0===Object.keys(w).length?(0,a.jsxs)("span",{className:"text-gray-500",children:[(0,a.jsx)("br",{}),"\xa0\xa0# No aliases configured yet"]}):Object.entries(w).map(e=>{let[s,t]=e;return(0,a.jsxs)("span",{children:[(0,a.jsx)("br",{}),'\xa0\xa0"',s,'": "',t,'"']},s)})]})})]})]})}},76593:function(e,s,t){var a=t(57437),l=t(2265),r=t(56522),i=t(37592),n=t(69993),o=t(10703);s.Z=e=>{let{accessToken:s,value:t,placeholder:d="Select a Model",onChange:c,disabled:m=!1,style:u,className:h,showLabel:p=!0,labelText:x="Select Model"}=e,[g,y]=(0,l.useState)(t),[j,f]=(0,l.useState)(!1),[b,v]=(0,l.useState)([]),_=(0,l.useRef)(null);return(0,l.useEffect)(()=>{y(t)},[t]),(0,l.useEffect)(()=>{s&&(async()=>{try{let e=await (0,o.p)(s);console.log("Fetched models for selector:",e),e.length>0&&v(e)}catch(e){console.error("Error fetching model info:",e)}})()},[s]),(0,a.jsxs)("div",{children:[p&&(0,a.jsxs)(r.x,{className:"font-medium block mb-2 text-gray-700 flex items-center",children:[(0,a.jsx)(n.Z,{className:"mr-2"})," ",x]}),(0,a.jsx)(i.default,{value:g,placeholder:d,onChange:e=>{"custom"===e?(f(!0),y(void 0)):(f(!1),y(e),c&&c(e))},options:[...Array.from(new Set(b.map(e=>e.model_group))).map((e,s)=>({value:e,label:e,key:s})),{value:"custom",label:"Enter custom model",key:"custom"}],style:{width:"100%",...u},showSearch:!0,className:"rounded-md ".concat(h||""),disabled:m}),j&&(0,a.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,s,t){var a=t(57437);t(2265);var l=t(92280),r=t(54507);s.Z=function(e){let{value:s,onChange:t,premiumUser:i=!1,disabledCallbacks:n=[],onDisabledCallbacksChange:o}=e;return i?(0,a.jsx)(r.Z,{value:s,onChange:t,disabledCallbacks:n,onDisabledCallbacksChange:o}):(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 mb-3",children:[(0,a.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,a.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,a.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,a.jsxs)(l.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,a.jsx)("a",{href:"https://www.litellm.ai/#pricing",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"here"}),"."]})})]})}},65895:function(e,s,t){var a=t(57437);t(2265);var l=t(37592),r=t(10032),i=t(99981),n=t(15424);let{Option:o}=l.default;s.Z=e=>{let{type:s,name:t,showDetailedDescriptions:d=!0,className:c="",initialValue:m=null,form:u,onChange:h}=e,p=s.toUpperCase(),x=s.toLowerCase(),g="Select 'guaranteed_throughput' to prevent overallocating ".concat(p," limit when the key belongs to a Team with specific ").concat(p," limits.");return(0,a.jsx)(r.Z.Item,{label:(0,a.jsxs)("span",{children:[p," Rate Limit Type"," ",(0,a.jsx)(i.Z,{title:g,children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:t,initialValue:m,className:c,children:(0,a.jsx)(l.default,{defaultValue:d?"default":void 0,placeholder:"Select rate limit type",style:{width:"100%"},optionLabelProp:d?"label":void 0,onChange:e=>{u&&u.setFieldValue(t,e),h&&h(e)},children:d?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{value:"best_effort_throughput",label:"Default",children:(0,a.jsxs)("div",{style:{padding:"4px 0"},children:[(0,a.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,a.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,a.jsx)(o,{value:"guaranteed_throughput",label:"Guaranteed throughput",children:(0,a.jsxs)("div",{style:{padding:"4px 0"},children:[(0,a.jsx)("div",{style:{fontWeight:500},children:"Guaranteed throughput"}),(0,a.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,a.jsx)(o,{value:"dynamic",label:"Dynamic",children:(0,a.jsxs)("div",{style:{padding:"4px 0"},children:[(0,a.jsx)("div",{style:{fontWeight:500},children:"Dynamic"}),(0,a.jsxs)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:["If the key has a set ",p," (e.g. 2 ",p,") and there are no 429 errors, it can dynamically exceed the limit when the model being called is not erroring."]})]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{value:"best_effort_throughput",children:"Best effort throughput"}),(0,a.jsx)(o,{value:"guaranteed_throughput",children:"Guaranteed throughput"}),(0,a.jsx)(o,{value:"dynamic",children:"Dynamic"})]})})})}},71098:function(e,s,t){t.d(s,{ZP:function(){return ee},wk:function(){return $},Nr:function(){return X}});var a=t(57437),l=t(30280),r=t(80443),i=t(59872),n=t(15424),o=t(29827),d=t(87452),c=t(88829),m=t(72208),u=t(78489),h=t(49804),p=t(67101),x=t(84264),g=t(49566),y=t(96761),j=t(37592),f=t(10032),b=t(22116),v=t(99981),_=t(29967),w=t(5545),Z=t(63709),N=t(4260),k=t(7310),S=t.n(k),C=t(2265),M=t(29233),P=t(20347),A=t(82586),L=t(97434),T=t(65925),I=t(63610),E=t(62099),F=t(72885),V=t(95096),U=t(2597),D=t(65895),K=t(84376),R=t(7765),O=t(46468),q=t(97492),B=t(68473),G=t(9114),W=t(19250),z=t(24199),J=t(97415);let H=e=>{let s;if(!(s=!e||"object"!=typeof e||e instanceof Error?String(e):JSON.stringify(e)).includes("/key/generate")&&!s.includes("KeyManagementRoutes.KEY_GENERATE"))return"Error creating the key: ".concat(e);let t=s;try{if(!e||"object"!=typeof e||e instanceof Error){let e=s.match(/\{[\s\S]*\}/);if(e){let s=JSON.parse(e[0]),a=(null==s?void 0:s.error)||s;(null==a?void 0:a.message)&&(t=a.message)}}else{let s=(null==e?void 0:e.error)||e;(null==s?void 0:s.message)&&(t=s.message)}}catch(e){}return s.includes("team_member_permission_error")||t.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:Y}=j.default,Q=e=>{let s=[];if(console.log("data:",JSON.stringify(e)),e)for(let t of e)t.metadata&&t.metadata.tags&&s.push(...t.metadata.tags);let t=Array.from(new Set(s)).map(e=>({value:e,label:e}));return console.log("uniqueTags:",t),t},$=async(e,s,t,a)=>{try{if(null===e||null===s)return[];if(null!==t){let l=(await (0,W.modelAvailableCall)(t,e,s,!0,a,!0)).data.map(e=>e.id);return console.log("available_model_names:",l),l}return[]}catch(e){return console.error("Error fetching user models:",e),[]}},X=async(e,s,t,a)=>{try{if(null===e||null===s)return;if(null!==t){let l=(await (0,W.modelAvailableCall)(t,e,s)).data.map(e=>e.id);console.log("available_model_names:",l),a(l)}}catch(e){console.error("Error fetching user models:",e)}};var ee=e=>{let{team:s,teams:t,data:k,addKey:ee}=e,{accessToken:es,userId:et,userRole:ea,premiumUser:el}=(0,r.Z)(),er=(0,o.NL)(),[ei]=f.Z.useForm(),[en,eo]=(0,C.useState)(!1),[ed,ec]=(0,C.useState)(null),[em,eu]=(0,C.useState)(null),[eh,ep]=(0,C.useState)([]),[ex,eg]=(0,C.useState)([]),[ey,ej]=(0,C.useState)("you"),[ef,eb]=(0,C.useState)(Q(k)),[ev,e_]=(0,C.useState)([]),[ew,eZ]=(0,C.useState)([]),[eN,ek]=(0,C.useState)([]),[eS,eC]=(0,C.useState)(s),[eM,eP]=(0,C.useState)(!1),[eA,eL]=(0,C.useState)(null),[eT,eI]=(0,C.useState)({}),[eE,eF]=(0,C.useState)([]),[eV,eU]=(0,C.useState)(!1),[eD,eK]=(0,C.useState)([]),[eR,eO]=(0,C.useState)([]),[eq,eB]=(0,C.useState)("default"),[eG,eW]=(0,C.useState)({}),[ez,eJ]=(0,C.useState)(!1),[eH,eY]=(0,C.useState)("30d"),eQ=()=>{eo(!1),ei.resetFields(),ek([]),eO([]),eB("default"),eW({}),eJ(!1),eY("30d")},e$=()=>{eo(!1),ec(null),eC(null),ei.resetFields(),ek([]),eO([]),eB("default"),eW({}),eJ(!1),eY("30d")};(0,C.useEffect)(()=>{et&&ea&&es&&X(et,ea,es,ep)},[es,et,ea]),(0,C.useEffect)(()=>{let e=async()=>{try{let e=await (0,W.getPromptsList)(es);eZ(e.prompts.map(e=>e.prompt_id))}catch(e){console.error("Failed to fetch prompts:",e)}};(async()=>{try{let e=(await (0,W.getGuardrailsList)(es)).guardrails.map(e=>e.guardrail_name);e_(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})(),e()},[es]),(0,C.useEffect)(()=>{(async()=>{try{if(es){let e=sessionStorage.getItem("possibleUserRoles");if(e)eI(JSON.parse(e));else{let e=await (0,W.getPossibleUserRoles)(es);sessionStorage.setItem("possibleUserRoles",JSON.stringify(e)),eI(e)}}}catch(e){console.error("Error fetching possible user roles:",e)}})()},[es]);let eX=ex.includes("no-default-models")&&!eS,e0=async e=>{try{var s,t,a,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==k?void 0:k.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"));G.Z.info("Making API Call"),eo(!0),"you"===ey&&(e.user_id=et);let u={};try{u=JSON.parse(e.metadata||"{}")}catch(e){console.error("Error parsing metadata:",e)}if("service_account"===ey&&(u.service_account_id=e.key_alias),eN.length>0&&(u={...u,logging:eN.filter(e=>e.callback_name)}),eR.length>0){let e=(0,L.Z3)(eR);u={...u,litellm_disabled_callbacks:e}}if(ez&&(e.auto_rotate=!0,e.rotation_interval=eH),e.duration&&(e.duration=e.duration),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===(s=e.allowed_mcp_servers_and_groups.servers)||void 0===s?void 0:s.length)>0||(null===(t=e.allowed_mcp_servers_and_groups.accessGroups)||void 0===t?void 0:t.length)>0)){e.object_permission||(e.object_permission={});let{servers:s,accessGroups:t}=e.allowed_mcp_servers_and_groups;s&&s.length>0&&(e.object_permission.mcp_servers=s),t&&t.length>0&&(e.object_permission.mcp_access_groups=t),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===(a=e.allowed_agents_and_groups.agents)||void 0===a?void 0:a.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:s,accessGroups:t}=e.allowed_agents_and_groups;s&&s.length>0&&(e.object_permission.agents=s),t&&t.length>0&&(e.object_permission.agent_access_groups=t),delete e.allowed_agents_and_groups}Object.keys(eG).length>0&&(e.aliases=JSON.stringify(eG)),d="service_account"===ey?await (0,W.keyCreateServiceAccountCall)(es,e):await (0,W.keyCreateCall)(es,et,e),console.log("key create Response:",d),ee(d),er.invalidateQueries({queryKey:l.Km.lists()}),ec(d.key),eu(d.soft_budget),G.Z.success("Virtual Key Created"),ei.resetFields(),localStorage.removeItem("userData"+et)}catch(s){console.log("error in create key:",s);let e=H(s);G.Z.fromBackend(e)}};(0,C.useEffect)(()=>{if(et&&ea&&es){var e;$(et,ea,es,null!==(e=null==eS?void 0:eS.team_id)&&void 0!==e?e:null).then(e=>{var s;eg(Array.from(new Set([...null!==(s=null==eS?void 0:eS.models)&&void 0!==s?s:[],...e])))})}ei.setFieldValue("models",[])},[eS,es,et,ea]);let e4=async e=>{if(!e){eF([]);return}eU(!0);try{let s=new URLSearchParams;if(s.append("user_email",e),null==es)return;let t=(await (0,W.userFilterUICall)(es,s)).map(e=>({label:"".concat(e.user_email," (").concat(e.user_id,")"),value:e.user_id,user:e}));eF(t)}catch(e){console.error("Error fetching users:",e),G.Z.fromBackend("Failed to search for users")}finally{eU(!1)}},e1=(0,C.useCallback)(S()(e=>e4(e),300),[es]),e2=(e,s)=>{let t=s.user;ei.setFieldsValue({user_id:t.user_id})};return(0,a.jsxs)("div",{children:[ea&&P.LQ.includes(ea)&&(0,a.jsx)(u.Z,{className:"mx-auto",onClick:()=>eo(!0),children:"+ Create New Key"}),(0,a.jsx)(b.Z,{open:en,width:1e3,footer:null,onOk:eQ,onCancel:e$,children:(0,a.jsxs)(f.Z,{form:ei,onFinish:e0,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)(y.Z,{className:"mb-4",children:"Key Ownership"}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Owned By"," ",(0,a.jsx)(v.Z,{title:"Select who will own this Virtual Key",children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),className:"mb-4",children:(0,a.jsxs)(_.ZP.Group,{onChange:e=>ej(e.target.value),value:ey,children:[(0,a.jsx)(_.ZP,{value:"you",children:"You"}),(0,a.jsx)(_.ZP,{value:"service_account",children:"Service Account"}),"Admin"===ea&&(0,a.jsx)(_.ZP,{value:"another_user",children:"Another User"})]})}),"another_user"===ey&&(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["User ID"," ",(0,a.jsx)(v.Z,{title:"The user who will own this key and be responsible for its usage",children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"user_id",className:"mt-4",rules:[{required:"another_user"===ey,message:"Please input the user ID of the user you are assigning the key to"}],children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{style:{display:"flex",marginBottom:"8px"},children:[(0,a.jsx)(j.default,{showSearch:!0,placeholder:"Type email to search for users",filterOption:!1,onSearch:e=>{e1(e)},onSelect:(e,s)=>e2(e,s),options:eE,loading:eV,allowClear:!0,style:{width:"100%"},notFoundContent:eV?"Searching...":"No users found"}),(0,a.jsx)(w.ZP,{onClick:()=>eP(!0),style:{marginLeft:"8px"},children:"Create User"})]}),(0,a.jsx)("div",{className:"text-xs text-gray-500",children:"Search by email to find users"})]})}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Team"," ",(0,a.jsx)(v.Z,{title:"The team this key belongs to, which determines available models and budget limits",children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"team_id",initialValue:s?s.team_id:null,className:"mt-4",rules:[{required:"service_account"===ey,message:"Please select a team for the service account"}],help:"service_account"===ey?"required":"",children:(0,a.jsx)(K.Z,{teams:t,onChange:e=>{eC((null==t?void 0:t.find(s=>s.team_id===e))||null)}})})]}),eX&&(0,a.jsx)("div",{className:"mb-8 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,a.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."})}),!eX&&(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)(y.Z,{className:"mb-4",children:"Key Details"}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["you"===ey||"another_user"===ey?"Key Name":"Service Account ID"," ",(0,a.jsx)(v.Z,{title:"you"===ey||"another_user"===ey?"A descriptive name to identify this key":"Unique identifier for this service account",children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"key_alias",rules:[{required:!0,message:"Please input a ".concat("you"===ey?"key name":"service account ID")}],help:"required",children:(0,a.jsx)(g.Z,{placeholder:""})}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Models"," ",(0,a.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,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"models",rules:"management"===eq||"read_only"===eq?[]:[{required:!0,message:"Please select a model"}],help:"management"===eq||"read_only"===eq?"Models field is disabled for this key type":"required",className:"mt-4",children:(0,a.jsxs)(j.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},disabled:"management"===eq||"read_only"===eq,onChange:e=>{e.includes("all-team-models")&&ei.setFieldsValue({models:["all-team-models"]})},children:[(0,a.jsx)(Y,{value:"all-team-models",children:"All Team Models"},"all-team-models"),ex.map(e=>(0,a.jsx)(Y,{value:e,children:(0,O.W0)(e)},e))]})}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Key Type"," ",(0,a.jsx)(v.Z,{title:"Select the type of key to determine what routes and operations this key can access",children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"key_type",initialValue:"default",className:"mt-4",children:(0,a.jsxs)(j.default,{defaultValue:"default",placeholder:"Select key type",style:{width:"100%"},optionLabelProp:"label",onChange:e=>{eB(e),("management"===e||"read_only"===e)&&ei.setFieldsValue({models:[]})},children:[(0,a.jsx)(Y,{value:"default",label:"Default",children:(0,a.jsxs)("div",{style:{padding:"4px 0"},children:[(0,a.jsx)("div",{style:{fontWeight:500},children:"Default"}),(0,a.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call LLM API + Management routes"})]})}),(0,a.jsx)(Y,{value:"llm_api",label:"LLM API",children:(0,a.jsxs)("div",{style:{padding:"4px 0"},children:[(0,a.jsx)("div",{style:{fontWeight:500},children:"LLM API"}),(0,a.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only LLM API routes (chat/completions, embeddings, etc.)"})]})}),(0,a.jsx)(Y,{value:"management",label:"Management",children:(0,a.jsxs)("div",{style:{padding:"4px 0"},children:[(0,a.jsx)("div",{style:{fontWeight:500},children:"Management"}),(0,a.jsx)("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:"Can call only management routes (user/team/key management)"})]})})]})})]}),!eX&&(0,a.jsx)("div",{className:"mb-8",children:(0,a.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)(y.Z,{className:"m-0",children:"Optional Settings"})}),(0,a.jsxs)(c.Z,{children:[(0,a.jsx)(f.Z.Item,{className:"mt-4",label:(0,a.jsxs)("span",{children:["Max Budget (USD)"," ",(0,a.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,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"max_budget",help:"Budget cannot exceed team max budget: $".concat((null==s?void 0:s.max_budget)!==null&&(null==s?void 0:s.max_budget)!==void 0?null==s?void 0:s.max_budget:"unlimited"),rules:[{validator:async(e,t)=>{if(t&&s&&null!==s.max_budget&&t>s.max_budget)throw Error("Budget cannot exceed team max budget: $".concat((0,i.pw)(s.max_budget,4)))}}],children:(0,a.jsx)(z.Z,{step:.01,precision:2,width:200})}),(0,a.jsx)(f.Z.Item,{className:"mt-4",label:(0,a.jsxs)("span",{children:["Reset Budget"," ",(0,a.jsx)(v.Z,{title:"How often the budget should reset. For example, setting 'daily' will reset the budget every 24 hours",children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"budget_duration",help:"Team Reset Budget: ".concat((null==s?void 0:s.budget_duration)!==null&&(null==s?void 0:s.budget_duration)!==void 0?null==s?void 0:s.budget_duration:"None"),children:(0,a.jsx)(T.Z,{onChange:e=>ei.setFieldValue("budget_duration",e)})}),(0,a.jsx)(f.Z.Item,{className:"mt-4",label:(0,a.jsxs)("span",{children:["Tokens per minute Limit (TPM)"," ",(0,a.jsx)(v.Z,{title:"Maximum number of tokens this key can process per minute. Helps control usage and costs",children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"tpm_limit",help:"TPM cannot exceed team TPM limit: ".concat((null==s?void 0:s.tpm_limit)!==null&&(null==s?void 0:s.tpm_limit)!==void 0?null==s?void 0:s.tpm_limit:"unlimited"),rules:[{validator:async(e,t)=>{if(t&&s&&null!==s.tpm_limit&&t>s.tpm_limit)throw Error("TPM limit cannot exceed team TPM limit: ".concat(s.tpm_limit))}}],children:(0,a.jsx)(z.Z,{step:1,width:400})}),(0,a.jsx)(D.Z,{type:"tpm",name:"tpm_limit_type",className:"mt-4",initialValue:null,form:ei,showDetailedDescriptions:!0}),(0,a.jsx)(f.Z.Item,{className:"mt-4",label:(0,a.jsxs)("span",{children:["Requests per minute Limit (RPM)"," ",(0,a.jsx)(v.Z,{title:"Maximum number of API requests this key can make per minute. Helps prevent abuse and manage load",children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"rpm_limit",help:"RPM cannot exceed team RPM limit: ".concat((null==s?void 0:s.rpm_limit)!==null&&(null==s?void 0:s.rpm_limit)!==void 0?null==s?void 0:s.rpm_limit:"unlimited"),rules:[{validator:async(e,t)=>{if(t&&s&&null!==s.rpm_limit&&t>s.rpm_limit)throw Error("RPM limit cannot exceed team RPM limit: ".concat(s.rpm_limit))}}],children:(0,a.jsx)(z.Z,{step:1,width:400})}),(0,a.jsx)(D.Z,{type:"rpm",name:"rpm_limit_type",className:"mt-4",initialValue:null,form:ei,showDetailedDescriptions:!0}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Guardrails"," ",(0,a.jsx)(v.Z,{title:"Apply safety guardrails to this key to filter content or enforce policies",children:(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",className:"mt-4",help:el?"Select existing guardrails or enter new ones":"Premium feature - Upgrade to set guardrails by key",children:(0,a.jsx)(j.default,{mode:"tags",style:{width:"100%"},disabled:!el,placeholder:el?"Select or enter guardrails":"Premium feature - Upgrade to set guardrails by key",options:ev.map(e=>({value:e,label:e}))})}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,a.jsx)(v.Z,{title:"When enabled, this key will bypass any guardrails configured to run on every request (global guardrails)",children:(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/guardrails/quick_start",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})})]}),name:"disable_global_guardrails",className:"mt-4",valuePropName:"checked",help:el?"Bypass global guardrails for this key":"Premium feature - Upgrade to disable global guardrails by key",children:(0,a.jsx)(Z.Z,{disabled:!el,checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Prompts"," ",(0,a.jsx)(v.Z,{title:"Allow this key to use specific prompt templates",children:(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/prompt_management",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})})]}),name:"prompts",className:"mt-4",help:el?"Select existing prompts or enter new ones":"Premium feature - Upgrade to set prompts by key",children:(0,a.jsx)(j.default,{mode:"tags",style:{width:"100%"},disabled:!el,placeholder:el?"Select or enter prompts":"Premium feature - Upgrade to set prompts by key",options:ew.map(e=>({value:e,label:e}))})}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Allowed Pass Through Routes"," ",(0,a.jsx)(v.Z,{title:"Allow this key to use specific pass through routes",children:(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/pass_through",target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})})]}),name:"allowed_passthrough_routes",className:"mt-4",help:el?"Select existing pass through routes or enter new ones":"Premium feature - Upgrade to set pass through routes by key",children:(0,a.jsx)(V.Z,{onChange:e=>ei.setFieldValue("allowed_passthrough_routes",e),value:ei.getFieldValue("allowed_passthrough_routes"),accessToken:es,placeholder:el?"Select or enter pass through routes":"Premium feature - Upgrade to set pass through routes by key",disabled:!el,teamId:eS?eS.team_id:null})}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Allowed Vector Stores"," ",(0,a.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,a.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,a.jsx)(J.Z,{onChange:e=>ei.setFieldValue("allowed_vector_store_ids",e),value:ei.getFieldValue("allowed_vector_store_ids"),accessToken:es,placeholder:"Select vector stores (optional)"})}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Metadata"," ",(0,a.jsx)(v.Z,{title:"JSON object with additional information about this key. Used for tracking or custom logic",children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"metadata",className:"mt-4",children:(0,a.jsx)(N.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Tags"," ",(0,a.jsx)(v.Z,{title:"Tags for tracking spend and/or doing tag-based routing. Used for analytics and filtering",children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"tags",className:"mt-4",help:"Tags for tracking spend and/or doing tag-based routing.",children:(0,a.jsx)(j.default,{mode:"tags",style:{width:"100%"},placeholder:"Enter tags",tokenSeparators:[","],options:ef})}),(0,a.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)("b",{children:"MCP Settings"})}),(0,a.jsxs)(c.Z,{children:[(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Allowed MCP Servers"," ",(0,a.jsx)(v.Z,{title:"Select which MCP servers or access groups this key can access",children:(0,a.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,a.jsx)(q.Z,{onChange:e=>ei.setFieldValue("allowed_mcp_servers_and_groups",e),value:ei.getFieldValue("allowed_mcp_servers_and_groups"),accessToken:es,placeholder:"Select MCP servers or access groups (optional)"})}),(0,a.jsx)(f.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,a.jsx)(N.default,{type:"hidden"})}),(0,a.jsx)(f.Z.Item,{noStyle:!0,shouldUpdate:(e,s)=>e.allowed_mcp_servers_and_groups!==s.allowed_mcp_servers_and_groups||e.mcp_tool_permissions!==s.mcp_tool_permissions,children:()=>{var e;return(0,a.jsx)("div",{className:"mt-6",children:(0,a.jsx)(B.Z,{accessToken:es,selectedServers:(null===(e=ei.getFieldValue("allowed_mcp_servers_and_groups"))||void 0===e?void 0:e.servers)||[],toolPermissions:ei.getFieldValue("mcp_tool_permissions")||{},onChange:e=>ei.setFieldsValue({mcp_tool_permissions:e})})})}})]})]}),(0,a.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)("b",{children:"Agent Settings"})}),(0,a.jsx)(c.Z,{children:(0,a.jsx)(f.Z.Item,{label:(0,a.jsxs)("span",{children:["Allowed Agents"," ",(0,a.jsx)(v.Z,{title:"Select which agents or access groups this key can access",children:(0,a.jsx)(n.Z,{style:{marginLeft:"4px"}})})]}),name:"allowed_agents_and_groups",help:"Select agents or access groups this key can access",children:(0,a.jsx)(A.Z,{onChange:e=>ei.setFieldValue("allowed_agents_and_groups",e),value:ei.getFieldValue("allowed_agents_and_groups"),accessToken:es,placeholder:"Select agents or access groups (optional)"})})})]}),el?(0,a.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)("b",{children:"Logging Settings"})}),(0,a.jsx)(c.Z,{children:(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(U.Z,{value:eN,onChange:ek,premiumUser:!0,disabledCallbacks:eR,onDisabledCallbacksChange:eO})})})]}):(0,a.jsx)(v.Z,{title:(0,a.jsxs)("span",{children:["Key-level logging settings is an enterprise feature, get in touch -",(0,a.jsx)("a",{href:"https://www.litellm.ai/enterprise",target:"_blank",children:"https://www.litellm.ai/enterprise"})]}),placement:"top",children:(0,a.jsxs)("div",{style:{position:"relative"},children:[(0,a.jsx)("div",{style:{opacity:.5},children:(0,a.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)("b",{children:"Logging Settings"})}),(0,a.jsx)(c.Z,{children:(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(U.Z,{value:eN,onChange:ek,premiumUser:!1,disabledCallbacks:eR,onDisabledCallbacksChange:eO})})})]})}),(0,a.jsx)("div",{style:{position:"absolute",inset:0,cursor:"not-allowed"}})]})}),(0,a.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)("b",{children:"Model Aliases"})}),(0,a.jsx)(c.Z,{children:(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.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,a.jsx)(F.Z,{accessToken:es,initialModelAliases:eG,onAliasUpdate:eW,showExampleConfig:!1})]})})]}),(0,a.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,a.jsx)(m.Z,{children:(0,a.jsx)("b",{children:"Key Lifecycle"})}),(0,a.jsx)(c.Z,{children:(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(E.Z,{form:ei,autoRotationEnabled:ez,onAutoRotationChange:eJ,rotationInterval:eH,onRotationIntervalChange:eY})})}),(0,a.jsx)(f.Z.Item,{name:"duration",hidden:!0,initialValue:null,children:(0,a.jsx)(N.default,{})})]}),(0,a.jsxs)(d.Z,{className:"mt-4 mb-4",children:[(0,a.jsx)(m.Z,{children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("b",{children:"Advanced Settings"}),(0,a.jsx)(v.Z,{title:(0,a.jsxs)("span",{children:["Learn more about advanced settings in our"," ",(0,a.jsx)("a",{href:W.proxyBaseUrl?"".concat(W.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,a.jsx)(n.Z,{className:"text-gray-400 hover:text-gray-300 cursor-help"})})]})}),(0,a.jsx)(c.Z,{children:(0,a.jsx)(I.Z,{schemaComponent:"GenerateKeyRequest",form:ei,excludedFields:["key_alias","team_id","models","duration","metadata","tags","guardrails","max_budget","budget_duration","tpm_limit","rpm_limit"]})})]})]})]})}),(0,a.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,a.jsx)(w.ZP,{htmlType:"submit",disabled:eX,style:{opacity:eX?.5:1},children:"Create Key"})})]})}),eM&&(0,a.jsx)(b.Z,{title:"Create New User",visible:eM,onCancel:()=>eP(!1),footer:null,width:800,children:(0,a.jsx)(R.Z,{userID:et,accessToken:es,teams:t,possibleUIRoles:eT,onUserCreated:e=>{eL(e),ei.setFieldsValue({user_id:e}),eP(!1)},isEmbedded:!0})}),ed&&(0,a.jsx)(b.Z,{visible:en,onOk:eQ,onCancel:e$,footer:null,children:(0,a.jsxs)(p.Z,{numItems:1,className:"gap-2 w-full",children:[(0,a.jsx)(y.Z,{children:"Save your Key"}),(0,a.jsx)(h.Z,{numColSpan:1,children:(0,a.jsxs)("p",{children:["Please save this secret key somewhere safe and accessible. For security reasons,"," ",(0,a.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,a.jsx)(h.Z,{numColSpan:1,children:null!=ed?(0,a.jsxs)("div",{children:[(0,a.jsx)(x.Z,{className:"mt-3",children:"Virtual Key:"}),(0,a.jsx)("div",{style:{background:"#f8f8f8",padding:"10px",borderRadius:"5px",marginBottom:"10px"},children:(0,a.jsx)("pre",{style:{wordWrap:"break-word",whiteSpace:"normal"},children:ed})}),(0,a.jsx)(M.CopyToClipboard,{text:ed,onCopy:()=>{G.Z.success("Virtual Key copied to clipboard")},children:(0,a.jsx)(u.Z,{className:"mt-3",children:"Copy Virtual Key"})})]}):(0,a.jsx)(x.Z,{children:"Key being created, this might take 30s"})})]})})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1108-7d554d3c02522125.js b/litellm/proxy/_experimental/out/_next/static/chunks/1108-7d554d3c02522125.js deleted file mode 100644 index bf079f880b..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1108-7d554d3c02522125.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1108],{40278:function(t,e,r){"use strict";r.d(e,{Z:function(){return S}});var n=r(5853),o=r(7084),i=r(26898),a=r(13241),u=r(1153),c=r(2265),l=r(47625),s=r(93765),f=r(31699),p=r(97059),h=r(62994),d=r(25311),y=(0,s.z)({chartName:"BarChart",GraphicalChild:f.$,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:p.K},{axisType:"yAxis",AxisComp:h.B}],formatAxisMap:d.t9}),v=r(56940),m=r(26680),b=r(8147),g=r(22190),x=r(65278),w=r(98593),O=r(92666),j=r(32644);let S=c.forwardRef((t,e)=>{let{data:r=[],categories:s=[],index:d,colors:S=i.s,valueFormatter:P=u.Cj,layout:E="horizontal",stack:k=!1,relative:A=!1,startEndOnly:M=!1,animationDuration:T=900,showAnimation:_=!1,showXAxis:C=!0,showYAxis:N=!0,yAxisWidth:D=56,intervalType:I="equidistantPreserveStart",showTooltip:L=!0,showLegend:B=!0,showGridLines:R=!0,autoMinValue:z=!1,minValue:U,maxValue:$,allowDecimals:F=!0,noDataText:q,onValueChange:Z,enableLegendSlider:W=!1,customTooltip:Y,rotateLabelX:H,barCategoryGap:X,tickGap:G=5,xAxisLabel:V,yAxisLabel:K,className:Q,padding:J=C||N?{left:20,right:20}:{left:0,right:0}}=t,tt=(0,n._T)(t,["data","categories","index","colors","valueFormatter","layout","stack","relative","startEndOnly","animationDuration","showAnimation","showXAxis","showYAxis","yAxisWidth","intervalType","showTooltip","showLegend","showGridLines","autoMinValue","minValue","maxValue","allowDecimals","noDataText","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","barCategoryGap","tickGap","xAxisLabel","yAxisLabel","className","padding"]),[te,tr]=(0,c.useState)(60),tn=(0,j.me)(s,S),[to,ti]=c.useState(void 0),[ta,tu]=(0,c.useState)(void 0),tc=!!Z;function tl(t,e,r){var n,o,i,a;r.stopPropagation(),Z&&((0,j.vZ)(to,Object.assign(Object.assign({},t.payload),{value:t.value}))?(tu(void 0),ti(void 0),null==Z||Z(null)):(tu(null===(o=null===(n=t.tooltipPayload)||void 0===n?void 0:n[0])||void 0===o?void 0:o.dataKey),ti(Object.assign(Object.assign({},t.payload),{value:t.value})),null==Z||Z(Object.assign({eventType:"bar",categoryClicked:null===(a=null===(i=t.tooltipPayload)||void 0===i?void 0:i[0])||void 0===a?void 0:a.dataKey},t.payload))))}let ts=(0,j.i4)(z,U,$);return c.createElement("div",Object.assign({ref:e,className:(0,a.q)("w-full h-80",Q)},tt),c.createElement(l.h,{className:"h-full w-full"},(null==r?void 0:r.length)?c.createElement(y,{barCategoryGap:X,data:r,stackOffset:k?"sign":A?"expand":"none",layout:"vertical"===E?"vertical":"horizontal",onClick:tc&&(ta||to)?()=>{ti(void 0),tu(void 0),null==Z||Z(null)}:void 0,margin:{bottom:V?30:void 0,left:K?20:void 0,right:K?5:void 0,top:5}},R?c.createElement(v.q,{className:(0,a.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:"vertical"!==E,vertical:"vertical"===E}):null,"vertical"!==E?c.createElement(p.K,{padding:J,hide:!C,dataKey:d,interval:M?"preserveStartEnd":I,tick:{transform:"translate(0, 6)"},ticks:M?[r[0][d],r[r.length-1][d]]:void 0,fill:"",stroke:"",className:(0,a.q)("mt-4 text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,angle:null==H?void 0:H.angle,dy:null==H?void 0:H.verticalShift,height:null==H?void 0:H.xAxisHeight,minTickGap:G},V&&c.createElement(m._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},V)):c.createElement(p.K,{hide:!C,type:"number",tick:{transform:"translate(-3, 0)"},domain:ts,fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,tickFormatter:P,minTickGap:G,allowDecimals:F,angle:null==H?void 0:H.angle,dy:null==H?void 0:H.verticalShift,height:null==H?void 0:H.xAxisHeight},V&&c.createElement(m._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},V)),"vertical"!==E?c.createElement(h.B,{width:D,hide:!N,axisLine:!1,tickLine:!1,type:"number",domain:ts,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:A?t=>"".concat((100*t).toString()," %"):P,allowDecimals:F},K&&c.createElement(m._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},K)):c.createElement(h.B,{width:D,hide:!N,dataKey:d,axisLine:!1,tickLine:!1,ticks:M?[r[0][d],r[r.length-1][d]]:void 0,type:"category",interval:"preserveStartEnd",tick:{transform:"translate(0, 6)"},fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content")},K&&c.createElement(m._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},K)),c.createElement(b.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{fill:"#d1d5db",opacity:"0.15"},content:L?t=>{let{active:e,payload:r,label:n}=t;return Y?c.createElement(Y,{payload:null==r?void 0:r.map(t=>{var e;return Object.assign(Object.assign({},t),{color:null!==(e=tn.get(t.dataKey))&&void 0!==e?e:o.fr.Gray})}),active:e,label:n}):c.createElement(w.ZP,{active:e,payload:r,label:n,valueFormatter:P,categoryColors:tn})}:c.createElement(c.Fragment,null),position:{y:0}}),B?c.createElement(g.D,{verticalAlign:"top",height:te,content:t=>{let{payload:e}=t;return(0,x.Z)({payload:e},tn,tr,ta,tc?t=>{tc&&(t!==ta||to?(tu(t),null==Z||Z({eventType:"category",categoryClicked:t})):(tu(void 0),null==Z||Z(null)),ti(void 0))}:void 0,W)}}):null,s.map(t=>{var e;return c.createElement(f.$,{className:(0,a.q)((0,u.bM)(null!==(e=tn.get(t))&&void 0!==e?e:o.fr.Gray,i.K.background).fillColor,Z?"cursor-pointer":""),key:t,name:t,type:"linear",stackId:k||A?"a":void 0,dataKey:t,fill:"",isAnimationActive:_,animationDuration:T,shape:t=>((t,e,r,n)=>{let{fillOpacity:o,name:i,payload:a,value:u}=t,{x:l,width:s,y:f,height:p}=t;return"horizontal"===n&&p<0?(f+=p,p=Math.abs(p)):"vertical"===n&&s<0&&(l+=s,s=Math.abs(s)),c.createElement("rect",{x:l,y:f,width:s,height:p,opacity:e||r&&r!==i?(0,j.vZ)(e,Object.assign(Object.assign({},a),{value:u}))?o:.3:o})})(t,to,ta,E),onClick:tl})})):c.createElement(O.Z,{noDataText:q})))});S.displayName="BarChart"},65278:function(t,e,r){"use strict";r.d(e,{Z:function(){return y}});var n=r(2265);let o=t=>{n.useEffect(()=>{let e=()=>{t()};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t])};var i=r(5853),a=r(26898),u=r(13241),c=r(1153);let l=t=>{var e=(0,i._T)(t,[]);return n.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),n.createElement("path",{d:"M8 12L14 6V18L8 12Z"}))},s=t=>{var e=(0,i._T)(t,[]);return n.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),n.createElement("path",{d:"M16 12L10 18V6L16 12Z"}))},f=(0,c.fn)("Legend"),p=t=>{let{name:e,color:r,onClick:o,activeLegend:i}=t,l=!!o;return n.createElement("li",{className:(0,u.q)(f("legendItem"),"group inline-flex items-center px-2 py-0.5 rounded-tremor-small transition whitespace-nowrap",l?"cursor-pointer":"cursor-default","text-tremor-content",l?"hover:bg-tremor-background-subtle":"","dark:text-dark-tremor-content",l?"dark:hover:bg-dark-tremor-background-subtle":""),onClick:t=>{t.stopPropagation(),null==o||o(e,r)}},n.createElement("svg",{className:(0,u.q)("flex-none h-2 w-2 mr-1.5",(0,c.bM)(r,a.K.text).textColor,i&&i!==e?"opacity-40":"opacity-100"),fill:"currentColor",viewBox:"0 0 8 8"},n.createElement("circle",{cx:4,cy:4,r:4})),n.createElement("p",{className:(0,u.q)("whitespace-nowrap truncate text-tremor-default","text-tremor-content",l?"group-hover:text-tremor-content-emphasis":"","dark:text-dark-tremor-content",i&&i!==e?"opacity-40":"opacity-100",l?"dark:group-hover:text-dark-tremor-content-emphasis":"")},e))},h=t=>{let{icon:e,onClick:r,disabled:o}=t,[i,a]=n.useState(!1),c=n.useRef(null);return n.useEffect(()=>(i?c.current=setInterval(()=>{null==r||r()},300):clearInterval(c.current),()=>clearInterval(c.current)),[i,r]),(0,n.useEffect)(()=>{o&&(clearInterval(c.current),a(!1))},[o]),n.createElement("button",{type:"button",className:(0,u.q)(f("legendSliderButton"),"w-5 group inline-flex items-center truncate rounded-tremor-small transition",o?"cursor-not-allowed":"cursor-pointer",o?"text-tremor-content-subtle":"text-tremor-content hover:text-tremor-content-emphasis hover:bg-tremor-background-subtle",o?"dark:text-dark-tremor-subtle":"dark:text-dark-tremor dark:hover:text-tremor-content-emphasis dark:hover:bg-dark-tremor-background-subtle"),disabled:o,onClick:t=>{t.stopPropagation(),null==r||r()},onMouseDown:t=>{t.stopPropagation(),a(!0)},onMouseUp:t=>{t.stopPropagation(),a(!1)}},n.createElement(e,{className:"w-full"}))},d=n.forwardRef((t,e)=>{let{categories:r,colors:o=a.s,className:c,onClickLegendItem:d,activeLegend:y,enableLegendSlider:v=!1}=t,m=(0,i._T)(t,["categories","colors","className","onClickLegendItem","activeLegend","enableLegendSlider"]),b=n.useRef(null),g=n.useRef(null),[x,w]=n.useState(null),[O,j]=n.useState(null),S=n.useRef(null),P=(0,n.useCallback)(()=>{let t=null==b?void 0:b.current;t&&w({left:t.scrollLeft>0,right:t.scrollWidth-t.clientWidth>t.scrollLeft})},[w]),E=(0,n.useCallback)(t=>{var e,r;let n=null==b?void 0:b.current,o=null==g?void 0:g.current,i=null!==(e=null==n?void 0:n.clientWidth)&&void 0!==e?e:0,a=null!==(r=null==o?void 0:o.clientWidth)&&void 0!==r?r:0;n&&v&&(n.scrollTo({left:"left"===t?n.scrollLeft-i+a:n.scrollLeft+i-a,behavior:"smooth"}),setTimeout(()=>{P()},400))},[v,P]);n.useEffect(()=>{let t=t=>{"ArrowLeft"===t?E("left"):"ArrowRight"===t&&E("right")};return O?(t(O),S.current=setInterval(()=>{t(O)},300)):clearInterval(S.current),()=>clearInterval(S.current)},[O,E]);let k=t=>{t.stopPropagation(),"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(t.preventDefault(),j(t.key))},A=t=>{t.stopPropagation(),j(null)};return n.useEffect(()=>{let t=null==b?void 0:b.current;return v&&(P(),null==t||t.addEventListener("keydown",k),null==t||t.addEventListener("keyup",A)),()=>{null==t||t.removeEventListener("keydown",k),null==t||t.removeEventListener("keyup",A)}},[P,v]),n.createElement("ol",Object.assign({ref:e,className:(0,u.q)(f("root"),"relative overflow-hidden",c)},m),n.createElement("div",{ref:b,tabIndex:0,className:(0,u.q)("h-full flex",v?(null==x?void 0:x.right)||(null==x?void 0:x.left)?"pl-4 pr-12 items-center overflow-auto snap-mandatory [&::-webkit-scrollbar]:hidden [scrollbar-width:none]":"":"flex-wrap")},r.map((t,e)=>n.createElement(p,{key:"item-".concat(e),name:t,color:o[e%o.length],onClick:d,activeLegend:y}))),v&&((null==x?void 0:x.right)||(null==x?void 0:x.left))?n.createElement(n.Fragment,null,n.createElement("div",{className:(0,u.q)("bg-tremor-background","dark:bg-dark-tremor-background","absolute flex top-0 pr-1 bottom-0 right-0 items-center justify-center h-full"),ref:g},n.createElement(h,{icon:l,onClick:()=>{j(null),E("left")},disabled:!(null==x?void 0:x.left)}),n.createElement(h,{icon:s,onClick:()=>{j(null),E("right")},disabled:!(null==x?void 0:x.right)}))):null)});d.displayName="Legend";let y=(t,e,r,i,a,u)=>{let{payload:c}=t,l=(0,n.useRef)(null);o(()=>{var t,e;r((e=null===(t=l.current)||void 0===t?void 0:t.clientHeight)?Number(e)+20:60)});let s=c.filter(t=>"none"!==t.type);return n.createElement("div",{ref:l,className:"flex items-center justify-end"},n.createElement(d,{categories:s.map(t=>t.value),colors:s.map(t=>e.get(t.value)),onClickLegendItem:a,activeLegend:i,enableLegendSlider:u}))}},98593:function(t,e,r){"use strict";r.d(e,{$B:function(){return c},ZP:function(){return s},zX:function(){return l}});var n=r(2265),o=r(7084),i=r(26898),a=r(13241),u=r(1153);let c=t=>{let{children:e}=t;return n.createElement("div",{className:(0,a.q)("rounded-tremor-default text-tremor-default border","bg-tremor-background shadow-tremor-dropdown border-tremor-border","dark:bg-dark-tremor-background dark:shadow-dark-tremor-dropdown dark:border-dark-tremor-border")},e)},l=t=>{let{value:e,name:r,color:o}=t;return n.createElement("div",{className:"flex items-center justify-between space-x-8"},n.createElement("div",{className:"flex items-center space-x-2"},n.createElement("span",{className:(0,a.q)("shrink-0 rounded-tremor-full border-2 h-3 w-3","border-tremor-background shadow-tremor-card","dark:border-dark-tremor-background dark:shadow-dark-tremor-card",(0,u.bM)(o,i.K.background).bgColor)}),n.createElement("p",{className:(0,a.q)("text-right whitespace-nowrap","text-tremor-content","dark:text-dark-tremor-content")},r)),n.createElement("p",{className:(0,a.q)("font-medium tabular-nums text-right whitespace-nowrap","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e))},s=t=>{let{active:e,payload:r,label:i,categoryColors:u,valueFormatter:s}=t;if(e&&r){let t=r.filter(t=>"none"!==t.type);return n.createElement(c,null,n.createElement("div",{className:(0,a.q)("border-tremor-border border-b px-4 py-2","dark:border-dark-tremor-border")},n.createElement("p",{className:(0,a.q)("font-medium","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},i)),n.createElement("div",{className:(0,a.q)("px-4 py-2 space-y-1")},t.map((t,e)=>{var r;let{value:i,name:a}=t;return n.createElement(l,{key:"id-".concat(e),value:s(i),name:a,color:null!==(r=u.get(a))&&void 0!==r?r:o.fr.Blue})})))}return null}},92666:function(t,e,r){"use strict";r.d(e,{Z:function(){return i}});var n=r(13241),o=r(2265);let i=t=>{let{className:e,noDataText:r="No data"}=t;return o.createElement("div",{className:(0,n.q)("flex items-center justify-center w-full h-full border border-dashed rounded-tremor-default","border-tremor-border","dark:border-dark-tremor-border",e)},o.createElement("p",{className:(0,n.q)("text-tremor-content text-tremor-default","dark:text-dark-tremor-content")},r))}},32644:function(t,e,r){"use strict";r.d(e,{FB:function(){return i},i4:function(){return o},me:function(){return n},vZ:function(){return function t(e,r){if(e===r)return!0;if("object"!=typeof e||"object"!=typeof r||null===e||null===r)return!1;let n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;for(let i of n)if(!o.includes(i)||!t(e[i],r[i]))return!1;return!0}}});let n=(t,e)=>{let r=new Map;return t.forEach((t,n)=>{r.set(t,e[n%e.length])}),r},o=(t,e,r)=>[t?"auto":null!=e?e:0,null!=r?r:"auto"];function i(t,e){let r=[];for(let n of t)if(Object.prototype.hasOwnProperty.call(n,e)&&(r.push(n[e]),r.length>1))return!1;return!0}},49804:function(t,e,r){"use strict";r.d(e,{Z:function(){return l}});var n=r(5853),o=r(13241),i=r(1153),a=r(2265),u=r(9496);let c=(0,i.fn)("Col"),l=a.forwardRef((t,e)=>{let{numColSpan:r=1,numColSpanSm:i,numColSpanMd:l,numColSpanLg:s,children:f,className:p}=t,h=(0,n._T)(t,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),d=(t,e)=>t&&Object.keys(e).includes(String(t))?e[t]:"";return a.createElement("div",Object.assign({ref:e,className:(0,o.q)(c("root"),(()=>{let t=d(r,u.PT),e=d(i,u.SP),n=d(l,u.VS),a=d(s,u._w);return(0,o.q)(t,e,n,a)})(),p)},h),f)});l.displayName="Col"},97765:function(t,e,r){"use strict";r.d(e,{Z:function(){return c}});var n=r(5853),o=r(26898),i=r(13241),a=r(1153),u=r(2265);let c=u.forwardRef((t,e)=>{let{color:r,children:c,className:l}=t,s=(0,n._T)(t,["color","children","className"]);return u.createElement("p",Object.assign({ref:e,className:(0,i.q)(r?(0,a.bM)(r,o.K.lightText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",l)},s),c)});c.displayName="Subtitle"},61134:function(t,e,r){var n;!function(o){"use strict";var i,a={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},u=!0,c="[DecimalError] ",l=c+"Invalid argument: ",s=c+"Exponent out of range: ",f=Math.floor,p=Math.pow,h=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d=f(1286742750677284.5),y={};function v(t,e){var r,n,o,i,a,c,l,s,f=t.constructor,p=f.precision;if(!t.s||!e.s)return e.s||(e=new f(t)),u?E(e,p):e;if(l=t.d,s=e.d,a=t.e,o=e.e,l=l.slice(),i=a-o){for(i<0?(n=l,i=-i,c=s.length):(n=s,o=a,c=l.length),i>(c=(a=Math.ceil(p/7))>c?a+1:c+1)&&(i=c,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((c=l.length)-(i=s.length)<0&&(i=c,n=s,s=l,l=n),r=0;i;)r=(l[--i]=l[i]+s[i]+r)/1e7|0,l[i]%=1e7;for(r&&(l.unshift(r),++o),c=l.length;0==l[--c];)l.pop();return e.d=l,e.e=o,u?E(e,p):e}function m(t,e,r){if(t!==~~t||tr)throw Error(l+t)}function b(t){var e,r,n,o=t.length-1,i="",a=t[0];if(o>0){for(i+=a,e=1;et.e^this.s<0?1:-1;for(e=0,r=(n=this.d.length)<(o=t.d.length)?n:o;et.d[e]^this.s<0?1:-1;return n===o?0:n>o^this.s<0?1:-1},y.decimalPlaces=y.dp=function(){var t=this.d.length-1,e=(t-this.e)*7;if(t=this.d[t])for(;t%10==0;t/=10)e--;return e<0?0:e},y.dividedBy=y.div=function(t){return g(this,new this.constructor(t))},y.dividedToIntegerBy=y.idiv=function(t){var e=this.constructor;return E(g(this,new e(t),0,1),e.precision)},y.equals=y.eq=function(t){return!this.cmp(t)},y.exponent=function(){return w(this)},y.greaterThan=y.gt=function(t){return this.cmp(t)>0},y.greaterThanOrEqualTo=y.gte=function(t){return this.cmp(t)>=0},y.isInteger=y.isint=function(){return this.e>this.d.length-2},y.isNegative=y.isneg=function(){return this.s<0},y.isPositive=y.ispos=function(){return this.s>0},y.isZero=function(){return 0===this.s},y.lessThan=y.lt=function(t){return 0>this.cmp(t)},y.lessThanOrEqualTo=y.lte=function(t){return 1>this.cmp(t)},y.logarithm=y.log=function(t){var e,r=this.constructor,n=r.precision,o=n+5;if(void 0===t)t=new r(10);else if((t=new r(t)).s<1||t.eq(i))throw Error(c+"NaN");if(this.s<1)throw Error(c+(this.s?"NaN":"-Infinity"));return this.eq(i)?new r(0):(u=!1,e=g(S(this,o),S(t,o),o),u=!0,E(e,n))},y.minus=y.sub=function(t){return t=new this.constructor(t),this.s==t.s?k(this,t):v(this,(t.s=-t.s,t))},y.modulo=y.mod=function(t){var e,r=this.constructor,n=r.precision;if(!(t=new r(t)).s)throw Error(c+"NaN");return this.s?(u=!1,e=g(this,t,0,1).times(t),u=!0,this.minus(e)):E(new r(this),n)},y.naturalExponential=y.exp=function(){return x(this)},y.naturalLogarithm=y.ln=function(){return S(this)},y.negated=y.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t},y.plus=y.add=function(t){return t=new this.constructor(t),this.s==t.s?v(this,t):k(this,(t.s=-t.s,t))},y.precision=y.sd=function(t){var e,r,n;if(void 0!==t&&!!t!==t&&1!==t&&0!==t)throw Error(l+t);if(e=w(this)+1,r=7*(n=this.d.length-1)+1,n=this.d[n]){for(;n%10==0;n/=10)r--;for(n=this.d[0];n>=10;n/=10)r++}return t&&e>r?e:r},y.squareRoot=y.sqrt=function(){var t,e,r,n,o,i,a,l=this.constructor;if(this.s<1){if(!this.s)return new l(0);throw Error(c+"NaN")}for(t=w(this),u=!1,0==(o=Math.sqrt(+this))||o==1/0?(((e=b(this.d)).length+t)%2==0&&(e+="0"),o=Math.sqrt(e),t=f((t+1)/2)-(t<0||t%2),n=new l(e=o==1/0?"5e"+t:(e=o.toExponential()).slice(0,e.indexOf("e")+1)+t)):n=new l(o.toString()),o=a=(r=l.precision)+3;;)if(n=(i=n).plus(g(this,i,a+2)).times(.5),b(i.d).slice(0,a)===(e=b(n.d)).slice(0,a)){if(e=e.slice(a-3,a+1),o==a&&"4999"==e){if(E(i,r+1,0),i.times(i).eq(this)){n=i;break}}else if("9999"!=e)break;a+=4}return u=!0,E(n,r)},y.times=y.mul=function(t){var e,r,n,o,i,a,c,l,s,f=this.constructor,p=this.d,h=(t=new f(t)).d;if(!this.s||!t.s)return new f(0);for(t.s*=this.s,r=this.e+t.e,(l=p.length)<(s=h.length)&&(i=p,p=h,h=i,a=l,l=s,s=a),i=[],n=a=l+s;n--;)i.push(0);for(n=s;--n>=0;){for(e=0,o=l+n;o>n;)c=i[o]+h[n]*p[o-n-1]+e,i[o--]=c%1e7|0,e=c/1e7|0;i[o]=(i[o]+e)%1e7|0}for(;!i[--a];)i.pop();return e?++r:i.shift(),t.d=i,t.e=r,u?E(t,f.precision):t},y.toDecimalPlaces=y.todp=function(t,e){var r=this,n=r.constructor;return(r=new n(r),void 0===t)?r:(m(t,0,1e9),void 0===e?e=n.rounding:m(e,0,8),E(r,t+w(r)+1,e))},y.toExponential=function(t,e){var r,n=this,o=n.constructor;return void 0===t?r=A(n,!0):(m(t,0,1e9),void 0===e?e=o.rounding:m(e,0,8),r=A(n=E(new o(n),t+1,e),!0,t+1)),r},y.toFixed=function(t,e){var r,n,o=this.constructor;return void 0===t?A(this):(m(t,0,1e9),void 0===e?e=o.rounding:m(e,0,8),r=A((n=E(new o(this),t+w(this)+1,e)).abs(),!1,t+w(n)+1),this.isneg()&&!this.isZero()?"-"+r:r)},y.toInteger=y.toint=function(){var t=this.constructor;return E(new t(this),w(this)+1,t.rounding)},y.toNumber=function(){return+this},y.toPower=y.pow=function(t){var e,r,n,o,a,l,s=this,p=s.constructor,h=+(t=new p(t));if(!t.s)return new p(i);if(!(s=new p(s)).s){if(t.s<1)throw Error(c+"Infinity");return s}if(s.eq(i))return s;if(n=p.precision,t.eq(i))return E(s,n);if(l=(e=t.e)>=(r=t.d.length-1),a=s.s,l){if((r=h<0?-h:h)<=9007199254740991){for(o=new p(i),e=Math.ceil(n/7+4),u=!1;r%2&&M((o=o.times(s)).d,e),0!==(r=f(r/2));)M((s=s.times(s)).d,e);return u=!0,t.s<0?new p(i).div(o):E(o,n)}}else if(a<0)throw Error(c+"NaN");return a=a<0&&1&t.d[Math.max(e,r)]?-1:1,s.s=1,u=!1,o=t.times(S(s,n+12)),u=!0,(o=x(o)).s=a,o},y.toPrecision=function(t,e){var r,n,o=this,i=o.constructor;return void 0===t?(r=w(o),n=A(o,r<=i.toExpNeg||r>=i.toExpPos)):(m(t,1,1e9),void 0===e?e=i.rounding:m(e,0,8),r=w(o=E(new i(o),t,e)),n=A(o,t<=r||r<=i.toExpNeg,t)),n},y.toSignificantDigits=y.tosd=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(m(t,1,1e9),void 0===e?e=r.rounding:m(e,0,8)),E(new r(this),t,e)},y.toString=y.valueOf=y.val=y.toJSON=function(){var t=w(this),e=this.constructor;return A(this,t<=e.toExpNeg||t>=e.toExpPos)};var g=function(){function t(t,e){var r,n=0,o=t.length;for(t=t.slice();o--;)r=t[o]*e+n,t[o]=r%1e7|0,n=r/1e7|0;return n&&t.unshift(n),t}function e(t,e,r,n){var o,i;if(r!=n)i=r>n?1:-1;else for(o=i=0;oe[o]?1:-1;break}return i}function r(t,e,r){for(var n=0;r--;)t[r]-=n,n=t[r]1;)t.shift()}return function(n,o,i,a){var u,l,s,f,p,h,d,y,v,m,b,g,x,O,j,S,P,k,A=n.constructor,M=n.s==o.s?1:-1,T=n.d,_=o.d;if(!n.s)return new A(n);if(!o.s)throw Error(c+"Division by zero");for(s=0,l=n.e-o.e,P=_.length,j=T.length,y=(d=new A(M)).d=[];_[s]==(T[s]||0);)++s;if(_[s]>(T[s]||0)&&--l,(g=null==i?i=A.precision:a?i+(w(n)-w(o))+1:i)<0)return new A(0);if(g=g/7+2|0,s=0,1==P)for(f=0,_=_[0],g++;(s1&&(_=t(_,f),T=t(T,f),P=_.length,j=T.length),O=P,m=(v=T.slice(0,P)).length;m=1e7/2&&++S;do f=0,(u=e(_,v,P,m))<0?(b=v[0],P!=m&&(b=1e7*b+(v[1]||0)),(f=b/S|0)>1?(f>=1e7&&(f=1e7-1),h=(p=t(_,f)).length,m=v.length,1==(u=e(p,v,h,m))&&(f--,r(p,P16)throw Error(s+w(t));if(!t.s)return new h(i);for(null==e?(u=!1,c=d):c=e,a=new h(.03125);t.abs().gte(.1);)t=t.times(a),f+=5;for(c+=Math.log(p(2,f))/Math.LN10*2+5|0,r=n=o=new h(i),h.precision=c;;){if(n=E(n.times(t),c),r=r.times(++l),b((a=o.plus(g(n,r,c))).d).slice(0,c)===b(o.d).slice(0,c)){for(;f--;)o=E(o.times(o),c);return h.precision=d,null==e?(u=!0,E(o,d)):o}o=a}}function w(t){for(var e=7*t.e,r=t.d[0];r>=10;r/=10)e++;return e}function O(t,e,r){if(e>t.LN10.sd())throw u=!0,r&&(t.precision=r),Error(c+"LN10 precision limit exceeded");return E(new t(t.LN10),e)}function j(t){for(var e="";t--;)e+="0";return e}function S(t,e){var r,n,o,a,l,s,f,p,h,d=1,y=t,v=y.d,m=y.constructor,x=m.precision;if(y.s<1)throw Error(c+(y.s?"NaN":"-Infinity"));if(y.eq(i))return new m(0);if(null==e?(u=!1,p=x):p=e,y.eq(10))return null==e&&(u=!0),O(m,p);if(p+=10,m.precision=p,n=(r=b(v)).charAt(0),!(15e14>Math.abs(a=w(y))))return f=O(m,p+2,x).times(a+""),y=S(new m(n+"."+r.slice(1)),p-10).plus(f),m.precision=x,null==e?(u=!0,E(y,x)):y;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=b((y=y.times(t)).d)).charAt(0),d++;for(a=w(y),n>1?(y=new m("0."+r),a++):y=new m(n+"."+r.slice(1)),s=l=y=g(y.minus(i),y.plus(i),p),h=E(y.times(y),p),o=3;;){if(l=E(l.times(h),p),b((f=s.plus(g(l,new m(o),p))).d).slice(0,p)===b(s.d).slice(0,p))return s=s.times(2),0!==a&&(s=s.plus(O(m,p+2,x).times(a+""))),s=g(s,new m(d),p),m.precision=x,null==e?(u=!0,E(s,x)):s;s=f,o+=2}}function P(t,e){var r,n,o;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;48===e.charCodeAt(n);)++n;for(o=e.length;48===e.charCodeAt(o-1);)--o;if(e=e.slice(n,o)){if(o-=n,r=r-n-1,t.e=f(r/7),t.d=[],n=(r+1)%7,r<0&&(n+=7),nd||t.e<-d))throw Error(s+r)}else t.s=0,t.e=0,t.d=[0];return t}function E(t,e,r){var n,o,i,a,c,l,h,y,v=t.d;for(a=1,i=v[0];i>=10;i/=10)a++;if((n=e-a)<0)n+=7,o=e,h=v[y=0];else{if((y=Math.ceil((n+1)/7))>=(i=v.length))return t;for(a=1,h=i=v[y];i>=10;i/=10)a++;n%=7,o=n-7+a}if(void 0!==r&&(c=h/(i=p(10,a-o-1))%10|0,l=e<0||void 0!==v[y+1]||h%i,l=r<4?(c||l)&&(0==r||r==(t.s<0?3:2)):c>5||5==c&&(4==r||l||6==r&&(n>0?o>0?h/p(10,a-o):0:v[y-1])%10&1||r==(t.s<0?8:7))),e<1||!v[0])return l?(i=w(t),v.length=1,e=e-i-1,v[0]=p(10,(7-e%7)%7),t.e=f(-e/7)||0):(v.length=1,v[0]=t.e=t.s=0),t;if(0==n?(v.length=y,i=1,y--):(v.length=y+1,i=p(10,7-n),v[y]=o>0?(h/p(10,a-o)%p(10,o)|0)*i:0),l)for(;;){if(0==y){1e7==(v[0]+=i)&&(v[0]=1,++t.e);break}if(v[y]+=i,1e7!=v[y])break;v[y--]=0,i=1}for(n=v.length;0===v[--n];)v.pop();if(u&&(t.e>d||t.e<-d))throw Error(s+w(t));return t}function k(t,e){var r,n,o,i,a,c,l,s,f,p,h=t.constructor,d=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),u?E(e,d):e;if(l=t.d,p=e.d,n=e.e,s=t.e,l=l.slice(),a=s-n){for((f=a<0)?(r=l,a=-a,c=p.length):(r=p,n=s,c=l.length),a>(o=Math.max(Math.ceil(d/7),c)+2)&&(a=o,r.length=1),r.reverse(),o=a;o--;)r.push(0);r.reverse()}else{for((f=(o=l.length)<(c=p.length))&&(c=o),o=0;o0;--o)l[c++]=0;for(o=p.length;o>a;){if(l[--o]0?i=i.charAt(0)+"."+i.slice(1)+j(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(o<0?"e":"e+")+o):o<0?(i="0."+j(-o-1)+i,r&&(n=r-a)>0&&(i+=j(n))):o>=a?(i+=j(o+1-a),r&&(n=r-o-1)>0&&(i=i+"."+j(n))):((n=o+1)0&&(o+1===a&&(i+="."),i+=j(n))),t.s<0?"-"+i:i}function M(t,e){if(t.length>e)return t.length=e,!0}function T(t){if(!t||"object"!=typeof t)throw Error(c+"Object expected");var e,r,n,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e=o[e+1]&&n<=o[e+2])this[r]=n;else throw Error(l+r+": "+n)}if(void 0!==(n=t[r="LN10"])){if(n==Math.LN10)this[r]=new this(n);else throw Error(l+r+": "+n)}return this}(a=function t(e){var r,n,o;function i(t){if(!(this instanceof i))return new i(t);if(this.constructor=i,t instanceof i){this.s=t.s,this.e=t.e,this.d=(t=t.d)?t.slice():t;return}if("number"==typeof t){if(0*t!=0)throw Error(l+t);if(t>0)this.s=1;else if(t<0)t=-t,this.s=-1;else{this.s=0,this.e=0,this.d=[0];return}if(t===~~t&&t<1e7){this.e=0,this.d=[t];return}return P(this,t.toString())}if("string"!=typeof t)throw Error(l+t);if(45===t.charCodeAt(0)?(t=t.slice(1),this.s=-1):this.s=1,h.test(t))P(this,t);else throw Error(l+t)}if(i.prototype=y,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=t,i.config=i.set=T,void 0===e&&(e={}),e)for(r=0,o=["precision","rounding","toExpNeg","toExpPos","LN10"];r-1}},56883:function(t){t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n0&&i(s)?r>1?t(s,r-1,i,a,u):n(u,s):a||(u[u.length]=s)}return u}},63321:function(t,e,r){var n=r(33023)();t.exports=n},98060:function(t,e,r){var n=r(63321),o=r(43228);t.exports=function(t,e){return t&&n(t,e,o)}},92167:function(t,e,r){var n=r(67906),o=r(70235);t.exports=function(t,e){e=n(e,t);for(var r=0,i=e.length;null!=t&&re}},93012:function(t){t.exports=function(t,e){return null!=t&&e in Object(t)}},47909:function(t,e,r){var n=r(8235),o=r(31953),i=r(35281);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},90370:function(t,e,r){var n=r(54506),o=r(10303);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},56318:function(t,e,r){var n=r(6791),o=r(10303);t.exports=function t(e,r,i,a,u){return e===r||(null!=e&&null!=r&&(o(e)||o(r))?n(e,r,i,a,t,u):e!=e&&r!=r)}},6791:function(t,e,r){var n=r(85885),o=r(97638),i=r(88030),a=r(64974),u=r(81690),c=r(25614),l=r(98051),s=r(9792),f="[object Arguments]",p="[object Array]",h="[object Object]",d=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,y,v,m){var b=c(t),g=c(e),x=b?p:u(t),w=g?p:u(e);x=x==f?h:x,w=w==f?h:w;var O=x==h,j=w==h,S=x==w;if(S&&l(t)){if(!l(e))return!1;b=!0,O=!1}if(S&&!O)return m||(m=new n),b||s(t)?o(t,e,r,y,v,m):i(t,e,x,r,y,v,m);if(!(1&r)){var P=O&&d.call(t,"__wrapped__"),E=j&&d.call(e,"__wrapped__");if(P||E){var k=P?t.value():t,A=E?e.value():e;return m||(m=new n),v(k,A,r,y,m)}}return!!S&&(m||(m=new n),a(t,e,r,y,v,m))}},62538:function(t,e,r){var n=r(85885),o=r(56318);t.exports=function(t,e,r,i){var a=r.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var l=r[a];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++ao?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n=200){var y=e?null:u(t);if(y)return c(y);p=!1,s=a,d=new n}else d=e?[]:h;t:for(;++l=o?t:n(t,e,r)}},1536:function(t,e,r){var n=r(78371);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,a=n(t),u=void 0!==e,c=null===e,l=e==e,s=n(e);if(!c&&!s&&!a&&t>e||a&&u&&l&&!c&&!s||o&&u&&l||!r&&l||!i)return 1;if(!o&&!a&&!s&&t=c)return l;return l*("desc"==r[o]?-1:1)}}return t.index-e.index}},92077:function(t,e,r){var n=r(74288)["__core-js_shared__"];t.exports=n},97930:function(t,e,r){var n=r(5629);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,a=e?i:-1,u=Object(r);(e?a--:++a-1?u[c?e[l]:l]:void 0}}},35464:function(t,e,r){var n=r(19608),o=r(49639),i=r(175);t.exports=function(t){return function(e,r,a){return a&&"number"!=typeof a&&o(e,r,a)&&(r=a=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),a=void 0===a?es))return!1;var p=c.get(t),h=c.get(e);if(p&&h)return p==e&&h==t;var d=-1,y=!0,v=2&r?new n:void 0;for(c.set(t,e),c.set(e,t);++d-1&&t%1==0&&t-1}},13368:function(t,e,r){var n=r(24457);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},38764:function(t,e,r){var n=r(9855),o=r(99078),i=r(88675);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},78615:function(t,e,r){var n=r(1507);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},83391:function(t,e,r){var n=r(1507);t.exports=function(t){return n(this,t).get(t)}},53483:function(t,e,r){var n=r(1507);t.exports=function(t){return n(this,t).has(t)}},74724:function(t,e,r){var n=r(1507);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},22523:function(t){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}},47073:function(t){t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},23787:function(t,e,r){var n=r(50967);t.exports=function(t){var e=n(t,function(t){return 500===r.size&&r.clear(),t}),r=e.cache;return e}},20453:function(t,e,r){var n=r(39866)(Object,"create");t.exports=n},77184:function(t,e,r){var n=r(45070)(Object.keys,Object);t.exports=n},39931:function(t,e,r){t=r.nmd(t);var n=r(17071),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,a=i&&i.exports===o&&n.process,u=function(){try{var t=i&&i.require&&i.require("util").types;if(t)return t;return a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=u},80910:function(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},45070:function(t){t.exports=function(t,e){return function(r){return t(e(r))}}},49478:function(t,e,r){var n=r(60493),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,a=-1,u=o(i.length-e,0),c=Array(u);++a0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},84092:function(t,e,r){var n=r(99078);t.exports=function(){this.__data__=new n,this.size=0}},31663:function(t){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},69135:function(t){t.exports=function(t){return this.__data__.get(t)}},39552:function(t){t.exports=function(t){return this.__data__.has(t)}},63960:function(t,e,r){var n=r(99078),o=r(88675),i=r(76219);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var a=r.__data__;if(!o||a.length<199)return a.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(a)}return r.set(t,e),this.size=r.size,this}},35281:function(t){t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n=e||r<0||v&&n>=s}function x(){var t,r,n,i=o();if(g(i))return w(i);p=setTimeout(x,(t=i-h,r=i-d,n=e-t,v?u(n,s-r):n))}function w(t){return(p=void 0,m&&c)?b(t):(c=l=void 0,f)}function O(){var t,r=o(),n=g(r);if(c=arguments,l=this,h=r,n){if(void 0===p)return d=t=h,p=setTimeout(x,e),y?b(t):f;if(v)return clearTimeout(p),p=setTimeout(x,e),b(h)}return void 0===p&&(p=setTimeout(x,e)),f}return e=i(e)||0,n(r)&&(y=!!r.leading,s=(v="maxWait"in r)?a(i(r.maxWait)||0,e):s,m="trailing"in r?!!r.trailing:m),O.cancel=function(){void 0!==p&&clearTimeout(p),d=0,c=h=l=p=void 0},O.flush=function(){return void 0===p?f:w(o())},O}},37560:function(t){t.exports=function(t,e){return t===e||t!=t&&e!=e}},32242:function(t,e,r){var n=r(78897),o=r(28935),i=r(88157),a=r(25614),u=r(49639);t.exports=function(t,e,r){var c=a(t)?n:o;return r&&u(t,e,r)&&(e=void 0),c(t,i(e,3))}},84173:function(t,e,r){var n=r(82602)(r(12152));t.exports=n},12152:function(t,e,r){var n=r(8235),o=r(88157),i=r(85759),a=Math.max;t.exports=function(t,e,r){var u=null==t?0:t.length;if(!u)return -1;var c=null==r?0:i(r);return c<0&&(c=a(u+c,0)),n(t,o(e,3),c)}},11314:function(t,e,r){var n=r(72569),o=r(89238);t.exports=function(t,e){return n(o(t,e),1)}},13735:function(t,e,r){var n=r(92167);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},17764:function(t,e,r){var n=r(93012),o=r(59592);t.exports=function(t,e){return null!=t&&o(t,e,n)}},79586:function(t){t.exports=function(t){return t}},56569:function(t,e,r){var n=r(90370),o=r(10303),i=Object.prototype,a=i.hasOwnProperty,u=i.propertyIsEnumerable,c=n(function(){return arguments}())?n:function(t){return o(t)&&a.call(t,"callee")&&!u.call(t,"callee")};t.exports=c},25614:function(t){var e=Array.isArray;t.exports=e},5629:function(t,e,r){var n=r(86757),o=r(13973);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},24342:function(t,e,r){var n=r(54506),o=r(10303);t.exports=function(t){return!0===t||!1===t||o(t)&&"[object Boolean]"==n(t)}},98051:function(t,e,r){t=r.nmd(t);var n=r(74288),o=r(7406),i=e&&!e.nodeType&&e,a=i&&t&&!t.nodeType&&t,u=a&&a.exports===i?n.Buffer:void 0,c=u?u.isBuffer:void 0;t.exports=c||o},21652:function(t,e,r){var n=r(56318);t.exports=function(t,e){return n(t,e)}},86757:function(t,e,r){var n=r(54506),o=r(28302);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},13973:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},82559:function(t,e,r){var n=r(22345);t.exports=function(t){return n(t)&&t!=+t}},77571:function(t){t.exports=function(t){return null==t}},22345:function(t,e,r){var n=r(54506),o=r(10303);t.exports=function(t){return"number"==typeof t||o(t)&&"[object Number]"==n(t)}},28302:function(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},10303:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},90231:function(t,e,r){var n=r(54506),o=r(62602),i=r(10303),a=Object.prototype,u=Function.prototype.toString,c=a.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=c.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==l}},42715:function(t,e,r){var n=r(54506),o=r(25614),i=r(10303);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},78371:function(t,e,r){var n=r(54506),o=r(10303);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},9792:function(t,e,r){var n=r(59332),o=r(23305),i=r(39931),a=i&&i.isTypedArray,u=a?o(a):n;t.exports=u},43228:function(t,e,r){var n=r(28579),o=r(4578),i=r(5629);t.exports=function(t){return i(t)?n(t):o(t)}},86185:function(t){t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},89238:function(t,e,r){var n=r(73819),o=r(88157),i=r(24240),a=r(25614);t.exports=function(t,e){return(a(t)?n:i)(t,o(e,3))}},41443:function(t,e,r){var n=r(83023),o=r(98060),i=r(88157);t.exports=function(t,e){var r={};return e=i(e,3),o(t,function(t,o,i){n(r,o,e(t,o,i))}),r}},95645:function(t,e,r){var n=r(67646),o=r(58905),i=r(79586);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},50967:function(t,e,r){var n=r(76219);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},99008:function(t,e,r){var n=r(67646),o=r(20121),i=r(79586);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},93810:function(t){t.exports=function(){}},11121:function(t,e,r){var n=r(74288);t.exports=function(){return n.Date.now()}},22350:function(t,e,r){var n=r(18155),o=r(73584),i=r(67352),a=r(70235);t.exports=function(t){return i(t)?n(a(t)):o(t)}},99676:function(t,e,r){var n=r(35464)();t.exports=n},33645:function(t,e,r){var n=r(25253),o=r(88157),i=r(12327),a=r(25614),u=r(49639);t.exports=function(t,e,r){var c=a(t)?n:i;return r&&u(t,e,r)&&(e=void 0),c(t,o(e,3))}},34935:function(t,e,r){var n=r(72569),o=r(84046),i=r(44843),a=r(49639),u=i(function(t,e){if(null==t)return[];var r=e.length;return r>1&&a(t,e[0],e[1])?e=[]:r>2&&a(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])});t.exports=u},55716:function(t){t.exports=function(){return[]}},7406:function(t){t.exports=function(){return!1}},37065:function(t,e,r){var n=r(7310),o=r(28302);t.exports=function(t,e,r){var i=!0,a=!0;if("function"!=typeof t)throw TypeError("Expected a function");return o(r)&&(i="leading"in r?!!r.leading:i,a="trailing"in r?!!r.trailing:a),n(t,e,{leading:i,maxWait:e,trailing:a})}},175:function(t,e,r){var n=r(6660),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-o?(t<0?-1:1)*17976931348623157e292:t==t?t:0:0===t?t:0}},85759:function(t,e,r){var n=r(175);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},6660:function(t,e,r){var n=r(41087),o=r(28302),i=r(78371),a=0/0,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,s=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return a;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=c.test(t);return r||l.test(t)?s(t.slice(2),r?2:8):u.test(t)?a:+t}},3641:function(t,e,r){var n=r(65020);t.exports=function(t){return null==t?"":n(t)}},47230:function(t,e,r){var n=r(88157),o=r(13826);t.exports=function(t,e){return t&&t.length?o(t,n(e,2)):[]}},75551:function(t,e,r){var n=r(80675)("toUpperCase");t.exports=n},48049:function(t,e,r){"use strict";var n=r(14397);function o(){}function i(){}i.resetWarningCache=o,t.exports=function(){function t(t,e,r,o,i,a){if(a!==n){var u=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function e(){return t}t.isRequired=t;var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:i,resetWarningCache:o};return r.PropTypes=r,r}},40718:function(t,e,r){t.exports=r(48049)()},14397:function(t){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},84735:function(t,e,r){"use strict";r.d(e,{ZP:function(){return tS}});var n=r(2265),o=r(40718),i=r.n(o),a=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty;function l(t,e){return function(r,n,o){return t(r,n,o)&&e(r,n,o)}}function s(t){return function(e,r,n){if(!e||!r||"object"!=typeof e||"object"!=typeof r)return t(e,r,n);var o=n.cache,i=o.get(e),a=o.get(r);if(i&&a)return i===r&&a===e;o.set(e,r),o.set(r,e);var u=t(e,r,n);return o.delete(e),o.delete(r),u}}function f(t){return a(t).concat(u(t))}var p=Object.hasOwn||function(t,e){return c.call(t,e)};function h(t,e){return t===e||!t&&!e&&t!=t&&e!=e}var d=Object.getOwnPropertyDescriptor,y=Object.keys;function v(t,e,r){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function m(t,e){return h(t.getTime(),e.getTime())}function b(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function g(t,e){return t===e}function x(t,e,r){var n,o,i=t.size;if(i!==e.size)return!1;if(!i)return!0;for(var a=Array(i),u=t.entries(),c=0;(n=u.next())&&!n.done;){for(var l=e.entries(),s=!1,f=0;(o=l.next())&&!o.done;){if(a[f]){f++;continue}var p=n.value,h=o.value;if(r.equals(p[0],h[0],c,f,t,e,r)&&r.equals(p[1],h[1],p[0],h[0],t,e,r)){s=a[f]=!0;break}f++}if(!s)return!1;c++}return!0}function w(t,e,r){var n=y(t),o=n.length;if(y(e).length!==o)return!1;for(;o-- >0;)if(!A(t,e,r,n[o]))return!1;return!0}function O(t,e,r){var n,o,i,a=f(t),u=a.length;if(f(e).length!==u)return!1;for(;u-- >0;)if(!A(t,e,r,n=a[u])||(o=d(t,n),i=d(e,n),(o||i)&&(!o||!i||o.configurable!==i.configurable||o.enumerable!==i.enumerable||o.writable!==i.writable)))return!1;return!0}function j(t,e){return h(t.valueOf(),e.valueOf())}function S(t,e){return t.source===e.source&&t.flags===e.flags}function P(t,e,r){var n,o,i=t.size;if(i!==e.size)return!1;if(!i)return!0;for(var a=Array(i),u=t.values();(n=u.next())&&!n.done;){for(var c=e.values(),l=!1,s=0;(o=c.next())&&!o.done;){if(!a[s]&&r.equals(n.value,o.value,n.value,o.value,t,e,r)){l=a[s]=!0;break}s++}if(!l)return!1}return!0}function E(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function k(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function A(t,e,r,n){return("_owner"===n||"__o"===n||"__v"===n)&&(!!t.$$typeof||!!e.$$typeof)||p(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var M=Array.isArray,T="undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView:null,_=Object.assign,C=Object.prototype.toString.call.bind(Object.prototype.toString),N=D();function D(t){void 0===t&&(t={});var e,r,n,o,i,a,u,c,f,p,d,y,A,N,D=t.circular,I=t.createInternalComparator,L=t.createState,B=t.strict,R=(r=(e=function(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,o={areArraysEqual:n?O:v,areDatesEqual:m,areErrorsEqual:b,areFunctionsEqual:g,areMapsEqual:n?l(x,O):x,areNumbersEqual:h,areObjectsEqual:n?O:w,arePrimitiveWrappersEqual:j,areRegExpsEqual:S,areSetsEqual:n?l(P,O):P,areTypedArraysEqual:n?O:E,areUrlsEqual:k,unknownTagComparators:void 0};if(r&&(o=_({},o,r(o))),e){var i=s(o.areArraysEqual),a=s(o.areMapsEqual),u=s(o.areObjectsEqual),c=s(o.areSetsEqual);o=_({},o,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:u,areSetsEqual:c})}return o}(t)).areArraysEqual,n=e.areDatesEqual,o=e.areErrorsEqual,i=e.areFunctionsEqual,a=e.areMapsEqual,u=e.areNumbersEqual,c=e.areObjectsEqual,f=e.arePrimitiveWrappersEqual,p=e.areRegExpsEqual,d=e.areSetsEqual,y=e.areTypedArraysEqual,A=e.areUrlsEqual,N=e.unknownTagComparators,function(t,e,l){if(t===e)return!0;if(null==t||null==e)return!1;var s=typeof t;if(s!==typeof e)return!1;if("object"!==s)return"number"===s?u(t,e,l):"function"===s&&i(t,e,l);var h=t.constructor;if(h!==e.constructor)return!1;if(h===Object)return c(t,e,l);if(M(t))return r(t,e,l);if(null!=T&&T(t))return y(t,e,l);if(h===Date)return n(t,e,l);if(h===RegExp)return p(t,e,l);if(h===Map)return a(t,e,l);if(h===Set)return d(t,e,l);var v=C(t);if("[object Date]"===v)return n(t,e,l);if("[object RegExp]"===v)return p(t,e,l);if("[object Map]"===v)return a(t,e,l);if("[object Set]"===v)return d(t,e,l);if("[object Object]"===v)return"function"!=typeof t.then&&"function"!=typeof e.then&&c(t,e,l);if("[object URL]"===v)return A(t,e,l);if("[object Error]"===v)return o(t,e,l);if("[object Arguments]"===v)return c(t,e,l);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return f(t,e,l);if(N){var m=N[v];if(!m){var b=null!=t?t[Symbol.toStringTag]:void 0;b&&(m=N[b])}if(m)return m(t,e,l)}return!1}),z=I?I(R):function(t,e,r,n,o,i,a){return R(t,e,a)};return function(t){var e=t.circular,r=t.comparator,n=t.createState,o=t.equals,i=t.strict;if(n)return function(t,a){var u=n(),c=u.cache;return r(t,a,{cache:void 0===c?e?new WeakMap:void 0:c,equals:o,meta:u.meta,strict:i})};if(e)return function(t,e){return r(t,e,{cache:new WeakMap,equals:o,meta:void 0,strict:i})};var a={cache:void 0,equals:o,meta:void 0,strict:i};return function(t,e){return r(t,e,a)}}({circular:void 0!==D&&D,comparator:R,createState:L,equals:z,strict:void 0!==B&&B})}function I(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=-1;requestAnimationFrame(function n(o){if(r<0&&(r=o),o-r>e)t(o),r=-1;else{var i;i=n,"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(i)}})}function L(t){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r=0&&t<=1}),"[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s",n);var p=V(i,u),h=V(a,c),d=(t=i,e=u,function(r){var n;return G([].concat(function(t){if(Array.isArray(t))return H(t)}(n=X(t,e).map(function(t,e){return t*e}).slice(1))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||Y(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[0]),r)}),y=function(t){for(var e=t>1?1:t,r=e,n=0;n<8;++n){var o,i=p(r)-e,a=d(r);if(1e-4>Math.abs(i-e)||a<1e-4)break;r=(o=r-i/a)>1?1:o<0?0:o}return h(r)};return y.isStepper=!1,y},Q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.stiff,r=void 0===e?100:e,n=t.damping,o=void 0===n?8:n,i=t.dt,a=void 0===i?17:i,u=function(t,e,n){var i=n+(-(t-e)*r-n*o)*a/1e3,u=n*a/1e3+t;return 1e-4>Math.abs(u-e)&&1e-4>Math.abs(i)?[e,0]:[u,i]};return u.isStepper=!0,u.dt=a,u},J=function(){for(var t=arguments.length,e=Array(t),r=0;rt.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r0?r[o-1]:n,p=l||Object.keys(c);if("function"==typeof u||"spring"===u)return[].concat(th(t),[e.runJSAnimation.bind(e,{from:f.style,to:c,duration:i,easing:u}),i]);var h=Z(p,i,u),d=tv(tv(tv({},f.style),c),{},{transition:h});return[].concat(th(t),[d,i,s]).filter(F)},[a,Math.max(void 0===u?0:u,n)])),[t.onAnimationEnd]))}},{key:"runAnimation",value:function(t){if(!this.manager){var e,r,n;this.manager=(e=function(){return null},r=!1,n=function t(n){if(!r){if(Array.isArray(n)){if(!n.length)return;var o=function(t){if(Array.isArray(t))return t}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||function(t,e){if(t){if("string"==typeof t)return B(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(t,void 0)}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=o[0],a=o.slice(1);if("number"==typeof i){I(t.bind(null,a),i);return}t(i),I(t.bind(null,a));return}"object"===L(n)&&e(n),"function"==typeof n&&n()}},{stop:function(){r=!0},start:function(t){r=!1,n(t)},subscribe:function(t){return e=t,function(){e=function(){return null}}}})}var o=t.begin,i=t.duration,a=t.attributeName,u=t.to,c=t.easing,l=t.onAnimationStart,s=t.onAnimationEnd,f=t.steps,p=t.children,h=this.manager;if(this.unSubscribe=h.subscribe(this.handleStyleChange),"function"==typeof c||"function"==typeof p||"spring"===c){this.runJSAnimation(t);return}if(f.length>1){this.runStepAnimation(t);return}var d=a?tm({},a,u):u,y=Z(Object.keys(d),i,c);h.start([l,o,tv(tv({},d),{},{transition:y}),i,s])}},{key:"render",value:function(){var t=this.props,e=t.children,r=(t.begin,t.duration),o=(t.attributeName,t.easing,t.isActive),i=(t.steps,t.from,t.to,t.canBegin,t.onAnimationEnd,t.shouldReAnimate,t.onAnimationReStart,function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,tp)),a=n.Children.count(e),u=this.state.style;if("function"==typeof e)return e(u);if(!o||0===a||r<=0)return e;var c=function(t){var e=t.props,r=e.style,o=e.className;return(0,n.cloneElement)(t,tv(tv({},i),{},{style:tv(tv({},void 0===r?{}:r),u),className:o}))};return 1===a?c(n.Children.only(e)):n.createElement("div",null,n.Children.map(e,function(t){return c(t)}))}}],function(t,e){for(var r=0;r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,w),i=parseInt("".concat(r),10),a=parseInt("".concat(n),10),u=parseInt("".concat(e.height||o.height),10),c=parseInt("".concat(e.width||o.width),10);return P(P(P(P(P({},e),o),i?{x:i}:{}),a?{y:a}:{}),{},{height:u,width:c,name:e.name,radius:e.radius})}function k(t){return n.createElement(x.bn,j({shapeType:"rectangle",propTransformer:E,activeClassName:"recharts-active-bar"},t))}var A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(r,n){if("number"==typeof t)return t;var o=(0,d.hj)(r)||(0,d.Rw)(r);return o?t(r,n):(o||(0,g.Z)(!1),e)}},M=["value","background"];function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _(){return(_=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(e,M);if(!u)return null;var l=N(N(N(N(N({},c),{},{fill:"#eee"},u),a),(0,b.bw)(t.props,e,r)),{},{onAnimationStart:t.handleAnimationStart,onAnimationEnd:t.handleAnimationEnd,dataKey:o,index:r,className:"recharts-bar-background-rectangle"});return n.createElement(k,_({key:"background-bar-".concat(r),option:t.props.background,isActive:r===i},l))})}},{key:"renderErrorBar",value:function(t,e){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var r=this.props,o=r.data,i=r.xAxis,a=r.yAxis,u=r.layout,c=r.children,l=(0,y.NN)(c,f.W);if(!l)return null;var p="vertical"===u?o[0].height/2:o[0].width/2,h=function(t,e){var r=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:r,errorVal:(0,m.F$)(t,e)}};return n.createElement(s.m,{clipPath:t?"url(#clipPath-".concat(e,")"):null},l.map(function(t){return n.cloneElement(t,{key:"error-bar-".concat(e,"-").concat(t.props.dataKey),data:o,xAxis:i,yAxis:a,layout:u,offset:p,dataPointFormatter:h})}))}},{key:"render",value:function(){var t=this.props,e=t.hide,r=t.data,i=t.className,a=t.xAxis,u=t.yAxis,c=t.left,f=t.top,p=t.width,d=t.height,y=t.isAnimationActive,v=t.background,m=t.id;if(e||!r||!r.length)return null;var b=this.state.isAnimationFinished,g=(0,o.Z)("recharts-bar",i),x=a&&a.allowDataOverflow,w=u&&u.allowDataOverflow,O=x||w,j=l()(m)?this.id:m;return n.createElement(s.m,{className:g},x||w?n.createElement("defs",null,n.createElement("clipPath",{id:"clipPath-".concat(j)},n.createElement("rect",{x:x?c:c-p/2,y:w?f:f-d/2,width:x?p:2*p,height:w?d:2*d}))):null,n.createElement(s.m,{className:"recharts-bar-rectangles",clipPath:O?"url(#clipPath-".concat(j,")"):null},v?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(O,j),(!y||b)&&h.e.renderCallByParent(this.props,r))}}],r=[{key:"getDerivedStateFromProps",value:function(t,e){return t.animationId!==e.prevAnimationId?{prevAnimationId:t.animationId,curData:t.data,prevData:e.curData}:t.data!==e.curData?{curData:t.data}:null}}],e&&D(a.prototype,e),r&&D(a,r),Object.defineProperty(a,"prototype",{writable:!1}),a}(n.PureComponent);R(U,"displayName","Bar"),R(U,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!v.x.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"}),R(U,"getComposedData",function(t){var e=t.props,r=t.item,n=t.barPosition,o=t.bandSize,i=t.xAxis,a=t.yAxis,u=t.xAxisTicks,c=t.yAxisTicks,l=t.stackedData,s=t.dataStartIndex,f=t.displayedData,h=t.offset,v=(0,m.Bu)(n,r);if(!v)return null;var b=e.layout,g=r.type.defaultProps,x=void 0!==g?N(N({},g),r.props):r.props,w=x.dataKey,O=x.children,j=x.minPointSize,S="horizontal"===b?a:i,P=l?S.scale.domain():null,E=(0,m.Yj)({numericAxis:S}),k=(0,y.NN)(O,p.b),M=f.map(function(t,e){l?f=(0,m.Vv)(l[s+e],P):Array.isArray(f=(0,m.F$)(t,w))||(f=[E,f]);var n=A(j,U.defaultProps.minPointSize)(f[1],e);if("horizontal"===b){var f,p,h,y,g,x,O,S=[a.scale(f[0]),a.scale(f[1])],M=S[0],T=S[1];p=(0,m.Fy)({axis:i,ticks:u,bandSize:o,offset:v.offset,entry:t,index:e}),h=null!==(O=null!=T?T:M)&&void 0!==O?O:void 0,y=v.size;var _=M-T;if(g=Number.isNaN(_)?0:_,x={x:p,y:a.y,width:y,height:a.height},Math.abs(n)>0&&Math.abs(g)0&&Math.abs(y)=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function P(t,e){for(var r=0;r0?this.props:d)),o<=0||a<=0||!y||!y.length)?null:n.createElement(s.m,{className:(0,c.Z)("recharts-cartesian-axis",l),ref:function(e){t.layerReference=e}},r&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),p._.renderCallByParent(this.props))}}],r=[{key:"renderTickItem",value:function(t,e,r){var o=(0,c.Z)(e.className,"recharts-cartesian-axis-tick-value");return n.isValidElement(t)?n.cloneElement(t,j(j({},e),{},{className:o})):i()(t)?t(j(j({},e),{},{className:o})):n.createElement(f.x,w({},e,{className:"recharts-cartesian-axis-tick-value"}),r)}}],e&&P(o.prototype,e),r&&P(o,r),Object.defineProperty(o,"prototype",{writable:!1}),o}(n.Component);M(_,"displayName","CartesianAxis"),M(_,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"})},56940:function(t,e,r){"use strict";r.d(e,{q:function(){return M}});var n=r(2265),o=r(86757),i=r.n(o),a=r(1175),u=r(16630),c=r(82944),l=r(85355),s=r(78242),f=r(80285),p=r(25739),h=["x1","y1","x2","y2","key"],d=["offset"];function y(t){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function m(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var x=function(t){var e=t.fill;if(!e||"none"===e)return null;var r=t.fillOpacity,o=t.x,i=t.y,a=t.width,u=t.height,c=t.ry;return n.createElement("rect",{x:o,y:i,ry:c,width:a,height:u,stroke:"none",fill:e,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function w(t,e){var r;if(n.isValidElement(t))r=n.cloneElement(t,e);else if(i()(t))r=t(e);else{var o=e.x1,a=e.y1,u=e.x2,l=e.y2,s=e.key,f=g(e,h),p=(0,c.L6)(f,!1),y=(p.offset,g(p,d));r=n.createElement("line",b({},y,{x1:o,y1:a,x2:u,y2:l,fill:"none",key:s}))}return r}function O(t){var e=t.x,r=t.width,o=t.horizontal,i=void 0===o||o,a=t.horizontalPoints;if(!i||!a||!a.length)return null;var u=a.map(function(n,o){return w(i,m(m({},t),{},{x1:e,y1:n,x2:e+r,y2:n,key:"line-".concat(o),index:o}))});return n.createElement("g",{className:"recharts-cartesian-grid-horizontal"},u)}function j(t){var e=t.y,r=t.height,o=t.vertical,i=void 0===o||o,a=t.verticalPoints;if(!i||!a||!a.length)return null;var u=a.map(function(n,o){return w(i,m(m({},t),{},{x1:n,y1:e,x2:n,y2:e+r,key:"line-".concat(o),index:o}))});return n.createElement("g",{className:"recharts-cartesian-grid-vertical"},u)}function S(t){var e=t.horizontalFill,r=t.fillOpacity,o=t.x,i=t.y,a=t.width,u=t.height,c=t.horizontalPoints,l=t.horizontal;if(!(void 0===l||l)||!e||!e.length)return null;var s=c.map(function(t){return Math.round(t+i-i)}).sort(function(t,e){return t-e});i!==s[0]&&s.unshift(0);var f=s.map(function(t,c){var l=s[c+1]?s[c+1]-t:i+u-t;if(l<=0)return null;var f=c%e.length;return n.createElement("rect",{key:"react-".concat(c),y:t,x:o,height:l,width:a,stroke:"none",fill:e[f],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return n.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function P(t){var e=t.vertical,r=t.verticalFill,o=t.fillOpacity,i=t.x,a=t.y,u=t.width,c=t.height,l=t.verticalPoints;if(!(void 0===e||e)||!r||!r.length)return null;var s=l.map(function(t){return Math.round(t+i-i)}).sort(function(t,e){return t-e});i!==s[0]&&s.unshift(0);var f=s.map(function(t,e){var l=s[e+1]?s[e+1]-t:i+u-t;if(l<=0)return null;var f=e%r.length;return n.createElement("rect",{key:"react-".concat(e),x:t,y:a,width:l,height:c,stroke:"none",fill:r[f],fillOpacity:o,className:"recharts-cartesian-grid-bg"})});return n.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var E=function(t,e){var r=t.xAxis,n=t.width,o=t.height,i=t.offset;return(0,l.Rf)((0,s.f)(m(m(m({},f.O.defaultProps),r),{},{ticks:(0,l.uY)(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),i.left,i.left+i.width,e)},k=function(t,e){var r=t.yAxis,n=t.width,o=t.height,i=t.offset;return(0,l.Rf)((0,s.f)(m(m(m({},f.O.defaultProps),r),{},{ticks:(0,l.uY)(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),i.top,i.top+i.height,e)},A={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function M(t){var e,r,o,c,l,s,f=(0,p.zn)(),h=(0,p.Mw)(),d=(0,p.qD)(),v=m(m({},t),{},{stroke:null!==(e=t.stroke)&&void 0!==e?e:A.stroke,fill:null!==(r=t.fill)&&void 0!==r?r:A.fill,horizontal:null!==(o=t.horizontal)&&void 0!==o?o:A.horizontal,horizontalFill:null!==(c=t.horizontalFill)&&void 0!==c?c:A.horizontalFill,vertical:null!==(l=t.vertical)&&void 0!==l?l:A.vertical,verticalFill:null!==(s=t.verticalFill)&&void 0!==s?s:A.verticalFill,x:(0,u.hj)(t.x)?t.x:d.left,y:(0,u.hj)(t.y)?t.y:d.top,width:(0,u.hj)(t.width)?t.width:d.width,height:(0,u.hj)(t.height)?t.height:d.height}),g=v.x,w=v.y,M=v.width,T=v.height,_=v.syncWithTicks,C=v.horizontalValues,N=v.verticalValues,D=(0,p.CW)(),I=(0,p.Nf)();if(!(0,u.hj)(M)||M<=0||!(0,u.hj)(T)||T<=0||!(0,u.hj)(g)||g!==+g||!(0,u.hj)(w)||w!==+w)return null;var L=v.verticalCoordinatesGenerator||E,B=v.horizontalCoordinatesGenerator||k,R=v.horizontalPoints,z=v.verticalPoints;if((!R||!R.length)&&i()(B)){var U=C&&C.length,$=B({yAxis:I?m(m({},I),{},{ticks:U?C:I.ticks}):void 0,width:f,height:h,offset:d},!!U||_);(0,a.Z)(Array.isArray($),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(y($),"]")),Array.isArray($)&&(R=$)}if((!z||!z.length)&&i()(L)){var F=N&&N.length,q=L({xAxis:D?m(m({},D),{},{ticks:F?N:D.ticks}):void 0,width:f,height:h,offset:d},!!F||_);(0,a.Z)(Array.isArray(q),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(y(q),"]")),Array.isArray(q)&&(z=q)}return n.createElement("g",{className:"recharts-cartesian-grid"},n.createElement(x,{fill:v.fill,fillOpacity:v.fillOpacity,x:v.x,y:v.y,width:v.width,height:v.height,ry:v.ry}),n.createElement(O,b({},v,{offset:d,horizontalPoints:R,xAxis:D,yAxis:I})),n.createElement(j,b({},v,{offset:d,verticalPoints:z,xAxis:D,yAxis:I})),n.createElement(S,b({},v,{horizontalPoints:R})),n.createElement(P,b({},v,{verticalPoints:z})))}M.displayName="CartesianGrid"},13137:function(t,e,r){"use strict";r.d(e,{W:function(){return v}});var n=r(2265),o=r(69398),i=r(9841),a=r(82944),u=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(){return(l=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,u),m=(0,a.L6)(v,!1);"x"===this.props.direction&&"number"!==d.type&&(0,o.Z)(!1);var b=p.map(function(t){var o,a,u=h(t,f),p=u.x,v=u.y,b=u.value,g=u.errorVal;if(!g)return null;var x=[];if(Array.isArray(g)){var w=function(t){if(Array.isArray(t))return t}(g)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(g,2)||function(t,e){if(t){if("string"==typeof t)return s(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(t,2)}}(g,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();o=w[0],a=w[1]}else o=a=g;if("vertical"===r){var O=d.scale,j=v+e,S=j+c,P=j-c,E=O(b-o),k=O(b+a);x.push({x1:k,y1:S,x2:k,y2:P}),x.push({x1:E,y1:j,x2:k,y2:j}),x.push({x1:E,y1:S,x2:E,y2:P})}else if("horizontal"===r){var A=y.scale,M=p+e,T=M-c,_=M+c,C=A(b-o),N=A(b+a);x.push({x1:T,y1:N,x2:_,y2:N}),x.push({x1:M,y1:C,x2:M,y2:N}),x.push({x1:T,y1:C,x2:_,y2:C})}return n.createElement(i.m,l({className:"recharts-errorBar",key:"bar-".concat(x.map(function(t){return"".concat(t.x1,"-").concat(t.x2,"-").concat(t.y1,"-").concat(t.y2)}))},m),x.map(function(t){return n.createElement("line",l({},t,{key:"line-".concat(t.x1,"-").concat(t.x2,"-").concat(t.y1,"-").concat(t.y2)}))}))});return n.createElement(i.m,{className:"recharts-errorBars"},b)}}],function(t,e){for(var r=0;rt*o)return!1;var i=r();return t*(e-t*i/2-n)>=0&&t*(e+t*i/2-o)<=0}function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function h(t){for(var e=1;e=2?(0,i.uY)(m[1].coordinate-m[0].coordinate):1,M=(n="width"===P,f=b.x,p=b.y,d=b.width,y=b.height,1===A?{start:n?f:p,end:n?f+d:p+y}:{start:n?f+d:p+y,end:n?f:p});return"equidistantPreserveStart"===w?function(t,e,r,n,o){for(var i,a=(n||[]).slice(),u=e.start,c=e.end,f=0,p=1,h=u;p<=a.length;)if(i=function(){var e,i=null==n?void 0:n[f];if(void 0===i)return{v:l(n,p)};var a=f,d=function(){return void 0===e&&(e=r(i,a)),e},y=i.coordinate,v=0===f||s(t,y,d,h,c);v||(f=0,h=u,p+=1),v&&(h=y+t*(d()/2+o),f+=p)}())return i.v;return[]}(A,M,k,m,g):("preserveStart"===w||"preserveStartEnd"===w?function(t,e,r,n,o,i){var a=(n||[]).slice(),u=a.length,c=e.start,l=e.end;if(i){var f=n[u-1],p=r(f,u-1),d=t*(f.coordinate+t*p/2-l);a[u-1]=f=h(h({},f),{},{tickCoord:d>0?f.coordinate-d*t:f.coordinate}),s(t,f.tickCoord,function(){return p},c,l)&&(l=f.tickCoord-t*(p/2+o),a[u-1]=h(h({},f),{},{isShow:!0}))}for(var y=i?u-1:u,v=function(e){var n,i=a[e],u=function(){return void 0===n&&(n=r(i,e)),n};if(0===e){var f=t*(i.coordinate-t*u()/2-c);a[e]=i=h(h({},i),{},{tickCoord:f<0?i.coordinate-f*t:i.coordinate})}else a[e]=i=h(h({},i),{},{tickCoord:i.coordinate});s(t,i.tickCoord,u,c,l)&&(c=i.tickCoord+t*(u()/2+o),a[e]=h(h({},i),{},{isShow:!0}))},m=0;m0?l.coordinate-p*t:l.coordinate})}else i[e]=l=h(h({},l),{},{tickCoord:l.coordinate});s(t,l.tickCoord,f,u,c)&&(c=l.tickCoord-t*(f()/2+o),i[e]=h(h({},l),{},{isShow:!0}))},f=a-1;f>=0;f--)l(f);return i}(A,M,k,m,g)).filter(function(t){return t.isShow})}},93765:function(t,e,r){"use strict";r.d(e,{z:function(){return eD}});var n,o,i=r(2265),a=r(77571),u=r.n(a),c=r(86757),l=r.n(c),s=r(99676),f=r.n(s),p=r(13735),h=r.n(p),d=r(34935),y=r.n(d),v=r(37065),m=r.n(v),b=r(87602),g=r(69398),x=r(48777),w=r(9841),O=r(8147),j=r(22190),S=r(81889),P=r(73649),E=r(82944),k=r(55284),A=r(58811),M=r(85355),T=r(16630);function _(t){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function N(t){for(var e=1;e0&&e.handleDrag(t.changedTouches[0])}),W(e,"handleDragEnd",function(){e.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var t=e.props,r=t.endIndex,n=t.onDragEnd,o=t.startIndex;null==n||n({endIndex:r,startIndex:o})}),e.detachDragEndListener()}),W(e,"handleLeaveWrapper",function(){(e.state.isTravellerMoving||e.state.isSlideMoving)&&(e.leaveTimer=window.setTimeout(e.handleDragEnd,e.props.leaveTimeOut))}),W(e,"handleEnterSlideOrTraveller",function(){e.setState({isTextActive:!0})}),W(e,"handleLeaveSlideOrTraveller",function(){e.setState({isTextActive:!1})}),W(e,"handleSlideDragStart",function(t){var r=X(t)?t.changedTouches[0]:t;e.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:r.pageX}),e.attachDragEndListener()}),e.travellerDragStartHandlers={startX:e.handleTravellerDragStart.bind(e,"startX"),endX:e.handleTravellerDragStart.bind(e,"endX")},e.state={},e}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Z(t,e)}(n,t),e=[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(t){var e=t.startX,r=t.endX,o=this.state.scaleValues,i=this.props,a=i.gap,u=i.data.length-1,c=n.getIndexInRange(o,Math.min(e,r)),l=n.getIndexInRange(o,Math.max(e,r));return{startIndex:c-c%a,endIndex:l===u?u:l-l%a}}},{key:"getTextOfTick",value:function(t){var e=this.props,r=e.data,n=e.tickFormatter,o=e.dataKey,i=(0,M.F$)(r[t],o,t);return l()(n)?n(i,t):i}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(t){var e=this.state,r=e.slideMoveStartX,n=e.startX,o=e.endX,i=this.props,a=i.x,u=i.width,c=i.travellerWidth,l=i.startIndex,s=i.endIndex,f=i.onChange,p=t.pageX-r;p>0?p=Math.min(p,a+u-c-o,a+u-c-n):p<0&&(p=Math.max(p,a-n,a-o));var h=this.getIndex({startX:n+p,endX:o+p});(h.startIndex!==l||h.endIndex!==s)&&f&&f(h),this.setState({startX:n+p,endX:o+p,slideMoveStartX:t.pageX})}},{key:"handleTravellerDragStart",value:function(t,e){var r=X(e)?e.changedTouches[0]:e;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:t,brushMoveStartX:r.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(t){var e=this.state,r=e.brushMoveStartX,n=e.movingTravellerId,o=e.endX,i=e.startX,a=this.state[n],u=this.props,c=u.x,l=u.width,s=u.travellerWidth,f=u.onChange,p=u.gap,h=u.data,d={startX:this.state.startX,endX:this.state.endX},y=t.pageX-r;y>0?y=Math.min(y,c+l-s-a):y<0&&(y=Math.max(y,c-a)),d[n]=a+y;var v=this.getIndex(d),m=v.startIndex,b=v.endIndex,g=function(){var t=h.length-1;return"startX"===n&&(o>i?m%p==0:b%p==0)||oi?b%p==0:m%p==0)||o>i&&b===t};this.setState(W(W({},n,a+y),"brushMoveStartX",t.pageX),function(){f&&g()&&f(v)})}},{key:"handleTravellerMoveKeyboard",value:function(t,e){var r=this,n=this.state,o=n.scaleValues,i=n.startX,a=n.endX,u=this.state[e],c=o.indexOf(u);if(-1!==c){var l=c+t;if(-1!==l&&!(l>=o.length)){var s=o[l];"startX"===e&&s>=a||"endX"===e&&s<=i||this.setState(W({},e,s),function(){r.props.onChange(r.getIndex({startX:r.state.startX,endX:r.state.endX}))})}}}},{key:"renderBackground",value:function(){var t=this.props,e=t.x,r=t.y,n=t.width,o=t.height,a=t.fill,u=t.stroke;return i.createElement("rect",{stroke:u,fill:a,x:e,y:r,width:n,height:o})}},{key:"renderPanorama",value:function(){var t=this.props,e=t.x,r=t.y,n=t.width,o=t.height,a=t.data,u=t.children,c=t.padding,l=i.Children.only(u);return l?i.cloneElement(l,{x:e,y:r,width:n,height:o,margin:c,compact:!0,data:a}):null}},{key:"renderTravellerLayer",value:function(t,e){var r,o,a=this,u=this.props,c=u.y,l=u.travellerWidth,s=u.height,f=u.traveller,p=u.ariaLabel,h=u.data,d=u.startIndex,y=u.endIndex,v=Math.max(t,this.props.x),m=U(U({},(0,E.L6)(this.props,!1)),{},{x:v,y:c,width:l,height:s}),b=p||"Min value: ".concat(null===(r=h[d])||void 0===r?void 0:r.name,", Max value: ").concat(null===(o=h[y])||void 0===o?void 0:o.name);return i.createElement(w.m,{tabIndex:0,role:"slider","aria-label":b,"aria-valuenow":t,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[e],onTouchStart:this.travellerDragStartHandlers[e],onKeyDown:function(t){["ArrowLeft","ArrowRight"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),a.handleTravellerMoveKeyboard("ArrowRight"===t.key?1:-1,e))},onFocus:function(){a.setState({isTravellerFocused:!0})},onBlur:function(){a.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},n.renderTraveller(f,m))}},{key:"renderSlide",value:function(t,e){var r=this.props,n=r.y,o=r.height,a=r.stroke,u=r.travellerWidth;return i.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:a,fillOpacity:.2,x:Math.min(t,e)+u,y:n,width:Math.max(Math.abs(e-t)-u,0),height:o})}},{key:"renderText",value:function(){var t=this.props,e=t.startIndex,r=t.endIndex,n=t.y,o=t.height,a=t.travellerWidth,u=t.stroke,c=this.state,l=c.startX,s=c.endX,f={pointerEvents:"none",fill:u};return i.createElement(w.m,{className:"recharts-brush-texts"},i.createElement(A.x,R({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,s)-5,y:n+o/2},f),this.getTextOfTick(e)),i.createElement(A.x,R({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,s)+a+5,y:n+o/2},f),this.getTextOfTick(r)))}},{key:"render",value:function(){var t=this.props,e=t.data,r=t.className,n=t.children,o=t.x,a=t.y,u=t.width,c=t.height,l=t.alwaysShowText,s=this.state,f=s.startX,p=s.endX,h=s.isTextActive,d=s.isSlideMoving,y=s.isTravellerMoving,v=s.isTravellerFocused;if(!e||!e.length||!(0,T.hj)(o)||!(0,T.hj)(a)||!(0,T.hj)(u)||!(0,T.hj)(c)||u<=0||c<=0)return null;var m=(0,b.Z)("recharts-brush",r),g=1===i.Children.count(n),x=L("userSelect","none");return i.createElement(w.m,{className:m,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:x},this.renderBackground(),g&&this.renderPanorama(),this.renderSlide(f,p),this.renderTravellerLayer(f,"startX"),this.renderTravellerLayer(p,"endX"),(h||d||y||v||l)&&this.renderText())}}],r=[{key:"renderDefaultTraveller",value:function(t){var e=t.x,r=t.y,n=t.width,o=t.height,a=t.stroke,u=Math.floor(r+o/2)-1;return i.createElement(i.Fragment,null,i.createElement("rect",{x:e,y:r,width:n,height:o,fill:a,stroke:"none"}),i.createElement("line",{x1:e+1,y1:u,x2:e+n-1,y2:u,fill:"none",stroke:"#fff"}),i.createElement("line",{x1:e+1,y1:u+2,x2:e+n-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(t,e){return i.isValidElement(t)?i.cloneElement(t,e):l()(t)?t(e):n.renderDefaultTraveller(e)}},{key:"getDerivedStateFromProps",value:function(t,e){var r=t.data,n=t.width,o=t.x,i=t.travellerWidth,a=t.updateId,u=t.startIndex,c=t.endIndex;if(r!==e.prevData||a!==e.prevUpdateId)return U({prevData:r,prevTravellerWidth:i,prevUpdateId:a,prevX:o,prevWidth:n},r&&r.length?H({data:r,width:n,x:o,travellerWidth:i,startIndex:u,endIndex:c}):{scale:null,scaleValues:null});if(e.scale&&(n!==e.prevWidth||o!==e.prevX||i!==e.prevTravellerWidth)){e.scale.range([o,o+n-i]);var l=e.scale.domain().map(function(t){return e.scale(t)});return{prevData:r,prevTravellerWidth:i,prevUpdateId:a,prevX:o,prevWidth:n,startX:e.scale(t.startIndex),endX:e.scale(t.endIndex),scaleValues:l}}return null}},{key:"getIndexInRange",value:function(t,e){for(var r=t.length,n=0,o=r-1;o-n>1;){var i=Math.floor((n+o)/2);t[i]>e?o=i:n=i}return e>=t[o]?o:n}}],e&&$(n.prototype,e),r&&$(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n}(i.PureComponent);W(G,"displayName","Brush"),W(G,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var V=r(4094),K=r(38569),Q=r(26680),J=function(t,e){var r=t.alwaysShow,n=t.ifOverflow;return r&&(n="extendDomain"),n===e},tt=r(25311),te=r(1175);function tr(){return(tr=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,t2));return(0,T.hj)(r)&&(0,T.hj)(o)&&(0,T.hj)(f)&&(0,T.hj)(h)&&(0,T.hj)(u)&&(0,T.hj)(l)?i.createElement("path",t5({},(0,E.L6)(y,!0),{className:(0,b.Z)("recharts-cross",d),d:"M".concat(r,",").concat(u,"v").concat(h,"M").concat(l,",").concat(o,"h").concat(f)})):null};function t7(t){var e=t.cx,r=t.cy,n=t.radius,o=t.startAngle,i=t.endAngle;return{points:[(0,tq.op)(e,r,n,o),(0,tq.op)(e,r,n,i)],cx:e,cy:r,radius:n,startAngle:o,endAngle:i}}var t8=r(60474);function t4(t){return(t4="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function t9(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function et(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function ec(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ec=function(){return!!t})()}function el(t){return(el=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function es(t,e){return(es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function ef(t){return function(t){if(Array.isArray(t))return eh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ep(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ep(t,e){if(t){if("string"==typeof t)return eh(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eh(t,e)}}function eh(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0?i:t&&t.length&&(0,T.hj)(n)&&(0,T.hj)(o)?t.slice(n,o+1):[]};function eS(t){return"number"===t?[0,"auto"]:void 0}var eP=function(t,e,r,n){var o=t.graphicalItems,i=t.tooltipAxis,a=ej(e,t);return r<0||!o||!o.length||r>=a.length?null:o.reduce(function(o,u){var c,l,s=null!==(c=u.props.data)&&void 0!==c?c:e;if(s&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(s=s.slice(t.dataStartIndex,t.dataEndIndex+1)),i.dataKey&&!i.allowDuplicatedCategory){var f=void 0===s?a:s;l=(0,T.Ap)(f,i.dataKey,n)}else l=s&&s[r]||a[r];return l?[].concat(ef(o),[(0,M.Qo)(u,l)]):o},[])},eE=function(t,e,r,n){var o=n||{x:t.chartX,y:t.chartY},i="horizontal"===r?o.x:"vertical"===r?o.y:"centric"===r?o.angle:o.radius,a=t.orderedTooltipTicks,u=t.tooltipAxis,c=t.tooltipTicks,l=(0,M.VO)(i,a,c,u);if(l>=0&&c){var s=c[l]&&c[l].value,f=eP(t,e,l,s),p=eO(r,a,l,o);return{activeTooltipIndex:l,activeLabel:s,activePayload:f,activeCoordinate:p}}return null},ek=function(t,e){var r=e.axes,n=e.graphicalItems,o=e.axisType,i=e.axisIdKey,a=e.stackGroups,c=e.dataStartIndex,l=e.dataEndIndex,s=t.layout,p=t.children,h=t.stackOffset,d=(0,M.NA)(s,o);return r.reduce(function(e,r){var y=void 0!==r.type.defaultProps?ey(ey({},r.type.defaultProps),r.props):r.props,v=y.type,m=y.dataKey,b=y.allowDataOverflow,g=y.allowDuplicatedCategory,x=y.scale,w=y.ticks,O=y.includeHidden,j=y[i];if(e[j])return e;var S=ej(t.data,{graphicalItems:n.filter(function(t){var e;return(i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i])===j}),dataStartIndex:c,dataEndIndex:l}),P=S.length;(function(t,e,r){if("number"===r&&!0===e&&Array.isArray(t)){var n=null==t?void 0:t[0],o=null==t?void 0:t[1];if(n&&o&&(0,T.hj)(n)&&(0,T.hj)(o))return!0}return!1})(y.domain,b,v)&&(A=(0,M.LG)(y.domain,null,b),d&&("number"===v||"auto"!==x)&&(C=(0,M.gF)(S,m,"category")));var E=eS(v);if(!A||0===A.length){var k,A,_,C,N,D=null!==(N=y.domain)&&void 0!==N?N:E;if(m){if(A=(0,M.gF)(S,m,v),"category"===v&&d){var I=(0,T.bv)(A);g&&I?(_=A,A=f()(0,P)):g||(A=(0,M.ko)(D,A,r).reduce(function(t,e){return t.indexOf(e)>=0?t:[].concat(ef(t),[e])},[]))}else if("category"===v)A=g?A.filter(function(t){return""!==t&&!u()(t)}):(0,M.ko)(D,A,r).reduce(function(t,e){return t.indexOf(e)>=0||""===e||u()(e)?t:[].concat(ef(t),[e])},[]);else if("number"===v){var L=(0,M.ZI)(S,n.filter(function(t){var e,r,n=i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i],o="hide"in t.props?t.props.hide:null===(r=t.type.defaultProps)||void 0===r?void 0:r.hide;return n===j&&(O||!o)}),m,o,s);L&&(A=L)}d&&("number"===v||"auto"!==x)&&(C=(0,M.gF)(S,m,"category"))}else A=d?f()(0,P):a&&a[j]&&a[j].hasStack&&"number"===v?"expand"===h?[0,1]:(0,M.EB)(a[j].stackGroups,c,l):(0,M.s6)(S,n.filter(function(t){var e=i in t.props?t.props[i]:t.type.defaultProps[i],r="hide"in t.props?t.props.hide:t.type.defaultProps.hide;return e===j&&(O||!r)}),v,s,!0);"number"===v?(A=tF(p,A,j,o,w),D&&(A=(0,M.LG)(D,A,b))):"category"===v&&D&&A.every(function(t){return D.indexOf(t)>=0})&&(A=D)}return ey(ey({},e),{},ev({},j,ey(ey({},y),{},{axisType:o,domain:A,categoricalDomain:C,duplicateDomain:_,originalDomain:null!==(k=y.domain)&&void 0!==k?k:E,isCategorical:d,layout:s})))},{})},eA=function(t,e){var r=e.graphicalItems,n=e.Axis,o=e.axisType,i=e.axisIdKey,a=e.stackGroups,u=e.dataStartIndex,c=e.dataEndIndex,l=t.layout,s=t.children,p=ej(t.data,{graphicalItems:r,dataStartIndex:u,dataEndIndex:c}),d=p.length,y=(0,M.NA)(l,o),v=-1;return r.reduce(function(t,e){var m,b=(void 0!==e.type.defaultProps?ey(ey({},e.type.defaultProps),e.props):e.props)[i],g=eS("number");return t[b]?t:(v++,m=y?f()(0,d):a&&a[b]&&a[b].hasStack?tF(s,m=(0,M.EB)(a[b].stackGroups,u,c),b,o):tF(s,m=(0,M.LG)(g,(0,M.s6)(p,r.filter(function(t){var e,r,n=i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i],o="hide"in t.props?t.props.hide:null===(r=t.type.defaultProps)||void 0===r?void 0:r.hide;return n===b&&!o}),"number",l),n.defaultProps.allowDataOverflow),b,o),ey(ey({},t),{},ev({},b,ey(ey({axisType:o},n.defaultProps),{},{hide:!0,orientation:h()(eb,"".concat(o,".").concat(v%2),null),domain:m,originalDomain:g,isCategorical:y,layout:l}))))},{})},eM=function(t,e){var r=e.axisType,n=void 0===r?"xAxis":r,o=e.AxisComp,i=e.graphicalItems,a=e.stackGroups,u=e.dataStartIndex,c=e.dataEndIndex,l=t.children,s="".concat(n,"Id"),f=(0,E.NN)(l,o),p={};return f&&f.length?p=ek(t,{axes:f,graphicalItems:i,axisType:n,axisIdKey:s,stackGroups:a,dataStartIndex:u,dataEndIndex:c}):i&&i.length&&(p=eA(t,{Axis:o,graphicalItems:i,axisType:n,axisIdKey:s,stackGroups:a,dataStartIndex:u,dataEndIndex:c})),p},eT=function(t){var e=(0,T.Kt)(t),r=(0,M.uY)(e,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:y()(r,function(t){return t.coordinate}),tooltipAxis:e,tooltipAxisBandSize:(0,M.zT)(e,r)}},e_=function(t){var e=t.children,r=t.defaultShowTooltip,n=(0,E.sP)(e,G),o=0,i=0;return t.data&&0!==t.data.length&&(i=t.data.length-1),n&&n.props&&(n.props.startIndex>=0&&(o=n.props.startIndex),n.props.endIndex>=0&&(i=n.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:i,activeTooltipIndex:-1,isTooltipActive:!!r}},eC=function(t){return"horizontal"===t?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:"vertical"===t?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:"centric"===t?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},eN=function(t,e){var r=t.props,n=t.graphicalItems,o=t.xAxisMap,i=void 0===o?{}:o,a=t.yAxisMap,u=void 0===a?{}:a,c=r.width,l=r.height,s=r.children,f=r.margin||{},p=(0,E.sP)(s,G),d=(0,E.sP)(s,j.D),y=Object.keys(u).reduce(function(t,e){var r=u[e],n=r.orientation;return r.mirror||r.hide?t:ey(ey({},t),{},ev({},n,t[n]+r.width))},{left:f.left||0,right:f.right||0}),v=Object.keys(i).reduce(function(t,e){var r=i[e],n=r.orientation;return r.mirror||r.hide?t:ey(ey({},t),{},ev({},n,h()(t,"".concat(n))+r.height))},{top:f.top||0,bottom:f.bottom||0}),m=ey(ey({},v),y),b=m.bottom;p&&(m.bottom+=p.props.height||G.defaultProps.height),d&&e&&(m=(0,M.By)(m,n,r,e));var g=c-m.left-m.right,x=l-m.top-m.bottom;return ey(ey({brushBottom:b},m),{},{width:Math.max(g,0),height:Math.max(x,0)})},eD=function(t){var e=t.chartName,r=t.GraphicalChild,n=t.defaultTooltipEventType,o=void 0===n?"axis":n,a=t.validateTooltipEventTypes,c=void 0===a?["axis"]:a,s=t.axisComponents,f=t.legendContent,p=t.formatAxisMap,d=t.defaultProps,y=function(t,e){var r=e.graphicalItems,n=e.stackGroups,o=e.offset,i=e.updateId,a=e.dataStartIndex,c=e.dataEndIndex,l=t.barSize,f=t.layout,p=t.barGap,h=t.barCategoryGap,d=t.maxBarSize,y=eC(f),v=y.numericAxisName,m=y.cateAxisName,b=!!r&&!!r.length&&r.some(function(t){var e=(0,E.Gf)(t&&t.type);return e&&e.indexOf("Bar")>=0}),x=[];return r.forEach(function(r,y){var w=ej(t.data,{graphicalItems:[r],dataStartIndex:a,dataEndIndex:c}),O=void 0!==r.type.defaultProps?ey(ey({},r.type.defaultProps),r.props):r.props,j=O.dataKey,S=O.maxBarSize,P=O["".concat(v,"Id")],k=O["".concat(m,"Id")],A=s.reduce(function(t,r){var n=e["".concat(r.axisType,"Map")],o=O["".concat(r.axisType,"Id")];n&&n[o]||"zAxis"===r.axisType||(0,g.Z)(!1);var i=n[o];return ey(ey({},t),{},ev(ev({},r.axisType,i),"".concat(r.axisType,"Ticks"),(0,M.uY)(i)))},{}),T=A[m],_=A["".concat(m,"Ticks")],C=n&&n[P]&&n[P].hasStack&&(0,M.O3)(r,n[P].stackGroups),N=(0,E.Gf)(r.type).indexOf("Bar")>=0,D=(0,M.zT)(T,_),I=[],L=b&&(0,M.pt)({barSize:l,stackGroups:n,totalSize:"xAxis"===m?A[m].width:"yAxis"===m?A[m].height:void 0});if(N){var B,R,z=u()(S)?d:S,U=null!==(B=null!==(R=(0,M.zT)(T,_,!0))&&void 0!==R?R:z)&&void 0!==B?B:0;I=(0,M.qz)({barGap:p,barCategoryGap:h,bandSize:U!==D?U:D,sizeList:L[k],maxBarSize:z}),U!==D&&(I=I.map(function(t){return ey(ey({},t),{},{position:ey(ey({},t.position),{},{offset:t.position.offset-U/2})})}))}var $=r&&r.type&&r.type.getComposedData;$&&x.push({props:ey(ey({},$(ey(ey({},A),{},{displayedData:w,props:t,dataKey:j,item:r,bandSize:D,barPosition:I,offset:o,stackedData:C,layout:f,dataStartIndex:a,dataEndIndex:c}))),{},ev(ev(ev({key:r.key||"item-".concat(y)},v,A[v]),m,A[m]),"animationId",i)),childIndex:(0,E.$R)(r,t.children),item:r})}),x},v=function(t,n){var o=t.props,i=t.dataStartIndex,a=t.dataEndIndex,u=t.updateId;if(!(0,E.TT)({props:o}))return null;var c=o.children,l=o.layout,f=o.stackOffset,h=o.data,d=o.reverseStackOrder,v=eC(l),m=v.numericAxisName,b=v.cateAxisName,g=(0,E.NN)(c,r),x=(0,M.wh)(h,g,"".concat(m,"Id"),"".concat(b,"Id"),f,d),w=s.reduce(function(t,e){var r="".concat(e.axisType,"Map");return ey(ey({},t),{},ev({},r,eM(o,ey(ey({},e),{},{graphicalItems:g,stackGroups:e.axisType===m&&x,dataStartIndex:i,dataEndIndex:a}))))},{}),O=eN(ey(ey({},w),{},{props:o,graphicalItems:g}),null==n?void 0:n.legendBBox);Object.keys(w).forEach(function(t){w[t]=p(o,w[t],O,t.replace("Map",""),e)});var j=eT(w["".concat(b,"Map")]),S=y(o,ey(ey({},w),{},{dataStartIndex:i,dataEndIndex:a,updateId:u,graphicalItems:g,stackGroups:x,offset:O}));return ey(ey({formattedGraphicalItems:S,graphicalItems:g,offset:O,stackGroups:x},j),w)},j=function(t){var r;function n(t){var r,o,a,c,s;return!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,n),c=n,s=[t],c=el(c),ev(a=function(t,e){if(e&&("object"===eo(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,ec()?Reflect.construct(c,s||[],el(this).constructor):c.apply(this,s)),"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ev(a,"accessibilityManager",new tQ),ev(a,"handleLegendBBoxUpdate",function(t){if(t){var e=a.state,r=e.dataStartIndex,n=e.dataEndIndex,o=e.updateId;a.setState(ey({legendBBox:t},v({props:a.props,dataStartIndex:r,dataEndIndex:n,updateId:o},ey(ey({},a.state),{},{legendBBox:t}))))}}),ev(a,"handleReceiveSyncEvent",function(t,e,r){a.props.syncId===t&&(r!==a.eventEmitterSymbol||"function"==typeof a.props.syncMethod)&&a.applySyncEvent(e)}),ev(a,"handleBrushChange",function(t){var e=t.startIndex,r=t.endIndex;if(e!==a.state.dataStartIndex||r!==a.state.dataEndIndex){var n=a.state.updateId;a.setState(function(){return ey({dataStartIndex:e,dataEndIndex:r},v({props:a.props,dataStartIndex:e,dataEndIndex:r,updateId:n},a.state))}),a.triggerSyncEvent({dataStartIndex:e,dataEndIndex:r})}}),ev(a,"handleMouseEnter",function(t){var e=a.getMouseInfo(t);if(e){var r=ey(ey({},e),{},{isTooltipActive:!0});a.setState(r),a.triggerSyncEvent(r);var n=a.props.onMouseEnter;l()(n)&&n(r,t)}}),ev(a,"triggeredAfterMouseMove",function(t){var e=a.getMouseInfo(t),r=e?ey(ey({},e),{},{isTooltipActive:!0}):{isTooltipActive:!1};a.setState(r),a.triggerSyncEvent(r);var n=a.props.onMouseMove;l()(n)&&n(r,t)}),ev(a,"handleItemMouseEnter",function(t){a.setState(function(){return{isTooltipActive:!0,activeItem:t,activePayload:t.tooltipPayload,activeCoordinate:t.tooltipPosition||{x:t.cx,y:t.cy}}})}),ev(a,"handleItemMouseLeave",function(){a.setState(function(){return{isTooltipActive:!1}})}),ev(a,"handleMouseMove",function(t){t.persist(),a.throttleTriggeredAfterMouseMove(t)}),ev(a,"handleMouseLeave",function(t){a.throttleTriggeredAfterMouseMove.cancel();var e={isTooltipActive:!1};a.setState(e),a.triggerSyncEvent(e);var r=a.props.onMouseLeave;l()(r)&&r(e,t)}),ev(a,"handleOuterEvent",function(t){var e,r=(0,E.Bh)(t),n=h()(a.props,"".concat(r));r&&l()(n)&&n(null!==(e=/.*touch.*/i.test(r)?a.getMouseInfo(t.changedTouches[0]):a.getMouseInfo(t))&&void 0!==e?e:{},t)}),ev(a,"handleClick",function(t){var e=a.getMouseInfo(t);if(e){var r=ey(ey({},e),{},{isTooltipActive:!0});a.setState(r),a.triggerSyncEvent(r);var n=a.props.onClick;l()(n)&&n(r,t)}}),ev(a,"handleMouseDown",function(t){var e=a.props.onMouseDown;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleMouseUp",function(t){var e=a.props.onMouseUp;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleTouchMove",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.throttleTriggeredAfterMouseMove(t.changedTouches[0])}),ev(a,"handleTouchStart",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.handleMouseDown(t.changedTouches[0])}),ev(a,"handleTouchEnd",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.handleMouseUp(t.changedTouches[0])}),ev(a,"handleDoubleClick",function(t){var e=a.props.onDoubleClick;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleContextMenu",function(t){var e=a.props.onContextMenu;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"triggerSyncEvent",function(t){void 0!==a.props.syncId&&tY.emit(tH,a.props.syncId,t,a.eventEmitterSymbol)}),ev(a,"applySyncEvent",function(t){var e=a.props,r=e.layout,n=e.syncMethod,o=a.state.updateId,i=t.dataStartIndex,u=t.dataEndIndex;if(void 0!==t.dataStartIndex||void 0!==t.dataEndIndex)a.setState(ey({dataStartIndex:i,dataEndIndex:u},v({props:a.props,dataStartIndex:i,dataEndIndex:u,updateId:o},a.state)));else if(void 0!==t.activeTooltipIndex){var c=t.chartX,l=t.chartY,s=t.activeTooltipIndex,f=a.state,p=f.offset,h=f.tooltipTicks;if(!p)return;if("function"==typeof n)s=n(h,t);else if("value"===n){s=-1;for(var d=0;d=0){if(s.dataKey&&!s.allowDuplicatedCategory){var A="function"==typeof s.dataKey?function(t){return"function"==typeof s.dataKey?s.dataKey(t.payload):null}:"payload.".concat(s.dataKey.toString());C=(0,T.Ap)(v,A,p),N=m&&b&&(0,T.Ap)(b,A,p)}else C=null==v?void 0:v[f],N=m&&b&&b[f];if(S||j){var _=void 0!==t.props.activeIndex?t.props.activeIndex:f;return[(0,i.cloneElement)(t,ey(ey(ey({},n.props),P),{},{activeIndex:_})),null,null]}if(!u()(C))return[k].concat(ef(a.renderActivePoints({item:n,activePoint:C,basePoint:N,childIndex:f,isRange:m})))}else{var C,N,D,I=(null!==(D=a.getItemByXY(a.state.activeCoordinate))&&void 0!==D?D:{graphicalItem:k}).graphicalItem,L=I.item,B=void 0===L?t:L,R=I.childIndex,z=ey(ey(ey({},n.props),P),{},{activeIndex:R});return[(0,i.cloneElement)(B,z),null,null]}}return m?[k,null,null]:[k,null]}),ev(a,"renderCustomized",function(t,e,r){return(0,i.cloneElement)(t,ey(ey({key:"recharts-customized-".concat(r)},a.props),a.state))}),ev(a,"renderMap",{CartesianGrid:{handler:ew,once:!0},ReferenceArea:{handler:a.renderReferenceElement},ReferenceLine:{handler:ew},ReferenceDot:{handler:a.renderReferenceElement},XAxis:{handler:ew},YAxis:{handler:ew},Brush:{handler:a.renderBrush,once:!0},Bar:{handler:a.renderGraphicChild},Line:{handler:a.renderGraphicChild},Area:{handler:a.renderGraphicChild},Radar:{handler:a.renderGraphicChild},RadialBar:{handler:a.renderGraphicChild},Scatter:{handler:a.renderGraphicChild},Pie:{handler:a.renderGraphicChild},Funnel:{handler:a.renderGraphicChild},Tooltip:{handler:a.renderCursor,once:!0},PolarGrid:{handler:a.renderPolarGrid,once:!0},PolarAngleAxis:{handler:a.renderPolarAxis},PolarRadiusAxis:{handler:a.renderPolarAxis},Customized:{handler:a.renderCustomized}}),a.clipPathId="".concat(null!==(r=t.id)&&void 0!==r?r:(0,T.EL)("recharts"),"-clip"),a.throttleTriggeredAfterMouseMove=m()(a.triggeredAfterMouseMove,null!==(o=t.throttleDelay)&&void 0!==o?o:1e3/60),a.state={},a}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&es(t,e)}(n,t),r=[{key:"componentDidMount",value:function(){var t,e;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:null!==(t=this.props.margin.left)&&void 0!==t?t:0,top:null!==(e=this.props.margin.top)&&void 0!==e?e:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var t=this.props,e=t.children,r=t.data,n=t.height,o=t.layout,i=(0,E.sP)(e,O.u);if(i){var a=i.props.defaultIndex;if("number"==typeof a&&!(a<0)&&!(a>this.state.tooltipTicks.length-1)){var u=this.state.tooltipTicks[a]&&this.state.tooltipTicks[a].value,c=eP(this.state,r,a,u),l=this.state.tooltipTicks[a].coordinate,s=(this.state.offset.top+n)/2,f="horizontal"===o?{x:l,y:s}:{y:l,x:s},p=this.state.formattedGraphicalItems.find(function(t){return"Scatter"===t.item.type.name});p&&(f=ey(ey({},f),p.props.points[a].tooltipPosition),c=p.props.points[a].tooltipPayload);var h={activeTooltipIndex:a,isTooltipActive:!0,activeLabel:u,activePayload:c,activeCoordinate:f};this.setState(h),this.renderCursor(i),this.accessibilityManager.setIndex(a)}}}},{key:"getSnapshotBeforeUpdate",value:function(t,e){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==e.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==t.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==t.margin){var r,n;this.accessibilityManager.setDetails({offset:{left:null!==(r=this.props.margin.left)&&void 0!==r?r:0,top:null!==(n=this.props.margin.top)&&void 0!==n?n:0}})}return null}},{key:"componentDidUpdate",value:function(t){(0,E.rL)([(0,E.sP)(t.children,O.u)],[(0,E.sP)(this.props.children,O.u)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var t=(0,E.sP)(this.props.children,O.u);if(t&&"boolean"==typeof t.props.shared){var e=t.props.shared?"axis":"item";return c.indexOf(e)>=0?e:o}return o}},{key:"getMouseInfo",value:function(t){if(!this.container)return null;var e=this.container,r=e.getBoundingClientRect(),n=(0,V.os)(r),o={chartX:Math.round(t.pageX-n.left),chartY:Math.round(t.pageY-n.top)},i=r.width/e.offsetWidth||1,a=this.inRange(o.chartX,o.chartY,i);if(!a)return null;var u=this.state,c=u.xAxisMap,l=u.yAxisMap,s=this.getTooltipEventType(),f=eE(this.state,this.props.data,this.props.layout,a);if("axis"!==s&&c&&l){var p=(0,T.Kt)(c).scale,h=(0,T.Kt)(l).scale,d=p&&p.invert?p.invert(o.chartX):null,y=h&&h.invert?h.invert(o.chartY):null;return ey(ey({},o),{},{xValue:d,yValue:y},f)}return f?ey(ey({},o),f):null}},{key:"inRange",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.props.layout,o=t/r,i=e/r;if("horizontal"===n||"vertical"===n){var a=this.state.offset;return o>=a.left&&o<=a.left+a.width&&i>=a.top&&i<=a.top+a.height?{x:o,y:i}:null}var u=this.state,c=u.angleAxisMap,l=u.radiusAxisMap;if(c&&l){var s=(0,T.Kt)(c);return(0,tq.z3)({x:o,y:i},s)}return null}},{key:"parseEventsOfWrapper",value:function(){var t=this.props.children,e=this.getTooltipEventType(),r=(0,E.sP)(t,O.u),n={};return r&&"axis"===e&&(n="click"===r.props.trigger?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),ey(ey({},(0,tX.Ym)(this.props,this.handleOuterEvent)),n)}},{key:"addListener",value:function(){tY.on(tH,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){tY.removeListener(tH,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(t,e,r){for(var n=this.state.formattedGraphicalItems,o=0,i=n.length;ot.length)&&(e=t.length);for(var r=0,n=Array(e);r=0?1:-1;"insideStart"===u?(o=b+S*l,a=w):"insideEnd"===u?(o=g-S*l,a=!w):"end"===u&&(o=g+S*l,a=w),a=j<=0?a:!a;var P=(0,d.op)(p,y,O,o),E=(0,d.op)(p,y,O,o+(a?1:-1)*359),k="M".concat(P.x,",").concat(P.y,"\n A").concat(O,",").concat(O,",0,1,").concat(a?0:1,",\n ").concat(E.x,",").concat(E.y),A=i()(t.id)?(0,h.EL)("recharts-radial-line-"):t.id;return n.createElement("text",x({},r,{dominantBaseline:"central",className:(0,s.Z)("recharts-radial-bar-label",f)}),n.createElement("defs",null,n.createElement("path",{id:A,d:k})),n.createElement("textPath",{xlinkHref:"#".concat(A)},e))},j=function(t){var e=t.viewBox,r=t.offset,n=t.position,o=e.cx,i=e.cy,a=e.innerRadius,u=e.outerRadius,c=(e.startAngle+e.endAngle)/2;if("outside"===n){var l=(0,d.op)(o,i,u+r,c),s=l.x;return{x:s,y:l.y,textAnchor:s>=o?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"end"};var f=(0,d.op)(o,i,(a+u)/2,c);return{x:f.x,y:f.y,textAnchor:"middle",verticalAnchor:"middle"}},S=function(t){var e=t.viewBox,r=t.parentViewBox,n=t.offset,o=t.position,i=e.x,a=e.y,u=e.width,c=e.height,s=c>=0?1:-1,f=s*n,p=s>0?"end":"start",d=s>0?"start":"end",y=u>=0?1:-1,v=y*n,m=y>0?"end":"start",b=y>0?"start":"end";if("top"===o)return g(g({},{x:i+u/2,y:a-s*n,textAnchor:"middle",verticalAnchor:p}),r?{height:Math.max(a-r.y,0),width:u}:{});if("bottom"===o)return g(g({},{x:i+u/2,y:a+c+f,textAnchor:"middle",verticalAnchor:d}),r?{height:Math.max(r.y+r.height-(a+c),0),width:u}:{});if("left"===o){var x={x:i-v,y:a+c/2,textAnchor:m,verticalAnchor:"middle"};return g(g({},x),r?{width:Math.max(x.x-r.x,0),height:c}:{})}if("right"===o){var w={x:i+u+v,y:a+c/2,textAnchor:b,verticalAnchor:"middle"};return g(g({},w),r?{width:Math.max(r.x+r.width-w.x,0),height:c}:{})}var O=r?{width:u,height:c}:{};return"insideLeft"===o?g({x:i+v,y:a+c/2,textAnchor:b,verticalAnchor:"middle"},O):"insideRight"===o?g({x:i+u-v,y:a+c/2,textAnchor:m,verticalAnchor:"middle"},O):"insideTop"===o?g({x:i+u/2,y:a+f,textAnchor:"middle",verticalAnchor:d},O):"insideBottom"===o?g({x:i+u/2,y:a+c-f,textAnchor:"middle",verticalAnchor:p},O):"insideTopLeft"===o?g({x:i+v,y:a+f,textAnchor:b,verticalAnchor:d},O):"insideTopRight"===o?g({x:i+u-v,y:a+f,textAnchor:m,verticalAnchor:d},O):"insideBottomLeft"===o?g({x:i+v,y:a+c-f,textAnchor:b,verticalAnchor:p},O):"insideBottomRight"===o?g({x:i+u-v,y:a+c-f,textAnchor:m,verticalAnchor:p},O):l()(o)&&((0,h.hj)(o.x)||(0,h.hU)(o.x))&&((0,h.hj)(o.y)||(0,h.hU)(o.y))?g({x:i+(0,h.h1)(o.x,u),y:a+(0,h.h1)(o.y,c),textAnchor:"end",verticalAnchor:"end"},O):g({x:i+u/2,y:a+c/2,textAnchor:"middle",verticalAnchor:"middle"},O)};function P(t){var e,r=t.offset,o=g({offset:void 0===r?5:r},function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,v)),a=o.viewBox,c=o.position,l=o.value,d=o.children,y=o.content,m=o.className,b=o.textBreakAll;if(!a||i()(l)&&i()(d)&&!(0,n.isValidElement)(y)&&!u()(y))return null;if((0,n.isValidElement)(y))return(0,n.cloneElement)(y,o);if(u()(y)){if(e=(0,n.createElement)(y,o),(0,n.isValidElement)(e))return e}else e=w(o);var P="cx"in a&&(0,h.hj)(a.cx),E=(0,p.L6)(o,!0);if(P&&("insideStart"===c||"insideEnd"===c||"end"===c))return O(o,e,E);var k=P?j(o):S(o);return n.createElement(f.x,x({className:(0,s.Z)("recharts-label",void 0===m?"":m)},E,k,{breakAll:b}),e)}P.displayName="Label";var E=function(t){var e=t.cx,r=t.cy,n=t.angle,o=t.startAngle,i=t.endAngle,a=t.r,u=t.radius,c=t.innerRadius,l=t.outerRadius,s=t.x,f=t.y,p=t.top,d=t.left,y=t.width,v=t.height,m=t.clockWise,b=t.labelViewBox;if(b)return b;if((0,h.hj)(y)&&(0,h.hj)(v)){if((0,h.hj)(s)&&(0,h.hj)(f))return{x:s,y:f,width:y,height:v};if((0,h.hj)(p)&&(0,h.hj)(d))return{x:p,y:d,width:y,height:v}}return(0,h.hj)(s)&&(0,h.hj)(f)?{x:s,y:f,width:0,height:0}:(0,h.hj)(e)&&(0,h.hj)(r)?{cx:e,cy:r,startAngle:o||n||0,endAngle:i||n||0,innerRadius:c||0,outerRadius:l||u||a||0,clockWise:m}:t.viewBox?t.viewBox:{}};P.parseViewBox=E,P.renderCallByParent=function(t,e){var r,o,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!t||!t.children&&i&&!t.label)return null;var a=t.children,c=E(t),s=(0,p.NN)(a,P).map(function(t,r){return(0,n.cloneElement)(t,{viewBox:e||c,key:"label-".concat(r)})});return i?[(r=t.label,o=e||c,r?!0===r?n.createElement(P,{key:"label-implicit",viewBox:o}):(0,h.P2)(r)?n.createElement(P,{key:"label-implicit",viewBox:o,value:r}):(0,n.isValidElement)(r)?r.type===P?(0,n.cloneElement)(r,{key:"label-implicit",viewBox:o}):n.createElement(P,{key:"label-implicit",content:r,viewBox:o}):u()(r)?n.createElement(P,{key:"label-implicit",content:r,viewBox:o}):l()(r)?n.createElement(P,x({viewBox:o},r,{key:"label-implicit"})):null:null)].concat(function(t){if(Array.isArray(t))return m(t)}(s)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(s)||function(t,e){if(t){if("string"==typeof t)return m(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(t,void 0)}}(s)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):s}},58772:function(t,e,r){"use strict";r.d(e,{e:function(){return P}});var n=r(2265),o=r(77571),i=r.n(o),a=r(28302),u=r.n(a),c=r(86757),l=r.n(c),s=r(86185),f=r.n(s),p=r(26680),h=r(9841),d=r(82944),y=r(85355);function v(t){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var m=["valueAccessor"],b=["data","dataKey","clockWise","id","textBreakAll"];function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var S=function(t){return Array.isArray(t.value)?f()(t.value):t.value};function P(t){var e=t.valueAccessor,r=void 0===e?S:e,o=j(t,m),a=o.data,u=o.dataKey,c=o.clockWise,l=o.id,s=o.textBreakAll,f=j(o,b);return a&&a.length?n.createElement(h.m,{className:"recharts-label-list"},a.map(function(t,e){var o=i()(u)?r(t,e):(0,y.F$)(t&&t.payload,u),a=i()(l)?{}:{id:"".concat(l,"-").concat(e)};return n.createElement(p._,x({},(0,d.L6)(t,!0),f,a,{parentViewBox:t.parentViewBox,value:o,textBreakAll:s,viewBox:p._.parseViewBox(i()(c)?t:O(O({},t),{},{clockWise:c})),key:"label-".concat(e),index:e}))})):null}P.displayName="LabelList",P.renderCallByParent=function(t,e){var r,o=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!t||!t.children&&o&&!t.label)return null;var i=t.children,a=(0,d.NN)(i,P).map(function(t,r){return(0,n.cloneElement)(t,{data:e,key:"labelList-".concat(r)})});return o?[(r=t.label)?!0===r?n.createElement(P,{key:"labelList-implicit",data:e}):n.isValidElement(r)||l()(r)?n.createElement(P,{key:"labelList-implicit",data:e,content:r}):u()(r)?n.createElement(P,x({data:e},r,{key:"labelList-implicit"})):null:null].concat(function(t){if(Array.isArray(t))return g(t)}(a)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(a)||function(t,e){if(t){if("string"==typeof t)return g(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(t,void 0)}}(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):a}},22190:function(t,e,r){"use strict";r.d(e,{D:function(){return N}});var n=r(2265),o=r(86757),i=r.n(o),a=r(87602),u=r(1175),c=r(48777),l=r(14870),s=r(41637);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(){return(p=Object.assign?Object.assign.bind():function(t){for(var e=1;e');var x=e.inactive?h:e.color;return n.createElement("li",p({className:b,style:y,key:"legend-item-".concat(r)},(0,s.bw)(t.props,e,r)),n.createElement(c.T,{width:o,height:o,viewBox:d,style:v},t.renderIcon(e)),n.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},l?l(g,e,r):g))})}},{key:"render",value:function(){var t=this.props,e=t.payload,r=t.layout,o=t.align;return e&&e.length?n.createElement("ul",{className:"recharts-default-legend",style:{padding:0,margin:0,textAlign:"horizontal"===r?o:"left"}},this.renderItems()):null}}],function(t,e){for(var r=0;r1||Math.abs(e.height-this.lastBoundingBox.height)>1)&&(this.lastBoundingBox.width=e.width,this.lastBoundingBox.height=e.height,t&&t(e)):(-1!==this.lastBoundingBox.width||-1!==this.lastBoundingBox.height)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,t&&t(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?P({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(t){var e,r,n=this.props,o=n.layout,i=n.align,a=n.verticalAlign,u=n.margin,c=n.chartWidth,l=n.chartHeight;return t&&(void 0!==t.left&&null!==t.left||void 0!==t.right&&null!==t.right)||(e="center"===i&&"vertical"===o?{left:((c||0)-this.getBBoxSnapshot().width)/2}:"right"===i?{right:u&&u.right||0}:{left:u&&u.left||0}),t&&(void 0!==t.top&&null!==t.top||void 0!==t.bottom&&null!==t.bottom)||(r="middle"===a?{top:((l||0)-this.getBBoxSnapshot().height)/2}:"bottom"===a?{bottom:u&&u.bottom||0}:{top:u&&u.top||0}),P(P({},e),r)}},{key:"render",value:function(){var t=this,e=this.props,r=e.content,o=e.width,i=e.height,a=e.wrapperStyle,u=e.payloadUniqBy,c=e.payload,l=P(P({position:"absolute",width:o||"auto",height:i||"auto"},this.getDefaultPosition(a)),a);return n.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(e){t.wrapperNode=e}},function(t,e){if(n.isValidElement(t))return n.cloneElement(t,e);if("function"==typeof t)return n.createElement(t,e);e.ref;var r=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(e,j);return n.createElement(g,r)}(r,P(P({},this.props),{},{payload:(0,w.z)(c,u,C)})))}}],r=[{key:"getWithHeight",value:function(t,e){var r=P(P({},this.defaultProps),t.props).layout;return"vertical"===r&&(0,x.hj)(t.props.height)?{height:t.props.height}:"horizontal"===r?{width:t.props.width||e}:null}}],e&&E(o.prototype,e),r&&E(o,r),Object.defineProperty(o,"prototype",{writable:!1}),o}(n.PureComponent);T(N,"displayName","Legend"),T(N,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"})},47625:function(t,e,r){"use strict";r.d(e,{h:function(){return d}});var n=r(87602),o=r(2265),i=r(37065),a=r.n(i),u=r(16630),c=r(1175),l=r(82944);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function p(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&(t=a()(t,S,{trailing:!0,leading:!1}));var e=new ResizeObserver(t),r=M.current.getBoundingClientRect();return D(r.width,r.height),e.observe(M.current),function(){e.disconnect()}},[D,S]);var I=(0,o.useMemo)(function(){var t=C.containerWidth,e=C.containerHeight;if(t<0||e<0)return null;(0,c.Z)((0,u.hU)(y)||(0,u.hU)(m),"The width(%s) and height(%s) are both fixed numbers,\n maybe you don't need to use a ResponsiveContainer.",y,m),(0,c.Z)(!i||i>0,"The aspect(%s) must be greater than zero.",i);var r=(0,u.hU)(y)?t:y,n=(0,u.hU)(m)?e:m;i&&i>0&&(r?n=r/i:n&&(r=n*i),w&&n>w&&(n=w)),(0,c.Z)(r>0||n>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",r,n,y,m,g,x,i);var a=!Array.isArray(O)&&(0,l.Gf)(O.type).endsWith("Chart");return o.Children.map(O,function(t){return o.isValidElement(t)?(0,o.cloneElement)(t,p({width:r,height:n},a?{style:p({height:"100%",width:"100%",maxHeight:n,maxWidth:r},t.props.style)}:{})):t})},[i,O,m,w,x,g,C,y]);return o.createElement("div",{id:P?"".concat(P):void 0,className:(0,n.Z)("recharts-responsive-container",E),style:p(p({},void 0===A?{}:A),{},{width:y,height:m,minWidth:g,minHeight:x,maxHeight:w}),ref:M},I)})},58811:function(t,e,r){"use strict";r.d(e,{x:function(){return B}});var n=r(2265),o=r(77571),i=r.n(o),a=r(87602),u=r(16630),c=r(34067),l=r(82944),s=r(4094);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return h(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function M(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return T(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return T(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&void 0!==arguments[0]?arguments[0]:[];return t.reduce(function(t,e){var i=e.word,a=e.width,u=t[t.length-1];return u&&(null==n||o||u.width+a+ra||e.reduce(function(t,e){return t.width>e.width?t:e}).width>Number(n),e]},y=0,v=c.length-1,m=0;y<=v&&m<=c.length-1;){var b=Math.floor((y+v)/2),g=M(d(b-1),2),x=g[0],w=g[1],O=M(d(b),1)[0];if(x||O||(y=b+1),x&&O&&(v=b-1),!x&&O){i=w;break}m++}return i||h},D=function(t){return[{words:i()(t)?[]:t.toString().split(_)}]},I=function(t){var e=t.width,r=t.scaleToFit,n=t.children,o=t.style,i=t.breakAll,a=t.maxLines;if((e||r)&&!c.x.isSsr){var u=C({breakAll:i,children:n,style:o});return u?N({breakAll:i,children:n,maxLines:a,style:o},u.wordsWithComputedWidth,u.spaceWidth,e,r):D(n)}return D(n)},L="#808080",B=function(t){var e,r=t.x,o=void 0===r?0:r,i=t.y,c=void 0===i?0:i,s=t.lineHeight,f=void 0===s?"1em":s,p=t.capHeight,h=void 0===p?"0.71em":p,d=t.scaleToFit,y=void 0!==d&&d,v=t.textAnchor,m=t.verticalAnchor,b=t.fill,g=void 0===b?L:b,x=A(t,P),w=(0,n.useMemo)(function(){return I({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:y,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,y,x.style,x.width]),O=x.dx,j=x.dy,M=x.angle,T=x.className,_=x.breakAll,C=A(x,E);if(!(0,u.P2)(o)||!(0,u.P2)(c))return null;var N=o+((0,u.hj)(O)?O:0),D=c+((0,u.hj)(j)?j:0);switch(void 0===m?"end":m){case"start":e=S("calc(".concat(h,")"));break;case"middle":e=S("calc(".concat((w.length-1)/2," * -").concat(f," + (").concat(h," / 2))"));break;default:e=S("calc(".concat(w.length-1," * -").concat(f,")"))}var B=[];if(y){var R=w[0].width,z=x.width;B.push("scale(".concat(((0,u.hj)(z)?z/R:1)/R,")"))}return M&&B.push("rotate(".concat(M,", ").concat(N,", ").concat(D,")")),B.length&&(C.transform=B.join(" ")),n.createElement("text",k({},(0,l.L6)(C,!0),{x:N,y:D,className:(0,a.Z)("recharts-text",T),textAnchor:void 0===v?"start":v,fill:g.includes("url")?L:g}),w.map(function(t,r){var o=t.words.join(_?"":" ");return n.createElement("tspan",{x:N,dy:0===r?e:f,key:"".concat(o,"-").concat(r)},o)}))}},8147:function(t,e,r){"use strict";r.d(e,{u:function(){return F}});var n=r(2265),o=r(34935),i=r.n(o),a=r(77571),u=r.n(a),c=r(87602),l=r(16630);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(){return(f=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);rc[n]+s?Math.max(f,c[n]):Math.max(p,c[n])}function O(t){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function S(t){for(var e=1;e1||Math.abs(t.height-this.state.lastBoundingBox.height)>1)&&this.setState({lastBoundingBox:{width:t.width,height:t.height}})}else(-1!==this.state.lastBoundingBox.width||-1!==this.state.lastBoundingBox.height)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var t,e;this.props.active&&this.updateBBox(),this.state.dismissed&&((null===(t=this.props.coordinate)||void 0===t?void 0:t.x)!==this.state.dismissedAtCoordinate.x||(null===(e=this.props.coordinate)||void 0===e?void 0:e.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var t,e,r,o,i,a,u,s,f,p,h,d,y,v,m,O,j,P,E,k=this,A=this.props,M=A.active,T=A.allowEscapeViewBox,_=A.animationDuration,C=A.animationEasing,N=A.children,D=A.coordinate,I=A.hasPayload,L=A.isAnimationActive,B=A.offset,R=A.position,z=A.reverseDirection,U=A.useTranslate3d,$=A.viewBox,F=A.wrapperStyle,q=(d=(t={allowEscapeViewBox:T,coordinate:D,offsetTopLeft:B,position:R,reverseDirection:z,tooltipBox:this.state.lastBoundingBox,useTranslate3d:U,viewBox:$}).allowEscapeViewBox,y=t.coordinate,v=t.offsetTopLeft,m=t.position,O=t.reverseDirection,j=t.tooltipBox,P=t.useTranslate3d,E=t.viewBox,j.height>0&&j.width>0&&y?(r=(e={translateX:p=w({allowEscapeViewBox:d,coordinate:y,key:"x",offsetTopLeft:v,position:m,reverseDirection:O,tooltipDimension:j.width,viewBox:E,viewBoxDimension:E.width}),translateY:h=w({allowEscapeViewBox:d,coordinate:y,key:"y",offsetTopLeft:v,position:m,reverseDirection:O,tooltipDimension:j.height,viewBox:E,viewBoxDimension:E.height}),useTranslate3d:P}).translateX,o=e.translateY,f={transform:e.useTranslate3d?"translate3d(".concat(r,"px, ").concat(o,"px, 0)"):"translate(".concat(r,"px, ").concat(o,"px)")}):f=x,{cssProperties:f,cssClasses:(a=(i={translateX:p,translateY:h,coordinate:y}).coordinate,u=i.translateX,s=i.translateY,(0,c.Z)(g,b(b(b(b({},"".concat(g,"-right"),(0,l.hj)(u)&&a&&(0,l.hj)(a.x)&&u>=a.x),"".concat(g,"-left"),(0,l.hj)(u)&&a&&(0,l.hj)(a.x)&&u=a.y),"".concat(g,"-top"),(0,l.hj)(s)&&a&&(0,l.hj)(a.y)&&s0;return n.createElement(T,{allowEscapeViewBox:i,animationDuration:a,animationEasing:u,isAnimationActive:f,active:o,coordinate:l,hasPayload:O,offset:p,position:y,reverseDirection:m,useTranslate3d:b,viewBox:g,wrapperStyle:x},(t=I(I({},this.props),{},{payload:w}),n.isValidElement(c)?n.cloneElement(c,t):"function"==typeof c?n.createElement(c,t):n.createElement(v,t)))}}],function(t,e){for(var r=0;r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,a),s=(0,o.Z)("recharts-layer",c);return n.createElement("g",u({className:s},(0,i.L6)(l,!0),{ref:e}),r)})},48777:function(t,e,r){"use strict";r.d(e,{T:function(){return c}});var n=r(2265),o=r(87602),i=r(82944),a=["children","width","height","viewBox","className","style","title","desc"];function u(){return(u=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,a),y=l||{width:r,height:c,x:0,y:0},v=(0,o.Z)("recharts-surface",s);return n.createElement("svg",u({},(0,i.L6)(d,!0,"svg"),{className:v,width:r,height:c,style:f,viewBox:"".concat(y.x," ").concat(y.y," ").concat(y.width," ").concat(y.height)}),n.createElement("title",null,p),n.createElement("desc",null,h),e)}},25739:function(t,e,r){"use strict";r.d(e,{br:function(){return g},CW:function(){return O},Mw:function(){return A},zn:function(){return k},sp:function(){return x},qD:function(){return E},d2:function(){return P},bH:function(){return w},Ud:function(){return S},Nf:function(){return j}});var n=r(2265),o=r(69398),i=r(84173),a=r.n(i),u=r(32242),c=r.n(u),l=r(50967),s=r.n(l)()(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),f=r(16630),p=(0,n.createContext)(void 0),h=(0,n.createContext)(void 0),d=(0,n.createContext)(void 0),y=(0,n.createContext)({}),v=(0,n.createContext)(void 0),m=(0,n.createContext)(0),b=(0,n.createContext)(0),g=function(t){var e=t.state,r=e.xAxisMap,o=e.yAxisMap,i=e.offset,a=t.clipPathId,u=t.children,c=t.width,l=t.height,f=s(i);return n.createElement(p.Provider,{value:r},n.createElement(h.Provider,{value:o},n.createElement(y.Provider,{value:i},n.createElement(d.Provider,{value:f},n.createElement(v.Provider,{value:a},n.createElement(m.Provider,{value:l},n.createElement(b.Provider,{value:c},u)))))))},x=function(){return(0,n.useContext)(v)},w=function(t){var e=(0,n.useContext)(p);null!=e||(0,o.Z)(!1);var r=e[t];return null!=r||(0,o.Z)(!1),r},O=function(){var t=(0,n.useContext)(p);return(0,f.Kt)(t)},j=function(){var t=(0,n.useContext)(h);return a()(t,function(t){return c()(t.domain,Number.isFinite)})||(0,f.Kt)(t)},S=function(t){var e=(0,n.useContext)(h);null!=e||(0,o.Z)(!1);var r=e[t];return null!=r||(0,o.Z)(!1),r},P=function(){return(0,n.useContext)(d)},E=function(){return(0,n.useContext)(y)},k=function(){return(0,n.useContext)(b)},A=function(){return(0,n.useContext)(m)}},57165:function(t,e,r){"use strict";r.d(e,{H:function(){return H}});var n=r(2265);function o(){}function i(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function a(t){this._context=t}function u(t){this._context=t}function c(t){this._context=t}a.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:i(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},u.prototype={areaStart:o,areaEnd:o,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},c.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};class l{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}function s(t){this._context=t}function f(t){this._context=t}function p(t){return new f(t)}function h(t,e,r){var n=t._x1-t._x0,o=e-t._x1,i=(t._y1-t._y0)/(n||o<0&&-0),a=(r-t._y1)/(o||n<0&&-0);return((i<0?-1:1)+(a<0?-1:1))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs((i*o+a*n)/(n+o)))||0}function d(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function y(t,e,r){var n=t._x0,o=t._y0,i=t._x1,a=t._y1,u=(i-n)/3;t._context.bezierCurveTo(n+u,o+u*e,i-u,a-u*r,i,a)}function v(t){this._context=t}function m(t){this._context=new b(t)}function b(t){this._context=t}function g(t){this._context=t}function x(t){var e,r,n=t.length-1,o=Array(n),i=Array(n),a=Array(n);for(o[0]=0,i[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)o[e]=(a[e]-o[e+1])/i[e];for(e=0,i[n-1]=(t[n]+o[n-1])/2;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}}this._x=t,this._y=e}};var O=r(22516),j=r(76115),S=r(67790);function P(t){return t[0]}function E(t){return t[1]}function k(t,e){var r=(0,j.Z)(!0),n=null,o=p,i=null,a=(0,S.d)(u);function u(u){var c,l,s,f=(u=(0,O.Z)(u)).length,p=!1;for(null==n&&(i=o(s=a())),c=0;c<=f;++c)!(c=f;--p)u.point(m[p],b[p]);u.lineEnd(),u.areaEnd()}}v&&(m[s]=+t(h,s,l),b[s]=+e(h,s,l),u.point(n?+n(h,s,l):m[s],r?+r(h,s,l):b[s]))}if(d)return u=null,d+""||null}function s(){return k().defined(o).curve(a).context(i)}return t="function"==typeof t?t:void 0===t?P:(0,j.Z)(+t),e="function"==typeof e?e:void 0===e?(0,j.Z)(0):(0,j.Z)(+e),r="function"==typeof r?r:void 0===r?E:(0,j.Z)(+r),l.x=function(e){return arguments.length?(t="function"==typeof e?e:(0,j.Z)(+e),n=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:(0,j.Z)(+e),l):t},l.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:(0,j.Z)(+t),l):n},l.y=function(t){return arguments.length?(e="function"==typeof t?t:(0,j.Z)(+t),r=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:(0,j.Z)(+t),l):e},l.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:(0,j.Z)(+t),l):r},l.lineX0=l.lineY0=function(){return s().x(t).y(e)},l.lineY1=function(){return s().x(t).y(r)},l.lineX1=function(){return s().x(n).y(e)},l.defined=function(t){return arguments.length?(o="function"==typeof t?t:(0,j.Z)(!!t),l):o},l.curve=function(t){return arguments.length?(a=t,null!=i&&(u=a(i)),l):a},l.context=function(t){return arguments.length?(null==t?i=u=null:u=a(i=t),l):i},l}var M=r(75551),T=r.n(M),_=r(86757),C=r.n(_),N=r(87602),D=r(41637),I=r(82944),L=r(16630);function B(t){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function R(){return(R=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r=0?1:-1,c=r>=0?1:-1,l=n>=0&&r>=0||n<0&&r<0?1:0;if(a>0&&o instanceof Array){for(var s=[0,0,0,0],f=0;f<4;f++)s[f]=o[f]>a?a:o[f];i="M".concat(t,",").concat(e+u*s[0]),s[0]>0&&(i+="A ".concat(s[0],",").concat(s[0],",0,0,").concat(l,",").concat(t+c*s[0],",").concat(e)),i+="L ".concat(t+r-c*s[1],",").concat(e),s[1]>0&&(i+="A ".concat(s[1],",").concat(s[1],",0,0,").concat(l,",\n ").concat(t+r,",").concat(e+u*s[1])),i+="L ".concat(t+r,",").concat(e+n-u*s[2]),s[2]>0&&(i+="A ".concat(s[2],",").concat(s[2],",0,0,").concat(l,",\n ").concat(t+r-c*s[2],",").concat(e+n)),i+="L ".concat(t+c*s[3],",").concat(e+n),s[3]>0&&(i+="A ".concat(s[3],",").concat(s[3],",0,0,").concat(l,",\n ").concat(t,",").concat(e+n-u*s[3])),i+="Z"}else if(a>0&&o===+o&&o>0){var p=Math.min(a,o);i="M ".concat(t,",").concat(e+u*p,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+c*p,",").concat(e,"\n L ").concat(t+r-c*p,",").concat(e,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+r,",").concat(e+u*p,"\n L ").concat(t+r,",").concat(e+n-u*p,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+r-c*p,",").concat(e+n,"\n L ").concat(t+c*p,",").concat(e+n,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t,",").concat(e+n-u*p," Z")}else i="M ".concat(t,",").concat(e," h ").concat(r," v ").concat(n," h ").concat(-r," Z");return i},h=function(t,e){if(!t||!e)return!1;var r=t.x,n=t.y,o=e.x,i=e.y,a=e.width,u=e.height;return!!(Math.abs(a)>0&&Math.abs(u)>0)&&r>=Math.min(o,o+a)&&r<=Math.max(o,o+a)&&n>=Math.min(i,i+u)&&n<=Math.max(i,i+u)},d={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},y=function(t){var e,r=f(f({},d),t),u=(0,n.useRef)(),s=function(t){if(Array.isArray(t))return t}(e=(0,n.useState)(-1))||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,2)||function(t,e){if(t){if("string"==typeof t)return l(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(t,2)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),h=s[0],y=s[1];(0,n.useEffect)(function(){if(u.current&&u.current.getTotalLength)try{var t=u.current.getTotalLength();t&&y(t)}catch(t){}},[]);var v=r.x,m=r.y,b=r.width,g=r.height,x=r.radius,w=r.className,O=r.animationEasing,j=r.animationDuration,S=r.animationBegin,P=r.isAnimationActive,E=r.isUpdateAnimationActive;if(v!==+v||m!==+m||b!==+b||g!==+g||0===b||0===g)return null;var k=(0,o.Z)("recharts-rectangle",w);return E?n.createElement(i.ZP,{canBegin:h>0,from:{width:b,height:g,x:v,y:m},to:{width:b,height:g,x:v,y:m},duration:j,animationEasing:O,isActive:E},function(t){var e=t.width,o=t.height,l=t.x,s=t.y;return n.createElement(i.ZP,{canBegin:h>0,from:"0px ".concat(-1===h?1:h,"px"),to:"".concat(h,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:j,isActive:P,easing:O},n.createElement("path",c({},(0,a.L6)(r,!0),{className:k,d:p(l,s,e,o,x),ref:u})))}):n.createElement("path",c({},(0,a.L6)(r,!0),{className:k,d:p(v,m,b,g,x)}))}},60474:function(t,e,r){"use strict";r.d(e,{L:function(){return v}});var n=r(2265),o=r(87602),i=r(82944),a=r(39206),u=r(16630);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(){return(l=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(c>s),",\n ").concat(p.x,",").concat(p.y,"\n ");if(o>0){var d=(0,a.op)(r,n,o,c),y=(0,a.op)(r,n,o,s);h+="L ".concat(y.x,",").concat(y.y,"\n A ").concat(o,",").concat(o,",0,\n ").concat(+(Math.abs(l)>180),",").concat(+(c<=s),",\n ").concat(d.x,",").concat(d.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},d=function(t){var e=t.cx,r=t.cy,n=t.innerRadius,o=t.outerRadius,i=t.cornerRadius,a=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,s=t.endAngle,f=(0,u.uY)(s-l),d=p({cx:e,cy:r,radius:o,angle:l,sign:f,cornerRadius:i,cornerIsExternal:c}),y=d.circleTangency,v=d.lineTangency,m=d.theta,b=p({cx:e,cy:r,radius:o,angle:s,sign:-f,cornerRadius:i,cornerIsExternal:c}),g=b.circleTangency,x=b.lineTangency,w=b.theta,O=c?Math.abs(l-s):Math.abs(l-s)-m-w;if(O<0)return a?"M ".concat(v.x,",").concat(v.y,"\n a").concat(i,",").concat(i,",0,0,1,").concat(2*i,",0\n a").concat(i,",").concat(i,",0,0,1,").concat(-(2*i),",0\n "):h({cx:e,cy:r,innerRadius:n,outerRadius:o,startAngle:l,endAngle:s});var j="M ".concat(v.x,",").concat(v.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(y.x,",").concat(y.y,"\n A").concat(o,",").concat(o,",0,").concat(+(O>180),",").concat(+(f<0),",").concat(g.x,",").concat(g.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(x.x,",").concat(x.y,"\n ");if(n>0){var S=p({cx:e,cy:r,radius:n,angle:l,sign:f,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),P=S.circleTangency,E=S.lineTangency,k=S.theta,A=p({cx:e,cy:r,radius:n,angle:s,sign:-f,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),M=A.circleTangency,T=A.lineTangency,_=A.theta,C=c?Math.abs(l-s):Math.abs(l-s)-k-_;if(C<0&&0===i)return"".concat(j,"L").concat(e,",").concat(r,"Z");j+="L".concat(T.x,",").concat(T.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(M.x,",").concat(M.y,"\n A").concat(n,",").concat(n,",0,").concat(+(C>180),",").concat(+(f>0),",").concat(P.x,",").concat(P.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(E.x,",").concat(E.y,"Z")}else j+="L".concat(e,",").concat(r,"Z");return j},y={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},v=function(t){var e,r=f(f({},y),t),a=r.cx,c=r.cy,s=r.innerRadius,p=r.outerRadius,v=r.cornerRadius,m=r.forceCornerRadius,b=r.cornerIsExternal,g=r.startAngle,x=r.endAngle,w=r.className;if(p0&&360>Math.abs(g-x)?d({cx:a,cy:c,innerRadius:s,outerRadius:p,cornerRadius:Math.min(S,j/2),forceCornerRadius:m,cornerIsExternal:b,startAngle:g,endAngle:x}):h({cx:a,cy:c,innerRadius:s,outerRadius:p,startAngle:g,endAngle:x}),n.createElement("path",l({},(0,i.L6)(r,!0),{className:O,d:e,role:"img"}))}},14870:function(t,e,r){"use strict";r.d(e,{v:function(){return N}});var n=r(2265),o=r(75551),i=r.n(o);let a=Math.cos,u=Math.sin,c=Math.sqrt,l=Math.PI,s=2*l;var f={draw(t,e){let r=c(e/l);t.moveTo(r,0),t.arc(0,0,r,0,s)}};let p=c(1/3),h=2*p,d=u(l/10)/u(7*l/10),y=u(s/10)*d,v=-a(s/10)*d,m=c(3),b=c(3)/2,g=1/c(12),x=(g/2+1)*3;var w=r(76115),O=r(67790);c(3),c(3);var j=r(87602),S=r(82944);function P(t){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var E=["type","size","sizeType"];function k(){return(k=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,E)),{},{type:o,size:u,sizeType:l}),p=s.className,h=s.cx,d=s.cy,y=(0,S.L6)(s,!0);return h===+h&&d===+d&&u===+u?n.createElement("path",k({},y,{className:(0,j.Z)("recharts-symbols",p),transform:"translate(".concat(h,", ").concat(d,")"),d:(e=T["symbol".concat(i()(o))]||f,(function(t,e){let r=null,n=(0,O.d)(o);function o(){let o;if(r||(r=o=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),o)return r=null,o+""||null}return t="function"==typeof t?t:(0,w.Z)(t||f),e="function"==typeof e?e:(0,w.Z)(void 0===e?64:+e),o.type=function(e){return arguments.length?(t="function"==typeof e?e:(0,w.Z)(e),o):t},o.size=function(t){return arguments.length?(e="function"==typeof t?t:(0,w.Z)(+t),o):e},o.context=function(t){return arguments.length?(r=null==t?null:t,o):r},o})().type(e).size(C(u,l,o))())})):null};N.registerSymbol=function(t,e){T["symbol".concat(i()(t))]=e}},11638:function(t,e,r){"use strict";r.d(e,{bn:function(){return C},a3:function(){return z},lT:function(){return N},V$:function(){return D},w7:function(){return I}});var n=r(2265),o=r(86757),i=r.n(o),a=r(90231),u=r.n(a),c=r(24342),l=r.n(c),s=r(21652),f=r.n(s),p=r(73649),h=r(87602),d=r(84735),y=r(82944);function v(t){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function m(){return(m=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r0,from:{upperWidth:0,lowerWidth:0,height:p,x:c,y:l},to:{upperWidth:s,lowerWidth:f,height:p,x:c,y:l},duration:j,animationEasing:g,isActive:P},function(t){var e=t.upperWidth,i=t.lowerWidth,u=t.height,c=t.x,l=t.y;return n.createElement(d.ZP,{canBegin:a>0,from:"0px ".concat(-1===a?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:j,easing:g},n.createElement("path",m({},(0,y.L6)(r,!0),{className:E,d:w(c,l,e,i,u),ref:o})))}):n.createElement("g",null,n.createElement("path",m({},(0,y.L6)(r,!0),{className:E,d:w(c,l,s,f,p)})))},S=r(60474),P=r(9841),E=r(14870),k=["option","shapeType","propTransformer","activeClassName","isActive"];function A(t){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function T(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,k);if((0,n.isValidElement)(r))e=(0,n.cloneElement)(r,T(T({},f),(0,n.isValidElement)(r)?r.props:r));else if(i()(r))e=r(f);else if(u()(r)&&!l()(r)){var p=(void 0===a?function(t,e){return T(T({},e),t)}:a)(r,f);e=n.createElement(_,{shapeType:o,elementProps:p})}else e=n.createElement(_,{shapeType:o,elementProps:f});return s?n.createElement(P.m,{className:void 0===c?"recharts-active-shape":c},e):e}function N(t,e){return null!=e&&"trapezoids"in t.props}function D(t,e){return null!=e&&"sectors"in t.props}function I(t,e){return null!=e&&"points"in t.props}function L(t,e){var r,n,o=t.x===(null==e||null===(r=e.labelViewBox)||void 0===r?void 0:r.x)||t.x===e.x,i=t.y===(null==e||null===(n=e.labelViewBox)||void 0===n?void 0:n.y)||t.y===e.y;return o&&i}function B(t,e){var r=t.endAngle===e.endAngle,n=t.startAngle===e.startAngle;return r&&n}function R(t,e){var r=t.x===e.x,n=t.y===e.y,o=t.z===e.z;return r&&n&&o}function z(t){var e,r,n,o=t.activeTooltipItem,i=t.graphicalItem,a=t.itemData,u=(N(i,o)?e="trapezoids":D(i,o)?e="sectors":I(i,o)&&(e="points"),e),c=N(i,o)?null===(r=o.tooltipPayload)||void 0===r||null===(r=r[0])||void 0===r||null===(r=r.payload)||void 0===r?void 0:r.payload:D(i,o)?null===(n=o.tooltipPayload)||void 0===n||null===(n=n[0])||void 0===n||null===(n=n.payload)||void 0===n?void 0:n.payload:I(i,o)?o.payload:{},l=a.filter(function(t,e){var r=f()(c,t),n=i.props[u].filter(function(t){var e;return(N(i,o)?e=L:D(i,o)?e=B:I(i,o)&&(e=R),e)(t,o)}),a=i.props[u].indexOf(n[n.length-1]);return r&&e===a});return a.indexOf(l[l.length-1])}},25311:function(t,e,r){"use strict";r.d(e,{Ky:function(){return w},O1:function(){return b},_b:function(){return g},t9:function(){return m},xE:function(){return O}});var n=r(41443),o=r.n(n),i=r(32242),a=r.n(i),u=r(85355),c=r(82944),l=r(16630),s=r(31699);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){for(var r=0;r0&&(A=Math.min((t||0)-(M[e-1]||0),A))}),Number.isFinite(A)){var T=A/k,_="vertical"===g.layout?r.height:r.width;if("gap"===g.padding&&(c=T*_/2),"no-gap"===g.padding){var C=(0,l.h1)(t.barCategoryGap,T*_),N=T*_/2;c=N-C-(N-C)/_*C}}}s="xAxis"===n?[r.left+(j.left||0)+(c||0),r.left+r.width-(j.right||0)-(c||0)]:"yAxis"===n?"horizontal"===f?[r.top+r.height-(j.bottom||0),r.top+(j.top||0)]:[r.top+(j.top||0)+(c||0),r.top+r.height-(j.bottom||0)-(c||0)]:g.range,P&&(s=[s[1],s[0]]);var D=(0,u.Hq)(g,o,m),I=D.scale,L=D.realScaleType;I.domain(w).range(s),(0,u.zF)(I);var B=(0,u.g$)(I,d(d({},g),{},{realScaleType:L}));"xAxis"===n?(b="top"===x&&!S||"bottom"===x&&S,p=r.left,h=v[E]-b*g.height):"yAxis"===n&&(b="left"===x&&!S||"right"===x&&S,p=v[E]-b*g.width,h=r.top);var R=d(d(d({},g),B),{},{realScaleType:L,x:p,y:h,scale:I,width:"xAxis"===n?r.width:g.width,height:"yAxis"===n?r.height:g.height});return R.bandSize=(0,u.zT)(R,B),g.hide||"xAxis"!==n?g.hide||(v[E]+=(b?-1:1)*R.width):v[E]+=(b?-1:1)*R.height,d(d({},i),{},y({},a,R))},{})},b=function(t,e){var r=t.x,n=t.y,o=e.x,i=e.y;return{x:Math.min(r,o),y:Math.min(n,i),width:Math.abs(o-r),height:Math.abs(i-n)}},g=function(t){return b({x:t.x1,y:t.y1},{x:t.x2,y:t.y2})},x=function(){var t,e;function r(t){!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,r),this.scale=t}return t=[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.bandAware,n=e.position;if(void 0!==t){if(n)switch(n){case"start":default:return this.scale(t);case"middle":var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+o;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(t)+i}if(r){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+a}return this.scale(t)}}},{key:"isInRange",value:function(t){var e=this.range(),r=e[0],n=e[e.length-1];return r<=n?t>=r&&t<=n:t>=n&&t<=r}}],e=[{key:"create",value:function(t){return new r(t)}}],t&&p(r.prototype,t),e&&p(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}();y(x,"EPS",1e-4);var w=function(t){var e=Object.keys(t).reduce(function(e,r){return d(d({},e),{},y({},r,x.create(t[r])))},{});return d(d({},e),{},{apply:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.bandAware,i=r.position;return o()(t,function(t,r){return e[r].apply(t,{bandAware:n,position:i})})},isInRange:function(t){return a()(t,function(t,r){return e[r].isInRange(t)})}})},O=function(t){var e=t.width,r=t.height,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=(n%180+180)%180*Math.PI/180,i=Math.atan(r/e);return Math.abs(o>i&&otx(e,t()).base(e.base()),tj.o.apply(e,arguments),e}},scaleOrdinal:function(){return tX.Z},scalePoint:function(){return f.x},scalePow:function(){return tJ},scaleQuantile:function(){return function t(){var e,r=[],n=[],o=[];function i(){var t=0,e=Math.max(1,n.length);for(o=Array(e-1);++t=1)return+r(t[n-1],n-1,t);var n,o=(n-1)*e,i=Math.floor(o),a=+r(t[i],i,t);return a+(+r(t[i+1],i+1,t)-a)*(o-i)}}(r,t/e);return a}function a(t){return null==t||isNaN(t=+t)?e:n[P(o,t)]}return a.invertExtent=function(t){var e=n.indexOf(t);return e<0?[NaN,NaN]:[e>0?o[e-1]:r[0],e=o?[i[o-1],n]:[i[e-1],i[e]]},u.unknown=function(t){return arguments.length&&(e=t),u},u.thresholds=function(){return i.slice()},u.copy=function(){return t().domain([r,n]).range(a).unknown(e)},tj.o.apply(tI(u),arguments)}},scaleRadial:function(){return function t(){var e,r=tO(),n=[0,1],o=!1;function i(t){var n,i=Math.sign(n=r(t))*Math.sqrt(Math.abs(n));return isNaN(i)?e:o?Math.round(i):i}return i.invert=function(t){return r.invert(t1(t))},i.domain=function(t){return arguments.length?(r.domain(t),i):r.domain()},i.range=function(t){return arguments.length?(r.range((n=Array.from(t,td)).map(t1)),i):n.slice()},i.rangeRound=function(t){return i.range(t).round(!0)},i.round=function(t){return arguments.length?(o=!!t,i):o},i.clamp=function(t){return arguments.length?(r.clamp(t),i):r.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t(r.domain(),n).round(o).clamp(r.clamp()).unknown(e)},tj.o.apply(i,arguments),tI(i)}},scaleSequential:function(){return function t(){var e=tI(rX()(tv));return e.copy=function(){return rG(e,t())},tj.O.apply(e,arguments)}},scaleSequentialLog:function(){return function t(){var e=tZ(rX()).domain([1,10]);return e.copy=function(){return rG(e,t()).base(e.base())},tj.O.apply(e,arguments)}},scaleSequentialPow:function(){return rV},scaleSequentialQuantile:function(){return function t(){var e=[],r=tv;function n(t){if(null!=t&&!isNaN(t=+t))return r((P(e,t,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();for(let r of(e=[],t))null==r||isNaN(r=+r)||e.push(r);return e.sort(g),n},n.interpolator=function(t){return arguments.length?(r=t,n):r},n.range=function(){return e.map((t,n)=>r(n/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(r,n)=>(function(t,e,r){if(!(!(n=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let r=-1;for(let n of t)null!=(n=e(n,++r,t))&&(n=+n)>=n&&(yield n)}}(t,void 0))).length)||isNaN(e=+e))){if(e<=0||n<2)return t5(t);if(e>=1)return t2(t);var n,o=(n-1)*e,i=Math.floor(o),a=t2((function t(e,r,n=0,o=1/0,i){if(r=Math.floor(r),n=Math.floor(Math.max(0,n)),o=Math.floor(Math.min(e.length-1,o)),!(n<=r&&r<=o))return e;for(i=void 0===i?t6:function(t=g){if(t===g)return t6;if("function"!=typeof t)throw TypeError("compare is not a function");return(e,r)=>{let n=t(e,r);return n||0===n?n:(0===t(r,r))-(0===t(e,e))}}(i);o>n;){if(o-n>600){let a=o-n+1,u=r-n+1,c=Math.log(a),l=.5*Math.exp(2*c/3),s=.5*Math.sqrt(c*l*(a-l)/a)*(u-a/2<0?-1:1),f=Math.max(n,Math.floor(r-u*l/a+s)),p=Math.min(o,Math.floor(r+(a-u)*l/a+s));t(e,r,f,p,i)}let a=e[r],u=n,c=o;for(t3(e,n,r),i(e[o],a)>0&&t3(e,n,o);ui(e[u],a);)++u;for(;i(e[c],a)>0;)--c}0===i(e[n],a)?t3(e,n,c):t3(e,++c,o),c<=r&&(n=c+1),r<=c&&(o=c-1)}return e})(t,i).subarray(0,i+1));return a+(t5(t.subarray(i+1))-a)*(o-i)}})(e,n/t))},n.copy=function(){return t(r).domain(e)},tj.O.apply(n,arguments)}},scaleSequentialSqrt:function(){return rK},scaleSequentialSymlog:function(){return function t(){var e=tH(rX());return e.copy=function(){return rG(e,t()).constant(e.constant())},tj.O.apply(e,arguments)}},scaleSqrt:function(){return t0},scaleSymlog:function(){return function t(){var e=tH(tw());return e.copy=function(){return tx(e,t()).constant(e.constant())},tj.o.apply(e,arguments)}},scaleThreshold:function(){return function t(){var e,r=[.5],n=[0,1],o=1;function i(t){return null!=t&&t<=t?n[P(r,t,0,o)]:e}return i.domain=function(t){return arguments.length?(o=Math.min((r=Array.from(t)).length,n.length-1),i):r.slice()},i.range=function(t){return arguments.length?(n=Array.from(t),o=Math.min(r.length,n.length-1),i):n.slice()},i.invertExtent=function(t){var e=n.indexOf(t);return[r[e-1],r[e]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t().domain(r).range(n).unknown(e)},tj.o.apply(i,arguments)}},scaleTime:function(){return rY},scaleUtc:function(){return rH},tickFormat:function(){return tD}});var f=r(55284);let p=Math.sqrt(50),h=Math.sqrt(10),d=Math.sqrt(2);function y(t,e,r){let n,o,i;let a=(e-t)/Math.max(0,r),u=Math.floor(Math.log10(a)),c=a/Math.pow(10,u),l=c>=p?10:c>=h?5:c>=d?2:1;return(u<0?(n=Math.round(t*(i=Math.pow(10,-u)/l)),o=Math.round(e*i),n/ie&&--o,i=-i):(n=Math.round(t/(i=Math.pow(10,u)*l)),o=Math.round(e/i),n*ie&&--o),o0))return[];if(t===e)return[t];let n=e=o))return[];let u=i-o+1,c=Array(u);if(n){if(a<0)for(let t=0;te?1:t>=e?0:NaN}function x(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function w(t){let e,r,n;function o(t,n,o=0,i=t.length){if(o>>1;0>r(t[e],n)?o=e+1:i=e}while(og(t(e),r),n=(e,r)=>t(e)-r):(e=t===g||t===x?t:O,r=t,n=t),{left:o,center:function(t,e,r=0,i=t.length){let a=o(t,e,r,i-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,o=0,i=t.length){if(o>>1;0>=r(t[e],n)?o=e+1:i=e}while(o>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Z(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Z(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=N.exec(t))?new Y(e[1],e[2],e[3],1):(e=D.exec(t))?new Y(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=I.exec(t))?Z(e[1],e[2],e[3],e[4]):(e=L.exec(t))?Z(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=B.exec(t))?Q(e[1],e[2]/100,e[3]/100,1):(e=R.exec(t))?Q(e[1],e[2]/100,e[3]/100,e[4]):z.hasOwnProperty(t)?q(z[t]):"transparent"===t?new Y(NaN,NaN,NaN,0):null}function q(t){return new Y(t>>16&255,t>>8&255,255&t,1)}function Z(t,e,r,n){return n<=0&&(t=e=r=NaN),new Y(t,e,r,n)}function W(t,e,r,n){var o;return 1==arguments.length?((o=t)instanceof A||(o=F(o)),o)?new Y((o=o.rgb()).r,o.g,o.b,o.opacity):new Y:new Y(t,e,r,null==n?1:n)}function Y(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function H(){return`#${K(this.r)}${K(this.g)}${K(this.b)}`}function X(){let t=G(this.opacity);return`${1===t?"rgb(":"rgba("}${V(this.r)}, ${V(this.g)}, ${V(this.b)}${1===t?")":`, ${t})`}`}function G(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function V(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function K(t){return((t=V(t))<16?"0":"")+t.toString(16)}function Q(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new tt(t,e,r,n)}function J(t){if(t instanceof tt)return new tt(t.h,t.s,t.l,t.opacity);if(t instanceof A||(t=F(t)),!t)return new tt;if(t instanceof tt)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=NaN,u=i-o,c=(i+o)/2;return u?(a=e===i?(r-n)/u+(r0&&c<1?0:a,new tt(a,u,c,t.opacity)}function tt(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function te(t){return(t=(t||0)%360)<0?t+360:t}function tr(t){return Math.max(0,Math.min(1,t||0))}function tn(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}function to(t,e,r,n,o){var i=t*t,a=i*t;return((1-3*t+3*i-a)*e+(4-6*i+3*a)*r+(1+3*t+3*i-3*a)*n+a*o)/6}E(A,F,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:U,formatHex:U,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return J(this).formatHsl()},formatRgb:$,toString:$}),E(Y,W,k(A,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new Y(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Y(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Y(V(this.r),V(this.g),V(this.b),G(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:H,formatHex:H,formatHex8:function(){return`#${K(this.r)}${K(this.g)}${K(this.b)}${K((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:X,toString:X})),E(tt,function(t,e,r,n){return 1==arguments.length?J(t):new tt(t,e,r,null==n?1:n)},k(A,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new tt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new tt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,o=2*r-n;return new Y(tn(t>=240?t-240:t+120,o,n),tn(t,o,n),tn(t<120?t+240:t-120,o,n),this.opacity)},clamp(){return new tt(te(this.h),tr(this.s),tr(this.l),G(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=G(this.opacity);return`${1===t?"hsl(":"hsla("}${te(this.h)}, ${100*tr(this.s)}%, ${100*tr(this.l)}%${1===t?")":`, ${t})`}`}}));var ti=t=>()=>t;function ta(t,e){var r=e-t;return r?function(e){return t+e*r}:ti(isNaN(t)?e:t)}var tu=function t(e){var r,n=1==(r=+(r=e))?ta:function(t,e){var n,o,i;return e-t?(n=t,o=e,n=Math.pow(n,i=r),o=Math.pow(o,i)-n,i=1/i,function(t){return Math.pow(n+t*o,i)}):ti(isNaN(t)?e:t)};function o(t,e){var r=n((t=W(t)).r,(e=W(e)).r),o=n(t.g,e.g),i=n(t.b,e.b),a=ta(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=o(e),t.b=i(e),t.opacity=a(e),t+""}}return o.gamma=t,o}(1);function tc(t){return function(e){var r,n,o=e.length,i=Array(o),a=Array(o),u=Array(o);for(r=0;r=1?(r=1,e-1):Math.floor(r*e),o=t[n],i=t[n+1],a=n>0?t[n-1]:2*o-i,u=nu&&(a=e.slice(u,a),l[c]?l[c]+=a:l[++c]=a),(o=o[0])===(i=i[0])?l[c]?l[c]+=i:l[++c]=i:(l[++c]=null,s.push({i:c,x:tl(o,i)})),u=tf.lastIndex;return ue&&(r=t,t=e,e=r),l=function(r){return Math.max(t,Math.min(e,r))}),n=c>2?tg:tb,o=i=null,f}function f(e){return null==e||isNaN(e=+e)?r:(o||(o=n(a.map(t),u,c)))(t(l(e)))}return f.invert=function(r){return l(e((i||(i=n(u,a.map(t),tl)))(r)))},f.domain=function(t){return arguments.length?(a=Array.from(t,td),s()):a.slice()},f.range=function(t){return arguments.length?(u=Array.from(t),s()):u.slice()},f.rangeRound=function(t){return u=Array.from(t),c=th,s()},f.clamp=function(t){return arguments.length?(l=!!t||tv,s()):l!==tv},f.interpolate=function(t){return arguments.length?(c=t,s()):c},f.unknown=function(t){return arguments.length?(r=t,f):r},function(r,n){return t=r,e=n,s()}}function tO(){return tw()(tv,tv)}var tj=r(89999),tS=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function tP(t){var e;if(!(e=tS.exec(t)))throw Error("invalid format: "+t);return new tE({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function tE(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function tk(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function tA(t){return(t=tk(Math.abs(t)))?t[1]:NaN}function tM(t,e){var r=tk(t,e);if(!r)return t+"";var n=r[0],o=r[1];return o<0?"0."+Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+Array(o-n.length+2).join("0")}tP.prototype=tE.prototype,tE.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var tT={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>tM(100*t,e),r:tM,s:function(t,e){var r=tk(t,e);if(!r)return t+"";var o=r[0],i=r[1],a=i-(n=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=o.length;return a===u?o:a>u?o+Array(a-u+1).join("0"):a>0?o.slice(0,a)+"."+o.slice(a):"0."+Array(1-a).join("0")+tk(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function t_(t){return t}var tC=Array.prototype.map,tN=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"];function tD(t,e,r,n){var o,u,c=b(t,e,r);switch((n=tP(null==n?",f":n)).type){case"s":var l=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(u=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(tA(l)/3)))-tA(Math.abs(c))))||(n.precision=u),a(n,l);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(u=Math.max(0,tA(Math.abs(Math.max(Math.abs(t),Math.abs(e)))-(o=Math.abs(o=c)))-tA(o))+1)||(n.precision=u-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(u=Math.max(0,-tA(Math.abs(c))))||(n.precision=u-("%"===n.type)*2)}return i(n)}function tI(t){var e=t.domain;return t.ticks=function(t){var r=e();return v(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return tD(n[0],n[n.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var n,o,i=e(),a=0,u=i.length-1,c=i[a],l=i[u],s=10;for(l0;){if((o=m(c,l,r))===n)return i[a]=c,i[u]=l,e(i);if(o>0)c=Math.floor(c/o)*o,l=Math.ceil(l/o)*o;else if(o<0)c=Math.ceil(c*o)/o,l=Math.floor(l*o)/o;else break;n=o}return t},t}function tL(){var t=tO();return t.copy=function(){return tx(t,tL())},tj.o.apply(t,arguments),tI(t)}function tB(t,e){t=t.slice();var r,n=0,o=t.length-1,i=t[n],a=t[o];return a-t(-e,r)}function tZ(t){let e,r;let n=t(tR,tz),o=n.domain,a=10;function u(){var i,u;return e=(i=a)===Math.E?Math.log:10===i&&Math.log10||2===i&&Math.log2||(i=Math.log(i),t=>Math.log(t)/i),r=10===(u=a)?tF:u===Math.E?Math.exp:t=>Math.pow(u,t),o()[0]<0?(e=tq(e),r=tq(r),t(tU,t$)):t(tR,tz),n}return n.base=function(t){return arguments.length?(a=+t,u()):a},n.domain=function(t){return arguments.length?(o(t),u()):o()},n.ticks=t=>{let n,i;let u=o(),c=u[0],l=u[u.length-1],s=l0){for(;f<=p;++f)for(n=1;nl)break;d.push(i)}}else for(;f<=p;++f)for(n=a-1;n>=1;--n)if(!((i=f>0?n/r(-f):n*r(f))l)break;d.push(i)}2*d.length{if(null==t&&(t=10),null==o&&(o=10===a?"s":","),"function"!=typeof o&&(a%1||null!=(o=tP(o)).precision||(o.trim=!0),o=i(o)),t===1/0)return o;let u=Math.max(1,a*t/n.ticks().length);return t=>{let n=t/r(Math.round(e(t)));return n*ao(tB(o(),{floor:t=>r(Math.floor(e(t))),ceil:t=>r(Math.ceil(e(t)))})),n}function tW(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function tY(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function tH(t){var e=1,r=t(tW(1),tY(e));return r.constant=function(r){return arguments.length?t(tW(e=+r),tY(e)):e},tI(r)}i=(o=function(t){var e,r,o,i=void 0===t.grouping||void 0===t.thousands?t_:(e=tC.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var o=t.length,i=[],a=0,u=e[0],c=0;o>0&&u>0&&(c+u+1>n&&(u=Math.max(1,n-c)),i.push(t.substring(o-=u,o+u)),!((c+=u+1)>n));)u=e[a=(a+1)%e.length];return i.reverse().join(r)}),a=void 0===t.currency?"":t.currency[0]+"",u=void 0===t.currency?"":t.currency[1]+"",c=void 0===t.decimal?".":t.decimal+"",l=void 0===t.numerals?t_:(o=tC.call(t.numerals,String),function(t){return t.replace(/[0-9]/g,function(t){return o[+t]})}),s=void 0===t.percent?"%":t.percent+"",f=void 0===t.minus?"−":t.minus+"",p=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=tP(t)).fill,r=t.align,o=t.sign,h=t.symbol,d=t.zero,y=t.width,v=t.comma,m=t.precision,b=t.trim,g=t.type;"n"===g?(v=!0,g="g"):tT[g]||(void 0===m&&(m=12),b=!0,g="g"),(d||"0"===e&&"="===r)&&(d=!0,e="0",r="=");var x="$"===h?a:"#"===h&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",w="$"===h?u:/[%p]/.test(g)?s:"",O=tT[g],j=/[defgprs%]/.test(g);function S(t){var a,u,s,h=x,S=w;if("c"===g)S=O(t)+S,t="";else{var P=(t=+t)<0||1/t<0;if(t=isNaN(t)?p:O(Math.abs(t),m),b&&(t=function(t){e:for(var e,r=t.length,n=1,o=-1;n0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t}(t)),P&&0==+t&&"+"!==o&&(P=!1),h=(P?"("===o?o:f:"-"===o||"("===o?"":o)+h,S=("s"===g?tN[8+n/3]:"")+S+(P&&"("===o?")":""),j){for(a=-1,u=t.length;++a(s=t.charCodeAt(a))||s>57){S=(46===s?c+t.slice(a+1):t.slice(a))+S,t=t.slice(0,a);break}}}v&&!d&&(t=i(t,1/0));var E=h.length+t.length+S.length,k=E>1)+h+t+S+k.slice(E);break;default:t=k+h+t+S}return l(t)}return m=void 0===m?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),S.toString=function(){return t+""},S}return{format:h,formatPrefix:function(t,e){var r=h(((t=tP(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(tA(e)/3))),o=Math.pow(10,-n),i=tN[8+n/3];return function(t){return r(o*t)+i}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,a=o.formatPrefix;var tX=r(36967);function tG(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function tV(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function tK(t){return t<0?-t*t:t*t}function tQ(t){var e=t(tv,tv),r=1;return e.exponent=function(e){return arguments.length?1==(r=+e)?t(tv,tv):.5===r?t(tV,tK):t(tG(r),tG(1/r)):r},tI(e)}function tJ(){var t=tQ(tw());return t.copy=function(){return tx(t,tJ()).exponent(t.exponent())},tj.o.apply(t,arguments),t}function t0(){return tJ.apply(null,arguments).exponent(.5)}function t1(t){return Math.sign(t)*t*t}function t2(t,e){let r;if(void 0===e)for(let e of t)null!=e&&(r=e)&&(r=e);else{let n=-1;for(let o of t)null!=(o=e(o,++n,t))&&(r=o)&&(r=o)}return r}function t5(t,e){let r;if(void 0===e)for(let e of t)null!=e&&(r>e||void 0===r&&e>=e)&&(r=e);else{let n=-1;for(let o of t)null!=(o=e(o,++n,t))&&(r>o||void 0===r&&o>=o)&&(r=o)}return r}function t6(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(te?1:0)}function t3(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}let t7=new Date,t8=new Date;function t4(t,e,r,n){function o(e){return t(e=0==arguments.length?new Date:new Date(+e)),e}return o.floor=e=>(t(e=new Date(+e)),e),o.ceil=r=>(t(r=new Date(r-1)),e(r,1),t(r),r),o.round=t=>{let e=o(t),r=o.ceil(t);return t-e(e(t=new Date(+t),null==r?1:Math.floor(r)),t),o.range=(r,n,i)=>{let a;let u=[];if(r=o.ceil(r),i=null==i?1:Math.floor(i),!(r0))return u;do u.push(a=new Date(+r)),e(r,i),t(r);while(at4(e=>{if(e>=e)for(;t(e),!r(e);)e.setTime(e-1)},(t,n)=>{if(t>=t){if(n<0)for(;++n<=0;)for(;e(t,-1),!r(t););else for(;--n>=0;)for(;e(t,1),!r(t););}}),r&&(o.count=(e,n)=>(t7.setTime(+e),t8.setTime(+n),t(t7),t(t8),Math.floor(r(t7,t8))),o.every=t=>isFinite(t=Math.floor(t))&&t>0?t>1?o.filter(n?e=>n(e)%t==0:e=>o.count(0,e)%t==0):o:null),o}let t9=t4(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);t9.every=t=>isFinite(t=Math.floor(t))&&t>0?t>1?t4(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):t9:null,t9.range;let et=t4(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+1e3*e)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds());et.range;let ee=t4(t=>{t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},(t,e)=>{t.setTime(+t+6e4*e)},(t,e)=>(e-t)/6e4,t=>t.getMinutes());ee.range;let er=t4(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+6e4*e)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes());er.range;let en=t4(t=>{t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())},(t,e)=>{t.setTime(+t+36e5*e)},(t,e)=>(e-t)/36e5,t=>t.getHours());en.range;let eo=t4(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+36e5*e)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours());eo.range;let ei=t4(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1);ei.range;let ea=t4(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1);ea.range;let eu=t4(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5));function ec(t){return t4(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+7*e)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}eu.range;let el=ec(0),es=ec(1),ef=ec(2),ep=ec(3),eh=ec(4),ed=ec(5),ey=ec(6);function ev(t){return t4(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)},(t,e)=>(e-t)/6048e5)}el.range,es.range,ef.range,ep.range,eh.range,ed.range,ey.range;let em=ev(0),eb=ev(1),eg=ev(2),ex=ev(3),ew=ev(4),eO=ev(5),ej=ev(6);em.range,eb.range,eg.range,ex.range,ew.range,eO.range,ej.range;let eS=t4(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());eS.range;let eP=t4(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());eP.range;let eE=t4(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());eE.every=t=>isFinite(t=Math.floor(t))&&t>0?t4(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)}):null,eE.range;let ek=t4(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());function eA(t,e,r,n,o,i){let a=[[et,1,1e3],[et,5,5e3],[et,15,15e3],[et,30,3e4],[i,1,6e4],[i,5,3e5],[i,15,9e5],[i,30,18e5],[o,1,36e5],[o,3,108e5],[o,6,216e5],[o,12,432e5],[n,1,864e5],[n,2,1728e5],[r,1,6048e5],[e,1,2592e6],[e,3,7776e6],[t,1,31536e6]];function u(e,r,n){let o=Math.abs(r-e)/n,i=w(([,,t])=>t).right(a,o);if(i===a.length)return t.every(b(e/31536e6,r/31536e6,n));if(0===i)return t9.every(Math.max(b(e,r,n),1));let[u,c]=a[o/a[i-1][2]isFinite(t=Math.floor(t))&&t>0?t4(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)}):null,ek.range;let[eM,eT]=eA(ek,eP,em,eu,eo,er),[e_,eC]=eA(eE,eS,el,ei,en,ee);function eN(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function eD(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function eI(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}var eL={"-":"",_:" ",0:"0"},eB=/^\s*\d+/,eR=/^%/,ez=/[\\^$*+?|[\]().{}]/g;function eU(t,e,r){var n=t<0?"-":"",o=(n?-t:t)+"",i=o.length;return n+(i[t.toLowerCase(),e]))}function eZ(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function eW(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function eY(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function eH(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function eX(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function eG(t,e,r){var n=eB.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function eV(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function eK(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function eQ(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function eJ(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function e0(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function e1(t,e,r){var n=eB.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function e2(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function e5(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function e6(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function e3(t,e,r){var n=eB.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function e7(t,e,r){var n=eB.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function e8(t,e,r){var n=eR.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function e4(t,e,r){var n=eB.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function e9(t,e,r){var n=eB.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function rt(t,e){return eU(t.getDate(),e,2)}function re(t,e){return eU(t.getHours(),e,2)}function rr(t,e){return eU(t.getHours()%12||12,e,2)}function rn(t,e){return eU(1+ei.count(eE(t),t),e,3)}function ro(t,e){return eU(t.getMilliseconds(),e,3)}function ri(t,e){return ro(t,e)+"000"}function ra(t,e){return eU(t.getMonth()+1,e,2)}function ru(t,e){return eU(t.getMinutes(),e,2)}function rc(t,e){return eU(t.getSeconds(),e,2)}function rl(t){var e=t.getDay();return 0===e?7:e}function rs(t,e){return eU(el.count(eE(t)-1,t),e,2)}function rf(t){var e=t.getDay();return e>=4||0===e?eh(t):eh.ceil(t)}function rp(t,e){return t=rf(t),eU(eh.count(eE(t),t)+(4===eE(t).getDay()),e,2)}function rh(t){return t.getDay()}function rd(t,e){return eU(es.count(eE(t)-1,t),e,2)}function ry(t,e){return eU(t.getFullYear()%100,e,2)}function rv(t,e){return eU((t=rf(t)).getFullYear()%100,e,2)}function rm(t,e){return eU(t.getFullYear()%1e4,e,4)}function rb(t,e){var r=t.getDay();return eU((t=r>=4||0===r?eh(t):eh.ceil(t)).getFullYear()%1e4,e,4)}function rg(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+eU(e/60|0,"0",2)+eU(e%60,"0",2)}function rx(t,e){return eU(t.getUTCDate(),e,2)}function rw(t,e){return eU(t.getUTCHours(),e,2)}function rO(t,e){return eU(t.getUTCHours()%12||12,e,2)}function rj(t,e){return eU(1+ea.count(ek(t),t),e,3)}function rS(t,e){return eU(t.getUTCMilliseconds(),e,3)}function rP(t,e){return rS(t,e)+"000"}function rE(t,e){return eU(t.getUTCMonth()+1,e,2)}function rk(t,e){return eU(t.getUTCMinutes(),e,2)}function rA(t,e){return eU(t.getUTCSeconds(),e,2)}function rM(t){var e=t.getUTCDay();return 0===e?7:e}function rT(t,e){return eU(em.count(ek(t)-1,t),e,2)}function r_(t){var e=t.getUTCDay();return e>=4||0===e?ew(t):ew.ceil(t)}function rC(t,e){return t=r_(t),eU(ew.count(ek(t),t)+(4===ek(t).getUTCDay()),e,2)}function rN(t){return t.getUTCDay()}function rD(t,e){return eU(eb.count(ek(t)-1,t),e,2)}function rI(t,e){return eU(t.getUTCFullYear()%100,e,2)}function rL(t,e){return eU((t=r_(t)).getUTCFullYear()%100,e,2)}function rB(t,e){return eU(t.getUTCFullYear()%1e4,e,4)}function rR(t,e){var r=t.getUTCDay();return eU((t=r>=4||0===r?ew(t):ew.ceil(t)).getUTCFullYear()%1e4,e,4)}function rz(){return"+0000"}function rU(){return"%"}function r$(t){return+t}function rF(t){return Math.floor(+t/1e3)}function rq(t){return new Date(t)}function rZ(t){return t instanceof Date?+t:+new Date(+t)}function rW(t,e,r,n,o,i,a,u,c,l){var s=tO(),f=s.invert,p=s.domain,h=l(".%L"),d=l(":%S"),y=l("%I:%M"),v=l("%I %p"),m=l("%a %d"),b=l("%b %d"),g=l("%B"),x=l("%Y");function w(t){return(c(t)1)for(var r,n,o,i=1,a=t[e[0]],u=a.length;i=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:r$,s:rF,S:rc,u:rl,U:rs,V:rp,w:rh,W:rd,x:null,X:null,y:ry,Y:rm,Z:rg,"%":rU},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return i[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:rx,e:rx,f:rP,g:rL,G:rR,H:rw,I:rO,j:rj,L:rS,m:rE,M:rk,p:function(t){return o[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:r$,s:rF,S:rA,u:rM,U:rT,V:rC,w:rN,W:rD,x:null,X:null,y:rI,Y:rB,Z:rz,"%":rU},w={a:function(t,e,r){var n=h.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){var n=f.exec(e.slice(r));return n?(t.w=p.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){var n=m.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){var n=y.exec(e.slice(r));return n?(t.m=v.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,r,n){return S(t,e,r,n)},d:e0,e:e0,f:e7,g:eV,G:eG,H:e2,I:e2,j:e1,L:e3,m:eJ,M:e5,p:function(t,e,r){var n=l.exec(e.slice(r));return n?(t.p=s.get(n[0].toLowerCase()),r+n[0].length):-1},q:eQ,Q:e4,s:e9,S:e6,u:eW,U:eY,V:eH,w:eZ,W:eX,x:function(t,e,n){return S(t,r,e,n)},X:function(t,e,r){return S(t,n,e,r)},y:eV,Y:eG,Z:eK,"%":e8};function O(t,e){return function(r){var n,o,i,a=[],u=-1,c=0,l=t.length;for(r instanceof Date||(r=new Date(+r));++u53)return null;"w"in i||(i.w=1),"Z"in i?(n=(o=(n=eD(eI(i.y,0,1))).getUTCDay())>4||0===o?eb.ceil(n):eb(n),n=ea.offset(n,(i.V-1)*7),i.y=n.getUTCFullYear(),i.m=n.getUTCMonth(),i.d=n.getUTCDate()+(i.w+6)%7):(n=(o=(n=eN(eI(i.y,0,1))).getDay())>4||0===o?es.ceil(n):es(n),n=ei.offset(n,(i.V-1)*7),i.y=n.getFullYear(),i.m=n.getMonth(),i.d=n.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),o="Z"in i?eD(eI(i.y,0,1)).getUTCDay():eN(eI(i.y,0,1)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(o+5)%7:i.w+7*i.U-(o+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,eD(i)):eN(i)}}function S(t,e,r,n){for(var o,i,a=0,u=e.length,c=r.length;a=c)return -1;if(37===(o=e.charCodeAt(a++))){if(!(i=w[(o=e.charAt(a++))in eL?e.charAt(a++):o])||(n=i(t,r,n))<0)return -1}else if(o!=r.charCodeAt(n++))return -1}return n}return g.x=O(r,g),g.X=O(n,g),g.c=O(e,g),x.x=O(r,x),x.X=O(n,x),x.c=O(e,x),{format:function(t){var e=O(t+="",g);return e.toString=function(){return t},e},parse:function(t){var e=j(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=O(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=j(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,u.parse,l=u.utcFormat,u.utcParse;var r2=r(22516),r5=r(76115);function r6(t){for(var e=t.length,r=Array(e);--e>=0;)r[e]=e;return r}function r3(t,e){return t[e]}function r7(t){let e=[];return e.key=t,e}var r8=r(95645),r4=r.n(r8),r9=r(99008),nt=r.n(r9),ne=r(77571),nr=r.n(ne),nn=r(86757),no=r.n(nn),ni=r(42715),na=r.n(ni),nu=r(13735),nc=r.n(nu),nl=r(11314),ns=r.n(nl),nf=r(82559),np=r.n(nf),nh=r(75551),nd=r.n(nh),ny=r(21652),nv=r.n(ny),nm=r(34935),nb=r.n(nm),ng=r(61134),nx=r.n(ng);function nw(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=e?r.apply(void 0,o):t(e-a,nP(function(){for(var t=arguments.length,e=Array(t),n=0;nt.length)&&(e=t.length);for(var r=0,n=Array(e);rn&&(o=n,i=r),[o,i]}function nR(t,e,r){if(t.lte(0))return new(nx())(0);var n=nC.getDigitCount(t.toNumber()),o=new(nx())(10).pow(n),i=t.div(o),a=1!==n?.05:.1,u=new(nx())(Math.ceil(i.div(a).toNumber())).add(r).mul(a).mul(o);return e?u:new(nx())(Math.ceil(u))}function nz(t,e,r){var n=1,o=new(nx())(t);if(!o.isint()&&r){var i=Math.abs(t);i<1?(n=new(nx())(10).pow(nC.getDigitCount(t)-1),o=new(nx())(Math.floor(o.div(n).toNumber())).mul(n)):i>1&&(o=new(nx())(Math.floor(t)))}else 0===t?o=new(nx())(Math.floor((e-1)/2)):r||(o=new(nx())(Math.floor(t)));var a=Math.floor((e-1)/2);return nM(nA(function(t){return o.add(new(nx())(t-a).mul(n)).toNumber()}),nk)(0,e)}var nU=n_(function(t){var e=nD(t,2),r=e[0],n=e[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(o,2),u=nD(nB([r,n]),2),c=u[0],l=u[1];if(c===-1/0||l===1/0){var s=l===1/0?[c].concat(nN(nk(0,o-1).map(function(){return 1/0}))):[].concat(nN(nk(0,o-1).map(function(){return-1/0})),[l]);return r>n?nT(s):s}if(c===l)return nz(c,o,i);var f=function t(e,r,n,o){var i,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((r-e)/(n-1)))return{step:new(nx())(0),tickMin:new(nx())(0),tickMax:new(nx())(0)};var u=nR(new(nx())(r).sub(e).div(n-1),o,a),c=Math.ceil((i=e<=0&&r>=0?new(nx())(0):(i=new(nx())(e).add(r).div(2)).sub(new(nx())(i).mod(u))).sub(e).div(u).toNumber()),l=Math.ceil(new(nx())(r).sub(i).div(u).toNumber()),s=c+l+1;return s>n?t(e,r,n,o,a+1):(s0?l+(n-s):l,c=r>0?c:c+(n-s)),{step:u,tickMin:i.sub(new(nx())(c).mul(u)),tickMax:i.add(new(nx())(l).mul(u))})}(c,l,a,i),p=f.step,h=f.tickMin,d=f.tickMax,y=nC.rangeStep(h,d.add(new(nx())(.1).mul(p)),p);return r>n?nT(y):y});n_(function(t){var e=nD(t,2),r=e[0],n=e[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(o,2),u=nD(nB([r,n]),2),c=u[0],l=u[1];if(c===-1/0||l===1/0)return[r,n];if(c===l)return nz(c,o,i);var s=nR(new(nx())(l).sub(c).div(a-1),i,0),f=nM(nA(function(t){return new(nx())(c).add(new(nx())(t).mul(s)).toNumber()}),nk)(0,a).filter(function(t){return t>=c&&t<=l});return r>n?nT(f):f});var n$=n_(function(t,e){var r=nD(t,2),n=r[0],o=r[1],i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=nD(nB([n,o]),2),u=a[0],c=a[1];if(u===-1/0||c===1/0)return[n,o];if(u===c)return[u];var l=nR(new(nx())(c).sub(u).div(Math.max(e,2)-1),i,0),s=[].concat(nN(nC.rangeStep(new(nx())(u),new(nx())(c).sub(new(nx())(.99).mul(l)),l)),[c]);return n>o?nT(s):s}),nF=r(13137),nq=r(16630),nZ=r(82944),nW=r(38569);function nY(t){return(nY="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function nH(t){return function(t){if(Array.isArray(t))return nX(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return nX(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nX(t,void 0)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nX(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,i=-1,a=null!==(e=null==r?void 0:r.length)&&void 0!==e?e:0;if(a<=1)return 0;if(o&&"angleAxis"===o.axisType&&1e-6>=Math.abs(Math.abs(o.range[1]-o.range[0])-360))for(var u=o.range,c=0;c0?n[c-1].coordinate:n[a-1].coordinate,s=n[c].coordinate,f=c>=a-1?n[0].coordinate:n[c+1].coordinate,p=void 0;if((0,nq.uY)(s-l)!==(0,nq.uY)(f-s)){var h=[];if((0,nq.uY)(f-s)===(0,nq.uY)(u[1]-u[0])){p=f;var d=s+u[1]-u[0];h[0]=Math.min(d,(d+l)/2),h[1]=Math.max(d,(d+l)/2)}else{p=l;var y=f+u[1]-u[0];h[0]=Math.min(s,(y+s)/2),h[1]=Math.max(s,(y+s)/2)}var v=[Math.min(s,(p+s)/2),Math.max(s,(p+s)/2)];if(t>v[0]&&t<=v[1]||t>=h[0]&&t<=h[1]){i=n[c].index;break}}else{var m=Math.min(l,f),b=Math.max(l,f);if(t>(m+s)/2&&t<=(b+s)/2){i=n[c].index;break}}}else for(var g=0;g0&&g(r[g].coordinate+r[g-1].coordinate)/2&&t<=(r[g].coordinate+r[g+1].coordinate)/2||g===a-1&&t>(r[g].coordinate+r[g-1].coordinate)/2){i=r[g].index;break}return i},n1=function(t){var e,r,n=t.type.displayName,o=null!==(e=t.type)&&void 0!==e&&e.defaultProps?nV(nV({},t.type.defaultProps),t.props):t.props,i=o.stroke,a=o.fill;switch(n){case"Line":r=i;break;case"Area":case"Radar":r=i&&"none"!==i?i:a;break;default:r=a}return r},n2=function(t){var e=t.barSize,r=t.totalSize,n=t.stackGroups,o=void 0===n?{}:n;if(!o)return{};for(var i={},a=Object.keys(o),u=0,c=a.length;u=0});if(v&&v.length){var m=v[0].type.defaultProps,b=void 0!==m?nV(nV({},m),v[0].props):v[0].props,g=b.barSize,x=b[y];i[x]||(i[x]=[]);var w=nr()(g)?e:g;i[x].push({item:v[0],stackList:v.slice(1),barSize:nr()(w)?void 0:(0,nq.h1)(w,r,0)})}}return i},n5=function(t){var e,r=t.barGap,n=t.barCategoryGap,o=t.bandSize,i=t.sizeList,a=void 0===i?[]:i,u=t.maxBarSize,c=a.length;if(c<1)return null;var l=(0,nq.h1)(r,o,0,!0),s=[];if(a[0].barSize===+a[0].barSize){var f=!1,p=o/c,h=a.reduce(function(t,e){return t+e.barSize||0},0);(h+=(c-1)*l)>=o&&(h-=(c-1)*l,l=0),h>=o&&p>0&&(f=!0,p*=.9,h=c*p);var d={offset:((o-h)/2>>0)-l,size:0};e=a.reduce(function(t,e){var r={item:e.item,position:{offset:d.offset+d.size+l,size:f?p:e.barSize}},n=[].concat(nH(t),[r]);return d=n[n.length-1].position,e.stackList&&e.stackList.length&&e.stackList.forEach(function(t){n.push({item:t,position:d})}),n},s)}else{var y=(0,nq.h1)(n,o,0,!0);o-2*y-(c-1)*l<=0&&(l=0);var v=(o-2*y-(c-1)*l)/c;v>1&&(v>>=0);var m=u===+u?Math.min(v,u):v;e=a.reduce(function(t,e,r){var n=[].concat(nH(t),[{item:e.item,position:{offset:y+(v+l)*r+(v-m)/2,size:m}}]);return e.stackList&&e.stackList.length&&e.stackList.forEach(function(t){n.push({item:t,position:n[n.length-1].position})}),n},s)}return e},n6=function(t,e,r,n){var o=r.children,i=r.width,a=r.margin,u=i-(a.left||0)-(a.right||0),c=(0,nW.z)({children:o,legendWidth:u});if(c){var l=n||{},s=l.width,f=l.height,p=c.align,h=c.verticalAlign,d=c.layout;if(("vertical"===d||"horizontal"===d&&"middle"===h)&&"center"!==p&&(0,nq.hj)(t[p]))return nV(nV({},t),{},nK({},p,t[p]+(s||0)));if(("horizontal"===d||"vertical"===d&&"center"===p)&&"middle"!==h&&(0,nq.hj)(t[h]))return nV(nV({},t),{},nK({},h,t[h]+(f||0)))}return t},n3=function(t,e,r,n,o){var i=e.props.children,a=(0,nZ.NN)(i,nF.W).filter(function(t){var e;return e=t.props.direction,!!nr()(o)||("horizontal"===n?"yAxis"===o:"vertical"===n||"x"===e?"xAxis"===o:"y"!==e||"yAxis"===o)});if(a&&a.length){var u=a.map(function(t){return t.props.dataKey});return t.reduce(function(t,e){var n=nQ(e,r);if(nr()(n))return t;var o=Array.isArray(n)?[nt()(n),r4()(n)]:[n,n],i=u.reduce(function(t,r){var n=nQ(e,r,0),i=o[0]-Math.abs(Array.isArray(n)?n[0]:n),a=o[1]+Math.abs(Array.isArray(n)?n[1]:n);return[Math.min(i,t[0]),Math.max(a,t[1])]},[1/0,-1/0]);return[Math.min(i[0],t[0]),Math.max(i[1],t[1])]},[1/0,-1/0])}return null},n7=function(t,e,r,n,o){var i=e.map(function(e){return n3(t,e,r,o,n)}).filter(function(t){return!nr()(t)});return i&&i.length?i.reduce(function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]},[1/0,-1/0]):null},n8=function(t,e,r,n,o){var i=e.map(function(e){var i=e.props.dataKey;return"number"===r&&i&&n3(t,e,i,n)||nJ(t,i,r,o)});if("number"===r)return i.reduce(function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]},[1/0,-1/0]);var a={};return i.reduce(function(t,e){for(var r=0,n=e.length;r=2?2*(0,nq.uY)(a[0]-a[1])*c:c,e&&(t.ticks||t.niceTicks))?(t.ticks||t.niceTicks).map(function(t){return{coordinate:n(o?o.indexOf(t):t)+c,value:t,offset:c}}).filter(function(t){return!np()(t.coordinate)}):t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(t,e){return{coordinate:n(t)+c,value:t,index:e,offset:c}}):n.ticks&&!r?n.ticks(t.tickCount).map(function(t){return{coordinate:n(t)+c,value:t,offset:c}}):n.domain().map(function(t,e){return{coordinate:n(t)+c,value:o?o[t]:t,index:e,offset:c}})},oe=new WeakMap,or=function(t,e){if("function"!=typeof e)return t;oe.has(t)||oe.set(t,new WeakMap);var r=oe.get(t);if(r.has(e))return r.get(e);var n=function(){t.apply(void 0,arguments),e.apply(void 0,arguments)};return r.set(e,n),n},on=function(t,e,r){var n=t.scale,o=t.type,i=t.layout,a=t.axisType;if("auto"===n)return"radial"===i&&"radiusAxis"===a?{scale:f.Z(),realScaleType:"band"}:"radial"===i&&"angleAxis"===a?{scale:tL(),realScaleType:"linear"}:"category"===o&&e&&(e.indexOf("LineChart")>=0||e.indexOf("AreaChart")>=0||e.indexOf("ComposedChart")>=0&&!r)?{scale:f.x(),realScaleType:"point"}:"category"===o?{scale:f.Z(),realScaleType:"band"}:{scale:tL(),realScaleType:"linear"};if(na()(n)){var u="scale".concat(nd()(n));return{scale:(s[u]||f.x)(),realScaleType:s[u]?u:"point"}}return no()(n)?{scale:n}:{scale:f.x(),realScaleType:"point"}},oo=function(t){var e=t.domain();if(e&&!(e.length<=2)){var r=e.length,n=t.range(),o=Math.min(n[0],n[1])-1e-4,i=Math.max(n[0],n[1])+1e-4,a=t(e[0]),u=t(e[r-1]);(ai||ui)&&t.domain([e[0],e[r-1]])}},oi=function(t,e){if(!t)return null;for(var r=0,n=t.length;rn)&&(o[1]=n),o[0]>n&&(o[0]=n),o[1]=0?(t[a][r][0]=o,t[a][r][1]=o+u,o=t[a][r][1]):(t[a][r][0]=i,t[a][r][1]=i+u,i=t[a][r][1])}},expand:function(t,e){if((n=t.length)>0){for(var r,n,o,i=0,a=t[0].length;i0){for(var r,n=0,o=t[e[0]],i=o.length;n0&&(n=(r=t[e[0]]).length)>0){for(var r,n,o,i=0,a=1;a=0?(t[i][r][0]=o,t[i][r][1]=o+a,o=t[i][r][1]):(t[i][r][0]=0,t[i][r][1]=0)}}},oc=function(t,e,r){var n=e.map(function(t){return t.props.dataKey}),o=ou[r];return(function(){var t=(0,r5.Z)([]),e=r6,r=r1,n=r3;function o(o){var i,a,u=Array.from(t.apply(this,arguments),r7),c=u.length,l=-1;for(let t of o)for(i=0,++l;i=0?0:o<0?o:n}return r[0]},od=function(t,e){var r,n=(null!==(r=t.type)&&void 0!==r&&r.defaultProps?nV(nV({},t.type.defaultProps),t.props):t.props).stackId;if((0,nq.P2)(n)){var o=e[n];if(o){var i=o.items.indexOf(t);return i>=0?o.stackedData[i]:null}}return null},oy=function(t,e,r){return Object.keys(t).reduce(function(n,o){var i=t[o].stackedData.reduce(function(t,n){var o=n.slice(e,r+1).reduce(function(t,e){return[nt()(e.concat([t[0]]).filter(nq.hj)),r4()(e.concat([t[1]]).filter(nq.hj))]},[1/0,-1/0]);return[Math.min(t[0],o[0]),Math.max(t[1],o[1])]},[1/0,-1/0]);return[Math.min(i[0],n[0]),Math.max(i[1],n[1])]},[1/0,-1/0]).map(function(t){return t===1/0||t===-1/0?0:t})},ov=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,om=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ob=function(t,e,r){if(no()(t))return t(e,r);if(!Array.isArray(t))return e;var n=[];if((0,nq.hj)(t[0]))n[0]=r?t[0]:Math.min(t[0],e[0]);else if(ov.test(t[0])){var o=+ov.exec(t[0])[1];n[0]=e[0]-o}else no()(t[0])?n[0]=t[0](e[0]):n[0]=e[0];if((0,nq.hj)(t[1]))n[1]=r?t[1]:Math.max(t[1],e[1]);else if(om.test(t[1])){var i=+om.exec(t[1])[1];n[1]=e[1]+i}else no()(t[1])?n[1]=t[1](e[1]):n[1]=e[1];return n},og=function(t,e,r){if(t&&t.scale&&t.scale.bandwidth){var n=t.scale.bandwidth();if(!r||n>0)return n}if(t&&e&&e.length>=2){for(var o=nb()(e,function(t){return t.coordinate}),i=1/0,a=1,u=o.length;a1&&void 0!==arguments[1]?arguments[1]:{};if(null==t||n.x.isSsr)return{width:0,height:0};var o=(Object.keys(e=a({},r)).forEach(function(t){e[t]||delete e[t]}),e),i=JSON.stringify({text:t,copyStyle:o});if(u.widthCache[i])return u.widthCache[i];try{var s=document.getElementById(l);s||((s=document.createElement("span")).setAttribute("id",l),s.setAttribute("aria-hidden","true"),document.body.appendChild(s));var f=a(a({},c),o);Object.assign(s.style,f),s.textContent="".concat(t);var p=s.getBoundingClientRect(),h={width:p.width,height:p.height};return u.widthCache[i]=h,++u.cacheCount>2e3&&(u.cacheCount=0,u.widthCache={}),h}catch(t){return{width:0,height:0}}},f=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}}},16630:function(t,e,r){"use strict";r.d(e,{Ap:function(){return S},EL:function(){return g},Kt:function(){return w},P2:function(){return m},Rw:function(){return v},bv:function(){return O},fC:function(){return P},h1:function(){return x},hU:function(){return d},hj:function(){return y},k4:function(){return j},uY:function(){return h}});var n=r(42715),o=r.n(n),i=r(82559),a=r.n(i),u=r(13735),c=r.n(u),l=r(22345),s=r.n(l),f=r(77571),p=r.n(f),h=function(t){return 0===t?0:t>0?1:-1},d=function(t){return o()(t)&&t.indexOf("%")===t.length-1},y=function(t){return s()(t)&&!a()(t)},v=function(t){return p()(t)},m=function(t){return y(t)||o()(t)},b=0,g=function(t){var e=++b;return"".concat(t||"").concat(e)},x=function(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!y(t)&&!o()(t))return n;if(d(t)){var u=t.indexOf("%");r=e*parseFloat(t.slice(0,u))/100}else r=+t;return a()(r)&&(r=n),i&&r>e&&(r=e),r},w=function(t){if(!t)return null;var e=Object.keys(t);return e&&e.length?t[e[0]]:null},O=function(t){if(!Array.isArray(t))return!1;for(var e=t.length,r={},n=0;n2?r-2:0),o=2;ot.length)&&(e=t.length);for(var r=0,n=Array(e);r2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(e-(r.top||0)-(r.bottom||0)))/2},b=function(t,e,r,n,i){var a=t.width,u=t.height,s=t.startAngle,f=t.endAngle,y=(0,c.h1)(t.cx,a,a/2),v=(0,c.h1)(t.cy,u,u/2),b=m(a,u,r),g=(0,c.h1)(t.innerRadius,b,0),x=(0,c.h1)(t.outerRadius,b,.8*b);return Object.keys(e).reduce(function(t,r){var a,u=e[r],c=u.domain,m=u.reversed;if(o()(u.range))"angleAxis"===n?a=[s,f]:"radiusAxis"===n&&(a=[g,x]),m&&(a=[a[1],a[0]]);else{var b,w=function(t){if(Array.isArray(t))return t}(b=a=u.range)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(b,2)||function(t,e){if(t){if("string"==typeof t)return d(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(t,2)}}(b,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();s=w[0],f=w[1]}var O=(0,l.Hq)(u,i),j=O.realScaleType,S=O.scale;S.domain(c).range(a),(0,l.zF)(S);var P=(0,l.g$)(S,p(p({},u),{},{realScaleType:j})),E=p(p(p({},u),P),{},{range:a,radius:x,realScaleType:j,scale:S,cx:y,cy:v,innerRadius:g,outerRadius:x,startAngle:s,endAngle:f});return p(p({},t),{},h({},r,E))},{})},g=function(t,e){var r=t.x,n=t.y;return Math.sqrt(Math.pow(r-e.x,2)+Math.pow(n-e.y,2))},x=function(t,e){var r=t.x,n=t.y,o=e.cx,i=e.cy,a=g({x:r,y:n},{x:o,y:i});if(a<=0)return{radius:a};var u=Math.acos((r-o)/a);return n>i&&(u=2*Math.PI-u),{radius:a,angle:180*u/Math.PI,angleInRadian:u}},w=function(t){var e=t.startAngle,r=t.endAngle,n=Math.min(Math.floor(e/360),Math.floor(r/360));return{startAngle:e-360*n,endAngle:r-360*n}},O=function(t,e){var r,n=x({x:t.x,y:t.y},e),o=n.radius,i=n.angle,a=e.innerRadius,u=e.outerRadius;if(ou)return!1;if(0===o)return!0;var c=w(e),l=c.startAngle,s=c.endAngle,f=i;if(l<=s){for(;f>s;)f-=360;for(;f=l&&f<=s}else{for(;f>l;)f-=360;for(;f=s&&f<=l}return r?p(p({},e),{},{radius:o,angle:f+360*Math.min(Math.floor(e.startAngle/360),Math.floor(e.endAngle/360))}):null},j=function(t){return(0,i.isValidElement)(t)||u()(t)||"boolean"==typeof t?"":t.className}},82944:function(t,e,r){"use strict";r.d(e,{$R:function(){return R},Bh:function(){return B},Gf:function(){return j},L6:function(){return N},NN:function(){return k},TT:function(){return M},eu:function(){return L},jf:function(){return _},rL:function(){return D},sP:function(){return A}});var n=r(13735),o=r.n(n),i=r(77571),a=r.n(i),u=r(42715),c=r.n(u),l=r(86757),s=r.n(l),f=r(28302),p=r.n(f),h=r(2265),d=r(14326),y=r(16630),v=r(46485),m=r(41637),b=["children"],g=["children"];function x(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function w(t){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var O={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},j=function(t){return"string"==typeof t?t:t?t.displayName||t.name||"Component":""},S=null,P=null,E=function t(e){if(e===S&&Array.isArray(P))return P;var r=[];return h.Children.forEach(e,function(e){a()(e)||((0,d.isFragment)(e)?r=r.concat(t(e.props.children)):r.push(e))}),P=r,S=e,r};function k(t,e){var r=[],n=[];return n=Array.isArray(e)?e.map(function(t){return j(t)}):[j(e)],E(t).forEach(function(t){var e=o()(t,"type.displayName")||o()(t,"type.name");-1!==n.indexOf(e)&&r.push(t)}),r}function A(t,e){var r=k(t,e);return r&&r[0]}var M=function(t){if(!t||!t.props)return!1;var e=t.props,r=e.width,n=e.height;return!!(0,y.hj)(r)&&!(r<=0)&&!!(0,y.hj)(n)&&!(n<=0)},T=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],_=function(t){return t&&"object"===w(t)&&"clipDot"in t},C=function(t,e,r,n){var o,i=null!==(o=null===m.ry||void 0===m.ry?void 0:m.ry[n])&&void 0!==o?o:[];return e.startsWith("data-")||!s()(t)&&(n&&i.includes(e)||m.Yh.includes(e))||r&&m.nv.includes(e)},N=function(t,e,r){if(!t||"function"==typeof t||"boolean"==typeof t)return null;var n=t;if((0,h.isValidElement)(t)&&(n=t.props),!p()(n))return null;var o={};return Object.keys(n).forEach(function(t){var i;C(null===(i=n)||void 0===i?void 0:i[t],t,e,r)&&(o[t]=n[t])}),o},D=function t(e,r){if(e===r)return!0;var n=h.Children.count(e);if(n!==h.Children.count(r))return!1;if(0===n)return!0;if(1===n)return I(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var o=0;o=0)r.push(t);else if(t){var i=j(t.type),a=e[i]||{},u=a.handler,l=a.once;if(u&&(!l||!n[i])){var s=u(t,i,o);r.push(s),n[i]=!0}}}),r},B=function(t){var e=t&&t.type;return e&&O[e]?O[e]:null},R=function(t,e){return E(e).indexOf(t)}},46485:function(t,e,r){"use strict";function n(t,e){for(var r in t)if(({}).hasOwnProperty.call(t,r)&&(!({}).hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if(({}).hasOwnProperty.call(e,n)&&!({}).hasOwnProperty.call(t,n))return!1;return!0}r.d(e,{w:function(){return n}})},38569:function(t,e,r){"use strict";r.d(e,{z:function(){return l}});var n=r(22190),o=r(85355),i=r(82944);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function c(t){for(var e=1;e=0))throw Error(`invalid digits: ${t}`);if(e>15)return a;let r=10**e;return function(t){this._+=t[0];for(let e=1,n=t.length;e1e-6){if(Math.abs(f*c-l*s)>1e-6&&i){let h=r-a,d=o-u,y=c*c+l*l,v=Math.sqrt(y),m=Math.sqrt(p),b=i*Math.tan((n-Math.acos((y+p-(h*h+d*d))/(2*v*m)))/2),g=b/m,x=b/v;Math.abs(g-1)>1e-6&&this._append`L${t+g*s},${e+g*f}`,this._append`A${i},${i},0,0,${+(f*h>s*d)},${this._x1=t+x*c},${this._y1=e+x*l}`}else this._append`L${this._x1=t},${this._y1=e}`}}arc(t,e,r,a,u,c){if(t=+t,e=+e,c=!!c,(r=+r)<0)throw Error(`negative radius: ${r}`);let l=r*Math.cos(a),s=r*Math.sin(a),f=t+l,p=e+s,h=1^c,d=c?a-u:u-a;null===this._x1?this._append`M${f},${p}`:(Math.abs(this._x1-f)>1e-6||Math.abs(this._y1-p)>1e-6)&&this._append`L${f},${p}`,r&&(d<0&&(d=d%o+o),d>i?this._append`A${r},${r},0,1,${h},${t-l},${e-s}A${r},${r},0,1,${h},${this._x1=f},${this._y1=p}`:d>1e-6&&this._append`A${r},${r},0,${+(d>=n)},${h},${this._x1=t+r*Math.cos(u)},${this._y1=e+r*Math.sin(u)}`)}rect(t,e,r,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${r=+r}v${+n}h${-r}Z`}toString(){return this._}}function c(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(null==r)e=null;else{let t=Math.floor(r);if(!(t>=0))throw RangeError(`invalid digits: ${r}`);e=t}return t},()=>new u(e)}u.prototype},59121:function(t,e,r){"use strict";r.d(e,{E:function(){return i}});var n=r(99649),o=r(63497);function i(t,e){let r=(0,n.Q)(t);return isNaN(e)?(0,o.L)(t,NaN):(e&&r.setDate(r.getDate()+e),r)}},31091:function(t,e,r){"use strict";r.d(e,{z:function(){return i}});var n=r(99649),o=r(63497);function i(t,e){let r=(0,n.Q)(t);if(isNaN(e))return(0,o.L)(t,NaN);if(!e)return r;let i=r.getDate(),a=(0,o.L)(t,r.getTime());return(a.setMonth(r.getMonth()+e+1,0),i>=a.getDate())?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}},63497:function(t,e,r){"use strict";function n(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}r.d(e,{L:function(){return n}})},99649:function(t,e,r){"use strict";function n(t){let e=Object.prototype.toString.call(t);return t instanceof Date||"object"==typeof t&&"[object Date]"===e?new t.constructor(+t):new Date("number"==typeof t||"[object Number]"===e||"string"==typeof t||"[object String]"===e?t:NaN)}r.d(e,{Q:function(){return n}})},69398:function(t,e,r){"use strict";function n(t,e){if(!t)throw Error("Invariant failed")}r.d(e,{Z:function(){return n}})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1108-c2d0c742b6e72436.js b/litellm/proxy/_experimental/out/_next/static/chunks/1108-c2d0c742b6e72436.js new file mode 100644 index 0000000000..efdd028104 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1108-c2d0c742b6e72436.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1108],{40278:function(t,e,r){"use strict";r.d(e,{Z:function(){return S}});var n=r(5853),o=r(7084),i=r(26898),a=r(13241),u=r(1153),c=r(2265),l=r(47625),s=r(93765),f=r(31699),p=r(97059),h=r(62994),d=r(25311),y=(0,s.z)({chartName:"BarChart",GraphicalChild:f.$,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:p.K},{axisType:"yAxis",AxisComp:h.B}],formatAxisMap:d.t9}),v=r(56940),m=r(26680),b=r(8147),g=r(22190),x=r(65278),w=r(98593),O=r(92666),j=r(32644);let S=c.forwardRef((t,e)=>{let{data:r=[],categories:s=[],index:d,colors:S=i.s,valueFormatter:P=u.Cj,layout:E="horizontal",stack:k=!1,relative:A=!1,startEndOnly:M=!1,animationDuration:_=900,showAnimation:T=!1,showXAxis:C=!0,showYAxis:N=!0,yAxisWidth:D=56,intervalType:I="equidistantPreserveStart",showTooltip:L=!0,showLegend:B=!0,showGridLines:R=!0,autoMinValue:z=!1,minValue:U,maxValue:F,allowDecimals:$=!0,noDataText:q,onValueChange:Z,enableLegendSlider:W=!1,customTooltip:Y,rotateLabelX:H,barCategoryGap:X,tickGap:G=5,xAxisLabel:V,yAxisLabel:K,className:Q,padding:J=C||N?{left:20,right:20}:{left:0,right:0}}=t,tt=(0,n._T)(t,["data","categories","index","colors","valueFormatter","layout","stack","relative","startEndOnly","animationDuration","showAnimation","showXAxis","showYAxis","yAxisWidth","intervalType","showTooltip","showLegend","showGridLines","autoMinValue","minValue","maxValue","allowDecimals","noDataText","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","barCategoryGap","tickGap","xAxisLabel","yAxisLabel","className","padding"]),[te,tr]=(0,c.useState)(60),tn=(0,j.me)(s,S),[to,ti]=c.useState(void 0),[ta,tu]=(0,c.useState)(void 0),tc=!!Z;function tl(t,e,r){var n,o,i,a;r.stopPropagation(),Z&&((0,j.vZ)(to,Object.assign(Object.assign({},t.payload),{value:t.value}))?(tu(void 0),ti(void 0),null==Z||Z(null)):(tu(null===(o=null===(n=t.tooltipPayload)||void 0===n?void 0:n[0])||void 0===o?void 0:o.dataKey),ti(Object.assign(Object.assign({},t.payload),{value:t.value})),null==Z||Z(Object.assign({eventType:"bar",categoryClicked:null===(a=null===(i=t.tooltipPayload)||void 0===i?void 0:i[0])||void 0===a?void 0:a.dataKey},t.payload))))}let ts=(0,j.i4)(z,U,F);return c.createElement("div",Object.assign({ref:e,className:(0,a.q)("w-full h-80",Q)},tt),c.createElement(l.h,{className:"h-full w-full"},(null==r?void 0:r.length)?c.createElement(y,{barCategoryGap:X,data:r,stackOffset:k?"sign":A?"expand":"none",layout:"vertical"===E?"vertical":"horizontal",onClick:tc&&(ta||to)?()=>{ti(void 0),tu(void 0),null==Z||Z(null)}:void 0,margin:{bottom:V?30:void 0,left:K?20:void 0,right:K?5:void 0,top:5}},R?c.createElement(v.q,{className:(0,a.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:"vertical"!==E,vertical:"vertical"===E}):null,"vertical"!==E?c.createElement(p.K,{padding:J,hide:!C,dataKey:d,interval:M?"preserveStartEnd":I,tick:{transform:"translate(0, 6)"},ticks:M?[r[0][d],r[r.length-1][d]]:void 0,fill:"",stroke:"",className:(0,a.q)("mt-4 text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,angle:null==H?void 0:H.angle,dy:null==H?void 0:H.verticalShift,height:null==H?void 0:H.xAxisHeight,minTickGap:G},V&&c.createElement(m._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},V)):c.createElement(p.K,{hide:!C,type:"number",tick:{transform:"translate(-3, 0)"},domain:ts,fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,tickFormatter:P,minTickGap:G,allowDecimals:$,angle:null==H?void 0:H.angle,dy:null==H?void 0:H.verticalShift,height:null==H?void 0:H.xAxisHeight},V&&c.createElement(m._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},V)),"vertical"!==E?c.createElement(h.B,{width:D,hide:!N,axisLine:!1,tickLine:!1,type:"number",domain:ts,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:A?t=>"".concat((100*t).toString()," %"):P,allowDecimals:$},K&&c.createElement(m._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},K)):c.createElement(h.B,{width:D,hide:!N,dataKey:d,axisLine:!1,tickLine:!1,ticks:M?[r[0][d],r[r.length-1][d]]:void 0,type:"category",interval:"preserveStartEnd",tick:{transform:"translate(0, 6)"},fill:"",stroke:"",className:(0,a.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content")},K&&c.createElement(m._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},K)),c.createElement(b.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{fill:"#d1d5db",opacity:"0.15"},content:L?t=>{let{active:e,payload:r,label:n}=t;return Y?c.createElement(Y,{payload:null==r?void 0:r.map(t=>{var e;return Object.assign(Object.assign({},t),{color:null!==(e=tn.get(t.dataKey))&&void 0!==e?e:o.fr.Gray})}),active:e,label:n}):c.createElement(w.ZP,{active:e,payload:r,label:n,valueFormatter:P,categoryColors:tn})}:c.createElement(c.Fragment,null),position:{y:0}}),B?c.createElement(g.D,{verticalAlign:"top",height:te,content:t=>{let{payload:e}=t;return(0,x.Z)({payload:e},tn,tr,ta,tc?t=>{tc&&(t!==ta||to?(tu(t),null==Z||Z({eventType:"category",categoryClicked:t})):(tu(void 0),null==Z||Z(null)),ti(void 0))}:void 0,W)}}):null,s.map(t=>{var e;return c.createElement(f.$,{className:(0,a.q)((0,u.bM)(null!==(e=tn.get(t))&&void 0!==e?e:o.fr.Gray,i.K.background).fillColor,Z?"cursor-pointer":""),key:t,name:t,type:"linear",stackId:k||A?"a":void 0,dataKey:t,fill:"",isAnimationActive:T,animationDuration:_,shape:t=>((t,e,r,n)=>{let{fillOpacity:o,name:i,payload:a,value:u}=t,{x:l,width:s,y:f,height:p}=t;return"horizontal"===n&&p<0?(f+=p,p=Math.abs(p)):"vertical"===n&&s<0&&(l+=s,s=Math.abs(s)),c.createElement("rect",{x:l,y:f,width:s,height:p,opacity:e||r&&r!==i?(0,j.vZ)(e,Object.assign(Object.assign({},a),{value:u}))?o:.3:o})})(t,to,ta,E),onClick:tl})})):c.createElement(O.Z,{noDataText:q})))});S.displayName="BarChart"},65278:function(t,e,r){"use strict";r.d(e,{Z:function(){return y}});var n=r(2265);let o=t=>{n.useEffect(()=>{let e=()=>{t()};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t])};var i=r(5853),a=r(26898),u=r(13241),c=r(1153);let l=t=>{var e=(0,i._T)(t,[]);return n.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),n.createElement("path",{d:"M8 12L14 6V18L8 12Z"}))},s=t=>{var e=(0,i._T)(t,[]);return n.createElement("svg",Object.assign({},e,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),n.createElement("path",{d:"M16 12L10 18V6L16 12Z"}))},f=(0,c.fn)("Legend"),p=t=>{let{name:e,color:r,onClick:o,activeLegend:i}=t,l=!!o;return n.createElement("li",{className:(0,u.q)(f("legendItem"),"group inline-flex items-center px-2 py-0.5 rounded-tremor-small transition whitespace-nowrap",l?"cursor-pointer":"cursor-default","text-tremor-content",l?"hover:bg-tremor-background-subtle":"","dark:text-dark-tremor-content",l?"dark:hover:bg-dark-tremor-background-subtle":""),onClick:t=>{t.stopPropagation(),null==o||o(e,r)}},n.createElement("svg",{className:(0,u.q)("flex-none h-2 w-2 mr-1.5",(0,c.bM)(r,a.K.text).textColor,i&&i!==e?"opacity-40":"opacity-100"),fill:"currentColor",viewBox:"0 0 8 8"},n.createElement("circle",{cx:4,cy:4,r:4})),n.createElement("p",{className:(0,u.q)("whitespace-nowrap truncate text-tremor-default","text-tremor-content",l?"group-hover:text-tremor-content-emphasis":"","dark:text-dark-tremor-content",i&&i!==e?"opacity-40":"opacity-100",l?"dark:group-hover:text-dark-tremor-content-emphasis":"")},e))},h=t=>{let{icon:e,onClick:r,disabled:o}=t,[i,a]=n.useState(!1),c=n.useRef(null);return n.useEffect(()=>(i?c.current=setInterval(()=>{null==r||r()},300):clearInterval(c.current),()=>clearInterval(c.current)),[i,r]),(0,n.useEffect)(()=>{o&&(clearInterval(c.current),a(!1))},[o]),n.createElement("button",{type:"button",className:(0,u.q)(f("legendSliderButton"),"w-5 group inline-flex items-center truncate rounded-tremor-small transition",o?"cursor-not-allowed":"cursor-pointer",o?"text-tremor-content-subtle":"text-tremor-content hover:text-tremor-content-emphasis hover:bg-tremor-background-subtle",o?"dark:text-dark-tremor-subtle":"dark:text-dark-tremor dark:hover:text-tremor-content-emphasis dark:hover:bg-dark-tremor-background-subtle"),disabled:o,onClick:t=>{t.stopPropagation(),null==r||r()},onMouseDown:t=>{t.stopPropagation(),a(!0)},onMouseUp:t=>{t.stopPropagation(),a(!1)}},n.createElement(e,{className:"w-full"}))},d=n.forwardRef((t,e)=>{let{categories:r,colors:o=a.s,className:c,onClickLegendItem:d,activeLegend:y,enableLegendSlider:v=!1}=t,m=(0,i._T)(t,["categories","colors","className","onClickLegendItem","activeLegend","enableLegendSlider"]),b=n.useRef(null),g=n.useRef(null),[x,w]=n.useState(null),[O,j]=n.useState(null),S=n.useRef(null),P=(0,n.useCallback)(()=>{let t=null==b?void 0:b.current;t&&w({left:t.scrollLeft>0,right:t.scrollWidth-t.clientWidth>t.scrollLeft})},[w]),E=(0,n.useCallback)(t=>{var e,r;let n=null==b?void 0:b.current,o=null==g?void 0:g.current,i=null!==(e=null==n?void 0:n.clientWidth)&&void 0!==e?e:0,a=null!==(r=null==o?void 0:o.clientWidth)&&void 0!==r?r:0;n&&v&&(n.scrollTo({left:"left"===t?n.scrollLeft-i+a:n.scrollLeft+i-a,behavior:"smooth"}),setTimeout(()=>{P()},400))},[v,P]);n.useEffect(()=>{let t=t=>{"ArrowLeft"===t?E("left"):"ArrowRight"===t&&E("right")};return O?(t(O),S.current=setInterval(()=>{t(O)},300)):clearInterval(S.current),()=>clearInterval(S.current)},[O,E]);let k=t=>{t.stopPropagation(),"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||(t.preventDefault(),j(t.key))},A=t=>{t.stopPropagation(),j(null)};return n.useEffect(()=>{let t=null==b?void 0:b.current;return v&&(P(),null==t||t.addEventListener("keydown",k),null==t||t.addEventListener("keyup",A)),()=>{null==t||t.removeEventListener("keydown",k),null==t||t.removeEventListener("keyup",A)}},[P,v]),n.createElement("ol",Object.assign({ref:e,className:(0,u.q)(f("root"),"relative overflow-hidden",c)},m),n.createElement("div",{ref:b,tabIndex:0,className:(0,u.q)("h-full flex",v?(null==x?void 0:x.right)||(null==x?void 0:x.left)?"pl-4 pr-12 items-center overflow-auto snap-mandatory [&::-webkit-scrollbar]:hidden [scrollbar-width:none]":"":"flex-wrap")},r.map((t,e)=>n.createElement(p,{key:"item-".concat(e),name:t,color:o[e%o.length],onClick:d,activeLegend:y}))),v&&((null==x?void 0:x.right)||(null==x?void 0:x.left))?n.createElement(n.Fragment,null,n.createElement("div",{className:(0,u.q)("bg-tremor-background","dark:bg-dark-tremor-background","absolute flex top-0 pr-1 bottom-0 right-0 items-center justify-center h-full"),ref:g},n.createElement(h,{icon:l,onClick:()=>{j(null),E("left")},disabled:!(null==x?void 0:x.left)}),n.createElement(h,{icon:s,onClick:()=>{j(null),E("right")},disabled:!(null==x?void 0:x.right)}))):null)});d.displayName="Legend";let y=(t,e,r,i,a,u)=>{let{payload:c}=t,l=(0,n.useRef)(null);o(()=>{var t,e;r((e=null===(t=l.current)||void 0===t?void 0:t.clientHeight)?Number(e)+20:60)});let s=c.filter(t=>"none"!==t.type);return n.createElement("div",{ref:l,className:"flex items-center justify-end"},n.createElement(d,{categories:s.map(t=>t.value),colors:s.map(t=>e.get(t.value)),onClickLegendItem:a,activeLegend:i,enableLegendSlider:u}))}},98593:function(t,e,r){"use strict";r.d(e,{$B:function(){return c},ZP:function(){return s},zX:function(){return l}});var n=r(2265),o=r(7084),i=r(26898),a=r(13241),u=r(1153);let c=t=>{let{children:e}=t;return n.createElement("div",{className:(0,a.q)("rounded-tremor-default text-tremor-default border","bg-tremor-background shadow-tremor-dropdown border-tremor-border","dark:bg-dark-tremor-background dark:shadow-dark-tremor-dropdown dark:border-dark-tremor-border")},e)},l=t=>{let{value:e,name:r,color:o}=t;return n.createElement("div",{className:"flex items-center justify-between space-x-8"},n.createElement("div",{className:"flex items-center space-x-2"},n.createElement("span",{className:(0,a.q)("shrink-0 rounded-tremor-full border-2 h-3 w-3","border-tremor-background shadow-tremor-card","dark:border-dark-tremor-background dark:shadow-dark-tremor-card",(0,u.bM)(o,i.K.background).bgColor)}),n.createElement("p",{className:(0,a.q)("text-right whitespace-nowrap","text-tremor-content","dark:text-dark-tremor-content")},r)),n.createElement("p",{className:(0,a.q)("font-medium tabular-nums text-right whitespace-nowrap","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e))},s=t=>{let{active:e,payload:r,label:i,categoryColors:u,valueFormatter:s}=t;if(e&&r){let t=r.filter(t=>"none"!==t.type);return n.createElement(c,null,n.createElement("div",{className:(0,a.q)("border-tremor-border border-b px-4 py-2","dark:border-dark-tremor-border")},n.createElement("p",{className:(0,a.q)("font-medium","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},i)),n.createElement("div",{className:(0,a.q)("px-4 py-2 space-y-1")},t.map((t,e)=>{var r;let{value:i,name:a}=t;return n.createElement(l,{key:"id-".concat(e),value:s(i),name:a,color:null!==(r=u.get(a))&&void 0!==r?r:o.fr.Blue})})))}return null}},92666:function(t,e,r){"use strict";r.d(e,{Z:function(){return i}});var n=r(13241),o=r(2265);let i=t=>{let{className:e,noDataText:r="No data"}=t;return o.createElement("div",{className:(0,n.q)("flex items-center justify-center w-full h-full border border-dashed rounded-tremor-default","border-tremor-border","dark:border-dark-tremor-border",e)},o.createElement("p",{className:(0,n.q)("text-tremor-content text-tremor-default","dark:text-dark-tremor-content")},r))}},32644:function(t,e,r){"use strict";r.d(e,{FB:function(){return i},i4:function(){return o},me:function(){return n},vZ:function(){return function t(e,r){if(e===r)return!0;if("object"!=typeof e||"object"!=typeof r||null===e||null===r)return!1;let n=Object.keys(e),o=Object.keys(r);if(n.length!==o.length)return!1;for(let i of n)if(!o.includes(i)||!t(e[i],r[i]))return!1;return!0}}});let n=(t,e)=>{let r=new Map;return t.forEach((t,n)=>{r.set(t,e[n%e.length])}),r},o=(t,e,r)=>[t?"auto":null!=e?e:0,null!=r?r:"auto"];function i(t,e){let r=[];for(let n of t)if(Object.prototype.hasOwnProperty.call(n,e)&&(r.push(n[e]),r.length>1))return!1;return!0}},49804:function(t,e,r){"use strict";r.d(e,{Z:function(){return l}});var n=r(5853),o=r(13241),i=r(1153),a=r(2265),u=r(9496);let c=(0,i.fn)("Col"),l=a.forwardRef((t,e)=>{let{numColSpan:r=1,numColSpanSm:i,numColSpanMd:l,numColSpanLg:s,children:f,className:p}=t,h=(0,n._T)(t,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),d=(t,e)=>t&&Object.keys(e).includes(String(t))?e[t]:"";return a.createElement("div",Object.assign({ref:e,className:(0,o.q)(c("root"),(()=>{let t=d(r,u.PT),e=d(i,u.SP),n=d(l,u.VS),a=d(s,u._w);return(0,o.q)(t,e,n,a)})(),p)},h),f)});l.displayName="Col"},97765:function(t,e,r){"use strict";r.d(e,{Z:function(){return c}});var n=r(5853),o=r(26898),i=r(13241),a=r(1153),u=r(2265);let c=u.forwardRef((t,e)=>{let{color:r,children:c,className:l}=t,s=(0,n._T)(t,["color","children","className"]);return u.createElement("p",Object.assign({ref:e,className:(0,i.q)(r?(0,a.bM)(r,o.K.lightText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",l)},s),c)});c.displayName="Subtitle"},61134:function(t,e,r){var n;!function(o){"use strict";var i,a={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},u=!0,c="[DecimalError] ",l=c+"Invalid argument: ",s=c+"Exponent out of range: ",f=Math.floor,p=Math.pow,h=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d=f(1286742750677284.5),y={};function v(t,e){var r,n,o,i,a,c,l,s,f=t.constructor,p=f.precision;if(!t.s||!e.s)return e.s||(e=new f(t)),u?E(e,p):e;if(l=t.d,s=e.d,a=t.e,o=e.e,l=l.slice(),i=a-o){for(i<0?(n=l,i=-i,c=s.length):(n=s,o=a,c=l.length),i>(c=(a=Math.ceil(p/7))>c?a+1:c+1)&&(i=c,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((c=l.length)-(i=s.length)<0&&(i=c,n=s,s=l,l=n),r=0;i;)r=(l[--i]=l[i]+s[i]+r)/1e7|0,l[i]%=1e7;for(r&&(l.unshift(r),++o),c=l.length;0==l[--c];)l.pop();return e.d=l,e.e=o,u?E(e,p):e}function m(t,e,r){if(t!==~~t||tr)throw Error(l+t)}function b(t){var e,r,n,o=t.length-1,i="",a=t[0];if(o>0){for(i+=a,e=1;et.e^this.s<0?1:-1;for(e=0,r=(n=this.d.length)<(o=t.d.length)?n:o;et.d[e]^this.s<0?1:-1;return n===o?0:n>o^this.s<0?1:-1},y.decimalPlaces=y.dp=function(){var t=this.d.length-1,e=(t-this.e)*7;if(t=this.d[t])for(;t%10==0;t/=10)e--;return e<0?0:e},y.dividedBy=y.div=function(t){return g(this,new this.constructor(t))},y.dividedToIntegerBy=y.idiv=function(t){var e=this.constructor;return E(g(this,new e(t),0,1),e.precision)},y.equals=y.eq=function(t){return!this.cmp(t)},y.exponent=function(){return w(this)},y.greaterThan=y.gt=function(t){return this.cmp(t)>0},y.greaterThanOrEqualTo=y.gte=function(t){return this.cmp(t)>=0},y.isInteger=y.isint=function(){return this.e>this.d.length-2},y.isNegative=y.isneg=function(){return this.s<0},y.isPositive=y.ispos=function(){return this.s>0},y.isZero=function(){return 0===this.s},y.lessThan=y.lt=function(t){return 0>this.cmp(t)},y.lessThanOrEqualTo=y.lte=function(t){return 1>this.cmp(t)},y.logarithm=y.log=function(t){var e,r=this.constructor,n=r.precision,o=n+5;if(void 0===t)t=new r(10);else if((t=new r(t)).s<1||t.eq(i))throw Error(c+"NaN");if(this.s<1)throw Error(c+(this.s?"NaN":"-Infinity"));return this.eq(i)?new r(0):(u=!1,e=g(S(this,o),S(t,o),o),u=!0,E(e,n))},y.minus=y.sub=function(t){return t=new this.constructor(t),this.s==t.s?k(this,t):v(this,(t.s=-t.s,t))},y.modulo=y.mod=function(t){var e,r=this.constructor,n=r.precision;if(!(t=new r(t)).s)throw Error(c+"NaN");return this.s?(u=!1,e=g(this,t,0,1).times(t),u=!0,this.minus(e)):E(new r(this),n)},y.naturalExponential=y.exp=function(){return x(this)},y.naturalLogarithm=y.ln=function(){return S(this)},y.negated=y.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t},y.plus=y.add=function(t){return t=new this.constructor(t),this.s==t.s?v(this,t):k(this,(t.s=-t.s,t))},y.precision=y.sd=function(t){var e,r,n;if(void 0!==t&&!!t!==t&&1!==t&&0!==t)throw Error(l+t);if(e=w(this)+1,r=7*(n=this.d.length-1)+1,n=this.d[n]){for(;n%10==0;n/=10)r--;for(n=this.d[0];n>=10;n/=10)r++}return t&&e>r?e:r},y.squareRoot=y.sqrt=function(){var t,e,r,n,o,i,a,l=this.constructor;if(this.s<1){if(!this.s)return new l(0);throw Error(c+"NaN")}for(t=w(this),u=!1,0==(o=Math.sqrt(+this))||o==1/0?(((e=b(this.d)).length+t)%2==0&&(e+="0"),o=Math.sqrt(e),t=f((t+1)/2)-(t<0||t%2),n=new l(e=o==1/0?"5e"+t:(e=o.toExponential()).slice(0,e.indexOf("e")+1)+t)):n=new l(o.toString()),o=a=(r=l.precision)+3;;)if(n=(i=n).plus(g(this,i,a+2)).times(.5),b(i.d).slice(0,a)===(e=b(n.d)).slice(0,a)){if(e=e.slice(a-3,a+1),o==a&&"4999"==e){if(E(i,r+1,0),i.times(i).eq(this)){n=i;break}}else if("9999"!=e)break;a+=4}return u=!0,E(n,r)},y.times=y.mul=function(t){var e,r,n,o,i,a,c,l,s,f=this.constructor,p=this.d,h=(t=new f(t)).d;if(!this.s||!t.s)return new f(0);for(t.s*=this.s,r=this.e+t.e,(l=p.length)<(s=h.length)&&(i=p,p=h,h=i,a=l,l=s,s=a),i=[],n=a=l+s;n--;)i.push(0);for(n=s;--n>=0;){for(e=0,o=l+n;o>n;)c=i[o]+h[n]*p[o-n-1]+e,i[o--]=c%1e7|0,e=c/1e7|0;i[o]=(i[o]+e)%1e7|0}for(;!i[--a];)i.pop();return e?++r:i.shift(),t.d=i,t.e=r,u?E(t,f.precision):t},y.toDecimalPlaces=y.todp=function(t,e){var r=this,n=r.constructor;return(r=new n(r),void 0===t)?r:(m(t,0,1e9),void 0===e?e=n.rounding:m(e,0,8),E(r,t+w(r)+1,e))},y.toExponential=function(t,e){var r,n=this,o=n.constructor;return void 0===t?r=A(n,!0):(m(t,0,1e9),void 0===e?e=o.rounding:m(e,0,8),r=A(n=E(new o(n),t+1,e),!0,t+1)),r},y.toFixed=function(t,e){var r,n,o=this.constructor;return void 0===t?A(this):(m(t,0,1e9),void 0===e?e=o.rounding:m(e,0,8),r=A((n=E(new o(this),t+w(this)+1,e)).abs(),!1,t+w(n)+1),this.isneg()&&!this.isZero()?"-"+r:r)},y.toInteger=y.toint=function(){var t=this.constructor;return E(new t(this),w(this)+1,t.rounding)},y.toNumber=function(){return+this},y.toPower=y.pow=function(t){var e,r,n,o,a,l,s=this,p=s.constructor,h=+(t=new p(t));if(!t.s)return new p(i);if(!(s=new p(s)).s){if(t.s<1)throw Error(c+"Infinity");return s}if(s.eq(i))return s;if(n=p.precision,t.eq(i))return E(s,n);if(l=(e=t.e)>=(r=t.d.length-1),a=s.s,l){if((r=h<0?-h:h)<=9007199254740991){for(o=new p(i),e=Math.ceil(n/7+4),u=!1;r%2&&M((o=o.times(s)).d,e),0!==(r=f(r/2));)M((s=s.times(s)).d,e);return u=!0,t.s<0?new p(i).div(o):E(o,n)}}else if(a<0)throw Error(c+"NaN");return a=a<0&&1&t.d[Math.max(e,r)]?-1:1,s.s=1,u=!1,o=t.times(S(s,n+12)),u=!0,(o=x(o)).s=a,o},y.toPrecision=function(t,e){var r,n,o=this,i=o.constructor;return void 0===t?(r=w(o),n=A(o,r<=i.toExpNeg||r>=i.toExpPos)):(m(t,1,1e9),void 0===e?e=i.rounding:m(e,0,8),r=w(o=E(new i(o),t,e)),n=A(o,t<=r||r<=i.toExpNeg,t)),n},y.toSignificantDigits=y.tosd=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(m(t,1,1e9),void 0===e?e=r.rounding:m(e,0,8)),E(new r(this),t,e)},y.toString=y.valueOf=y.val=y.toJSON=function(){var t=w(this),e=this.constructor;return A(this,t<=e.toExpNeg||t>=e.toExpPos)};var g=function(){function t(t,e){var r,n=0,o=t.length;for(t=t.slice();o--;)r=t[o]*e+n,t[o]=r%1e7|0,n=r/1e7|0;return n&&t.unshift(n),t}function e(t,e,r,n){var o,i;if(r!=n)i=r>n?1:-1;else for(o=i=0;oe[o]?1:-1;break}return i}function r(t,e,r){for(var n=0;r--;)t[r]-=n,n=t[r]1;)t.shift()}return function(n,o,i,a){var u,l,s,f,p,h,d,y,v,m,b,g,x,O,j,S,P,k,A=n.constructor,M=n.s==o.s?1:-1,_=n.d,T=o.d;if(!n.s)return new A(n);if(!o.s)throw Error(c+"Division by zero");for(s=0,l=n.e-o.e,P=T.length,j=_.length,y=(d=new A(M)).d=[];T[s]==(_[s]||0);)++s;if(T[s]>(_[s]||0)&&--l,(g=null==i?i=A.precision:a?i+(w(n)-w(o))+1:i)<0)return new A(0);if(g=g/7+2|0,s=0,1==P)for(f=0,T=T[0],g++;(s1&&(T=t(T,f),_=t(_,f),P=T.length,j=_.length),O=P,m=(v=_.slice(0,P)).length;m=1e7/2&&++S;do f=0,(u=e(T,v,P,m))<0?(b=v[0],P!=m&&(b=1e7*b+(v[1]||0)),(f=b/S|0)>1?(f>=1e7&&(f=1e7-1),h=(p=t(T,f)).length,m=v.length,1==(u=e(p,v,h,m))&&(f--,r(p,P16)throw Error(s+w(t));if(!t.s)return new h(i);for(null==e?(u=!1,c=d):c=e,a=new h(.03125);t.abs().gte(.1);)t=t.times(a),f+=5;for(c+=Math.log(p(2,f))/Math.LN10*2+5|0,r=n=o=new h(i),h.precision=c;;){if(n=E(n.times(t),c),r=r.times(++l),b((a=o.plus(g(n,r,c))).d).slice(0,c)===b(o.d).slice(0,c)){for(;f--;)o=E(o.times(o),c);return h.precision=d,null==e?(u=!0,E(o,d)):o}o=a}}function w(t){for(var e=7*t.e,r=t.d[0];r>=10;r/=10)e++;return e}function O(t,e,r){if(e>t.LN10.sd())throw u=!0,r&&(t.precision=r),Error(c+"LN10 precision limit exceeded");return E(new t(t.LN10),e)}function j(t){for(var e="";t--;)e+="0";return e}function S(t,e){var r,n,o,a,l,s,f,p,h,d=1,y=t,v=y.d,m=y.constructor,x=m.precision;if(y.s<1)throw Error(c+(y.s?"NaN":"-Infinity"));if(y.eq(i))return new m(0);if(null==e?(u=!1,p=x):p=e,y.eq(10))return null==e&&(u=!0),O(m,p);if(p+=10,m.precision=p,n=(r=b(v)).charAt(0),!(15e14>Math.abs(a=w(y))))return f=O(m,p+2,x).times(a+""),y=S(new m(n+"."+r.slice(1)),p-10).plus(f),m.precision=x,null==e?(u=!0,E(y,x)):y;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=b((y=y.times(t)).d)).charAt(0),d++;for(a=w(y),n>1?(y=new m("0."+r),a++):y=new m(n+"."+r.slice(1)),s=l=y=g(y.minus(i),y.plus(i),p),h=E(y.times(y),p),o=3;;){if(l=E(l.times(h),p),b((f=s.plus(g(l,new m(o),p))).d).slice(0,p)===b(s.d).slice(0,p))return s=s.times(2),0!==a&&(s=s.plus(O(m,p+2,x).times(a+""))),s=g(s,new m(d),p),m.precision=x,null==e?(u=!0,E(s,x)):s;s=f,o+=2}}function P(t,e){var r,n,o;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;48===e.charCodeAt(n);)++n;for(o=e.length;48===e.charCodeAt(o-1);)--o;if(e=e.slice(n,o)){if(o-=n,r=r-n-1,t.e=f(r/7),t.d=[],n=(r+1)%7,r<0&&(n+=7),nd||t.e<-d))throw Error(s+r)}else t.s=0,t.e=0,t.d=[0];return t}function E(t,e,r){var n,o,i,a,c,l,h,y,v=t.d;for(a=1,i=v[0];i>=10;i/=10)a++;if((n=e-a)<0)n+=7,o=e,h=v[y=0];else{if((y=Math.ceil((n+1)/7))>=(i=v.length))return t;for(a=1,h=i=v[y];i>=10;i/=10)a++;n%=7,o=n-7+a}if(void 0!==r&&(c=h/(i=p(10,a-o-1))%10|0,l=e<0||void 0!==v[y+1]||h%i,l=r<4?(c||l)&&(0==r||r==(t.s<0?3:2)):c>5||5==c&&(4==r||l||6==r&&(n>0?o>0?h/p(10,a-o):0:v[y-1])%10&1||r==(t.s<0?8:7))),e<1||!v[0])return l?(i=w(t),v.length=1,e=e-i-1,v[0]=p(10,(7-e%7)%7),t.e=f(-e/7)||0):(v.length=1,v[0]=t.e=t.s=0),t;if(0==n?(v.length=y,i=1,y--):(v.length=y+1,i=p(10,7-n),v[y]=o>0?(h/p(10,a-o)%p(10,o)|0)*i:0),l)for(;;){if(0==y){1e7==(v[0]+=i)&&(v[0]=1,++t.e);break}if(v[y]+=i,1e7!=v[y])break;v[y--]=0,i=1}for(n=v.length;0===v[--n];)v.pop();if(u&&(t.e>d||t.e<-d))throw Error(s+w(t));return t}function k(t,e){var r,n,o,i,a,c,l,s,f,p,h=t.constructor,d=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),u?E(e,d):e;if(l=t.d,p=e.d,n=e.e,s=t.e,l=l.slice(),a=s-n){for((f=a<0)?(r=l,a=-a,c=p.length):(r=p,n=s,c=l.length),a>(o=Math.max(Math.ceil(d/7),c)+2)&&(a=o,r.length=1),r.reverse(),o=a;o--;)r.push(0);r.reverse()}else{for((f=(o=l.length)<(c=p.length))&&(c=o),o=0;o0;--o)l[c++]=0;for(o=p.length;o>a;){if(l[--o]0?i=i.charAt(0)+"."+i.slice(1)+j(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(o<0?"e":"e+")+o):o<0?(i="0."+j(-o-1)+i,r&&(n=r-a)>0&&(i+=j(n))):o>=a?(i+=j(o+1-a),r&&(n=r-o-1)>0&&(i=i+"."+j(n))):((n=o+1)0&&(o+1===a&&(i+="."),i+=j(n))),t.s<0?"-"+i:i}function M(t,e){if(t.length>e)return t.length=e,!0}function _(t){if(!t||"object"!=typeof t)throw Error(c+"Object expected");var e,r,n,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e=o[e+1]&&n<=o[e+2])this[r]=n;else throw Error(l+r+": "+n)}if(void 0!==(n=t[r="LN10"])){if(n==Math.LN10)this[r]=new this(n);else throw Error(l+r+": "+n)}return this}(a=function t(e){var r,n,o;function i(t){if(!(this instanceof i))return new i(t);if(this.constructor=i,t instanceof i){this.s=t.s,this.e=t.e,this.d=(t=t.d)?t.slice():t;return}if("number"==typeof t){if(0*t!=0)throw Error(l+t);if(t>0)this.s=1;else if(t<0)t=-t,this.s=-1;else{this.s=0,this.e=0,this.d=[0];return}if(t===~~t&&t<1e7){this.e=0,this.d=[t];return}return P(this,t.toString())}if("string"!=typeof t)throw Error(l+t);if(45===t.charCodeAt(0)?(t=t.slice(1),this.s=-1):this.s=1,h.test(t))P(this,t);else throw Error(l+t)}if(i.prototype=y,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=t,i.config=i.set=_,void 0===e&&(e={}),e)for(r=0,o=["precision","rounding","toExpNeg","toExpPos","LN10"];r-1}},56883:function(t){t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n0&&i(s)?r>1?t(s,r-1,i,a,u):n(u,s):a||(u[u.length]=s)}return u}},63321:function(t,e,r){var n=r(33023)();t.exports=n},98060:function(t,e,r){var n=r(63321),o=r(43228);t.exports=function(t,e){return t&&n(t,e,o)}},92167:function(t,e,r){var n=r(67906),o=r(70235);t.exports=function(t,e){e=n(e,t);for(var r=0,i=e.length;null!=t&&re}},93012:function(t){t.exports=function(t,e){return null!=t&&e in Object(t)}},47909:function(t,e,r){var n=r(8235),o=r(31953),i=r(35281);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},90370:function(t,e,r){var n=r(54506),o=r(10303);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},56318:function(t,e,r){var n=r(6791),o=r(10303);t.exports=function t(e,r,i,a,u){return e===r||(null!=e&&null!=r&&(o(e)||o(r))?n(e,r,i,a,t,u):e!=e&&r!=r)}},6791:function(t,e,r){var n=r(85885),o=r(97638),i=r(88030),a=r(64974),u=r(81690),c=r(25614),l=r(98051),s=r(9792),f="[object Arguments]",p="[object Array]",h="[object Object]",d=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,y,v,m){var b=c(t),g=c(e),x=b?p:u(t),w=g?p:u(e);x=x==f?h:x,w=w==f?h:w;var O=x==h,j=w==h,S=x==w;if(S&&l(t)){if(!l(e))return!1;b=!0,O=!1}if(S&&!O)return m||(m=new n),b||s(t)?o(t,e,r,y,v,m):i(t,e,x,r,y,v,m);if(!(1&r)){var P=O&&d.call(t,"__wrapped__"),E=j&&d.call(e,"__wrapped__");if(P||E){var k=P?t.value():t,A=E?e.value():e;return m||(m=new n),v(k,A,r,y,m)}}return!!S&&(m||(m=new n),a(t,e,r,y,v,m))}},62538:function(t,e,r){var n=r(85885),o=r(56318);t.exports=function(t,e,r,i){var a=r.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var l=r[a];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++ao?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n=200){var y=e?null:u(t);if(y)return c(y);p=!1,s=a,d=new n}else d=e?[]:h;t:for(;++l=o?t:n(t,e,r)}},1536:function(t,e,r){var n=r(78371);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,a=n(t),u=void 0!==e,c=null===e,l=e==e,s=n(e);if(!c&&!s&&!a&&t>e||a&&u&&l&&!c&&!s||o&&u&&l||!r&&l||!i)return 1;if(!o&&!a&&!s&&t=c)return l;return l*("desc"==r[o]?-1:1)}}return t.index-e.index}},92077:function(t,e,r){var n=r(74288)["__core-js_shared__"];t.exports=n},97930:function(t,e,r){var n=r(5629);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,a=e?i:-1,u=Object(r);(e?a--:++a-1?u[c?e[l]:l]:void 0}}},35464:function(t,e,r){var n=r(19608),o=r(49639),i=r(175);t.exports=function(t){return function(e,r,a){return a&&"number"!=typeof a&&o(e,r,a)&&(r=a=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),a=void 0===a?es))return!1;var p=c.get(t),h=c.get(e);if(p&&h)return p==e&&h==t;var d=-1,y=!0,v=2&r?new n:void 0;for(c.set(t,e),c.set(e,t);++d-1&&t%1==0&&t-1}},13368:function(t,e,r){var n=r(24457);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},38764:function(t,e,r){var n=r(9855),o=r(99078),i=r(88675);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},78615:function(t,e,r){var n=r(1507);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},83391:function(t,e,r){var n=r(1507);t.exports=function(t){return n(this,t).get(t)}},53483:function(t,e,r){var n=r(1507);t.exports=function(t){return n(this,t).has(t)}},74724:function(t,e,r){var n=r(1507);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},22523:function(t){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}},47073:function(t){t.exports=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}}},23787:function(t,e,r){var n=r(50967);t.exports=function(t){var e=n(t,function(t){return 500===r.size&&r.clear(),t}),r=e.cache;return e}},20453:function(t,e,r){var n=r(39866)(Object,"create");t.exports=n},77184:function(t,e,r){var n=r(45070)(Object.keys,Object);t.exports=n},39931:function(t,e,r){t=r.nmd(t);var n=r(17071),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,a=i&&i.exports===o&&n.process,u=function(){try{var t=i&&i.require&&i.require("util").types;if(t)return t;return a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=u},45070:function(t){t.exports=function(t,e){return function(r){return t(e(r))}}},49478:function(t,e,r){var n=r(60493),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,a=-1,u=o(i.length-e,0),c=Array(u);++a0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},84092:function(t,e,r){var n=r(99078);t.exports=function(){this.__data__=new n,this.size=0}},31663:function(t){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},69135:function(t){t.exports=function(t){return this.__data__.get(t)}},39552:function(t){t.exports=function(t){return this.__data__.has(t)}},8381:function(t,e,r){var n=r(99078),o=r(88675),i=r(76219);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var a=r.__data__;if(!o||a.length<199)return a.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(a)}return r.set(t,e),this.size=r.size,this}},35281:function(t){t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n-1&&t%1==0&&t<=9007199254740991}},82559:function(t,e,r){var n=r(22345);t.exports=function(t){return n(t)&&t!=+t}},77571:function(t){t.exports=function(t){return null==t}},22345:function(t,e,r){var n=r(54506),o=r(10303);t.exports=function(t){return"number"==typeof t||o(t)&&"[object Number]"==n(t)}},90231:function(t,e,r){var n=r(54506),o=r(62602),i=r(10303),a=Object.prototype,u=Function.prototype.toString,c=a.hasOwnProperty,l=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=c.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==l}},42715:function(t,e,r){var n=r(54506),o=r(25614),i=r(10303);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},9792:function(t,e,r){var n=r(59332),o=r(23305),i=r(39931),a=i&&i.isTypedArray,u=a?o(a):n;t.exports=u},43228:function(t,e,r){var n=r(28579),o=r(4578),i=r(5629);t.exports=function(t){return i(t)?n(t):o(t)}},86185:function(t){t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},89238:function(t,e,r){var n=r(73819),o=r(88157),i=r(24240),a=r(25614);t.exports=function(t,e){return(a(t)?n:i)(t,o(e,3))}},41443:function(t,e,r){var n=r(83023),o=r(98060),i=r(88157);t.exports=function(t,e){var r={};return e=i(e,3),o(t,function(t,o,i){n(r,o,e(t,o,i))}),r}},95645:function(t,e,r){var n=r(67646),o=r(58905),i=r(79586);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},50967:function(t,e,r){var n=r(76219);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},99008:function(t,e,r){var n=r(67646),o=r(20121),i=r(79586);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},93810:function(t){t.exports=function(){}},22350:function(t,e,r){var n=r(18155),o=r(73584),i=r(67352),a=r(70235);t.exports=function(t){return i(t)?n(a(t)):o(t)}},99676:function(t,e,r){var n=r(35464)();t.exports=n},33645:function(t,e,r){var n=r(25253),o=r(88157),i=r(12327),a=r(25614),u=r(49639);t.exports=function(t,e,r){var c=a(t)?n:i;return r&&u(t,e,r)&&(e=void 0),c(t,o(e,3))}},34935:function(t,e,r){var n=r(72569),o=r(84046),i=r(44843),a=r(49639),u=i(function(t,e){if(null==t)return[];var r=e.length;return r>1&&a(t,e[0],e[1])?e=[]:r>2&&a(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])});t.exports=u},55716:function(t){t.exports=function(){return[]}},7406:function(t){t.exports=function(){return!1}},37065:function(t,e,r){var n=r(7310),o=r(28302);t.exports=function(t,e,r){var i=!0,a=!0;if("function"!=typeof t)throw TypeError("Expected a function");return o(r)&&(i="leading"in r?!!r.leading:i,a="trailing"in r?!!r.trailing:a),n(t,e,{leading:i,maxWait:e,trailing:a})}},175:function(t,e,r){var n=r(6660),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-o?(t<0?-1:1)*17976931348623157e292:t==t?t:0:0===t?t:0}},85759:function(t,e,r){var n=r(175);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},3641:function(t,e,r){var n=r(65020);t.exports=function(t){return null==t?"":n(t)}},47230:function(t,e,r){var n=r(88157),o=r(13826);t.exports=function(t,e){return t&&t.length?o(t,n(e,2)):[]}},75551:function(t,e,r){var n=r(80675)("toUpperCase");t.exports=n},48049:function(t,e,r){"use strict";var n=r(14397);function o(){}function i(){}i.resetWarningCache=o,t.exports=function(){function t(t,e,r,o,i,a){if(a!==n){var u=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function e(){return t}t.isRequired=t;var r={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:i,resetWarningCache:o};return r.PropTypes=r,r}},40718:function(t,e,r){t.exports=r(48049)()},14397:function(t){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},84735:function(t,e,r){"use strict";r.d(e,{ZP:function(){return tS}});var n=r(2265),o=r(40718),i=r.n(o),a=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty;function l(t,e){return function(r,n,o){return t(r,n,o)&&e(r,n,o)}}function s(t){return function(e,r,n){if(!e||!r||"object"!=typeof e||"object"!=typeof r)return t(e,r,n);var o=n.cache,i=o.get(e),a=o.get(r);if(i&&a)return i===r&&a===e;o.set(e,r),o.set(r,e);var u=t(e,r,n);return o.delete(e),o.delete(r),u}}function f(t){return a(t).concat(u(t))}var p=Object.hasOwn||function(t,e){return c.call(t,e)};function h(t,e){return t===e||!t&&!e&&t!=t&&e!=e}var d=Object.getOwnPropertyDescriptor,y=Object.keys;function v(t,e,r){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function m(t,e){return h(t.getTime(),e.getTime())}function b(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function g(t,e){return t===e}function x(t,e,r){var n,o,i=t.size;if(i!==e.size)return!1;if(!i)return!0;for(var a=Array(i),u=t.entries(),c=0;(n=u.next())&&!n.done;){for(var l=e.entries(),s=!1,f=0;(o=l.next())&&!o.done;){if(a[f]){f++;continue}var p=n.value,h=o.value;if(r.equals(p[0],h[0],c,f,t,e,r)&&r.equals(p[1],h[1],p[0],h[0],t,e,r)){s=a[f]=!0;break}f++}if(!s)return!1;c++}return!0}function w(t,e,r){var n=y(t),o=n.length;if(y(e).length!==o)return!1;for(;o-- >0;)if(!A(t,e,r,n[o]))return!1;return!0}function O(t,e,r){var n,o,i,a=f(t),u=a.length;if(f(e).length!==u)return!1;for(;u-- >0;)if(!A(t,e,r,n=a[u])||(o=d(t,n),i=d(e,n),(o||i)&&(!o||!i||o.configurable!==i.configurable||o.enumerable!==i.enumerable||o.writable!==i.writable)))return!1;return!0}function j(t,e){return h(t.valueOf(),e.valueOf())}function S(t,e){return t.source===e.source&&t.flags===e.flags}function P(t,e,r){var n,o,i=t.size;if(i!==e.size)return!1;if(!i)return!0;for(var a=Array(i),u=t.values();(n=u.next())&&!n.done;){for(var c=e.values(),l=!1,s=0;(o=c.next())&&!o.done;){if(!a[s]&&r.equals(n.value,o.value,n.value,o.value,t,e,r)){l=a[s]=!0;break}s++}if(!l)return!1}return!0}function E(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}function k(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function A(t,e,r,n){return("_owner"===n||"__o"===n||"__v"===n)&&(!!t.$$typeof||!!e.$$typeof)||p(e,n)&&r.equals(t[n],e[n],n,n,t,e,r)}var M=Array.isArray,_="undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView:null,T=Object.assign,C=Object.prototype.toString.call.bind(Object.prototype.toString),N=D();function D(t){void 0===t&&(t={});var e,r,n,o,i,a,u,c,f,p,d,y,A,N,D=t.circular,I=t.createInternalComparator,L=t.createState,B=t.strict,R=(r=(e=function(t){var e=t.circular,r=t.createCustomConfig,n=t.strict,o={areArraysEqual:n?O:v,areDatesEqual:m,areErrorsEqual:b,areFunctionsEqual:g,areMapsEqual:n?l(x,O):x,areNumbersEqual:h,areObjectsEqual:n?O:w,arePrimitiveWrappersEqual:j,areRegExpsEqual:S,areSetsEqual:n?l(P,O):P,areTypedArraysEqual:n?O:E,areUrlsEqual:k,unknownTagComparators:void 0};if(r&&(o=T({},o,r(o))),e){var i=s(o.areArraysEqual),a=s(o.areMapsEqual),u=s(o.areObjectsEqual),c=s(o.areSetsEqual);o=T({},o,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:u,areSetsEqual:c})}return o}(t)).areArraysEqual,n=e.areDatesEqual,o=e.areErrorsEqual,i=e.areFunctionsEqual,a=e.areMapsEqual,u=e.areNumbersEqual,c=e.areObjectsEqual,f=e.arePrimitiveWrappersEqual,p=e.areRegExpsEqual,d=e.areSetsEqual,y=e.areTypedArraysEqual,A=e.areUrlsEqual,N=e.unknownTagComparators,function(t,e,l){if(t===e)return!0;if(null==t||null==e)return!1;var s=typeof t;if(s!==typeof e)return!1;if("object"!==s)return"number"===s?u(t,e,l):"function"===s&&i(t,e,l);var h=t.constructor;if(h!==e.constructor)return!1;if(h===Object)return c(t,e,l);if(M(t))return r(t,e,l);if(null!=_&&_(t))return y(t,e,l);if(h===Date)return n(t,e,l);if(h===RegExp)return p(t,e,l);if(h===Map)return a(t,e,l);if(h===Set)return d(t,e,l);var v=C(t);if("[object Date]"===v)return n(t,e,l);if("[object RegExp]"===v)return p(t,e,l);if("[object Map]"===v)return a(t,e,l);if("[object Set]"===v)return d(t,e,l);if("[object Object]"===v)return"function"!=typeof t.then&&"function"!=typeof e.then&&c(t,e,l);if("[object URL]"===v)return A(t,e,l);if("[object Error]"===v)return o(t,e,l);if("[object Arguments]"===v)return c(t,e,l);if("[object Boolean]"===v||"[object Number]"===v||"[object String]"===v)return f(t,e,l);if(N){var m=N[v];if(!m){var b=null!=t?t[Symbol.toStringTag]:void 0;b&&(m=N[b])}if(m)return m(t,e,l)}return!1}),z=I?I(R):function(t,e,r,n,o,i,a){return R(t,e,a)};return function(t){var e=t.circular,r=t.comparator,n=t.createState,o=t.equals,i=t.strict;if(n)return function(t,a){var u=n(),c=u.cache;return r(t,a,{cache:void 0===c?e?new WeakMap:void 0:c,equals:o,meta:u.meta,strict:i})};if(e)return function(t,e){return r(t,e,{cache:new WeakMap,equals:o,meta:void 0,strict:i})};var a={cache:void 0,equals:o,meta:void 0,strict:i};return function(t,e){return r(t,e,a)}}({circular:void 0!==D&&D,comparator:R,createState:L,equals:z,strict:void 0!==B&&B})}function I(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=-1;requestAnimationFrame(function n(o){if(r<0&&(r=o),o-r>e)t(o),r=-1;else{var i;i=n,"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame(i)}})}function L(t){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r=0&&t<=1}),"[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s",n);var p=V(i,u),h=V(a,c),d=(t=i,e=u,function(r){var n;return G([].concat(function(t){if(Array.isArray(t))return H(t)}(n=X(t,e).map(function(t,e){return t*e}).slice(1))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||Y(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[0]),r)}),y=function(t){for(var e=t>1?1:t,r=e,n=0;n<8;++n){var o,i=p(r)-e,a=d(r);if(1e-4>Math.abs(i-e)||a<1e-4)break;r=(o=r-i/a)>1?1:o<0?0:o}return h(r)};return y.isStepper=!1,y},Q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.stiff,r=void 0===e?100:e,n=t.damping,o=void 0===n?8:n,i=t.dt,a=void 0===i?17:i,u=function(t,e,n){var i=n+(-(t-e)*r-n*o)*a/1e3,u=n*a/1e3+t;return 1e-4>Math.abs(u-e)&&1e-4>Math.abs(i)?[e,0]:[u,i]};return u.isStepper=!0,u.dt=a,u},J=function(){for(var t=arguments.length,e=Array(t),r=0;rt.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r0?r[o-1]:n,p=l||Object.keys(c);if("function"==typeof u||"spring"===u)return[].concat(th(t),[e.runJSAnimation.bind(e,{from:f.style,to:c,duration:i,easing:u}),i]);var h=Z(p,i,u),d=tv(tv(tv({},f.style),c),{},{transition:h});return[].concat(th(t),[d,i,s]).filter($)},[a,Math.max(void 0===u?0:u,n)])),[t.onAnimationEnd]))}},{key:"runAnimation",value:function(t){if(!this.manager){var e,r,n;this.manager=(e=function(){return null},r=!1,n=function t(n){if(!r){if(Array.isArray(n)){if(!n.length)return;var o=function(t){if(Array.isArray(t))return t}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||function(t,e){if(t){if("string"==typeof t)return B(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(t,void 0)}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=o[0],a=o.slice(1);if("number"==typeof i){I(t.bind(null,a),i);return}t(i),I(t.bind(null,a));return}"object"===L(n)&&e(n),"function"==typeof n&&n()}},{stop:function(){r=!0},start:function(t){r=!1,n(t)},subscribe:function(t){return e=t,function(){e=function(){return null}}}})}var o=t.begin,i=t.duration,a=t.attributeName,u=t.to,c=t.easing,l=t.onAnimationStart,s=t.onAnimationEnd,f=t.steps,p=t.children,h=this.manager;if(this.unSubscribe=h.subscribe(this.handleStyleChange),"function"==typeof c||"function"==typeof p||"spring"===c){this.runJSAnimation(t);return}if(f.length>1){this.runStepAnimation(t);return}var d=a?tm({},a,u):u,y=Z(Object.keys(d),i,c);h.start([l,o,tv(tv({},d),{},{transition:y}),i,s])}},{key:"render",value:function(){var t=this.props,e=t.children,r=(t.begin,t.duration),o=(t.attributeName,t.easing,t.isActive),i=(t.steps,t.from,t.to,t.canBegin,t.onAnimationEnd,t.shouldReAnimate,t.onAnimationReStart,function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,tp)),a=n.Children.count(e),u=this.state.style;if("function"==typeof e)return e(u);if(!o||0===a||r<=0)return e;var c=function(t){var e=t.props,r=e.style,o=e.className;return(0,n.cloneElement)(t,tv(tv({},i),{},{style:tv(tv({},void 0===r?{}:r),u),className:o}))};return 1===a?c(n.Children.only(e)):n.createElement("div",null,n.Children.map(e,function(t){return c(t)}))}}],function(t,e){for(var r=0;r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,w),i=parseInt("".concat(r),10),a=parseInt("".concat(n),10),u=parseInt("".concat(e.height||o.height),10),c=parseInt("".concat(e.width||o.width),10);return P(P(P(P(P({},e),o),i?{x:i}:{}),a?{y:a}:{}),{},{height:u,width:c,name:e.name,radius:e.radius})}function k(t){return n.createElement(x.bn,j({shapeType:"rectangle",propTransformer:E,activeClassName:"recharts-active-bar"},t))}var A=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(r,n){if("number"==typeof t)return t;var o=(0,d.hj)(r)||(0,d.Rw)(r);return o?t(r,n):(o||(0,g.Z)(!1),e)}},M=["value","background"];function _(t){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function T(){return(T=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(e,M);if(!u)return null;var l=N(N(N(N(N({},c),{},{fill:"#eee"},u),a),(0,b.bw)(t.props,e,r)),{},{onAnimationStart:t.handleAnimationStart,onAnimationEnd:t.handleAnimationEnd,dataKey:o,index:r,className:"recharts-bar-background-rectangle"});return n.createElement(k,T({key:"background-bar-".concat(r),option:t.props.background,isActive:r===i},l))})}},{key:"renderErrorBar",value:function(t,e){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var r=this.props,o=r.data,i=r.xAxis,a=r.yAxis,u=r.layout,c=r.children,l=(0,y.NN)(c,f.W);if(!l)return null;var p="vertical"===u?o[0].height/2:o[0].width/2,h=function(t,e){var r=Array.isArray(t.value)?t.value[1]:t.value;return{x:t.x,y:t.y,value:r,errorVal:(0,m.F$)(t,e)}};return n.createElement(s.m,{clipPath:t?"url(#clipPath-".concat(e,")"):null},l.map(function(t){return n.cloneElement(t,{key:"error-bar-".concat(e,"-").concat(t.props.dataKey),data:o,xAxis:i,yAxis:a,layout:u,offset:p,dataPointFormatter:h})}))}},{key:"render",value:function(){var t=this.props,e=t.hide,r=t.data,i=t.className,a=t.xAxis,u=t.yAxis,c=t.left,f=t.top,p=t.width,d=t.height,y=t.isAnimationActive,v=t.background,m=t.id;if(e||!r||!r.length)return null;var b=this.state.isAnimationFinished,g=(0,o.Z)("recharts-bar",i),x=a&&a.allowDataOverflow,w=u&&u.allowDataOverflow,O=x||w,j=l()(m)?this.id:m;return n.createElement(s.m,{className:g},x||w?n.createElement("defs",null,n.createElement("clipPath",{id:"clipPath-".concat(j)},n.createElement("rect",{x:x?c:c-p/2,y:w?f:f-d/2,width:x?p:2*p,height:w?d:2*d}))):null,n.createElement(s.m,{className:"recharts-bar-rectangles",clipPath:O?"url(#clipPath-".concat(j,")"):null},v?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(O,j),(!y||b)&&h.e.renderCallByParent(this.props,r))}}],r=[{key:"getDerivedStateFromProps",value:function(t,e){return t.animationId!==e.prevAnimationId?{prevAnimationId:t.animationId,curData:t.data,prevData:e.curData}:t.data!==e.curData?{curData:t.data}:null}}],e&&D(a.prototype,e),r&&D(a,r),Object.defineProperty(a,"prototype",{writable:!1}),a}(n.PureComponent);R(U,"displayName","Bar"),R(U,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!v.x.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"}),R(U,"getComposedData",function(t){var e=t.props,r=t.item,n=t.barPosition,o=t.bandSize,i=t.xAxis,a=t.yAxis,u=t.xAxisTicks,c=t.yAxisTicks,l=t.stackedData,s=t.dataStartIndex,f=t.displayedData,h=t.offset,v=(0,m.Bu)(n,r);if(!v)return null;var b=e.layout,g=r.type.defaultProps,x=void 0!==g?N(N({},g),r.props):r.props,w=x.dataKey,O=x.children,j=x.minPointSize,S="horizontal"===b?a:i,P=l?S.scale.domain():null,E=(0,m.Yj)({numericAxis:S}),k=(0,y.NN)(O,p.b),M=f.map(function(t,e){l?f=(0,m.Vv)(l[s+e],P):Array.isArray(f=(0,m.F$)(t,w))||(f=[E,f]);var n=A(j,U.defaultProps.minPointSize)(f[1],e);if("horizontal"===b){var f,p,h,y,g,x,O,S=[a.scale(f[0]),a.scale(f[1])],M=S[0],_=S[1];p=(0,m.Fy)({axis:i,ticks:u,bandSize:o,offset:v.offset,entry:t,index:e}),h=null!==(O=null!=_?_:M)&&void 0!==O?O:void 0,y=v.size;var T=M-_;if(g=Number.isNaN(T)?0:T,x={x:p,y:a.y,width:y,height:a.height},Math.abs(n)>0&&Math.abs(g)0&&Math.abs(y)=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function P(t,e){for(var r=0;r0?this.props:d)),o<=0||a<=0||!y||!y.length)?null:n.createElement(s.m,{className:(0,c.Z)("recharts-cartesian-axis",l),ref:function(e){t.layerReference=e}},r&&this.renderAxisLine(),this.renderTicks(y,this.state.fontSize,this.state.letterSpacing),p._.renderCallByParent(this.props))}}],r=[{key:"renderTickItem",value:function(t,e,r){var o=(0,c.Z)(e.className,"recharts-cartesian-axis-tick-value");return n.isValidElement(t)?n.cloneElement(t,j(j({},e),{},{className:o})):i()(t)?t(j(j({},e),{},{className:o})):n.createElement(f.x,w({},e,{className:"recharts-cartesian-axis-tick-value"}),r)}}],e&&P(o.prototype,e),r&&P(o,r),Object.defineProperty(o,"prototype",{writable:!1}),o}(n.Component);M(T,"displayName","CartesianAxis"),M(T,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"})},56940:function(t,e,r){"use strict";r.d(e,{q:function(){return M}});var n=r(2265),o=r(86757),i=r.n(o),a=r(1175),u=r(16630),c=r(82944),l=r(85355),s=r(78242),f=r(80285),p=r(25739),h=["x1","y1","x2","y2","key"],d=["offset"];function y(t){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function m(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var x=function(t){var e=t.fill;if(!e||"none"===e)return null;var r=t.fillOpacity,o=t.x,i=t.y,a=t.width,u=t.height,c=t.ry;return n.createElement("rect",{x:o,y:i,ry:c,width:a,height:u,stroke:"none",fill:e,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function w(t,e){var r;if(n.isValidElement(t))r=n.cloneElement(t,e);else if(i()(t))r=t(e);else{var o=e.x1,a=e.y1,u=e.x2,l=e.y2,s=e.key,f=g(e,h),p=(0,c.L6)(f,!1),y=(p.offset,g(p,d));r=n.createElement("line",b({},y,{x1:o,y1:a,x2:u,y2:l,fill:"none",key:s}))}return r}function O(t){var e=t.x,r=t.width,o=t.horizontal,i=void 0===o||o,a=t.horizontalPoints;if(!i||!a||!a.length)return null;var u=a.map(function(n,o){return w(i,m(m({},t),{},{x1:e,y1:n,x2:e+r,y2:n,key:"line-".concat(o),index:o}))});return n.createElement("g",{className:"recharts-cartesian-grid-horizontal"},u)}function j(t){var e=t.y,r=t.height,o=t.vertical,i=void 0===o||o,a=t.verticalPoints;if(!i||!a||!a.length)return null;var u=a.map(function(n,o){return w(i,m(m({},t),{},{x1:n,y1:e,x2:n,y2:e+r,key:"line-".concat(o),index:o}))});return n.createElement("g",{className:"recharts-cartesian-grid-vertical"},u)}function S(t){var e=t.horizontalFill,r=t.fillOpacity,o=t.x,i=t.y,a=t.width,u=t.height,c=t.horizontalPoints,l=t.horizontal;if(!(void 0===l||l)||!e||!e.length)return null;var s=c.map(function(t){return Math.round(t+i-i)}).sort(function(t,e){return t-e});i!==s[0]&&s.unshift(0);var f=s.map(function(t,c){var l=s[c+1]?s[c+1]-t:i+u-t;if(l<=0)return null;var f=c%e.length;return n.createElement("rect",{key:"react-".concat(c),y:t,x:o,height:l,width:a,stroke:"none",fill:e[f],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return n.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function P(t){var e=t.vertical,r=t.verticalFill,o=t.fillOpacity,i=t.x,a=t.y,u=t.width,c=t.height,l=t.verticalPoints;if(!(void 0===e||e)||!r||!r.length)return null;var s=l.map(function(t){return Math.round(t+i-i)}).sort(function(t,e){return t-e});i!==s[0]&&s.unshift(0);var f=s.map(function(t,e){var l=s[e+1]?s[e+1]-t:i+u-t;if(l<=0)return null;var f=e%r.length;return n.createElement("rect",{key:"react-".concat(e),x:t,y:a,width:l,height:c,stroke:"none",fill:r[f],fillOpacity:o,className:"recharts-cartesian-grid-bg"})});return n.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var E=function(t,e){var r=t.xAxis,n=t.width,o=t.height,i=t.offset;return(0,l.Rf)((0,s.f)(m(m(m({},f.O.defaultProps),r),{},{ticks:(0,l.uY)(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),i.left,i.left+i.width,e)},k=function(t,e){var r=t.yAxis,n=t.width,o=t.height,i=t.offset;return(0,l.Rf)((0,s.f)(m(m(m({},f.O.defaultProps),r),{},{ticks:(0,l.uY)(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),i.top,i.top+i.height,e)},A={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function M(t){var e,r,o,c,l,s,f=(0,p.zn)(),h=(0,p.Mw)(),d=(0,p.qD)(),v=m(m({},t),{},{stroke:null!==(e=t.stroke)&&void 0!==e?e:A.stroke,fill:null!==(r=t.fill)&&void 0!==r?r:A.fill,horizontal:null!==(o=t.horizontal)&&void 0!==o?o:A.horizontal,horizontalFill:null!==(c=t.horizontalFill)&&void 0!==c?c:A.horizontalFill,vertical:null!==(l=t.vertical)&&void 0!==l?l:A.vertical,verticalFill:null!==(s=t.verticalFill)&&void 0!==s?s:A.verticalFill,x:(0,u.hj)(t.x)?t.x:d.left,y:(0,u.hj)(t.y)?t.y:d.top,width:(0,u.hj)(t.width)?t.width:d.width,height:(0,u.hj)(t.height)?t.height:d.height}),g=v.x,w=v.y,M=v.width,_=v.height,T=v.syncWithTicks,C=v.horizontalValues,N=v.verticalValues,D=(0,p.CW)(),I=(0,p.Nf)();if(!(0,u.hj)(M)||M<=0||!(0,u.hj)(_)||_<=0||!(0,u.hj)(g)||g!==+g||!(0,u.hj)(w)||w!==+w)return null;var L=v.verticalCoordinatesGenerator||E,B=v.horizontalCoordinatesGenerator||k,R=v.horizontalPoints,z=v.verticalPoints;if((!R||!R.length)&&i()(B)){var U=C&&C.length,F=B({yAxis:I?m(m({},I),{},{ticks:U?C:I.ticks}):void 0,width:f,height:h,offset:d},!!U||T);(0,a.Z)(Array.isArray(F),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(y(F),"]")),Array.isArray(F)&&(R=F)}if((!z||!z.length)&&i()(L)){var $=N&&N.length,q=L({xAxis:D?m(m({},D),{},{ticks:$?N:D.ticks}):void 0,width:f,height:h,offset:d},!!$||T);(0,a.Z)(Array.isArray(q),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(y(q),"]")),Array.isArray(q)&&(z=q)}return n.createElement("g",{className:"recharts-cartesian-grid"},n.createElement(x,{fill:v.fill,fillOpacity:v.fillOpacity,x:v.x,y:v.y,width:v.width,height:v.height,ry:v.ry}),n.createElement(O,b({},v,{offset:d,horizontalPoints:R,xAxis:D,yAxis:I})),n.createElement(j,b({},v,{offset:d,verticalPoints:z,xAxis:D,yAxis:I})),n.createElement(S,b({},v,{horizontalPoints:R})),n.createElement(P,b({},v,{verticalPoints:z})))}M.displayName="CartesianGrid"},13137:function(t,e,r){"use strict";r.d(e,{W:function(){return v}});var n=r(2265),o=r(69398),i=r(9841),a=r(82944),u=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(){return(l=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,u),m=(0,a.L6)(v,!1);"x"===this.props.direction&&"number"!==d.type&&(0,o.Z)(!1);var b=p.map(function(t){var o,a,u=h(t,f),p=u.x,v=u.y,b=u.value,g=u.errorVal;if(!g)return null;var x=[];if(Array.isArray(g)){var w=function(t){if(Array.isArray(t))return t}(g)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(g,2)||function(t,e){if(t){if("string"==typeof t)return s(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(t,2)}}(g,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();o=w[0],a=w[1]}else o=a=g;if("vertical"===r){var O=d.scale,j=v+e,S=j+c,P=j-c,E=O(b-o),k=O(b+a);x.push({x1:k,y1:S,x2:k,y2:P}),x.push({x1:E,y1:j,x2:k,y2:j}),x.push({x1:E,y1:S,x2:E,y2:P})}else if("horizontal"===r){var A=y.scale,M=p+e,_=M-c,T=M+c,C=A(b-o),N=A(b+a);x.push({x1:_,y1:N,x2:T,y2:N}),x.push({x1:M,y1:C,x2:M,y2:N}),x.push({x1:_,y1:C,x2:T,y2:C})}return n.createElement(i.m,l({className:"recharts-errorBar",key:"bar-".concat(x.map(function(t){return"".concat(t.x1,"-").concat(t.x2,"-").concat(t.y1,"-").concat(t.y2)}))},m),x.map(function(t){return n.createElement("line",l({},t,{key:"line-".concat(t.x1,"-").concat(t.x2,"-").concat(t.y1,"-").concat(t.y2)}))}))});return n.createElement(i.m,{className:"recharts-errorBars"},b)}}],function(t,e){for(var r=0;rt*o)return!1;var i=r();return t*(e-t*i/2-n)>=0&&t*(e+t*i/2-o)<=0}function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function h(t){for(var e=1;e=2?(0,i.uY)(m[1].coordinate-m[0].coordinate):1,M=(n="width"===P,f=b.x,p=b.y,d=b.width,y=b.height,1===A?{start:n?f:p,end:n?f+d:p+y}:{start:n?f+d:p+y,end:n?f:p});return"equidistantPreserveStart"===w?function(t,e,r,n,o){for(var i,a=(n||[]).slice(),u=e.start,c=e.end,f=0,p=1,h=u;p<=a.length;)if(i=function(){var e,i=null==n?void 0:n[f];if(void 0===i)return{v:l(n,p)};var a=f,d=function(){return void 0===e&&(e=r(i,a)),e},y=i.coordinate,v=0===f||s(t,y,d,h,c);v||(f=0,h=u,p+=1),v&&(h=y+t*(d()/2+o),f+=p)}())return i.v;return[]}(A,M,k,m,g):("preserveStart"===w||"preserveStartEnd"===w?function(t,e,r,n,o,i){var a=(n||[]).slice(),u=a.length,c=e.start,l=e.end;if(i){var f=n[u-1],p=r(f,u-1),d=t*(f.coordinate+t*p/2-l);a[u-1]=f=h(h({},f),{},{tickCoord:d>0?f.coordinate-d*t:f.coordinate}),s(t,f.tickCoord,function(){return p},c,l)&&(l=f.tickCoord-t*(p/2+o),a[u-1]=h(h({},f),{},{isShow:!0}))}for(var y=i?u-1:u,v=function(e){var n,i=a[e],u=function(){return void 0===n&&(n=r(i,e)),n};if(0===e){var f=t*(i.coordinate-t*u()/2-c);a[e]=i=h(h({},i),{},{tickCoord:f<0?i.coordinate-f*t:i.coordinate})}else a[e]=i=h(h({},i),{},{tickCoord:i.coordinate});s(t,i.tickCoord,u,c,l)&&(c=i.tickCoord+t*(u()/2+o),a[e]=h(h({},i),{},{isShow:!0}))},m=0;m0?l.coordinate-p*t:l.coordinate})}else i[e]=l=h(h({},l),{},{tickCoord:l.coordinate});s(t,l.tickCoord,f,u,c)&&(c=l.tickCoord-t*(f()/2+o),i[e]=h(h({},l),{},{isShow:!0}))},f=a-1;f>=0;f--)l(f);return i}(A,M,k,m,g)).filter(function(t){return t.isShow})}},93765:function(t,e,r){"use strict";r.d(e,{z:function(){return eD}});var n,o,i=r(2265),a=r(77571),u=r.n(a),c=r(86757),l=r.n(c),s=r(99676),f=r.n(s),p=r(13735),h=r.n(p),d=r(34935),y=r.n(d),v=r(37065),m=r.n(v),b=r(61994),g=r(69398),x=r(48777),w=r(9841),O=r(8147),j=r(22190),S=r(81889),P=r(73649),E=r(82944),k=r(55284),A=r(58811),M=r(85355),_=r(16630);function T(t){return(T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function N(t){for(var e=1;e0&&e.handleDrag(t.changedTouches[0])}),W(e,"handleDragEnd",function(){e.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var t=e.props,r=t.endIndex,n=t.onDragEnd,o=t.startIndex;null==n||n({endIndex:r,startIndex:o})}),e.detachDragEndListener()}),W(e,"handleLeaveWrapper",function(){(e.state.isTravellerMoving||e.state.isSlideMoving)&&(e.leaveTimer=window.setTimeout(e.handleDragEnd,e.props.leaveTimeOut))}),W(e,"handleEnterSlideOrTraveller",function(){e.setState({isTextActive:!0})}),W(e,"handleLeaveSlideOrTraveller",function(){e.setState({isTextActive:!1})}),W(e,"handleSlideDragStart",function(t){var r=X(t)?t.changedTouches[0]:t;e.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:r.pageX}),e.attachDragEndListener()}),e.travellerDragStartHandlers={startX:e.handleTravellerDragStart.bind(e,"startX"),endX:e.handleTravellerDragStart.bind(e,"endX")},e.state={},e}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Z(t,e)}(n,t),e=[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(t){var e=t.startX,r=t.endX,o=this.state.scaleValues,i=this.props,a=i.gap,u=i.data.length-1,c=n.getIndexInRange(o,Math.min(e,r)),l=n.getIndexInRange(o,Math.max(e,r));return{startIndex:c-c%a,endIndex:l===u?u:l-l%a}}},{key:"getTextOfTick",value:function(t){var e=this.props,r=e.data,n=e.tickFormatter,o=e.dataKey,i=(0,M.F$)(r[t],o,t);return l()(n)?n(i,t):i}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(t){var e=this.state,r=e.slideMoveStartX,n=e.startX,o=e.endX,i=this.props,a=i.x,u=i.width,c=i.travellerWidth,l=i.startIndex,s=i.endIndex,f=i.onChange,p=t.pageX-r;p>0?p=Math.min(p,a+u-c-o,a+u-c-n):p<0&&(p=Math.max(p,a-n,a-o));var h=this.getIndex({startX:n+p,endX:o+p});(h.startIndex!==l||h.endIndex!==s)&&f&&f(h),this.setState({startX:n+p,endX:o+p,slideMoveStartX:t.pageX})}},{key:"handleTravellerDragStart",value:function(t,e){var r=X(e)?e.changedTouches[0]:e;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:t,brushMoveStartX:r.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(t){var e=this.state,r=e.brushMoveStartX,n=e.movingTravellerId,o=e.endX,i=e.startX,a=this.state[n],u=this.props,c=u.x,l=u.width,s=u.travellerWidth,f=u.onChange,p=u.gap,h=u.data,d={startX:this.state.startX,endX:this.state.endX},y=t.pageX-r;y>0?y=Math.min(y,c+l-s-a):y<0&&(y=Math.max(y,c-a)),d[n]=a+y;var v=this.getIndex(d),m=v.startIndex,b=v.endIndex,g=function(){var t=h.length-1;return"startX"===n&&(o>i?m%p==0:b%p==0)||oi?b%p==0:m%p==0)||o>i&&b===t};this.setState(W(W({},n,a+y),"brushMoveStartX",t.pageX),function(){f&&g()&&f(v)})}},{key:"handleTravellerMoveKeyboard",value:function(t,e){var r=this,n=this.state,o=n.scaleValues,i=n.startX,a=n.endX,u=this.state[e],c=o.indexOf(u);if(-1!==c){var l=c+t;if(-1!==l&&!(l>=o.length)){var s=o[l];"startX"===e&&s>=a||"endX"===e&&s<=i||this.setState(W({},e,s),function(){r.props.onChange(r.getIndex({startX:r.state.startX,endX:r.state.endX}))})}}}},{key:"renderBackground",value:function(){var t=this.props,e=t.x,r=t.y,n=t.width,o=t.height,a=t.fill,u=t.stroke;return i.createElement("rect",{stroke:u,fill:a,x:e,y:r,width:n,height:o})}},{key:"renderPanorama",value:function(){var t=this.props,e=t.x,r=t.y,n=t.width,o=t.height,a=t.data,u=t.children,c=t.padding,l=i.Children.only(u);return l?i.cloneElement(l,{x:e,y:r,width:n,height:o,margin:c,compact:!0,data:a}):null}},{key:"renderTravellerLayer",value:function(t,e){var r,o,a=this,u=this.props,c=u.y,l=u.travellerWidth,s=u.height,f=u.traveller,p=u.ariaLabel,h=u.data,d=u.startIndex,y=u.endIndex,v=Math.max(t,this.props.x),m=U(U({},(0,E.L6)(this.props,!1)),{},{x:v,y:c,width:l,height:s}),b=p||"Min value: ".concat(null===(r=h[d])||void 0===r?void 0:r.name,", Max value: ").concat(null===(o=h[y])||void 0===o?void 0:o.name);return i.createElement(w.m,{tabIndex:0,role:"slider","aria-label":b,"aria-valuenow":t,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[e],onTouchStart:this.travellerDragStartHandlers[e],onKeyDown:function(t){["ArrowLeft","ArrowRight"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),a.handleTravellerMoveKeyboard("ArrowRight"===t.key?1:-1,e))},onFocus:function(){a.setState({isTravellerFocused:!0})},onBlur:function(){a.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},n.renderTraveller(f,m))}},{key:"renderSlide",value:function(t,e){var r=this.props,n=r.y,o=r.height,a=r.stroke,u=r.travellerWidth;return i.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:a,fillOpacity:.2,x:Math.min(t,e)+u,y:n,width:Math.max(Math.abs(e-t)-u,0),height:o})}},{key:"renderText",value:function(){var t=this.props,e=t.startIndex,r=t.endIndex,n=t.y,o=t.height,a=t.travellerWidth,u=t.stroke,c=this.state,l=c.startX,s=c.endX,f={pointerEvents:"none",fill:u};return i.createElement(w.m,{className:"recharts-brush-texts"},i.createElement(A.x,R({textAnchor:"end",verticalAnchor:"middle",x:Math.min(l,s)-5,y:n+o/2},f),this.getTextOfTick(e)),i.createElement(A.x,R({textAnchor:"start",verticalAnchor:"middle",x:Math.max(l,s)+a+5,y:n+o/2},f),this.getTextOfTick(r)))}},{key:"render",value:function(){var t=this.props,e=t.data,r=t.className,n=t.children,o=t.x,a=t.y,u=t.width,c=t.height,l=t.alwaysShowText,s=this.state,f=s.startX,p=s.endX,h=s.isTextActive,d=s.isSlideMoving,y=s.isTravellerMoving,v=s.isTravellerFocused;if(!e||!e.length||!(0,_.hj)(o)||!(0,_.hj)(a)||!(0,_.hj)(u)||!(0,_.hj)(c)||u<=0||c<=0)return null;var m=(0,b.Z)("recharts-brush",r),g=1===i.Children.count(n),x=L("userSelect","none");return i.createElement(w.m,{className:m,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:x},this.renderBackground(),g&&this.renderPanorama(),this.renderSlide(f,p),this.renderTravellerLayer(f,"startX"),this.renderTravellerLayer(p,"endX"),(h||d||y||v||l)&&this.renderText())}}],r=[{key:"renderDefaultTraveller",value:function(t){var e=t.x,r=t.y,n=t.width,o=t.height,a=t.stroke,u=Math.floor(r+o/2)-1;return i.createElement(i.Fragment,null,i.createElement("rect",{x:e,y:r,width:n,height:o,fill:a,stroke:"none"}),i.createElement("line",{x1:e+1,y1:u,x2:e+n-1,y2:u,fill:"none",stroke:"#fff"}),i.createElement("line",{x1:e+1,y1:u+2,x2:e+n-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(t,e){return i.isValidElement(t)?i.cloneElement(t,e):l()(t)?t(e):n.renderDefaultTraveller(e)}},{key:"getDerivedStateFromProps",value:function(t,e){var r=t.data,n=t.width,o=t.x,i=t.travellerWidth,a=t.updateId,u=t.startIndex,c=t.endIndex;if(r!==e.prevData||a!==e.prevUpdateId)return U({prevData:r,prevTravellerWidth:i,prevUpdateId:a,prevX:o,prevWidth:n},r&&r.length?H({data:r,width:n,x:o,travellerWidth:i,startIndex:u,endIndex:c}):{scale:null,scaleValues:null});if(e.scale&&(n!==e.prevWidth||o!==e.prevX||i!==e.prevTravellerWidth)){e.scale.range([o,o+n-i]);var l=e.scale.domain().map(function(t){return e.scale(t)});return{prevData:r,prevTravellerWidth:i,prevUpdateId:a,prevX:o,prevWidth:n,startX:e.scale(t.startIndex),endX:e.scale(t.endIndex),scaleValues:l}}return null}},{key:"getIndexInRange",value:function(t,e){for(var r=t.length,n=0,o=r-1;o-n>1;){var i=Math.floor((n+o)/2);t[i]>e?o=i:n=i}return e>=t[o]?o:n}}],e&&F(n.prototype,e),r&&F(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n}(i.PureComponent);W(G,"displayName","Brush"),W(G,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var V=r(4094),K=r(38569),Q=r(26680),J=function(t,e){var r=t.alwaysShow,n=t.ifOverflow;return r&&(n="extendDomain"),n===e},tt=r(25311),te=r(1175);function tr(){return(tr=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);rt.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,t2));return(0,_.hj)(r)&&(0,_.hj)(o)&&(0,_.hj)(f)&&(0,_.hj)(h)&&(0,_.hj)(u)&&(0,_.hj)(l)?i.createElement("path",t5({},(0,E.L6)(y,!0),{className:(0,b.Z)("recharts-cross",d),d:"M".concat(r,",").concat(u,"v").concat(h,"M").concat(l,",").concat(o,"h").concat(f)})):null};function t7(t){var e=t.cx,r=t.cy,n=t.radius,o=t.startAngle,i=t.endAngle;return{points:[(0,tq.op)(e,r,n,o),(0,tq.op)(e,r,n,i)],cx:e,cy:r,radius:n,startAngle:o,endAngle:i}}var t4=r(60474);function t8(t){return(t8="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function t9(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function et(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function ec(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ec=function(){return!!t})()}function el(t){return(el=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function es(t,e){return(es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function ef(t){return function(t){if(Array.isArray(t))return eh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ep(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ep(t,e){if(t){if("string"==typeof t)return eh(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eh(t,e)}}function eh(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0?i:t&&t.length&&(0,_.hj)(n)&&(0,_.hj)(o)?t.slice(n,o+1):[]};function eS(t){return"number"===t?[0,"auto"]:void 0}var eP=function(t,e,r,n){var o=t.graphicalItems,i=t.tooltipAxis,a=ej(e,t);return r<0||!o||!o.length||r>=a.length?null:o.reduce(function(o,u){var c,l,s=null!==(c=u.props.data)&&void 0!==c?c:e;if(s&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(s=s.slice(t.dataStartIndex,t.dataEndIndex+1)),i.dataKey&&!i.allowDuplicatedCategory){var f=void 0===s?a:s;l=(0,_.Ap)(f,i.dataKey,n)}else l=s&&s[r]||a[r];return l?[].concat(ef(o),[(0,M.Qo)(u,l)]):o},[])},eE=function(t,e,r,n){var o=n||{x:t.chartX,y:t.chartY},i="horizontal"===r?o.x:"vertical"===r?o.y:"centric"===r?o.angle:o.radius,a=t.orderedTooltipTicks,u=t.tooltipAxis,c=t.tooltipTicks,l=(0,M.VO)(i,a,c,u);if(l>=0&&c){var s=c[l]&&c[l].value,f=eP(t,e,l,s),p=eO(r,a,l,o);return{activeTooltipIndex:l,activeLabel:s,activePayload:f,activeCoordinate:p}}return null},ek=function(t,e){var r=e.axes,n=e.graphicalItems,o=e.axisType,i=e.axisIdKey,a=e.stackGroups,c=e.dataStartIndex,l=e.dataEndIndex,s=t.layout,p=t.children,h=t.stackOffset,d=(0,M.NA)(s,o);return r.reduce(function(e,r){var y=void 0!==r.type.defaultProps?ey(ey({},r.type.defaultProps),r.props):r.props,v=y.type,m=y.dataKey,b=y.allowDataOverflow,g=y.allowDuplicatedCategory,x=y.scale,w=y.ticks,O=y.includeHidden,j=y[i];if(e[j])return e;var S=ej(t.data,{graphicalItems:n.filter(function(t){var e;return(i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i])===j}),dataStartIndex:c,dataEndIndex:l}),P=S.length;(function(t,e,r){if("number"===r&&!0===e&&Array.isArray(t)){var n=null==t?void 0:t[0],o=null==t?void 0:t[1];if(n&&o&&(0,_.hj)(n)&&(0,_.hj)(o))return!0}return!1})(y.domain,b,v)&&(A=(0,M.LG)(y.domain,null,b),d&&("number"===v||"auto"!==x)&&(C=(0,M.gF)(S,m,"category")));var E=eS(v);if(!A||0===A.length){var k,A,T,C,N,D=null!==(N=y.domain)&&void 0!==N?N:E;if(m){if(A=(0,M.gF)(S,m,v),"category"===v&&d){var I=(0,_.bv)(A);g&&I?(T=A,A=f()(0,P)):g||(A=(0,M.ko)(D,A,r).reduce(function(t,e){return t.indexOf(e)>=0?t:[].concat(ef(t),[e])},[]))}else if("category"===v)A=g?A.filter(function(t){return""!==t&&!u()(t)}):(0,M.ko)(D,A,r).reduce(function(t,e){return t.indexOf(e)>=0||""===e||u()(e)?t:[].concat(ef(t),[e])},[]);else if("number"===v){var L=(0,M.ZI)(S,n.filter(function(t){var e,r,n=i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i],o="hide"in t.props?t.props.hide:null===(r=t.type.defaultProps)||void 0===r?void 0:r.hide;return n===j&&(O||!o)}),m,o,s);L&&(A=L)}d&&("number"===v||"auto"!==x)&&(C=(0,M.gF)(S,m,"category"))}else A=d?f()(0,P):a&&a[j]&&a[j].hasStack&&"number"===v?"expand"===h?[0,1]:(0,M.EB)(a[j].stackGroups,c,l):(0,M.s6)(S,n.filter(function(t){var e=i in t.props?t.props[i]:t.type.defaultProps[i],r="hide"in t.props?t.props.hide:t.type.defaultProps.hide;return e===j&&(O||!r)}),v,s,!0);"number"===v?(A=t$(p,A,j,o,w),D&&(A=(0,M.LG)(D,A,b))):"category"===v&&D&&A.every(function(t){return D.indexOf(t)>=0})&&(A=D)}return ey(ey({},e),{},ev({},j,ey(ey({},y),{},{axisType:o,domain:A,categoricalDomain:C,duplicateDomain:T,originalDomain:null!==(k=y.domain)&&void 0!==k?k:E,isCategorical:d,layout:s})))},{})},eA=function(t,e){var r=e.graphicalItems,n=e.Axis,o=e.axisType,i=e.axisIdKey,a=e.stackGroups,u=e.dataStartIndex,c=e.dataEndIndex,l=t.layout,s=t.children,p=ej(t.data,{graphicalItems:r,dataStartIndex:u,dataEndIndex:c}),d=p.length,y=(0,M.NA)(l,o),v=-1;return r.reduce(function(t,e){var m,b=(void 0!==e.type.defaultProps?ey(ey({},e.type.defaultProps),e.props):e.props)[i],g=eS("number");return t[b]?t:(v++,m=y?f()(0,d):a&&a[b]&&a[b].hasStack?t$(s,m=(0,M.EB)(a[b].stackGroups,u,c),b,o):t$(s,m=(0,M.LG)(g,(0,M.s6)(p,r.filter(function(t){var e,r,n=i in t.props?t.props[i]:null===(e=t.type.defaultProps)||void 0===e?void 0:e[i],o="hide"in t.props?t.props.hide:null===(r=t.type.defaultProps)||void 0===r?void 0:r.hide;return n===b&&!o}),"number",l),n.defaultProps.allowDataOverflow),b,o),ey(ey({},t),{},ev({},b,ey(ey({axisType:o},n.defaultProps),{},{hide:!0,orientation:h()(eb,"".concat(o,".").concat(v%2),null),domain:m,originalDomain:g,isCategorical:y,layout:l}))))},{})},eM=function(t,e){var r=e.axisType,n=void 0===r?"xAxis":r,o=e.AxisComp,i=e.graphicalItems,a=e.stackGroups,u=e.dataStartIndex,c=e.dataEndIndex,l=t.children,s="".concat(n,"Id"),f=(0,E.NN)(l,o),p={};return f&&f.length?p=ek(t,{axes:f,graphicalItems:i,axisType:n,axisIdKey:s,stackGroups:a,dataStartIndex:u,dataEndIndex:c}):i&&i.length&&(p=eA(t,{Axis:o,graphicalItems:i,axisType:n,axisIdKey:s,stackGroups:a,dataStartIndex:u,dataEndIndex:c})),p},e_=function(t){var e=(0,_.Kt)(t),r=(0,M.uY)(e,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:y()(r,function(t){return t.coordinate}),tooltipAxis:e,tooltipAxisBandSize:(0,M.zT)(e,r)}},eT=function(t){var e=t.children,r=t.defaultShowTooltip,n=(0,E.sP)(e,G),o=0,i=0;return t.data&&0!==t.data.length&&(i=t.data.length-1),n&&n.props&&(n.props.startIndex>=0&&(o=n.props.startIndex),n.props.endIndex>=0&&(i=n.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:i,activeTooltipIndex:-1,isTooltipActive:!!r}},eC=function(t){return"horizontal"===t?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:"vertical"===t?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:"centric"===t?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},eN=function(t,e){var r=t.props,n=t.graphicalItems,o=t.xAxisMap,i=void 0===o?{}:o,a=t.yAxisMap,u=void 0===a?{}:a,c=r.width,l=r.height,s=r.children,f=r.margin||{},p=(0,E.sP)(s,G),d=(0,E.sP)(s,j.D),y=Object.keys(u).reduce(function(t,e){var r=u[e],n=r.orientation;return r.mirror||r.hide?t:ey(ey({},t),{},ev({},n,t[n]+r.width))},{left:f.left||0,right:f.right||0}),v=Object.keys(i).reduce(function(t,e){var r=i[e],n=r.orientation;return r.mirror||r.hide?t:ey(ey({},t),{},ev({},n,h()(t,"".concat(n))+r.height))},{top:f.top||0,bottom:f.bottom||0}),m=ey(ey({},v),y),b=m.bottom;p&&(m.bottom+=p.props.height||G.defaultProps.height),d&&e&&(m=(0,M.By)(m,n,r,e));var g=c-m.left-m.right,x=l-m.top-m.bottom;return ey(ey({brushBottom:b},m),{},{width:Math.max(g,0),height:Math.max(x,0)})},eD=function(t){var e=t.chartName,r=t.GraphicalChild,n=t.defaultTooltipEventType,o=void 0===n?"axis":n,a=t.validateTooltipEventTypes,c=void 0===a?["axis"]:a,s=t.axisComponents,f=t.legendContent,p=t.formatAxisMap,d=t.defaultProps,y=function(t,e){var r=e.graphicalItems,n=e.stackGroups,o=e.offset,i=e.updateId,a=e.dataStartIndex,c=e.dataEndIndex,l=t.barSize,f=t.layout,p=t.barGap,h=t.barCategoryGap,d=t.maxBarSize,y=eC(f),v=y.numericAxisName,m=y.cateAxisName,b=!!r&&!!r.length&&r.some(function(t){var e=(0,E.Gf)(t&&t.type);return e&&e.indexOf("Bar")>=0}),x=[];return r.forEach(function(r,y){var w=ej(t.data,{graphicalItems:[r],dataStartIndex:a,dataEndIndex:c}),O=void 0!==r.type.defaultProps?ey(ey({},r.type.defaultProps),r.props):r.props,j=O.dataKey,S=O.maxBarSize,P=O["".concat(v,"Id")],k=O["".concat(m,"Id")],A=s.reduce(function(t,r){var n=e["".concat(r.axisType,"Map")],o=O["".concat(r.axisType,"Id")];n&&n[o]||"zAxis"===r.axisType||(0,g.Z)(!1);var i=n[o];return ey(ey({},t),{},ev(ev({},r.axisType,i),"".concat(r.axisType,"Ticks"),(0,M.uY)(i)))},{}),_=A[m],T=A["".concat(m,"Ticks")],C=n&&n[P]&&n[P].hasStack&&(0,M.O3)(r,n[P].stackGroups),N=(0,E.Gf)(r.type).indexOf("Bar")>=0,D=(0,M.zT)(_,T),I=[],L=b&&(0,M.pt)({barSize:l,stackGroups:n,totalSize:"xAxis"===m?A[m].width:"yAxis"===m?A[m].height:void 0});if(N){var B,R,z=u()(S)?d:S,U=null!==(B=null!==(R=(0,M.zT)(_,T,!0))&&void 0!==R?R:z)&&void 0!==B?B:0;I=(0,M.qz)({barGap:p,barCategoryGap:h,bandSize:U!==D?U:D,sizeList:L[k],maxBarSize:z}),U!==D&&(I=I.map(function(t){return ey(ey({},t),{},{position:ey(ey({},t.position),{},{offset:t.position.offset-U/2})})}))}var F=r&&r.type&&r.type.getComposedData;F&&x.push({props:ey(ey({},F(ey(ey({},A),{},{displayedData:w,props:t,dataKey:j,item:r,bandSize:D,barPosition:I,offset:o,stackedData:C,layout:f,dataStartIndex:a,dataEndIndex:c}))),{},ev(ev(ev({key:r.key||"item-".concat(y)},v,A[v]),m,A[m]),"animationId",i)),childIndex:(0,E.$R)(r,t.children),item:r})}),x},v=function(t,n){var o=t.props,i=t.dataStartIndex,a=t.dataEndIndex,u=t.updateId;if(!(0,E.TT)({props:o}))return null;var c=o.children,l=o.layout,f=o.stackOffset,h=o.data,d=o.reverseStackOrder,v=eC(l),m=v.numericAxisName,b=v.cateAxisName,g=(0,E.NN)(c,r),x=(0,M.wh)(h,g,"".concat(m,"Id"),"".concat(b,"Id"),f,d),w=s.reduce(function(t,e){var r="".concat(e.axisType,"Map");return ey(ey({},t),{},ev({},r,eM(o,ey(ey({},e),{},{graphicalItems:g,stackGroups:e.axisType===m&&x,dataStartIndex:i,dataEndIndex:a}))))},{}),O=eN(ey(ey({},w),{},{props:o,graphicalItems:g}),null==n?void 0:n.legendBBox);Object.keys(w).forEach(function(t){w[t]=p(o,w[t],O,t.replace("Map",""),e)});var j=e_(w["".concat(b,"Map")]),S=y(o,ey(ey({},w),{},{dataStartIndex:i,dataEndIndex:a,updateId:u,graphicalItems:g,stackGroups:x,offset:O}));return ey(ey({formattedGraphicalItems:S,graphicalItems:g,offset:O,stackGroups:x},j),w)},j=function(t){var r;function n(t){var r,o,a,c,s;return!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,n),c=n,s=[t],c=el(c),ev(a=function(t,e){if(e&&("object"===eo(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,ec()?Reflect.construct(c,s||[],el(this).constructor):c.apply(this,s)),"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ev(a,"accessibilityManager",new tQ),ev(a,"handleLegendBBoxUpdate",function(t){if(t){var e=a.state,r=e.dataStartIndex,n=e.dataEndIndex,o=e.updateId;a.setState(ey({legendBBox:t},v({props:a.props,dataStartIndex:r,dataEndIndex:n,updateId:o},ey(ey({},a.state),{},{legendBBox:t}))))}}),ev(a,"handleReceiveSyncEvent",function(t,e,r){a.props.syncId===t&&(r!==a.eventEmitterSymbol||"function"==typeof a.props.syncMethod)&&a.applySyncEvent(e)}),ev(a,"handleBrushChange",function(t){var e=t.startIndex,r=t.endIndex;if(e!==a.state.dataStartIndex||r!==a.state.dataEndIndex){var n=a.state.updateId;a.setState(function(){return ey({dataStartIndex:e,dataEndIndex:r},v({props:a.props,dataStartIndex:e,dataEndIndex:r,updateId:n},a.state))}),a.triggerSyncEvent({dataStartIndex:e,dataEndIndex:r})}}),ev(a,"handleMouseEnter",function(t){var e=a.getMouseInfo(t);if(e){var r=ey(ey({},e),{},{isTooltipActive:!0});a.setState(r),a.triggerSyncEvent(r);var n=a.props.onMouseEnter;l()(n)&&n(r,t)}}),ev(a,"triggeredAfterMouseMove",function(t){var e=a.getMouseInfo(t),r=e?ey(ey({},e),{},{isTooltipActive:!0}):{isTooltipActive:!1};a.setState(r),a.triggerSyncEvent(r);var n=a.props.onMouseMove;l()(n)&&n(r,t)}),ev(a,"handleItemMouseEnter",function(t){a.setState(function(){return{isTooltipActive:!0,activeItem:t,activePayload:t.tooltipPayload,activeCoordinate:t.tooltipPosition||{x:t.cx,y:t.cy}}})}),ev(a,"handleItemMouseLeave",function(){a.setState(function(){return{isTooltipActive:!1}})}),ev(a,"handleMouseMove",function(t){t.persist(),a.throttleTriggeredAfterMouseMove(t)}),ev(a,"handleMouseLeave",function(t){a.throttleTriggeredAfterMouseMove.cancel();var e={isTooltipActive:!1};a.setState(e),a.triggerSyncEvent(e);var r=a.props.onMouseLeave;l()(r)&&r(e,t)}),ev(a,"handleOuterEvent",function(t){var e,r=(0,E.Bh)(t),n=h()(a.props,"".concat(r));r&&l()(n)&&n(null!==(e=/.*touch.*/i.test(r)?a.getMouseInfo(t.changedTouches[0]):a.getMouseInfo(t))&&void 0!==e?e:{},t)}),ev(a,"handleClick",function(t){var e=a.getMouseInfo(t);if(e){var r=ey(ey({},e),{},{isTooltipActive:!0});a.setState(r),a.triggerSyncEvent(r);var n=a.props.onClick;l()(n)&&n(r,t)}}),ev(a,"handleMouseDown",function(t){var e=a.props.onMouseDown;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleMouseUp",function(t){var e=a.props.onMouseUp;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleTouchMove",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.throttleTriggeredAfterMouseMove(t.changedTouches[0])}),ev(a,"handleTouchStart",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.handleMouseDown(t.changedTouches[0])}),ev(a,"handleTouchEnd",function(t){null!=t.changedTouches&&t.changedTouches.length>0&&a.handleMouseUp(t.changedTouches[0])}),ev(a,"handleDoubleClick",function(t){var e=a.props.onDoubleClick;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"handleContextMenu",function(t){var e=a.props.onContextMenu;l()(e)&&e(a.getMouseInfo(t),t)}),ev(a,"triggerSyncEvent",function(t){void 0!==a.props.syncId&&tY.emit(tH,a.props.syncId,t,a.eventEmitterSymbol)}),ev(a,"applySyncEvent",function(t){var e=a.props,r=e.layout,n=e.syncMethod,o=a.state.updateId,i=t.dataStartIndex,u=t.dataEndIndex;if(void 0!==t.dataStartIndex||void 0!==t.dataEndIndex)a.setState(ey({dataStartIndex:i,dataEndIndex:u},v({props:a.props,dataStartIndex:i,dataEndIndex:u,updateId:o},a.state)));else if(void 0!==t.activeTooltipIndex){var c=t.chartX,l=t.chartY,s=t.activeTooltipIndex,f=a.state,p=f.offset,h=f.tooltipTicks;if(!p)return;if("function"==typeof n)s=n(h,t);else if("value"===n){s=-1;for(var d=0;d=0){if(s.dataKey&&!s.allowDuplicatedCategory){var A="function"==typeof s.dataKey?function(t){return"function"==typeof s.dataKey?s.dataKey(t.payload):null}:"payload.".concat(s.dataKey.toString());C=(0,_.Ap)(v,A,p),N=m&&b&&(0,_.Ap)(b,A,p)}else C=null==v?void 0:v[f],N=m&&b&&b[f];if(S||j){var T=void 0!==t.props.activeIndex?t.props.activeIndex:f;return[(0,i.cloneElement)(t,ey(ey(ey({},n.props),P),{},{activeIndex:T})),null,null]}if(!u()(C))return[k].concat(ef(a.renderActivePoints({item:n,activePoint:C,basePoint:N,childIndex:f,isRange:m})))}else{var C,N,D,I=(null!==(D=a.getItemByXY(a.state.activeCoordinate))&&void 0!==D?D:{graphicalItem:k}).graphicalItem,L=I.item,B=void 0===L?t:L,R=I.childIndex,z=ey(ey(ey({},n.props),P),{},{activeIndex:R});return[(0,i.cloneElement)(B,z),null,null]}}return m?[k,null,null]:[k,null]}),ev(a,"renderCustomized",function(t,e,r){return(0,i.cloneElement)(t,ey(ey({key:"recharts-customized-".concat(r)},a.props),a.state))}),ev(a,"renderMap",{CartesianGrid:{handler:ew,once:!0},ReferenceArea:{handler:a.renderReferenceElement},ReferenceLine:{handler:ew},ReferenceDot:{handler:a.renderReferenceElement},XAxis:{handler:ew},YAxis:{handler:ew},Brush:{handler:a.renderBrush,once:!0},Bar:{handler:a.renderGraphicChild},Line:{handler:a.renderGraphicChild},Area:{handler:a.renderGraphicChild},Radar:{handler:a.renderGraphicChild},RadialBar:{handler:a.renderGraphicChild},Scatter:{handler:a.renderGraphicChild},Pie:{handler:a.renderGraphicChild},Funnel:{handler:a.renderGraphicChild},Tooltip:{handler:a.renderCursor,once:!0},PolarGrid:{handler:a.renderPolarGrid,once:!0},PolarAngleAxis:{handler:a.renderPolarAxis},PolarRadiusAxis:{handler:a.renderPolarAxis},Customized:{handler:a.renderCustomized}}),a.clipPathId="".concat(null!==(r=t.id)&&void 0!==r?r:(0,_.EL)("recharts"),"-clip"),a.throttleTriggeredAfterMouseMove=m()(a.triggeredAfterMouseMove,null!==(o=t.throttleDelay)&&void 0!==o?o:1e3/60),a.state={},a}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&es(t,e)}(n,t),r=[{key:"componentDidMount",value:function(){var t,e;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:null!==(t=this.props.margin.left)&&void 0!==t?t:0,top:null!==(e=this.props.margin.top)&&void 0!==e?e:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var t=this.props,e=t.children,r=t.data,n=t.height,o=t.layout,i=(0,E.sP)(e,O.u);if(i){var a=i.props.defaultIndex;if("number"==typeof a&&!(a<0)&&!(a>this.state.tooltipTicks.length-1)){var u=this.state.tooltipTicks[a]&&this.state.tooltipTicks[a].value,c=eP(this.state,r,a,u),l=this.state.tooltipTicks[a].coordinate,s=(this.state.offset.top+n)/2,f="horizontal"===o?{x:l,y:s}:{y:l,x:s},p=this.state.formattedGraphicalItems.find(function(t){return"Scatter"===t.item.type.name});p&&(f=ey(ey({},f),p.props.points[a].tooltipPosition),c=p.props.points[a].tooltipPayload);var h={activeTooltipIndex:a,isTooltipActive:!0,activeLabel:u,activePayload:c,activeCoordinate:f};this.setState(h),this.renderCursor(i),this.accessibilityManager.setIndex(a)}}}},{key:"getSnapshotBeforeUpdate",value:function(t,e){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==e.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==t.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==t.margin){var r,n;this.accessibilityManager.setDetails({offset:{left:null!==(r=this.props.margin.left)&&void 0!==r?r:0,top:null!==(n=this.props.margin.top)&&void 0!==n?n:0}})}return null}},{key:"componentDidUpdate",value:function(t){(0,E.rL)([(0,E.sP)(t.children,O.u)],[(0,E.sP)(this.props.children,O.u)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var t=(0,E.sP)(this.props.children,O.u);if(t&&"boolean"==typeof t.props.shared){var e=t.props.shared?"axis":"item";return c.indexOf(e)>=0?e:o}return o}},{key:"getMouseInfo",value:function(t){if(!this.container)return null;var e=this.container,r=e.getBoundingClientRect(),n=(0,V.os)(r),o={chartX:Math.round(t.pageX-n.left),chartY:Math.round(t.pageY-n.top)},i=r.width/e.offsetWidth||1,a=this.inRange(o.chartX,o.chartY,i);if(!a)return null;var u=this.state,c=u.xAxisMap,l=u.yAxisMap,s=this.getTooltipEventType(),f=eE(this.state,this.props.data,this.props.layout,a);if("axis"!==s&&c&&l){var p=(0,_.Kt)(c).scale,h=(0,_.Kt)(l).scale,d=p&&p.invert?p.invert(o.chartX):null,y=h&&h.invert?h.invert(o.chartY):null;return ey(ey({},o),{},{xValue:d,yValue:y},f)}return f?ey(ey({},o),f):null}},{key:"inRange",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=this.props.layout,o=t/r,i=e/r;if("horizontal"===n||"vertical"===n){var a=this.state.offset;return o>=a.left&&o<=a.left+a.width&&i>=a.top&&i<=a.top+a.height?{x:o,y:i}:null}var u=this.state,c=u.angleAxisMap,l=u.radiusAxisMap;if(c&&l){var s=(0,_.Kt)(c);return(0,tq.z3)({x:o,y:i},s)}return null}},{key:"parseEventsOfWrapper",value:function(){var t=this.props.children,e=this.getTooltipEventType(),r=(0,E.sP)(t,O.u),n={};return r&&"axis"===e&&(n="click"===r.props.trigger?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),ey(ey({},(0,tX.Ym)(this.props,this.handleOuterEvent)),n)}},{key:"addListener",value:function(){tY.on(tH,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){tY.removeListener(tH,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(t,e,r){for(var n=this.state.formattedGraphicalItems,o=0,i=n.length;ot.length)&&(e=t.length);for(var r=0,n=Array(e);r=0?1:-1;"insideStart"===u?(o=b+S*l,a=w):"insideEnd"===u?(o=g-S*l,a=!w):"end"===u&&(o=g+S*l,a=w),a=j<=0?a:!a;var P=(0,d.op)(p,y,O,o),E=(0,d.op)(p,y,O,o+(a?1:-1)*359),k="M".concat(P.x,",").concat(P.y,"\n A").concat(O,",").concat(O,",0,1,").concat(a?0:1,",\n ").concat(E.x,",").concat(E.y),A=i()(t.id)?(0,h.EL)("recharts-radial-line-"):t.id;return n.createElement("text",x({},r,{dominantBaseline:"central",className:(0,s.Z)("recharts-radial-bar-label",f)}),n.createElement("defs",null,n.createElement("path",{id:A,d:k})),n.createElement("textPath",{xlinkHref:"#".concat(A)},e))},j=function(t){var e=t.viewBox,r=t.offset,n=t.position,o=e.cx,i=e.cy,a=e.innerRadius,u=e.outerRadius,c=(e.startAngle+e.endAngle)/2;if("outside"===n){var l=(0,d.op)(o,i,u+r,c),s=l.x;return{x:s,y:l.y,textAnchor:s>=o?"start":"end",verticalAnchor:"middle"}}if("center"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"middle"};if("centerTop"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"start"};if("centerBottom"===n)return{x:o,y:i,textAnchor:"middle",verticalAnchor:"end"};var f=(0,d.op)(o,i,(a+u)/2,c);return{x:f.x,y:f.y,textAnchor:"middle",verticalAnchor:"middle"}},S=function(t){var e=t.viewBox,r=t.parentViewBox,n=t.offset,o=t.position,i=e.x,a=e.y,u=e.width,c=e.height,s=c>=0?1:-1,f=s*n,p=s>0?"end":"start",d=s>0?"start":"end",y=u>=0?1:-1,v=y*n,m=y>0?"end":"start",b=y>0?"start":"end";if("top"===o)return g(g({},{x:i+u/2,y:a-s*n,textAnchor:"middle",verticalAnchor:p}),r?{height:Math.max(a-r.y,0),width:u}:{});if("bottom"===o)return g(g({},{x:i+u/2,y:a+c+f,textAnchor:"middle",verticalAnchor:d}),r?{height:Math.max(r.y+r.height-(a+c),0),width:u}:{});if("left"===o){var x={x:i-v,y:a+c/2,textAnchor:m,verticalAnchor:"middle"};return g(g({},x),r?{width:Math.max(x.x-r.x,0),height:c}:{})}if("right"===o){var w={x:i+u+v,y:a+c/2,textAnchor:b,verticalAnchor:"middle"};return g(g({},w),r?{width:Math.max(r.x+r.width-w.x,0),height:c}:{})}var O=r?{width:u,height:c}:{};return"insideLeft"===o?g({x:i+v,y:a+c/2,textAnchor:b,verticalAnchor:"middle"},O):"insideRight"===o?g({x:i+u-v,y:a+c/2,textAnchor:m,verticalAnchor:"middle"},O):"insideTop"===o?g({x:i+u/2,y:a+f,textAnchor:"middle",verticalAnchor:d},O):"insideBottom"===o?g({x:i+u/2,y:a+c-f,textAnchor:"middle",verticalAnchor:p},O):"insideTopLeft"===o?g({x:i+v,y:a+f,textAnchor:b,verticalAnchor:d},O):"insideTopRight"===o?g({x:i+u-v,y:a+f,textAnchor:m,verticalAnchor:d},O):"insideBottomLeft"===o?g({x:i+v,y:a+c-f,textAnchor:b,verticalAnchor:p},O):"insideBottomRight"===o?g({x:i+u-v,y:a+c-f,textAnchor:m,verticalAnchor:p},O):l()(o)&&((0,h.hj)(o.x)||(0,h.hU)(o.x))&&((0,h.hj)(o.y)||(0,h.hU)(o.y))?g({x:i+(0,h.h1)(o.x,u),y:a+(0,h.h1)(o.y,c),textAnchor:"end",verticalAnchor:"end"},O):g({x:i+u/2,y:a+c/2,textAnchor:"middle",verticalAnchor:"middle"},O)};function P(t){var e,r=t.offset,o=g({offset:void 0===r?5:r},function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,v)),a=o.viewBox,c=o.position,l=o.value,d=o.children,y=o.content,m=o.className,b=o.textBreakAll;if(!a||i()(l)&&i()(d)&&!(0,n.isValidElement)(y)&&!u()(y))return null;if((0,n.isValidElement)(y))return(0,n.cloneElement)(y,o);if(u()(y)){if(e=(0,n.createElement)(y,o),(0,n.isValidElement)(e))return e}else e=w(o);var P="cx"in a&&(0,h.hj)(a.cx),E=(0,p.L6)(o,!0);if(P&&("insideStart"===c||"insideEnd"===c||"end"===c))return O(o,e,E);var k=P?j(o):S(o);return n.createElement(f.x,x({className:(0,s.Z)("recharts-label",void 0===m?"":m)},E,k,{breakAll:b}),e)}P.displayName="Label";var E=function(t){var e=t.cx,r=t.cy,n=t.angle,o=t.startAngle,i=t.endAngle,a=t.r,u=t.radius,c=t.innerRadius,l=t.outerRadius,s=t.x,f=t.y,p=t.top,d=t.left,y=t.width,v=t.height,m=t.clockWise,b=t.labelViewBox;if(b)return b;if((0,h.hj)(y)&&(0,h.hj)(v)){if((0,h.hj)(s)&&(0,h.hj)(f))return{x:s,y:f,width:y,height:v};if((0,h.hj)(p)&&(0,h.hj)(d))return{x:p,y:d,width:y,height:v}}return(0,h.hj)(s)&&(0,h.hj)(f)?{x:s,y:f,width:0,height:0}:(0,h.hj)(e)&&(0,h.hj)(r)?{cx:e,cy:r,startAngle:o||n||0,endAngle:i||n||0,innerRadius:c||0,outerRadius:l||u||a||0,clockWise:m}:t.viewBox?t.viewBox:{}};P.parseViewBox=E,P.renderCallByParent=function(t,e){var r,o,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!t||!t.children&&i&&!t.label)return null;var a=t.children,c=E(t),s=(0,p.NN)(a,P).map(function(t,r){return(0,n.cloneElement)(t,{viewBox:e||c,key:"label-".concat(r)})});return i?[(r=t.label,o=e||c,r?!0===r?n.createElement(P,{key:"label-implicit",viewBox:o}):(0,h.P2)(r)?n.createElement(P,{key:"label-implicit",viewBox:o,value:r}):(0,n.isValidElement)(r)?r.type===P?(0,n.cloneElement)(r,{key:"label-implicit",viewBox:o}):n.createElement(P,{key:"label-implicit",content:r,viewBox:o}):u()(r)?n.createElement(P,{key:"label-implicit",content:r,viewBox:o}):l()(r)?n.createElement(P,x({viewBox:o},r,{key:"label-implicit"})):null:null)].concat(function(t){if(Array.isArray(t))return m(t)}(s)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(s)||function(t,e){if(t){if("string"==typeof t)return m(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(t,void 0)}}(s)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):s}},58772:function(t,e,r){"use strict";r.d(e,{e:function(){return P}});var n=r(2265),o=r(77571),i=r.n(o),a=r(28302),u=r.n(a),c=r(86757),l=r.n(c),s=r(86185),f=r.n(s),p=r(26680),h=r(9841),d=r(82944),y=r(85355);function v(t){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var m=["valueAccessor"],b=["data","dataKey","clockWise","id","textBreakAll"];function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}var S=function(t){return Array.isArray(t.value)?f()(t.value):t.value};function P(t){var e=t.valueAccessor,r=void 0===e?S:e,o=j(t,m),a=o.data,u=o.dataKey,c=o.clockWise,l=o.id,s=o.textBreakAll,f=j(o,b);return a&&a.length?n.createElement(h.m,{className:"recharts-label-list"},a.map(function(t,e){var o=i()(u)?r(t,e):(0,y.F$)(t&&t.payload,u),a=i()(l)?{}:{id:"".concat(l,"-").concat(e)};return n.createElement(p._,x({},(0,d.L6)(t,!0),f,a,{parentViewBox:t.parentViewBox,value:o,textBreakAll:s,viewBox:p._.parseViewBox(i()(c)?t:O(O({},t),{},{clockWise:c})),key:"label-".concat(e),index:e}))})):null}P.displayName="LabelList",P.renderCallByParent=function(t,e){var r,o=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!t||!t.children&&o&&!t.label)return null;var i=t.children,a=(0,d.NN)(i,P).map(function(t,r){return(0,n.cloneElement)(t,{data:e,key:"labelList-".concat(r)})});return o?[(r=t.label)?!0===r?n.createElement(P,{key:"labelList-implicit",data:e}):n.isValidElement(r)||l()(r)?n.createElement(P,{key:"labelList-implicit",data:e,content:r}):u()(r)?n.createElement(P,x({data:e},r,{key:"labelList-implicit"})):null:null].concat(function(t){if(Array.isArray(t))return g(t)}(a)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(a)||function(t,e){if(t){if("string"==typeof t)return g(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(t,void 0)}}(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):a}},22190:function(t,e,r){"use strict";r.d(e,{D:function(){return N}});var n=r(2265),o=r(86757),i=r.n(o),a=r(61994),u=r(1175),c=r(48777),l=r(14870),s=r(41637);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(){return(p=Object.assign?Object.assign.bind():function(t){for(var e=1;e');var x=e.inactive?h:e.color;return n.createElement("li",p({className:b,style:y,key:"legend-item-".concat(r)},(0,s.bw)(t.props,e,r)),n.createElement(c.T,{width:o,height:o,viewBox:d,style:v},t.renderIcon(e)),n.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},l?l(g,e,r):g))})}},{key:"render",value:function(){var t=this.props,e=t.payload,r=t.layout,o=t.align;return e&&e.length?n.createElement("ul",{className:"recharts-default-legend",style:{padding:0,margin:0,textAlign:"horizontal"===r?o:"left"}},this.renderItems()):null}}],function(t,e){for(var r=0;r1||Math.abs(e.height-this.lastBoundingBox.height)>1)&&(this.lastBoundingBox.width=e.width,this.lastBoundingBox.height=e.height,t&&t(e)):(-1!==this.lastBoundingBox.width||-1!==this.lastBoundingBox.height)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,t&&t(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?P({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(t){var e,r,n=this.props,o=n.layout,i=n.align,a=n.verticalAlign,u=n.margin,c=n.chartWidth,l=n.chartHeight;return t&&(void 0!==t.left&&null!==t.left||void 0!==t.right&&null!==t.right)||(e="center"===i&&"vertical"===o?{left:((c||0)-this.getBBoxSnapshot().width)/2}:"right"===i?{right:u&&u.right||0}:{left:u&&u.left||0}),t&&(void 0!==t.top&&null!==t.top||void 0!==t.bottom&&null!==t.bottom)||(r="middle"===a?{top:((l||0)-this.getBBoxSnapshot().height)/2}:"bottom"===a?{bottom:u&&u.bottom||0}:{top:u&&u.top||0}),P(P({},e),r)}},{key:"render",value:function(){var t=this,e=this.props,r=e.content,o=e.width,i=e.height,a=e.wrapperStyle,u=e.payloadUniqBy,c=e.payload,l=P(P({position:"absolute",width:o||"auto",height:i||"auto"},this.getDefaultPosition(a)),a);return n.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(e){t.wrapperNode=e}},function(t,e){if(n.isValidElement(t))return n.cloneElement(t,e);if("function"==typeof t)return n.createElement(t,e);e.ref;var r=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(e,j);return n.createElement(g,r)}(r,P(P({},this.props),{},{payload:(0,w.z)(c,u,C)})))}}],r=[{key:"getWithHeight",value:function(t,e){var r=P(P({},this.defaultProps),t.props).layout;return"vertical"===r&&(0,x.hj)(t.props.height)?{height:t.props.height}:"horizontal"===r?{width:t.props.width||e}:null}}],e&&E(o.prototype,e),r&&E(o,r),Object.defineProperty(o,"prototype",{writable:!1}),o}(n.PureComponent);_(N,"displayName","Legend"),_(N,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"})},47625:function(t,e,r){"use strict";r.d(e,{h:function(){return d}});var n=r(61994),o=r(2265),i=r(37065),a=r.n(i),u=r(16630),c=r(1175),l=r(82944);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function p(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&(t=a()(t,S,{trailing:!0,leading:!1}));var e=new ResizeObserver(t),r=M.current.getBoundingClientRect();return D(r.width,r.height),e.observe(M.current),function(){e.disconnect()}},[D,S]);var I=(0,o.useMemo)(function(){var t=C.containerWidth,e=C.containerHeight;if(t<0||e<0)return null;(0,c.Z)((0,u.hU)(y)||(0,u.hU)(m),"The width(%s) and height(%s) are both fixed numbers,\n maybe you don't need to use a ResponsiveContainer.",y,m),(0,c.Z)(!i||i>0,"The aspect(%s) must be greater than zero.",i);var r=(0,u.hU)(y)?t:y,n=(0,u.hU)(m)?e:m;i&&i>0&&(r?n=r/i:n&&(r=n*i),w&&n>w&&(n=w)),(0,c.Z)(r>0||n>0,"The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.",r,n,y,m,g,x,i);var a=!Array.isArray(O)&&(0,l.Gf)(O.type).endsWith("Chart");return o.Children.map(O,function(t){return o.isValidElement(t)?(0,o.cloneElement)(t,p({width:r,height:n},a?{style:p({height:"100%",width:"100%",maxHeight:n,maxWidth:r},t.props.style)}:{})):t})},[i,O,m,w,x,g,C,y]);return o.createElement("div",{id:P?"".concat(P):void 0,className:(0,n.Z)("recharts-responsive-container",E),style:p(p({},void 0===A?{}:A),{},{width:y,height:m,minWidth:g,minHeight:x,maxHeight:w}),ref:M},I)})},58811:function(t,e,r){"use strict";r.d(e,{x:function(){return B}});var n=r(2265),o=r(77571),i=r.n(o),a=r(61994),u=r(16630),c=r(34067),l=r(82944),s=r(4094);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return h(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function M(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return _(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r0&&void 0!==arguments[0]?arguments[0]:[];return t.reduce(function(t,e){var i=e.word,a=e.width,u=t[t.length-1];return u&&(null==n||o||u.width+a+ra||e.reduce(function(t,e){return t.width>e.width?t:e}).width>Number(n),e]},y=0,v=c.length-1,m=0;y<=v&&m<=c.length-1;){var b=Math.floor((y+v)/2),g=M(d(b-1),2),x=g[0],w=g[1],O=M(d(b),1)[0];if(x||O||(y=b+1),x&&O&&(v=b-1),!x&&O){i=w;break}m++}return i||h},D=function(t){return[{words:i()(t)?[]:t.toString().split(T)}]},I=function(t){var e=t.width,r=t.scaleToFit,n=t.children,o=t.style,i=t.breakAll,a=t.maxLines;if((e||r)&&!c.x.isSsr){var u=C({breakAll:i,children:n,style:o});return u?N({breakAll:i,children:n,maxLines:a,style:o},u.wordsWithComputedWidth,u.spaceWidth,e,r):D(n)}return D(n)},L="#808080",B=function(t){var e,r=t.x,o=void 0===r?0:r,i=t.y,c=void 0===i?0:i,s=t.lineHeight,f=void 0===s?"1em":s,p=t.capHeight,h=void 0===p?"0.71em":p,d=t.scaleToFit,y=void 0!==d&&d,v=t.textAnchor,m=t.verticalAnchor,b=t.fill,g=void 0===b?L:b,x=A(t,P),w=(0,n.useMemo)(function(){return I({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:y,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,y,x.style,x.width]),O=x.dx,j=x.dy,M=x.angle,_=x.className,T=x.breakAll,C=A(x,E);if(!(0,u.P2)(o)||!(0,u.P2)(c))return null;var N=o+((0,u.hj)(O)?O:0),D=c+((0,u.hj)(j)?j:0);switch(void 0===m?"end":m){case"start":e=S("calc(".concat(h,")"));break;case"middle":e=S("calc(".concat((w.length-1)/2," * -").concat(f," + (").concat(h," / 2))"));break;default:e=S("calc(".concat(w.length-1," * -").concat(f,")"))}var B=[];if(y){var R=w[0].width,z=x.width;B.push("scale(".concat(((0,u.hj)(z)?z/R:1)/R,")"))}return M&&B.push("rotate(".concat(M,", ").concat(N,", ").concat(D,")")),B.length&&(C.transform=B.join(" ")),n.createElement("text",k({},(0,l.L6)(C,!0),{x:N,y:D,className:(0,a.Z)("recharts-text",_),textAnchor:void 0===v?"start":v,fill:g.includes("url")?L:g}),w.map(function(t,r){var o=t.words.join(T?"":" ");return n.createElement("tspan",{x:N,dy:0===r?e:f,key:"".concat(o,"-").concat(r)},o)}))}},8147:function(t,e,r){"use strict";r.d(e,{u:function(){return $}});var n=r(2265),o=r(34935),i=r.n(o),a=r(77571),u=r.n(a),c=r(61994),l=r(16630);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(){return(f=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);rc[n]+s?Math.max(f,c[n]):Math.max(p,c[n])}function O(t){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function S(t){for(var e=1;e1||Math.abs(t.height-this.state.lastBoundingBox.height)>1)&&this.setState({lastBoundingBox:{width:t.width,height:t.height}})}else(-1!==this.state.lastBoundingBox.width||-1!==this.state.lastBoundingBox.height)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var t,e;this.props.active&&this.updateBBox(),this.state.dismissed&&((null===(t=this.props.coordinate)||void 0===t?void 0:t.x)!==this.state.dismissedAtCoordinate.x||(null===(e=this.props.coordinate)||void 0===e?void 0:e.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var t,e,r,o,i,a,u,s,f,p,h,d,y,v,m,O,j,P,E,k=this,A=this.props,M=A.active,_=A.allowEscapeViewBox,T=A.animationDuration,C=A.animationEasing,N=A.children,D=A.coordinate,I=A.hasPayload,L=A.isAnimationActive,B=A.offset,R=A.position,z=A.reverseDirection,U=A.useTranslate3d,F=A.viewBox,$=A.wrapperStyle,q=(d=(t={allowEscapeViewBox:_,coordinate:D,offsetTopLeft:B,position:R,reverseDirection:z,tooltipBox:this.state.lastBoundingBox,useTranslate3d:U,viewBox:F}).allowEscapeViewBox,y=t.coordinate,v=t.offsetTopLeft,m=t.position,O=t.reverseDirection,j=t.tooltipBox,P=t.useTranslate3d,E=t.viewBox,j.height>0&&j.width>0&&y?(r=(e={translateX:p=w({allowEscapeViewBox:d,coordinate:y,key:"x",offsetTopLeft:v,position:m,reverseDirection:O,tooltipDimension:j.width,viewBox:E,viewBoxDimension:E.width}),translateY:h=w({allowEscapeViewBox:d,coordinate:y,key:"y",offsetTopLeft:v,position:m,reverseDirection:O,tooltipDimension:j.height,viewBox:E,viewBoxDimension:E.height}),useTranslate3d:P}).translateX,o=e.translateY,f={transform:e.useTranslate3d?"translate3d(".concat(r,"px, ").concat(o,"px, 0)"):"translate(".concat(r,"px, ").concat(o,"px)")}):f=x,{cssProperties:f,cssClasses:(a=(i={translateX:p,translateY:h,coordinate:y}).coordinate,u=i.translateX,s=i.translateY,(0,c.Z)(g,b(b(b(b({},"".concat(g,"-right"),(0,l.hj)(u)&&a&&(0,l.hj)(a.x)&&u>=a.x),"".concat(g,"-left"),(0,l.hj)(u)&&a&&(0,l.hj)(a.x)&&u=a.y),"".concat(g,"-top"),(0,l.hj)(s)&&a&&(0,l.hj)(a.y)&&s0;return n.createElement(_,{allowEscapeViewBox:i,animationDuration:a,animationEasing:u,isAnimationActive:f,active:o,coordinate:l,hasPayload:O,offset:p,position:y,reverseDirection:m,useTranslate3d:b,viewBox:g,wrapperStyle:x},(t=I(I({},this.props),{},{payload:w}),n.isValidElement(c)?n.cloneElement(c,t):"function"==typeof c?n.createElement(c,t):n.createElement(v,t)))}}],function(t,e){for(var r=0;r=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,a),s=(0,o.Z)("recharts-layer",c);return n.createElement("g",u({className:s},(0,i.L6)(l,!0),{ref:e}),r)})},48777:function(t,e,r){"use strict";r.d(e,{T:function(){return c}});var n=r(2265),o=r(61994),i=r(82944),a=["children","width","height","viewBox","className","style","title","desc"];function u(){return(u=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,a),y=l||{width:r,height:c,x:0,y:0},v=(0,o.Z)("recharts-surface",s);return n.createElement("svg",u({},(0,i.L6)(d,!0,"svg"),{className:v,width:r,height:c,style:f,viewBox:"".concat(y.x," ").concat(y.y," ").concat(y.width," ").concat(y.height)}),n.createElement("title",null,p),n.createElement("desc",null,h),e)}},25739:function(t,e,r){"use strict";r.d(e,{br:function(){return g},CW:function(){return O},Mw:function(){return A},zn:function(){return k},sp:function(){return x},qD:function(){return E},d2:function(){return P},bH:function(){return w},Ud:function(){return S},Nf:function(){return j}});var n=r(2265),o=r(69398),i=r(84173),a=r.n(i),u=r(32242),c=r.n(u),l=r(50967),s=r.n(l)()(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),f=r(16630),p=(0,n.createContext)(void 0),h=(0,n.createContext)(void 0),d=(0,n.createContext)(void 0),y=(0,n.createContext)({}),v=(0,n.createContext)(void 0),m=(0,n.createContext)(0),b=(0,n.createContext)(0),g=function(t){var e=t.state,r=e.xAxisMap,o=e.yAxisMap,i=e.offset,a=t.clipPathId,u=t.children,c=t.width,l=t.height,f=s(i);return n.createElement(p.Provider,{value:r},n.createElement(h.Provider,{value:o},n.createElement(y.Provider,{value:i},n.createElement(d.Provider,{value:f},n.createElement(v.Provider,{value:a},n.createElement(m.Provider,{value:l},n.createElement(b.Provider,{value:c},u)))))))},x=function(){return(0,n.useContext)(v)},w=function(t){var e=(0,n.useContext)(p);null!=e||(0,o.Z)(!1);var r=e[t];return null!=r||(0,o.Z)(!1),r},O=function(){var t=(0,n.useContext)(p);return(0,f.Kt)(t)},j=function(){var t=(0,n.useContext)(h);return a()(t,function(t){return c()(t.domain,Number.isFinite)})||(0,f.Kt)(t)},S=function(t){var e=(0,n.useContext)(h);null!=e||(0,o.Z)(!1);var r=e[t];return null!=r||(0,o.Z)(!1),r},P=function(){return(0,n.useContext)(d)},E=function(){return(0,n.useContext)(y)},k=function(){return(0,n.useContext)(b)},A=function(){return(0,n.useContext)(m)}},57165:function(t,e,r){"use strict";r.d(e,{H:function(){return H}});var n=r(2265);function o(){}function i(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function a(t){this._context=t}function u(t){this._context=t}function c(t){this._context=t}a.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:i(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},u.prototype={areaStart:o,areaEnd:o,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},c.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:i(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};class l{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}function s(t){this._context=t}function f(t){this._context=t}function p(t){return new f(t)}function h(t,e,r){var n=t._x1-t._x0,o=e-t._x1,i=(t._y1-t._y0)/(n||o<0&&-0),a=(r-t._y1)/(o||n<0&&-0);return((i<0?-1:1)+(a<0?-1:1))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs((i*o+a*n)/(n+o)))||0}function d(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function y(t,e,r){var n=t._x0,o=t._y0,i=t._x1,a=t._y1,u=(i-n)/3;t._context.bezierCurveTo(n+u,o+u*e,i-u,a-u*r,i,a)}function v(t){this._context=t}function m(t){this._context=new b(t)}function b(t){this._context=t}function g(t){this._context=t}function x(t){var e,r,n=t.length-1,o=Array(n),i=Array(n),a=Array(n);for(o[0]=0,i[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)o[e]=(a[e]-o[e+1])/i[e];for(e=0,i[n-1]=(t[n]+o[n-1])/2;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}}this._x=t,this._y=e}};var O=r(22516),j=r(76115),S=r(67790);function P(t){return t[0]}function E(t){return t[1]}function k(t,e){var r=(0,j.Z)(!0),n=null,o=p,i=null,a=(0,S.d)(u);function u(u){var c,l,s,f=(u=(0,O.Z)(u)).length,p=!1;for(null==n&&(i=o(s=a())),c=0;c<=f;++c)!(c=f;--p)u.point(m[p],b[p]);u.lineEnd(),u.areaEnd()}}v&&(m[s]=+t(h,s,l),b[s]=+e(h,s,l),u.point(n?+n(h,s,l):m[s],r?+r(h,s,l):b[s]))}if(d)return u=null,d+""||null}function s(){return k().defined(o).curve(a).context(i)}return t="function"==typeof t?t:void 0===t?P:(0,j.Z)(+t),e="function"==typeof e?e:void 0===e?(0,j.Z)(0):(0,j.Z)(+e),r="function"==typeof r?r:void 0===r?E:(0,j.Z)(+r),l.x=function(e){return arguments.length?(t="function"==typeof e?e:(0,j.Z)(+e),n=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:(0,j.Z)(+e),l):t},l.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:(0,j.Z)(+t),l):n},l.y=function(t){return arguments.length?(e="function"==typeof t?t:(0,j.Z)(+t),r=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:(0,j.Z)(+t),l):e},l.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:(0,j.Z)(+t),l):r},l.lineX0=l.lineY0=function(){return s().x(t).y(e)},l.lineY1=function(){return s().x(t).y(r)},l.lineX1=function(){return s().x(n).y(e)},l.defined=function(t){return arguments.length?(o="function"==typeof t?t:(0,j.Z)(!!t),l):o},l.curve=function(t){return arguments.length?(a=t,null!=i&&(u=a(i)),l):a},l.context=function(t){return arguments.length?(null==t?i=u=null:u=a(i=t),l):i},l}var M=r(75551),_=r.n(M),T=r(86757),C=r.n(T),N=r(61994),D=r(41637),I=r(82944),L=r(16630);function B(t){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function R(){return(R=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r=0?1:-1,c=r>=0?1:-1,l=n>=0&&r>=0||n<0&&r<0?1:0;if(a>0&&o instanceof Array){for(var s=[0,0,0,0],f=0;f<4;f++)s[f]=o[f]>a?a:o[f];i="M".concat(t,",").concat(e+u*s[0]),s[0]>0&&(i+="A ".concat(s[0],",").concat(s[0],",0,0,").concat(l,",").concat(t+c*s[0],",").concat(e)),i+="L ".concat(t+r-c*s[1],",").concat(e),s[1]>0&&(i+="A ".concat(s[1],",").concat(s[1],",0,0,").concat(l,",\n ").concat(t+r,",").concat(e+u*s[1])),i+="L ".concat(t+r,",").concat(e+n-u*s[2]),s[2]>0&&(i+="A ".concat(s[2],",").concat(s[2],",0,0,").concat(l,",\n ").concat(t+r-c*s[2],",").concat(e+n)),i+="L ".concat(t+c*s[3],",").concat(e+n),s[3]>0&&(i+="A ".concat(s[3],",").concat(s[3],",0,0,").concat(l,",\n ").concat(t,",").concat(e+n-u*s[3])),i+="Z"}else if(a>0&&o===+o&&o>0){var p=Math.min(a,o);i="M ".concat(t,",").concat(e+u*p,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+c*p,",").concat(e,"\n L ").concat(t+r-c*p,",").concat(e,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+r,",").concat(e+u*p,"\n L ").concat(t+r,",").concat(e+n-u*p,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t+r-c*p,",").concat(e+n,"\n L ").concat(t+c*p,",").concat(e+n,"\n A ").concat(p,",").concat(p,",0,0,").concat(l,",").concat(t,",").concat(e+n-u*p," Z")}else i="M ".concat(t,",").concat(e," h ").concat(r," v ").concat(n," h ").concat(-r," Z");return i},h=function(t,e){if(!t||!e)return!1;var r=t.x,n=t.y,o=e.x,i=e.y,a=e.width,u=e.height;return!!(Math.abs(a)>0&&Math.abs(u)>0)&&r>=Math.min(o,o+a)&&r<=Math.max(o,o+a)&&n>=Math.min(i,i+u)&&n<=Math.max(i,i+u)},d={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},y=function(t){var e,r=f(f({},d),t),u=(0,n.useRef)(),s=function(t){if(Array.isArray(t))return t}(e=(0,n.useState)(-1))||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,2)||function(t,e){if(t){if("string"==typeof t)return l(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(t,2)}}(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),h=s[0],y=s[1];(0,n.useEffect)(function(){if(u.current&&u.current.getTotalLength)try{var t=u.current.getTotalLength();t&&y(t)}catch(t){}},[]);var v=r.x,m=r.y,b=r.width,g=r.height,x=r.radius,w=r.className,O=r.animationEasing,j=r.animationDuration,S=r.animationBegin,P=r.isAnimationActive,E=r.isUpdateAnimationActive;if(v!==+v||m!==+m||b!==+b||g!==+g||0===b||0===g)return null;var k=(0,o.Z)("recharts-rectangle",w);return E?n.createElement(i.ZP,{canBegin:h>0,from:{width:b,height:g,x:v,y:m},to:{width:b,height:g,x:v,y:m},duration:j,animationEasing:O,isActive:E},function(t){var e=t.width,o=t.height,l=t.x,s=t.y;return n.createElement(i.ZP,{canBegin:h>0,from:"0px ".concat(-1===h?1:h,"px"),to:"".concat(h,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:j,isActive:P,easing:O},n.createElement("path",c({},(0,a.L6)(r,!0),{className:k,d:p(l,s,e,o,x),ref:u})))}):n.createElement("path",c({},(0,a.L6)(r,!0),{className:k,d:p(v,m,b,g,x)}))}},60474:function(t,e,r){"use strict";r.d(e,{L:function(){return v}});var n=r(2265),o=r(61994),i=r(82944),a=r(39206),u=r(16630);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(){return(l=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(c>s),",\n ").concat(p.x,",").concat(p.y,"\n ");if(o>0){var d=(0,a.op)(r,n,o,c),y=(0,a.op)(r,n,o,s);h+="L ".concat(y.x,",").concat(y.y,"\n A ").concat(o,",").concat(o,",0,\n ").concat(+(Math.abs(l)>180),",").concat(+(c<=s),",\n ").concat(d.x,",").concat(d.y," Z")}else h+="L ".concat(r,",").concat(n," Z");return h},d=function(t){var e=t.cx,r=t.cy,n=t.innerRadius,o=t.outerRadius,i=t.cornerRadius,a=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,s=t.endAngle,f=(0,u.uY)(s-l),d=p({cx:e,cy:r,radius:o,angle:l,sign:f,cornerRadius:i,cornerIsExternal:c}),y=d.circleTangency,v=d.lineTangency,m=d.theta,b=p({cx:e,cy:r,radius:o,angle:s,sign:-f,cornerRadius:i,cornerIsExternal:c}),g=b.circleTangency,x=b.lineTangency,w=b.theta,O=c?Math.abs(l-s):Math.abs(l-s)-m-w;if(O<0)return a?"M ".concat(v.x,",").concat(v.y,"\n a").concat(i,",").concat(i,",0,0,1,").concat(2*i,",0\n a").concat(i,",").concat(i,",0,0,1,").concat(-(2*i),",0\n "):h({cx:e,cy:r,innerRadius:n,outerRadius:o,startAngle:l,endAngle:s});var j="M ".concat(v.x,",").concat(v.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(y.x,",").concat(y.y,"\n A").concat(o,",").concat(o,",0,").concat(+(O>180),",").concat(+(f<0),",").concat(g.x,",").concat(g.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(x.x,",").concat(x.y,"\n ");if(n>0){var S=p({cx:e,cy:r,radius:n,angle:l,sign:f,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),P=S.circleTangency,E=S.lineTangency,k=S.theta,A=p({cx:e,cy:r,radius:n,angle:s,sign:-f,isExternal:!0,cornerRadius:i,cornerIsExternal:c}),M=A.circleTangency,_=A.lineTangency,T=A.theta,C=c?Math.abs(l-s):Math.abs(l-s)-k-T;if(C<0&&0===i)return"".concat(j,"L").concat(e,",").concat(r,"Z");j+="L".concat(_.x,",").concat(_.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(M.x,",").concat(M.y,"\n A").concat(n,",").concat(n,",0,").concat(+(C>180),",").concat(+(f>0),",").concat(P.x,",").concat(P.y,"\n A").concat(i,",").concat(i,",0,0,").concat(+(f<0),",").concat(E.x,",").concat(E.y,"Z")}else j+="L".concat(e,",").concat(r,"Z");return j},y={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},v=function(t){var e,r=f(f({},y),t),a=r.cx,c=r.cy,s=r.innerRadius,p=r.outerRadius,v=r.cornerRadius,m=r.forceCornerRadius,b=r.cornerIsExternal,g=r.startAngle,x=r.endAngle,w=r.className;if(p0&&360>Math.abs(g-x)?d({cx:a,cy:c,innerRadius:s,outerRadius:p,cornerRadius:Math.min(S,j/2),forceCornerRadius:m,cornerIsExternal:b,startAngle:g,endAngle:x}):h({cx:a,cy:c,innerRadius:s,outerRadius:p,startAngle:g,endAngle:x}),n.createElement("path",l({},(0,i.L6)(r,!0),{className:O,d:e,role:"img"}))}},14870:function(t,e,r){"use strict";r.d(e,{v:function(){return N}});var n=r(2265),o=r(75551),i=r.n(o);let a=Math.cos,u=Math.sin,c=Math.sqrt,l=Math.PI,s=2*l;var f={draw(t,e){let r=c(e/l);t.moveTo(r,0),t.arc(0,0,r,0,s)}};let p=c(1/3),h=2*p,d=u(l/10)/u(7*l/10),y=u(s/10)*d,v=-a(s/10)*d,m=c(3),b=c(3)/2,g=1/c(12),x=(g/2+1)*3;var w=r(76115),O=r(67790);c(3),c(3);var j=r(61994),S=r(82944);function P(t){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var E=["type","size","sizeType"];function k(){return(k=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,E)),{},{type:o,size:u,sizeType:l}),p=s.className,h=s.cx,d=s.cy,y=(0,S.L6)(s,!0);return h===+h&&d===+d&&u===+u?n.createElement("path",k({},y,{className:(0,j.Z)("recharts-symbols",p),transform:"translate(".concat(h,", ").concat(d,")"),d:(e=_["symbol".concat(i()(o))]||f,(function(t,e){let r=null,n=(0,O.d)(o);function o(){let o;if(r||(r=o=n()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),o)return r=null,o+""||null}return t="function"==typeof t?t:(0,w.Z)(t||f),e="function"==typeof e?e:(0,w.Z)(void 0===e?64:+e),o.type=function(e){return arguments.length?(t="function"==typeof e?e:(0,w.Z)(e),o):t},o.size=function(t){return arguments.length?(e="function"==typeof t?t:(0,w.Z)(+t),o):e},o.context=function(t){return arguments.length?(r=null==t?null:t,o):r},o})().type(e).size(C(u,l,o))())})):null};N.registerSymbol=function(t,e){_["symbol".concat(i()(t))]=e}},11638:function(t,e,r){"use strict";r.d(e,{bn:function(){return C},a3:function(){return z},lT:function(){return N},V$:function(){return D},w7:function(){return I}});var n=r(2265),o=r(86757),i=r.n(o),a=r(90231),u=r.n(a),c=r(24342),l=r.n(c),s=r(21652),f=r.n(s),p=r(73649),h=r(61994),d=r(84735),y=r(82944);function v(t){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function m(){return(m=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var r=0,n=Array(e);r0,from:{upperWidth:0,lowerWidth:0,height:p,x:c,y:l},to:{upperWidth:s,lowerWidth:f,height:p,x:c,y:l},duration:j,animationEasing:g,isActive:P},function(t){var e=t.upperWidth,i=t.lowerWidth,u=t.height,c=t.x,l=t.y;return n.createElement(d.ZP,{canBegin:a>0,from:"0px ".concat(-1===a?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:S,duration:j,easing:g},n.createElement("path",m({},(0,y.L6)(r,!0),{className:E,d:w(c,l,e,i,u),ref:o})))}):n.createElement("g",null,n.createElement("path",m({},(0,y.L6)(r,!0),{className:E,d:w(c,l,s,f,p)})))},S=r(60474),P=r(9841),E=r(14870),k=["option","shapeType","propTransformer","activeClassName","isActive"];function A(t){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function _(t){for(var e=1;e=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,k);if((0,n.isValidElement)(r))e=(0,n.cloneElement)(r,_(_({},f),(0,n.isValidElement)(r)?r.props:r));else if(i()(r))e=r(f);else if(u()(r)&&!l()(r)){var p=(void 0===a?function(t,e){return _(_({},e),t)}:a)(r,f);e=n.createElement(T,{shapeType:o,elementProps:p})}else e=n.createElement(T,{shapeType:o,elementProps:f});return s?n.createElement(P.m,{className:void 0===c?"recharts-active-shape":c},e):e}function N(t,e){return null!=e&&"trapezoids"in t.props}function D(t,e){return null!=e&&"sectors"in t.props}function I(t,e){return null!=e&&"points"in t.props}function L(t,e){var r,n,o=t.x===(null==e||null===(r=e.labelViewBox)||void 0===r?void 0:r.x)||t.x===e.x,i=t.y===(null==e||null===(n=e.labelViewBox)||void 0===n?void 0:n.y)||t.y===e.y;return o&&i}function B(t,e){var r=t.endAngle===e.endAngle,n=t.startAngle===e.startAngle;return r&&n}function R(t,e){var r=t.x===e.x,n=t.y===e.y,o=t.z===e.z;return r&&n&&o}function z(t){var e,r,n,o=t.activeTooltipItem,i=t.graphicalItem,a=t.itemData,u=(N(i,o)?e="trapezoids":D(i,o)?e="sectors":I(i,o)&&(e="points"),e),c=N(i,o)?null===(r=o.tooltipPayload)||void 0===r||null===(r=r[0])||void 0===r||null===(r=r.payload)||void 0===r?void 0:r.payload:D(i,o)?null===(n=o.tooltipPayload)||void 0===n||null===(n=n[0])||void 0===n||null===(n=n.payload)||void 0===n?void 0:n.payload:I(i,o)?o.payload:{},l=a.filter(function(t,e){var r=f()(c,t),n=i.props[u].filter(function(t){var e;return(N(i,o)?e=L:D(i,o)?e=B:I(i,o)&&(e=R),e)(t,o)}),a=i.props[u].indexOf(n[n.length-1]);return r&&e===a});return a.indexOf(l[l.length-1])}},25311:function(t,e,r){"use strict";r.d(e,{Ky:function(){return w},O1:function(){return b},_b:function(){return g},t9:function(){return m},xE:function(){return O}});var n=r(41443),o=r.n(n),i=r(32242),a=r.n(i),u=r(85355),c=r(82944),l=r(16630),s=r(31699);function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){for(var r=0;r0&&(A=Math.min((t||0)-(M[e-1]||0),A))}),Number.isFinite(A)){var _=A/k,T="vertical"===g.layout?r.height:r.width;if("gap"===g.padding&&(c=_*T/2),"no-gap"===g.padding){var C=(0,l.h1)(t.barCategoryGap,_*T),N=_*T/2;c=N-C-(N-C)/T*C}}}s="xAxis"===n?[r.left+(j.left||0)+(c||0),r.left+r.width-(j.right||0)-(c||0)]:"yAxis"===n?"horizontal"===f?[r.top+r.height-(j.bottom||0),r.top+(j.top||0)]:[r.top+(j.top||0)+(c||0),r.top+r.height-(j.bottom||0)-(c||0)]:g.range,P&&(s=[s[1],s[0]]);var D=(0,u.Hq)(g,o,m),I=D.scale,L=D.realScaleType;I.domain(w).range(s),(0,u.zF)(I);var B=(0,u.g$)(I,d(d({},g),{},{realScaleType:L}));"xAxis"===n?(b="top"===x&&!S||"bottom"===x&&S,p=r.left,h=v[E]-b*g.height):"yAxis"===n&&(b="left"===x&&!S||"right"===x&&S,p=v[E]-b*g.width,h=r.top);var R=d(d(d({},g),B),{},{realScaleType:L,x:p,y:h,scale:I,width:"xAxis"===n?r.width:g.width,height:"yAxis"===n?r.height:g.height});return R.bandSize=(0,u.zT)(R,B),g.hide||"xAxis"!==n?g.hide||(v[E]+=(b?-1:1)*R.width):v[E]+=(b?-1:1)*R.height,d(d({},i),{},y({},a,R))},{})},b=function(t,e){var r=t.x,n=t.y,o=e.x,i=e.y;return{x:Math.min(r,o),y:Math.min(n,i),width:Math.abs(o-r),height:Math.abs(i-n)}},g=function(t){return b({x:t.x1,y:t.y1},{x:t.x2,y:t.y2})},x=function(){var t,e;function r(t){!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,r),this.scale=t}return t=[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.bandAware,n=e.position;if(void 0!==t){if(n)switch(n){case"start":default:return this.scale(t);case"middle":var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+o;case"end":var i=this.bandwidth?this.bandwidth():0;return this.scale(t)+i}if(r){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+a}return this.scale(t)}}},{key:"isInRange",value:function(t){var e=this.range(),r=e[0],n=e[e.length-1];return r<=n?t>=r&&t<=n:t>=n&&t<=r}}],e=[{key:"create",value:function(t){return new r(t)}}],t&&p(r.prototype,t),e&&p(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}();y(x,"EPS",1e-4);var w=function(t){var e=Object.keys(t).reduce(function(e,r){return d(d({},e),{},y({},r,x.create(t[r])))},{});return d(d({},e),{},{apply:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.bandAware,i=r.position;return o()(t,function(t,r){return e[r].apply(t,{bandAware:n,position:i})})},isInRange:function(t){return a()(t,function(t,r){return e[r].isInRange(t)})}})},O=function(t){var e=t.width,r=t.height,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=(n%180+180)%180*Math.PI/180,i=Math.atan(r/e);return Math.abs(o>i&&otx(e,t()).base(e.base()),tj.o.apply(e,arguments),e}},scaleOrdinal:function(){return tX.Z},scalePoint:function(){return f.x},scalePow:function(){return tJ},scaleQuantile:function(){return function t(){var e,r=[],n=[],o=[];function i(){var t=0,e=Math.max(1,n.length);for(o=Array(e-1);++t=1)return+r(t[n-1],n-1,t);var n,o=(n-1)*e,i=Math.floor(o),a=+r(t[i],i,t);return a+(+r(t[i+1],i+1,t)-a)*(o-i)}}(r,t/e);return a}function a(t){return null==t||isNaN(t=+t)?e:n[P(o,t)]}return a.invertExtent=function(t){var e=n.indexOf(t);return e<0?[NaN,NaN]:[e>0?o[e-1]:r[0],e=o?[i[o-1],n]:[i[e-1],i[e]]},u.unknown=function(t){return arguments.length&&(e=t),u},u.thresholds=function(){return i.slice()},u.copy=function(){return t().domain([r,n]).range(a).unknown(e)},tj.o.apply(tI(u),arguments)}},scaleRadial:function(){return function t(){var e,r=tO(),n=[0,1],o=!1;function i(t){var n,i=Math.sign(n=r(t))*Math.sqrt(Math.abs(n));return isNaN(i)?e:o?Math.round(i):i}return i.invert=function(t){return r.invert(t1(t))},i.domain=function(t){return arguments.length?(r.domain(t),i):r.domain()},i.range=function(t){return arguments.length?(r.range((n=Array.from(t,td)).map(t1)),i):n.slice()},i.rangeRound=function(t){return i.range(t).round(!0)},i.round=function(t){return arguments.length?(o=!!t,i):o},i.clamp=function(t){return arguments.length?(r.clamp(t),i):r.clamp()},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t(r.domain(),n).round(o).clamp(r.clamp()).unknown(e)},tj.o.apply(i,arguments),tI(i)}},scaleSequential:function(){return function t(){var e=tI(rX()(tv));return e.copy=function(){return rG(e,t())},tj.O.apply(e,arguments)}},scaleSequentialLog:function(){return function t(){var e=tZ(rX()).domain([1,10]);return e.copy=function(){return rG(e,t()).base(e.base())},tj.O.apply(e,arguments)}},scaleSequentialPow:function(){return rV},scaleSequentialQuantile:function(){return function t(){var e=[],r=tv;function n(t){if(null!=t&&!isNaN(t=+t))return r((P(e,t,1)-1)/(e.length-1))}return n.domain=function(t){if(!arguments.length)return e.slice();for(let r of(e=[],t))null==r||isNaN(r=+r)||e.push(r);return e.sort(g),n},n.interpolator=function(t){return arguments.length?(r=t,n):r},n.range=function(){return e.map((t,n)=>r(n/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(r,n)=>(function(t,e,r){if(!(!(n=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let r=-1;for(let n of t)null!=(n=e(n,++r,t))&&(n=+n)>=n&&(yield n)}}(t,void 0))).length)||isNaN(e=+e))){if(e<=0||n<2)return t5(t);if(e>=1)return t2(t);var n,o=(n-1)*e,i=Math.floor(o),a=t2((function t(e,r,n=0,o=1/0,i){if(r=Math.floor(r),n=Math.floor(Math.max(0,n)),o=Math.floor(Math.min(e.length-1,o)),!(n<=r&&r<=o))return e;for(i=void 0===i?t6:function(t=g){if(t===g)return t6;if("function"!=typeof t)throw TypeError("compare is not a function");return(e,r)=>{let n=t(e,r);return n||0===n?n:(0===t(r,r))-(0===t(e,e))}}(i);o>n;){if(o-n>600){let a=o-n+1,u=r-n+1,c=Math.log(a),l=.5*Math.exp(2*c/3),s=.5*Math.sqrt(c*l*(a-l)/a)*(u-a/2<0?-1:1),f=Math.max(n,Math.floor(r-u*l/a+s)),p=Math.min(o,Math.floor(r+(a-u)*l/a+s));t(e,r,f,p,i)}let a=e[r],u=n,c=o;for(t3(e,n,r),i(e[o],a)>0&&t3(e,n,o);ui(e[u],a);)++u;for(;i(e[c],a)>0;)--c}0===i(e[n],a)?t3(e,n,c):t3(e,++c,o),c<=r&&(n=c+1),r<=c&&(o=c-1)}return e})(t,i).subarray(0,i+1));return a+(t5(t.subarray(i+1))-a)*(o-i)}})(e,n/t))},n.copy=function(){return t(r).domain(e)},tj.O.apply(n,arguments)}},scaleSequentialSqrt:function(){return rK},scaleSequentialSymlog:function(){return function t(){var e=tH(rX());return e.copy=function(){return rG(e,t()).constant(e.constant())},tj.O.apply(e,arguments)}},scaleSqrt:function(){return t0},scaleSymlog:function(){return function t(){var e=tH(tw());return e.copy=function(){return tx(e,t()).constant(e.constant())},tj.o.apply(e,arguments)}},scaleThreshold:function(){return function t(){var e,r=[.5],n=[0,1],o=1;function i(t){return null!=t&&t<=t?n[P(r,t,0,o)]:e}return i.domain=function(t){return arguments.length?(o=Math.min((r=Array.from(t)).length,n.length-1),i):r.slice()},i.range=function(t){return arguments.length?(n=Array.from(t),o=Math.min(r.length,n.length-1),i):n.slice()},i.invertExtent=function(t){var e=n.indexOf(t);return[r[e-1],r[e]]},i.unknown=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return t().domain(r).range(n).unknown(e)},tj.o.apply(i,arguments)}},scaleTime:function(){return rY},scaleUtc:function(){return rH},tickFormat:function(){return tD}});var f=r(55284);let p=Math.sqrt(50),h=Math.sqrt(10),d=Math.sqrt(2);function y(t,e,r){let n,o,i;let a=(e-t)/Math.max(0,r),u=Math.floor(Math.log10(a)),c=a/Math.pow(10,u),l=c>=p?10:c>=h?5:c>=d?2:1;return(u<0?(n=Math.round(t*(i=Math.pow(10,-u)/l)),o=Math.round(e*i),n/ie&&--o,i=-i):(n=Math.round(t/(i=Math.pow(10,u)*l)),o=Math.round(e/i),n*ie&&--o),o0))return[];if(t===e)return[t];let n=e=o))return[];let u=i-o+1,c=Array(u);if(n){if(a<0)for(let t=0;te?1:t>=e?0:NaN}function x(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function w(t){let e,r,n;function o(t,n,o=0,i=t.length){if(o>>1;0>r(t[e],n)?o=e+1:i=e}while(og(t(e),r),n=(e,r)=>t(e)-r):(e=t===g||t===x?t:O,r=t,n=t),{left:o,center:function(t,e,r=0,i=t.length){let a=o(t,e,r,i-1);return a>r&&n(t[a-1],e)>-n(t[a],e)?a-1:a},right:function(t,n,o=0,i=t.length){if(o>>1;0>=r(t[e],n)?o=e+1:i=e}while(o>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===r?Z(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===r?Z(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=N.exec(t))?new Y(e[1],e[2],e[3],1):(e=D.exec(t))?new Y(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=I.exec(t))?Z(e[1],e[2],e[3],e[4]):(e=L.exec(t))?Z(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=B.exec(t))?Q(e[1],e[2]/100,e[3]/100,1):(e=R.exec(t))?Q(e[1],e[2]/100,e[3]/100,e[4]):z.hasOwnProperty(t)?q(z[t]):"transparent"===t?new Y(NaN,NaN,NaN,0):null}function q(t){return new Y(t>>16&255,t>>8&255,255&t,1)}function Z(t,e,r,n){return n<=0&&(t=e=r=NaN),new Y(t,e,r,n)}function W(t,e,r,n){var o;return 1==arguments.length?((o=t)instanceof A||(o=$(o)),o)?new Y((o=o.rgb()).r,o.g,o.b,o.opacity):new Y:new Y(t,e,r,null==n?1:n)}function Y(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function H(){return`#${K(this.r)}${K(this.g)}${K(this.b)}`}function X(){let t=G(this.opacity);return`${1===t?"rgb(":"rgba("}${V(this.r)}, ${V(this.g)}, ${V(this.b)}${1===t?")":`, ${t})`}`}function G(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function V(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function K(t){return((t=V(t))<16?"0":"")+t.toString(16)}function Q(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new tt(t,e,r,n)}function J(t){if(t instanceof tt)return new tt(t.h,t.s,t.l,t.opacity);if(t instanceof A||(t=$(t)),!t)return new tt;if(t instanceof tt)return t;var e=(t=t.rgb()).r/255,r=t.g/255,n=t.b/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=NaN,u=i-o,c=(i+o)/2;return u?(a=e===i?(r-n)/u+(r0&&c<1?0:a,new tt(a,u,c,t.opacity)}function tt(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function te(t){return(t=(t||0)%360)<0?t+360:t}function tr(t){return Math.max(0,Math.min(1,t||0))}function tn(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}function to(t,e,r,n,o){var i=t*t,a=i*t;return((1-3*t+3*i-a)*e+(4-6*i+3*a)*r+(1+3*t+3*i-3*a)*n+a*o)/6}E(A,$,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:U,formatHex:U,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return J(this).formatHsl()},formatRgb:F,toString:F}),E(Y,W,k(A,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new Y(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new Y(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Y(V(this.r),V(this.g),V(this.b),G(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:H,formatHex:H,formatHex8:function(){return`#${K(this.r)}${K(this.g)}${K(this.b)}${K((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:X,toString:X})),E(tt,function(t,e,r,n){return 1==arguments.length?J(t):new tt(t,e,r,null==n?1:n)},k(A,{brighter(t){return t=null==t?1.4285714285714286:Math.pow(1.4285714285714286,t),new tt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new tt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,o=2*r-n;return new Y(tn(t>=240?t-240:t+120,o,n),tn(t,o,n),tn(t<120?t+240:t-120,o,n),this.opacity)},clamp(){return new tt(te(this.h),tr(this.s),tr(this.l),G(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=G(this.opacity);return`${1===t?"hsl(":"hsla("}${te(this.h)}, ${100*tr(this.s)}%, ${100*tr(this.l)}%${1===t?")":`, ${t})`}`}}));var ti=t=>()=>t;function ta(t,e){var r=e-t;return r?function(e){return t+e*r}:ti(isNaN(t)?e:t)}var tu=function t(e){var r,n=1==(r=+(r=e))?ta:function(t,e){var n,o,i;return e-t?(n=t,o=e,n=Math.pow(n,i=r),o=Math.pow(o,i)-n,i=1/i,function(t){return Math.pow(n+t*o,i)}):ti(isNaN(t)?e:t)};function o(t,e){var r=n((t=W(t)).r,(e=W(e)).r),o=n(t.g,e.g),i=n(t.b,e.b),a=ta(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=o(e),t.b=i(e),t.opacity=a(e),t+""}}return o.gamma=t,o}(1);function tc(t){return function(e){var r,n,o=e.length,i=Array(o),a=Array(o),u=Array(o);for(r=0;r=1?(r=1,e-1):Math.floor(r*e),o=t[n],i=t[n+1],a=n>0?t[n-1]:2*o-i,u=nu&&(a=e.slice(u,a),l[c]?l[c]+=a:l[++c]=a),(o=o[0])===(i=i[0])?l[c]?l[c]+=i:l[++c]=i:(l[++c]=null,s.push({i:c,x:tl(o,i)})),u=tf.lastIndex;return ue&&(r=t,t=e,e=r),l=function(r){return Math.max(t,Math.min(e,r))}),n=c>2?tg:tb,o=i=null,f}function f(e){return null==e||isNaN(e=+e)?r:(o||(o=n(a.map(t),u,c)))(t(l(e)))}return f.invert=function(r){return l(e((i||(i=n(u,a.map(t),tl)))(r)))},f.domain=function(t){return arguments.length?(a=Array.from(t,td),s()):a.slice()},f.range=function(t){return arguments.length?(u=Array.from(t),s()):u.slice()},f.rangeRound=function(t){return u=Array.from(t),c=th,s()},f.clamp=function(t){return arguments.length?(l=!!t||tv,s()):l!==tv},f.interpolate=function(t){return arguments.length?(c=t,s()):c},f.unknown=function(t){return arguments.length?(r=t,f):r},function(r,n){return t=r,e=n,s()}}function tO(){return tw()(tv,tv)}var tj=r(89999),tS=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function tP(t){var e;if(!(e=tS.exec(t)))throw Error("invalid format: "+t);return new tE({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function tE(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function tk(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function tA(t){return(t=tk(Math.abs(t)))?t[1]:NaN}function tM(t,e){var r=tk(t,e);if(!r)return t+"";var n=r[0],o=r[1];return o<0?"0."+Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+Array(o-n.length+2).join("0")}tP.prototype=tE.prototype,tE.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var t_={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>tM(100*t,e),r:tM,s:function(t,e){var r=tk(t,e);if(!r)return t+"";var o=r[0],i=r[1],a=i-(n=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=o.length;return a===u?o:a>u?o+Array(a-u+1).join("0"):a>0?o.slice(0,a)+"."+o.slice(a):"0."+Array(1-a).join("0")+tk(t,Math.max(0,e+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function tT(t){return t}var tC=Array.prototype.map,tN=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"];function tD(t,e,r,n){var o,u,c=b(t,e,r);switch((n=tP(null==n?",f":n)).type){case"s":var l=Math.max(Math.abs(t),Math.abs(e));return null!=n.precision||isNaN(u=Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(tA(l)/3)))-tA(Math.abs(c))))||(n.precision=u),a(n,l);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(u=Math.max(0,tA(Math.abs(Math.max(Math.abs(t),Math.abs(e)))-(o=Math.abs(o=c)))-tA(o))+1)||(n.precision=u-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(u=Math.max(0,-tA(Math.abs(c))))||(n.precision=u-("%"===n.type)*2)}return i(n)}function tI(t){var e=t.domain;return t.ticks=function(t){var r=e();return v(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,r){var n=e();return tD(n[0],n[n.length-1],null==t?10:t,r)},t.nice=function(r){null==r&&(r=10);var n,o,i=e(),a=0,u=i.length-1,c=i[a],l=i[u],s=10;for(l0;){if((o=m(c,l,r))===n)return i[a]=c,i[u]=l,e(i);if(o>0)c=Math.floor(c/o)*o,l=Math.ceil(l/o)*o;else if(o<0)c=Math.ceil(c*o)/o,l=Math.floor(l*o)/o;else break;n=o}return t},t}function tL(){var t=tO();return t.copy=function(){return tx(t,tL())},tj.o.apply(t,arguments),tI(t)}function tB(t,e){t=t.slice();var r,n=0,o=t.length-1,i=t[n],a=t[o];return a-t(-e,r)}function tZ(t){let e,r;let n=t(tR,tz),o=n.domain,a=10;function u(){var i,u;return e=(i=a)===Math.E?Math.log:10===i&&Math.log10||2===i&&Math.log2||(i=Math.log(i),t=>Math.log(t)/i),r=10===(u=a)?t$:u===Math.E?Math.exp:t=>Math.pow(u,t),o()[0]<0?(e=tq(e),r=tq(r),t(tU,tF)):t(tR,tz),n}return n.base=function(t){return arguments.length?(a=+t,u()):a},n.domain=function(t){return arguments.length?(o(t),u()):o()},n.ticks=t=>{let n,i;let u=o(),c=u[0],l=u[u.length-1],s=l0){for(;f<=p;++f)for(n=1;nl)break;d.push(i)}}else for(;f<=p;++f)for(n=a-1;n>=1;--n)if(!((i=f>0?n/r(-f):n*r(f))l)break;d.push(i)}2*d.length{if(null==t&&(t=10),null==o&&(o=10===a?"s":","),"function"!=typeof o&&(a%1||null!=(o=tP(o)).precision||(o.trim=!0),o=i(o)),t===1/0)return o;let u=Math.max(1,a*t/n.ticks().length);return t=>{let n=t/r(Math.round(e(t)));return n*ao(tB(o(),{floor:t=>r(Math.floor(e(t))),ceil:t=>r(Math.ceil(e(t)))})),n}function tW(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function tY(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function tH(t){var e=1,r=t(tW(1),tY(e));return r.constant=function(r){return arguments.length?t(tW(e=+r),tY(e)):e},tI(r)}i=(o=function(t){var e,r,o,i=void 0===t.grouping||void 0===t.thousands?tT:(e=tC.call(t.grouping,Number),r=t.thousands+"",function(t,n){for(var o=t.length,i=[],a=0,u=e[0],c=0;o>0&&u>0&&(c+u+1>n&&(u=Math.max(1,n-c)),i.push(t.substring(o-=u,o+u)),!((c+=u+1)>n));)u=e[a=(a+1)%e.length];return i.reverse().join(r)}),a=void 0===t.currency?"":t.currency[0]+"",u=void 0===t.currency?"":t.currency[1]+"",c=void 0===t.decimal?".":t.decimal+"",l=void 0===t.numerals?tT:(o=tC.call(t.numerals,String),function(t){return t.replace(/[0-9]/g,function(t){return o[+t]})}),s=void 0===t.percent?"%":t.percent+"",f=void 0===t.minus?"−":t.minus+"",p=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=tP(t)).fill,r=t.align,o=t.sign,h=t.symbol,d=t.zero,y=t.width,v=t.comma,m=t.precision,b=t.trim,g=t.type;"n"===g?(v=!0,g="g"):t_[g]||(void 0===m&&(m=12),b=!0,g="g"),(d||"0"===e&&"="===r)&&(d=!0,e="0",r="=");var x="$"===h?a:"#"===h&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",w="$"===h?u:/[%p]/.test(g)?s:"",O=t_[g],j=/[defgprs%]/.test(g);function S(t){var a,u,s,h=x,S=w;if("c"===g)S=O(t)+S,t="";else{var P=(t=+t)<0||1/t<0;if(t=isNaN(t)?p:O(Math.abs(t),m),b&&(t=function(t){e:for(var e,r=t.length,n=1,o=-1;n0&&(o=0)}return o>0?t.slice(0,o)+t.slice(e+1):t}(t)),P&&0==+t&&"+"!==o&&(P=!1),h=(P?"("===o?o:f:"-"===o||"("===o?"":o)+h,S=("s"===g?tN[8+n/3]:"")+S+(P&&"("===o?")":""),j){for(a=-1,u=t.length;++a(s=t.charCodeAt(a))||s>57){S=(46===s?c+t.slice(a+1):t.slice(a))+S,t=t.slice(0,a);break}}}v&&!d&&(t=i(t,1/0));var E=h.length+t.length+S.length,k=E>1)+h+t+S+k.slice(E);break;default:t=k+h+t+S}return l(t)}return m=void 0===m?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),S.toString=function(){return t+""},S}return{format:h,formatPrefix:function(t,e){var r=h(((t=tP(t)).type="f",t)),n=3*Math.max(-8,Math.min(8,Math.floor(tA(e)/3))),o=Math.pow(10,-n),i=tN[8+n/3];return function(t){return r(o*t)+i}}}}({thousands:",",grouping:[3],currency:["$",""]})).format,a=o.formatPrefix;var tX=r(36967);function tG(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function tV(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function tK(t){return t<0?-t*t:t*t}function tQ(t){var e=t(tv,tv),r=1;return e.exponent=function(e){return arguments.length?1==(r=+e)?t(tv,tv):.5===r?t(tV,tK):t(tG(r),tG(1/r)):r},tI(e)}function tJ(){var t=tQ(tw());return t.copy=function(){return tx(t,tJ()).exponent(t.exponent())},tj.o.apply(t,arguments),t}function t0(){return tJ.apply(null,arguments).exponent(.5)}function t1(t){return Math.sign(t)*t*t}function t2(t,e){let r;if(void 0===e)for(let e of t)null!=e&&(r=e)&&(r=e);else{let n=-1;for(let o of t)null!=(o=e(o,++n,t))&&(r=o)&&(r=o)}return r}function t5(t,e){let r;if(void 0===e)for(let e of t)null!=e&&(r>e||void 0===r&&e>=e)&&(r=e);else{let n=-1;for(let o of t)null!=(o=e(o,++n,t))&&(r>o||void 0===r&&o>=o)&&(r=o)}return r}function t6(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(te?1:0)}function t3(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}let t7=new Date,t4=new Date;function t8(t,e,r,n){function o(e){return t(e=0==arguments.length?new Date:new Date(+e)),e}return o.floor=e=>(t(e=new Date(+e)),e),o.ceil=r=>(t(r=new Date(r-1)),e(r,1),t(r),r),o.round=t=>{let e=o(t),r=o.ceil(t);return t-e(e(t=new Date(+t),null==r?1:Math.floor(r)),t),o.range=(r,n,i)=>{let a;let u=[];if(r=o.ceil(r),i=null==i?1:Math.floor(i),!(r0))return u;do u.push(a=new Date(+r)),e(r,i),t(r);while(at8(e=>{if(e>=e)for(;t(e),!r(e);)e.setTime(e-1)},(t,n)=>{if(t>=t){if(n<0)for(;++n<=0;)for(;e(t,-1),!r(t););else for(;--n>=0;)for(;e(t,1),!r(t););}}),r&&(o.count=(e,n)=>(t7.setTime(+e),t4.setTime(+n),t(t7),t(t4),Math.floor(r(t7,t4))),o.every=t=>isFinite(t=Math.floor(t))&&t>0?t>1?o.filter(n?e=>n(e)%t==0:e=>o.count(0,e)%t==0):o:null),o}let t9=t8(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);t9.every=t=>isFinite(t=Math.floor(t))&&t>0?t>1?t8(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):t9:null,t9.range;let et=t8(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+1e3*e)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds());et.range;let ee=t8(t=>{t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},(t,e)=>{t.setTime(+t+6e4*e)},(t,e)=>(e-t)/6e4,t=>t.getMinutes());ee.range;let er=t8(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+6e4*e)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes());er.range;let en=t8(t=>{t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())},(t,e)=>{t.setTime(+t+36e5*e)},(t,e)=>(e-t)/36e5,t=>t.getHours());en.range;let eo=t8(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+36e5*e)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours());eo.range;let ei=t8(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1);ei.range;let ea=t8(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1);ea.range;let eu=t8(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5));function ec(t){return t8(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+7*e)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}eu.range;let el=ec(0),es=ec(1),ef=ec(2),ep=ec(3),eh=ec(4),ed=ec(5),ey=ec(6);function ev(t){return t8(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)},(t,e)=>(e-t)/6048e5)}el.range,es.range,ef.range,ep.range,eh.range,ed.range,ey.range;let em=ev(0),eb=ev(1),eg=ev(2),ex=ev(3),ew=ev(4),eO=ev(5),ej=ev(6);em.range,eb.range,eg.range,ex.range,ew.range,eO.range,ej.range;let eS=t8(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());eS.range;let eP=t8(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());eP.range;let eE=t8(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());eE.every=t=>isFinite(t=Math.floor(t))&&t>0?t8(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)}):null,eE.range;let ek=t8(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());function eA(t,e,r,n,o,i){let a=[[et,1,1e3],[et,5,5e3],[et,15,15e3],[et,30,3e4],[i,1,6e4],[i,5,3e5],[i,15,9e5],[i,30,18e5],[o,1,36e5],[o,3,108e5],[o,6,216e5],[o,12,432e5],[n,1,864e5],[n,2,1728e5],[r,1,6048e5],[e,1,2592e6],[e,3,7776e6],[t,1,31536e6]];function u(e,r,n){let o=Math.abs(r-e)/n,i=w(([,,t])=>t).right(a,o);if(i===a.length)return t.every(b(e/31536e6,r/31536e6,n));if(0===i)return t9.every(Math.max(b(e,r,n),1));let[u,c]=a[o/a[i-1][2]isFinite(t=Math.floor(t))&&t>0?t8(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)}):null,ek.range;let[eM,e_]=eA(ek,eP,em,eu,eo,er),[eT,eC]=eA(eE,eS,el,ei,en,ee);function eN(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function eD(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function eI(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}var eL={"-":"",_:" ",0:"0"},eB=/^\s*\d+/,eR=/^%/,ez=/[\\^$*+?|[\]().{}]/g;function eU(t,e,r){var n=t<0?"-":"",o=(n?-t:t)+"",i=o.length;return n+(i[t.toLowerCase(),e]))}function eZ(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function eW(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function eY(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function eH(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function eX(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function eG(t,e,r){var n=eB.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function eV(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function eK(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function eQ(t,e,r){var n=eB.exec(e.slice(r,r+1));return n?(t.q=3*n[0]-3,r+n[0].length):-1}function eJ(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function e0(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function e1(t,e,r){var n=eB.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function e2(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function e5(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function e6(t,e,r){var n=eB.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function e3(t,e,r){var n=eB.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function e7(t,e,r){var n=eB.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function e4(t,e,r){var n=eR.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function e8(t,e,r){var n=eB.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function e9(t,e,r){var n=eB.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function rt(t,e){return eU(t.getDate(),e,2)}function re(t,e){return eU(t.getHours(),e,2)}function rr(t,e){return eU(t.getHours()%12||12,e,2)}function rn(t,e){return eU(1+ei.count(eE(t),t),e,3)}function ro(t,e){return eU(t.getMilliseconds(),e,3)}function ri(t,e){return ro(t,e)+"000"}function ra(t,e){return eU(t.getMonth()+1,e,2)}function ru(t,e){return eU(t.getMinutes(),e,2)}function rc(t,e){return eU(t.getSeconds(),e,2)}function rl(t){var e=t.getDay();return 0===e?7:e}function rs(t,e){return eU(el.count(eE(t)-1,t),e,2)}function rf(t){var e=t.getDay();return e>=4||0===e?eh(t):eh.ceil(t)}function rp(t,e){return t=rf(t),eU(eh.count(eE(t),t)+(4===eE(t).getDay()),e,2)}function rh(t){return t.getDay()}function rd(t,e){return eU(es.count(eE(t)-1,t),e,2)}function ry(t,e){return eU(t.getFullYear()%100,e,2)}function rv(t,e){return eU((t=rf(t)).getFullYear()%100,e,2)}function rm(t,e){return eU(t.getFullYear()%1e4,e,4)}function rb(t,e){var r=t.getDay();return eU((t=r>=4||0===r?eh(t):eh.ceil(t)).getFullYear()%1e4,e,4)}function rg(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+eU(e/60|0,"0",2)+eU(e%60,"0",2)}function rx(t,e){return eU(t.getUTCDate(),e,2)}function rw(t,e){return eU(t.getUTCHours(),e,2)}function rO(t,e){return eU(t.getUTCHours()%12||12,e,2)}function rj(t,e){return eU(1+ea.count(ek(t),t),e,3)}function rS(t,e){return eU(t.getUTCMilliseconds(),e,3)}function rP(t,e){return rS(t,e)+"000"}function rE(t,e){return eU(t.getUTCMonth()+1,e,2)}function rk(t,e){return eU(t.getUTCMinutes(),e,2)}function rA(t,e){return eU(t.getUTCSeconds(),e,2)}function rM(t){var e=t.getUTCDay();return 0===e?7:e}function r_(t,e){return eU(em.count(ek(t)-1,t),e,2)}function rT(t){var e=t.getUTCDay();return e>=4||0===e?ew(t):ew.ceil(t)}function rC(t,e){return t=rT(t),eU(ew.count(ek(t),t)+(4===ek(t).getUTCDay()),e,2)}function rN(t){return t.getUTCDay()}function rD(t,e){return eU(eb.count(ek(t)-1,t),e,2)}function rI(t,e){return eU(t.getUTCFullYear()%100,e,2)}function rL(t,e){return eU((t=rT(t)).getUTCFullYear()%100,e,2)}function rB(t,e){return eU(t.getUTCFullYear()%1e4,e,4)}function rR(t,e){var r=t.getUTCDay();return eU((t=r>=4||0===r?ew(t):ew.ceil(t)).getUTCFullYear()%1e4,e,4)}function rz(){return"+0000"}function rU(){return"%"}function rF(t){return+t}function r$(t){return Math.floor(+t/1e3)}function rq(t){return new Date(t)}function rZ(t){return t instanceof Date?+t:+new Date(+t)}function rW(t,e,r,n,o,i,a,u,c,l){var s=tO(),f=s.invert,p=s.domain,h=l(".%L"),d=l(":%S"),y=l("%I:%M"),v=l("%I %p"),m=l("%a %d"),b=l("%b %d"),g=l("%B"),x=l("%Y");function w(t){return(c(t)1)for(var r,n,o,i=1,a=t[e[0]],u=a.length;i=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:rF,s:r$,S:rc,u:rl,U:rs,V:rp,w:rh,W:rd,x:null,X:null,y:ry,Y:rm,Z:rg,"%":rU},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return i[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:rx,e:rx,f:rP,g:rL,G:rR,H:rw,I:rO,j:rj,L:rS,m:rE,M:rk,p:function(t){return o[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:rF,s:r$,S:rA,u:rM,U:r_,V:rC,w:rN,W:rD,x:null,X:null,y:rI,Y:rB,Z:rz,"%":rU},w={a:function(t,e,r){var n=h.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){var n=f.exec(e.slice(r));return n?(t.w=p.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){var n=m.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){var n=y.exec(e.slice(r));return n?(t.m=v.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,r,n){return S(t,e,r,n)},d:e0,e:e0,f:e7,g:eV,G:eG,H:e2,I:e2,j:e1,L:e3,m:eJ,M:e5,p:function(t,e,r){var n=l.exec(e.slice(r));return n?(t.p=s.get(n[0].toLowerCase()),r+n[0].length):-1},q:eQ,Q:e8,s:e9,S:e6,u:eW,U:eY,V:eH,w:eZ,W:eX,x:function(t,e,n){return S(t,r,e,n)},X:function(t,e,r){return S(t,n,e,r)},y:eV,Y:eG,Z:eK,"%":e4};function O(t,e){return function(r){var n,o,i,a=[],u=-1,c=0,l=t.length;for(r instanceof Date||(r=new Date(+r));++u53)return null;"w"in i||(i.w=1),"Z"in i?(n=(o=(n=eD(eI(i.y,0,1))).getUTCDay())>4||0===o?eb.ceil(n):eb(n),n=ea.offset(n,(i.V-1)*7),i.y=n.getUTCFullYear(),i.m=n.getUTCMonth(),i.d=n.getUTCDate()+(i.w+6)%7):(n=(o=(n=eN(eI(i.y,0,1))).getDay())>4||0===o?es.ceil(n):es(n),n=ei.offset(n,(i.V-1)*7),i.y=n.getFullYear(),i.m=n.getMonth(),i.d=n.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),o="Z"in i?eD(eI(i.y,0,1)).getUTCDay():eN(eI(i.y,0,1)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(o+5)%7:i.w+7*i.U-(o+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,eD(i)):eN(i)}}function S(t,e,r,n){for(var o,i,a=0,u=e.length,c=r.length;a=c)return -1;if(37===(o=e.charCodeAt(a++))){if(!(i=w[(o=e.charAt(a++))in eL?e.charAt(a++):o])||(n=i(t,r,n))<0)return -1}else if(o!=r.charCodeAt(n++))return -1}return n}return g.x=O(r,g),g.X=O(n,g),g.c=O(e,g),x.x=O(r,x),x.X=O(n,x),x.c=O(e,x),{format:function(t){var e=O(t+="",g);return e.toString=function(){return t},e},parse:function(t){var e=j(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=O(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=j(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,u.parse,l=u.utcFormat,u.utcParse;var r2=r(22516),r5=r(76115);function r6(t){for(var e=t.length,r=Array(e);--e>=0;)r[e]=e;return r}function r3(t,e){return t[e]}function r7(t){let e=[];return e.key=t,e}var r4=r(95645),r8=r.n(r4),r9=r(99008),nt=r.n(r9),ne=r(77571),nr=r.n(ne),nn=r(86757),no=r.n(nn),ni=r(42715),na=r.n(ni),nu=r(13735),nc=r.n(nu),nl=r(11314),ns=r.n(nl),nf=r(82559),np=r.n(nf),nh=r(75551),nd=r.n(nh),ny=r(21652),nv=r.n(ny),nm=r(34935),nb=r.n(nm),ng=r(61134),nx=r.n(ng);function nw(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r=e?r.apply(void 0,o):t(e-a,nP(function(){for(var t=arguments.length,e=Array(t),n=0;nt.length)&&(e=t.length);for(var r=0,n=Array(e);rn&&(o=n,i=r),[o,i]}function nR(t,e,r){if(t.lte(0))return new(nx())(0);var n=nC.getDigitCount(t.toNumber()),o=new(nx())(10).pow(n),i=t.div(o),a=1!==n?.05:.1,u=new(nx())(Math.ceil(i.div(a).toNumber())).add(r).mul(a).mul(o);return e?u:new(nx())(Math.ceil(u))}function nz(t,e,r){var n=1,o=new(nx())(t);if(!o.isint()&&r){var i=Math.abs(t);i<1?(n=new(nx())(10).pow(nC.getDigitCount(t)-1),o=new(nx())(Math.floor(o.div(n).toNumber())).mul(n)):i>1&&(o=new(nx())(Math.floor(t)))}else 0===t?o=new(nx())(Math.floor((e-1)/2)):r||(o=new(nx())(Math.floor(t)));var a=Math.floor((e-1)/2);return nM(nA(function(t){return o.add(new(nx())(t-a).mul(n)).toNumber()}),nk)(0,e)}var nU=nT(function(t){var e=nD(t,2),r=e[0],n=e[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(o,2),u=nD(nB([r,n]),2),c=u[0],l=u[1];if(c===-1/0||l===1/0){var s=l===1/0?[c].concat(nN(nk(0,o-1).map(function(){return 1/0}))):[].concat(nN(nk(0,o-1).map(function(){return-1/0})),[l]);return r>n?n_(s):s}if(c===l)return nz(c,o,i);var f=function t(e,r,n,o){var i,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((r-e)/(n-1)))return{step:new(nx())(0),tickMin:new(nx())(0),tickMax:new(nx())(0)};var u=nR(new(nx())(r).sub(e).div(n-1),o,a),c=Math.ceil((i=e<=0&&r>=0?new(nx())(0):(i=new(nx())(e).add(r).div(2)).sub(new(nx())(i).mod(u))).sub(e).div(u).toNumber()),l=Math.ceil(new(nx())(r).sub(i).div(u).toNumber()),s=c+l+1;return s>n?t(e,r,n,o,a+1):(s0?l+(n-s):l,c=r>0?c:c+(n-s)),{step:u,tickMin:i.sub(new(nx())(c).mul(u)),tickMax:i.add(new(nx())(l).mul(u))})}(c,l,a,i),p=f.step,h=f.tickMin,d=f.tickMax,y=nC.rangeStep(h,d.add(new(nx())(.1).mul(p)),p);return r>n?n_(y):y});nT(function(t){var e=nD(t,2),r=e[0],n=e[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=Math.max(o,2),u=nD(nB([r,n]),2),c=u[0],l=u[1];if(c===-1/0||l===1/0)return[r,n];if(c===l)return nz(c,o,i);var s=nR(new(nx())(l).sub(c).div(a-1),i,0),f=nM(nA(function(t){return new(nx())(c).add(new(nx())(t).mul(s)).toNumber()}),nk)(0,a).filter(function(t){return t>=c&&t<=l});return r>n?n_(f):f});var nF=nT(function(t,e){var r=nD(t,2),n=r[0],o=r[1],i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=nD(nB([n,o]),2),u=a[0],c=a[1];if(u===-1/0||c===1/0)return[n,o];if(u===c)return[u];var l=nR(new(nx())(c).sub(u).div(Math.max(e,2)-1),i,0),s=[].concat(nN(nC.rangeStep(new(nx())(u),new(nx())(c).sub(new(nx())(.99).mul(l)),l)),[c]);return n>o?n_(s):s}),n$=r(13137),nq=r(16630),nZ=r(82944),nW=r(38569);function nY(t){return(nY="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function nH(t){return function(t){if(Array.isArray(t))return nX(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return nX(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nX(t,void 0)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nX(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,i=-1,a=null!==(e=null==r?void 0:r.length)&&void 0!==e?e:0;if(a<=1)return 0;if(o&&"angleAxis"===o.axisType&&1e-6>=Math.abs(Math.abs(o.range[1]-o.range[0])-360))for(var u=o.range,c=0;c0?n[c-1].coordinate:n[a-1].coordinate,s=n[c].coordinate,f=c>=a-1?n[0].coordinate:n[c+1].coordinate,p=void 0;if((0,nq.uY)(s-l)!==(0,nq.uY)(f-s)){var h=[];if((0,nq.uY)(f-s)===(0,nq.uY)(u[1]-u[0])){p=f;var d=s+u[1]-u[0];h[0]=Math.min(d,(d+l)/2),h[1]=Math.max(d,(d+l)/2)}else{p=l;var y=f+u[1]-u[0];h[0]=Math.min(s,(y+s)/2),h[1]=Math.max(s,(y+s)/2)}var v=[Math.min(s,(p+s)/2),Math.max(s,(p+s)/2)];if(t>v[0]&&t<=v[1]||t>=h[0]&&t<=h[1]){i=n[c].index;break}}else{var m=Math.min(l,f),b=Math.max(l,f);if(t>(m+s)/2&&t<=(b+s)/2){i=n[c].index;break}}}else for(var g=0;g0&&g(r[g].coordinate+r[g-1].coordinate)/2&&t<=(r[g].coordinate+r[g+1].coordinate)/2||g===a-1&&t>(r[g].coordinate+r[g-1].coordinate)/2){i=r[g].index;break}return i},n1=function(t){var e,r,n=t.type.displayName,o=null!==(e=t.type)&&void 0!==e&&e.defaultProps?nV(nV({},t.type.defaultProps),t.props):t.props,i=o.stroke,a=o.fill;switch(n){case"Line":r=i;break;case"Area":case"Radar":r=i&&"none"!==i?i:a;break;default:r=a}return r},n2=function(t){var e=t.barSize,r=t.totalSize,n=t.stackGroups,o=void 0===n?{}:n;if(!o)return{};for(var i={},a=Object.keys(o),u=0,c=a.length;u=0});if(v&&v.length){var m=v[0].type.defaultProps,b=void 0!==m?nV(nV({},m),v[0].props):v[0].props,g=b.barSize,x=b[y];i[x]||(i[x]=[]);var w=nr()(g)?e:g;i[x].push({item:v[0],stackList:v.slice(1),barSize:nr()(w)?void 0:(0,nq.h1)(w,r,0)})}}return i},n5=function(t){var e,r=t.barGap,n=t.barCategoryGap,o=t.bandSize,i=t.sizeList,a=void 0===i?[]:i,u=t.maxBarSize,c=a.length;if(c<1)return null;var l=(0,nq.h1)(r,o,0,!0),s=[];if(a[0].barSize===+a[0].barSize){var f=!1,p=o/c,h=a.reduce(function(t,e){return t+e.barSize||0},0);(h+=(c-1)*l)>=o&&(h-=(c-1)*l,l=0),h>=o&&p>0&&(f=!0,p*=.9,h=c*p);var d={offset:((o-h)/2>>0)-l,size:0};e=a.reduce(function(t,e){var r={item:e.item,position:{offset:d.offset+d.size+l,size:f?p:e.barSize}},n=[].concat(nH(t),[r]);return d=n[n.length-1].position,e.stackList&&e.stackList.length&&e.stackList.forEach(function(t){n.push({item:t,position:d})}),n},s)}else{var y=(0,nq.h1)(n,o,0,!0);o-2*y-(c-1)*l<=0&&(l=0);var v=(o-2*y-(c-1)*l)/c;v>1&&(v>>=0);var m=u===+u?Math.min(v,u):v;e=a.reduce(function(t,e,r){var n=[].concat(nH(t),[{item:e.item,position:{offset:y+(v+l)*r+(v-m)/2,size:m}}]);return e.stackList&&e.stackList.length&&e.stackList.forEach(function(t){n.push({item:t,position:n[n.length-1].position})}),n},s)}return e},n6=function(t,e,r,n){var o=r.children,i=r.width,a=r.margin,u=i-(a.left||0)-(a.right||0),c=(0,nW.z)({children:o,legendWidth:u});if(c){var l=n||{},s=l.width,f=l.height,p=c.align,h=c.verticalAlign,d=c.layout;if(("vertical"===d||"horizontal"===d&&"middle"===h)&&"center"!==p&&(0,nq.hj)(t[p]))return nV(nV({},t),{},nK({},p,t[p]+(s||0)));if(("horizontal"===d||"vertical"===d&&"center"===p)&&"middle"!==h&&(0,nq.hj)(t[h]))return nV(nV({},t),{},nK({},h,t[h]+(f||0)))}return t},n3=function(t,e,r,n,o){var i=e.props.children,a=(0,nZ.NN)(i,n$.W).filter(function(t){var e;return e=t.props.direction,!!nr()(o)||("horizontal"===n?"yAxis"===o:"vertical"===n||"x"===e?"xAxis"===o:"y"!==e||"yAxis"===o)});if(a&&a.length){var u=a.map(function(t){return t.props.dataKey});return t.reduce(function(t,e){var n=nQ(e,r);if(nr()(n))return t;var o=Array.isArray(n)?[nt()(n),r8()(n)]:[n,n],i=u.reduce(function(t,r){var n=nQ(e,r,0),i=o[0]-Math.abs(Array.isArray(n)?n[0]:n),a=o[1]+Math.abs(Array.isArray(n)?n[1]:n);return[Math.min(i,t[0]),Math.max(a,t[1])]},[1/0,-1/0]);return[Math.min(i[0],t[0]),Math.max(i[1],t[1])]},[1/0,-1/0])}return null},n7=function(t,e,r,n,o){var i=e.map(function(e){return n3(t,e,r,o,n)}).filter(function(t){return!nr()(t)});return i&&i.length?i.reduce(function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]},[1/0,-1/0]):null},n4=function(t,e,r,n,o){var i=e.map(function(e){var i=e.props.dataKey;return"number"===r&&i&&n3(t,e,i,n)||nJ(t,i,r,o)});if("number"===r)return i.reduce(function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]},[1/0,-1/0]);var a={};return i.reduce(function(t,e){for(var r=0,n=e.length;r=2?2*(0,nq.uY)(a[0]-a[1])*c:c,e&&(t.ticks||t.niceTicks))?(t.ticks||t.niceTicks).map(function(t){return{coordinate:n(o?o.indexOf(t):t)+c,value:t,offset:c}}).filter(function(t){return!np()(t.coordinate)}):t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(t,e){return{coordinate:n(t)+c,value:t,index:e,offset:c}}):n.ticks&&!r?n.ticks(t.tickCount).map(function(t){return{coordinate:n(t)+c,value:t,offset:c}}):n.domain().map(function(t,e){return{coordinate:n(t)+c,value:o?o[t]:t,index:e,offset:c}})},oe=new WeakMap,or=function(t,e){if("function"!=typeof e)return t;oe.has(t)||oe.set(t,new WeakMap);var r=oe.get(t);if(r.has(e))return r.get(e);var n=function(){t.apply(void 0,arguments),e.apply(void 0,arguments)};return r.set(e,n),n},on=function(t,e,r){var n=t.scale,o=t.type,i=t.layout,a=t.axisType;if("auto"===n)return"radial"===i&&"radiusAxis"===a?{scale:f.Z(),realScaleType:"band"}:"radial"===i&&"angleAxis"===a?{scale:tL(),realScaleType:"linear"}:"category"===o&&e&&(e.indexOf("LineChart")>=0||e.indexOf("AreaChart")>=0||e.indexOf("ComposedChart")>=0&&!r)?{scale:f.x(),realScaleType:"point"}:"category"===o?{scale:f.Z(),realScaleType:"band"}:{scale:tL(),realScaleType:"linear"};if(na()(n)){var u="scale".concat(nd()(n));return{scale:(s[u]||f.x)(),realScaleType:s[u]?u:"point"}}return no()(n)?{scale:n}:{scale:f.x(),realScaleType:"point"}},oo=function(t){var e=t.domain();if(e&&!(e.length<=2)){var r=e.length,n=t.range(),o=Math.min(n[0],n[1])-1e-4,i=Math.max(n[0],n[1])+1e-4,a=t(e[0]),u=t(e[r-1]);(ai||ui)&&t.domain([e[0],e[r-1]])}},oi=function(t,e){if(!t)return null;for(var r=0,n=t.length;rn)&&(o[1]=n),o[0]>n&&(o[0]=n),o[1]=0?(t[a][r][0]=o,t[a][r][1]=o+u,o=t[a][r][1]):(t[a][r][0]=i,t[a][r][1]=i+u,i=t[a][r][1])}},expand:function(t,e){if((n=t.length)>0){for(var r,n,o,i=0,a=t[0].length;i0){for(var r,n=0,o=t[e[0]],i=o.length;n0&&(n=(r=t[e[0]]).length)>0){for(var r,n,o,i=0,a=1;a=0?(t[i][r][0]=o,t[i][r][1]=o+a,o=t[i][r][1]):(t[i][r][0]=0,t[i][r][1]=0)}}},oc=function(t,e,r){var n=e.map(function(t){return t.props.dataKey}),o=ou[r];return(function(){var t=(0,r5.Z)([]),e=r6,r=r1,n=r3;function o(o){var i,a,u=Array.from(t.apply(this,arguments),r7),c=u.length,l=-1;for(let t of o)for(i=0,++l;i=0?0:o<0?o:n}return r[0]},od=function(t,e){var r,n=(null!==(r=t.type)&&void 0!==r&&r.defaultProps?nV(nV({},t.type.defaultProps),t.props):t.props).stackId;if((0,nq.P2)(n)){var o=e[n];if(o){var i=o.items.indexOf(t);return i>=0?o.stackedData[i]:null}}return null},oy=function(t,e,r){return Object.keys(t).reduce(function(n,o){var i=t[o].stackedData.reduce(function(t,n){var o=n.slice(e,r+1).reduce(function(t,e){return[nt()(e.concat([t[0]]).filter(nq.hj)),r8()(e.concat([t[1]]).filter(nq.hj))]},[1/0,-1/0]);return[Math.min(t[0],o[0]),Math.max(t[1],o[1])]},[1/0,-1/0]);return[Math.min(i[0],n[0]),Math.max(i[1],n[1])]},[1/0,-1/0]).map(function(t){return t===1/0||t===-1/0?0:t})},ov=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,om=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ob=function(t,e,r){if(no()(t))return t(e,r);if(!Array.isArray(t))return e;var n=[];if((0,nq.hj)(t[0]))n[0]=r?t[0]:Math.min(t[0],e[0]);else if(ov.test(t[0])){var o=+ov.exec(t[0])[1];n[0]=e[0]-o}else no()(t[0])?n[0]=t[0](e[0]):n[0]=e[0];if((0,nq.hj)(t[1]))n[1]=r?t[1]:Math.max(t[1],e[1]);else if(om.test(t[1])){var i=+om.exec(t[1])[1];n[1]=e[1]+i}else no()(t[1])?n[1]=t[1](e[1]):n[1]=e[1];return n},og=function(t,e,r){if(t&&t.scale&&t.scale.bandwidth){var n=t.scale.bandwidth();if(!r||n>0)return n}if(t&&e&&e.length>=2){for(var o=nb()(e,function(t){return t.coordinate}),i=1/0,a=1,u=o.length;a1&&void 0!==arguments[1]?arguments[1]:{};if(null==t||n.x.isSsr)return{width:0,height:0};var o=(Object.keys(e=a({},r)).forEach(function(t){e[t]||delete e[t]}),e),i=JSON.stringify({text:t,copyStyle:o});if(u.widthCache[i])return u.widthCache[i];try{var s=document.getElementById(l);s||((s=document.createElement("span")).setAttribute("id",l),s.setAttribute("aria-hidden","true"),document.body.appendChild(s));var f=a(a({},c),o);Object.assign(s.style,f),s.textContent="".concat(t);var p=s.getBoundingClientRect(),h={width:p.width,height:p.height};return u.widthCache[i]=h,++u.cacheCount>2e3&&(u.cacheCount=0,u.widthCache={}),h}catch(t){return{width:0,height:0}}},f=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}}},16630:function(t,e,r){"use strict";r.d(e,{Ap:function(){return S},EL:function(){return g},Kt:function(){return w},P2:function(){return m},Rw:function(){return v},bv:function(){return O},fC:function(){return P},h1:function(){return x},hU:function(){return d},hj:function(){return y},k4:function(){return j},uY:function(){return h}});var n=r(42715),o=r.n(n),i=r(82559),a=r.n(i),u=r(13735),c=r.n(u),l=r(22345),s=r.n(l),f=r(77571),p=r.n(f),h=function(t){return 0===t?0:t>0?1:-1},d=function(t){return o()(t)&&t.indexOf("%")===t.length-1},y=function(t){return s()(t)&&!a()(t)},v=function(t){return p()(t)},m=function(t){return y(t)||o()(t)},b=0,g=function(t){var e=++b;return"".concat(t||"").concat(e)},x=function(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!y(t)&&!o()(t))return n;if(d(t)){var u=t.indexOf("%");r=e*parseFloat(t.slice(0,u))/100}else r=+t;return a()(r)&&(r=n),i&&r>e&&(r=e),r},w=function(t){if(!t)return null;var e=Object.keys(t);return e&&e.length?t[e[0]]:null},O=function(t){if(!Array.isArray(t))return!1;for(var e=t.length,r={},n=0;n2?r-2:0),o=2;ot.length)&&(e=t.length);for(var r=0,n=Array(e);r2&&void 0!==arguments[2]?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(e-(r.top||0)-(r.bottom||0)))/2},b=function(t,e,r,n,i){var a=t.width,u=t.height,s=t.startAngle,f=t.endAngle,y=(0,c.h1)(t.cx,a,a/2),v=(0,c.h1)(t.cy,u,u/2),b=m(a,u,r),g=(0,c.h1)(t.innerRadius,b,0),x=(0,c.h1)(t.outerRadius,b,.8*b);return Object.keys(e).reduce(function(t,r){var a,u=e[r],c=u.domain,m=u.reversed;if(o()(u.range))"angleAxis"===n?a=[s,f]:"radiusAxis"===n&&(a=[g,x]),m&&(a=[a[1],a[0]]);else{var b,w=function(t){if(Array.isArray(t))return t}(b=a=u.range)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(b,2)||function(t,e){if(t){if("string"==typeof t)return d(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(t,2)}}(b,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();s=w[0],f=w[1]}var O=(0,l.Hq)(u,i),j=O.realScaleType,S=O.scale;S.domain(c).range(a),(0,l.zF)(S);var P=(0,l.g$)(S,p(p({},u),{},{realScaleType:j})),E=p(p(p({},u),P),{},{range:a,radius:x,realScaleType:j,scale:S,cx:y,cy:v,innerRadius:g,outerRadius:x,startAngle:s,endAngle:f});return p(p({},t),{},h({},r,E))},{})},g=function(t,e){var r=t.x,n=t.y;return Math.sqrt(Math.pow(r-e.x,2)+Math.pow(n-e.y,2))},x=function(t,e){var r=t.x,n=t.y,o=e.cx,i=e.cy,a=g({x:r,y:n},{x:o,y:i});if(a<=0)return{radius:a};var u=Math.acos((r-o)/a);return n>i&&(u=2*Math.PI-u),{radius:a,angle:180*u/Math.PI,angleInRadian:u}},w=function(t){var e=t.startAngle,r=t.endAngle,n=Math.min(Math.floor(e/360),Math.floor(r/360));return{startAngle:e-360*n,endAngle:r-360*n}},O=function(t,e){var r,n=x({x:t.x,y:t.y},e),o=n.radius,i=n.angle,a=e.innerRadius,u=e.outerRadius;if(ou)return!1;if(0===o)return!0;var c=w(e),l=c.startAngle,s=c.endAngle,f=i;if(l<=s){for(;f>s;)f-=360;for(;f=l&&f<=s}else{for(;f>l;)f-=360;for(;f=s&&f<=l}return r?p(p({},e),{},{radius:o,angle:f+360*Math.min(Math.floor(e.startAngle/360),Math.floor(e.endAngle/360))}):null},j=function(t){return(0,i.isValidElement)(t)||u()(t)||"boolean"==typeof t?"":t.className}},82944:function(t,e,r){"use strict";r.d(e,{$R:function(){return R},Bh:function(){return B},Gf:function(){return j},L6:function(){return N},NN:function(){return k},TT:function(){return M},eu:function(){return L},jf:function(){return T},rL:function(){return D},sP:function(){return A}});var n=r(13735),o=r.n(n),i=r(77571),a=r.n(i),u=r(42715),c=r.n(u),l=r(86757),s=r.n(l),f=r(28302),p=r.n(f),h=r(2265),d=r(14326),y=r(16630),v=r(46485),m=r(41637),b=["children"],g=["children"];function x(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e.indexOf(n)>=0)continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function w(t){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var O={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},j=function(t){return"string"==typeof t?t:t?t.displayName||t.name||"Component":""},S=null,P=null,E=function t(e){if(e===S&&Array.isArray(P))return P;var r=[];return h.Children.forEach(e,function(e){a()(e)||((0,d.isFragment)(e)?r=r.concat(t(e.props.children)):r.push(e))}),P=r,S=e,r};function k(t,e){var r=[],n=[];return n=Array.isArray(e)?e.map(function(t){return j(t)}):[j(e)],E(t).forEach(function(t){var e=o()(t,"type.displayName")||o()(t,"type.name");-1!==n.indexOf(e)&&r.push(t)}),r}function A(t,e){var r=k(t,e);return r&&r[0]}var M=function(t){if(!t||!t.props)return!1;var e=t.props,r=e.width,n=e.height;return!!(0,y.hj)(r)&&!(r<=0)&&!!(0,y.hj)(n)&&!(n<=0)},_=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],T=function(t){return t&&"object"===w(t)&&"clipDot"in t},C=function(t,e,r,n){var o,i=null!==(o=null===m.ry||void 0===m.ry?void 0:m.ry[n])&&void 0!==o?o:[];return e.startsWith("data-")||!s()(t)&&(n&&i.includes(e)||m.Yh.includes(e))||r&&m.nv.includes(e)},N=function(t,e,r){if(!t||"function"==typeof t||"boolean"==typeof t)return null;var n=t;if((0,h.isValidElement)(t)&&(n=t.props),!p()(n))return null;var o={};return Object.keys(n).forEach(function(t){var i;C(null===(i=n)||void 0===i?void 0:i[t],t,e,r)&&(o[t]=n[t])}),o},D=function t(e,r){if(e===r)return!0;var n=h.Children.count(e);if(n!==h.Children.count(r))return!1;if(0===n)return!0;if(1===n)return I(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var o=0;o=0)r.push(t);else if(t){var i=j(t.type),a=e[i]||{},u=a.handler,l=a.once;if(u&&(!l||!n[i])){var s=u(t,i,o);r.push(s),n[i]=!0}}}),r},B=function(t){var e=t&&t.type;return e&&O[e]?O[e]:null},R=function(t,e){return E(e).indexOf(t)}},46485:function(t,e,r){"use strict";function n(t,e){for(var r in t)if(({}).hasOwnProperty.call(t,r)&&(!({}).hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if(({}).hasOwnProperty.call(e,n)&&!({}).hasOwnProperty.call(t,n))return!1;return!0}r.d(e,{w:function(){return n}})},38569:function(t,e,r){"use strict";r.d(e,{z:function(){return l}});var n=r(22190),o=r(85355),i=r(82944);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function c(t){for(var e=1;e=0))throw Error(`invalid digits: ${t}`);if(e>15)return a;let r=10**e;return function(t){this._+=t[0];for(let e=1,n=t.length;e1e-6){if(Math.abs(f*c-l*s)>1e-6&&i){let h=r-a,d=o-u,y=c*c+l*l,v=Math.sqrt(y),m=Math.sqrt(p),b=i*Math.tan((n-Math.acos((y+p-(h*h+d*d))/(2*v*m)))/2),g=b/m,x=b/v;Math.abs(g-1)>1e-6&&this._append`L${t+g*s},${e+g*f}`,this._append`A${i},${i},0,0,${+(f*h>s*d)},${this._x1=t+x*c},${this._y1=e+x*l}`}else this._append`L${this._x1=t},${this._y1=e}`}}arc(t,e,r,a,u,c){if(t=+t,e=+e,c=!!c,(r=+r)<0)throw Error(`negative radius: ${r}`);let l=r*Math.cos(a),s=r*Math.sin(a),f=t+l,p=e+s,h=1^c,d=c?a-u:u-a;null===this._x1?this._append`M${f},${p}`:(Math.abs(this._x1-f)>1e-6||Math.abs(this._y1-p)>1e-6)&&this._append`L${f},${p}`,r&&(d<0&&(d=d%o+o),d>i?this._append`A${r},${r},0,1,${h},${t-l},${e-s}A${r},${r},0,1,${h},${this._x1=f},${this._y1=p}`:d>1e-6&&this._append`A${r},${r},0,${+(d>=n)},${h},${this._x1=t+r*Math.cos(u)},${this._y1=e+r*Math.sin(u)}`)}rect(t,e,r,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${r=+r}v${+n}h${-r}Z`}toString(){return this._}}function c(t){let e=3;return t.digits=function(r){if(!arguments.length)return e;if(null==r)e=null;else{let t=Math.floor(r);if(!(t>=0))throw RangeError(`invalid digits: ${r}`);e=t}return t},()=>new u(e)}u.prototype},59121:function(t,e,r){"use strict";r.d(e,{E:function(){return i}});var n=r(99649),o=r(63497);function i(t,e){let r=(0,n.Q)(t);return isNaN(e)?(0,o.L)(t,NaN):(e&&r.setDate(r.getDate()+e),r)}},31091:function(t,e,r){"use strict";r.d(e,{z:function(){return i}});var n=r(99649),o=r(63497);function i(t,e){let r=(0,n.Q)(t);if(isNaN(e))return(0,o.L)(t,NaN);if(!e)return r;let i=r.getDate(),a=(0,o.L)(t,r.getTime());return(a.setMonth(r.getMonth()+e+1,0),i>=a.getDate())?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}},63497:function(t,e,r){"use strict";function n(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}r.d(e,{L:function(){return n}})},99649:function(t,e,r){"use strict";function n(t){let e=Object.prototype.toString.call(t);return t instanceof Date||"object"==typeof t&&"[object Date]"===e?new t.constructor(+t):new Date("number"==typeof t||"[object Number]"===e||"string"==typeof t||"[object String]"===e?t:NaN)}r.d(e,{Q:function(){return n}})},69398:function(t,e,r){"use strict";function n(t,e){if(!t)throw Error("Invariant failed")}r.d(e,{Z:function(){return n}})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1274-e76373d2e507ce0d.js b/litellm/proxy/_experimental/out/_next/static/chunks/1274-e76373d2e507ce0d.js deleted file mode 100644 index 1180f8691b..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1274-e76373d2e507ce0d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1274],{26210:function(e,t,l){l.d(t,{UQ:function(){return s.Z},X1:function(){return i.Z},_m:function(){return a.Z},oi:function(){return n.Z},xv:function(){return r.Z}});var s=l(87452),i=l(88829),a=l(72208),r=l(84264),n=l(49566)},30078:function(e,t,l){l.d(t,{Ct:function(){return s.Z},Dx:function(){return x.Z},OK:function(){return n.Z},Zb:function(){return a.Z},nP:function(){return c.Z},oi:function(){return h.Z},rj:function(){return r.Z},td:function(){return o.Z},v0:function(){return m.Z},x4:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var s=l(41649),i=l(78489),a=l(12514),r=l(67101),n=l(12485),m=l(18135),o=l(35242),d=l(29706),c=l(77991),u=l(84264),h=l(49566),x=l(96761)},62490:function(e,t,l){l.d(t,{Ct:function(){return s.Z},RM:function(){return n.Z},SC:function(){return c.Z},Zb:function(){return a.Z},iA:function(){return r.Z},pj:function(){return m.Z},ss:function(){return o.Z},xs:function(){return d.Z},xv:function(){return u.Z},zx:function(){return i.Z}});var s=l(41649),i=l(78489),a=l(12514),r=l(21626),n=l(97214),m=l(28241),o=l(58834),d=l(69552),c=l(71876),u=l(84264)},47359:function(e,t,l){l.d(t,{y:function(){return n}});var s=l(11713),i=l(39760),a=l(39623);let r=(0,l(90246).n)("teams"),n=()=>{let{accessToken:e,userId:t,userRole:l}=(0,i.Z)();return(0,s.a)({queryKey:r.list({}),queryFn:async()=>await (0,a.Z)(e,t,l,null),enabled:!!e})}},33860:function(e,t,l){var s=l(57437),i=l(2265),a=l(10032),r=l(22116),n=l(37592),m=l(99981),o=l(5545),d=l(7310),c=l.n(d),u=l(19250);t.Z=e=>{let{isVisible:t,onCancel:l,onSubmit:d,accessToken:h,title:x="Add Team Member",roles:g=[{label:"admin",value:"admin",description:"Admin role. Can create team keys, add members, and manage settings."},{label:"user",value:"user",description:"User role. Can view team info, but not manage it."}],defaultRole:_="user"}=e,[b]=a.Z.useForm(),[p,v]=(0,i.useState)([]),[j,f]=(0,i.useState)(!1),[y,Z]=(0,i.useState)("user_email"),N=async(e,t)=>{if(!e){v([]);return}f(!0);try{let l=new URLSearchParams;if(l.append(t,e),null==h)return;let s=(await (0,u.userFilterUICall)(h,l)).map(e=>({label:"user_email"===t?"".concat(e.user_email):"".concat(e.user_id),value:"user_email"===t?e.user_email:e.user_id,user:e}));v(s)}catch(e){console.error("Error fetching users:",e)}finally{f(!1)}},w=(0,i.useCallback)(c()((e,t)=>N(e,t),300),[]),k=(e,t)=>{Z(t),w(e,t)},S=(e,t)=>{let l=t.user;b.setFieldsValue({user_email:l.user_email,user_id:l.user_id,role:b.getFieldValue("role")})};return(0,s.jsx)(r.Z,{title:x,open:t,onCancel:()=>{b.resetFields(),v([]),l()},footer:null,width:800,children:(0,s.jsxs)(a.Z,{form:b,onFinish:d,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",initialValues:{role:_},children:[(0,s.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",children:(0,s.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by email",filterOption:!1,onSearch:e=>k(e,"user_email"),onSelect:(e,t)=>S(e,t),options:"user_email"===y?p:[],loading:j,allowClear:!0})}),(0,s.jsx)("div",{className:"text-center mb-4",children:"OR"}),(0,s.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,s.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search by user ID",filterOption:!1,onSearch:e=>k(e,"user_id"),onSelect:(e,t)=>S(e,t),options:"user_id"===y?p:[],loading:j,allowClear:!0})}),(0,s.jsx)(a.Z.Item,{label:"Member Role",name:"role",className:"mb-4",children:(0,s.jsx)(n.default,{defaultValue:_,children:g.map(e=>(0,s.jsx)(n.default.Option,{value:e.value,children:(0,s.jsxs)(m.Z,{title:e.description,children:[(0,s.jsx)("span",{className:"font-medium",children:e.label}),(0,s.jsxs)("span",{className:"ml-2 text-gray-500 text-sm",children:["- ",e.description]})]})},e.value))})}),(0,s.jsx)("div",{className:"text-right mt-4",children:(0,s.jsx)(o.ZP,{type:"default",htmlType:"submit",children:"Add Member"})})]})})}},36894:function(e,t,l){var s=l(57437),i=l(56522),a=l(10032),r=l(37592),n=l(22116),m=l(5545),o=l(2265),d=l(24199);t.Z=e=>{var t,l,c;let{visible:u,onCancel:h,onSubmit:x,initialData:g,mode:_,config:b}=e,[p]=a.Z.useForm(),[v,j]=(0,o.useState)(!1);console.log("Initial Data:",g),(0,o.useEffect)(()=>{if(u){if("edit"===_&&g){let e={...g,role:g.role||b.defaultRole,max_budget_in_team:g.max_budget_in_team||null,tpm_limit:g.tpm_limit||null,rpm_limit:g.rpm_limit||null};console.log("Setting form values:",e),p.setFieldsValue(e)}else{var e;p.resetFields(),p.setFieldsValue({role:b.defaultRole||(null===(e=b.roleOptions[0])||void 0===e?void 0:e.value)})}}},[u,g,_,p,b.defaultRole,b.roleOptions]);let f=async e=>{try{j(!0);let t=Object.entries(e).reduce((e,t)=>{let[l,s]=t;if("string"==typeof s){let t=s.trim();return""===t&&("max_budget_in_team"===l||"tpm_limit"===l||"rpm_limit"===l)?{...e,[l]:null}:{...e,[l]:t}}return{...e,[l]:s}},{});console.log("Submitting form data:",t),await Promise.resolve(x(t)),p.resetFields()}catch(e){console.error("Form submission error:",e)}finally{j(!1)}},y=e=>{switch(e.type){case"input":return(0,s.jsx)(i.o,{placeholder:e.placeholder});case"numerical":return(0,s.jsx)(d.Z,{step:e.step||1,min:e.min||0,style:{width:"100%"},placeholder:e.placeholder||"Enter a numerical value"});case"select":var t;return(0,s.jsx)(r.default,{children:null===(t=e.options)||void 0===t?void 0:t.map(e=>(0,s.jsx)(r.default.Option,{value:e.value,children:e.label},e.value))});default:return null}};return(0,s.jsx)(n.Z,{title:b.title||("add"===_?"Add Member":"Edit Member"),open:u,width:1e3,footer:null,onCancel:h,children:(0,s.jsxs)(a.Z,{form:p,onFinish:f,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[b.showEmail&&(0,s.jsx)(a.Z.Item,{label:"Email",name:"user_email",className:"mb-4",rules:[{type:"email",message:"Please enter a valid email!"}],children:(0,s.jsx)(i.o,{placeholder:"user@example.com"})}),b.showEmail&&b.showUserId&&(0,s.jsx)("div",{className:"text-center mb-4",children:(0,s.jsx)(i.x,{children:"OR"})}),b.showUserId&&(0,s.jsx)(a.Z.Item,{label:"User ID",name:"user_id",className:"mb-4",children:(0,s.jsx)(i.o,{placeholder:"user_123"})}),(0,s.jsx)(a.Z.Item,{label:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{children:"Role"}),"edit"===_&&g&&(0,s.jsxs)("span",{className:"text-gray-500 text-sm",children:["(Current: ",(l=g.role,(null===(c=b.roleOptions.find(e=>e.value===l))||void 0===c?void 0:c.label)||l),")"]})]}),name:"role",className:"mb-4",rules:[{required:!0,message:"Please select a role!"}],children:(0,s.jsx)(r.default,{children:"edit"===_&&g?[...b.roleOptions.filter(e=>e.value===g.role),...b.roleOptions.filter(e=>e.value!==g.role)].map(e=>(0,s.jsx)(r.default.Option,{value:e.value,children:e.label},e.value)):b.roleOptions.map(e=>(0,s.jsx)(r.default.Option,{value:e.value,children:e.label},e.value))})}),null===(t=b.additionalFields)||void 0===t?void 0:t.map(e=>(0,s.jsx)(a.Z.Item,{label:e.label,name:e.name,className:"mb-4",rules:e.rules,children:y(e)},e.name)),(0,s.jsxs)("div",{className:"text-right mt-6",children:[(0,s.jsx)(m.ZP,{onClick:h,className:"mr-2",disabled:v,children:"Cancel"}),(0,s.jsx)(m.ZP,{type:"default",htmlType:"submit",loading:v,children:"add"===_?v?"Adding...":"Add Member":v?"Saving...":"Save Changes"})]})]})})}},93542:function(e,t,l){l.d(t,{Z:function(){return ei}});var s=l(57437),i=l(33860),a=l(19250),r=l(59872),n=l(33304),m=l(15424),o=l(10900),d=l(30078),c=l(10032),u=l(42264),h=l(5545),x=l(4260),g=l(37592),_=l(99981),b=l(63709),p=l(30401),v=l(78867),j=l(2265),f=l(82586),y=l(21609),Z=l(95096),N=l(46468),w=l(27799),k=l(97492),S=l(68473),M=l(9114),C=l(60131),T=l(24199),I=l(97415),P=l(21425),O=l(36894),F=l(89245),L=l(78355),E=l(95704),D=l(61994),A=l(85180);let R={"/key/generate":"Member can generate a virtual key for this team","/key/service-account/generate":"Member can generate a service account key (not belonging to any user) for this team","/key/update":"Member can update a virtual key belonging to this team","/key/delete":"Member can delete a virtual key belonging to this team","/key/info":"Member can get info about a virtual key belonging to this team","/key/regenerate":"Member can regenerate a virtual key belonging to this team","/key/{key_id}/regenerate":"Member can regenerate a virtual key belonging to this team","/key/list":"Member can list virtual keys belonging to this team","/key/block":"Member can block a virtual key belonging to this team","/key/unblock":"Member can unblock a virtual key belonging to this team"},U=e=>e.includes("/info")||e.includes("/list")?"GET":"POST",V=e=>{let t=U(e),l=R[e];if(!l){for(let[t,s]of Object.entries(R))if(e.includes(t)){l=s;break}}return l||(l="Access ".concat(e)),{method:t,endpoint:e,description:l,route:e}};var z=e=>{let{teamId:t,accessToken:l,canEditTeam:i}=e,[r,n]=(0,j.useState)([]),[m,o]=(0,j.useState)([]),[d,c]=(0,j.useState)(!0),[u,x]=(0,j.useState)(!1),[g,_]=(0,j.useState)(!1),b=async()=>{try{if(c(!0),!l)return;let e=await (0,a.getTeamPermissionsCall)(l,t),s=e.all_available_permissions||[];n(s);let i=e.team_member_permissions||[];o(i),_(!1)}catch(e){M.Z.fromBackend("Failed to load permissions"),console.error("Error fetching permissions:",e)}finally{c(!1)}};(0,j.useEffect)(()=>{b()},[t,l]);let p=(e,t)=>{o(t?[...m,e]:m.filter(t=>t!==e)),_(!0)},v=async()=>{try{if(!l)return;x(!0),await (0,a.teamPermissionsUpdateCall)(l,t,m),M.Z.success("Permissions updated successfully"),_(!1)}catch(e){M.Z.fromBackend("Failed to update permissions"),console.error("Error updating permissions:",e)}finally{x(!1)}};if(d)return(0,s.jsx)("div",{className:"p-6 text-center",children:"Loading permissions..."});let f=r.length>0;return(0,s.jsxs)(E.Zb,{className:"bg-white shadow-md rounded-md p-6",children:[(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center border-b pb-4 mb-6",children:[(0,s.jsx)(E.Dx,{className:"mb-2 sm:mb-0",children:"Member Permissions"}),i&&g&&(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsx)(h.ZP,{icon:(0,s.jsx)(F.Z,{}),onClick:()=>{b()},children:"Reset"}),(0,s.jsxs)(h.ZP,{onClick:v,loading:u,type:"primary",children:[(0,s.jsx)(L.Z,{})," Save Changes"]})]})]}),(0,s.jsx)(E.xv,{className:"mb-6 text-gray-600",children:"Control what team members can do when they are not team admins."}),f?(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(E.iA,{className:" min-w-full",children:[(0,s.jsx)(E.ss,{children:(0,s.jsxs)(E.SC,{children:[(0,s.jsx)(E.xs,{children:"Method"}),(0,s.jsx)(E.xs,{children:"Endpoint"}),(0,s.jsx)(E.xs,{children:"Description"}),(0,s.jsx)(E.xs,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:"Allow Access"})]})}),(0,s.jsx)(E.RM,{children:r.map(e=>{let t=V(e);return(0,s.jsxs)(E.SC,{className:"hover:bg-gray-50 transition-colors",children:[(0,s.jsx)(E.pj,{children:(0,s.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium ".concat("GET"===t.method?"bg-blue-100 text-blue-800":"bg-green-100 text-green-800"),children:t.method})}),(0,s.jsx)(E.pj,{children:(0,s.jsx)("span",{className:"font-mono text-sm text-gray-800",children:t.endpoint})}),(0,s.jsx)(E.pj,{className:"text-gray-700",children:t.description}),(0,s.jsx)(E.pj,{className:"sticky right-0 bg-white shadow-[-4px_0_4px_-4px_rgba(0,0,0,0.1)] text-center",children:(0,s.jsx)(D.Z,{checked:m.includes(e),onChange:t=>p(e,t.target.checked),disabled:!i})})]},e)})})]})}):(0,s.jsx)("div",{className:"py-12",children:(0,s.jsx)(A.Z,{description:"No permissions available"})})]})},B=l(78489),G=l(12514),q=l(47323),K=l(21626),J=l(97214),$=l(28241),W=l(58834),Q=l(69552),X=l(71876),Y=l(84264),H=l(53410),ee=l(74998),et=e=>{let{teamData:t,canEditTeam:l,handleMemberDelete:i,setSelectedEditMember:a,setIsEditMemberModalVisible:n,setIsAddMemberModalVisible:o}=e,d=e=>{if(null==e)return"0";if("number"==typeof e){let t=Number(e);return t===Math.floor(t)?t.toString():(0,r.pw)(t,8).replace(/\.?0+$/,"")}return"0"},c=e=>{if(!e)return 0;let l=t.team_memberships.find(t=>t.user_id===e);return(null==l?void 0:l.spend)||0},u=e=>{var l;if(!e)return null;let s=t.team_memberships.find(t=>t.user_id===e);console.log("membership=".concat(s));let i=null==s?void 0:null===(l=s.litellm_budget_table)||void 0===l?void 0:l.max_budget;return null==i?null:d(i)},h=e=>{var l,s;if(!e)return"No Limits";let i=t.team_memberships.find(t=>t.user_id===e),a=null==i?void 0:null===(l=i.litellm_budget_table)||void 0===l?void 0:l.rpm_limit,r=null==i?void 0:null===(s=i.litellm_budget_table)||void 0===s?void 0:s.tpm_limit,n=[a?"".concat(d(a)," RPM"):null,r?"".concat(d(r)," TPM"):null].filter(Boolean);return n.length>0?n.join(" / "):"No Limits"};return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(G.Z,{className:"w-full mx-auto flex-auto overflow-auto max-h-[50vh]",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)(K.Z,{className:"min-w-full",children:[(0,s.jsx)(W.Z,{children:(0,s.jsxs)(X.Z,{children:[(0,s.jsx)(Q.Z,{children:"User ID"}),(0,s.jsx)(Q.Z,{children:"User Email"}),(0,s.jsx)(Q.Z,{children:"Role"}),(0,s.jsxs)(Q.Z,{children:["Team Member Spend (USD)"," ",(0,s.jsx)(_.Z,{title:"This is the amount spent by a user in the team.",children:(0,s.jsx)(m.Z,{})})]}),(0,s.jsx)(Q.Z,{children:"Team Member Budget (USD)"}),(0,s.jsxs)(Q.Z,{children:["Team Member Rate Limits"," ",(0,s.jsx)(_.Z,{title:"Rate limits for this member's usage within this team.",children:(0,s.jsx)(m.Z,{})})]}),(0,s.jsx)(Q.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:"Actions"})]})}),(0,s.jsx)(J.Z,{children:t.team_info.members_with_roles.map((e,m)=>(0,s.jsxs)(X.Z,{children:[(0,s.jsx)($.Z,{children:(0,s.jsx)(Y.Z,{className:"font-mono",children:e.user_id})}),(0,s.jsx)($.Z,{children:(0,s.jsx)(Y.Z,{className:"font-mono",children:e.user_email?e.user_email:"No Email"})}),(0,s.jsx)($.Z,{children:(0,s.jsx)(Y.Z,{className:"font-mono",children:e.role})}),(0,s.jsx)($.Z,{children:(0,s.jsxs)(Y.Z,{className:"font-mono",children:["$",(0,r.pw)(c(e.user_id),4)]})}),(0,s.jsx)($.Z,{children:(0,s.jsx)(Y.Z,{className:"font-mono",children:u(e.user_id)?"$".concat((0,r.pw)(Number(u(e.user_id)),4)):"No Limit"})}),(0,s.jsx)($.Z,{children:(0,s.jsx)(Y.Z,{className:"font-mono",children:h(e.user_id)})}),(0,s.jsx)($.Z,{className:"sticky right-0 bg-white z-10 border-l border-gray-200",children:l&&(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(q.Z,{icon:H.Z,size:"sm",onClick:()=>{var l,s,i;let r=t.team_memberships.find(t=>t.user_id===e.user_id);a({...e,max_budget_in_team:(null==r?void 0:null===(l=r.litellm_budget_table)||void 0===l?void 0:l.max_budget)||null,tpm_limit:(null==r?void 0:null===(s=r.litellm_budget_table)||void 0===s?void 0:s.tpm_limit)||null,rpm_limit:(null==r?void 0:null===(i=r.litellm_budget_table)||void 0===i?void 0:i.rpm_limit)||null}),n(!0)},className:"cursor-pointer hover:text-blue-600"}),(0,s.jsx)(q.Z,{icon:ee.Z,size:"sm",onClick:()=>i(e),className:"cursor-pointer hover:text-red-600"})]})})]},m))})]})})}),(0,s.jsx)(B.Z,{onClick:()=>o(!0),children:"Add Member"})]})};function el(e){let{className:t,value:l,onChange:i}=e;return(0,s.jsxs)(g.default,{className:t,value:l,onChange:i,children:[(0,s.jsx)(g.default.Option,{value:"24h",children:"Daily"}),(0,s.jsx)(g.default.Option,{value:"7d",children:"Weekly"}),(0,s.jsx)(g.default.Option,{value:"30d",children:"Monthly"})]})}let es=(e,t)=>{let l=[];return l=e?e.models.includes("all-proxy-models")?t:e.models.length>0?e.models:t:t,(0,N.Ob)(l,t)};var ei=e=>{var t,l,F,L,E,D,A,R,U,V,B,G,q,K,J,$,W,Q,X,Y,H,ee,ei,ea,er,en;let em;let{teamId:eo,onClose:ed,accessToken:ec,is_team_admin:eu,is_proxy_admin:eh,userModels:ex,editTeam:eg,premiumUser:e_=!1,onUpdate:eb}=e,[ep,ev]=(0,j.useState)(null),[ej,ef]=(0,j.useState)(!0),[ey,eZ]=(0,j.useState)(!1),[eN]=c.Z.useForm(),[ew,ek]=(0,j.useState)(!1),[eS,eM]=(0,j.useState)(null),[eC,eT]=(0,j.useState)(!1),[eI,eP]=(0,j.useState)([]),[eO,eF]=(0,j.useState)(!1),[eL,eE]=(0,j.useState)({}),[eD,eA]=(0,j.useState)([]),[eR,eU]=(0,j.useState)(null),[eV,ez]=(0,j.useState)(!1),[eB,eG]=(0,j.useState)(!1),[eq,eK]=(0,j.useState)(!1),[eJ,e$]=(0,j.useState)(null);console.log("userModels in team info",ex);let eW=eu||eh,eQ=async()=>{try{if(ef(!0),!ec)return;let e=await (0,a.teamInfoCall)(ec,eo);ev(e)}catch(e){M.Z.fromBackend("Failed to load team information"),console.error("Error fetching team info:",e)}finally{ef(!1)}};(0,j.useEffect)(()=>{eQ()},[eo,ec]),(0,j.useEffect)(()=>{(async()=>{var e;if(!ec||!(null==ep?void 0:null===(e=ep.team_info)||void 0===e?void 0:e.organization_id)){e$(null);return}try{let e=await (0,a.organizationInfoCall)(ec,ep.team_info.organization_id);e$(e)}catch(e){console.error("Error fetching organization info:",e),e$(null)}})()},[ec,null==ep?void 0:null===(t=ep.team_info)||void 0===t?void 0:t.organization_id]);let eX=(0,j.useMemo)(()=>es(eJ,ex),[eJ,ex]);(0,j.useEffect)(()=>{(async()=>{try{if(!ec)return;let e=(await (0,a.getGuardrailsList)(ec)).guardrails.map(e=>e.guardrail_name);eA(e)}catch(e){console.error("Failed to fetch guardrails:",e)}})()},[ec]);let eY=async e=>{try{if(null==ec)return;let t={user_email:e.user_email,user_id:e.user_id,role:e.role};await (0,a.teamMemberAddCall)(ec,eo,t),M.Z.success("Team member added successfully"),eZ(!1),eN.resetFields();let l=await (0,a.teamInfoCall)(ec,eo);ev(l),eb(l)}catch(i){var t,l,s;let e="Failed to add team member";(null==i?void 0:null===(s=i.raw)||void 0===s?void 0:null===(l=s.detail)||void 0===l?void 0:null===(t=l.error)||void 0===t?void 0:t.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==i?void 0:i.message)&&(e=i.message),M.Z.fromBackend(e),console.error("Error adding team member:",i)}},eH=async e=>{try{if(null==ec)return;let t={user_email:e.user_email,user_id:e.user_id,role:e.role,max_budget_in_team:e.max_budget_in_team,tpm_limit:e.tpm_limit,rpm_limit:e.rpm_limit};console.log("Updating member with values:",t),u.ZP.destroy(),await (0,a.teamMemberUpdateCall)(ec,eo,t),M.Z.success("Team member updated successfully"),ek(!1);let l=await (0,a.teamInfoCall)(ec,eo);ev(l),eb(l)}catch(s){var t,l;let e="Failed to update team member";(null==s?void 0:null===(l=s.raw)||void 0===l?void 0:null===(t=l.detail)||void 0===t?void 0:t.includes("Assigning team admins is a premium feature"))?e="Assigning admins is an enterprise-only feature. Please upgrade your LiteLLM plan to enable this.":(null==s?void 0:s.message)&&(e=s.message),ek(!1),u.ZP.destroy(),M.Z.fromBackend(e),console.error("Error updating team member:",s)}},e0=async()=>{if(eR&&ec){eG(!0);try{await (0,a.teamMemberDeleteCall)(ec,eo,eR),M.Z.success("Team member removed successfully");let e=await (0,a.teamInfoCall)(ec,eo);ev(e),eb(e)}catch(e){M.Z.fromBackend("Failed to remove team member"),console.error("Error removing team member:",e)}finally{eG(!1),ez(!1),eU(null)}}},e1=async e=>{try{let t;if(!ec)return;eK(!0);let l={};try{l=e.metadata?JSON.parse(e.metadata):{}}catch(e){M.Z.fromBackend("Invalid JSON in metadata field");return}if("string"==typeof e.secret_manager_settings&&e.secret_manager_settings.trim().length>0)try{t=JSON.parse(e.secret_manager_settings)}catch(e){M.Z.fromBackend("Invalid JSON in secret manager settings");return}let s=e=>null==e||"string"==typeof e&&""===e.trim()||"number"==typeof e&&Number.isNaN(e)?null:e,i={team_id:eo,team_alias:e.team_alias,models:e.models,tpm_limit:s(e.tpm_limit),rpm_limit:s(e.rpm_limit),max_budget:e.max_budget,budget_duration:e.budget_duration,metadata:{...l,guardrails:e.guardrails||[],logging:e.logging_settings||[],...void 0!==t?{secret_manager_settings:t}:{}},organization_id:e.organization_id};i.max_budget=(0,n.C)(i.max_budget),i.team_member_budget_duration=e.team_member_budget_duration,void 0!==e.team_member_budget&&(i.team_member_budget=Number(e.team_member_budget)),void 0!==e.team_member_key_duration&&(i.team_member_key_duration=e.team_member_key_duration),(void 0!==e.team_member_tpm_limit||void 0!==e.team_member_rpm_limit)&&(i.team_member_tpm_limit=s(e.team_member_tpm_limit),i.team_member_rpm_limit=s(e.team_member_rpm_limit));let{servers:r,accessGroups:m}=e.mcp_servers_and_groups||{servers:[],accessGroups:[]},o=new Set(r||[]),d=Object.fromEntries(Object.entries(e.mcp_tool_permissions||{}).filter(e=>{let[t]=e;return o.has(t)}));i.object_permission={},r&&(i.object_permission.mcp_servers=r),m&&(i.object_permission.mcp_access_groups=m),d&&(i.object_permission.mcp_tool_permissions=d),delete e.mcp_servers_and_groups,delete e.mcp_tool_permissions;let{agents:c,accessGroups:u}=e.agents_and_groups||{agents:[],accessGroups:[]};c&&c.length>0&&(i.object_permission.agents=c),u&&u.length>0&&(i.object_permission.agent_access_groups=u),delete e.agents_and_groups,e.vector_stores&&e.vector_stores.length>0&&(i.object_permission.vector_stores=e.vector_stores),await (0,a.teamUpdateCall)(ec,i),M.Z.success("Team settings updated successfully"),eT(!1),eQ()}catch(e){console.error("Error updating team:",e)}finally{eK(!1)}};if(ej)return(0,s.jsx)("div",{className:"p-4",children:"Loading..."});if(!(null==ep?void 0:ep.team_info))return(0,s.jsx)("div",{className:"p-4",children:"Team not found"});let{team_info:e4}=ep,e2=async(e,t)=>{await (0,r.vQ)(e)&&(eE(e=>({...e,[t]:!0})),setTimeout(()=>{eE(e=>({...e,[t]:!1}))},2e3))};return(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)(d.zx,{icon:o.Z,variant:"light",onClick:ed,className:"mb-4",children:"Back to Teams"}),(0,s.jsx)(d.Dx,{children:e4.team_alias}),(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(d.xv,{className:"text-gray-500 font-mono",children:e4.team_id}),(0,s.jsx)(h.ZP,{type:"text",size:"small",icon:eL["team-id"]?(0,s.jsx)(p.Z,{size:12}):(0,s.jsx)(v.Z,{size:12}),onClick:()=>e2(e4.team_id,"team-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eL["team-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]})}),(0,s.jsxs)(d.v0,{defaultIndex:eg?3:0,children:[(0,s.jsx)(d.td,{className:"mb-4",children:[(0,s.jsx)(d.OK,{children:"Overview"},"overview"),...eW?[(0,s.jsx)(d.OK,{children:"Members"},"members"),(0,s.jsx)(d.OK,{children:"Member Permissions"},"member-permissions"),(0,s.jsx)(d.OK,{children:"Settings"},"settings")]:[]]}),(0,s.jsxs)(d.nP,{children:[(0,s.jsx)(d.x4,{children:(0,s.jsxs)(d.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,s.jsxs)(d.Zb,{children:[(0,s.jsx)(d.xv,{children:"Budget Status"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)(d.Dx,{children:["$",(0,r.pw)(e4.spend,4)]}),(0,s.jsxs)(d.xv,{children:["of ",null===e4.max_budget?"Unlimited":"$".concat((0,r.pw)(e4.max_budget,4))]}),e4.budget_duration&&(0,s.jsxs)(d.xv,{className:"text-gray-500",children:["Reset: ",e4.budget_duration]}),(0,s.jsx)("br",{}),e4.team_member_budget_table&&(0,s.jsxs)(d.xv,{className:"text-gray-500",children:["Team Member Budget: $",(0,r.pw)(e4.team_member_budget_table.max_budget,4)]})]})]}),(0,s.jsxs)(d.Zb,{children:[(0,s.jsx)(d.xv,{children:"Rate Limits"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)(d.xv,{children:["TPM: ",e4.tpm_limit||"Unlimited"]}),(0,s.jsxs)(d.xv,{children:["RPM: ",e4.rpm_limit||"Unlimited"]}),e4.max_parallel_requests&&(0,s.jsxs)(d.xv,{children:["Max Parallel Requests: ",e4.max_parallel_requests]})]})]}),(0,s.jsxs)(d.Zb,{children:[(0,s.jsx)(d.xv,{children:"Models"}),(0,s.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:0===e4.models.length?(0,s.jsx)(d.Ct,{color:"red",children:"All proxy models"}):e4.models.map((e,t)=>(0,s.jsx)(d.Ct,{color:"red",children:e},t))})]}),(0,s.jsxs)(d.Zb,{children:[(0,s.jsx)(d.xv,{className:"font-semibold text-gray-900",children:"Virtual Keys"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)(d.xv,{children:["User Keys: ",ep.keys.filter(e=>e.user_id).length]}),(0,s.jsxs)(d.xv,{children:["Service Account Keys: ",ep.keys.filter(e=>!e.user_id).length]}),(0,s.jsxs)(d.xv,{className:"text-gray-500",children:["Total: ",ep.keys.length]})]})]}),(0,s.jsx)(C.Z,{objectPermission:e4.object_permission,variant:"card",accessToken:ec}),(0,s.jsx)(w.Z,{loggingConfigs:(null===(l=e4.metadata)||void 0===l?void 0:l.logging)||[],disabledCallbacks:[],variant:"card"})]})}),(0,s.jsx)(d.x4,{children:(0,s.jsx)(et,{teamData:ep,canEditTeam:eW,handleMemberDelete:e=>{eU(e),ez(!0)},setSelectedEditMember:eM,setIsEditMemberModalVisible:ek,setIsAddMemberModalVisible:eZ})}),eW&&(0,s.jsx)(d.x4,{children:(0,s.jsx)(z,{teamId:eo,accessToken:ec,canEditTeam:eW})}),(0,s.jsx)(d.x4,{children:(0,s.jsxs)(d.Zb,{className:"overflow-y-auto max-h-[65vh]",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(d.Dx,{children:"Team Settings"}),eW&&!eC&&(0,s.jsx)(d.zx,{onClick:()=>eT(!0),children:"Edit Settings"})]}),eC?(0,s.jsxs)(c.Z,{form:eN,onFinish:e1,initialValues:{...e4,team_alias:e4.team_alias,models:e4.models,tpm_limit:e4.tpm_limit,rpm_limit:e4.rpm_limit,max_budget:e4.max_budget,budget_duration:e4.budget_duration,team_member_tpm_limit:null===(F=e4.team_member_budget_table)||void 0===F?void 0:F.tpm_limit,team_member_rpm_limit:null===(L=e4.team_member_budget_table)||void 0===L?void 0:L.rpm_limit,team_member_budget:null===(E=e4.team_member_budget_table)||void 0===E?void 0:E.max_budget,team_member_budget_duration:null===(D=e4.team_member_budget_table)||void 0===D?void 0:D.budget_duration,guardrails:(null===(A=e4.metadata)||void 0===A?void 0:A.guardrails)||[],disable_global_guardrails:(null===(R=e4.metadata)||void 0===R?void 0:R.disable_global_guardrails)||!1,metadata:e4.metadata?JSON.stringify((e=>{let{logging:t,secret_manager_settings:l,...s}=e;return s})(e4.metadata),null,2):"",logging_settings:(null===(U=e4.metadata)||void 0===U?void 0:U.logging)||[],secret_manager_settings:(null===(V=e4.metadata)||void 0===V?void 0:V.secret_manager_settings)?JSON.stringify(e4.metadata.secret_manager_settings,null,2):"",organization_id:e4.organization_id,vector_stores:(null===(B=e4.object_permission)||void 0===B?void 0:B.vector_stores)||[],mcp_servers:(null===(G=e4.object_permission)||void 0===G?void 0:G.mcp_servers)||[],mcp_access_groups:(null===(q=e4.object_permission)||void 0===q?void 0:q.mcp_access_groups)||[],mcp_servers_and_groups:{servers:(null===(K=e4.object_permission)||void 0===K?void 0:K.mcp_servers)||[],accessGroups:(null===(J=e4.object_permission)||void 0===J?void 0:J.mcp_access_groups)||[]},mcp_tool_permissions:(null===($=e4.object_permission)||void 0===$?void 0:$.mcp_tool_permissions)||{},agents_and_groups:{agents:(null===(W=e4.object_permission)||void 0===W?void 0:W.agents)||[],accessGroups:(null===(Q=e4.object_permission)||void 0===Q?void 0:Q.agent_access_groups)||[]}},layout:"vertical",children:[(0,s.jsx)(c.Z.Item,{label:"Team Name",name:"team_alias",rules:[{required:!0,message:"Please input a team name"}],children:(0,s.jsx)(x.default,{type:""})}),(0,s.jsx)(c.Z.Item,{label:"Models",name:"models",rules:[{required:!0,message:"Please select at least one model"}],children:(0,s.jsxs)(g.default,{mode:"multiple",placeholder:"Select models",children:[(em=!1,eJ?(0===eJ.models.length||eJ.models.includes("all-proxy-models"))&&(em=!0):em=eh||ex.includes("all-proxy-models"),em?(0,s.jsx)(g.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"):null),!eJ||eJ.models.includes("no-default-models")?(0,s.jsx)(g.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"):null,Array.from(new Set(eX)).map((e,t)=>(0,s.jsx)(g.default.Option,{value:e,children:(0,N.W0)(e)},t))]})}),(0,s.jsx)(c.Z.Item,{label:"Max Budget (USD)",name:"max_budget",children:(0,s.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,s.jsx)(c.Z.Item,{label:"Team Member Budget (USD)",name:"team_member_budget",tooltip:"This is the individual budget for a user in the team.",children:(0,s.jsx)(T.Z,{step:.01,precision:2,style:{width:"100%"}})}),(0,s.jsx)(c.Z.Item,{label:"Team Member Budget Duration",name:"team_member_budget_duration",children:(0,s.jsx)(el,{onChange:e=>eN.setFieldValue("team_member_budget_duration",e),value:eN.getFieldValue("team_member_budget_duration")})}),(0,s.jsx)(c.Z.Item,{label:"Team Member Key Duration (eg: 1d, 1mo)",name:"team_member_key_duration",tooltip:"Set a limit to the duration of a team member's key. Format: 30s (seconds), 30m (minutes), 30h (hours), 30d (days), 1mo (month)",children:(0,s.jsx)(d.oi,{placeholder:"e.g., 30d"})}),(0,s.jsx)(c.Z.Item,{label:"Team Member TPM Limit",name:"team_member_tpm_limit",tooltip:"Default tokens per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,s.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 1000"})}),(0,s.jsx)(c.Z.Item,{label:"Team Member RPM Limit",name:"team_member_rpm_limit",tooltip:"Default requests per minute limit for an individual team member. This limit applies to all requests the user makes within this team. Can be overridden per member.",children:(0,s.jsx)(T.Z,{step:1,style:{width:"100%"},placeholder:"e.g., 100"})}),(0,s.jsx)(c.Z.Item,{label:"Reset Budget",name:"budget_duration",children:(0,s.jsxs)(g.default,{placeholder:"n/a",children:[(0,s.jsx)(g.default.Option,{value:"24h",children:"daily"}),(0,s.jsx)(g.default.Option,{value:"7d",children:"weekly"}),(0,s.jsx)(g.default.Option,{value:"30d",children:"monthly"})]})}),(0,s.jsx)(c.Z.Item,{label:"Tokens per minute Limit (TPM)",name:"tpm_limit",children:(0,s.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,s.jsx)(c.Z.Item,{label:"Requests per minute Limit (RPM)",name:"rpm_limit",children:(0,s.jsx)(T.Z,{step:1,style:{width:"100%"}})}),(0,s.jsx)(c.Z.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(_.Z,{title:"Setup your first guardrail",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)(m.Z,{style:{marginLeft:"4px"}})})})]}),name:"guardrails",help:"Select existing guardrails or enter new ones",children:(0,s.jsx)(g.default,{mode:"tags",placeholder:"Select or enter guardrails",options:eD.map(e=>({value:e,label:e}))})}),(0,s.jsx)(c.Z.Item,{label:(0,s.jsxs)("span",{children:["Disable Global Guardrails"," ",(0,s.jsx)(_.Z,{title:"When enabled, this team will bypass any guardrails configured to run on every request (global guardrails)",children:(0,s.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),name:"disable_global_guardrails",valuePropName:"checked",help:"Bypass global guardrails for this team",children:(0,s.jsx)(b.Z,{checkedChildren:"Yes",unCheckedChildren:"No"})}),(0,s.jsx)(c.Z.Item,{label:"Vector Stores",name:"vector_stores","aria-label":"Vector Stores",children:(0,s.jsx)(I.Z,{onChange:e=>eN.setFieldValue("vector_stores",e),value:eN.getFieldValue("vector_stores"),accessToken:ec||"",placeholder:"Select vector stores"})}),(0,s.jsx)(c.Z.Item,{label:"Allowed Pass Through Routes",name:"allowed_passthrough_routes",children:(0,s.jsx)(Z.Z,{onChange:e=>eN.setFieldValue("allowed_passthrough_routes",e),value:eN.getFieldValue("allowed_passthrough_routes"),accessToken:ec||"",placeholder:"Select pass through routes"})}),(0,s.jsx)(c.Z.Item,{label:"MCP Servers / Access Groups",name:"mcp_servers_and_groups",children:(0,s.jsx)(k.Z,{onChange:e=>eN.setFieldValue("mcp_servers_and_groups",e),value:eN.getFieldValue("mcp_servers_and_groups"),accessToken:ec||"",placeholder:"Select MCP servers or access groups (optional)"})}),(0,s.jsx)(c.Z.Item,{name:"mcp_tool_permissions",initialValue:{},hidden:!0,children:(0,s.jsx)(x.default,{type:"hidden"})}),(0,s.jsx)(c.Z.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.mcp_servers_and_groups!==t.mcp_servers_and_groups||e.mcp_tool_permissions!==t.mcp_tool_permissions,children:()=>{var e;return(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsx)(S.Z,{accessToken:ec||"",selectedServers:(null===(e=eN.getFieldValue("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.jsx)(c.Z.Item,{label:"Agents / Access Groups",name:"agents_and_groups",children:(0,s.jsx)(f.Z,{onChange:e=>eN.setFieldValue("agents_and_groups",e),value:eN.getFieldValue("agents_and_groups"),accessToken:ec||"",placeholder:"Select agents or access groups (optional)"})}),(0,s.jsx)(c.Z.Item,{label:"Organization ID",name:"organization_id",children:(0,s.jsx)(x.default,{type:"",disabled:!0})}),(0,s.jsx)(c.Z.Item,{label:"Logging Settings",name:"logging_settings",children:(0,s.jsx)(P.Z,{value:eN.getFieldValue("logging_settings"),onChange:e=>eN.setFieldValue("logging_settings",e)})}),(0,s.jsx)(c.Z.Item,{label:"Secret Manager Settings",name:"secret_manager_settings",help:e_?"Enter secret manager configuration as a JSON object.":"Premium feature - Upgrade to manage secret manager settings.",rules:[{validator:async(e,t)=>{if(!t)return Promise.resolve();try{return JSON.parse(t),Promise.resolve()}catch(e){return Promise.reject(Error("Please enter valid JSON"))}}}],children:(0,s.jsx)(x.default.TextArea,{rows:6,placeholder:'{"namespace": "admin", "mount": "secret", "path_prefix": "litellm"}',disabled:!e_})}),(0,s.jsx)(c.Z.Item,{label:"Metadata",name:"metadata",children:(0,s.jsx)(x.default.TextArea,{rows:10})}),(0,s.jsx)("div",{className:"sticky z-10 bg-white p-4 border-t border-gray-200 bottom-[-1.5rem] inset-x-[-1.5rem]",children:(0,s.jsxs)("div",{className:"flex justify-end items-center gap-2",children:[(0,s.jsx)(d.zx,{variant:"secondary",onClick:()=>eT(!1),disabled:eq,children:"Cancel"}),(0,s.jsx)(d.zx,{type:"submit",loading:eq,children:"Save Changes"})]})})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(d.xv,{className:"font-medium",children:"Team Name"}),(0,s.jsx)("div",{children:e4.team_alias})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(d.xv,{className:"font-medium",children:"Team ID"}),(0,s.jsx)("div",{className:"font-mono",children:e4.team_id})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(d.xv,{className:"font-medium",children:"Created At"}),(0,s.jsx)("div",{children:new Date(e4.created_at).toLocaleString()})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(d.xv,{className:"font-medium",children:"Models"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2 mt-1",children:e4.models.map((e,t)=>(0,s.jsx)(d.Ct,{color:"red",children:e},t))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(d.xv,{className:"font-medium",children:"Rate Limits"}),(0,s.jsxs)("div",{children:["TPM: ",e4.tpm_limit||"Unlimited"]}),(0,s.jsxs)("div",{children:["RPM: ",e4.rpm_limit||"Unlimited"]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(d.xv,{className:"font-medium",children:"Team Budget"}),(0,s.jsxs)("div",{children:["Max Budget:"," ",null!==e4.max_budget?"$".concat((0,r.pw)(e4.max_budget,4)):"No Limit"]}),(0,s.jsxs)("div",{children:["Budget Reset: ",e4.budget_duration||"Never"]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(d.xv,{className:"font-medium",children:["Team Member Settings"," ",(0,s.jsx)(_.Z,{title:"These are limits on individual team members",children:(0,s.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),(0,s.jsxs)("div",{children:["Max Budget: ",(null===(X=e4.team_member_budget_table)||void 0===X?void 0:X.max_budget)||"No Limit"]}),(0,s.jsxs)("div",{children:["Budget Duration: ",(null===(Y=e4.team_member_budget_table)||void 0===Y?void 0:Y.budget_duration)||"No Limit"]}),(0,s.jsxs)("div",{children:["Key Duration: ",(null===(H=e4.metadata)||void 0===H?void 0:H.team_member_key_duration)||"No Limit"]}),(0,s.jsxs)("div",{children:["TPM Limit: ",(null===(ee=e4.team_member_budget_table)||void 0===ee?void 0:ee.tpm_limit)||"No Limit"]}),(0,s.jsxs)("div",{children:["RPM Limit: ",(null===(ei=e4.team_member_budget_table)||void 0===ei?void 0:ei.rpm_limit)||"No Limit"]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(d.xv,{className:"font-medium",children:"Organization ID"}),(0,s.jsx)("div",{children:e4.organization_id})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(d.xv,{className:"font-medium",children:"Status"}),(0,s.jsx)(d.Ct,{color:e4.blocked?"red":"green",children:e4.blocked?"Blocked":"Active"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(d.xv,{className:"font-medium",children:"Disable Global Guardrails"}),(0,s.jsx)("div",{children:(null===(ea=e4.metadata)||void 0===ea?void 0:ea.disable_global_guardrails)===!0?(0,s.jsx)(d.Ct,{color:"yellow",children:"Enabled - Global guardrails bypassed"}):(0,s.jsx)(d.Ct,{color:"green",children:"Disabled - Global guardrails active"})})]}),(0,s.jsx)(C.Z,{objectPermission:e4.object_permission,variant:"inline",className:"pt-4 border-t border-gray-200",accessToken:ec}),(0,s.jsx)(w.Z,{loggingConfigs:(null===(er=e4.metadata)||void 0===er?void 0:er.logging)||[],disabledCallbacks:[],variant:"inline",className:"pt-4 border-t border-gray-200"}),(null===(en=e4.metadata)||void 0===en?void 0:en.secret_manager_settings)&&(0,s.jsxs)("div",{className:"pt-4 border-t border-gray-200",children:[(0,s.jsx)(d.xv,{className:"font-medium",children:"Secret Manager Settings"}),(0,s.jsx)("pre",{className:"mt-2 bg-gray-50 p-3 rounded text-xs overflow-x-auto",children:JSON.stringify(e4.metadata.secret_manager_settings,null,2)})]})]})]})})]})]}),(0,s.jsx)(O.Z,{visible:ew,onCancel:()=>ek(!1),onSubmit:eH,initialData:eS,mode:"edit",config:{title:"Edit Member",showEmail:!0,showUserId:!0,roleOptions:[{label:"Admin",value:"admin"},{label:"User",value:"user"}],additionalFields:[{name:"max_budget_in_team",label:(0,s.jsxs)("span",{children:["Team Member Budget (USD)"," ",(0,s.jsx)(_.Z,{title:"Maximum amount in USD this member can spend within this team. This is separate from any global user budget limits",children:(0,s.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:.01,min:0,placeholder:"Budget limit for this member within this team"},{name:"tpm_limit",label:(0,s.jsxs)("span",{children:["Team Member TPM Limit"," ",(0,s.jsx)(_.Z,{title:"Maximum tokens per minute this member can use within this team. This is separate from any global user TPM limit",children:(0,s.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Tokens per minute limit for this member in this team"},{name:"rpm_limit",label:(0,s.jsxs)("span",{children:["Team Member RPM Limit"," ",(0,s.jsx)(_.Z,{title:"Maximum requests per minute this member can make within this team. This is separate from any global user RPM limit",children:(0,s.jsx)(m.Z,{style:{marginLeft:"4px"}})})]}),type:"numerical",step:1,min:0,placeholder:"Requests per minute limit for this member in this team"}]}}),(0,s.jsx)(i.Z,{isVisible:ey,onCancel:()=>eZ(!1),onSubmit:eY,accessToken:ec}),(0,s.jsx)(y.Z,{isOpen:eV,title:"Delete Team Member",alertMessage:"Removing team members will also delete any keys created by or created for this member.",message:"Are you sure you want to remove this member from the team? This action cannot be undone.",resourceInformationTitle:"Team Member Information",resourceInformation:[{label:"User ID",value:null==eR?void 0:eR.user_id,code:!0},{label:"Email",value:null==eR?void 0:eR.user_email},{label:"Role",value:null==eR?void 0:eR.role}],onCancel:()=>{ez(!1),eU(null)},onOk:e0,confirmLoading:eB})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/137-639f92dd476d20a9.js b/litellm/proxy/_experimental/out/_next/static/chunks/137-639f92dd476d20a9.js deleted file mode 100644 index 40ab217416..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/137-639f92dd476d20a9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[137],{1309:function(e,l,a){a.d(l,{C:function(){return t.Z}});var t=a(41649)},10137:function(e,l,a){a.d(l,{Z:function(){return lF}});var t,i,r,s,n=a(57437),o=a(2265),d=a(78489),c=a(12485),u=a(18135),m=a(35242),x=a(29706),p=a(77991),h=a(19250),g=a(57840),f=a(37592),j=a(15690),v=a(10032),y=a(3810),_=a(22116),b=a(64504);(t=r||(r={})).PresidioPII="Presidio PII",t.Bedrock="Bedrock Guardrail",t.Lakera="Lakera";let N={},w=e=>{let l={};return l.PresidioPII="Presidio PII",l.Bedrock="Bedrock Guardrail",l.Lakera="Lakera",Object.entries(e).forEach(e=>{let[a,t]=e;t&&"object"==typeof t&&"ui_friendly_name"in t&&(l[a.split("_").map((e,l)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=t.ui_friendly_name)}),N=l,l},k=()=>Object.keys(N).length>0?N:r,C={PresidioPII:"presidio",Bedrock:"bedrock",Lakera:"lakera_v2",LitellmContentFilter:"litellm_content_filter",ToolPermission:"tool_permission"},S=e=>{Object.entries(e).forEach(e=>{let[l,a]=e;a&&"object"==typeof a&&"ui_friendly_name"in a&&(C[l.split("_").map((e,l)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=l)})},Z=e=>!!e&&"Presidio PII"===k()[e],P=e=>!!e&&"LiteLLM Content Filter"===k()[e],A="../ui/assets/logos/",O={"Presidio PII":"".concat(A,"presidio.png"),"Bedrock Guardrail":"".concat(A,"bedrock.svg"),Lakera:"".concat(A,"lakeraai.jpeg"),"Azure Content Safety Prompt Shield":"".concat(A,"presidio.png"),"Azure Content Safety Text Moderation":"".concat(A,"presidio.png"),"Aporia AI":"".concat(A,"aporia.png"),"PANW Prisma AIRS":"".concat(A,"palo_alto_networks.jpeg"),"Noma Security":"".concat(A,"noma_security.png"),"Javelin Guardrails":"".concat(A,"javelin.png"),"Pillar Guardrail":"".concat(A,"pillar.jpeg"),"Google Cloud Model Armor":"".concat(A,"google.svg"),"Guardrails AI":"".concat(A,"guardrails_ai.jpeg"),"Lasso Guardrail":"".concat(A,"lasso.png"),"Pangea Guardrail":"".concat(A,"pangea.png"),"AIM Guardrail":"".concat(A,"aim_security.jpeg"),"OpenAI Moderation":"".concat(A,"openai_small.svg"),EnkryptAI:"".concat(A,"enkrypt_ai.avif"),"Prompt Security":"".concat(A,"prompt_security.png"),"LiteLLM Content Filter":"".concat(A,"litellm_logo.jpg")},I=e=>{if(!e)return{logo:"",displayName:"-"};let l=Object.keys(C).find(l=>C[l].toLowerCase()===e.toLowerCase());if(!l)return{logo:"",displayName:e};let a=k()[l];return{logo:O[a]||"",displayName:a||e}};var L=a(99981),T=a(5545),z=a(61994),E=a(97416),B=a(8881),M=a(10798),F=a(49638);let{Text:G}=g.default,{Option:K}=f.default,D=e=>e.replace(/_/g," "),R=e=>{switch(e){case"MASK":return(0,n.jsx)(E.Z,{style:{marginRight:4}});case"BLOCK":return(0,n.jsx)(B.Z,{style:{marginRight:4}});default:return null}},J=e=>{let{categories:l,selectedCategories:a,onChange:t}=e;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center mb-2",children:[(0,n.jsx)(M.Z,{className:"text-gray-500 mr-1"}),(0,n.jsx)(G,{className:"text-gray-500 font-medium",children:"Filter by category"})]}),(0,n.jsx)(f.default,{mode:"multiple",placeholder:"Select categories to filter by",style:{width:"100%"},onChange:t,value:a,allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"mb-4",tagRender:e=>(0,n.jsx)(y.Z,{color:"blue",closable:e.closable,onClose:e.onClose,className:"mr-2 mb-2",children:e.label}),children:l.map(e=>(0,n.jsx)(K,{value:e.category,children:e.category},e.category))})]})},V=e=>{let{onSelectAll:l,onUnselectAll:a,hasSelectedEntities:t}=e;return(0,n.jsxs)("div",{className:"bg-gray-50 p-5 rounded-lg mb-6 border border-gray-200 shadow-sm",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(G,{strong:!0,className:"text-gray-700 text-base",children:"Quick Actions"}),(0,n.jsx)(L.Z,{title:"Apply action to all PII types at once",children:(0,n.jsx)("div",{className:"ml-2 text-gray-400 cursor-help text-xs",children:"ⓘ"})})]}),(0,n.jsx)(T.ZP,{color:"danger",variant:"outlined",onClick:a,disabled:!t,icon:(0,n.jsx)(F.Z,{}),children:"Unselect All"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,n.jsx)(T.ZP,{color:"primary",variant:"outlined",onClick:()=>l("MASK"),className:"h-10",block:!0,icon:(0,n.jsx)(E.Z,{}),children:"Select All & Mask"}),(0,n.jsx)(T.ZP,{color:"danger",variant:"outlined",onClick:()=>l("BLOCK"),className:"h-10 hover:bg-red-100",block:!0,icon:(0,n.jsx)(B.Z,{}),children:"Select All & Block"})]})]})},U=e=>{let{entities:l,selectedEntities:a,selectedActions:t,actions:i,onEntitySelect:r,onActionSelect:s,entityToCategoryMap:o}=e;return(0,n.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,n.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,n.jsx)(G,{strong:!0,className:"flex-1 text-gray-700",children:"PII Type"}),(0,n.jsx)(G,{strong:!0,className:"w-32 text-right text-gray-700",children:"Action"})]}),(0,n.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:0===l.length?(0,n.jsx)("div",{className:"py-10 text-center text-gray-500",children:"No PII types match your filter criteria"}):l.map(e=>(0,n.jsxs)("div",{className:"px-5 py-3 flex items-center justify-between hover:bg-gray-50 border-b ".concat(a.includes(e)?"bg-blue-50":""),children:[(0,n.jsxs)("div",{className:"flex items-center flex-1",children:[(0,n.jsx)(z.Z,{checked:a.includes(e),onChange:()=>r(e),className:"mr-3"}),(0,n.jsx)(G,{className:a.includes(e)?"font-medium text-gray-900":"text-gray-700",children:D(e)}),o.get(e)&&(0,n.jsx)(y.Z,{className:"ml-2 text-xs",color:"blue",children:o.get(e)})]}),(0,n.jsx)("div",{className:"w-32",children:(0,n.jsx)(f.default,{value:a.includes(e)&&t[e]||"MASK",onChange:l=>s(e,l),style:{width:120},disabled:!a.includes(e),className:"".concat(a.includes(e)?"":"opacity-50"),dropdownMatchSelectWidth:!1,children:i.map(e=>(0,n.jsx)(K,{value:e,children:(0,n.jsxs)("div",{className:"flex items-center",children:[R(e),e]})},e))})})]},e))})]})},{Title:W,Text:Y}=g.default;var q=e=>{let{entities:l,actions:a,selectedEntities:t,selectedActions:i,onEntitySelect:r,onActionSelect:s,entityCategories:d=[]}=e,[c,u]=(0,o.useState)([]),m=new Map;d.forEach(e=>{e.entities.forEach(l=>{m.set(l,e.category)})});let x=l.filter(e=>0===c.length||c.includes(m.get(e)||""));return(0,n.jsxs)("div",{className:"pii-configuration",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-5",children:[(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)(W,{level:4,className:"!m-0 font-semibold text-gray-800",children:"Configure PII Protection"})}),(0,n.jsxs)(Y,{className:"text-gray-500",children:[t.length," items selected"]})]}),(0,n.jsxs)("div",{className:"mb-6",children:[(0,n.jsx)(J,{categories:d,selectedCategories:c,onChange:u}),(0,n.jsx)(V,{onSelectAll:e=>{l.forEach(l=>{t.includes(l)||r(l),s(l,e)})},onUnselectAll:()=>{t.forEach(e=>{r(e)})},hasSelectedEntities:t.length>0})]}),(0,n.jsx)(U,{entities:x,selectedEntities:t,selectedActions:i,actions:a,onEntitySelect:r,onActionSelect:s,entityToCategoryMap:m})]})},H=a(10353),$=a(31283),Q=a(24199),X=e=>{var l;let{selectedProvider:a,accessToken:t,providerParams:i=null,value:r=null}=e,[s,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(i),[m,x]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(i){u(i);return}let e=async()=>{if(t){d(!0),x(null);try{let e=await (0,h.getGuardrailProviderSpecificParams)(t);console.log("Provider params API response:",e),u(e),w(e),S(e)}catch(e){console.error("Error fetching provider params:",e),x("Failed to load provider parameters")}finally{d(!1)}}};i||e()},[t,i]),!a)return null;if(s)return(0,n.jsx)(H.Z,{tip:"Loading provider parameters..."});if(m)return(0,n.jsx)("div",{className:"text-red-500",children:m});let p=null===(l=C[a])||void 0===l?void 0:l.toLowerCase(),g=c&&c[p];if(console.log("Provider key:",p),console.log("Provider fields:",g),!g||0===Object.keys(g).length)return(0,n.jsx)("div",{children:"No configuration fields available for this provider."});console.log("Value:",r);let j=new Set(["patterns","blocked_words","blocked_words_file","categories","severity_threshold","pattern_redaction_format","keyword_redaction_tag"]),y=P(a),_=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0;return Object.entries(e).map(e=>{let[t,i]=e,s=l?"".concat(l,".").concat(t):t,o=a?a[t]:null==r?void 0:r[t];return(console.log("Field value:",o),"ui_friendly_name"===t||"optional_params"===t&&"nested"===i.type&&i.fields||y&&j.has(t))?null:"nested"===i.type&&i.fields?(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"mb-2 font-medium",children:t}),(0,n.jsx)("div",{className:"ml-4 border-l-2 border-gray-200 pl-4",children:_(i.fields,s,o)})]},s):(0,n.jsx)(v.Z.Item,{name:s,label:t,tooltip:i.description,rules:i.required?[{required:!0,message:"".concat(t," is required")}]:void 0,children:"select"===i.type&&i.options?(0,n.jsx)(f.default,{placeholder:i.description,defaultValue:o||i.default_value,children:i.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"multiselect"===i.type&&i.options?(0,n.jsx)(f.default,{mode:"multiple",placeholder:i.description,defaultValue:o||i.default_value,children:i.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"bool"===i.type||"boolean"===i.type?(0,n.jsxs)(f.default,{placeholder:i.description,defaultValue:void 0!==o?String(o):i.default_value,children:[(0,n.jsx)(f.default.Option,{value:"true",children:"True"}),(0,n.jsx)(f.default.Option,{value:"false",children:"False"})]}):"number"===i.type?(0,n.jsx)(Q.Z,{step:1,width:400,placeholder:i.description,defaultValue:void 0!==o?Number(o):void 0}):t.includes("password")||t.includes("secret")||t.includes("key")?(0,n.jsx)($.o,{placeholder:i.description,type:"password",defaultValue:o||""}):(0,n.jsx)($.o,{placeholder:i.description,type:"text",defaultValue:o||""})},s)})};return(0,n.jsx)(n.Fragment,{children:_(g)})};let{Title:ee}=g.default,el=e=>{let{field:l,fieldKey:a,fullFieldKey:t,value:i}=e,[r,s]=o.useState([]),[d,c]=o.useState(l.dict_key_options||[]);o.useEffect(()=>{if(i&&"object"==typeof i){let e=Object.keys(i);s(e.map(e=>({key:e,id:"".concat(e,"_").concat(Date.now(),"_").concat(Math.random())}))),c((l.dict_key_options||[]).filter(l=>!e.includes(l)))}},[i,l.dict_key_options]);let u=e=>{e&&(s([...r,{key:e,id:"".concat(e,"_").concat(Date.now())}]),c(d.filter(l=>l!==e)))},m=(e,l)=>{s(r.filter(l=>l.id!==e)),c([...d,l].sort())};return(0,n.jsxs)("div",{className:"space-y-3",children:[r.map(e=>(0,n.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg",children:[(0,n.jsx)("div",{className:"w-24 font-medium text-sm",children:e.key}),(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(v.Z.Item,{name:Array.isArray(t)?[...t,e.key]:[t,e.key],style:{marginBottom:0},initialValue:i&&"object"==typeof i?i[e.key]:void 0,normalize:"number"===l.dict_value_type?e=>{if(null==e||""===e)return;let l=Number(e);return isNaN(l)?e:l}:void 0,children:"number"===l.dict_value_type?(0,n.jsx)(Q.Z,{step:1,width:200,placeholder:"Enter ".concat(e.key," value")}):"boolean"===l.dict_value_type?(0,n.jsxs)(f.default,{placeholder:"Select ".concat(e.key," value"),children:[(0,n.jsx)(f.default.Option,{value:!0,children:"True"}),(0,n.jsx)(f.default.Option,{value:!1,children:"False"})]}):(0,n.jsx)($.o,{placeholder:"Enter ".concat(e.key," value"),type:"text"})})}),(0,n.jsx)("button",{type:"button",className:"text-red-500 hover:text-red-700 text-sm",onClick:()=>m(e.id,e.key),children:"Remove"})]},e.id)),d.length>0&&(0,n.jsxs)("div",{className:"flex items-center space-x-3 mt-2",children:[(0,n.jsx)(f.default,{placeholder:"Select category to configure",style:{width:200},onSelect:e=>e&&u(e),value:void 0,children:d.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}),(0,n.jsx)("span",{className:"text-sm text-gray-500",children:"Select a category to add threshold configuration"})]})]})};var ea=e=>{let{optionalParams:l,parentFieldKey:a,values:t}=e,i=(e,l)=>{let i="".concat(a,".").concat(e),r=null==t?void 0:t[e];return(console.log("value",r),"dict"===l.type&&l.dict_key_options)?(0,n.jsxs)("div",{className:"mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,n.jsx)("div",{className:"mb-4 font-medium text-gray-900 text-base",children:e}),(0,n.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:l.description}),(0,n.jsx)(el,{field:l,fieldKey:e,fullFieldKey:[a,e],value:r})]},i):(0,n.jsx)("div",{className:"mb-8 p-6 bg-white rounded-lg border border-gray-200 shadow-sm",children:(0,n.jsx)(v.Z.Item,{name:[a,e],label:(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsx)("div",{className:"font-medium text-gray-900 text-base",children:e}),(0,n.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:l.description})]}),rules:l.required?[{required:!0,message:"".concat(e," is required")}]:void 0,className:"mb-0",initialValue:void 0!==r?r:l.default_value,normalize:"number"===l.type?e=>{if(null==e||""===e)return;let l=Number(e);return isNaN(l)?e:l}:void 0,children:"select"===l.type&&l.options?(0,n.jsx)(f.default,{placeholder:l.description,children:l.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"multiselect"===l.type&&l.options?(0,n.jsx)(f.default,{mode:"multiple",placeholder:l.description,children:l.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"bool"===l.type||"boolean"===l.type?(0,n.jsxs)(f.default,{placeholder:l.description,children:[(0,n.jsx)(f.default.Option,{value:"true",children:"True"}),(0,n.jsx)(f.default.Option,{value:"false",children:"False"})]}):"number"===l.type?(0,n.jsx)(Q.Z,{step:1,width:400,placeholder:l.description}):e.includes("password")||e.includes("secret")||e.includes("key")?(0,n.jsx)($.o,{placeholder:l.description,type:"password"}):(0,n.jsx)($.o,{placeholder:l.description,type:"text"})})},i)};return l.fields&&0!==Object.keys(l.fields).length?(0,n.jsxs)("div",{className:"guardrail-optional-params",children:[(0,n.jsxs)("div",{className:"mb-8 pb-4 border-b border-gray-100",children:[(0,n.jsx)(ee,{level:3,className:"mb-2 font-semibold text-gray-900",children:"Optional Parameters"}),(0,n.jsx)("p",{className:"text-gray-600 text-sm",children:l.description||"Configure additional settings for this guardrail provider"})]}),(0,n.jsx)("div",{className:"space-y-8",children:Object.entries(l.fields).map(e=>{let[l,a]=e;return i(l,a)})})]}):null},et=a(9114),ei=a(5945),er=a(58760),es=a(65319),en=a(96473),eo=a(3632),ed=a(16312);let{Text:ec}=g.default,{Option:eu}=f.default;var em=e=>{let{visible:l,prebuiltPatterns:a,categories:t,selectedPatternName:i,patternAction:r,onPatternNameChange:s,onActionChange:o,onAdd:d,onCancel:c}=e;return(0,n.jsxs)(_.Z,{title:"Add prebuilt pattern",open:l,onCancel:c,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ec,{strong:!0,children:"Pattern type"}),(0,n.jsx)(f.default,{placeholder:"Choose pattern type",value:i,onChange:s,style:{width:"100%",marginTop:8},showSearch:!0,filterOption:(e,l)=>{let t=a.find(e=>e.name===(null==l?void 0:l.value));return!!t&&(t.display_name.toLowerCase().includes(e.toLowerCase())||t.name.toLowerCase().includes(e.toLowerCase()))},children:t.map(e=>{let l=a.filter(l=>l.category===e);return 0===l.length?null:(0,n.jsx)(f.default.OptGroup,{label:e,children:l.map(e=>(0,n.jsx)(eu,{value:e.name,children:e.display_name},e.name))},e)})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ec,{strong:!0,children:"Action"}),(0,n.jsx)(ec,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,n.jsxs)(f.default,{value:r,onChange:o,style:{width:"100%"},children:[(0,n.jsx)(eu,{value:"BLOCK",children:"Block"}),(0,n.jsx)(eu,{value:"MASK",children:"Mask"})]})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(ed.z,{variant:"secondary",onClick:c,children:"Cancel"}),(0,n.jsx)(ed.z,{onClick:d,children:"Add"})]})]})};let{Text:ex}=g.default,{Option:ep}=f.default;var eh=e=>{let{visible:l,patternName:a,patternRegex:t,patternAction:i,onNameChange:r,onRegexChange:s,onActionChange:o,onAdd:d,onCancel:c}=e;return(0,n.jsxs)(_.Z,{title:"Add custom regex pattern",open:l,onCancel:c,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Pattern name"}),(0,n.jsx)(b.o,{placeholder:"e.g., internal_id, employee_code",value:a,onValueChange:r,style:{marginTop:8}})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Regex pattern"}),(0,n.jsx)(b.o,{placeholder:"e.g., ID-[0-9]{6}",value:t,onValueChange:s,style:{marginTop:8}}),(0,n.jsx)(ex,{type:"secondary",style:{fontSize:12},children:"Enter a valid regular expression to match sensitive data"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Action"}),(0,n.jsx)(ex,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,n.jsxs)(f.default,{value:i,onChange:o,style:{width:"100%"},children:[(0,n.jsx)(ep,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ep,{value:"MASK",children:"Mask"})]})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(b.z,{variant:"secondary",onClick:c,children:"Cancel"}),(0,n.jsx)(b.z,{onClick:d,children:"Add"})]})]})},eg=a(49566),ef=a(16853);let{Text:ej}=g.default,{Option:ev}=f.default;var ey=e=>{let{visible:l,keyword:a,action:t,description:i,onKeywordChange:r,onActionChange:s,onDescriptionChange:o,onAdd:c,onCancel:u}=e;return(0,n.jsxs)(_.Z,{title:"Add blocked keyword",open:l,onCancel:u,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Keyword"}),(0,n.jsx)(eg.Z,{placeholder:"Enter sensitive keyword or phrase",value:a,onValueChange:r,style:{marginTop:8}})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Action"}),(0,n.jsx)(ej,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this keyword is detected"}),(0,n.jsxs)(f.default,{value:t,onChange:s,style:{width:"100%"},children:[(0,n.jsx)(ev,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ev,{value:"MASK",children:"Mask"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Description (optional)"}),(0,n.jsx)(ef.Z,{placeholder:"Explain why this keyword is sensitive",value:i,onValueChange:o,rows:3,style:{marginTop:8}})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(d.Z,{variant:"secondary",onClick:u,children:"Cancel"}),(0,n.jsx)(d.Z,{onClick:c,children:"Add"})]})]})},e_=a(56609),eb=a(26349);let{Text:eN}=g.default,{Option:ew}=f.default;var ek=e=>{let{patterns:l,onActionChange:a,onRemove:t}=e,i=[{title:"Type",dataIndex:"type",key:"type",width:100,render:e=>(0,n.jsx)(y.Z,{color:"prebuilt"===e?"blue":"green",children:"prebuilt"===e?"Prebuilt":"Custom"})},{title:"Pattern name",dataIndex:"name",key:"name",render:(e,l)=>l.display_name||l.name},{title:"Regex pattern",dataIndex:"pattern",key:"pattern",render:e=>e?(0,n.jsxs)(eN,{code:!0,style:{fontSize:12},children:[e.substring(0,40),"..."]}):"-"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>a(l.id,e),style:{width:120},size:"small",children:[(0,n.jsx)(ew,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ew,{value:"MASK",children:"Mask"})]})},{title:"",key:"actions",width:100,render:(e,l)=>(0,n.jsx)(ed.z,{type:"button",variant:"light",color:"red",size:"xs",icon:eb.Z,onClick:()=>t(l.id),children:"Delete"})}];return 0===l.length?(0,n.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No patterns added."}):(0,n.jsx)(e_.Z,{dataSource:l,columns:i,rowKey:"id",pagination:!1,size:"small"})};let{Text:eC}=g.default,{Option:eS}=f.default;var eZ=e=>{let{keywords:l,onActionChange:a,onRemove:t}=e,i=[{title:"Keyword",dataIndex:"keyword",key:"keyword"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>a(l.id,"action",e),style:{width:120},size:"small",children:[(0,n.jsx)(eS,{value:"BLOCK",children:"Block"}),(0,n.jsx)(eS,{value:"MASK",children:"Mask"})]})},{title:"Description",dataIndex:"description",key:"description",render:e=>e||"-"},{title:"",key:"actions",width:100,render:(e,l)=>(0,n.jsx)(ed.z,{type:"button",variant:"light",color:"red",size:"xs",icon:eb.Z,onClick:()=>t(l.id),children:"Delete"})}];return 0===l.length?(0,n.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No keywords added."}):(0,n.jsx)(e_.Z,{dataSource:l,columns:i,rowKey:"id",pagination:!1,size:"small"})},eP=a(44851),eA=a(38434);let{Title:eO,Text:eI}=g.default,{Option:eL}=f.default,{Panel:eT}=eP.default;var ez=e=>{var l;let{availableCategories:a,selectedCategories:t,onCategoryAdd:i,onCategoryRemove:r,onCategoryUpdate:s,accessToken:d}=e,[c,u]=o.useState(""),[m,x]=o.useState({}),[p,g]=o.useState({}),[j,v]=o.useState([]),[_,b]=o.useState(""),[N,w]=o.useState(!1),k=async e=>{if(d&&!m[e]){g(l=>({...l,[e]:!0}));try{let l=await (0,h.getCategoryYaml)(d,e);x(a=>({...a,[e]:l.yaml_content}))}catch(l){console.error("Failed to fetch YAML for category ".concat(e,":"),l)}finally{g(l=>({...l,[e]:!1}))}}};o.useEffect(()=>{if(c&&d){let e=m[c];if(e){b(e);return}w(!0),console.log("Fetching YAML for category: ".concat(c),{accessToken:d?"present":"missing"}),(0,h.getCategoryYaml)(d,c).then(e=>{console.log("Successfully fetched YAML for ".concat(c,":"),e),b(e.yaml_content),x(l=>({...l,[c]:e.yaml_content}))}).catch(e=>{console.error("Failed to fetch preview YAML for category ".concat(c,":"),e),b("")}).finally(()=>{w(!1)})}else b(""),w(!1)},[c,d]);let C=[{title:"Category",dataIndex:"display_name",key:"display_name",render:(e,l)=>{let t=a.find(e=>e.name===l.category);return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:{fontWeight:500},children:e}),(null==t?void 0:t.description)&&(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888",marginTop:"4px"},children:t.description})]})}},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>s(l.id,"action",e),style:{width:"100%"},children:[(0,n.jsx)(eL,{value:"BLOCK",children:(0,n.jsx)(y.Z,{color:"red",children:"BLOCK"})}),(0,n.jsx)(eL,{value:"MASK",children:(0,n.jsx)(y.Z,{color:"orange",children:"MASK"})})]})},{title:"Severity Threshold",dataIndex:"severity_threshold",key:"severity_threshold",width:180,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>s(l.id,"severity_threshold",e),style:{width:"100%"},children:[(0,n.jsx)(eL,{value:"low",children:"Low"}),(0,n.jsx)(eL,{value:"medium",children:"Medium"}),(0,n.jsx)(eL,{value:"high",children:"High"})]})},{title:"",key:"actions",width:80,render:(e,l)=>(0,n.jsx)(ed.z,{icon:eb.Z,onClick:()=>r(l.id),variant:"secondary",size:"xs",children:"Remove"})}],S=a.filter(e=>!t.some(l=>l.category===e.name));return(0,n.jsxs)(ei.Z,{title:(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(eO,{level:5,style:{margin:0},children:"Content Categories"}),(0,n.jsx)(eI,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Detect harmful content, bias, and inappropriate advice using semantic analysis"})]}),size:"small",children:[(0,n.jsxs)("div",{style:{marginBottom:16,display:"flex",gap:8},children:[(0,n.jsx)(f.default,{placeholder:"Select a content category",value:c||void 0,onChange:u,style:{flex:1},showSearch:!0,optionLabelProp:"label",filterOption:(e,l)=>{var a,t;return(null!==(t=null==l?void 0:null===(a=l.label)||void 0===a?void 0:a.toString().toLowerCase())&&void 0!==t?t:"").includes(e.toLowerCase())},children:S.map(e=>(0,n.jsx)(eL,{value:e.name,label:e.display_name,children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:{fontWeight:500},children:e.display_name}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#666",marginTop:"2px"},children:e.description})]})},e.name))}),(0,n.jsx)(ed.z,{onClick:()=>{if(!c)return;let e=a.find(e=>e.name===c);!e||t.some(e=>e.category===c)||(i({id:"category-".concat(Date.now()),category:e.name,display_name:e.display_name,action:e.default_action,severity_threshold:"medium"}),u(""),b(""))},disabled:!c,icon:en.Z,children:"Add"})]}),c&&(0,n.jsxs)("div",{style:{marginBottom:16,padding:"12px",background:"#f9f9f9",border:"1px solid #e0e0e0",borderRadius:"4px"},children:[(0,n.jsxs)("div",{style:{marginBottom:8,fontWeight:500,fontSize:"14px"},children:["Preview: ",null===(l=a.find(e=>e.name===c))||void 0===l?void 0:l.display_name]}),N?(0,n.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"Loading YAML..."}):_?(0,n.jsx)("pre",{style:{background:"#fff",padding:"12px",borderRadius:"4px",overflow:"auto",maxHeight:"300px",fontSize:"12px",lineHeight:"1.5",margin:0,border:"1px solid #e0e0e0"},children:(0,n.jsx)("code",{children:_})}):(0,n.jsx)("div",{style:{padding:"8px",textAlign:"center",color:"#888",fontSize:"12px"},children:"Unable to load YAML content"})]}),t.length>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e_.Z,{dataSource:t,columns:C,pagination:!1,size:"small",rowKey:"id"}),(0,n.jsx)("div",{style:{marginTop:16},children:(0,n.jsx)(eP.default,{activeKey:j,onChange:e=>{let l=Array.isArray(e)?e:e?[e]:[],a=new Set(j);l.forEach(e=>{a.has(e)||m[e]||k(e)}),v(l)},ghost:!0,children:t.map(e=>(0,n.jsx)(eT,{header:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,n.jsx)(eA.Z,{}),(0,n.jsxs)("span",{children:["View YAML for ",e.display_name]})]}),children:p[e.category]?(0,n.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"Loading YAML..."}):m[e.category]?(0,n.jsx)("pre",{style:{background:"#f5f5f5",padding:"16px",borderRadius:"4px",overflow:"auto",maxHeight:"400px",fontSize:"12px",lineHeight:"1.5",margin:0},children:(0,n.jsx)("code",{children:m[e.category]})}):(0,n.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"YAML will load when expanded"})},e.category))})})]}):(0,n.jsx)("div",{style:{textAlign:"center",padding:"24px",color:"#888",border:"1px dashed #d9d9d9",borderRadius:"4px"},children:"No content categories selected. Add categories to detect harmful content, bias, or inappropriate advice."})]})};let{Title:eE,Text:eB}=g.default;var eM=e=>{let{prebuiltPatterns:l,categories:a,selectedPatterns:t,blockedWords:i,onPatternAdd:r,onPatternRemove:s,onPatternActionChange:d,onBlockedWordAdd:c,onBlockedWordRemove:u,onBlockedWordUpdate:m,onFileUpload:x,accessToken:p,showStep:g,contentCategories:f=[],selectedContentCategories:j=[],onContentCategoryAdd:v,onContentCategoryRemove:y,onContentCategoryUpdate:_}=e,[b,N]=(0,o.useState)(!1),[w,k]=(0,o.useState)(!1),[C,S]=(0,o.useState)(!1),[Z,P]=(0,o.useState)(""),[A,O]=(0,o.useState)("BLOCK"),[I,L]=(0,o.useState)(""),[T,z]=(0,o.useState)(""),[E,B]=(0,o.useState)("BLOCK"),[M,F]=(0,o.useState)(""),[G,K]=(0,o.useState)("BLOCK"),[D,R]=(0,o.useState)(""),[J,V]=(0,o.useState)(!1),U=async e=>{V(!0);try{let l=await e.text();if(p){let e=await (0,h.validateBlockedWordsFile)(p,l);if(e.valid)x&&x(l),et.Z.success(e.message||"File uploaded successfully");else{let l=e.error||e.errors&&e.errors.join(", ")||"Invalid file";et.Z.error("Validation failed: ".concat(l))}}}catch(e){et.Z.error("Failed to upload file: ".concat(e))}finally{V(!1)}return!1};return(0,n.jsxs)("div",{className:"space-y-6",children:[!g&&(0,n.jsx)("div",{children:(0,n.jsx)(eB,{type:"secondary",children:"Configure patterns, keywords, and content categories to detect and filter sensitive information in requests and responses."})}),(!g||"patterns"===g)&&(0,n.jsxs)(ei.Z,{title:(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(eE,{level:5,style:{margin:0},children:"Pattern Detection"}),(0,n.jsx)(eB,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Detect sensitive information using regex patterns (SSN, credit cards, API keys, etc.)"})]}),size:"small",children:[(0,n.jsx)("div",{style:{marginBottom:16},children:(0,n.jsxs)(er.Z,{children:[(0,n.jsx)(ed.z,{type:"button",onClick:()=>N(!0),icon:en.Z,children:"Add prebuilt pattern"}),(0,n.jsx)(ed.z,{type:"button",onClick:()=>S(!0),variant:"secondary",icon:en.Z,children:"Add custom regex"})]})}),(0,n.jsx)(ek,{patterns:t,onActionChange:d,onRemove:s})]}),(!g||"keywords"===g)&&(0,n.jsxs)(ei.Z,{title:(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(eE,{level:5,style:{margin:0},children:"Blocked Keywords"}),(0,n.jsx)(eB,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Block or mask specific sensitive terms and phrases"})]}),size:"small",children:[(0,n.jsx)("div",{style:{marginBottom:16},children:(0,n.jsxs)(er.Z,{children:[(0,n.jsx)(ed.z,{type:"button",onClick:()=>k(!0),icon:en.Z,children:"Add keyword"}),(0,n.jsx)(es.default,{beforeUpload:U,accept:".yaml,.yml",showUploadList:!1,children:(0,n.jsx)(ed.z,{type:"button",variant:"secondary",icon:eo.Z,loading:J,children:"Upload YAML file"})})]})}),(0,n.jsx)(eZ,{keywords:i,onActionChange:m,onRemove:u})]}),(!g||"categories"===g)&&f.length>0&&v&&y&&_&&(0,n.jsx)(ez,{availableCategories:f,selectedCategories:j,onCategoryAdd:v,onCategoryRemove:y,onCategoryUpdate:_,accessToken:p}),(0,n.jsx)(em,{visible:b,prebuiltPatterns:l,categories:a,selectedPatternName:Z,patternAction:A,onPatternNameChange:P,onActionChange:e=>O(e),onAdd:()=>{if(!Z){et.Z.error("Please select a pattern");return}let e=l.find(e=>e.name===Z);r({id:"pattern-".concat(Date.now()),type:"prebuilt",name:Z,display_name:null==e?void 0:e.display_name,action:A}),N(!1),P(""),O("BLOCK")},onCancel:()=>{N(!1),P(""),O("BLOCK")}}),(0,n.jsx)(eh,{visible:C,patternName:I,patternRegex:T,patternAction:E,onNameChange:L,onRegexChange:z,onActionChange:e=>B(e),onAdd:()=>{if(!I||!T){et.Z.error("Please provide pattern name and regex");return}r({id:"custom-".concat(Date.now()),type:"custom",name:I,pattern:T,action:E}),S(!1),L(""),z(""),B("BLOCK")},onCancel:()=>{S(!1),L(""),z(""),B("BLOCK")}}),(0,n.jsx)(ey,{visible:w,keyword:M,action:G,description:D,onKeywordChange:F,onActionChange:e=>K(e),onDescriptionChange:R,onAdd:()=>{if(!M){et.Z.error("Please enter a keyword");return}c({id:"word-".concat(Date.now()),keyword:M,action:G,description:D||void 0}),k(!1),F(""),R(""),K("BLOCK")},onCancel:()=>{k(!1),F(""),R(""),K("BLOCK")}})]})},eF=a(78801),eG=a(4260),eK=a(23496),eD=a(85180),eR=a(15424);let eJ={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},eV=e=>({...eJ,...e||{},rules:(null==e?void 0:e.rules)?[...e.rules]:[]});var eU=e=>{let{value:l,onChange:a,disabled:t=!1}=e,i=eV(l),r=e=>{let l={...i,...e};null==a||a(l)},s=(e,l)=>{r({rules:i.rules.map((a,t)=>t===e?{...a,...l}:a)})},o=e=>{r({rules:i.rules.filter((l,a)=>a!==e)})},d=(e,l)=>{let a=i.rules[e];if(!a)return;let t=Object.entries(a.allowed_param_patterns||{});l(t);let r={};t.forEach(e=>{let[l,a]=e;r[l]=a}),s(e,{allowed_param_patterns:Object.keys(r).length>0?r:void 0})},c=(e,l,a)=>{d(e,e=>{if(!e[l])return;let[,t]=e[l];e[l]=[a,t]})},u=(e,l,a)=>{d(e,e=>{if(!e[l])return;let[t]=e[l];e[l]=[t,a]})},m=(e,l)=>{let a=Object.entries(e.allowed_param_patterns||{});return 0===a.length?(0,n.jsx)(T.ZP,{disabled:t,size:"small",onClick:()=>s(l,{allowed_param_patterns:{"":""}}),children:"+ Restrict tool arguments (optional)"}):(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(eF.x,{className:"text-sm text-gray-600",children:"Argument constraints (dot or array paths)"}),a.map((a,i)=>{let[r,s]=a;return(0,n.jsxs)(er.Z,{align:"start",children:[(0,n.jsx)(eG.default,{disabled:t,placeholder:"messages[0].content",value:r,onChange:e=>c(l,i,e.target.value)}),(0,n.jsx)(eG.default,{disabled:t,placeholder:"^email@.*$",value:s,onChange:e=>u(l,i,e.target.value)}),(0,n.jsx)(T.ZP,{disabled:t,icon:(0,n.jsx)(eb.Z,{}),danger:!0,onClick:()=>d(l,e=>{e.splice(i,1)})})]},"".concat(e.id||l,"-").concat(i))}),(0,n.jsx)(T.ZP,{disabled:t,size:"small",onClick:()=>s(l,{allowed_param_patterns:{...e.allowed_param_patterns||{},"":""}}),children:"+ Add another constraint"})]})};return(0,n.jsxs)(eF.Z,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eF.x,{className:"text-lg font-semibold",children:"LiteLLM Tool Permission Guardrail"}),(0,n.jsx)(eF.x,{className:"text-sm text-gray-500",children:"Provide regex patterns (e.g., ^mcp__github_.*$) for tool names or types and optionally constrain payload fields."})]}),!t&&(0,n.jsx)(T.ZP,{icon:(0,n.jsx)(en.Z,{}),type:"primary",onClick:()=>{r({rules:[...i.rules,{id:"rule_".concat(Math.random().toString(36).slice(2,8)),decision:"allow",allowed_param_patterns:void 0}]})},className:"!bg-blue-600 !text-white hover:!bg-blue-500",children:"Add Rule"})]}),(0,n.jsx)(eK.Z,{}),0===i.rules.length?(0,n.jsx)(eD.Z,{description:"No tool rules added yet"}):(0,n.jsx)("div",{className:"space-y-4",children:i.rules.map((e,l)=>{var a,i;return(0,n.jsxs)(eF.Z,{className:"bg-gray-50",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsxs)(eF.x,{className:"font-semibold",children:["Rule ",l+1]}),(0,n.jsx)(T.ZP,{icon:(0,n.jsx)(eb.Z,{}),danger:!0,type:"text",disabled:t,onClick:()=>o(l),children:"Remove"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Rule ID"}),(0,n.jsx)(eG.default,{disabled:t,placeholder:"unique_rule_id",value:e.id,onChange:e=>s(l,{id:e.target.value})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Tool Name (optional)"}),(0,n.jsx)(eG.default,{disabled:t,placeholder:"^mcp__github_.*$",value:null!==(a=e.tool_name)&&void 0!==a?a:"",onChange:e=>s(l,{tool_name:""===e.target.value.trim()?void 0:e.target.value})})]})]}),(0,n.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 mt-4",children:(0,n.jsxs)("div",{children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Tool Type (optional)"}),(0,n.jsx)(eG.default,{disabled:t,placeholder:"^function$",value:null!==(i=e.tool_type)&&void 0!==i?i:"",onChange:e=>s(l,{tool_type:""===e.target.value.trim()?void 0:e.target.value})})]})}),(0,n.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Decision"}),(0,n.jsxs)(f.default,{disabled:t,value:e.decision,style:{width:200},onChange:e=>s(l,{decision:e}),children:[(0,n.jsx)(f.default.Option,{value:"allow",children:"Allow"}),(0,n.jsx)(f.default.Option,{value:"deny",children:"Deny"})]})]}),(0,n.jsx)("div",{className:"mt-4",children:m(e,l)})]},e.id||l)})}),(0,n.jsx)(eK.Z,{}),(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Default action"}),(0,n.jsxs)(f.default,{disabled:t,value:i.default_action,onChange:e=>r({default_action:e}),children:[(0,n.jsx)(f.default.Option,{value:"allow",children:"Allow"}),(0,n.jsx)(f.default.Option,{value:"deny",children:"Deny"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)(eF.x,{className:"text-sm font-medium flex items-center gap-1",children:["On disallowed action",(0,n.jsx)(L.Z,{title:"Block returns an error when a forbidden tool is invoked. Rewrite strips the tool call but lets the rest of the response continue.",children:(0,n.jsx)(eR.Z,{})})]}),(0,n.jsxs)(f.default,{disabled:t,value:i.on_disallowed_action,onChange:e=>r({on_disallowed_action:e}),children:[(0,n.jsx)(f.default.Option,{value:"block",children:"Block"}),(0,n.jsx)(f.default.Option,{value:"rewrite",children:"Rewrite"})]})]})]}),(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Violation message (optional)"}),(0,n.jsx)(eG.default.TextArea,{disabled:t,rows:3,placeholder:"This violates our org policy...",value:i.violation_message_template,onChange:e=>r({violation_message_template:e.target.value})})]})]})};let{Title:eW,Text:eY,Link:eq}=g.default,{Option:eH}=f.default,{Step:e$}=j.default,eQ={pre_call:"Before LLM Call - Runs before the LLM call and checks the input (Recommended)",during_call:"During LLM Call - Runs in parallel with the LLM call, with response held until check completes",post_call:"After LLM Call - Runs after the LLM call and checks only the output",logging_only:"Logging Only - Only runs on logging callbacks without affecting the LLM call",pre_mcp_call:"Before MCP Tool Call - Runs before MCP tool execution and validates tool calls",during_mcp_call:"During MCP Tool Call - Runs in parallel with MCP tool execution for monitoring"};var eX=e=>{let{visible:l,onClose:a,accessToken:t,onSuccess:i}=e,[r]=v.Z.useForm(),[s,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(null),[m,x]=(0,o.useState)(null),[p,g]=(0,o.useState)([]),[N,A]=(0,o.useState)({}),[I,L]=(0,o.useState)(0),[T,z]=(0,o.useState)(null),[E,B]=(0,o.useState)([]),[M,F]=(0,o.useState)(2),[G,K]=(0,o.useState)({}),[D,R]=(0,o.useState)([]),[J,V]=(0,o.useState)([]),[U,W]=(0,o.useState)([]),[Y,H]=(0,o.useState)({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),$=(0,o.useMemo)(()=>!!c&&"tool_permission"===(C[c]||"").toLowerCase(),[c]);(0,o.useEffect)(()=>{t&&(async()=>{try{let[e,l]=await Promise.all([(0,h.getGuardrailUISettings)(t),(0,h.getGuardrailProviderSpecificParams)(t)]);x(e),z(l),w(l),S(l)}catch(e){console.error("Error fetching guardrail data:",e),et.Z.fromBackend("Failed to load guardrail configuration")}})()},[t]);let Q=e=>{u(e),r.setFieldsValue({config:void 0,presidio_analyzer_api_base:void 0,presidio_anonymizer_api_base:void 0}),g([]),A({}),B([]),F(2),K({}),H({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""})},ee=e=>{g(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},el=(e,l)=>{A(a=>({...a,[e]:l}))},ei=async()=>{try{if(0===I&&(await r.validateFields(["guardrail_name","provider","mode","default_on"]),c)){let e=["guardrail_name","provider","mode","default_on"];"PresidioPII"===c&&e.push("presidio_analyzer_api_base","presidio_anonymizer_api_base"),await r.validateFields(e)}if(1===I&&Z(c)&&0===p.length){et.Z.fromBackend("Please select at least one PII entity to continue");return}L(I+1)}catch(e){console.error("Form validation failed:",e)}},er=()=>{L(I-1)},es=()=>{r.resetFields(),u(null),g([]),A({}),B([]),F(2),K({}),R([]),V([]),W([]),H({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),L(0)},en=()=>{es(),a()},eo=async()=>{try{d(!0),await r.validateFields();let l=r.getFieldsValue(!0),s=C[l.provider],n={guardrail_name:l.guardrail_name,litellm_params:{guardrail:s,mode:l.mode,default_on:l.default_on},guardrail_info:{}};if("PresidioPII"===l.provider&&p.length>0){let e={};p.forEach(l=>{e[l]=N[l]||"MASK"}),n.litellm_params.pii_entities_config=e,l.presidio_analyzer_api_base&&(n.litellm_params.presidio_analyzer_api_base=l.presidio_analyzer_api_base),l.presidio_anonymizer_api_base&&(n.litellm_params.presidio_anonymizer_api_base=l.presidio_anonymizer_api_base)}if(P(l.provider))D.length>0&&(n.litellm_params.patterns=D.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action}))),J.length>0&&(n.litellm_params.blocked_words=J.map(e=>({keyword:e.keyword,action:e.action,description:e.description}))),U.length>0&&(n.litellm_params.categories=U.map(e=>({category:e.category,enabled:!0,action:e.action,severity_threshold:e.severity_threshold||"medium"})));else if(l.config)try{let e=JSON.parse(l.config);n.guardrail_info=e}catch(e){et.Z.fromBackend("Invalid JSON in configuration"),d(!1);return}if("tool_permission"===s){if(0===Y.rules.length){et.Z.fromBackend("Add at least one tool permission rule"),d(!1);return}n.litellm_params.rules=Y.rules,n.litellm_params.default_action=Y.default_action,n.litellm_params.on_disallowed_action=Y.on_disallowed_action,Y.violation_message_template&&(n.litellm_params.violation_message_template=Y.violation_message_template)}if(console.log("values: ",JSON.stringify(l)),T&&c){var e;let a=null===(e=C[c])||void 0===e?void 0:e.toLowerCase();console.log("providerKey: ",a);let t=T[a]||{},i=new Set;console.log("providerSpecificParams: ",JSON.stringify(t)),Object.keys(t).forEach(e=>{"optional_params"!==e&&i.add(e)}),t.optional_params&&t.optional_params.fields&&Object.keys(t.optional_params.fields).forEach(e=>{i.add(e)}),console.log("allowedParams: ",i),i.forEach(e=>{let a=l[e];if(null==a||""===a){var t;a=null===(t=l.optional_params)||void 0===t?void 0:t[e]}null!=a&&""!==a&&(n.litellm_params[e]=a)})}if(!t)throw Error("No access token available");console.log("Sending guardrail data:",JSON.stringify(n)),await (0,h.createGuardrailCall)(t,n),et.Z.success("Guardrail created successfully"),es(),i(),a()}catch(e){console.error("Failed to create guardrail:",e),et.Z.fromBackend("Failed to create guardrail: "+(e instanceof Error?e.message:String(e)))}finally{d(!1)}},ed=()=>{var e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(v.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,n.jsx)(b.o,{placeholder:"Enter a name for this guardrail"})}),(0,n.jsx)(v.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,n.jsx)(f.default,{placeholder:"Select a guardrail provider",onChange:Q,labelInValue:!1,optionLabelProp:"label",dropdownRender:e=>e,showSearch:!0,children:Object.entries(k()).map(e=>{let[l,a]=e;return(0,n.jsx)(eH,{value:l,label:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[O[a]&&(0,n.jsx)("img",{src:O[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]}),children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[O[a]&&(0,n.jsx)("img",{src:O[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]})},l)})})}),(0,n.jsx)(v.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,n.jsx)(f.default,{optionLabelProp:"label",mode:"multiple",children:(null==m?void 0:null===(e=m.supported_modes)||void 0===e?void 0:e.map(e=>(0,n.jsx)(eH,{value:e,label:e,children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:e}),"pre_call"===e&&(0,n.jsx)(y.Z,{color:"green",style:{marginLeft:"8px"},children:"Recommended"})]}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eQ[e]})]})},e)))||(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eH,{value:"pre_call",label:"pre_call",children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"pre_call"})," ",(0,n.jsx)(y.Z,{color:"green",children:"Recommended"})]}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eQ.pre_call})]})}),(0,n.jsx)(eH,{value:"during_call",label:"during_call",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"during_call"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eQ.during_call})]})}),(0,n.jsx)(eH,{value:"post_call",label:"post_call",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"post_call"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eQ.post_call})]})}),(0,n.jsx)(eH,{value:"logging_only",label:"logging_only",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"logging_only"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eQ.logging_only})]})})]})})}),(0,n.jsx)(v.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default.",children:(0,n.jsxs)(f.default,{children:[(0,n.jsx)(f.default.Option,{value:!0,children:"Yes"}),(0,n.jsx)(f.default.Option,{value:!1,children:"No"})]})}),!$&&!P(c)&&(0,n.jsx)(X,{selectedProvider:c,accessToken:t,providerParams:T})]})},ec=()=>m&&"PresidioPII"===c?(0,n.jsx)(q,{entities:m.supported_entities,actions:m.supported_actions,selectedEntities:p,selectedActions:N,onEntitySelect:ee,onActionSelect:el,entityCategories:m.pii_entity_categories}):null,eu=e=>{if(!m||!P(c))return null;let l=m.content_filter_settings;return l?(0,n.jsx)(eM,{prebuiltPatterns:l.prebuilt_patterns||[],categories:l.pattern_categories||[],selectedPatterns:D,blockedWords:J,onPatternAdd:e=>R([...D,e]),onPatternRemove:e=>R(D.filter(l=>l.id!==e)),onPatternActionChange:(e,l)=>{R(D.map(a=>a.id===e?{...a,action:l}:a))},onBlockedWordAdd:e=>V([...J,e]),onBlockedWordRemove:e=>V(J.filter(l=>l.id!==e)),onBlockedWordUpdate:(e,l,a)=>{V(J.map(t=>t.id===e?{...t,[l]:a}:t))},contentCategories:l.content_categories||[],selectedContentCategories:U,onContentCategoryAdd:e=>W([...U,e]),onContentCategoryRemove:e=>W(U.filter(l=>l.id!==e)),onContentCategoryUpdate:(e,l,a)=>{W(U.map(t=>t.id===e?{...t,[l]:a}:t))},accessToken:t,showStep:e}):null},em=()=>{var e;if(!c)return null;if($)return(0,n.jsx)(eU,{value:Y,onChange:H});if(!T)return null;console.log("guardrail_provider_map: ",C),console.log("selectedProvider: ",c);let l=null===(e=C[c])||void 0===e?void 0:e.toLowerCase(),a=T&&T[l];return a&&a.optional_params?(0,n.jsx)(ea,{optionalParams:a.optional_params,parentFieldKey:"optional_params"}):null};return(0,n.jsx)(_.Z,{title:"Add Guardrail",open:l,onCancel:en,footer:null,width:800,children:(0,n.jsxs)(v.Z,{form:r,layout:"vertical",initialValues:{mode:"pre_call",default_on:!1},children:[(0,n.jsxs)(j.default,{current:I,className:"mb-6",style:{overflow:"visible"},children:[(0,n.jsx)(e$,{title:"Basic Info"}),(0,n.jsx)(e$,{title:Z(c)?"PII Configuration":P(c)?"Default Categories":"Provider Configuration"}),P(c)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e$,{title:"Patterns"}),(0,n.jsx)(e$,{title:"Keywords"})]})]}),(()=>{switch(I){case 0:return ed();case 1:if(Z(c))return ec();if(P(c))return eu("categories");return em();case 2:if(P(c))return eu("patterns");return null;case 3:if(P(c))return eu("keywords");return null;default:return null}})(),(()=>{let e=I===(P(c)?4:2)-1;return(0,n.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[I>0&&(0,n.jsx)(b.z,{variant:"secondary",onClick:er,children:"Previous"}),!e&&(0,n.jsx)(b.z,{onClick:ei,children:"Next"}),e&&(0,n.jsx)(b.z,{onClick:eo,loading:s,children:"Create Guardrail"}),(0,n.jsx)(b.z,{variant:"secondary",onClick:en,children:"Cancel"})]})})()]})})},e0=a(47323),e1=a(21626),e4=a(97214),e2=a(28241),e8=a(58834),e5=a(69552),e6=a(71876),e3=a(74998),e9=a(44633),e7=a(86462),le=a(49084),ll=a(1309),la=a(71594),lt=a(24525),li=a(63709);let{Title:lr,Text:ls}=g.default,{Option:ln}=f.default;var lo=e=>{var l;let{visible:a,onClose:t,accessToken:i,onSuccess:r,guardrailId:s,initialValues:d}=e,[c]=v.Z.useForm(),[u,m]=(0,o.useState)(!1),[x,p]=(0,o.useState)((null==d?void 0:d.provider)||null),[g,j]=(0,o.useState)(null),[y,N]=(0,o.useState)([]),[w,S]=(0,o.useState)({});(0,o.useEffect)(()=>{(async()=>{try{if(!i)return;let e=await (0,h.getGuardrailUISettings)(i);j(e)}catch(e){console.error("Error fetching guardrail settings:",e),et.Z.fromBackend("Failed to load guardrail settings")}})()},[i]),(0,o.useEffect)(()=>{(null==d?void 0:d.pii_entities_config)&&Object.keys(d.pii_entities_config).length>0&&(N(Object.keys(d.pii_entities_config)),S(d.pii_entities_config))},[d]);let Z=e=>{N(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},P=(e,l)=>{S(a=>({...a,[e]:l}))},A=async()=>{try{m(!0);let e=await c.validateFields(),l=C[e.provider],a={guardrail_id:s,guardrail:{guardrail_name:e.guardrail_name,litellm_params:{guardrail:l,mode:e.mode,default_on:e.default_on},guardrail_info:{}}};if("PresidioPII"===e.provider&&y.length>0){let e={};y.forEach(l=>{e[l]=w[l]||"MASK"}),a.guardrail.litellm_params.pii_entities_config=e}else if(e.config)try{let l=JSON.parse(e.config);"Bedrock"===e.provider&&l?(l.guardrail_id&&(a.guardrail.litellm_params.guardrailIdentifier=l.guardrail_id),l.guardrail_version&&(a.guardrail.litellm_params.guardrailVersion=l.guardrail_version)):a.guardrail.guardrail_info=l}catch(e){et.Z.fromBackend("Invalid JSON in configuration"),m(!1);return}if(!i)throw Error("No access token available");console.log("Sending guardrail update data:",JSON.stringify(a));let n=await fetch("/guardrails/".concat(s),{method:"PUT",headers:{Authorization:"Bearer ".concat(i),"Content-Type":"application/json"},body:JSON.stringify(a)});if(!n.ok){let e=await n.text();throw Error(e||"Failed to update guardrail")}et.Z.success("Guardrail updated successfully"),r(),t()}catch(e){console.error("Failed to update guardrail:",e),et.Z.fromBackend("Failed to update guardrail: "+(e instanceof Error?e.message:String(e)))}finally{m(!1)}},I=()=>g&&x&&"PresidioPII"===x?(0,n.jsx)(q,{entities:g.supported_entities,actions:g.supported_actions,selectedEntities:y,selectedActions:w,onEntitySelect:Z,onActionSelect:P,entityCategories:g.pii_entity_categories}):null;return(0,n.jsx)(_.Z,{title:"Edit Guardrail",open:a,onCancel:t,footer:null,width:700,children:(0,n.jsxs)(v.Z,{form:c,layout:"vertical",initialValues:d,children:[(0,n.jsx)(v.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,n.jsx)(b.o,{placeholder:"Enter a name for this guardrail"})}),(0,n.jsx)(v.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,n.jsx)(f.default,{placeholder:"Select a guardrail provider",onChange:e=>{p(e),c.setFieldsValue({config:void 0}),N([]),S({})},disabled:!0,optionLabelProp:"label",children:Object.entries(k()).map(e=>{let[l,a]=e;return(0,n.jsx)(ln,{value:l,label:a,children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[O[a]&&(0,n.jsx)("img",{src:O[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]})},l)})})}),(0,n.jsx)(v.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,n.jsx)(f.default,{children:(null==g?void 0:null===(l=g.supported_modes)||void 0===l?void 0:l.map(e=>(0,n.jsx)(ln,{value:e,children:e},e)))||(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ln,{value:"pre_call",children:"pre_call"}),(0,n.jsx)(ln,{value:"post_call",children:"post_call"})]})})}),(0,n.jsx)(v.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default",valuePropName:"checked",children:(0,n.jsx)(li.Z,{})}),(()=>{if(!x)return null;if("PresidioPII"===x)return I();switch(x){case"Aporia":return(0,n.jsx)(v.Z.Item,{label:"Aporia Configuration",name:"config",tooltip:"JSON configuration for Aporia",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aporia_api_key",\n "project_name": "your_project_name"\n}'})});case"AimSecurity":return(0,n.jsx)(v.Z.Item,{label:"Aim Security Configuration",name:"config",tooltip:"JSON configuration for Aim Security",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aim_api_key"\n}'})});case"Bedrock":return(0,n.jsx)(v.Z.Item,{label:"Amazon Bedrock Configuration",name:"config",tooltip:"JSON configuration for Amazon Bedrock guardrails",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "guardrail_id": "your_guardrail_id",\n "guardrail_version": "your_guardrail_version"\n}'})});case"GuardrailsAI":return(0,n.jsx)(v.Z.Item,{label:"Guardrails.ai Configuration",name:"config",tooltip:"JSON configuration for Guardrails.ai",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_guardrails_api_key",\n "guardrail_id": "your_guardrail_id"\n}'})});case"LakeraAI":return(0,n.jsx)(v.Z.Item,{label:"Lakera AI Configuration",name:"config",tooltip:"JSON configuration for Lakera AI",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_lakera_api_key"\n}'})});case"PromptInjection":return(0,n.jsx)(v.Z.Item,{label:"Prompt Injection Configuration",name:"config",tooltip:"JSON configuration for prompt injection detection",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "threshold": 0.8\n}'})});default:return(0,n.jsx)(v.Z.Item,{label:"Custom Configuration",name:"config",tooltip:"JSON configuration for your custom guardrail",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "key1": "value1",\n "key2": "value2"\n}'})})}})(),(0,n.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[(0,n.jsx)(b.z,{variant:"secondary",onClick:t,children:"Cancel"}),(0,n.jsx)(b.z,{onClick:A,loading:u,children:"Update Guardrail"})]})]})})};(i=s||(s={})).DB="db",i.CONFIG="config";var ld=e=>{let{guardrailsList:l,isLoading:a,onDeleteClick:t,accessToken:i,onGuardrailUpdated:r,isAdmin:c=!1,onGuardrailClick:u}=e,[m,x]=(0,o.useState)([{id:"created_at",desc:!0}]),[p,h]=(0,o.useState)(!1),[g,f]=(0,o.useState)(null),j=e=>e?new Date(e).toLocaleString():"-",v=[{header:"Guardrail ID",accessorKey:"guardrail_id",cell:e=>(0,n.jsx)(L.Z,{title:String(e.getValue()||""),children:(0,n.jsx)(d.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 max-w-[200px]",onClick:()=>e.getValue()&&u(e.getValue()),children:e.getValue()?"".concat(String(e.getValue()).slice(0,7),"..."):""})})},{header:"Name",accessorKey:"guardrail_name",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.guardrail_name,children:(0,n.jsx)("span",{className:"text-xs font-medium",children:a.guardrail_name||"-"})})}},{header:"Provider",accessorKey:"litellm_params.guardrail",cell:e=>{let{row:l}=e,{logo:a,displayName:t}=I(l.original.litellm_params.guardrail);return(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,n.jsx)("img",{src:a,alt:"".concat(t," logo"),className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,n.jsx)("span",{className:"text-xs",children:t})]})}},{header:"Mode",accessorKey:"litellm_params.mode",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)("span",{className:"text-xs",children:a.litellm_params.mode})}},{header:"Default On",accessorKey:"litellm_params.default_on",cell:e=>{var l,a;let{row:t}=e,i=t.original;return(0,n.jsx)(ll.C,{color:(null===(l=i.litellm_params)||void 0===l?void 0:l.default_on)?"green":"gray",className:"text-xs font-normal",size:"xs",children:(null===(a=i.litellm_params)||void 0===a?void 0:a.default_on)?"Default On":"Default Off"})}},{header:"Created At",accessorKey:"created_at",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.created_at,children:(0,n.jsx)("span",{className:"text-xs",children:j(a.created_at)})})}},{header:"Updated At",accessorKey:"updated_at",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.updated_at,children:(0,n.jsx)("span",{className:"text-xs",children:j(a.updated_at)})})}},{id:"actions",header:"Actions",cell:e=>{let{row:l}=e,a=l.original,i=a.guardrail_definition_location===s.CONFIG;return(0,n.jsx)("div",{className:"flex space-x-2",children:i?(0,n.jsx)(L.Z,{title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,n.jsx)(e0.Z,{"data-testid":"config-delete-icon",icon:e3.Z,size:"sm",className:"cursor-not-allowed text-gray-400",title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.","aria-label":"Delete guardrail (config)"})}):(0,n.jsx)(L.Z,{title:"Delete guardrail",children:(0,n.jsx)(e0.Z,{icon:e3.Z,size:"sm",onClick:()=>a.guardrail_id&&t(a.guardrail_id,a.guardrail_name||"Unnamed Guardrail"),className:"cursor-pointer hover:text-red-500"})})})}}],y=(0,la.b7)({data:l,columns:v,state:{sorting:m},onSortingChange:x,getCoreRowModel:(0,lt.sC)(),getSortedRowModel:(0,lt.tj)(),enableSorting:!0});return(0,n.jsxs)("div",{className:"rounded-lg custom-border relative",children:[(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)(e1.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,n.jsx)(e8.Z,{children:y.getHeaderGroups().map(e=>(0,n.jsx)(e6.Z,{children:e.headers.map(e=>(0,n.jsx)(e5.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.getToggleSortingHandler(),children:(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,la.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,n.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,n.jsx)(e9.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,n.jsx)(e7.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,n.jsx)(le.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,n.jsx)(e4.Z,{children:a?(0,n.jsx)(e6.Z,{children:(0,n.jsx)(e2.Z,{colSpan:v.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"Loading..."})})})}):l.length>0?y.getRowModel().rows.map(e=>(0,n.jsx)(e6.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,n.jsx)(e2.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,la.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,n.jsx)(e6.Z,{children:(0,n.jsx)(e2.Z,{colSpan:v.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"No guardrails found"})})})})})]})}),g&&(0,n.jsx)(lo,{visible:p,onClose:()=>h(!1),accessToken:i,onSuccess:()=>{h(!1),f(null),r()},guardrailId:g.guardrail_id||"",initialValues:{guardrail_name:g.guardrail_name||"",provider:Object.keys(C).find(e=>C[e]===(null==g?void 0:g.litellm_params.guardrail))||"",mode:g.litellm_params.mode,default_on:g.litellm_params.default_on,pii_entities_config:g.litellm_params.pii_entities_config,...g.guardrail_info}})]})},lc=a(20347),lu=a(30078),lm=a(41649),lx=a(12514),lp=a(84264),lh=e=>{let{patterns:l,blockedWords:a,readOnly:t=!0,onPatternActionChange:i,onPatternRemove:r,onBlockedWordUpdate:s,onBlockedWordRemove:o}=e;if(0===l.length&&0===a.length)return null;let d=()=>{};return(0,n.jsxs)(n.Fragment,{children:[l.length>0&&(0,n.jsxs)(lx.Z,{className:"mt-6",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(lp.Z,{className:"text-lg font-semibold",children:"Pattern Detection"}),(0,n.jsxs)(lm.Z,{color:"blue",children:[l.length," patterns configured"]})]}),(0,n.jsx)(ek,{patterns:l,onActionChange:t?d:i||d,onRemove:t?d:r||d})]}),a.length>0&&(0,n.jsxs)(lx.Z,{className:"mt-6",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(lp.Z,{className:"text-lg font-semibold",children:"Blocked Keywords"}),(0,n.jsxs)(lm.Z,{color:"blue",children:[a.length," keywords configured"]})]}),(0,n.jsx)(eZ,{keywords:a,onActionChange:t?d:s||d,onRemove:t?d:o||d})]})]})},lg=e=>{var l;let{guardrailData:a,guardrailSettings:t,isEditing:i,accessToken:r,onDataChange:s,onUnsavedChanges:d}=e,[c,u]=(0,o.useState)([]),[m,x]=(0,o.useState)([]),[p,h]=(0,o.useState)([]),[g,f]=(0,o.useState)([]);(0,o.useEffect)(()=>{var e,l;if(null==a?void 0:null===(e=a.litellm_params)||void 0===e?void 0:e.patterns){let e=a.litellm_params.patterns.map((e,l)=>({id:"pattern-".concat(l),type:"prebuilt"===e.pattern_type?"prebuilt":"custom",name:e.pattern_name||e.name,display_name:e.display_name,pattern:e.pattern,action:e.action||"BLOCK"}));u(e),h(e)}else u([]),h([]);if(null==a?void 0:null===(l=a.litellm_params)||void 0===l?void 0:l.blocked_words){let e=a.litellm_params.blocked_words.map((e,l)=>({id:"word-".concat(l),keyword:e.keyword,action:e.action||"BLOCK",description:e.description}));x(e),f(e)}else x([]),f([])},[a]),(0,o.useEffect)(()=>{s&&s(c,m)},[c,m,s]);let j=o.useMemo(()=>{let e=JSON.stringify(c)!==JSON.stringify(p),l=JSON.stringify(m)!==JSON.stringify(g);return e||l},[c,m,p,g]);return((0,o.useEffect)(()=>{i&&d&&d(j)},[j,i,d]),(null==a?void 0:null===(l=a.litellm_params)||void 0===l?void 0:l.guardrail)!=="litellm_content_filter")?null:i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eK.Z,{orientation:"left",children:"Content Filter Configuration"}),j&&(0,n.jsx)("div",{className:"mb-4 px-4 py-3 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,n.jsx)("p",{className:"text-sm text-yellow-800 font-medium",children:'⚠️ You have unsaved changes to patterns or keywords. Remember to click "Save Changes" at the bottom.'})}),(0,n.jsx)("div",{className:"mb-6",children:t&&t.content_filter_settings&&(0,n.jsx)(eM,{prebuiltPatterns:t.content_filter_settings.prebuilt_patterns||[],categories:t.content_filter_settings.pattern_categories||[],selectedPatterns:c,blockedWords:m,onPatternAdd:e=>u([...c,e]),onPatternRemove:e=>u(c.filter(l=>l.id!==e)),onPatternActionChange:(e,l)=>u(c.map(a=>a.id===e?{...a,action:l}:a)),onBlockedWordAdd:e=>x([...m,e]),onBlockedWordRemove:e=>x(m.filter(l=>l.id!==e)),onBlockedWordUpdate:(e,l,a)=>x(m.map(t=>t.id===e?{...t,[l]:a}:t)),onFileUpload:e=>{console.log("File uploaded:",e)},accessToken:r})})]}):(0,n.jsx)(lh,{patterns:c,blockedWords:m,readOnly:!0})};let lf=(e,l)=>({patterns:e.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action})),blocked_words:l.map(e=>({keyword:e.keyword,action:e.action,description:e.description}))});var lj=a(10900),lv=a(59872),ly=a(30401),l_=a(78867),lb=e=>{var l,a,t,i,r,s,d,c,u,m,x,p,g,j,y,_;let{guardrailId:b,onClose:N,accessToken:w,isAdmin:k}=e,[S,Z]=(0,o.useState)(null),[P,A]=(0,o.useState)(null),[O,z]=(0,o.useState)(!0),[M,F]=(0,o.useState)(!1),[G]=v.Z.useForm(),[K,D]=(0,o.useState)([]),[R,J]=(0,o.useState)({}),[V,U]=(0,o.useState)(null),[W,Y]=(0,o.useState)({}),[H,$]=(0,o.useState)(!1),Q={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},[ee,el]=(0,o.useState)(Q),[ei,er]=(0,o.useState)(!1),es=o.useRef({patterns:[],blockedWords:[]}),en=(0,o.useCallback)((e,l)=>{es.current={patterns:e,blockedWords:l}},[]),eo=async()=>{try{var e;if(z(!0),!w)return;let l=await (0,h.getGuardrailInfo)(w,b);if(Z(l),null===(e=l.litellm_params)||void 0===e?void 0:e.pii_entities_config){let e=l.litellm_params.pii_entities_config;if(D([]),J({}),Object.keys(e).length>0){let l=[],a={};Object.entries(e).forEach(e=>{let[t,i]=e;l.push(t),a[t]="string"==typeof i?i:"MASK"}),D(l),J(a)}}else D([]),J({})}catch(e){et.Z.fromBackend("Failed to load guardrail information"),console.error("Error fetching guardrail info:",e)}finally{z(!1)}},ed=async()=>{try{if(!w)return;let e=await (0,h.getGuardrailProviderSpecificParams)(w);A(e)}catch(e){console.error("Error fetching guardrail provider specific params:",e)}},ec=async()=>{try{if(!w)return;let e=await (0,h.getGuardrailUISettings)(w);U(e)}catch(e){console.error("Error fetching guardrail UI settings:",e)}};(0,o.useEffect)(()=>{ed()},[w]),(0,o.useEffect)(()=>{eo(),ec()},[b,w]),(0,o.useEffect)(()=>{if(S&&G){var e;G.setFieldsValue({guardrail_name:S.guardrail_name,...S.litellm_params,guardrail_info:S.guardrail_info?JSON.stringify(S.guardrail_info,null,2):"",...(null===(e=S.litellm_params)||void 0===e?void 0:e.optional_params)&&{optional_params:S.litellm_params.optional_params}})}},[S,P,G]);let eu=(0,o.useCallback)(()=>{var e,l,a,t,i;(null==S?void 0:null===(e=S.litellm_params)||void 0===e?void 0:e.guardrail)==="tool_permission"?el({rules:(null===(l=S.litellm_params)||void 0===l?void 0:l.rules)||[],default_action:((null===(a=S.litellm_params)||void 0===a?void 0:a.default_action)||"deny").toLowerCase(),on_disallowed_action:((null===(t=S.litellm_params)||void 0===t?void 0:t.on_disallowed_action)||"block").toLowerCase(),violation_message_template:(null===(i=S.litellm_params)||void 0===i?void 0:i.violation_message_template)||""}):el(Q),er(!1)},[S]);(0,o.useEffect)(()=>{eu()},[eu]);let em=async e=>{try{var l,a,t,i,r,s,n,o,d,c,u,m;if(!w)return;let x={litellm_params:{}};e.guardrail_name!==S.guardrail_name&&(x.guardrail_name=e.guardrail_name),e.default_on!==(null===(l=S.litellm_params)||void 0===l?void 0:l.default_on)&&(x.litellm_params.default_on=e.default_on);let p=S.guardrail_info,g=e.guardrail_info?JSON.parse(e.guardrail_info):void 0;JSON.stringify(p)!==JSON.stringify(g)&&(x.guardrail_info=g);let f=(null===(a=S.litellm_params)||void 0===a?void 0:a.pii_entities_config)||{},j={};if(K.forEach(e=>{j[e]=R[e]||"MASK"}),JSON.stringify(f)!==JSON.stringify(j)&&(x.litellm_params.pii_entities_config=j),(null===(t=S.litellm_params)||void 0===t?void 0:t.guardrail)==="litellm_content_filter"){let e=(null===(s=S.litellm_params)||void 0===s?void 0:s.patterns)||[],l=(null===(n=S.litellm_params)||void 0===n?void 0:n.blocked_words)||[],a=lf(es.current.patterns,es.current.blockedWords);JSON.stringify(e)!==JSON.stringify(a.patterns)&&(x.litellm_params.patterns=a.patterns),JSON.stringify(l)!==JSON.stringify(a.blocked_words)&&(x.litellm_params.blocked_words=a.blocked_words)}if((null===(i=S.litellm_params)||void 0===i?void 0:i.guardrail)==="tool_permission"){let e=(null===(o=S.litellm_params)||void 0===o?void 0:o.rules)||[],l=ee.rules||[],a=JSON.stringify(e)!==JSON.stringify(l),t=((null===(d=S.litellm_params)||void 0===d?void 0:d.default_action)||"deny").toLowerCase(),i=(ee.default_action||"deny").toLowerCase(),r=t!==i,s=((null===(c=S.litellm_params)||void 0===c?void 0:c.on_disallowed_action)||"block").toLowerCase(),n=(ee.on_disallowed_action||"block").toLowerCase(),m=s!==n,p=(null===(u=S.litellm_params)||void 0===u?void 0:u.violation_message_template)||"",h=ee.violation_message_template||"",g=p!==h;(ei||a||r||m||g)&&(x.litellm_params.rules=l,x.litellm_params.default_action=i,x.litellm_params.on_disallowed_action=n,x.litellm_params.violation_message_template=h||null)}let v=Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)});console.log("values: ",JSON.stringify(e)),console.log("currentProvider: ",v);let y=(null===(r=S.litellm_params)||void 0===r?void 0:r.guardrail)==="tool_permission";if(P&&v&&!y){let l=P[null===(m=C[v])||void 0===m?void 0:m.toLowerCase()]||{},a=new Set;console.log("providerSpecificParams: ",JSON.stringify(l)),Object.keys(l).forEach(e=>{"optional_params"!==e&&a.add(e)}),l.optional_params&&l.optional_params.fields&&Object.keys(l.optional_params.fields).forEach(e=>{a.add(e)}),console.log("allowedParams: ",a),a.forEach(l=>{var a,t;let i=e[l];(null==i||""===i)&&(i=null===(t=e.optional_params)||void 0===t?void 0:t[l]);let r=null===(a=S.litellm_params)||void 0===a?void 0:a[l];JSON.stringify(i)!==JSON.stringify(r)&&(null!=i&&""!==i?x.litellm_params[l]=i:null!=r&&""!==r&&(x.litellm_params[l]=null))})}if(0===Object.keys(x.litellm_params).length&&delete x.litellm_params,0===Object.keys(x).length){et.Z.info("No changes detected"),F(!1);return}await (0,h.updateGuardrailCall)(w,b,x),et.Z.success("Guardrail updated successfully"),$(!1),eo(),F(!1)}catch(e){console.error("Error updating guardrail:",e),et.Z.fromBackend("Failed to update guardrail")}};if(O)return(0,n.jsx)("div",{className:"p-4",children:"Loading..."});if(!S)return(0,n.jsx)("div",{className:"p-4",children:"Guardrail not found"});let ex=e=>e?new Date(e).toLocaleString():"-",{logo:ep,displayName:eh}=I((null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)||""),eg=async(e,l)=>{await (0,lv.vQ)(e)&&(Y(e=>({...e,[l]:!0})),setTimeout(()=>{Y(e=>({...e,[l]:!1}))},2e3))},ef="config"===S.guardrail_definition_location;return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.zx,{icon:lj.Z,variant:"light",onClick:N,className:"mb-4",children:"Back to Guardrails"}),(0,n.jsx)(lu.Dx,{children:S.guardrail_name||"Unnamed Guardrail"}),(0,n.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,n.jsx)(lu.xv,{className:"text-gray-500 font-mono",children:S.guardrail_id}),(0,n.jsx)(T.ZP,{type:"text",size:"small",icon:W["guardrail-id"]?(0,n.jsx)(ly.Z,{size:12}):(0,n.jsx)(l_.Z,{size:12}),onClick:()=>eg(S.guardrail_id,"guardrail-id"),className:"left-2 z-10 transition-all duration-200 ".concat(W["guardrail-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,n.jsxs)(lu.v0,{children:[(0,n.jsxs)(lu.td,{className:"mb-4",children:[(0,n.jsx)(lu.OK,{children:"Overview"},"overview"),k?(0,n.jsx)(lu.OK,{children:"Settings"},"settings"):(0,n.jsx)(n.Fragment,{})]}),(0,n.jsxs)(lu.nP,{children:[(0,n.jsxs)(lu.x4,{children:[(0,n.jsxs)(lu.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,n.jsxs)(lu.Zb,{children:[(0,n.jsx)(lu.xv,{children:"Provider"}),(0,n.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[ep&&(0,n.jsx)("img",{src:ep,alt:"".concat(eh," logo"),className:"w-6 h-6",onError:e=>{e.target.style.display="none"}}),(0,n.jsx)(lu.Dx,{children:eh})]})]}),(0,n.jsxs)(lu.Zb,{children:[(0,n.jsx)(lu.xv,{children:"Mode"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(lu.Dx,{children:(null===(a=S.litellm_params)||void 0===a?void 0:a.mode)||"-"}),(0,n.jsx)(lu.Ct,{color:(null===(t=S.litellm_params)||void 0===t?void 0:t.default_on)?"green":"gray",children:(null===(i=S.litellm_params)||void 0===i?void 0:i.default_on)?"Default On":"Default Off"})]})]}),(0,n.jsxs)(lu.Zb,{children:[(0,n.jsx)(lu.xv,{children:"Created At"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(lu.Dx,{children:ex(S.created_at)}),(0,n.jsxs)(lu.xv,{children:["Last Updated: ",ex(S.updated_at)]})]})]})]}),(null===(r=S.litellm_params)||void 0===r?void 0:r.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsx)(lu.Zb,{className:"mt-6",children:(0,n.jsxs)("div",{className:"flex justify-between items-center",children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"PII Protection"}),(0,n.jsxs)(lu.Ct,{color:"blue",children:[Object.keys(S.litellm_params.pii_entities_config).length," PII entities configured"]})]})}),(null===(s=S.litellm_params)||void 0===s?void 0:s.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsxs)(lu.Zb,{className:"mt-6",children:[(0,n.jsx)(lu.xv,{className:"mb-4 text-lg font-semibold",children:"PII Entity Configuration"}),(0,n.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,n.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,n.jsx)(lu.xv,{className:"flex-1 font-semibold text-gray-700",children:"Entity Type"}),(0,n.jsx)(lu.xv,{className:"flex-1 font-semibold text-gray-700",children:"Configuration"})]}),(0,n.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:Object.entries(null===(d=S.litellm_params)||void 0===d?void 0:d.pii_entities_config).map(e=>{let[l,a]=e;return(0,n.jsxs)("div",{className:"px-5 py-3 flex border-b hover:bg-gray-50 transition-colors",children:[(0,n.jsx)(lu.xv,{className:"flex-1 font-medium text-gray-900",children:l}),(0,n.jsx)(lu.xv,{className:"flex-1",children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 ".concat("MASK"===a?"text-blue-600":"text-red-600"),children:["MASK"===a?(0,n.jsx)(E.Z,{}):(0,n.jsx)(B.Z,{}),String(a)]})})]},l)})})]})]}),(null===(c=S.litellm_params)||void 0===c?void 0:c.guardrail)==="tool_permission"&&(0,n.jsx)(lu.Zb,{className:"mt-6",children:(0,n.jsx)(eU,{value:ee,disabled:!0})}),(0,n.jsx)(lg,{guardrailData:S,guardrailSettings:V,isEditing:!1,accessToken:w})]}),k&&(0,n.jsx)(lu.x4,{children:(0,n.jsxs)(lu.Zb,{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(lu.Dx,{children:"Guardrail Settings"}),ef&&(0,n.jsx)(L.Z,{title:"Guardrail is defined in the config file and cannot be edited.",children:(0,n.jsx)(eR.Z,{})}),!M&&!ef&&(0,n.jsx)(lu.zx,{onClick:()=>F(!0),children:"Edit Settings"})]}),M?(0,n.jsxs)(v.Z,{form:G,onFinish:em,initialValues:{guardrail_name:S.guardrail_name,...S.litellm_params,guardrail_info:S.guardrail_info?JSON.stringify(S.guardrail_info,null,2):"",...(null===(u=S.litellm_params)||void 0===u?void 0:u.optional_params)&&{optional_params:S.litellm_params.optional_params}},layout:"vertical",children:[(0,n.jsx)(v.Z.Item,{label:"Guardrail Name",name:"guardrail_name",rules:[{required:!0,message:"Please input a guardrail name"}],children:(0,n.jsx)(lu.oi,{})}),(0,n.jsx)(v.Z.Item,{label:"Default On",name:"default_on",children:(0,n.jsxs)(f.default,{children:[(0,n.jsx)(f.default.Option,{value:!0,children:"Yes"}),(0,n.jsx)(f.default.Option,{value:!1,children:"No"})]})}),(null===(m=S.litellm_params)||void 0===m?void 0:m.guardrail)==="presidio"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eK.Z,{orientation:"left",children:"PII Protection"}),(0,n.jsx)("div",{className:"mb-6",children:V&&(0,n.jsx)(q,{entities:V.supported_entities,actions:V.supported_actions,selectedEntities:K,selectedActions:R,onEntitySelect:e=>{D(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},onActionSelect:(e,l)=>{J(a=>({...a,[e]:l}))},entityCategories:V.pii_entity_categories})})]}),(0,n.jsx)(lg,{guardrailData:S,guardrailSettings:V,isEditing:!0,accessToken:w,onDataChange:en,onUnsavedChanges:$}),(0,n.jsx)(eK.Z,{orientation:"left",children:"Provider Settings"}),(null===(x=S.litellm_params)||void 0===x?void 0:x.guardrail)==="tool_permission"?(0,n.jsx)(eU,{value:ee,onChange:el}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(X,{selectedProvider:Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)})||null,accessToken:w,providerParams:P,value:S.litellm_params}),P&&(()=>{var e;let l=Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)});if(!l)return null;let a=P[null===(e=C[l])||void 0===e?void 0:e.toLowerCase()];return a&&a.optional_params?(0,n.jsx)(ea,{optionalParams:a.optional_params,parentFieldKey:"optional_params",values:S.litellm_params}):null})()]}),(0,n.jsx)(eK.Z,{orientation:"left",children:"Advanced Settings"}),(0,n.jsx)(v.Z.Item,{label:"Guardrail Information",name:"guardrail_info",children:(0,n.jsx)(eG.default.TextArea,{rows:5})}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,n.jsx)(T.ZP,{onClick:()=>{F(!1),$(!1),eu()},children:"Cancel"}),(0,n.jsx)(lu.zx,{children:"Save Changes"})]})]}):(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Guardrail ID"}),(0,n.jsx)("div",{className:"font-mono",children:S.guardrail_id})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Guardrail Name"}),(0,n.jsx)("div",{children:S.guardrail_name||"Unnamed Guardrail"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Provider"}),(0,n.jsx)("div",{children:eh})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Mode"}),(0,n.jsx)("div",{children:(null===(p=S.litellm_params)||void 0===p?void 0:p.mode)||"-"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Default On"}),(0,n.jsx)(lu.Ct,{color:(null===(g=S.litellm_params)||void 0===g?void 0:g.default_on)?"green":"gray",children:(null===(j=S.litellm_params)||void 0===j?void 0:j.default_on)?"Yes":"No"})]}),(null===(y=S.litellm_params)||void 0===y?void 0:y.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"PII Protection"}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsxs)(lu.Ct,{color:"blue",children:[Object.keys(S.litellm_params.pii_entities_config).length," PII entities configured"]})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Created At"}),(0,n.jsx)("div",{children:ex(S.created_at)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Last Updated"}),(0,n.jsx)("div",{children:ex(S.updated_at)})]}),(null===(_=S.litellm_params)||void 0===_?void 0:_.guardrail)==="tool_permission"&&(0,n.jsx)(eU,{value:ee,disabled:!0})]})]})})]})]})]})},lN=a(96761),lw=a(35631),lk=a(29436),lC=a(41169),lS=a(23639),lZ=a(77565),lP=a(70464),lA=a(83669),lO=a(5540);let{Text:lI}=g.default;var lL=function(e){let{results:l,errors:a}=e,[t,i]=(0,o.useState)(new Set),r=e=>{let l=new Set(t);l.has(e)?l.delete(e):l.add(e),i(l)},s=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.focus(),l.select();let a=document.execCommand("copy");if(document.body.removeChild(l),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}};return l||a?(0,n.jsxs)("div",{className:"space-y-3 pt-4 border-t border-gray-200",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Results"}),l&&l.map(e=>{let l=t.has(e.guardrailName);return(0,n.jsx)(lx.Z,{className:"bg-green-50 border-green-200",children:(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2 cursor-pointer flex-1",onClick:()=>r(e.guardrailName),children:[l?(0,n.jsx)(lZ.Z,{className:"text-gray-500 text-xs"}):(0,n.jsx)(lP.Z,{className:"text-gray-500 text-xs"}),(0,n.jsx)(lA.Z,{className:"text-green-600 text-lg"}),(0,n.jsx)("span",{className:"text-sm font-medium text-green-800",children:e.guardrailName})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,n.jsx)(lO.Z,{}),(0,n.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]}),!l&&(0,n.jsx)(d.Z,{size:"xs",variant:"secondary",icon:lS.Z,onClick:async()=>{await s(e.response_text)?et.Z.success("Result copied to clipboard"):et.Z.fromBackend("Failed to copy result")},children:"Copy"})]})]}),!l&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"bg-white border border-green-200 rounded p-3",children:[(0,n.jsx)("label",{className:"text-xs font-medium text-gray-600 mb-2 block",children:"Output Text"}),(0,n.jsx)("div",{className:"font-mono text-sm text-gray-900 whitespace-pre-wrap break-words",children:e.response_text})]}),(0,n.jsxs)("div",{className:"text-xs text-gray-600",children:[(0,n.jsx)("span",{className:"font-medium",children:"Characters:"})," ",e.response_text.length]})]})]})},e.guardrailName)}),a&&a.map(e=>{let l=t.has(e.guardrailName);return(0,n.jsx)(lx.Z,{className:"bg-red-50 border-red-200",children:(0,n.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,n.jsx)("div",{className:"cursor-pointer mt-0.5",onClick:()=>r(e.guardrailName),children:l?(0,n.jsx)(lZ.Z,{className:"text-gray-500 text-xs"}):(0,n.jsx)(lP.Z,{className:"text-gray-500 text-xs"})}),(0,n.jsx)("div",{className:"text-red-600 mt-0.5",children:(0,n.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,n.jsxs)("p",{className:"text-sm font-medium text-red-800 cursor-pointer",onClick:()=>r(e.guardrailName),children:[e.guardrailName," - Error"]}),(0,n.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,n.jsx)(lO.Z,{}),(0,n.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]})]}),!l&&(0,n.jsx)("p",{className:"text-sm text-red-700 mt-1",children:e.error.message})]})]})},e.guardrailName)})]}):null};let{TextArea:lT}=eG.default,{Text:lz}=g.default;var lE=function(e){let{guardrailNames:l,onSubmit:a,isLoading:t,results:i,errors:r,onClose:s}=e,[d,c]=(0,o.useState)(""),u=()=>{if(!d.trim()){et.Z.fromBackend("Please enter text to test");return}a(d)},m=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.focus(),l.select();let a=document.execCommand("copy");if(document.body.removeChild(l),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},x=async()=>{await m(d)?et.Z.success("Input copied to clipboard"):et.Z.fromBackend("Failed to copy input")};return(0,n.jsxs)("div",{className:"space-y-4 h-full flex flex-col",children:[(0,n.jsx)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:(0,n.jsx)("div",{className:"flex items-center space-x-3",children:(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Guardrails:"}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:l.map(e=>(0,n.jsx)("div",{className:"inline-flex items-center space-x-1 bg-blue-50 px-3 py-1 rounded-md border border-blue-200",children:(0,n.jsx)("span",{className:"font-mono text-blue-700 font-medium text-sm",children:e})},e))})]}),(0,n.jsxs)("p",{className:"text-sm text-gray-500",children:["Test ",l.length>1?"guardrails":"guardrail"," and compare results"]})]})})}),(0,n.jsxs)("div",{className:"flex-1 overflow-auto space-y-4",children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Input Text"}),(0,n.jsx)(L.Z,{title:"Press Enter to submit. Use Shift+Enter for new line.",children:(0,n.jsx)(eR.Z,{className:"text-gray-400 cursor-help"})})]}),d&&(0,n.jsx)(ed.z,{size:"xs",variant:"secondary",icon:lS.Z,onClick:x,children:"Copy Input"})]}),(0,n.jsx)(lT,{value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||(e.preventDefault(),u())},placeholder:"Enter text to test with guardrails...",rows:8,className:"font-mono text-sm"}),(0,n.jsxs)("div",{className:"flex justify-between items-center mt-1",children:[(0,n.jsxs)(lz,{className:"text-xs text-gray-500",children:["Press ",(0,n.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Enter"})," to submit • ",(0,n.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Shift+Enter"})," for new line"]}),(0,n.jsxs)(lz,{className:"text-xs text-gray-500",children:["Characters: ",d.length]})]})]}),(0,n.jsx)("div",{className:"pt-2",children:(0,n.jsx)(ed.z,{onClick:u,loading:t,disabled:!d.trim(),className:"w-full",children:t?"Testing ".concat(l.length," guardrail").concat(l.length>1?"s":"","..."):"Test ".concat(l.length," guardrail").concat(l.length>1?"s":"")})})]}),(0,n.jsx)(lL,{results:i,errors:r})]})]})},lB=e=>{let{guardrailsList:l,isLoading:a,accessToken:t,onClose:i}=e,[r,s]=(0,o.useState)(new Set),[d,c]=(0,o.useState)(""),[u,m]=(0,o.useState)([]),[x,p]=(0,o.useState)([]),[g,f]=(0,o.useState)(!1),j=l.filter(e=>{var l;return null===(l=e.guardrail_name)||void 0===l?void 0:l.toLowerCase().includes(d.toLowerCase())}),v=e=>{let l=new Set(r);l.has(e)?l.delete(e):l.add(e),s(l)},y=async e=>{if(0===r.size||!t)return;f(!0),m([]),p([]);let l=[],a=[];await Promise.all(Array.from(r).map(async i=>{let r=Date.now();try{let a=await (0,h.applyGuardrail)(t,i,e,null,null),s=Date.now()-r;l.push({guardrailName:i,response_text:a.response_text,latency:s})}catch(l){let e=Date.now()-r;console.error("Error testing guardrail ".concat(i,":"),l),a.push({guardrailName:i,error:l,latency:e})}})),m(l),p(a),f(!1),l.length>0&&et.Z.success("".concat(l.length," guardrail").concat(l.length>1?"s":""," applied successfully")),a.length>0&&et.Z.fromBackend("".concat(a.length," guardrail").concat(a.length>1?"s":""," failed"))};return(0,n.jsx)("div",{className:"w-full h-[calc(100vh-200px)]",children:(0,n.jsx)(lx.Z,{className:"h-full",children:(0,n.jsxs)("div",{className:"flex h-full",children:[(0,n.jsxs)("div",{className:"w-1/4 border-r border-gray-200 flex flex-col overflow-hidden",children:[(0,n.jsx)("div",{className:"p-4 border-b border-gray-200",children:(0,n.jsxs)("div",{className:"mb-3",children:[(0,n.jsx)(lN.Z,{className:"text-lg font-semibold mb-3",children:"Guardrails"}),(0,n.jsx)(eg.Z,{icon:lk.Z,placeholder:"Search guardrails...",value:d,onValueChange:c})]})}),(0,n.jsx)("div",{className:"flex-1 overflow-auto",children:a?(0,n.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,n.jsx)(H.Z,{})}):0===j.length?(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)(eD.Z,{description:d?"No guardrails match your search":"No guardrails available"})}):(0,n.jsx)(lw.Z,{dataSource:j,renderItem:e=>(0,n.jsx)(lw.Z.Item,{onClick:()=>{e.guardrail_name&&v(e.guardrail_name)},className:"cursor-pointer hover:bg-gray-50 transition-colors px-4 ".concat(r.has(e.guardrail_name||"")?"bg-blue-50 border-l-4 border-l-blue-500":"border-l-4 border-l-transparent"),children:(0,n.jsx)(lw.Z.Item.Meta,{avatar:(0,n.jsx)(z.Z,{checked:r.has(e.guardrail_name||""),onClick:l=>{l.stopPropagation(),e.guardrail_name&&v(e.guardrail_name)}}),title:(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(lC.Z,{className:"text-gray-400"}),(0,n.jsx)("span",{className:"font-medium text-gray-900",children:e.guardrail_name})]}),description:(0,n.jsxs)("div",{className:"text-xs space-y-1 mt-1",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-medium",children:"Type: "}),(0,n.jsx)("span",{className:"text-gray-600",children:e.litellm_params.guardrail})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-medium",children:"Mode: "}),(0,n.jsx)("span",{className:"text-gray-600",children:e.litellm_params.mode})]})]})})})})}),(0,n.jsx)("div",{className:"p-3 border-t border-gray-200 bg-gray-50",children:(0,n.jsxs)(lp.Z,{className:"text-xs text-gray-600",children:[r.size," of ",j.length," selected"]})})]}),(0,n.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,n.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,n.jsx)(lN.Z,{className:"text-xl font-semibold mb-0",children:"Guardrail Testing Playground"})}),(0,n.jsx)("div",{className:"flex-1 overflow-auto p-4",children:0===r.size?(0,n.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,n.jsx)(lC.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,n.jsx)(lp.Z,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select Guardrails to Test"}),(0,n.jsx)(lp.Z,{className:"text-center text-gray-500 max-w-md",children:"Choose one or more guardrails from the left sidebar to start testing and comparing results."})]}):(0,n.jsx)("div",{className:"h-full",children:(0,n.jsx)(lE,{guardrailNames:Array.from(r),onSubmit:y,results:u.length>0?u:null,errors:x.length>0?x:null,isLoading:g,onClose:()=>s(new Set)})})})]})]})})})},lM=a(21609),lF=e=>{let{accessToken:l,userRole:a}=e,[t,i]=(0,o.useState)([]),[r,s]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1),[y,_]=(0,o.useState)(null),[b,N]=(0,o.useState)(!1),[w,k]=(0,o.useState)(null),[C,S]=(0,o.useState)(0),Z=!!a&&(0,lc.tY)(a),P=async()=>{if(l){f(!0);try{let e=await (0,h.getGuardrailsList)(l);console.log("guardrails: ".concat(JSON.stringify(e))),i(e.guardrails)}catch(e){console.error("Error fetching guardrails:",e)}finally{f(!1)}}};(0,o.useEffect)(()=>{P()},[l]);let A=async()=>{if(y&&l){v(!0);try{await (0,h.deleteGuardrailCall)(l,y.guardrail_id),et.Z.success('Guardrail "'.concat(y.guardrail_name,'" deleted successfully')),await P()}catch(e){console.error("Error deleting guardrail:",e),et.Z.fromBackend("Failed to delete guardrail")}finally{v(!1),N(!1),_(null)}}},O=y&&y.litellm_params?I(y.litellm_params.guardrail).displayName:void 0;return(0,n.jsx)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:(0,n.jsxs)(u.Z,{index:C,onIndexChange:S,children:[(0,n.jsxs)(m.Z,{className:"mb-4",children:[(0,n.jsx)(c.Z,{children:"Guardrails"}),(0,n.jsx)(c.Z,{disabled:!l||0===t.length,children:"Test Playground"})]}),(0,n.jsxs)(p.Z,{children:[(0,n.jsxs)(x.Z,{children:[(0,n.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,n.jsx)(d.Z,{onClick:()=>{w&&k(null),s(!0)},disabled:!l,children:"+ Add New Guardrail"})}),w?(0,n.jsx)(lb,{guardrailId:w,onClose:()=>k(null),accessToken:l,isAdmin:Z}):(0,n.jsx)(ld,{guardrailsList:t,isLoading:g,onDeleteClick:(e,l)=>{_(t.find(l=>l.guardrail_id===e)||null),N(!0)},accessToken:l,onGuardrailUpdated:P,isAdmin:Z,onGuardrailClick:e=>k(e)}),(0,n.jsx)(eX,{visible:r,onClose:()=>{s(!1)},accessToken:l,onSuccess:()=>{P()}}),(0,n.jsx)(lM.Z,{isOpen:b,title:"Delete Guardrail",message:"Are you sure you want to delete guardrail: ".concat(null==y?void 0:y.guardrail_name,"? This action cannot be undone."),resourceInformationTitle:"Guardrail Information",resourceInformation:[{label:"Name",value:null==y?void 0:y.guardrail_name},{label:"ID",value:null==y?void 0:y.guardrail_id,code:!0},{label:"Provider",value:O},{label:"Mode",value:null==y?void 0:y.litellm_params.mode},{label:"Default On",value:(null==y?void 0:y.litellm_params.default_on)?"Yes":"No"}],onCancel:()=>{N(!1),_(null)},onOk:A,confirmLoading:j})]}),(0,n.jsx)(x.Z,{children:(0,n.jsx)(lB,{guardrailsList:t,isLoading:g,accessToken:l,onClose:()=>S(0)})})]})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/137-c6f74fedf576a11b.js b/litellm/proxy/_experimental/out/_next/static/chunks/137-c6f74fedf576a11b.js new file mode 100644 index 0000000000..fe98281d76 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/137-c6f74fedf576a11b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[137],{1309:function(e,l,a){a.d(l,{C:function(){return t.Z}});var t=a(41649)},10137:function(e,l,a){a.d(l,{Z:function(){return lF}});var t,i,r,s,n=a(57437),o=a(2265),d=a(78489),c=a(12485),u=a(18135),m=a(35242),x=a(29706),p=a(77991),h=a(19250),g=a(57840),f=a(37592),j=a(15690),v=a(10032),y=a(3810),_=a(22116),b=a(64504);(t=r||(r={})).PresidioPII="Presidio PII",t.Bedrock="Bedrock Guardrail",t.Lakera="Lakera";let N={},w=e=>{let l={};return l.PresidioPII="Presidio PII",l.Bedrock="Bedrock Guardrail",l.Lakera="Lakera",Object.entries(e).forEach(e=>{let[a,t]=e;t&&"object"==typeof t&&"ui_friendly_name"in t&&(l[a.split("_").map((e,l)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=t.ui_friendly_name)}),N=l,l},k=()=>Object.keys(N).length>0?N:r,C={PresidioPII:"presidio",Bedrock:"bedrock",Lakera:"lakera_v2",LitellmContentFilter:"litellm_content_filter",ToolPermission:"tool_permission"},S=e=>{Object.entries(e).forEach(e=>{let[l,a]=e;a&&"object"==typeof a&&"ui_friendly_name"in a&&(C[l.split("_").map((e,l)=>e.charAt(0).toUpperCase()+e.slice(1)).join("")]=l)})},Z=e=>!!e&&"Presidio PII"===k()[e],P=e=>!!e&&"LiteLLM Content Filter"===k()[e],A="../ui/assets/logos/",O={"Presidio PII":"".concat(A,"presidio.png"),"Bedrock Guardrail":"".concat(A,"bedrock.svg"),Lakera:"".concat(A,"lakeraai.jpeg"),"Azure Content Safety Prompt Shield":"".concat(A,"presidio.png"),"Azure Content Safety Text Moderation":"".concat(A,"presidio.png"),"Aporia AI":"".concat(A,"aporia.png"),"PANW Prisma AIRS":"".concat(A,"palo_alto_networks.jpeg"),"Noma Security":"".concat(A,"noma_security.png"),"Javelin Guardrails":"".concat(A,"javelin.png"),"Pillar Guardrail":"".concat(A,"pillar.jpeg"),"Google Cloud Model Armor":"".concat(A,"google.svg"),"Guardrails AI":"".concat(A,"guardrails_ai.jpeg"),"Lasso Guardrail":"".concat(A,"lasso.png"),"Pangea Guardrail":"".concat(A,"pangea.png"),"AIM Guardrail":"".concat(A,"aim_security.jpeg"),"OpenAI Moderation":"".concat(A,"openai_small.svg"),EnkryptAI:"".concat(A,"enkrypt_ai.avif"),"Prompt Security":"".concat(A,"prompt_security.png"),"LiteLLM Content Filter":"".concat(A,"litellm_logo.jpg")},I=e=>{if(!e)return{logo:"",displayName:"-"};let l=Object.keys(C).find(l=>C[l].toLowerCase()===e.toLowerCase());if(!l)return{logo:"",displayName:e};let a=k()[l];return{logo:O[a]||"",displayName:a||e}};var L=a(99981),T=a(5545),z=a(4156),E=a(97416),B=a(8881),M=a(10798),F=a(49638);let{Text:G}=g.default,{Option:K}=f.default,D=e=>e.replace(/_/g," "),R=e=>{switch(e){case"MASK":return(0,n.jsx)(E.Z,{style:{marginRight:4}});case"BLOCK":return(0,n.jsx)(B.Z,{style:{marginRight:4}});default:return null}},J=e=>{let{categories:l,selectedCategories:a,onChange:t}=e;return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex items-center mb-2",children:[(0,n.jsx)(M.Z,{className:"text-gray-500 mr-1"}),(0,n.jsx)(G,{className:"text-gray-500 font-medium",children:"Filter by category"})]}),(0,n.jsx)(f.default,{mode:"multiple",placeholder:"Select categories to filter by",style:{width:"100%"},onChange:t,value:a,allowClear:!0,showSearch:!0,optionFilterProp:"children",className:"mb-4",tagRender:e=>(0,n.jsx)(y.Z,{color:"blue",closable:e.closable,onClose:e.onClose,className:"mr-2 mb-2",children:e.label}),children:l.map(e=>(0,n.jsx)(K,{value:e.category,children:e.category},e.category))})]})},V=e=>{let{onSelectAll:l,onUnselectAll:a,hasSelectedEntities:t}=e;return(0,n.jsxs)("div",{className:"bg-gray-50 p-5 rounded-lg mb-6 border border-gray-200 shadow-sm",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(G,{strong:!0,className:"text-gray-700 text-base",children:"Quick Actions"}),(0,n.jsx)(L.Z,{title:"Apply action to all PII types at once",children:(0,n.jsx)("div",{className:"ml-2 text-gray-400 cursor-help text-xs",children:"ⓘ"})})]}),(0,n.jsx)(T.ZP,{color:"danger",variant:"outlined",onClick:a,disabled:!t,icon:(0,n.jsx)(F.Z,{}),children:"Unselect All"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,n.jsx)(T.ZP,{color:"primary",variant:"outlined",onClick:()=>l("MASK"),className:"h-10",block:!0,icon:(0,n.jsx)(E.Z,{}),children:"Select All & Mask"}),(0,n.jsx)(T.ZP,{color:"danger",variant:"outlined",onClick:()=>l("BLOCK"),className:"h-10 hover:bg-red-100",block:!0,icon:(0,n.jsx)(B.Z,{}),children:"Select All & Block"})]})]})},U=e=>{let{entities:l,selectedEntities:a,selectedActions:t,actions:i,onEntitySelect:r,onActionSelect:s,entityToCategoryMap:o}=e;return(0,n.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,n.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,n.jsx)(G,{strong:!0,className:"flex-1 text-gray-700",children:"PII Type"}),(0,n.jsx)(G,{strong:!0,className:"w-32 text-right text-gray-700",children:"Action"})]}),(0,n.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:0===l.length?(0,n.jsx)("div",{className:"py-10 text-center text-gray-500",children:"No PII types match your filter criteria"}):l.map(e=>(0,n.jsxs)("div",{className:"px-5 py-3 flex items-center justify-between hover:bg-gray-50 border-b ".concat(a.includes(e)?"bg-blue-50":""),children:[(0,n.jsxs)("div",{className:"flex items-center flex-1",children:[(0,n.jsx)(z.Z,{checked:a.includes(e),onChange:()=>r(e),className:"mr-3"}),(0,n.jsx)(G,{className:a.includes(e)?"font-medium text-gray-900":"text-gray-700",children:D(e)}),o.get(e)&&(0,n.jsx)(y.Z,{className:"ml-2 text-xs",color:"blue",children:o.get(e)})]}),(0,n.jsx)("div",{className:"w-32",children:(0,n.jsx)(f.default,{value:a.includes(e)&&t[e]||"MASK",onChange:l=>s(e,l),style:{width:120},disabled:!a.includes(e),className:"".concat(a.includes(e)?"":"opacity-50"),dropdownMatchSelectWidth:!1,children:i.map(e=>(0,n.jsx)(K,{value:e,children:(0,n.jsxs)("div",{className:"flex items-center",children:[R(e),e]})},e))})})]},e))})]})},{Title:W,Text:Y}=g.default;var q=e=>{let{entities:l,actions:a,selectedEntities:t,selectedActions:i,onEntitySelect:r,onActionSelect:s,entityCategories:d=[]}=e,[c,u]=(0,o.useState)([]),m=new Map;d.forEach(e=>{e.entities.forEach(l=>{m.set(l,e.category)})});let x=l.filter(e=>0===c.length||c.includes(m.get(e)||""));return(0,n.jsxs)("div",{className:"pii-configuration",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-5",children:[(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)(W,{level:4,className:"!m-0 font-semibold text-gray-800",children:"Configure PII Protection"})}),(0,n.jsxs)(Y,{className:"text-gray-500",children:[t.length," items selected"]})]}),(0,n.jsxs)("div",{className:"mb-6",children:[(0,n.jsx)(J,{categories:d,selectedCategories:c,onChange:u}),(0,n.jsx)(V,{onSelectAll:e=>{l.forEach(l=>{t.includes(l)||r(l),s(l,e)})},onUnselectAll:()=>{t.forEach(e=>{r(e)})},hasSelectedEntities:t.length>0})]}),(0,n.jsx)(U,{entities:x,selectedEntities:t,selectedActions:i,actions:a,onEntitySelect:r,onActionSelect:s,entityToCategoryMap:m})]})},H=a(10353),$=a(31283),Q=a(24199),X=e=>{var l;let{selectedProvider:a,accessToken:t,providerParams:i=null,value:r=null}=e,[s,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(i),[m,x]=(0,o.useState)(null);if((0,o.useEffect)(()=>{if(i){u(i);return}let e=async()=>{if(t){d(!0),x(null);try{let e=await (0,h.getGuardrailProviderSpecificParams)(t);console.log("Provider params API response:",e),u(e),w(e),S(e)}catch(e){console.error("Error fetching provider params:",e),x("Failed to load provider parameters")}finally{d(!1)}}};i||e()},[t,i]),!a)return null;if(s)return(0,n.jsx)(H.Z,{tip:"Loading provider parameters..."});if(m)return(0,n.jsx)("div",{className:"text-red-500",children:m});let p=null===(l=C[a])||void 0===l?void 0:l.toLowerCase(),g=c&&c[p];if(console.log("Provider key:",p),console.log("Provider fields:",g),!g||0===Object.keys(g).length)return(0,n.jsx)("div",{children:"No configuration fields available for this provider."});console.log("Value:",r);let j=new Set(["patterns","blocked_words","blocked_words_file","categories","severity_threshold","pattern_redaction_format","keyword_redaction_tag"]),y=P(a),_=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0;return Object.entries(e).map(e=>{let[t,i]=e,s=l?"".concat(l,".").concat(t):t,o=a?a[t]:null==r?void 0:r[t];return(console.log("Field value:",o),"ui_friendly_name"===t||"optional_params"===t&&"nested"===i.type&&i.fields||y&&j.has(t))?null:"nested"===i.type&&i.fields?(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"mb-2 font-medium",children:t}),(0,n.jsx)("div",{className:"ml-4 border-l-2 border-gray-200 pl-4",children:_(i.fields,s,o)})]},s):(0,n.jsx)(v.Z.Item,{name:s,label:t,tooltip:i.description,rules:i.required?[{required:!0,message:"".concat(t," is required")}]:void 0,children:"select"===i.type&&i.options?(0,n.jsx)(f.default,{placeholder:i.description,defaultValue:o||i.default_value,children:i.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"multiselect"===i.type&&i.options?(0,n.jsx)(f.default,{mode:"multiple",placeholder:i.description,defaultValue:o||i.default_value,children:i.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"bool"===i.type||"boolean"===i.type?(0,n.jsxs)(f.default,{placeholder:i.description,defaultValue:void 0!==o?String(o):i.default_value,children:[(0,n.jsx)(f.default.Option,{value:"true",children:"True"}),(0,n.jsx)(f.default.Option,{value:"false",children:"False"})]}):"number"===i.type?(0,n.jsx)(Q.Z,{step:1,width:400,placeholder:i.description,defaultValue:void 0!==o?Number(o):void 0}):t.includes("password")||t.includes("secret")||t.includes("key")?(0,n.jsx)($.o,{placeholder:i.description,type:"password",defaultValue:o||""}):(0,n.jsx)($.o,{placeholder:i.description,type:"text",defaultValue:o||""})},s)})};return(0,n.jsx)(n.Fragment,{children:_(g)})};let{Title:ee}=g.default,el=e=>{let{field:l,fieldKey:a,fullFieldKey:t,value:i}=e,[r,s]=o.useState([]),[d,c]=o.useState(l.dict_key_options||[]);o.useEffect(()=>{if(i&&"object"==typeof i){let e=Object.keys(i);s(e.map(e=>({key:e,id:"".concat(e,"_").concat(Date.now(),"_").concat(Math.random())}))),c((l.dict_key_options||[]).filter(l=>!e.includes(l)))}},[i,l.dict_key_options]);let u=e=>{e&&(s([...r,{key:e,id:"".concat(e,"_").concat(Date.now())}]),c(d.filter(l=>l!==e)))},m=(e,l)=>{s(r.filter(l=>l.id!==e)),c([...d,l].sort())};return(0,n.jsxs)("div",{className:"space-y-3",children:[r.map(e=>(0,n.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg",children:[(0,n.jsx)("div",{className:"w-24 font-medium text-sm",children:e.key}),(0,n.jsx)("div",{className:"flex-1",children:(0,n.jsx)(v.Z.Item,{name:Array.isArray(t)?[...t,e.key]:[t,e.key],style:{marginBottom:0},initialValue:i&&"object"==typeof i?i[e.key]:void 0,normalize:"number"===l.dict_value_type?e=>{if(null==e||""===e)return;let l=Number(e);return isNaN(l)?e:l}:void 0,children:"number"===l.dict_value_type?(0,n.jsx)(Q.Z,{step:1,width:200,placeholder:"Enter ".concat(e.key," value")}):"boolean"===l.dict_value_type?(0,n.jsxs)(f.default,{placeholder:"Select ".concat(e.key," value"),children:[(0,n.jsx)(f.default.Option,{value:!0,children:"True"}),(0,n.jsx)(f.default.Option,{value:!1,children:"False"})]}):(0,n.jsx)($.o,{placeholder:"Enter ".concat(e.key," value"),type:"text"})})}),(0,n.jsx)("button",{type:"button",className:"text-red-500 hover:text-red-700 text-sm",onClick:()=>m(e.id,e.key),children:"Remove"})]},e.id)),d.length>0&&(0,n.jsxs)("div",{className:"flex items-center space-x-3 mt-2",children:[(0,n.jsx)(f.default,{placeholder:"Select category to configure",style:{width:200},onSelect:e=>e&&u(e),value:void 0,children:d.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}),(0,n.jsx)("span",{className:"text-sm text-gray-500",children:"Select a category to add threshold configuration"})]})]})};var ea=e=>{let{optionalParams:l,parentFieldKey:a,values:t}=e,i=(e,l)=>{let i="".concat(a,".").concat(e),r=null==t?void 0:t[e];return(console.log("value",r),"dict"===l.type&&l.dict_key_options)?(0,n.jsxs)("div",{className:"mb-8 p-6 bg-gray-50 rounded-lg border border-gray-200",children:[(0,n.jsx)("div",{className:"mb-4 font-medium text-gray-900 text-base",children:e}),(0,n.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:l.description}),(0,n.jsx)(el,{field:l,fieldKey:e,fullFieldKey:[a,e],value:r})]},i):(0,n.jsx)("div",{className:"mb-8 p-6 bg-white rounded-lg border border-gray-200 shadow-sm",children:(0,n.jsx)(v.Z.Item,{name:[a,e],label:(0,n.jsxs)("div",{className:"mb-2",children:[(0,n.jsx)("div",{className:"font-medium text-gray-900 text-base",children:e}),(0,n.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:l.description})]}),rules:l.required?[{required:!0,message:"".concat(e," is required")}]:void 0,className:"mb-0",initialValue:void 0!==r?r:l.default_value,normalize:"number"===l.type?e=>{if(null==e||""===e)return;let l=Number(e);return isNaN(l)?e:l}:void 0,children:"select"===l.type&&l.options?(0,n.jsx)(f.default,{placeholder:l.description,children:l.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"multiselect"===l.type&&l.options?(0,n.jsx)(f.default,{mode:"multiple",placeholder:l.description,children:l.options.map(e=>(0,n.jsx)(f.default.Option,{value:e,children:e},e))}):"bool"===l.type||"boolean"===l.type?(0,n.jsxs)(f.default,{placeholder:l.description,children:[(0,n.jsx)(f.default.Option,{value:"true",children:"True"}),(0,n.jsx)(f.default.Option,{value:"false",children:"False"})]}):"number"===l.type?(0,n.jsx)(Q.Z,{step:1,width:400,placeholder:l.description}):e.includes("password")||e.includes("secret")||e.includes("key")?(0,n.jsx)($.o,{placeholder:l.description,type:"password"}):(0,n.jsx)($.o,{placeholder:l.description,type:"text"})})},i)};return l.fields&&0!==Object.keys(l.fields).length?(0,n.jsxs)("div",{className:"guardrail-optional-params",children:[(0,n.jsxs)("div",{className:"mb-8 pb-4 border-b border-gray-100",children:[(0,n.jsx)(ee,{level:3,className:"mb-2 font-semibold text-gray-900",children:"Optional Parameters"}),(0,n.jsx)("p",{className:"text-gray-600 text-sm",children:l.description||"Configure additional settings for this guardrail provider"})]}),(0,n.jsx)("div",{className:"space-y-8",children:Object.entries(l.fields).map(e=>{let[l,a]=e;return i(l,a)})})]}):null},et=a(9114),ei=a(5945),er=a(58760),es=a(65319),en=a(96473),eo=a(3632),ed=a(16312);let{Text:ec}=g.default,{Option:eu}=f.default;var em=e=>{let{visible:l,prebuiltPatterns:a,categories:t,selectedPatternName:i,patternAction:r,onPatternNameChange:s,onActionChange:o,onAdd:d,onCancel:c}=e;return(0,n.jsxs)(_.Z,{title:"Add prebuilt pattern",open:l,onCancel:c,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ec,{strong:!0,children:"Pattern type"}),(0,n.jsx)(f.default,{placeholder:"Choose pattern type",value:i,onChange:s,style:{width:"100%",marginTop:8},showSearch:!0,filterOption:(e,l)=>{let t=a.find(e=>e.name===(null==l?void 0:l.value));return!!t&&(t.display_name.toLowerCase().includes(e.toLowerCase())||t.name.toLowerCase().includes(e.toLowerCase()))},children:t.map(e=>{let l=a.filter(l=>l.category===e);return 0===l.length?null:(0,n.jsx)(f.default.OptGroup,{label:e,children:l.map(e=>(0,n.jsx)(eu,{value:e.name,children:e.display_name},e.name))},e)})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ec,{strong:!0,children:"Action"}),(0,n.jsx)(ec,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,n.jsxs)(f.default,{value:r,onChange:o,style:{width:"100%"},children:[(0,n.jsx)(eu,{value:"BLOCK",children:"Block"}),(0,n.jsx)(eu,{value:"MASK",children:"Mask"})]})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(ed.z,{variant:"secondary",onClick:c,children:"Cancel"}),(0,n.jsx)(ed.z,{onClick:d,children:"Add"})]})]})};let{Text:ex}=g.default,{Option:ep}=f.default;var eh=e=>{let{visible:l,patternName:a,patternRegex:t,patternAction:i,onNameChange:r,onRegexChange:s,onActionChange:o,onAdd:d,onCancel:c}=e;return(0,n.jsxs)(_.Z,{title:"Add custom regex pattern",open:l,onCancel:c,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Pattern name"}),(0,n.jsx)(b.o,{placeholder:"e.g., internal_id, employee_code",value:a,onValueChange:r,style:{marginTop:8}})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Regex pattern"}),(0,n.jsx)(b.o,{placeholder:"e.g., ID-[0-9]{6}",value:t,onValueChange:s,style:{marginTop:8}}),(0,n.jsx)(ex,{type:"secondary",style:{fontSize:12},children:"Enter a valid regular expression to match sensitive data"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ex,{strong:!0,children:"Action"}),(0,n.jsx)(ex,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this pattern is detected"}),(0,n.jsxs)(f.default,{value:i,onChange:o,style:{width:"100%"},children:[(0,n.jsx)(ep,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ep,{value:"MASK",children:"Mask"})]})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(b.z,{variant:"secondary",onClick:c,children:"Cancel"}),(0,n.jsx)(b.z,{onClick:d,children:"Add"})]})]})},eg=a(49566),ef=a(16853);let{Text:ej}=g.default,{Option:ev}=f.default;var ey=e=>{let{visible:l,keyword:a,action:t,description:i,onKeywordChange:r,onActionChange:s,onDescriptionChange:o,onAdd:c,onCancel:u}=e;return(0,n.jsxs)(_.Z,{title:"Add blocked keyword",open:l,onCancel:u,footer:null,width:800,children:[(0,n.jsxs)(er.Z,{direction:"vertical",style:{width:"100%"},size:"large",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Keyword"}),(0,n.jsx)(eg.Z,{placeholder:"Enter sensitive keyword or phrase",value:a,onValueChange:r,style:{marginTop:8}})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Action"}),(0,n.jsx)(ej,{type:"secondary",style:{display:"block",marginTop:4,marginBottom:8},children:"Choose what action the guardrail should take when this keyword is detected"}),(0,n.jsxs)(f.default,{value:t,onChange:s,style:{width:"100%"},children:[(0,n.jsx)(ev,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ev,{value:"MASK",children:"Mask"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(ej,{strong:!0,children:"Description (optional)"}),(0,n.jsx)(ef.Z,{placeholder:"Explain why this keyword is sensitive",value:i,onValueChange:o,rows:3,style:{marginTop:8}})]})]}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"24px"},children:[(0,n.jsx)(d.Z,{variant:"secondary",onClick:u,children:"Cancel"}),(0,n.jsx)(d.Z,{onClick:c,children:"Add"})]})]})},e_=a(56609),eb=a(26349);let{Text:eN}=g.default,{Option:ew}=f.default;var ek=e=>{let{patterns:l,onActionChange:a,onRemove:t}=e,i=[{title:"Type",dataIndex:"type",key:"type",width:100,render:e=>(0,n.jsx)(y.Z,{color:"prebuilt"===e?"blue":"green",children:"prebuilt"===e?"Prebuilt":"Custom"})},{title:"Pattern name",dataIndex:"name",key:"name",render:(e,l)=>l.display_name||l.name},{title:"Regex pattern",dataIndex:"pattern",key:"pattern",render:e=>e?(0,n.jsxs)(eN,{code:!0,style:{fontSize:12},children:[e.substring(0,40),"..."]}):"-"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>a(l.id,e),style:{width:120},size:"small",children:[(0,n.jsx)(ew,{value:"BLOCK",children:"Block"}),(0,n.jsx)(ew,{value:"MASK",children:"Mask"})]})},{title:"",key:"actions",width:100,render:(e,l)=>(0,n.jsx)(ed.z,{type:"button",variant:"light",color:"red",size:"xs",icon:eb.Z,onClick:()=>t(l.id),children:"Delete"})}];return 0===l.length?(0,n.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No patterns added."}):(0,n.jsx)(e_.Z,{dataSource:l,columns:i,rowKey:"id",pagination:!1,size:"small"})};let{Text:eC}=g.default,{Option:eS}=f.default;var eZ=e=>{let{keywords:l,onActionChange:a,onRemove:t}=e,i=[{title:"Keyword",dataIndex:"keyword",key:"keyword"},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>a(l.id,"action",e),style:{width:120},size:"small",children:[(0,n.jsx)(eS,{value:"BLOCK",children:"Block"}),(0,n.jsx)(eS,{value:"MASK",children:"Mask"})]})},{title:"Description",dataIndex:"description",key:"description",render:e=>e||"-"},{title:"",key:"actions",width:100,render:(e,l)=>(0,n.jsx)(ed.z,{type:"button",variant:"light",color:"red",size:"xs",icon:eb.Z,onClick:()=>t(l.id),children:"Delete"})}];return 0===l.length?(0,n.jsx)("div",{style:{textAlign:"center",padding:"40px 0",color:"#999"},children:"No keywords added."}):(0,n.jsx)(e_.Z,{dataSource:l,columns:i,rowKey:"id",pagination:!1,size:"small"})},eP=a(44851),eA=a(38434);let{Title:eO,Text:eI}=g.default,{Option:eL}=f.default,{Panel:eT}=eP.default;var ez=e=>{var l;let{availableCategories:a,selectedCategories:t,onCategoryAdd:i,onCategoryRemove:r,onCategoryUpdate:s,accessToken:d}=e,[c,u]=o.useState(""),[m,x]=o.useState({}),[p,g]=o.useState({}),[j,v]=o.useState([]),[_,b]=o.useState(""),[N,w]=o.useState(!1),k=async e=>{if(d&&!m[e]){g(l=>({...l,[e]:!0}));try{let l=await (0,h.getCategoryYaml)(d,e);x(a=>({...a,[e]:l.yaml_content}))}catch(l){console.error("Failed to fetch YAML for category ".concat(e,":"),l)}finally{g(l=>({...l,[e]:!1}))}}};o.useEffect(()=>{if(c&&d){let e=m[c];if(e){b(e);return}w(!0),console.log("Fetching YAML for category: ".concat(c),{accessToken:d?"present":"missing"}),(0,h.getCategoryYaml)(d,c).then(e=>{console.log("Successfully fetched YAML for ".concat(c,":"),e),b(e.yaml_content),x(l=>({...l,[c]:e.yaml_content}))}).catch(e=>{console.error("Failed to fetch preview YAML for category ".concat(c,":"),e),b("")}).finally(()=>{w(!1)})}else b(""),w(!1)},[c,d]);let C=[{title:"Category",dataIndex:"display_name",key:"display_name",render:(e,l)=>{let t=a.find(e=>e.name===l.category);return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:{fontWeight:500},children:e}),(null==t?void 0:t.description)&&(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888",marginTop:"4px"},children:t.description})]})}},{title:"Action",dataIndex:"action",key:"action",width:150,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>s(l.id,"action",e),style:{width:"100%"},children:[(0,n.jsx)(eL,{value:"BLOCK",children:(0,n.jsx)(y.Z,{color:"red",children:"BLOCK"})}),(0,n.jsx)(eL,{value:"MASK",children:(0,n.jsx)(y.Z,{color:"orange",children:"MASK"})})]})},{title:"Severity Threshold",dataIndex:"severity_threshold",key:"severity_threshold",width:180,render:(e,l)=>(0,n.jsxs)(f.default,{value:e,onChange:e=>s(l.id,"severity_threshold",e),style:{width:"100%"},children:[(0,n.jsx)(eL,{value:"low",children:"Low"}),(0,n.jsx)(eL,{value:"medium",children:"Medium"}),(0,n.jsx)(eL,{value:"high",children:"High"})]})},{title:"",key:"actions",width:80,render:(e,l)=>(0,n.jsx)(ed.z,{icon:eb.Z,onClick:()=>r(l.id),variant:"secondary",size:"xs",children:"Remove"})}],S=a.filter(e=>!t.some(l=>l.category===e.name));return(0,n.jsxs)(ei.Z,{title:(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(eO,{level:5,style:{margin:0},children:"Content Categories"}),(0,n.jsx)(eI,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Detect harmful content, bias, and inappropriate advice using semantic analysis"})]}),size:"small",children:[(0,n.jsxs)("div",{style:{marginBottom:16,display:"flex",gap:8},children:[(0,n.jsx)(f.default,{placeholder:"Select a content category",value:c||void 0,onChange:u,style:{flex:1},showSearch:!0,optionLabelProp:"label",filterOption:(e,l)=>{var a,t;return(null!==(t=null==l?void 0:null===(a=l.label)||void 0===a?void 0:a.toString().toLowerCase())&&void 0!==t?t:"").includes(e.toLowerCase())},children:S.map(e=>(0,n.jsx)(eL,{value:e.name,label:e.display_name,children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:{fontWeight:500},children:e.display_name}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#666",marginTop:"2px"},children:e.description})]})},e.name))}),(0,n.jsx)(ed.z,{onClick:()=>{if(!c)return;let e=a.find(e=>e.name===c);!e||t.some(e=>e.category===c)||(i({id:"category-".concat(Date.now()),category:e.name,display_name:e.display_name,action:e.default_action,severity_threshold:"medium"}),u(""),b(""))},disabled:!c,icon:en.Z,children:"Add"})]}),c&&(0,n.jsxs)("div",{style:{marginBottom:16,padding:"12px",background:"#f9f9f9",border:"1px solid #e0e0e0",borderRadius:"4px"},children:[(0,n.jsxs)("div",{style:{marginBottom:8,fontWeight:500,fontSize:"14px"},children:["Preview: ",null===(l=a.find(e=>e.name===c))||void 0===l?void 0:l.display_name]}),N?(0,n.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"Loading YAML..."}):_?(0,n.jsx)("pre",{style:{background:"#fff",padding:"12px",borderRadius:"4px",overflow:"auto",maxHeight:"300px",fontSize:"12px",lineHeight:"1.5",margin:0,border:"1px solid #e0e0e0"},children:(0,n.jsx)("code",{children:_})}):(0,n.jsx)("div",{style:{padding:"8px",textAlign:"center",color:"#888",fontSize:"12px"},children:"Unable to load YAML content"})]}),t.length>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e_.Z,{dataSource:t,columns:C,pagination:!1,size:"small",rowKey:"id"}),(0,n.jsx)("div",{style:{marginTop:16},children:(0,n.jsx)(eP.default,{activeKey:j,onChange:e=>{let l=Array.isArray(e)?e:e?[e]:[],a=new Set(j);l.forEach(e=>{a.has(e)||m[e]||k(e)}),v(l)},ghost:!0,children:t.map(e=>(0,n.jsx)(eT,{header:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,n.jsx)(eA.Z,{}),(0,n.jsxs)("span",{children:["View YAML for ",e.display_name]})]}),children:p[e.category]?(0,n.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"Loading YAML..."}):m[e.category]?(0,n.jsx)("pre",{style:{background:"#f5f5f5",padding:"16px",borderRadius:"4px",overflow:"auto",maxHeight:"400px",fontSize:"12px",lineHeight:"1.5",margin:0},children:(0,n.jsx)("code",{children:m[e.category]})}):(0,n.jsx)("div",{style:{padding:"16px",textAlign:"center",color:"#888"},children:"YAML will load when expanded"})},e.category))})})]}):(0,n.jsx)("div",{style:{textAlign:"center",padding:"24px",color:"#888",border:"1px dashed #d9d9d9",borderRadius:"4px"},children:"No content categories selected. Add categories to detect harmful content, bias, or inappropriate advice."})]})};let{Title:eE,Text:eB}=g.default;var eM=e=>{let{prebuiltPatterns:l,categories:a,selectedPatterns:t,blockedWords:i,onPatternAdd:r,onPatternRemove:s,onPatternActionChange:d,onBlockedWordAdd:c,onBlockedWordRemove:u,onBlockedWordUpdate:m,onFileUpload:x,accessToken:p,showStep:g,contentCategories:f=[],selectedContentCategories:j=[],onContentCategoryAdd:v,onContentCategoryRemove:y,onContentCategoryUpdate:_}=e,[b,N]=(0,o.useState)(!1),[w,k]=(0,o.useState)(!1),[C,S]=(0,o.useState)(!1),[Z,P]=(0,o.useState)(""),[A,O]=(0,o.useState)("BLOCK"),[I,L]=(0,o.useState)(""),[T,z]=(0,o.useState)(""),[E,B]=(0,o.useState)("BLOCK"),[M,F]=(0,o.useState)(""),[G,K]=(0,o.useState)("BLOCK"),[D,R]=(0,o.useState)(""),[J,V]=(0,o.useState)(!1),U=async e=>{V(!0);try{let l=await e.text();if(p){let e=await (0,h.validateBlockedWordsFile)(p,l);if(e.valid)x&&x(l),et.Z.success(e.message||"File uploaded successfully");else{let l=e.error||e.errors&&e.errors.join(", ")||"Invalid file";et.Z.error("Validation failed: ".concat(l))}}}catch(e){et.Z.error("Failed to upload file: ".concat(e))}finally{V(!1)}return!1};return(0,n.jsxs)("div",{className:"space-y-6",children:[!g&&(0,n.jsx)("div",{children:(0,n.jsx)(eB,{type:"secondary",children:"Configure patterns, keywords, and content categories to detect and filter sensitive information in requests and responses."})}),(!g||"patterns"===g)&&(0,n.jsxs)(ei.Z,{title:(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(eE,{level:5,style:{margin:0},children:"Pattern Detection"}),(0,n.jsx)(eB,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Detect sensitive information using regex patterns (SSN, credit cards, API keys, etc.)"})]}),size:"small",children:[(0,n.jsx)("div",{style:{marginBottom:16},children:(0,n.jsxs)(er.Z,{children:[(0,n.jsx)(ed.z,{type:"button",onClick:()=>N(!0),icon:en.Z,children:"Add prebuilt pattern"}),(0,n.jsx)(ed.z,{type:"button",onClick:()=>S(!0),variant:"secondary",icon:en.Z,children:"Add custom regex"})]})}),(0,n.jsx)(ek,{patterns:t,onActionChange:d,onRemove:s})]}),(!g||"keywords"===g)&&(0,n.jsxs)(ei.Z,{title:(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,n.jsx)(eE,{level:5,style:{margin:0},children:"Blocked Keywords"}),(0,n.jsx)(eB,{type:"secondary",style:{fontSize:14,fontWeight:400},children:"Block or mask specific sensitive terms and phrases"})]}),size:"small",children:[(0,n.jsx)("div",{style:{marginBottom:16},children:(0,n.jsxs)(er.Z,{children:[(0,n.jsx)(ed.z,{type:"button",onClick:()=>k(!0),icon:en.Z,children:"Add keyword"}),(0,n.jsx)(es.default,{beforeUpload:U,accept:".yaml,.yml",showUploadList:!1,children:(0,n.jsx)(ed.z,{type:"button",variant:"secondary",icon:eo.Z,loading:J,children:"Upload YAML file"})})]})}),(0,n.jsx)(eZ,{keywords:i,onActionChange:m,onRemove:u})]}),(!g||"categories"===g)&&f.length>0&&v&&y&&_&&(0,n.jsx)(ez,{availableCategories:f,selectedCategories:j,onCategoryAdd:v,onCategoryRemove:y,onCategoryUpdate:_,accessToken:p}),(0,n.jsx)(em,{visible:b,prebuiltPatterns:l,categories:a,selectedPatternName:Z,patternAction:A,onPatternNameChange:P,onActionChange:e=>O(e),onAdd:()=>{if(!Z){et.Z.error("Please select a pattern");return}let e=l.find(e=>e.name===Z);r({id:"pattern-".concat(Date.now()),type:"prebuilt",name:Z,display_name:null==e?void 0:e.display_name,action:A}),N(!1),P(""),O("BLOCK")},onCancel:()=>{N(!1),P(""),O("BLOCK")}}),(0,n.jsx)(eh,{visible:C,patternName:I,patternRegex:T,patternAction:E,onNameChange:L,onRegexChange:z,onActionChange:e=>B(e),onAdd:()=>{if(!I||!T){et.Z.error("Please provide pattern name and regex");return}r({id:"custom-".concat(Date.now()),type:"custom",name:I,pattern:T,action:E}),S(!1),L(""),z(""),B("BLOCK")},onCancel:()=>{S(!1),L(""),z(""),B("BLOCK")}}),(0,n.jsx)(ey,{visible:w,keyword:M,action:G,description:D,onKeywordChange:F,onActionChange:e=>K(e),onDescriptionChange:R,onAdd:()=>{if(!M){et.Z.error("Please enter a keyword");return}c({id:"word-".concat(Date.now()),keyword:M,action:G,description:D||void 0}),k(!1),F(""),R(""),K("BLOCK")},onCancel:()=>{k(!1),F(""),R(""),K("BLOCK")}})]})},eF=a(78801),eG=a(4260),eK=a(23496),eD=a(85180),eR=a(15424);let eJ={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},eV=e=>({...eJ,...e||{},rules:(null==e?void 0:e.rules)?[...e.rules]:[]});var eU=e=>{let{value:l,onChange:a,disabled:t=!1}=e,i=eV(l),r=e=>{let l={...i,...e};null==a||a(l)},s=(e,l)=>{r({rules:i.rules.map((a,t)=>t===e?{...a,...l}:a)})},o=e=>{r({rules:i.rules.filter((l,a)=>a!==e)})},d=(e,l)=>{let a=i.rules[e];if(!a)return;let t=Object.entries(a.allowed_param_patterns||{});l(t);let r={};t.forEach(e=>{let[l,a]=e;r[l]=a}),s(e,{allowed_param_patterns:Object.keys(r).length>0?r:void 0})},c=(e,l,a)=>{d(e,e=>{if(!e[l])return;let[,t]=e[l];e[l]=[a,t]})},u=(e,l,a)=>{d(e,e=>{if(!e[l])return;let[t]=e[l];e[l]=[t,a]})},m=(e,l)=>{let a=Object.entries(e.allowed_param_patterns||{});return 0===a.length?(0,n.jsx)(T.ZP,{disabled:t,size:"small",onClick:()=>s(l,{allowed_param_patterns:{"":""}}),children:"+ Restrict tool arguments (optional)"}):(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsx)(eF.x,{className:"text-sm text-gray-600",children:"Argument constraints (dot or array paths)"}),a.map((a,i)=>{let[r,s]=a;return(0,n.jsxs)(er.Z,{align:"start",children:[(0,n.jsx)(eG.default,{disabled:t,placeholder:"messages[0].content",value:r,onChange:e=>c(l,i,e.target.value)}),(0,n.jsx)(eG.default,{disabled:t,placeholder:"^email@.*$",value:s,onChange:e=>u(l,i,e.target.value)}),(0,n.jsx)(T.ZP,{disabled:t,icon:(0,n.jsx)(eb.Z,{}),danger:!0,onClick:()=>d(l,e=>{e.splice(i,1)})})]},"".concat(e.id||l,"-").concat(i))}),(0,n.jsx)(T.ZP,{disabled:t,size:"small",onClick:()=>s(l,{allowed_param_patterns:{...e.allowed_param_patterns||{},"":""}}),children:"+ Add another constraint"})]})};return(0,n.jsxs)(eF.Z,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eF.x,{className:"text-lg font-semibold",children:"LiteLLM Tool Permission Guardrail"}),(0,n.jsx)(eF.x,{className:"text-sm text-gray-500",children:"Provide regex patterns (e.g., ^mcp__github_.*$) for tool names or types and optionally constrain payload fields."})]}),!t&&(0,n.jsx)(T.ZP,{icon:(0,n.jsx)(en.Z,{}),type:"primary",onClick:()=>{r({rules:[...i.rules,{id:"rule_".concat(Math.random().toString(36).slice(2,8)),decision:"allow",allowed_param_patterns:void 0}]})},className:"!bg-blue-600 !text-white hover:!bg-blue-500",children:"Add Rule"})]}),(0,n.jsx)(eK.Z,{}),0===i.rules.length?(0,n.jsx)(eD.Z,{description:"No tool rules added yet"}):(0,n.jsx)("div",{className:"space-y-4",children:i.rules.map((e,l)=>{var a,i;return(0,n.jsxs)(eF.Z,{className:"bg-gray-50",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,n.jsxs)(eF.x,{className:"font-semibold",children:["Rule ",l+1]}),(0,n.jsx)(T.ZP,{icon:(0,n.jsx)(eb.Z,{}),danger:!0,type:"text",disabled:t,onClick:()=>o(l),children:"Remove"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Rule ID"}),(0,n.jsx)(eG.default,{disabled:t,placeholder:"unique_rule_id",value:e.id,onChange:e=>s(l,{id:e.target.value})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Tool Name (optional)"}),(0,n.jsx)(eG.default,{disabled:t,placeholder:"^mcp__github_.*$",value:null!==(a=e.tool_name)&&void 0!==a?a:"",onChange:e=>s(l,{tool_name:""===e.target.value.trim()?void 0:e.target.value})})]})]}),(0,n.jsx)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 mt-4",children:(0,n.jsxs)("div",{children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Tool Type (optional)"}),(0,n.jsx)(eG.default,{disabled:t,placeholder:"^function$",value:null!==(i=e.tool_type)&&void 0!==i?i:"",onChange:e=>s(l,{tool_type:""===e.target.value.trim()?void 0:e.target.value})})]})}),(0,n.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Decision"}),(0,n.jsxs)(f.default,{disabled:t,value:e.decision,style:{width:200},onChange:e=>s(l,{decision:e}),children:[(0,n.jsx)(f.default.Option,{value:"allow",children:"Allow"}),(0,n.jsx)(f.default.Option,{value:"deny",children:"Deny"})]})]}),(0,n.jsx)("div",{className:"mt-4",children:m(e,l)})]},e.id||l)})}),(0,n.jsx)(eK.Z,{}),(0,n.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Default action"}),(0,n.jsxs)(f.default,{disabled:t,value:i.default_action,onChange:e=>r({default_action:e}),children:[(0,n.jsx)(f.default.Option,{value:"allow",children:"Allow"}),(0,n.jsx)(f.default.Option,{value:"deny",children:"Deny"})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)(eF.x,{className:"text-sm font-medium flex items-center gap-1",children:["On disallowed action",(0,n.jsx)(L.Z,{title:"Block returns an error when a forbidden tool is invoked. Rewrite strips the tool call but lets the rest of the response continue.",children:(0,n.jsx)(eR.Z,{})})]}),(0,n.jsxs)(f.default,{disabled:t,value:i.on_disallowed_action,onChange:e=>r({on_disallowed_action:e}),children:[(0,n.jsx)(f.default.Option,{value:"block",children:"Block"}),(0,n.jsx)(f.default.Option,{value:"rewrite",children:"Rewrite"})]})]})]}),(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsx)(eF.x,{className:"text-sm font-medium",children:"Violation message (optional)"}),(0,n.jsx)(eG.default.TextArea,{disabled:t,rows:3,placeholder:"This violates our org policy...",value:i.violation_message_template,onChange:e=>r({violation_message_template:e.target.value})})]})]})};let{Title:eW,Text:eY,Link:eq}=g.default,{Option:eH}=f.default,{Step:e$}=j.default,eQ={pre_call:"Before LLM Call - Runs before the LLM call and checks the input (Recommended)",during_call:"During LLM Call - Runs in parallel with the LLM call, with response held until check completes",post_call:"After LLM Call - Runs after the LLM call and checks only the output",logging_only:"Logging Only - Only runs on logging callbacks without affecting the LLM call",pre_mcp_call:"Before MCP Tool Call - Runs before MCP tool execution and validates tool calls",during_mcp_call:"During MCP Tool Call - Runs in parallel with MCP tool execution for monitoring"};var eX=e=>{let{visible:l,onClose:a,accessToken:t,onSuccess:i}=e,[r]=v.Z.useForm(),[s,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(null),[m,x]=(0,o.useState)(null),[p,g]=(0,o.useState)([]),[N,A]=(0,o.useState)({}),[I,L]=(0,o.useState)(0),[T,z]=(0,o.useState)(null),[E,B]=(0,o.useState)([]),[M,F]=(0,o.useState)(2),[G,K]=(0,o.useState)({}),[D,R]=(0,o.useState)([]),[J,V]=(0,o.useState)([]),[U,W]=(0,o.useState)([]),[Y,H]=(0,o.useState)({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),$=(0,o.useMemo)(()=>!!c&&"tool_permission"===(C[c]||"").toLowerCase(),[c]);(0,o.useEffect)(()=>{t&&(async()=>{try{let[e,l]=await Promise.all([(0,h.getGuardrailUISettings)(t),(0,h.getGuardrailProviderSpecificParams)(t)]);x(e),z(l),w(l),S(l)}catch(e){console.error("Error fetching guardrail data:",e),et.Z.fromBackend("Failed to load guardrail configuration")}})()},[t]);let Q=e=>{u(e),r.setFieldsValue({config:void 0,presidio_analyzer_api_base:void 0,presidio_anonymizer_api_base:void 0}),g([]),A({}),B([]),F(2),K({}),H({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""})},ee=e=>{g(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},el=(e,l)=>{A(a=>({...a,[e]:l}))},ei=async()=>{try{if(0===I&&(await r.validateFields(["guardrail_name","provider","mode","default_on"]),c)){let e=["guardrail_name","provider","mode","default_on"];"PresidioPII"===c&&e.push("presidio_analyzer_api_base","presidio_anonymizer_api_base"),await r.validateFields(e)}if(1===I&&Z(c)&&0===p.length){et.Z.fromBackend("Please select at least one PII entity to continue");return}L(I+1)}catch(e){console.error("Form validation failed:",e)}},er=()=>{L(I-1)},es=()=>{r.resetFields(),u(null),g([]),A({}),B([]),F(2),K({}),R([]),V([]),W([]),H({rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""}),L(0)},en=()=>{es(),a()},eo=async()=>{try{d(!0),await r.validateFields();let l=r.getFieldsValue(!0),s=C[l.provider],n={guardrail_name:l.guardrail_name,litellm_params:{guardrail:s,mode:l.mode,default_on:l.default_on},guardrail_info:{}};if("PresidioPII"===l.provider&&p.length>0){let e={};p.forEach(l=>{e[l]=N[l]||"MASK"}),n.litellm_params.pii_entities_config=e,l.presidio_analyzer_api_base&&(n.litellm_params.presidio_analyzer_api_base=l.presidio_analyzer_api_base),l.presidio_anonymizer_api_base&&(n.litellm_params.presidio_anonymizer_api_base=l.presidio_anonymizer_api_base)}if(P(l.provider))D.length>0&&(n.litellm_params.patterns=D.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action}))),J.length>0&&(n.litellm_params.blocked_words=J.map(e=>({keyword:e.keyword,action:e.action,description:e.description}))),U.length>0&&(n.litellm_params.categories=U.map(e=>({category:e.category,enabled:!0,action:e.action,severity_threshold:e.severity_threshold||"medium"})));else if(l.config)try{let e=JSON.parse(l.config);n.guardrail_info=e}catch(e){et.Z.fromBackend("Invalid JSON in configuration"),d(!1);return}if("tool_permission"===s){if(0===Y.rules.length){et.Z.fromBackend("Add at least one tool permission rule"),d(!1);return}n.litellm_params.rules=Y.rules,n.litellm_params.default_action=Y.default_action,n.litellm_params.on_disallowed_action=Y.on_disallowed_action,Y.violation_message_template&&(n.litellm_params.violation_message_template=Y.violation_message_template)}if(console.log("values: ",JSON.stringify(l)),T&&c){var e;let a=null===(e=C[c])||void 0===e?void 0:e.toLowerCase();console.log("providerKey: ",a);let t=T[a]||{},i=new Set;console.log("providerSpecificParams: ",JSON.stringify(t)),Object.keys(t).forEach(e=>{"optional_params"!==e&&i.add(e)}),t.optional_params&&t.optional_params.fields&&Object.keys(t.optional_params.fields).forEach(e=>{i.add(e)}),console.log("allowedParams: ",i),i.forEach(e=>{let a=l[e];if(null==a||""===a){var t;a=null===(t=l.optional_params)||void 0===t?void 0:t[e]}null!=a&&""!==a&&(n.litellm_params[e]=a)})}if(!t)throw Error("No access token available");console.log("Sending guardrail data:",JSON.stringify(n)),await (0,h.createGuardrailCall)(t,n),et.Z.success("Guardrail created successfully"),es(),i(),a()}catch(e){console.error("Failed to create guardrail:",e),et.Z.fromBackend("Failed to create guardrail: "+(e instanceof Error?e.message:String(e)))}finally{d(!1)}},ed=()=>{var e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(v.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,n.jsx)(b.o,{placeholder:"Enter a name for this guardrail"})}),(0,n.jsx)(v.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,n.jsx)(f.default,{placeholder:"Select a guardrail provider",onChange:Q,labelInValue:!1,optionLabelProp:"label",dropdownRender:e=>e,showSearch:!0,children:Object.entries(k()).map(e=>{let[l,a]=e;return(0,n.jsx)(eH,{value:l,label:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[O[a]&&(0,n.jsx)("img",{src:O[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]}),children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[O[a]&&(0,n.jsx)("img",{src:O[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]})},l)})})}),(0,n.jsx)(v.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,n.jsx)(f.default,{optionLabelProp:"label",mode:"multiple",children:(null==m?void 0:null===(e=m.supported_modes)||void 0===e?void 0:e.map(e=>(0,n.jsx)(eH,{value:e,label:e,children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:e}),"pre_call"===e&&(0,n.jsx)(y.Z,{color:"green",style:{marginLeft:"8px"},children:"Recommended"})]}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eQ[e]})]})},e)))||(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eH,{value:"pre_call",label:"pre_call",children:(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("strong",{children:"pre_call"})," ",(0,n.jsx)(y.Z,{color:"green",children:"Recommended"})]}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eQ.pre_call})]})}),(0,n.jsx)(eH,{value:"during_call",label:"during_call",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"during_call"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eQ.during_call})]})}),(0,n.jsx)(eH,{value:"post_call",label:"post_call",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"post_call"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eQ.post_call})]})}),(0,n.jsx)(eH,{value:"logging_only",label:"logging_only",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:(0,n.jsx)("strong",{children:"logging_only"})}),(0,n.jsx)("div",{style:{fontSize:"12px",color:"#888"},children:eQ.logging_only})]})})]})})}),(0,n.jsx)(v.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default.",children:(0,n.jsxs)(f.default,{children:[(0,n.jsx)(f.default.Option,{value:!0,children:"Yes"}),(0,n.jsx)(f.default.Option,{value:!1,children:"No"})]})}),!$&&!P(c)&&(0,n.jsx)(X,{selectedProvider:c,accessToken:t,providerParams:T})]})},ec=()=>m&&"PresidioPII"===c?(0,n.jsx)(q,{entities:m.supported_entities,actions:m.supported_actions,selectedEntities:p,selectedActions:N,onEntitySelect:ee,onActionSelect:el,entityCategories:m.pii_entity_categories}):null,eu=e=>{if(!m||!P(c))return null;let l=m.content_filter_settings;return l?(0,n.jsx)(eM,{prebuiltPatterns:l.prebuilt_patterns||[],categories:l.pattern_categories||[],selectedPatterns:D,blockedWords:J,onPatternAdd:e=>R([...D,e]),onPatternRemove:e=>R(D.filter(l=>l.id!==e)),onPatternActionChange:(e,l)=>{R(D.map(a=>a.id===e?{...a,action:l}:a))},onBlockedWordAdd:e=>V([...J,e]),onBlockedWordRemove:e=>V(J.filter(l=>l.id!==e)),onBlockedWordUpdate:(e,l,a)=>{V(J.map(t=>t.id===e?{...t,[l]:a}:t))},contentCategories:l.content_categories||[],selectedContentCategories:U,onContentCategoryAdd:e=>W([...U,e]),onContentCategoryRemove:e=>W(U.filter(l=>l.id!==e)),onContentCategoryUpdate:(e,l,a)=>{W(U.map(t=>t.id===e?{...t,[l]:a}:t))},accessToken:t,showStep:e}):null},em=()=>{var e;if(!c)return null;if($)return(0,n.jsx)(eU,{value:Y,onChange:H});if(!T)return null;console.log("guardrail_provider_map: ",C),console.log("selectedProvider: ",c);let l=null===(e=C[c])||void 0===e?void 0:e.toLowerCase(),a=T&&T[l];return a&&a.optional_params?(0,n.jsx)(ea,{optionalParams:a.optional_params,parentFieldKey:"optional_params"}):null};return(0,n.jsx)(_.Z,{title:"Add Guardrail",open:l,onCancel:en,footer:null,width:800,children:(0,n.jsxs)(v.Z,{form:r,layout:"vertical",initialValues:{mode:"pre_call",default_on:!1},children:[(0,n.jsxs)(j.default,{current:I,className:"mb-6",style:{overflow:"visible"},children:[(0,n.jsx)(e$,{title:"Basic Info"}),(0,n.jsx)(e$,{title:Z(c)?"PII Configuration":P(c)?"Default Categories":"Provider Configuration"}),P(c)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(e$,{title:"Patterns"}),(0,n.jsx)(e$,{title:"Keywords"})]})]}),(()=>{switch(I){case 0:return ed();case 1:if(Z(c))return ec();if(P(c))return eu("categories");return em();case 2:if(P(c))return eu("patterns");return null;case 3:if(P(c))return eu("keywords");return null;default:return null}})(),(()=>{let e=I===(P(c)?4:2)-1;return(0,n.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[I>0&&(0,n.jsx)(b.z,{variant:"secondary",onClick:er,children:"Previous"}),!e&&(0,n.jsx)(b.z,{onClick:ei,children:"Next"}),e&&(0,n.jsx)(b.z,{onClick:eo,loading:s,children:"Create Guardrail"}),(0,n.jsx)(b.z,{variant:"secondary",onClick:en,children:"Cancel"})]})})()]})})},e0=a(47323),e1=a(21626),e4=a(97214),e2=a(28241),e8=a(58834),e5=a(69552),e6=a(71876),e3=a(74998),e9=a(44633),e7=a(86462),le=a(49084),ll=a(1309),la=a(71594),lt=a(24525),li=a(63709);let{Title:lr,Text:ls}=g.default,{Option:ln}=f.default;var lo=e=>{var l;let{visible:a,onClose:t,accessToken:i,onSuccess:r,guardrailId:s,initialValues:d}=e,[c]=v.Z.useForm(),[u,m]=(0,o.useState)(!1),[x,p]=(0,o.useState)((null==d?void 0:d.provider)||null),[g,j]=(0,o.useState)(null),[y,N]=(0,o.useState)([]),[w,S]=(0,o.useState)({});(0,o.useEffect)(()=>{(async()=>{try{if(!i)return;let e=await (0,h.getGuardrailUISettings)(i);j(e)}catch(e){console.error("Error fetching guardrail settings:",e),et.Z.fromBackend("Failed to load guardrail settings")}})()},[i]),(0,o.useEffect)(()=>{(null==d?void 0:d.pii_entities_config)&&Object.keys(d.pii_entities_config).length>0&&(N(Object.keys(d.pii_entities_config)),S(d.pii_entities_config))},[d]);let Z=e=>{N(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},P=(e,l)=>{S(a=>({...a,[e]:l}))},A=async()=>{try{m(!0);let e=await c.validateFields(),l=C[e.provider],a={guardrail_id:s,guardrail:{guardrail_name:e.guardrail_name,litellm_params:{guardrail:l,mode:e.mode,default_on:e.default_on},guardrail_info:{}}};if("PresidioPII"===e.provider&&y.length>0){let e={};y.forEach(l=>{e[l]=w[l]||"MASK"}),a.guardrail.litellm_params.pii_entities_config=e}else if(e.config)try{let l=JSON.parse(e.config);"Bedrock"===e.provider&&l?(l.guardrail_id&&(a.guardrail.litellm_params.guardrailIdentifier=l.guardrail_id),l.guardrail_version&&(a.guardrail.litellm_params.guardrailVersion=l.guardrail_version)):a.guardrail.guardrail_info=l}catch(e){et.Z.fromBackend("Invalid JSON in configuration"),m(!1);return}if(!i)throw Error("No access token available");console.log("Sending guardrail update data:",JSON.stringify(a));let n=await fetch("/guardrails/".concat(s),{method:"PUT",headers:{Authorization:"Bearer ".concat(i),"Content-Type":"application/json"},body:JSON.stringify(a)});if(!n.ok){let e=await n.text();throw Error(e||"Failed to update guardrail")}et.Z.success("Guardrail updated successfully"),r(),t()}catch(e){console.error("Failed to update guardrail:",e),et.Z.fromBackend("Failed to update guardrail: "+(e instanceof Error?e.message:String(e)))}finally{m(!1)}},I=()=>g&&x&&"PresidioPII"===x?(0,n.jsx)(q,{entities:g.supported_entities,actions:g.supported_actions,selectedEntities:y,selectedActions:w,onEntitySelect:Z,onActionSelect:P,entityCategories:g.pii_entity_categories}):null;return(0,n.jsx)(_.Z,{title:"Edit Guardrail",open:a,onCancel:t,footer:null,width:700,children:(0,n.jsxs)(v.Z,{form:c,layout:"vertical",initialValues:d,children:[(0,n.jsx)(v.Z.Item,{name:"guardrail_name",label:"Guardrail Name",rules:[{required:!0,message:"Please enter a guardrail name"}],children:(0,n.jsx)(b.o,{placeholder:"Enter a name for this guardrail"})}),(0,n.jsx)(v.Z.Item,{name:"provider",label:"Guardrail Provider",rules:[{required:!0,message:"Please select a provider"}],children:(0,n.jsx)(f.default,{placeholder:"Select a guardrail provider",onChange:e=>{p(e),c.setFieldsValue({config:void 0}),N([]),S({})},disabled:!0,optionLabelProp:"label",children:Object.entries(k()).map(e=>{let[l,a]=e;return(0,n.jsx)(ln,{value:l,label:a,children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[O[a]&&(0,n.jsx)("img",{src:O[a],alt:"",style:{height:"20px",width:"20px",marginRight:"8px",objectFit:"contain"},onError:e=>{e.currentTarget.style.display="none"}}),(0,n.jsx)("span",{children:a})]})},l)})})}),(0,n.jsx)(v.Z.Item,{name:"mode",label:"Mode",tooltip:"How the guardrail should be applied",rules:[{required:!0,message:"Please select a mode"}],children:(0,n.jsx)(f.default,{children:(null==g?void 0:null===(l=g.supported_modes)||void 0===l?void 0:l.map(e=>(0,n.jsx)(ln,{value:e,children:e},e)))||(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ln,{value:"pre_call",children:"pre_call"}),(0,n.jsx)(ln,{value:"post_call",children:"post_call"})]})})}),(0,n.jsx)(v.Z.Item,{name:"default_on",label:"Always On",tooltip:"If enabled, this guardrail will be applied to all requests by default",valuePropName:"checked",children:(0,n.jsx)(li.Z,{})}),(()=>{if(!x)return null;if("PresidioPII"===x)return I();switch(x){case"Aporia":return(0,n.jsx)(v.Z.Item,{label:"Aporia Configuration",name:"config",tooltip:"JSON configuration for Aporia",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aporia_api_key",\n "project_name": "your_project_name"\n}'})});case"AimSecurity":return(0,n.jsx)(v.Z.Item,{label:"Aim Security Configuration",name:"config",tooltip:"JSON configuration for Aim Security",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_aim_api_key"\n}'})});case"Bedrock":return(0,n.jsx)(v.Z.Item,{label:"Amazon Bedrock Configuration",name:"config",tooltip:"JSON configuration for Amazon Bedrock guardrails",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "guardrail_id": "your_guardrail_id",\n "guardrail_version": "your_guardrail_version"\n}'})});case"GuardrailsAI":return(0,n.jsx)(v.Z.Item,{label:"Guardrails.ai Configuration",name:"config",tooltip:"JSON configuration for Guardrails.ai",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_guardrails_api_key",\n "guardrail_id": "your_guardrail_id"\n}'})});case"LakeraAI":return(0,n.jsx)(v.Z.Item,{label:"Lakera AI Configuration",name:"config",tooltip:"JSON configuration for Lakera AI",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "api_key": "your_lakera_api_key"\n}'})});case"PromptInjection":return(0,n.jsx)(v.Z.Item,{label:"Prompt Injection Configuration",name:"config",tooltip:"JSON configuration for prompt injection detection",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "threshold": 0.8\n}'})});default:return(0,n.jsx)(v.Z.Item,{label:"Custom Configuration",name:"config",tooltip:"JSON configuration for your custom guardrail",children:(0,n.jsx)(eG.default.TextArea,{rows:4,placeholder:'{\n "key1": "value1",\n "key2": "value2"\n}'})})}})(),(0,n.jsxs)("div",{className:"flex justify-end space-x-2 mt-4",children:[(0,n.jsx)(b.z,{variant:"secondary",onClick:t,children:"Cancel"}),(0,n.jsx)(b.z,{onClick:A,loading:u,children:"Update Guardrail"})]})]})})};(i=s||(s={})).DB="db",i.CONFIG="config";var ld=e=>{let{guardrailsList:l,isLoading:a,onDeleteClick:t,accessToken:i,onGuardrailUpdated:r,isAdmin:c=!1,onGuardrailClick:u}=e,[m,x]=(0,o.useState)([{id:"created_at",desc:!0}]),[p,h]=(0,o.useState)(!1),[g,f]=(0,o.useState)(null),j=e=>e?new Date(e).toLocaleString():"-",v=[{header:"Guardrail ID",accessorKey:"guardrail_id",cell:e=>(0,n.jsx)(L.Z,{title:String(e.getValue()||""),children:(0,n.jsx)(d.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 max-w-[200px]",onClick:()=>e.getValue()&&u(e.getValue()),children:e.getValue()?"".concat(String(e.getValue()).slice(0,7),"..."):""})})},{header:"Name",accessorKey:"guardrail_name",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.guardrail_name,children:(0,n.jsx)("span",{className:"text-xs font-medium",children:a.guardrail_name||"-"})})}},{header:"Provider",accessorKey:"litellm_params.guardrail",cell:e=>{let{row:l}=e,{logo:a,displayName:t}=I(l.original.litellm_params.guardrail);return(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,n.jsx)("img",{src:a,alt:"".concat(t," logo"),className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,n.jsx)("span",{className:"text-xs",children:t})]})}},{header:"Mode",accessorKey:"litellm_params.mode",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)("span",{className:"text-xs",children:a.litellm_params.mode})}},{header:"Default On",accessorKey:"litellm_params.default_on",cell:e=>{var l,a;let{row:t}=e,i=t.original;return(0,n.jsx)(ll.C,{color:(null===(l=i.litellm_params)||void 0===l?void 0:l.default_on)?"green":"gray",className:"text-xs font-normal",size:"xs",children:(null===(a=i.litellm_params)||void 0===a?void 0:a.default_on)?"Default On":"Default Off"})}},{header:"Created At",accessorKey:"created_at",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.created_at,children:(0,n.jsx)("span",{className:"text-xs",children:j(a.created_at)})})}},{header:"Updated At",accessorKey:"updated_at",cell:e=>{let{row:l}=e,a=l.original;return(0,n.jsx)(L.Z,{title:a.updated_at,children:(0,n.jsx)("span",{className:"text-xs",children:j(a.updated_at)})})}},{id:"actions",header:"Actions",cell:e=>{let{row:l}=e,a=l.original,i=a.guardrail_definition_location===s.CONFIG;return(0,n.jsx)("div",{className:"flex space-x-2",children:i?(0,n.jsx)(L.Z,{title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,n.jsx)(e0.Z,{"data-testid":"config-delete-icon",icon:e3.Z,size:"sm",className:"cursor-not-allowed text-gray-400",title:"Config guardrail cannot be deleted on the dashboard. Please delete it from the config file.","aria-label":"Delete guardrail (config)"})}):(0,n.jsx)(L.Z,{title:"Delete guardrail",children:(0,n.jsx)(e0.Z,{icon:e3.Z,size:"sm",onClick:()=>a.guardrail_id&&t(a.guardrail_id,a.guardrail_name||"Unnamed Guardrail"),className:"cursor-pointer hover:text-red-500"})})})}}],y=(0,la.b7)({data:l,columns:v,state:{sorting:m},onSortingChange:x,getCoreRowModel:(0,lt.sC)(),getSortedRowModel:(0,lt.tj)(),enableSorting:!0});return(0,n.jsxs)("div",{className:"rounded-lg custom-border relative",children:[(0,n.jsx)("div",{className:"overflow-x-auto",children:(0,n.jsxs)(e1.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,n.jsx)(e8.Z,{children:y.getHeaderGroups().map(e=>(0,n.jsx)(e6.Z,{children:e.headers.map(e=>(0,n.jsx)(e5.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.getToggleSortingHandler(),children:(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,la.ie)(e.column.columnDef.header,e.getContext())}),"actions"!==e.id&&(0,n.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,n.jsx)(e9.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,n.jsx)(e7.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,n.jsx)(le.Z,{className:"h-4 w-4 text-gray-400"})})]})},e.id))},e.id))}),(0,n.jsx)(e4.Z,{children:a?(0,n.jsx)(e6.Z,{children:(0,n.jsx)(e2.Z,{colSpan:v.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"Loading..."})})})}):l.length>0?y.getRowModel().rows.map(e=>(0,n.jsx)(e6.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,n.jsx)(e2.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,la.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,n.jsx)(e6.Z,{children:(0,n.jsx)(e2.Z,{colSpan:v.length,className:"h-8 text-center",children:(0,n.jsx)("div",{className:"text-center text-gray-500",children:(0,n.jsx)("p",{children:"No guardrails found"})})})})})]})}),g&&(0,n.jsx)(lo,{visible:p,onClose:()=>h(!1),accessToken:i,onSuccess:()=>{h(!1),f(null),r()},guardrailId:g.guardrail_id||"",initialValues:{guardrail_name:g.guardrail_name||"",provider:Object.keys(C).find(e=>C[e]===(null==g?void 0:g.litellm_params.guardrail))||"",mode:g.litellm_params.mode,default_on:g.litellm_params.default_on,pii_entities_config:g.litellm_params.pii_entities_config,...g.guardrail_info}})]})},lc=a(20347),lu=a(30078),lm=a(41649),lx=a(12514),lp=a(84264),lh=e=>{let{patterns:l,blockedWords:a,readOnly:t=!0,onPatternActionChange:i,onPatternRemove:r,onBlockedWordUpdate:s,onBlockedWordRemove:o}=e;if(0===l.length&&0===a.length)return null;let d=()=>{};return(0,n.jsxs)(n.Fragment,{children:[l.length>0&&(0,n.jsxs)(lx.Z,{className:"mt-6",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(lp.Z,{className:"text-lg font-semibold",children:"Pattern Detection"}),(0,n.jsxs)(lm.Z,{color:"blue",children:[l.length," patterns configured"]})]}),(0,n.jsx)(ek,{patterns:l,onActionChange:t?d:i||d,onRemove:t?d:r||d})]}),a.length>0&&(0,n.jsxs)(lx.Z,{className:"mt-6",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(lp.Z,{className:"text-lg font-semibold",children:"Blocked Keywords"}),(0,n.jsxs)(lm.Z,{color:"blue",children:[a.length," keywords configured"]})]}),(0,n.jsx)(eZ,{keywords:a,onActionChange:t?d:s||d,onRemove:t?d:o||d})]})]})},lg=e=>{var l;let{guardrailData:a,guardrailSettings:t,isEditing:i,accessToken:r,onDataChange:s,onUnsavedChanges:d}=e,[c,u]=(0,o.useState)([]),[m,x]=(0,o.useState)([]),[p,h]=(0,o.useState)([]),[g,f]=(0,o.useState)([]);(0,o.useEffect)(()=>{var e,l;if(null==a?void 0:null===(e=a.litellm_params)||void 0===e?void 0:e.patterns){let e=a.litellm_params.patterns.map((e,l)=>({id:"pattern-".concat(l),type:"prebuilt"===e.pattern_type?"prebuilt":"custom",name:e.pattern_name||e.name,display_name:e.display_name,pattern:e.pattern,action:e.action||"BLOCK"}));u(e),h(e)}else u([]),h([]);if(null==a?void 0:null===(l=a.litellm_params)||void 0===l?void 0:l.blocked_words){let e=a.litellm_params.blocked_words.map((e,l)=>({id:"word-".concat(l),keyword:e.keyword,action:e.action||"BLOCK",description:e.description}));x(e),f(e)}else x([]),f([])},[a]),(0,o.useEffect)(()=>{s&&s(c,m)},[c,m,s]);let j=o.useMemo(()=>{let e=JSON.stringify(c)!==JSON.stringify(p),l=JSON.stringify(m)!==JSON.stringify(g);return e||l},[c,m,p,g]);return((0,o.useEffect)(()=>{i&&d&&d(j)},[j,i,d]),(null==a?void 0:null===(l=a.litellm_params)||void 0===l?void 0:l.guardrail)!=="litellm_content_filter")?null:i?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eK.Z,{orientation:"left",children:"Content Filter Configuration"}),j&&(0,n.jsx)("div",{className:"mb-4 px-4 py-3 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,n.jsx)("p",{className:"text-sm text-yellow-800 font-medium",children:'⚠️ You have unsaved changes to patterns or keywords. Remember to click "Save Changes" at the bottom.'})}),(0,n.jsx)("div",{className:"mb-6",children:t&&t.content_filter_settings&&(0,n.jsx)(eM,{prebuiltPatterns:t.content_filter_settings.prebuilt_patterns||[],categories:t.content_filter_settings.pattern_categories||[],selectedPatterns:c,blockedWords:m,onPatternAdd:e=>u([...c,e]),onPatternRemove:e=>u(c.filter(l=>l.id!==e)),onPatternActionChange:(e,l)=>u(c.map(a=>a.id===e?{...a,action:l}:a)),onBlockedWordAdd:e=>x([...m,e]),onBlockedWordRemove:e=>x(m.filter(l=>l.id!==e)),onBlockedWordUpdate:(e,l,a)=>x(m.map(t=>t.id===e?{...t,[l]:a}:t)),onFileUpload:e=>{console.log("File uploaded:",e)},accessToken:r})})]}):(0,n.jsx)(lh,{patterns:c,blockedWords:m,readOnly:!0})};let lf=(e,l)=>({patterns:e.map(e=>({pattern_type:"prebuilt"===e.type?"prebuilt":"regex",pattern_name:"prebuilt"===e.type?e.name:void 0,pattern:"custom"===e.type?e.pattern:void 0,name:e.name,action:e.action})),blocked_words:l.map(e=>({keyword:e.keyword,action:e.action,description:e.description}))});var lj=a(10900),lv=a(59872),ly=a(30401),l_=a(78867),lb=e=>{var l,a,t,i,r,s,d,c,u,m,x,p,g,j,y,_;let{guardrailId:b,onClose:N,accessToken:w,isAdmin:k}=e,[S,Z]=(0,o.useState)(null),[P,A]=(0,o.useState)(null),[O,z]=(0,o.useState)(!0),[M,F]=(0,o.useState)(!1),[G]=v.Z.useForm(),[K,D]=(0,o.useState)([]),[R,J]=(0,o.useState)({}),[V,U]=(0,o.useState)(null),[W,Y]=(0,o.useState)({}),[H,$]=(0,o.useState)(!1),Q={rules:[],default_action:"deny",on_disallowed_action:"block",violation_message_template:""},[ee,el]=(0,o.useState)(Q),[ei,er]=(0,o.useState)(!1),es=o.useRef({patterns:[],blockedWords:[]}),en=(0,o.useCallback)((e,l)=>{es.current={patterns:e,blockedWords:l}},[]),eo=async()=>{try{var e;if(z(!0),!w)return;let l=await (0,h.getGuardrailInfo)(w,b);if(Z(l),null===(e=l.litellm_params)||void 0===e?void 0:e.pii_entities_config){let e=l.litellm_params.pii_entities_config;if(D([]),J({}),Object.keys(e).length>0){let l=[],a={};Object.entries(e).forEach(e=>{let[t,i]=e;l.push(t),a[t]="string"==typeof i?i:"MASK"}),D(l),J(a)}}else D([]),J({})}catch(e){et.Z.fromBackend("Failed to load guardrail information"),console.error("Error fetching guardrail info:",e)}finally{z(!1)}},ed=async()=>{try{if(!w)return;let e=await (0,h.getGuardrailProviderSpecificParams)(w);A(e)}catch(e){console.error("Error fetching guardrail provider specific params:",e)}},ec=async()=>{try{if(!w)return;let e=await (0,h.getGuardrailUISettings)(w);U(e)}catch(e){console.error("Error fetching guardrail UI settings:",e)}};(0,o.useEffect)(()=>{ed()},[w]),(0,o.useEffect)(()=>{eo(),ec()},[b,w]),(0,o.useEffect)(()=>{if(S&&G){var e;G.setFieldsValue({guardrail_name:S.guardrail_name,...S.litellm_params,guardrail_info:S.guardrail_info?JSON.stringify(S.guardrail_info,null,2):"",...(null===(e=S.litellm_params)||void 0===e?void 0:e.optional_params)&&{optional_params:S.litellm_params.optional_params}})}},[S,P,G]);let eu=(0,o.useCallback)(()=>{var e,l,a,t,i;(null==S?void 0:null===(e=S.litellm_params)||void 0===e?void 0:e.guardrail)==="tool_permission"?el({rules:(null===(l=S.litellm_params)||void 0===l?void 0:l.rules)||[],default_action:((null===(a=S.litellm_params)||void 0===a?void 0:a.default_action)||"deny").toLowerCase(),on_disallowed_action:((null===(t=S.litellm_params)||void 0===t?void 0:t.on_disallowed_action)||"block").toLowerCase(),violation_message_template:(null===(i=S.litellm_params)||void 0===i?void 0:i.violation_message_template)||""}):el(Q),er(!1)},[S]);(0,o.useEffect)(()=>{eu()},[eu]);let em=async e=>{try{var l,a,t,i,r,s,n,o,d,c,u,m;if(!w)return;let x={litellm_params:{}};e.guardrail_name!==S.guardrail_name&&(x.guardrail_name=e.guardrail_name),e.default_on!==(null===(l=S.litellm_params)||void 0===l?void 0:l.default_on)&&(x.litellm_params.default_on=e.default_on);let p=S.guardrail_info,g=e.guardrail_info?JSON.parse(e.guardrail_info):void 0;JSON.stringify(p)!==JSON.stringify(g)&&(x.guardrail_info=g);let f=(null===(a=S.litellm_params)||void 0===a?void 0:a.pii_entities_config)||{},j={};if(K.forEach(e=>{j[e]=R[e]||"MASK"}),JSON.stringify(f)!==JSON.stringify(j)&&(x.litellm_params.pii_entities_config=j),(null===(t=S.litellm_params)||void 0===t?void 0:t.guardrail)==="litellm_content_filter"){let e=(null===(s=S.litellm_params)||void 0===s?void 0:s.patterns)||[],l=(null===(n=S.litellm_params)||void 0===n?void 0:n.blocked_words)||[],a=lf(es.current.patterns,es.current.blockedWords);JSON.stringify(e)!==JSON.stringify(a.patterns)&&(x.litellm_params.patterns=a.patterns),JSON.stringify(l)!==JSON.stringify(a.blocked_words)&&(x.litellm_params.blocked_words=a.blocked_words)}if((null===(i=S.litellm_params)||void 0===i?void 0:i.guardrail)==="tool_permission"){let e=(null===(o=S.litellm_params)||void 0===o?void 0:o.rules)||[],l=ee.rules||[],a=JSON.stringify(e)!==JSON.stringify(l),t=((null===(d=S.litellm_params)||void 0===d?void 0:d.default_action)||"deny").toLowerCase(),i=(ee.default_action||"deny").toLowerCase(),r=t!==i,s=((null===(c=S.litellm_params)||void 0===c?void 0:c.on_disallowed_action)||"block").toLowerCase(),n=(ee.on_disallowed_action||"block").toLowerCase(),m=s!==n,p=(null===(u=S.litellm_params)||void 0===u?void 0:u.violation_message_template)||"",h=ee.violation_message_template||"",g=p!==h;(ei||a||r||m||g)&&(x.litellm_params.rules=l,x.litellm_params.default_action=i,x.litellm_params.on_disallowed_action=n,x.litellm_params.violation_message_template=h||null)}let v=Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)});console.log("values: ",JSON.stringify(e)),console.log("currentProvider: ",v);let y=(null===(r=S.litellm_params)||void 0===r?void 0:r.guardrail)==="tool_permission";if(P&&v&&!y){let l=P[null===(m=C[v])||void 0===m?void 0:m.toLowerCase()]||{},a=new Set;console.log("providerSpecificParams: ",JSON.stringify(l)),Object.keys(l).forEach(e=>{"optional_params"!==e&&a.add(e)}),l.optional_params&&l.optional_params.fields&&Object.keys(l.optional_params.fields).forEach(e=>{a.add(e)}),console.log("allowedParams: ",a),a.forEach(l=>{var a,t;let i=e[l];(null==i||""===i)&&(i=null===(t=e.optional_params)||void 0===t?void 0:t[l]);let r=null===(a=S.litellm_params)||void 0===a?void 0:a[l];JSON.stringify(i)!==JSON.stringify(r)&&(null!=i&&""!==i?x.litellm_params[l]=i:null!=r&&""!==r&&(x.litellm_params[l]=null))})}if(0===Object.keys(x.litellm_params).length&&delete x.litellm_params,0===Object.keys(x).length){et.Z.info("No changes detected"),F(!1);return}await (0,h.updateGuardrailCall)(w,b,x),et.Z.success("Guardrail updated successfully"),$(!1),eo(),F(!1)}catch(e){console.error("Error updating guardrail:",e),et.Z.fromBackend("Failed to update guardrail")}};if(O)return(0,n.jsx)("div",{className:"p-4",children:"Loading..."});if(!S)return(0,n.jsx)("div",{className:"p-4",children:"Guardrail not found"});let ex=e=>e?new Date(e).toLocaleString():"-",{logo:ep,displayName:eh}=I((null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)||""),eg=async(e,l)=>{await (0,lv.vQ)(e)&&(Y(e=>({...e,[l]:!0})),setTimeout(()=>{Y(e=>({...e,[l]:!1}))},2e3))},ef="config"===S.guardrail_definition_location;return(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.zx,{icon:lj.Z,variant:"light",onClick:N,className:"mb-4",children:"Back to Guardrails"}),(0,n.jsx)(lu.Dx,{children:S.guardrail_name||"Unnamed Guardrail"}),(0,n.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,n.jsx)(lu.xv,{className:"text-gray-500 font-mono",children:S.guardrail_id}),(0,n.jsx)(T.ZP,{type:"text",size:"small",icon:W["guardrail-id"]?(0,n.jsx)(ly.Z,{size:12}):(0,n.jsx)(l_.Z,{size:12}),onClick:()=>eg(S.guardrail_id,"guardrail-id"),className:"left-2 z-10 transition-all duration-200 ".concat(W["guardrail-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]})]}),(0,n.jsxs)(lu.v0,{children:[(0,n.jsxs)(lu.td,{className:"mb-4",children:[(0,n.jsx)(lu.OK,{children:"Overview"},"overview"),k?(0,n.jsx)(lu.OK,{children:"Settings"},"settings"):(0,n.jsx)(n.Fragment,{})]}),(0,n.jsxs)(lu.nP,{children:[(0,n.jsxs)(lu.x4,{children:[(0,n.jsxs)(lu.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,n.jsxs)(lu.Zb,{children:[(0,n.jsx)(lu.xv,{children:"Provider"}),(0,n.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[ep&&(0,n.jsx)("img",{src:ep,alt:"".concat(eh," logo"),className:"w-6 h-6",onError:e=>{e.target.style.display="none"}}),(0,n.jsx)(lu.Dx,{children:eh})]})]}),(0,n.jsxs)(lu.Zb,{children:[(0,n.jsx)(lu.xv,{children:"Mode"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(lu.Dx,{children:(null===(a=S.litellm_params)||void 0===a?void 0:a.mode)||"-"}),(0,n.jsx)(lu.Ct,{color:(null===(t=S.litellm_params)||void 0===t?void 0:t.default_on)?"green":"gray",children:(null===(i=S.litellm_params)||void 0===i?void 0:i.default_on)?"Default On":"Default Off"})]})]}),(0,n.jsxs)(lu.Zb,{children:[(0,n.jsx)(lu.xv,{children:"Created At"}),(0,n.jsxs)("div",{className:"mt-2",children:[(0,n.jsx)(lu.Dx,{children:ex(S.created_at)}),(0,n.jsxs)(lu.xv,{children:["Last Updated: ",ex(S.updated_at)]})]})]})]}),(null===(r=S.litellm_params)||void 0===r?void 0:r.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsx)(lu.Zb,{className:"mt-6",children:(0,n.jsxs)("div",{className:"flex justify-between items-center",children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"PII Protection"}),(0,n.jsxs)(lu.Ct,{color:"blue",children:[Object.keys(S.litellm_params.pii_entities_config).length," PII entities configured"]})]})}),(null===(s=S.litellm_params)||void 0===s?void 0:s.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsxs)(lu.Zb,{className:"mt-6",children:[(0,n.jsx)(lu.xv,{className:"mb-4 text-lg font-semibold",children:"PII Entity Configuration"}),(0,n.jsxs)("div",{className:"border rounded-lg overflow-hidden shadow-sm",children:[(0,n.jsxs)("div",{className:"bg-gray-50 px-5 py-3 border-b flex",children:[(0,n.jsx)(lu.xv,{className:"flex-1 font-semibold text-gray-700",children:"Entity Type"}),(0,n.jsx)(lu.xv,{className:"flex-1 font-semibold text-gray-700",children:"Configuration"})]}),(0,n.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:Object.entries(null===(d=S.litellm_params)||void 0===d?void 0:d.pii_entities_config).map(e=>{let[l,a]=e;return(0,n.jsxs)("div",{className:"px-5 py-3 flex border-b hover:bg-gray-50 transition-colors",children:[(0,n.jsx)(lu.xv,{className:"flex-1 font-medium text-gray-900",children:l}),(0,n.jsx)(lu.xv,{className:"flex-1",children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5 ".concat("MASK"===a?"text-blue-600":"text-red-600"),children:["MASK"===a?(0,n.jsx)(E.Z,{}):(0,n.jsx)(B.Z,{}),String(a)]})})]},l)})})]})]}),(null===(c=S.litellm_params)||void 0===c?void 0:c.guardrail)==="tool_permission"&&(0,n.jsx)(lu.Zb,{className:"mt-6",children:(0,n.jsx)(eU,{value:ee,disabled:!0})}),(0,n.jsx)(lg,{guardrailData:S,guardrailSettings:V,isEditing:!1,accessToken:w})]}),k&&(0,n.jsx)(lu.x4,{children:(0,n.jsxs)(lu.Zb,{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)(lu.Dx,{children:"Guardrail Settings"}),ef&&(0,n.jsx)(L.Z,{title:"Guardrail is defined in the config file and cannot be edited.",children:(0,n.jsx)(eR.Z,{})}),!M&&!ef&&(0,n.jsx)(lu.zx,{onClick:()=>F(!0),children:"Edit Settings"})]}),M?(0,n.jsxs)(v.Z,{form:G,onFinish:em,initialValues:{guardrail_name:S.guardrail_name,...S.litellm_params,guardrail_info:S.guardrail_info?JSON.stringify(S.guardrail_info,null,2):"",...(null===(u=S.litellm_params)||void 0===u?void 0:u.optional_params)&&{optional_params:S.litellm_params.optional_params}},layout:"vertical",children:[(0,n.jsx)(v.Z.Item,{label:"Guardrail Name",name:"guardrail_name",rules:[{required:!0,message:"Please input a guardrail name"}],children:(0,n.jsx)(lu.oi,{})}),(0,n.jsx)(v.Z.Item,{label:"Default On",name:"default_on",children:(0,n.jsxs)(f.default,{children:[(0,n.jsx)(f.default.Option,{value:!0,children:"Yes"}),(0,n.jsx)(f.default.Option,{value:!1,children:"No"})]})}),(null===(m=S.litellm_params)||void 0===m?void 0:m.guardrail)==="presidio"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eK.Z,{orientation:"left",children:"PII Protection"}),(0,n.jsx)("div",{className:"mb-6",children:V&&(0,n.jsx)(q,{entities:V.supported_entities,actions:V.supported_actions,selectedEntities:K,selectedActions:R,onEntitySelect:e=>{D(l=>l.includes(e)?l.filter(l=>l!==e):[...l,e])},onActionSelect:(e,l)=>{J(a=>({...a,[e]:l}))},entityCategories:V.pii_entity_categories})})]}),(0,n.jsx)(lg,{guardrailData:S,guardrailSettings:V,isEditing:!0,accessToken:w,onDataChange:en,onUnsavedChanges:$}),(0,n.jsx)(eK.Z,{orientation:"left",children:"Provider Settings"}),(null===(x=S.litellm_params)||void 0===x?void 0:x.guardrail)==="tool_permission"?(0,n.jsx)(eU,{value:ee,onChange:el}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(X,{selectedProvider:Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)})||null,accessToken:w,providerParams:P,value:S.litellm_params}),P&&(()=>{var e;let l=Object.keys(C).find(e=>{var l;return C[e]===(null===(l=S.litellm_params)||void 0===l?void 0:l.guardrail)});if(!l)return null;let a=P[null===(e=C[l])||void 0===e?void 0:e.toLowerCase()];return a&&a.optional_params?(0,n.jsx)(ea,{optionalParams:a.optional_params,parentFieldKey:"optional_params",values:S.litellm_params}):null})()]}),(0,n.jsx)(eK.Z,{orientation:"left",children:"Advanced Settings"}),(0,n.jsx)(v.Z.Item,{label:"Guardrail Information",name:"guardrail_info",children:(0,n.jsx)(eG.default.TextArea,{rows:5})}),(0,n.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,n.jsx)(T.ZP,{onClick:()=>{F(!1),$(!1),eu()},children:"Cancel"}),(0,n.jsx)(lu.zx,{children:"Save Changes"})]})]}):(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Guardrail ID"}),(0,n.jsx)("div",{className:"font-mono",children:S.guardrail_id})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Guardrail Name"}),(0,n.jsx)("div",{children:S.guardrail_name||"Unnamed Guardrail"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Provider"}),(0,n.jsx)("div",{children:eh})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Mode"}),(0,n.jsx)("div",{children:(null===(p=S.litellm_params)||void 0===p?void 0:p.mode)||"-"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Default On"}),(0,n.jsx)(lu.Ct,{color:(null===(g=S.litellm_params)||void 0===g?void 0:g.default_on)?"green":"gray",children:(null===(j=S.litellm_params)||void 0===j?void 0:j.default_on)?"Yes":"No"})]}),(null===(y=S.litellm_params)||void 0===y?void 0:y.pii_entities_config)&&Object.keys(S.litellm_params.pii_entities_config).length>0&&(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"PII Protection"}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsxs)(lu.Ct,{color:"blue",children:[Object.keys(S.litellm_params.pii_entities_config).length," PII entities configured"]})})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Created At"}),(0,n.jsx)("div",{children:ex(S.created_at)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)(lu.xv,{className:"font-medium",children:"Last Updated"}),(0,n.jsx)("div",{children:ex(S.updated_at)})]}),(null===(_=S.litellm_params)||void 0===_?void 0:_.guardrail)==="tool_permission"&&(0,n.jsx)(eU,{value:ee,disabled:!0})]})]})})]})]})]})},lN=a(96761),lw=a(35631),lk=a(29436),lC=a(41169),lS=a(23639),lZ=a(77565),lP=a(70464),lA=a(83669),lO=a(5540);let{Text:lI}=g.default;var lL=function(e){let{results:l,errors:a}=e,[t,i]=(0,o.useState)(new Set),r=e=>{let l=new Set(t);l.has(e)?l.delete(e):l.add(e),i(l)},s=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.focus(),l.select();let a=document.execCommand("copy");if(document.body.removeChild(l),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}};return l||a?(0,n.jsxs)("div",{className:"space-y-3 pt-4 border-t border-gray-200",children:[(0,n.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Results"}),l&&l.map(e=>{let l=t.has(e.guardrailName);return(0,n.jsx)(lx.Z,{className:"bg-green-50 border-green-200",children:(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2 cursor-pointer flex-1",onClick:()=>r(e.guardrailName),children:[l?(0,n.jsx)(lZ.Z,{className:"text-gray-500 text-xs"}):(0,n.jsx)(lP.Z,{className:"text-gray-500 text-xs"}),(0,n.jsx)(lA.Z,{className:"text-green-600 text-lg"}),(0,n.jsx)("span",{className:"text-sm font-medium text-green-800",children:e.guardrailName})]}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,n.jsx)(lO.Z,{}),(0,n.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]}),!l&&(0,n.jsx)(d.Z,{size:"xs",variant:"secondary",icon:lS.Z,onClick:async()=>{await s(e.response_text)?et.Z.success("Result copied to clipboard"):et.Z.fromBackend("Failed to copy result")},children:"Copy"})]})]}),!l&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"bg-white border border-green-200 rounded p-3",children:[(0,n.jsx)("label",{className:"text-xs font-medium text-gray-600 mb-2 block",children:"Output Text"}),(0,n.jsx)("div",{className:"font-mono text-sm text-gray-900 whitespace-pre-wrap break-words",children:e.response_text})]}),(0,n.jsxs)("div",{className:"text-xs text-gray-600",children:[(0,n.jsx)("span",{className:"font-medium",children:"Characters:"})," ",e.response_text.length]})]})]})},e.guardrailName)}),a&&a.map(e=>{let l=t.has(e.guardrailName);return(0,n.jsx)(lx.Z,{className:"bg-red-50 border-red-200",children:(0,n.jsxs)("div",{className:"flex items-start space-x-2",children:[(0,n.jsx)("div",{className:"cursor-pointer mt-0.5",onClick:()=>r(e.guardrailName),children:l?(0,n.jsx)(lZ.Z,{className:"text-gray-500 text-xs"}):(0,n.jsx)(lP.Z,{className:"text-gray-500 text-xs"})}),(0,n.jsx)("div",{className:"text-red-600 mt-0.5",children:(0,n.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,n.jsxs)("p",{className:"text-sm font-medium text-red-800 cursor-pointer",onClick:()=>r(e.guardrailName),children:[e.guardrailName," - Error"]}),(0,n.jsxs)("div",{className:"flex items-center space-x-1 text-xs text-gray-600",children:[(0,n.jsx)(lO.Z,{}),(0,n.jsxs)("span",{className:"font-medium",children:[e.latency,"ms"]})]})]}),!l&&(0,n.jsx)("p",{className:"text-sm text-red-700 mt-1",children:e.error.message})]})]})},e.guardrailName)})]}):null};let{TextArea:lT}=eG.default,{Text:lz}=g.default;var lE=function(e){let{guardrailNames:l,onSubmit:a,isLoading:t,results:i,errors:r,onClose:s}=e,[d,c]=(0,o.useState)(""),u=()=>{if(!d.trim()){et.Z.fromBackend("Please enter text to test");return}a(d)},m=async e=>{try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0;{let l=document.createElement("textarea");l.value=e,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.focus(),l.select();let a=document.execCommand("copy");if(document.body.removeChild(l),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},x=async()=>{await m(d)?et.Z.success("Input copied to clipboard"):et.Z.fromBackend("Failed to copy input")};return(0,n.jsxs)("div",{className:"space-y-4 h-full flex flex-col",children:[(0,n.jsx)("div",{className:"flex items-center justify-between pb-3 border-b border-gray-200",children:(0,n.jsx)("div",{className:"flex items-center space-x-3",children:(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,n.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Test Guardrails:"}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:l.map(e=>(0,n.jsx)("div",{className:"inline-flex items-center space-x-1 bg-blue-50 px-3 py-1 rounded-md border border-blue-200",children:(0,n.jsx)("span",{className:"font-mono text-blue-700 font-medium text-sm",children:e})},e))})]}),(0,n.jsxs)("p",{className:"text-sm text-gray-500",children:["Test ",l.length>1?"guardrails":"guardrail"," and compare results"]})]})})}),(0,n.jsxs)("div",{className:"flex-1 overflow-auto space-y-4",children:[(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Input Text"}),(0,n.jsx)(L.Z,{title:"Press Enter to submit. Use Shift+Enter for new line.",children:(0,n.jsx)(eR.Z,{className:"text-gray-400 cursor-help"})})]}),d&&(0,n.jsx)(ed.z,{size:"xs",variant:"secondary",icon:lS.Z,onClick:x,children:"Copy Input"})]}),(0,n.jsx)(lT,{value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||(e.preventDefault(),u())},placeholder:"Enter text to test with guardrails...",rows:8,className:"font-mono text-sm"}),(0,n.jsxs)("div",{className:"flex justify-between items-center mt-1",children:[(0,n.jsxs)(lz,{className:"text-xs text-gray-500",children:["Press ",(0,n.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Enter"})," to submit • ",(0,n.jsx)("kbd",{className:"px-1 py-0.5 bg-gray-100 border border-gray-300 rounded text-xs",children:"Shift+Enter"})," for new line"]}),(0,n.jsxs)(lz,{className:"text-xs text-gray-500",children:["Characters: ",d.length]})]})]}),(0,n.jsx)("div",{className:"pt-2",children:(0,n.jsx)(ed.z,{onClick:u,loading:t,disabled:!d.trim(),className:"w-full",children:t?"Testing ".concat(l.length," guardrail").concat(l.length>1?"s":"","..."):"Test ".concat(l.length," guardrail").concat(l.length>1?"s":"")})})]}),(0,n.jsx)(lL,{results:i,errors:r})]})]})},lB=e=>{let{guardrailsList:l,isLoading:a,accessToken:t,onClose:i}=e,[r,s]=(0,o.useState)(new Set),[d,c]=(0,o.useState)(""),[u,m]=(0,o.useState)([]),[x,p]=(0,o.useState)([]),[g,f]=(0,o.useState)(!1),j=l.filter(e=>{var l;return null===(l=e.guardrail_name)||void 0===l?void 0:l.toLowerCase().includes(d.toLowerCase())}),v=e=>{let l=new Set(r);l.has(e)?l.delete(e):l.add(e),s(l)},y=async e=>{if(0===r.size||!t)return;f(!0),m([]),p([]);let l=[],a=[];await Promise.all(Array.from(r).map(async i=>{let r=Date.now();try{let a=await (0,h.applyGuardrail)(t,i,e,null,null),s=Date.now()-r;l.push({guardrailName:i,response_text:a.response_text,latency:s})}catch(l){let e=Date.now()-r;console.error("Error testing guardrail ".concat(i,":"),l),a.push({guardrailName:i,error:l,latency:e})}})),m(l),p(a),f(!1),l.length>0&&et.Z.success("".concat(l.length," guardrail").concat(l.length>1?"s":""," applied successfully")),a.length>0&&et.Z.fromBackend("".concat(a.length," guardrail").concat(a.length>1?"s":""," failed"))};return(0,n.jsx)("div",{className:"w-full h-[calc(100vh-200px)]",children:(0,n.jsx)(lx.Z,{className:"h-full",children:(0,n.jsxs)("div",{className:"flex h-full",children:[(0,n.jsxs)("div",{className:"w-1/4 border-r border-gray-200 flex flex-col overflow-hidden",children:[(0,n.jsx)("div",{className:"p-4 border-b border-gray-200",children:(0,n.jsxs)("div",{className:"mb-3",children:[(0,n.jsx)(lN.Z,{className:"text-lg font-semibold mb-3",children:"Guardrails"}),(0,n.jsx)(eg.Z,{icon:lk.Z,placeholder:"Search guardrails...",value:d,onValueChange:c})]})}),(0,n.jsx)("div",{className:"flex-1 overflow-auto",children:a?(0,n.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,n.jsx)(H.Z,{})}):0===j.length?(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)(eD.Z,{description:d?"No guardrails match your search":"No guardrails available"})}):(0,n.jsx)(lw.Z,{dataSource:j,renderItem:e=>(0,n.jsx)(lw.Z.Item,{onClick:()=>{e.guardrail_name&&v(e.guardrail_name)},className:"cursor-pointer hover:bg-gray-50 transition-colors px-4 ".concat(r.has(e.guardrail_name||"")?"bg-blue-50 border-l-4 border-l-blue-500":"border-l-4 border-l-transparent"),children:(0,n.jsx)(lw.Z.Item.Meta,{avatar:(0,n.jsx)(z.Z,{checked:r.has(e.guardrail_name||""),onClick:l=>{l.stopPropagation(),e.guardrail_name&&v(e.guardrail_name)}}),title:(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(lC.Z,{className:"text-gray-400"}),(0,n.jsx)("span",{className:"font-medium text-gray-900",children:e.guardrail_name})]}),description:(0,n.jsxs)("div",{className:"text-xs space-y-1 mt-1",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-medium",children:"Type: "}),(0,n.jsx)("span",{className:"text-gray-600",children:e.litellm_params.guardrail})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-medium",children:"Mode: "}),(0,n.jsx)("span",{className:"text-gray-600",children:e.litellm_params.mode})]})]})})})})}),(0,n.jsx)("div",{className:"p-3 border-t border-gray-200 bg-gray-50",children:(0,n.jsxs)(lp.Z,{className:"text-xs text-gray-600",children:[r.size," of ",j.length," selected"]})})]}),(0,n.jsxs)("div",{className:"w-3/4 flex flex-col bg-white",children:[(0,n.jsx)("div",{className:"p-4 border-b border-gray-200 flex justify-between items-center",children:(0,n.jsx)(lN.Z,{className:"text-xl font-semibold mb-0",children:"Guardrail Testing Playground"})}),(0,n.jsx)("div",{className:"flex-1 overflow-auto p-4",children:0===r.size?(0,n.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-gray-400",children:[(0,n.jsx)(lC.Z,{style:{fontSize:"48px",marginBottom:"16px"}}),(0,n.jsx)(lp.Z,{className:"text-lg font-medium text-gray-600 mb-2",children:"Select Guardrails to Test"}),(0,n.jsx)(lp.Z,{className:"text-center text-gray-500 max-w-md",children:"Choose one or more guardrails from the left sidebar to start testing and comparing results."})]}):(0,n.jsx)("div",{className:"h-full",children:(0,n.jsx)(lE,{guardrailNames:Array.from(r),onSubmit:y,results:u.length>0?u:null,errors:x.length>0?x:null,isLoading:g,onClose:()=>s(new Set)})})})]})]})})})},lM=a(21609),lF=e=>{let{accessToken:l,userRole:a}=e,[t,i]=(0,o.useState)([]),[r,s]=(0,o.useState)(!1),[g,f]=(0,o.useState)(!1),[j,v]=(0,o.useState)(!1),[y,_]=(0,o.useState)(null),[b,N]=(0,o.useState)(!1),[w,k]=(0,o.useState)(null),[C,S]=(0,o.useState)(0),Z=!!a&&(0,lc.tY)(a),P=async()=>{if(l){f(!0);try{let e=await (0,h.getGuardrailsList)(l);console.log("guardrails: ".concat(JSON.stringify(e))),i(e.guardrails)}catch(e){console.error("Error fetching guardrails:",e)}finally{f(!1)}}};(0,o.useEffect)(()=>{P()},[l]);let A=async()=>{if(y&&l){v(!0);try{await (0,h.deleteGuardrailCall)(l,y.guardrail_id),et.Z.success('Guardrail "'.concat(y.guardrail_name,'" deleted successfully')),await P()}catch(e){console.error("Error deleting guardrail:",e),et.Z.fromBackend("Failed to delete guardrail")}finally{v(!1),N(!1),_(null)}}},O=y&&y.litellm_params?I(y.litellm_params.guardrail).displayName:void 0;return(0,n.jsx)("div",{className:"w-full mx-auto flex-auto overflow-y-auto m-8 p-2",children:(0,n.jsxs)(u.Z,{index:C,onIndexChange:S,children:[(0,n.jsxs)(m.Z,{className:"mb-4",children:[(0,n.jsx)(c.Z,{children:"Guardrails"}),(0,n.jsx)(c.Z,{disabled:!l||0===t.length,children:"Test Playground"})]}),(0,n.jsxs)(p.Z,{children:[(0,n.jsxs)(x.Z,{children:[(0,n.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,n.jsx)(d.Z,{onClick:()=>{w&&k(null),s(!0)},disabled:!l,children:"+ Add New Guardrail"})}),w?(0,n.jsx)(lb,{guardrailId:w,onClose:()=>k(null),accessToken:l,isAdmin:Z}):(0,n.jsx)(ld,{guardrailsList:t,isLoading:g,onDeleteClick:(e,l)=>{_(t.find(l=>l.guardrail_id===e)||null),N(!0)},accessToken:l,onGuardrailUpdated:P,isAdmin:Z,onGuardrailClick:e=>k(e)}),(0,n.jsx)(eX,{visible:r,onClose:()=>{s(!1)},accessToken:l,onSuccess:()=>{P()}}),(0,n.jsx)(lM.Z,{isOpen:b,title:"Delete Guardrail",message:"Are you sure you want to delete guardrail: ".concat(null==y?void 0:y.guardrail_name,"? This action cannot be undone."),resourceInformationTitle:"Guardrail Information",resourceInformation:[{label:"Name",value:null==y?void 0:y.guardrail_name},{label:"ID",value:null==y?void 0:y.guardrail_id,code:!0},{label:"Provider",value:O},{label:"Mode",value:null==y?void 0:y.litellm_params.mode},{label:"Default On",value:(null==y?void 0:y.litellm_params.default_on)?"Yes":"No"}],onCancel:()=>{N(!1),_(null)},onOk:A,confirmLoading:j})]}),(0,n.jsx)(x.Z,{children:(0,n.jsx)(lB,{guardrailsList:t,isLoading:g,accessToken:l,onClose:()=>S(0)})})]})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1803-3425d0cf2a3e4677.js b/litellm/proxy/_experimental/out/_next/static/chunks/1803-3425d0cf2a3e4677.js deleted file mode 100644 index e2e8606420..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1803-3425d0cf2a3e4677.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1803,1623],{69993:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(1119),a=r(2265),i={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"},s=r(55015),o=a.forwardRef(function(e,t){return a.createElement(s.Z,(0,n.Z)({},e,{ref:t,icon:i}))})},59341:function(e,t,r){"use strict";r.d(t,{Z:function(){return D}});var n=r(5853),a=r(71049),i=r(11323),s=r(2265),o=r(66797),u=r(40099),l=r(74275),c=r(59456),d=r(93980),h=r(65573),f=r(67561),m=r(87550),p=r(628),g=r(80281),v=r(31370),b=r(20131),y=r(38929),w=r(52307),k=r(52724),x=r(7935);let C=(0,s.createContext)(null);C.displayName="GroupContext";let E=s.Fragment,O=Object.assign((0,y.yV)(function(e,t){var r;let n=(0,s.useId)(),E=(0,g.Q)(),O=(0,m.B)(),{id:M=E||"headlessui-switch-".concat(n),disabled:N=O||!1,checked:q,defaultChecked:S,onChange:j,name:P,value:D,form:L,autoFocus:F=!1,...R}=e,T=(0,s.useContext)(C),[Q,V]=(0,s.useState)(null),_=(0,s.useRef)(null),A=(0,f.T)(_,t,null===T?null:T.setSwitch,V),I=(0,l.L)(S),[Z,K]=(0,u.q)(q,j,null!=I&&I),z=(0,c.G)(),[B,H]=(0,s.useState)(!1),G=(0,d.z)(()=>{H(!0),null==K||K(!Z),z.nextFrame(()=>{H(!1)})}),W=(0,d.z)(e=>{if((0,v.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),G()}),J=(0,d.z)(e=>{e.key===k.R.Space?(e.preventDefault(),G()):e.key===k.R.Enter&&(0,b.g)(e.currentTarget)}),X=(0,d.z)(e=>e.preventDefault()),Y=(0,x.wp)(),U=(0,w.zH)(),{isFocusVisible:$,focusProps:ee}=(0,a.F)({autoFocus:F}),{isHovered:et,hoverProps:er}=(0,i.X)({isDisabled:N}),{pressed:en,pressProps:ea}=(0,o.x)({disabled:N}),ei=(0,s.useMemo)(()=>({checked:Z,disabled:N,hover:et,focus:$,active:en,autofocus:F,changing:B}),[Z,et,$,en,N,B,F]),es=(0,y.dG)({id:M,ref:A,role:"switch",type:(0,h.f)(e,Q),tabIndex:-1===e.tabIndex?0:null!=(r=e.tabIndex)?r:0,"aria-checked":Z,"aria-labelledby":Y,"aria-describedby":U,disabled:N||void 0,autoFocus:F,onClick:W,onKeyUp:J,onKeyPress:X},ee,er,ea),eo=(0,s.useCallback)(()=>{if(void 0!==I)return null==K?void 0:K(I)},[K,I]),eu=(0,y.L6)();return s.createElement(s.Fragment,null,null!=P&&s.createElement(p.Mt,{disabled:N,data:{[P]:D||"on"},overrides:{type:"checkbox",checked:Z},form:L,onReset:eo}),eu({ourProps:es,theirProps:R,slot:ei,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,s.useState)(null),[a,i]=(0,x.bE)(),[o,u]=(0,w.fw)(),l=(0,s.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),c=(0,y.L6)();return s.createElement(u,{name:"Switch.Description",value:o},s.createElement(i,{name:"Switch.Label",value:a,props:{htmlFor:null==(t=l.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},s.createElement(C.Provider,{value:l},c({ourProps:{},theirProps:e,slot:{},defaultTag:E,name:"Switch.Group"}))))},Label:x.__,Description:w.dk});var M=r(44140),N=r(26898),q=r(13241),S=r(1153),j=r(47187);let P=(0,S.fn)("Switch"),D=s.forwardRef((e,t)=>{let{checked:r,defaultChecked:a=!1,onChange:i,color:o,name:u,error:l,errorMessage:c,disabled:d,required:h,tooltip:f,id:m}=e,p=(0,n._T)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:o?(0,S.bM)(o,N.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:o?(0,S.bM)(o,N.K.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[v,b]=(0,M.Z)(a,r),[y,w]=(0,s.useState)(!1),{tooltipProps:k,getReferenceProps:x}=(0,j.l)(300);return s.createElement("div",{className:"flex flex-row items-center justify-start"},s.createElement(j.Z,Object.assign({text:f},k)),s.createElement("div",Object.assign({ref:(0,S.lq)([t,k.refs.setReference]),className:(0,q.q)(P("root"),"flex flex-row relative h-5")},p,x),s.createElement("input",{type:"checkbox",className:(0,q.q)(P("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:u,required:h,checked:v,onChange:e=>{e.preventDefault()}}),s.createElement(O,{checked:v,onChange:e=>{b(e),null==i||i(e)},disabled:d,className:(0,q.q)(P("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:()=>w(!0),onBlur:()=>w(!1),id:m},s.createElement("span",{className:(0,q.q)(P("sr-only"),"sr-only")},"Switch ",v?"on":"off"),s.createElement("span",{"aria-hidden":"true",className:(0,q.q)(P("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")}),s.createElement("span",{"aria-hidden":"true",className:(0,q.q)(P("round"),v?(0,q.q)(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,q.q)("ring-2",g.ringColor):"")}))),l&&c?s.createElement("p",{className:(0,q.q)(P("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});D.displayName="Switch"},49804:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(5853),a=r(13241),i=r(1153),s=r(2265),o=r(9496);let u=(0,i.fn)("Col"),l=s.forwardRef((e,t)=>{let{numColSpan:r=1,numColSpanSm:i,numColSpanMd:l,numColSpanLg:c,children:d,className:h}=e,f=(0,n._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),m=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return s.createElement("div",Object.assign({ref:t,className:(0,a.q)(u("root"),(()=>{let e=m(r,o.PT),t=m(i,o.SP),n=m(l,o.VS),s=m(c,o._w);return(0,a.q)(e,t,n,s)})(),h)},f),d)});l.displayName="Col"},35829:function(e,t,r){"use strict";r.d(t,{Z:function(){return u}});var n=r(5853),a=r(26898),i=r(13241),s=r(1153),o=r(2265);let u=o.forwardRef((e,t)=>{let{color:r,children:u,className:l}=e,c=(0,n._T)(e,["color","children","className"]);return o.createElement("p",Object.assign({ref:t,className:(0,i.q)("font-semibold text-tremor-metric",r?(0,s.bM)(r,a.K.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",l)},c),u)});u.displayName="Metric"},44140:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(2265);let a=(e,t)=>{let r=void 0!==t,[a,i]=(0,n.useState)(e);return[r?t:a,e=>{r||i(e)}]}},23910:function(e,t,r){var n=r(74288).Symbol;e.exports=n},54506:function(e,t,r){var n=r(23910),a=r(4479),i=r(80910),s=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?a(e):i(e)}},41087:function(e,t,r){var n=r(5035),a=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(a,""):e}},17071:function(e,t,r){var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},4479:function(e,t,r){var n=r(23910),a=Object.prototype,i=a.hasOwnProperty,s=a.toString,o=n?n.toStringTag:void 0;e.exports=function(e){var t=i.call(e,o),r=e[o];try{e[o]=void 0;var n=!0}catch(e){}var a=s.call(e);return n&&(t?e[o]=r:delete e[o]),a}},80910:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},74288:function(e,t,r){var n=r(17071),a="object"==typeof self&&self&&self.Object===Object&&self,i=n||a||Function("return this")();e.exports=i},5035:function(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},7310:function(e,t,r){var n=r(28302),a=r(11121),i=r(6660),s=Math.max,o=Math.min;e.exports=function(e,t,r){var u,l,c,d,h,f,m=0,p=!1,g=!1,v=!0;if("function"!=typeof e)throw TypeError("Expected a function");function b(t){var r=u,n=l;return u=l=void 0,m=t,d=e.apply(n,r)}function y(e){var r=e-f,n=e-m;return void 0===f||r>=t||r<0||g&&n>=c}function w(){var e,r,n,i=a();if(y(i))return k(i);h=setTimeout(w,(e=i-f,r=i-m,n=t-e,g?o(n,c-r):n))}function k(e){return(h=void 0,v&&u)?b(e):(u=l=void 0,d)}function x(){var e,r=a(),n=y(r);if(u=arguments,l=this,f=r,n){if(void 0===h)return m=e=f,h=setTimeout(w,t),p?b(e):d;if(g)return clearTimeout(h),h=setTimeout(w,t),b(f)}return void 0===h&&(h=setTimeout(w,t)),d}return t=i(t)||0,n(r)&&(p=!!r.leading,c=(g="maxWait"in r)?s(i(r.maxWait)||0,t):c,v="trailing"in r?!!r.trailing:v),x.cancel=function(){void 0!==h&&clearTimeout(h),m=0,u=f=l=h=void 0},x.flush=function(){return void 0===h?d:k(a())},x}},28302:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},10303:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},78371:function(e,t,r){var n=r(54506),a=r(10303);e.exports=function(e){return"symbol"==typeof e||a(e)&&"[object Symbol]"==n(e)}},11121:function(e,t,r){var n=r(74288);e.exports=function(){return n.Date.now()}},6660:function(e,t,r){var n=r(41087),a=r(28302),i=r(78371),s=0/0,o=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return s;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=u.test(e);return r||l.test(e)?c(e.slice(2),r?2:8):o.test(e)?s:+e}},32489:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},86669:function(e,t,r){"use strict";r.d(t,{gc:function(){return w},jF:function(){return b}});var n=r(2265);let a=e=>"boolean"==typeof e||e instanceof Boolean,i=e=>"number"==typeof e||e instanceof Number,s=e=>"bigint"==typeof e||e instanceof BigInt,o=e=>!!e&&e instanceof Date,u=e=>"string"==typeof e||e instanceof String,l=e=>Array.isArray(e),c=e=>"object"==typeof e&&null!==e,d=e=>!!e&&e instanceof Object&&"function"==typeof e;function h(e,t){return void 0===t&&(t=!1),!e||t?`"${e}"`:e}function f(e){let{field:t,value:r,data:a,lastElement:i,openBracket:s,closeBracket:o,level:u,style:l,shouldExpandNode:c,clickToExpandNode:d,outerRef:f,beforeExpandChange:m}=e,p=(0,n.useRef)(!1),[g,b]=(0,n.useState)(()=>c(u,r,t)),y=(0,n.useRef)(null);(0,n.useEffect)(()=>{p.current?b(c(u,r,t)):p.current=!0},[c]);let w=(0,n.useId)();if(0===a.length)return function(e){let{field:t,openBracket:r,closeBracket:a,lastElement:i,style:s}=e;return(0,n.createElement)("div",{className:s.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||""===t)&&(0,n.createElement)("span",{className:s.label},h(t,s.quotesForFieldNames),":"),(0,n.createElement)("span",{className:s.punctuation},r),(0,n.createElement)("span",{className:s.punctuation},a),!i&&(0,n.createElement)("span",{className:s.punctuation},","))}({field:t,openBracket:s,closeBracket:o,lastElement:i,style:l});let k=g?l.collapseIcon:l.expandIcon,x=g?l.ariaLables.collapseJson:l.ariaLables.expandJson,C=u+1,E=a.length-1,O=e=>{g!==e&&(!m||m({level:u,value:r,field:t,newExpandValue:e}))&&b(e)},M=e=>{if("ArrowRight"===e.key||"ArrowLeft"===e.key)e.preventDefault(),O("ArrowRight"===e.key);else if("ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();let t="ArrowUp"===e.key?-1:1;if(!f.current)return;let r=f.current.querySelectorAll("[role=button]"),n=-1;for(let e=0;e{var e;O(!g);let t=y.current;if(!t)return;let r=null===(e=f.current)||void 0===e?void 0:e.querySelector('[role=button][tabindex="0"]');r&&(r.tabIndex=-1),t.tabIndex=0,t.focus()};return(0,n.createElement)("div",{className:l.basicChildStyle,role:"treeitem","aria-expanded":g,"aria-selected":void 0},(0,n.createElement)("span",{className:k,onClick:N,onKeyDown:M,role:"button","aria-label":x,"aria-expanded":g,"aria-controls":g?w:void 0,ref:y,tabIndex:0===u?0:-1}),(t||""===t)&&(d?(0,n.createElement)("span",{className:l.clickableLabel,onClick:N,onKeyDown:M},h(t,l.quotesForFieldNames),":"):(0,n.createElement)("span",{className:l.label},h(t,l.quotesForFieldNames),":")),(0,n.createElement)("span",{className:l.punctuation},s),g?(0,n.createElement)("ul",{id:w,role:"group",className:l.childFieldsContainer},a.map((e,t)=>(0,n.createElement)(v,{key:e[0]||t,field:e[0],value:e[1],style:l,lastElement:t===E,level:C,shouldExpandNode:c,clickToExpandNode:d,beforeExpandChange:m,outerRef:f}))):(0,n.createElement)("span",{className:l.collapsedContent,onClick:N,onKeyDown:M}),(0,n.createElement)("span",{className:l.punctuation},o),!i&&(0,n.createElement)("span",{className:l.punctuation},","))}function m(e){let{field:t,value:r,style:n,lastElement:a,shouldExpandNode:i,clickToExpandNode:s,level:o,outerRef:u,beforeExpandChange:l}=e;return f({field:t,value:r,lastElement:a||!1,level:o,openBracket:"{",closeBracket:"}",style:n,shouldExpandNode:i,clickToExpandNode:s,data:Object.keys(r).map(e=>[e,r[e]]),outerRef:u,beforeExpandChange:l})}function p(e){let{field:t,value:r,style:n,lastElement:a,level:i,shouldExpandNode:s,clickToExpandNode:o,outerRef:u,beforeExpandChange:l}=e;return f({field:t,value:r,lastElement:a||!1,level:i,openBracket:"[",closeBracket:"]",style:n,shouldExpandNode:s,clickToExpandNode:o,data:r.map(e=>[void 0,e]),outerRef:u,beforeExpandChange:l})}function g(e){let t,{field:r,value:l,style:c,lastElement:f}=e,m=c.otherValue;if(null===l)t="null",m=c.nullValue;else if(void 0===l)t="undefined",m=c.undefinedValue;else if(u(l)){var p;p=!c.noQuotesForStringValues,t=c.stringifyStringValues?JSON.stringify(l):p?`"${l}"`:l,m=c.stringValue}else a(l)?(t=l?"true":"false",m=c.booleanValue):i(l)?(t=l.toString(),m=c.numberValue):s(l)?(t=`${l.toString()}n`,m=c.numberValue):t=o(l)?l.toISOString():d(l)?"function() { }":l.toString();return(0,n.createElement)("div",{className:c.basicChildStyle,role:"treeitem","aria-selected":void 0},(r||""===r)&&(0,n.createElement)("span",{className:c.label},h(r,c.quotesForFieldNames),":"),(0,n.createElement)("span",{className:m},t),!f&&(0,n.createElement)("span",{className:c.punctuation},","))}function v(e){let t=e.value;return l(t)?(0,n.createElement)(p,Object.assign({},e)):!c(t)||o(t)||d(t)?(0,n.createElement)(g,Object.assign({},e)):(0,n.createElement)(m,Object.assign({},e))}let b={container:"_2IvMF _GzYRV",basicChildStyle:"_2bkNM",childFieldsContainer:"_1BXBN",label:"_1MGIk",clickableLabel:"_2YKJg _1MGIk _1MFti",nullValue:"_2T6PJ",undefinedValue:"_1Gho6",stringValue:"_vGjyY",booleanValue:"_3zQKs",numberValue:"_1bQdo",otherValue:"_1xvuR",punctuation:"_3uHL6 _3eOF8",collapseIcon:"_oLqym _f10Tu _1MFti _1LId0",expandIcon:"_2AXVT _f10Tu _1MFti _1UmXx",collapsedContent:"_2KJWg _1pNG9 _1MFti",noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:{collapseJson:"collapse JSON",expandJson:"expand JSON"},stringifyStringValues:!1},y=()=>!0,w=e=>{let{data:t,style:r=b,shouldExpandNode:a=y,clickToExpandNode:i=!1,beforeExpandChange:s,compactTopLevel:o,...u}=e,l=(0,n.useRef)(null);return(0,n.createElement)("div",Object.assign({"aria-label":"JSON view"},u,{className:r.container,ref:l,role:"tree"}),o&&c(t)?Object.entries(t).map(e=>{let[t,o]=e;return(0,n.createElement)(v,{key:t,field:t,value:o,style:{...b,...r},lastElement:!0,level:1,shouldExpandNode:a,clickToExpandNode:i,beforeExpandChange:s,outerRef:l})}):(0,n.createElement)(v,{value:t,style:{...b,...r},lastElement:!0,level:0,shouldExpandNode:a,clickToExpandNode:i,outerRef:l,beforeExpandChange:s}))}},52621:function(){},10900:function(e,t,r){"use strict";var n=r(2265);let a=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=a},91777:function(e,t,r){"use strict";var n=r(2265);let a=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:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});t.Z=a},47686:function(e,t,r){"use strict";var n=r(2265);let a=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:"M9 5l7 7-7 7"}))});t.Z=a},58710:function(e,t,r){"use strict";var n=r(2265);let a=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:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},82182:function(e,t,r){"use strict";var n=r(2265);let a=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.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});t.Z=a},79814:function(e,t,r){"use strict";var n=r(2265);let a=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:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});t.Z=a},2356:function(e,t,r){"use strict";var n=r(2265);let a=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:"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"}))});t.Z=a},93416:function(e,t,r){"use strict";var n=r(2265);let a=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.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"}))});t.Z=a},77355:function(e,t,r){"use strict";var n=r(2265);let a=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:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},22452:function(e,t,r){"use strict";var n=r(2265);let a=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:"M12 4v16m8-8H4"}))});t.Z=a},25327:function(e,t,r){"use strict";var n=r(2265);let a=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:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});t.Z=a},3497:function(e,t,r){"use strict";var n=r(2265);let a=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:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))});t.Z=a},2894:function(e,t,r){"use strict";r.d(t,{R:function(){return o},m:function(){return s}});var n=r(18238),a=r(7989),i=r(11255),s=class extends a.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||o(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,i.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,a=!this.#n.canStart();try{if(n)t();else{this.#a({type:"pending",variables:e,isPaused:a}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:a})}let i=await this.#n.start();return await this.#r.config.onSuccess?.(i,e,this.state.context,this,r),await this.options.onSuccess?.(i,e,this.state.context,r),await this.#r.config.onSettled?.(i,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(i,null,e,this.state.context,r),this.#a({type:"success",data:i}),i}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#a({type:"error",error:t})}}finally{this.#r.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function o(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){"use strict";r.d(t,{S:function(){return p}});var n=r(45345),a=r(21733),i=r(18238),s=r(24112),o=class extends s.l{constructor(e={}){super(),this.config=e,this.#i=new Map}#i;build(e,t,r){let i=t.queryKey,s=t.queryHash??(0,n.Rm)(i,t),o=this.get(s);return o||(o=new a.A({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){this.#i.has(e.queryHash)||(this.#i.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#i.get(e.queryHash);t&&(e.destroy(),t===e&&this.#i.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){i.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#i.get(e)}getAll(){return[...this.#i.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){i.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){i.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){i.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},u=r(2894),l=class extends s.l{constructor(e={}){super(),this.config=e,this.#s=new Set,this.#o=new Map,this.#u=0}#s;#o;#u;build(e,t,r){let n=new u.m({client:e,mutationCache:this,mutationId:++this.#u,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#s.add(e);let t=c(e);if("string"==typeof t){let r=this.#o.get(t);r?r.push(e):this.#o.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#s.delete(e)){let t=c(e);if("string"==typeof t){let r=this.#o.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#o.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=c(e);if("string"!=typeof t)return!0;{let r=this.#o.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=c(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#o.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){i.Vr.batch(()=>{this.#s.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#s.clear(),this.#o.clear()})}getAll(){return Array.from(this.#s)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){i.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return i.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function c(e){return e.options.scope?.id}var d=r(87045),h=r(57853);function f(e){return{onFetch:(t,r)=>{let a=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],o=t.state.data?.pageParams||[],u={pages:[],pageParams:[]},l=0,c=async()=>{let r=!1,c=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},d=(0,n.cG)(t.options,t.fetchOptions),h=async(e,a,i)=>{if(r)return Promise.reject();if(null==a&&e.pages.length)return Promise.resolve(e);let s=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:a,direction:i?"backward":"forward",meta:t.options.meta};return c(e),e})(),o=await d(s),{maxPages:u}=t.options,l=i?n.Ht:n.VX;return{pages:l(e.pages,o,u),pageParams:l(e.pageParams,a,u)}};if(i&&s.length){let e="backward"===i,t={pages:s,pageParams:o},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:m)(a,t);u=await h(t,r,e)}else{let t=e??s.length;do{let e=0===l?o[0]??a.initialPageParam:m(a,u);if(l>0&&null==e)break;u=await h(u,e),l++}while(lt.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c}}}function m(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var p=class{#l;#r;#c;#d;#h;#f;#m;#p;constructor(e={}){this.#l=e.queryCache||new o,this.#r=e.mutationCache||new l,this.#c=e.defaultOptions||{},this.#d=new Map,this.#h=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#m=d.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onFocus())}),this.#p=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#m?.(),this.#m=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#l.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#l.build(this,t),a=r.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#l.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let a=this.defaultQueryOptions({queryKey:e}),i=this.#l.get(a.queryHash),s=i?.state.data,o=(0,n.SE)(t,s);if(void 0!==o)return this.#l.build(this,a).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return i.Vr.batch(()=>this.#l.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state}removeQueries(e){let t=this.#l;i.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#l;return i.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(i.Vr.batch(()=>this.#l.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return i.Vr.batch(()=>(this.#l.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(i.Vr.batch(()=>this.#l.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#l.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=f(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=f(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#l}getMutationCache(){return this.#r}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#d.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#l.clear(),this.#r.clear()}}},92668:function(e,t,r){"use strict";r.d(t,{I:function(){return o}});var n=r(59121),a=r(31091),i=r(63497),s=r(99649);function o(e,t){let{years:r=0,months:o=0,weeks:u=0,days:l=0,hours:c=0,minutes:d=0,seconds:h=0}=t,f=(0,s.Q)(e),m=o||r?(0,a.z)(f,o+12*r):f,p=l||u?(0,n.E)(m,l+7*u):m;return(0,i.L)(e,p.getTime()+1e3*(h+60*(d+60*c)))}},59121:function(e,t,r){"use strict";r.d(t,{E:function(){return i}});var n=r(99649),a=r(63497);function i(e,t){let r=(0,n.Q)(e);return isNaN(t)?(0,a.L)(e,NaN):(t&&r.setDate(r.getDate()+t),r)}},31091:function(e,t,r){"use strict";r.d(t,{z:function(){return i}});var n=r(99649),a=r(63497);function i(e,t){let r=(0,n.Q)(e);if(isNaN(t))return(0,a.L)(e,NaN);if(!t)return r;let i=r.getDate(),s=(0,a.L)(e,r.getTime());return(s.setMonth(r.getMonth()+t+1,0),i>=s.getDate())?s:(r.setFullYear(s.getFullYear(),s.getMonth(),i),r)}},63497:function(e,t,r){"use strict";function n(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}r.d(t,{L:function(){return n}})},99649:function(e,t,r){"use strict";function n(e){let t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):new Date("number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?e:NaN)}r.d(t,{Q:function(){return n}})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1901-4d02d1f2a71cdbf7.js b/litellm/proxy/_experimental/out/_next/static/chunks/1901-4d02d1f2a71cdbf7.js new file mode 100644 index 0000000000..f19de7216f --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1901-4d02d1f2a71cdbf7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1901],{91027:function(e,s,a){a.d(s,{Z:function(){return o}});var t=a(57437),l=a(33866),r=a(2265),n=a(9245);function i(e){let s=s=>{"disableShowNewBadge"===s.key&&e()},a=s=>{let{key:a}=s.detail;"disableShowNewBadge"===a&&e()};return window.addEventListener("storage",s),window.addEventListener(n.Qg,a),()=>{window.removeEventListener("storage",s),window.removeEventListener(n.Qg,a)}}function d(){return"true"===(0,n.le)("disableShowNewBadge")}function o(e){let{children:s}=e;return(0,r.useSyncExternalStore)(i,d)?s?(0,t.jsx)(t.Fragment,{children:s}):null:s?(0,t.jsx)(l.Z,{color:"blue",count:"New",children:s}):(0,t.jsx)(l.Z,{color:"blue",count:"New"})}},12363:function(e,s,a){a.d(s,{d:function(){return r},n:function(){return l}});var t=a(2265);let l=()=>{let[e,s]=(0,t.useState)("http://localhost:4000");return(0,t.useEffect)(()=>{{let{protocol:e,host:a}=window.location;s("".concat(e,"//").concat(a))}},[]),e},r=25},30841:function(e,s,a){a.d(s,{IE:function(){return r},LO:function(){return l},cT:function(){return n}});var t=a(19250);let l=async e=>{if(!e)return[];try{let{aliases:s}=await (0,t.keyAliasesCall)(e);return Array.from(new Set((s||[]).filter(Boolean)))}catch(e){return console.error("Error fetching all key aliases:",e),[]}},r=async(e,s)=>{if(!e)return[];try{let a=[],l=1,r=!0;for(;r;){let n=await (0,t.teamListCall)(e,s||null,null);a=[...a,...n],l{if(!e)return[];try{let s=[],a=1,l=!0;for(;l;){let r=await (0,t.organizationListCall)(e);s=[...s,...r],a{let{options:s,onApplyFilters:a,onResetFilters:o,initialValues:m={},buttonLabel:x="Filters"}=e,[u,h]=(0,l.useState)(!1),[g,p]=(0,l.useState)(m),[j,f]=(0,l.useState)({}),[v,y]=(0,l.useState)({}),[b,N]=(0,l.useState)({}),[w,_]=(0,l.useState)({}),k=(0,l.useCallback)(c()(async(e,s)=>{if(s.isSearchable&&s.searchFn){y(e=>({...e,[s.name]:!0}));try{let a=await s.searchFn(e);f(e=>({...e,[s.name]:a}))}catch(e){console.error("Error searching:",e),f(e=>({...e,[s.name]:[]}))}finally{y(e=>({...e,[s.name]:!1}))}}},300),[]),S=(0,l.useCallback)(async e=>{if(e.isSearchable&&e.searchFn&&!w[e.name]){y(s=>({...s,[e.name]:!0})),_(s=>({...s,[e.name]:!0}));try{let s=await e.searchFn("");f(a=>({...a,[e.name]:s}))}catch(s){console.error("Error loading initial options:",s),f(s=>({...s,[e.name]:[]}))}finally{y(s=>({...s,[e.name]:!1}))}}},[w]);(0,l.useEffect)(()=>{u&&s.forEach(e=>{e.isSearchable&&!w[e.name]&&S(e)})},[u,s,S,w]);let C=(e,s)=>{let t={...g,[e]:s};p(t),a(t)},L=(e,s)=>{e&&s.isSearchable&&!w[s.name]&&S(s)};return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,t.jsx)(r.ZP,{icon:(0,t.jsx)(d.Z,{className:"h-4 w-4"}),onClick:()=>h(!u),className:"flex items-center gap-2",children:x}),(0,t.jsx)(r.ZP,{onClick:()=>{let e={};s.forEach(s=>{e[s.name]=""}),p(e),o()},children:"Reset Filters"})]}),u&&(0,t.jsx)("div",{className:"grid grid-cols-3 gap-x-6 gap-y-4 mb-6",children:["Team ID","Status","Organization ID","Key Alias","User ID","End User","Error Code","Key Hash","Model"].map(e=>{let a=s.find(s=>s.label===e||s.name===e);return a?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{className:"text-sm text-gray-600",children:a.label||a.name}),a.isSearchable?(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),onDropdownVisibleChange:e=>L(e,a),onSearch:e=>{N(s=>({...s,[a.name]:e})),a.searchFn&&k(e,a)},filterOption:!1,loading:v[a.name],options:j[a.name]||[],allowClear:!0,notFoundContent:v[a.name]?"Loading...":"No results found"}):a.options?(0,t.jsx)(n.default,{className:"w-full",placeholder:"Select ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),allowClear:!0,children:a.options.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:e.label},e.value))}):(0,t.jsx)(i.default,{className:"w-full",placeholder:"Enter ".concat(a.label||a.name,"..."),value:g[a.name]||"",onChange:e=>C(a.name,e.target.value),allowClear:!0})]},a.name):null})})]})}},31901:function(e,s,a){a.d(s,{I:function(){return eU},Z:function(){return eV}});var t=a(57437),l=a(77398),r=a.n(l),n=a(11713),i=a(2265),d=a(29827),o=a(19250),c=a(12322),m=a(59872),x=a(41649),u=a(78489),h=a(99981),g=a(42673);let p=e=>{try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}).replace(",","")}catch(e){return"Error converting time"}},j=e=>{let{utcTime:s}=e;return(0,t.jsx)("span",{style:{fontFamily:"monospace",width:"180px",display:"inline-block"},children:p(s)})},f=(e,s)=>{var a,t;return(null===(t=e.metadata)||void 0===t?void 0:null===(a=t.mcp_tool_call_metadata)||void 0===a?void 0:a.mcp_server_logo_url)?e.metadata.mcp_tool_call_metadata.mcp_server_logo_url:s?(0,g.dr)(s).logo:""},v=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform duration-75 ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Time",accessorKey:"startTime",cell:e=>(0,t.jsx)(j,{utcTime:e.getValue()})},{header:"Status",accessorKey:"metadata.status",cell:e=>{let s="failure"!==(e.getValue()||"Success").toLowerCase();return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat(s?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:s?"Success":"Failure"})}},{header:"Session ID",accessorKey:"session_id",cell:e=>{let s=String(e.getValue()||""),a=e.row.original.onSessionClick;return(0,t.jsx)(h.Z,{title:String(e.getValue()||""),children:(0,t.jsx)(u.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal text-xs max-w-[15ch] truncate block",onClick:()=>null==a?void 0:a(s),children:String(e.getValue()||"")})})}},{header:"Request ID",accessorKey:"request_id",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||""),children:(0,t.jsx)("span",{className:"font-mono text-xs max-w-[15ch] truncate block",children:String(e.getValue()||"")})})},{header:"Cost",accessorKey:"spend",cell:e=>(0,t.jsx)(h.Z,{title:"$".concat(String(e.getValue()||0)," "),children:(0,t.jsx)("span",{children:(0,m.GS)(e.getValue()||0)})})},{header:"Duration (s)",accessorKey:"duration",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Team Name",accessorKey:"metadata.user_api_key_team_alias",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Key Hash",accessorKey:"metadata.user_api_key",cell:e=>{let s=String(e.getValue()||"-"),a=e.row.original.onKeyHashClick;return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono max-w-[15ch] truncate block cursor-pointer hover:text-blue-600",onClick:()=>null==a?void 0:a(s),children:s})})}},{header:"Key Name",accessorKey:"metadata.user_api_key_alias",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Model",accessorKey:"model",cell:e=>{let s=e.row.original,a=s.custom_llm_provider,l=String(e.getValue()||"");return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:f(s,a),alt:"",className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)(h.Z,{title:l,children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:l})})]})}},{header:"Tokens",accessorKey:"total_tokens",cell:e=>{let s=e.row.original;return(0,t.jsxs)("span",{className:"text-sm",children:[String(s.total_tokens||"0"),(0,t.jsxs)("span",{className:"text-gray-400 text-xs ml-1",children:["(",String(s.prompt_tokens||"0"),"+",String(s.completion_tokens||"0"),")"]})]})}},{header:"Internal User",accessorKey:"user",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"End User",accessorKey:"end_user",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Tags",accessorKey:"request_tags",cell:e=>{let s=e.getValue();if(!s||0===Object.keys(s).length)return"-";let a=Object.entries(s),l=a[0],r=a.slice(1);return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:(0,t.jsx)(h.Z,{title:(0,t.jsx)("div",{className:"flex flex-col gap-1",children:a.map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{children:[s,": ",String(a)]},s)})}),children:(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[l[0],": ",String(l[1]),r.length>0&&" +".concat(r.length)]})})})}}],y=e=>(0,t.jsx)(x.Z,{color:"gray",className:"flex items-center gap-1",children:(0,t.jsx)("span",{className:"whitespace-nowrap text-xs",children:e})}),b=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Timestamp",accessorKey:"updated_at",cell:e=>(0,t.jsx)(j,{utcTime:e.getValue()})},{header:"Table Name",accessorKey:"table_name",cell:e=>{let s=e.getValue(),a=s;switch(s){case"LiteLLM_VerificationToken":a="Keys";break;case"LiteLLM_TeamTable":a="Teams";break;case"LiteLLM_OrganizationTable":a="Organizations";break;case"LiteLLM_UserTable":a="Users";break;case"LiteLLM_ProxyModelTable":a="Models";break;default:a=s}return(0,t.jsx)("span",{children:a})}},{header:"Action",accessorKey:"action",cell:e=>(0,t.jsx)("span",{children:y(e.getValue())})},{header:"Changed By",accessorKey:"changed_by",cell:e=>{let s=e.row.original.changed_by,a=e.row.original.changed_by_api_key;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("div",{className:"font-medium",children:s}),a&&(0,t.jsx)(h.Z,{title:a,children:(0,t.jsxs)("div",{className:"text-xs text-muted-foreground max-w-[15ch] truncate",children:[" ",a]})})]})}},{header:"Affected Item ID",accessorKey:"object_id",cell:e=>(0,t.jsx)(()=>{let s=e.getValue(),[a,l]=(0,i.useState)(!1);if(!s)return(0,t.jsx)(t.Fragment,{children:"-"});let r=async()=>{try{await navigator.clipboard.writeText(String(s)),l(!0),setTimeout(()=>l(!1),1500)}catch(e){console.error("Failed to copy object ID: ",e)}};return(0,t.jsx)(h.Z,{title:a?"Copied!":String(s),children:(0,t.jsx)("span",{className:"max-w-[20ch] truncate block cursor-pointer hover:text-blue-600",onClick:r,children:String(s)})})},{})}],N=async(e,s,a,t)=>{console.log("prefetchLogDetails called with",e.length,"logs");let l=e.map(e=>{if(e.request_id)return console.log("Prefetching details for request_id:",e.request_id),t.prefetchQuery({queryKey:["logDetails",e.request_id,s],queryFn:async()=>{console.log("Fetching details for",e.request_id);let t=await (0,o.uiSpendLogDetailsCall)(a,e.request_id,s);return console.log("Received details for",e.request_id,":",t?"success":"failed"),t},staleTime:6e5,gcTime:6e5})});try{let e=await Promise.all(l);return console.log("All prefetch promises completed:",e.length),e}catch(e){throw console.error("Error in prefetchLogDetails:",e),e}};var w=a(9114),_=a(86669);function k(e){let{row:s,hasMessages:a,hasResponse:l,hasError:r,errorInfo:n,getRawRequest:i,formattedResponse:d}=e,o=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 a=document.execCommand("copy");if(document.body.removeChild(s),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},c=async()=>{await o(JSON.stringify(i(),null,2))?w.Z.success("Request copied to clipboard"):w.Z.fromBackend("Failed to copy request")},m=async()=>{await o(JSON.stringify(d(),null,2))?w.Z.success("Response copied to clipboard"):w.Z.fromBackend("Failed to copy response")};return(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request"}),(0,t.jsx)("button",{onClick:c,className:"p-1 hover:bg-gray-200 rounded",title:"Copy request",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",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.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:(0,t.jsx)("div",{className:"[&_[role='tree']]:bg-white [&_[role='tree']]:text-slate-900",children:(0,t.jsx)(_.gc,{data:i(),style:_.jF,clickToExpandNode:!0})})})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsxs)("h3",{className:"text-lg font-medium",children:["Response",r&&(0,t.jsxs)("span",{className:"ml-2 text-sm text-red-600",children:["• HTTP code ",(null==n?void 0:n.error_code)||400]})]}),(0,t.jsx)("button",{onClick:m,className:"p-1 hover:bg-gray-200 rounded",title:"Copy response",disabled:!l,children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",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.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:l?(0,t.jsx)("div",{className:"[&_[role='tree']]:bg-white [&_[role='tree']]:text-slate-900",children:(0,t.jsx)(_.gc,{data:d(),style:_.jF,clickToExpandNode:!0})}):(0,t.jsx)("div",{className:"text-gray-500 text-sm italic text-center py-4",children:"Response data not available"})})]})]})}a(52621);let S=e=>{var s;let{errorInfo:a}=e,[l,r]=i.useState({}),[n,d]=i.useState(!1),o=e=>{r(s=>({...s,[e]:!s[e]}))},c=a.traceback&&(s=a.traceback)?Array.from(s.matchAll(/File "([^"]+)", line (\d+)/g)).map(e=>{let a=e[1],t=e[2],l=a.split("/").pop()||a,r=e.index||0,n=s.indexOf('File "',r+1),i=n>-1?s.substring(r,n).trim():s.substring(r).trim(),d=i.split("\n"),o="";return d.length>1&&(o=d[d.length-1].trim()),{filePath:a,fileName:l,lineNumber:t,code:o,inFunction:i.includes(" in ")?i.split(" in ")[1].split("\n")[0]:""}}):[];return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsxs)("h3",{className:"text-lg font-medium flex items-center text-red-600",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),"Error Details"]})}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"bg-red-50 rounded-md p-4 mb-4",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20",children:"Type:"}),(0,t.jsx)("span",{className:"text-red-700",children:a.error_class||"Unknown Error"})]}),(0,t.jsxs)("div",{className:"flex mt-2",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20 flex-shrink-0",children:"Message:"}),(0,t.jsx)("span",{className:"text-red-700 break-words whitespace-pre-wrap",children:a.error_message||"Unknown error occurred"})]})]}),a.traceback&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsx)("h4",{className:"font-medium",children:"Traceback"}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)("button",{onClick:()=>{let e=!n;if(d(e),c.length>0){let s={};c.forEach((a,t)=>{s[t]=e}),r(s)}},className:"text-gray-500 hover:text-gray-700 flex items-center text-sm",children:n?"Collapse All":"Expand All"}),(0,t.jsxs)("button",{onClick:()=>navigator.clipboard.writeText(a.traceback||""),className:"text-gray-500 hover:text-gray-700 flex items-center",title:"Copy traceback",children:[(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",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.jsx)("span",{className:"ml-1",children:"Copy"})]})]})]}),(0,t.jsx)("div",{className:"bg-white rounded-md border border-gray-200 overflow-hidden shadow-sm",children:c.map((e,s)=>(0,t.jsxs)("div",{className:"border-b border-gray-200 last:border-b-0",children:[(0,t.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between cursor-pointer hover:bg-gray-50",onClick:()=>o(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-gray-400 mr-2 w-12 text-right",children:e.lineNumber}),(0,t.jsx)("span",{className:"text-gray-600 font-medium",children:e.fileName}),(0,t.jsx)("span",{className:"text-gray-500 mx-1",children:"in"}),(0,t.jsx)("span",{className:"text-indigo-600 font-medium",children:e.inFunction||e.fileName})]}),(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-500 transition-transform ".concat(l[s]?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),(l[s]||!1)&&e.code&&(0,t.jsx)("div",{className:"px-12 py-2 font-mono text-sm text-gray-800 bg-gray-50 overflow-x-auto border-t border-gray-100",children:e.code})]},s))})]})]})]})};var C=a(20347);let L=e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Request/Response Data Not Available"}),(0,t.jsxs)("p",{className:"text-sm text-blue-700 mt-1",children:["To view request and response details, enable prompt storage in your LiteLLM configuration by adding the following to your ",(0,t.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded",children:"proxy_config.yaml"})," file:"]}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"general_settings:\n store_model_in_db: true\n store_prompts_in_spend_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change."})]})]}):null};var D=a(50665),M=a(12514),E=a(35829),T=a(84264),A=a(96761),R=a(10900),z=a(5545),O=a(30401),Z=a(78867);let I=e=>{let{sessionId:s,logs:a,onBack:l}=e,[r,n]=(0,i.useState)(null),[d,o]=(0,i.useState)({}),x=a.reduce((e,s)=>e+(s.spend||0),0),g=a.reduce((e,s)=>e+(s.total_tokens||0),0),p=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_read_input_tokens)||0)},0),j=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_creation_input_tokens)||0)},0),f=g+p+j,y=a.length>0?new Date(a[0].startTime):new Date;(((a.length>0?new Date(a[a.length-1].endTime):new Date).getTime()-y.getTime())/1e3).toFixed(2),a.map(e=>({time:new Date(e.startTime).toISOString(),tokens:e.total_tokens||0,cost:e.spend||0}));let b=async(e,s)=>{await (0,m.vQ)(e)&&(o(e=>({...e,[s]:!0})),setTimeout(()=>{o(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(u.Z,{icon:R.Z,variant:"light",onClick:l,className:"mb-4",children:"Back to All Logs"}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold text-gray-900",children:"Session Details"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-mono",children:s}),(0,t.jsx)(z.ZP,{type:"text",size:"small",icon:d["session-id"]?(0,t.jsx)(O.Z,{size:12}):(0,t.jsx)(Z.Z,{size:12}),onClick:()=>b(s,"session-id"),className:"left-2 z-10 transition-all duration-200 ".concat(d["session-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("a",{href:"https://docs.litellm.ai/docs/proxy/ui_logs_sessions",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 flex items-center gap-1",children:["Get started with session management here",(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:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)(M.Z,{children:[(0,t.jsx)(T.Z,{children:"Total Requests"}),(0,t.jsx)(E.Z,{children:a.length})]}),(0,t.jsxs)(M.Z,{children:[(0,t.jsx)(T.Z,{children:"Total Cost"}),(0,t.jsxs)(E.Z,{children:["$",(0,m.pw)(x,6)]})]}),(0,t.jsx)(h.Z,{title:(0,t.jsxs)("div",{className:"text-white min-w-[200px]",children:[(0,t.jsx)("div",{className:"text-lg font-medium mb-3",children:"Usage breakdown"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Input usage:"}),(0,t.jsxs)("div",{className:"space-y-2 text-sm text-gray-300",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(a.reduce((e,s)=>e+(s.prompt_tokens||0),0))})]}),p>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cached_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(p)})]}),j>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cache_creation_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(j)})]})]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-600 pt-3",children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Output usage:"}),(0,t.jsx)("div",{className:"space-y-2 text-sm text-gray-300",children:(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"output:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(a.reduce((e,s)=>e+(s.completion_tokens||0),0))})]})})]}),(0,t.jsx)("div",{className:"border-t border-gray-600 pt-3",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-base font-medium",children:"Total usage:"}),(0,t.jsx)("span",{className:"text-sm text-gray-300",children:(0,m.pw)(f)})]})})]})]}),placement:"top",overlayStyle:{minWidth:"300px"},children:(0,t.jsxs)(M.Z,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(T.Z,{children:"Total Tokens"}),(0,t.jsx)("span",{className:"text-gray-400 text-sm",children:"ⓘ"})]}),(0,t.jsx)(E.Z,{children:(0,m.pw)(f)})]})})]}),(0,t.jsx)(A.Z,{children:"Session Logs"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(c.w,{columns:v,data:a,renderSubComponent:eU,getRowCanExpand:()=>!0,loadingMessage:"Loading logs...",noDataMessage:"No logs found"})})]})};function K(e){let{data:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({});if(!s||0===s.length)return null;let d=e=>new Date(1e3*e).toLocaleString(),o=(e,s)=>"".concat(((s-e)*1e3).toFixed(2),"ms"),c=(e,s)=>{let a="".concat(e,"-").concat(s);n(e=>({...e,[a]:!e[a]}))};return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>l(!a),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 text-gray-600 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Vector Store Requests"})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:a?"Click to collapse":"Click to expand"})]}),a&&(0,t.jsx)("div",{className:"p-4",children:s.map((e,s)=>(0,t.jsxs)("div",{className:"mb-6 last:mb-0",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border p-4 mb-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Query:"}),(0,t.jsx)("span",{className:"font-mono",children:e.query})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Vector Store ID:"}),(0,t.jsx)("span",{className:"font-mono",children:e.vector_store_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{className:"flex items-center",children:(()=>{let{logo:s,displayName:a}=(0,g.dr)(e.custom_llm_provider);return(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)("img",{src:s,alt:"".concat(a," logo"),className:"h-5 w-5 mr-2"}),a]})})()})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:d(e.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:d(e.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsx)("span",{children:o(e.start_time,e.end_time)})]})]})]})}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Search Results"}),(0,t.jsx)("div",{className:"space-y-2",children:e.vector_store_search_response.data.map((e,a)=>{let l=r["".concat(s,"-").concat(a)]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 cursor-pointer",onClick:()=>c(s,a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("span",{className:"font-medium mr-2",children:["Result ",a+1]}),(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["Score: ",(0,t.jsx)("span",{className:"font-mono",children:e.score.toFixed(4)})]})]})]}),l&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:e.content.map((e,s)=>(0,t.jsxs)("div",{className:"mb-2 last:mb-0",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:e.type}),(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all bg-gray-50 p-2 rounded",children:e.text})]},s))})]},a)})})]},s))})]})}let H=e=>e>=.8?"text-green-600":"text-yellow-600";var P=e=>{let{entities:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({}),d=e=>{n(s=>({...s,[e]:!s[e]}))};return s&&0!==s.length?(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer",onClick:()=>l(!a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h4",{className:"font-medium",children:["Detected Entities (",s.length,")"]})]}),a&&(0,t.jsx)("div",{className:"space-y-2",children:s.map((e,s)=>{let a=r[s]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("span",{className:"font-medium mr-2",children:e.entity_type}),(0,t.jsxs)("span",{className:"font-mono ".concat(H(e.score)),children:["Score: ",e.score.toFixed(2)]})]}),(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["Position: ",e.start,"-",e.end]})]}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Entity Type:"}),(0,t.jsx)("span",{children:e.entity_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Position:"}),(0,t.jsxs)("span",{children:["Characters ",e.start,"-",e.end]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Confidence:"}),(0,t.jsx)("span",{className:H(e.score),children:e.score.toFixed(2)})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[e.recognition_metadata&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Recognizer:"}),(0,t.jsx)("span",{children:e.recognition_metadata.recognizer_name})]}),(0,t.jsxs)("div",{className:"flex overflow-hidden",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Identifier:"}),(0,t.jsx)("span",{className:"truncate text-xs font-mono",children:e.recognition_metadata.recognizer_identifier})]})]}),e.analysis_explanation&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Explanation:"}),(0,t.jsx)("span",{children:e.analysis_explanation})]})]})]})})]},s)})})]}):null};let F=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},q=e=>e?F("detected","red"):F("not detected","slate"),Y=e=>{let{title:s,count:a,defaultOpen:l=!0,right:r,children:n}=e,[d,o]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>o(e=>!e),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(d?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]}),(0,t.jsx)("div",{children:r})]}),d&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:n})]})},B=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})},V=()=>(0,t.jsx)("div",{className:"my-3 border-t"});var U=e=>{var s,a,l,r,n,i,d,o,c,m;let{response:x}=e;if(!x)return null;let u=null!==(n=null!==(r=x.outputs)&&void 0!==r?r:x.output)&&void 0!==n?n:[],h="GUARDRAIL_INTERVENED"===x.action?"red":"green",g=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(s=x.guardrailCoverage)||void 0===s?void 0:s.textCharacters)&&F("text guarded ".concat(null!==(i=x.guardrailCoverage.textCharacters.guarded)&&void 0!==i?i:0,"/").concat(null!==(d=x.guardrailCoverage.textCharacters.total)&&void 0!==d?d:0),"blue"),(null===(a=x.guardrailCoverage)||void 0===a?void 0:a.images)&&F("images guarded ".concat(null!==(o=x.guardrailCoverage.images.guarded)&&void 0!==o?o:0,"/").concat(null!==(c=x.guardrailCoverage.images.total)&&void 0!==c?c:0),"blue")]}),p=x.usage&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(x.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})});return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(B,{label:"Action:",children:F(null!==(m=x.action)&&void 0!==m?m:"N/A",h)}),x.actionReason&&(0,t.jsx)(B,{label:"Action Reason:",children:x.actionReason}),x.blockedResponse&&(0,t.jsx)(B,{label:"Blocked Response:",children:(0,t.jsx)("span",{className:"italic",children:x.blockedResponse})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(B,{label:"Coverage:",children:g}),(0,t.jsx)(B,{label:"Usage:",children:p})]})]}),u.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(V,{}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Outputs"}),(0,t.jsx)("div",{className:"space-y-2",children:u.map((e,s)=>{var a;return(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap",children:null!==(a=e.text)&&void 0!==a?a:(0,t.jsx)("em",{children:"(non-text output)"})})},s)})})]})]}),(null===(l=x.assessments)||void 0===l?void 0:l.length)?(0,t.jsx)("div",{className:"space-y-3",children:x.assessments.map((e,s)=>{var a,l,r,n,i,d,o,c,m,x,u,h,g,p,j,f,v,y,b,N,w,_,k,S;let C=(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.wordPolicy&&F("word","slate"),e.contentPolicy&&F("content","slate"),e.topicPolicy&&F("topic","slate"),e.sensitiveInformationPolicy&&F("sensitive-info","slate"),e.contextualGroundingPolicy&&F("contextual-grounding","slate"),e.automatedReasoningPolicy&&F("automated-reasoning","slate")]});return(0,t.jsxs)(Y,{title:"Assessment #".concat(s+1),defaultOpen:!0,right:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(null===(a=e.invocationMetrics)||void 0===a?void 0:a.guardrailProcessingLatency)!=null&&F("".concat(e.invocationMetrics.guardrailProcessingLatency," ms"),"amber"),C]}),children:[e.wordPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Word Policy"}),(null!==(f=null===(l=e.wordPolicy.customWords)||void 0===l?void 0:l.length)&&void 0!==f?f:0)>0&&(0,t.jsx)(Y,{title:"Custom Words",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.customWords.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match})]}),q(e.detected)]},s)})})}),(null!==(v=null===(r=e.wordPolicy.managedWordLists)||void 0===r?void 0:r.length)&&void 0!==v?v:0)>0&&(0,t.jsx)(Y,{title:"Managed Word Lists",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.managedWordLists.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match}),e.type&&F(e.type,"slate")]}),q(e.detected)]},s)})})})]}),(null===(i=e.contentPolicy)||void 0===i?void 0:null===(n=i.filters)||void 0===n?void 0:n.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Content Policy"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Strength"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Confidence"})]})}),(0,t.jsx)("tbody",{children:e.contentPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:F(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:q(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.filterStrength)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.confidence)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,(null===(o=e.contextualGroundingPolicy)||void 0===o?void 0:null===(d=o.filters)||void 0===d?void 0:d.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Contextual Grounding"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Score"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Threshold"})]})}),(0,t.jsx)("tbody",{children:e.contextualGroundingPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:F(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:q(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.score)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.threshold)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,e.sensitiveInformationPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Sensitive Information"}),(null!==(y=null===(c=e.sensitiveInformationPolicy.piiEntities)||void 0===c?void 0:c.length)&&void 0!==y?y:0)>0&&(0,t.jsx)(Y,{title:"PII Entities",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.piiEntities.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),e.type&&F(e.type,"slate"),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]}),q(e.detected)]},s)})})}),(null!==(b=null===(m=e.sensitiveInformationPolicy.regexes)||void 0===m?void 0:m.length)&&void 0!==b?b:0)>0&&(0,t.jsx)(Y,{title:"Custom Regexes",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.regexes.map((e,s)=>{var a,l;return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-2 bg-gray-50 rounded gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"regex"}),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.regex})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[q(e.detected),e.match&&(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]})]},s)})})})]}),(null===(u=e.topicPolicy)||void 0===u?void 0:null===(x=u.topics)||void 0===x?void 0:x.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Topic Policy"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.topicPolicy.topics.map((e,s)=>{var a,l;return(0,t.jsx)("div",{className:"px-3 py-1.5 bg-gray-50 rounded-md text-xs",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[F(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"topic"}),e.type&&F(e.type,"slate"),q(e.detected)]})},s)})})]}):null,e.invocationMetrics&&(0,t.jsx)(Y,{title:"Invocation Metrics",defaultOpen:!1,children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(B,{label:"Latency (ms)",children:null!==(N=e.invocationMetrics.guardrailProcessingLatency)&&void 0!==N?N:"—"}),(0,t.jsx)(B,{label:"Coverage:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(h=e.invocationMetrics.guardrailCoverage)||void 0===h?void 0:h.textCharacters)&&F("text ".concat(null!==(w=e.invocationMetrics.guardrailCoverage.textCharacters.guarded)&&void 0!==w?w:0,"/").concat(null!==(_=e.invocationMetrics.guardrailCoverage.textCharacters.total)&&void 0!==_?_:0),"blue"),(null===(g=e.invocationMetrics.guardrailCoverage)||void 0===g?void 0:g.images)&&F("images ".concat(null!==(k=e.invocationMetrics.guardrailCoverage.images.guarded)&&void 0!==k?k:0,"/").concat(null!==(S=e.invocationMetrics.guardrailCoverage.images.total)&&void 0!==S?S:0),"blue")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(B,{label:"Usage:",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.invocationMetrics.usage&&Object.entries(e.invocationMetrics.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})})})})]})}),(null===(j=e.automatedReasoningPolicy)||void 0===j?void 0:null===(p=j.findings)||void 0===p?void 0:p.length)?(0,t.jsx)(Y,{title:"Automated Reasoning Findings",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.automatedReasoningPolicy.findings.map((e,s)=>(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-2 text-xs overflow-x-auto",children:JSON.stringify(e,null,2)},s))})}):null]},s)})}):null,(0,t.jsx)(Y,{title:"Raw Bedrock Guardrail Response",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(x,null,2)})})]})};let W=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},J=e=>{let{title:s,count:a,defaultOpen:l=!0,children:r}=e,[n,d]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(e=>!e),children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(n?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]})}),n&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:r})]})},G=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})};var Q=e=>{let{response:s}=e;if(!s||"string"==typeof s)return"string"==typeof s&&s?(0,t.jsx)("div",{className:"bg-white rounded-lg border border-red-200 p-4",children:(0,t.jsxs)("div",{className:"text-red-800",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Error"}),(0,t.jsx)("p",{className:"text-sm",children:s})]})}):null;let a=Array.isArray(s)?s:[];if(0===a.length)return(0,t.jsx)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:(0,t.jsx)("div",{className:"text-gray-600 text-sm",children:"No detections found"})});let l=a.filter(e=>"pattern"===e.type),r=a.filter(e=>"blocked_word"===e.type),n=a.filter(e=>"category_keyword"===e.type),i=a.filter(e=>"BLOCK"===e.action).length,d=a.filter(e=>"MASK"===e.action).length,o=a.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(G,{label:"Total Detections:",children:(0,t.jsx)("span",{className:"font-semibold",children:o})}),(0,t.jsx)(G,{label:"Actions:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[i>0&&W("".concat(i," blocked"),"red"),d>0&&W("".concat(d," masked"),"blue"),0===i&&0===d&&W("passed","green")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(G,{label:"By Type:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[l.length>0&&W("".concat(l.length," patterns"),"slate"),r.length>0&&W("".concat(r.length," keywords"),"slate"),n.length>0&&W("".concat(n.length," categories"),"slate")]})})})]})}),l.length>0&&(0,t.jsx)(J,{title:"Patterns Matched",count:l.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:l.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Pattern:",children:e.pattern_name||"unknown"})}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:W(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),r.length>0&&(0,t.jsx)(J,{title:"Blocked Words Detected",count:r.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:r.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(G,{label:"Keyword:",mono:!0,children:e.keyword||"unknown"}),e.description&&(0,t.jsx)(G,{label:"Description:",children:e.description})]}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:W(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),n.length>0&&(0,t.jsx)(J,{title:"Category Keywords Detected",count:n.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:n.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(G,{label:"Category:",children:e.category||"unknown"}),(0,t.jsx)(G,{label:"Keyword:",mono:!0,children:e.keyword||"unknown"}),e.severity&&(0,t.jsx)(G,{label:"Severity:",children:W(e.severity,"high"===e.severity?"red":"medium"===e.severity?"amber":"slate")})]}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:W(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),(0,t.jsx)(J,{title:"Raw Detection Data",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(a,null,2)})})]})};let $=e=>new Date(1e3*e).toLocaleString(),X=new Set(["presidio","bedrock","litellm_content_filter"]),ee=e=>{let{response:s}=e,[a,l]=(0,i.useState)(!1);return(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>l(!a),children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h5",{className:"font-medium",children:"Raw Guardrail Response"})]})}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(s,null,2)})})]})})},es=e=>{var s,a;let{entry:l,index:r,total:n}=e,i=null!==(s=l.guardrail_provider)&&void 0!==s?s:"presidio",d=null!==(a=l.guardrail_status)&&void 0!==a?a:"unknown",o="success"===d.toLowerCase(),c=l.masked_entity_count||{},m=Object.values(c).reduce((e,s)=>e+("number"==typeof s?s:0),0),x=l.guardrail_response,u=Array.isArray(x)?x:[],g="bedrock"!==i||null===x||"object"!=typeof x||Array.isArray(x)?void 0:x;return(0,t.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[n>1&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("h4",{className:"text-base font-semibold",children:["Guardrail #",r+1,(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:l.guardrail_name})]}),(0,t.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md text-xs capitalize",children:i})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail Name:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_name})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Mode:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_mode})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)(h.Z,{title:o?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(o?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:d})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:$(l.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:$(l.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[l.duration.toFixed(4),"s"]})]})]})]}),m>0&&(0,t.jsxs)("div",{className:"mt-4 pt-4 border-t",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Masked Entity Summary"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(c).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-3 py-1.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[s,": ",a]},s)})})]}),"presidio"===i&&u.length>0&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(P,{entities:u})}),"bedrock"===i&&g&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(U,{response:g})}),"litellm_content_filter"===i&&x&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(Q,{response:x})}),i&&!X.has(i)&&x&&(0,t.jsx)(ee,{response:x})]})};var ea=e=>{let{data:s}=e,a=Array.isArray(s)?s.filter(e=>!!e):s?[s]:[],[l,r]=(0,i.useState)(!0),n=1===a.length?a[0].guardrail_name:"".concat(a.length," guardrails"),d=Array.from(new Set(a.map(e=>e.guardrail_status))).every(e=>"success"===(null!=e?e:"").toLowerCase()),o=a.reduce((e,s)=>e+Object.values(s.masked_entity_count||{}).reduce((e,s)=>e+("number"==typeof s?s:0),0),0);return 0===a.length?null:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>r(!l),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-600 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Guardrail Information"}),(0,t.jsx)(h.Z,{title:d?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"ml-2 px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(d?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:d?"success":"failure"})}),(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:n}),o>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-1 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[o," masked ",1===o?"entity":"entities"]})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:l?"Click to collapse":"Click to expand"})]}),l&&(0,t.jsx)("div",{className:"p-4 space-y-6",children:a.map((e,s)=>{var l;return(0,t.jsx)(es,{entry:e,index:s,total:a.length},"".concat(null!==(l=e.guardrail_name)&&void 0!==l?l:"guardrail","-").concat(s))})})]})},et=a(87452),el=a(88829),er=a(72208);let en=e=>null==e?"-":"$".concat((0,m.pw)(e,8)),ei=e=>null==e?"-":"".concat((100*e).toFixed(2),"%"),ed=e=>{var s;let{costBreakdown:a,totalSpend:l}=e;if(!a)return null;let r=void 0!==a.discount_percent&&0!==a.discount_percent||void 0!==a.discount_amount&&0!==a.discount_amount,n=void 0!==a.margin_percent&&0!==a.margin_percent||void 0!==a.margin_fixed_amount&&0!==a.margin_fixed_amount||void 0!==a.margin_total_amount&&0!==a.margin_total_amount;return void 0!==a.input_cost||void 0!==a.output_cost||r||n?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:(0,t.jsxs)(et.Z,{children:[(0,t.jsx)(er.Z,{className:"p-4 border-b hover:bg-gray-50 transition-colors text-left",children:(0,t.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,t.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:"Cost Breakdown"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 mr-4",children:[(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Total:"}),(0,t.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:en(l)})]})]})}),(0,t.jsx)(el.Z,{className:"px-0",children:(0,t.jsxs)("div",{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2 max-w-2xl",children:[(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Input Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.input_cost)})]}),(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Output Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.output_cost)})]}),void 0!==a.tool_usage_cost&&a.tool_usage_cost>0&&(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Tool Usage Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.tool_usage_cost)})]})]}),(0,t.jsx)("div",{className:"pt-2 border-t border-gray-100 max-w-2xl",children:(0,t.jsxs)("div",{className:"flex text-sm font-semibold",children:[(0,t.jsx)("span",{className:"text-gray-900 w-1/3",children:"Original LLM Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.original_cost)})]})}),(r||n)&&(0,t.jsxs)("div",{className:"pt-2 space-y-2 max-w-2xl",children:[r&&(0,t.jsxs)("div",{className:"space-y-2",children:[void 0!==a.discount_percent&&0!==a.discount_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsxs)("span",{className:"font-medium w-1/3",children:["Discount (",ei(a.discount_percent),"):"]}),(0,t.jsxs)("span",{className:"text-gray-900",children:["-",en(a.discount_amount)]})]}),void 0!==a.discount_amount&&void 0===a.discount_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Discount Amount:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:["-",en(a.discount_amount)]})]})]}),n&&(0,t.jsxs)("div",{className:"space-y-2",children:[void 0!==a.margin_percent&&0!==a.margin_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsxs)("span",{className:"font-medium w-1/3",children:["Margin (",ei(a.margin_percent),"):"]}),(0,t.jsxs)("span",{className:"text-gray-900",children:["+",en((a.margin_total_amount||0)-(a.margin_fixed_amount||0))]})]}),void 0!==a.margin_fixed_amount&&0!==a.margin_fixed_amount&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Margin:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:["+",en(a.margin_fixed_amount)]})]})]})]}),(0,t.jsx)("div",{className:"mt-4 pt-4 border-t border-gray-200 max-w-2xl",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"font-bold text-sm text-gray-900 w-1/3",children:"Final Calculated Cost:"}),(0,t.jsx)("span",{className:"text-sm font-bold text-gray-900",children:en(null!==(s=a.total_cost)&&void 0!==s?s:l)})]})})]})})]})}):null};var eo=a(23048),ec=a(30841),em=a(7310),ex=a.n(em),eu=a(12363);let eh={TEAM_ID:"Team ID",KEY_HASH:"Key Hash",REQUEST_ID:"Request ID",MODEL:"Model",USER_ID:"User ID",END_USER:"End User",STATUS:"Status",KEY_ALIAS:"Key Alias",ERROR_CODE:"Error Code"};var eg=a(59341),ep=a(12485),ej=a(18135),ef=a(35242),ev=a(29706),ey=a(77991),eb=a(92280);let eN="".concat("../ui/assets/","audit-logs-preview.png");function ew(e){let{userID:s,userRole:a,token:l,accessToken:d,isActive:x,premiumUser:u,allTeams:h}=e,[g,p]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),j=(0,i.useRef)(null),f=(0,i.useRef)(null),[v,y]=(0,i.useState)(1),[N]=(0,i.useState)(50),[w,_]=(0,i.useState)({}),[k,S]=(0,i.useState)(""),[C,L]=(0,i.useState)(""),[D,M]=(0,i.useState)(""),[E,T]=(0,i.useState)("all"),[A,R]=(0,i.useState)("all"),[z,O]=(0,i.useState)(!1),[Z,I]=(0,i.useState)(!1),K=(0,n.a)({queryKey:["all_audit_logs",d,l,a,s,g],queryFn:async()=>{if(!d||!l||!a||!s)return[];let e=r()(g).utc().format("YYYY-MM-DD HH:mm:ss"),t=r()().utc().format("YYYY-MM-DD HH:mm:ss"),n=[],i=1,c=1;do{let s=await (0,o.uiAuditLogsCall)(d,e,t,i,50);n=n.concat(s.audit_logs),c=s.total_pages,i++}while(i<=c);return n},enabled:!!d&&!!l&&!!a&&!!s&&x,refetchInterval:5e3,refetchIntervalInBackground:!0}),H=(0,i.useCallback)(async e=>{if(d)try{let s=(await (0,o.keyListCall)(d,null,null,e,null,null,1,10)).keys.find(s=>s.key_alias===e);s?L(s.token):L("")}catch(e){console.error("Error fetching key hash for alias:",e),L("")}},[d]);(0,i.useEffect)(()=>{if(!d)return;let e=!1,s=!1;w["Team ID"]?k!==w["Team ID"]&&(S(w["Team ID"]),e=!0):""!==k&&(S(""),e=!0),w["Key Hash"]?C!==w["Key Hash"]&&(L(w["Key Hash"]),s=!0):w["Key Alias"]?H(w["Key Alias"]):""!==C&&(L(""),s=!0),(e||s)&&y(1)},[w,d,H,k,C]),(0,i.useEffect)(()=>{y(1)},[k,C,g,D,E,A]),(0,i.useEffect)(()=>{function e(e){j.current&&!j.current.contains(e.target)&&O(!1),f.current&&!f.current.contains(e.target)&&I(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let P=(0,i.useMemo)(()=>K.data?K.data.filter(e=>{var s,a,t,l,r,n,i;let d=!0,o=!0,c=!0,m=!0,x=!0;if(k){let r="string"==typeof e.before_value?null===(s=JSON.parse(e.before_value))||void 0===s?void 0:s.team_id:null===(a=e.before_value)||void 0===a?void 0:a.team_id,n="string"==typeof e.updated_values?null===(t=JSON.parse(e.updated_values))||void 0===t?void 0:t.team_id:null===(l=e.updated_values)||void 0===l?void 0:l.team_id;d=r===k||n===k}if(C)try{let s="string"==typeof e.before_value?JSON.parse(e.before_value):e.before_value,a="string"==typeof e.updated_values?JSON.parse(e.updated_values):e.updated_values,t=null==s?void 0:s.token,l=null==a?void 0:a.token;o="string"==typeof t&&t.includes(C)||"string"==typeof l&&l.includes(C)}catch(e){o=!1}if(D&&(c=null===(r=e.object_id)||void 0===r?void 0:r.toLowerCase().includes(D.toLowerCase())),"all"!==E&&(m=(null===(n=e.action)||void 0===n?void 0:n.toLowerCase())===E.toLowerCase()),"all"!==A){let s="";switch(A){case"keys":s="litellm_verificationtoken";break;case"teams":s="litellm_teamtable";break;case"users":s="litellm_usertable";break;default:s=A}x=(null===(i=e.table_name)||void 0===i?void 0:i.toLowerCase())===s}return d&&o&&c&&m&&x}):[],[K.data,k,C,D,E,A]),F=P.length,q=Math.ceil(F/N)||1,Y=(0,i.useMemo)(()=>{let e=(v-1)*N,s=e+N;return P.slice(e,s)},[P,v,N]),B=!K.data||0===K.data.length,V=(0,i.useCallback)(e=>{let{row:s}=e;return(0,t.jsx)(e=>{let{rowData:s}=e,{before_value:a,updated_values:l,table_name:r,action:n}=s,i=(e,s)=>{if(!e||0===Object.keys(e).length)return(0,t.jsx)(eb.x,{children:"N/A"});if(s){let s=Object.keys(e),a=["token","spend","max_budget"];if(s.every(e=>a.includes(e))&&s.length>0)return(0,t.jsxs)("div",{children:[s.includes("token")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Token:"})," ",e.token||"N/A"]}),s.includes("spend")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Spend:"})," ",void 0!==e.spend?"$".concat((0,m.pw)(e.spend,6)):"N/A"]}),s.includes("max_budget")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Max Budget:"})," ",void 0!==e.max_budget?"$".concat((0,m.pw)(e.max_budget,6)):"N/A"]})]});if(e["No differing fields detected in 'before' state"]||e["No differing fields detected in 'updated' state"]||e["No fields changed"])return(0,t.jsx)(eb.x,{children:e[Object.keys(e)[0]]})}return(0,t.jsx)("pre",{className:"p-2 bg-gray-50 border rounded text-xs overflow-auto max-h-60",children:JSON.stringify(e,null,2)})},d=a,o=l;if(("updated"===n||"rotated"===n)&&a&&l&&("LiteLLM_TeamTable"===r||"LiteLLM_UserTable"===r||"LiteLLM_VerificationToken"===r)){let e={},s={};new Set([...Object.keys(a),...Object.keys(l)]).forEach(t=>{JSON.stringify(a[t])!==JSON.stringify(l[t])&&(a.hasOwnProperty(t)&&(e[t]=a[t]),l.hasOwnProperty(t)&&(s[t]=l[t]))}),Object.keys(a).forEach(t=>{l.hasOwnProperty(t)||e.hasOwnProperty(t)||(e[t]=a[t],s[t]=void 0)}),Object.keys(l).forEach(t=>{a.hasOwnProperty(t)||s.hasOwnProperty(t)||(s[t]=l[t],e[t]=void 0)}),d=Object.keys(e).length>0?e:{"No differing fields detected in 'before' state":"N/A"},o=Object.keys(s).length>0?s:{"No differing fields detected in 'updated' state":"N/A"},0===Object.keys(e).length&&0===Object.keys(s).length&&(d={"No fields changed":"N/A"},o={"No fields changed":"N/A"})}return(0,t.jsxs)("div",{className:"-mx-4 p-4 bg-slate-100 border-y border-slate-300 grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Before Value:"}),i(d,"LiteLLM_VerificationToken"===r)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Updated Value:"}),i(o,"LiteLLM_VerificationToken"===r)]})]})},{rowData:s.original})},[]);if(!u)return(0,t.jsxs)("div",{style:{textAlign:"center",marginTop:"20px"},children:[(0,t.jsx)("h1",{style:{display:"block",marginBottom:"10px"},children:"✨ Enterprise Feature."}),(0,t.jsx)(eb.x,{style:{display:"block",marginBottom:"10px"},children:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)(eb.x,{style:{display:"block",marginBottom:"20px",fontStyle:"italic"},children:"Here's a preview of what Audit Logs offer:"}),(0,t.jsx)("img",{src:eN,alt:"Audit Logs Preview",style:{maxWidth:"100%",maxHeight:"700px",borderRadius:"8px",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",margin:"0 auto"},onError:e=>{console.error("Failed to load audit logs preview image"),e.target.style.display="none"}})]});let U=F>0?(v-1)*N+1:0,W=Math.min(v*N,F);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4"}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"border-b px-6 py-4",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold py-4",children:"Audit Logs"}),(0,t.jsx)(e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start mb-6",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Audit Logs Not Available"}),(0,t.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:"To enable audit logging, add the following configuration to your LiteLLM proxy configuration file:"}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"litellm_settings:\n store_audit_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change and proxy restart."})]})]}):null},{show:B}),(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0",children:[(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("input",{type:"text",placeholder:"Search by Object ID...",value:D,onChange:e=>M(e.target.value),className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsxs)("button",{onClick:()=>{K.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(K.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.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"})}),(0,t.jsx)("span",{children:"Refresh"})]})]})}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"relative",ref:j,children:[(0,t.jsx)("label",{htmlFor:"actionFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Action:"}),(0,t.jsxs)("button",{id:"actionFilterDisplay",onClick:()=>O(!z),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===E&&"All Actions","created"===E&&"Created","updated"===E&&"Updated","deleted"===E&&"Deleted","rotated"===E&&"Rotated"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),z&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Actions",value:"all"},{label:"Created",value:"created"},{label:"Updated",value:"updated"},{label:"Deleted",value:"deleted"},{label:"Rotated",value:"rotated"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(E===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{T(e.value),O(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("div",{className:"relative",ref:f,children:[(0,t.jsx)("label",{htmlFor:"tableFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Table:"}),(0,t.jsxs)("button",{id:"tableFilterDisplay",onClick:()=>I(!Z),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===A&&"All Tables","keys"===A&&"Keys","teams"===A&&"Teams","users"===A&&"Users"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),Z&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Tables",value:"all"},{label:"Keys",value:"keys"},{label:"Teams",value:"teams"},{label:"Users",value:"users"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(A===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{R(e.value),I(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing ",K.isLoading?"...":U," -"," ",K.isLoading?"...":W," of"," ",K.isLoading?"...":F," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",K.isLoading?"...":v," of"," ",K.isLoading?"...":q]}),(0,t.jsx)("button",{onClick:()=>y(e=>Math.max(1,e-1)),disabled:K.isLoading||1===v,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>y(e=>Math.min(q,e+1)),disabled:K.isLoading||v===q,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})]}),(0,t.jsx)(c.w,{columns:b,data:Y,renderSubComponent:V,getRowCanExpand:()=>!0})]})]})}let e_=(e,s,a)=>{if(e)return"".concat(r()(s).format("MMM D, h:mm A")," - ").concat(r()(a).format("MMM D, h:mm A"));let t=r()(),l=r()(s),n=t.diff(l,"minutes");if(n>=0&&n<2)return"Last 1 Minute";if(n>=2&&n<16)return"Last 15 Minutes";if(n>=16&&n<61)return"Last Hour";let i=t.diff(l,"hours");return i>=1&&i<5?"Last 4 Hours":i>=5&&i<25?"Last 24 Hours":i>=25&&i<169?"Last 7 Days":"".concat(l.format("MMM D")," - ").concat(t.format("MMM D"))};var ek=a(9309),eS=a(30280),eC=a(44633),eL=a(86462),eD=a(49084),eM=a(71594),eE=a(24525),eT=a(19130);function eA(e){let{keys:s,totalCount:a,isLoading:l,isFetching:r,pageIndex:n,pageSize:d,onPageChange:o}=e,[c,x]=(0,i.useState)([{id:"deleted_at",desc:!0}]),[u,g]=(0,i.useState)({pageIndex:n,pageSize:d});i.useEffect(()=>{g({pageIndex:n,pageSize:d})},[n,d]);let p=[{id:"token",accessorKey:"token",header:"Key ID",size:150,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-blue-500 text-xs truncate block max-w-[250px]",children:s||"-"})})}},{id:"key_alias",accessorKey:"key_alias",header:"Key Alias",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block max-w-[200px]",children:null!=s?s:"-"})})}},{id:"team_alias",accessorKey:"team_alias",header:"Team Alias",size:120,maxSize:180,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,maxSize:140,cell:e=>(0,t.jsx)("span",{className:"block max-w-[140px]",children:(0,m.pw)(e.getValue(),4)})},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,maxSize:150,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[150px]",children:null===s?"Unlimited":"$".concat((0,m.pw)(s))})}},{id:"user_email",accessorKey:"user_email",header:"User Email",size:160,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-xs truncate block max-w-[250px]",children:null!=s?s:"-"})})}},{id:"user_id",accessorKey:"user_id",header:"User ID",size:120,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"created_at",accessorKey:"created_at",header:"Created At",size:120,maxSize:140,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"created_by",accessorKey:"created_by",header:"Created By",size:120,maxSize:180,cell:e=>{let s=e.row.original.created_by;return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}},{id:"deleted_at",accessorKey:"deleted_at",header:"Deleted At",size:120,maxSize:140,cell:e=>{let s=e.row.original.deleted_at;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"deleted_by",accessorKey:"deleted_by",header:"Deleted By",size:120,maxSize:180,cell:e=>{let s=e.row.original.deleted_by;return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}}],j=(0,eM.b7)({data:s,columns:p,columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:c,pagination:u},onSortingChange:x,onPaginationChange:e=>{let s="function"==typeof e?e(u):e;g(s),o(s.pageIndex)},getCoreRowModel:(0,eE.sC)(),getSortedRowModel:(0,eE.tj)(),getPaginationRowModel:(0,eE.G_)(),enableSorting:!0,manualSorting:!1,manualPagination:!0,pageCount:Math.ceil(a/d)}),{pageIndex:f}=j.getState().pagination,v=f*d+1,y="".concat(v," - ").concat(Math.min((f+1)*d,a));return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between w-full mb-4",children:[l||r?(0,t.jsx)("span",{className:"inline-flex text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing ",y," of ",a," results"]}),(0,t.jsxs)("div",{className:"inline-flex items-center gap-2",children:[l||r?(0,t.jsx)("span",{className:"text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",f+1," of ",j.getPageCount()]}),(0,t.jsx)("button",{onClick:()=>j.previousPage(),disabled:l||r||!j.getCanPreviousPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>j.nextPage(),disabled:l||r||!j.getCanNextPage(),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(eT.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:j.getCenterTotalSize()},children:[(0,t.jsx)(eT.ss,{children:j.getHeaderGroups().map(e=>(0,t.jsx)(eT.SC,{children:e.headers.map(e=>(0,t.jsx)(eT.xs,{"data-header-id":e.id,className:"py-1 h-8 relative hover:bg-gray-50",style:{width:e.getSize(),maxWidth:e.column.columnDef.maxSize,position:"relative"},onMouseEnter:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&(s.style.opacity="0.5")},onMouseLeave:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&!e.column.getIsResizing()&&(s.style.opacity="0")},onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,eM.ie)(e.column.columnDef.header,e.getContext())}),(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(eC.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(eL.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(eD.Z,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"resizer ".concat(j.options.columnResizeDirection," ").concat(e.column.getIsResizing()?"isResizing":""),style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:e.column.getIsResizing()?1:0}})]})},e.id))},e.id))}),(0,t.jsx)(eT.RM,{children:l||r?(0,t.jsx)(eT.SC,{children:(0,t.jsx)(eT.pj,{colSpan:p.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading keys..."})})})}):s.length>0?j.getRowModel().rows.map(e=>(0,t.jsx)(eT.SC,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(eT.pj,{style:{width:e.column.getSize(),maxWidth:e.column.columnDef.maxSize,whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,eM.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(eT.SC,{children:(0,t.jsx)(eT.pj,{colSpan:p.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No deleted keys found"})})})})})]})})})})]})})}function eR(){let[e,s]=(0,i.useState)(0),[a]=(0,i.useState)(50),{data:l,isPending:r,isFetching:n}=(0,eS.Tv)(e+1,a);return(0,t.jsx)(eA,{keys:(null==l?void 0:l.keys)||[],totalCount:(null==l?void 0:l.total_count)||0,isLoading:r,isFetching:n,pageIndex:e,pageSize:a,onPageChange:s})}var ez=a(47359),eO=a(21626),eZ=a(97214),eI=a(28241),eK=a(58834),eH=a(69552),eP=a(71876),eF=a(46468);function eq(e){let{teams:s,isLoading:a,isFetching:l}=e,[r,n]=(0,i.useState)([{id:"deleted_at",desc:!0}]),d=[{id:"team_alias",accessorKey:"team_alias",header:"Team Name",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"team_id",accessorKey:"team_id",header:"Team ID",size:150,maxSize:250,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono text-blue-500 text-xs truncate block max-w-[250px]",children:s||"-"})})}},{id:"created_at",accessorKey:"created_at",header:"Created",size:120,maxSize:140,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"spend",accessorKey:"spend",header:"Spend (USD)",size:100,maxSize:140,cell:e=>{let s=e.row.original.spend;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:void 0!==s?(0,m.pw)(s,4):"-"})}},{id:"max_budget",accessorKey:"max_budget",header:"Budget (USD)",size:110,maxSize:150,cell:e=>{let s=e.getValue();return(0,t.jsx)("span",{className:"block max-w-[150px]",children:null==s?"No limit":"$".concat((0,m.pw)(s))})}},{id:"models",accessorKey:"models",header:"Models",size:200,maxSize:300,cell:e=>{let s=e.getValue();return Array.isArray(s)&&0!==s.length?(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 max-w-[300px]",children:[s.slice(0,3).map((e,s)=>"all-proxy-models"===e?(0,t.jsx)(x.Z,{size:"xs",color:"red",children:(0,t.jsx)(T.Z,{children:"All Proxy Models"})},s):(0,t.jsx)(x.Z,{size:"xs",color:"blue",children:(0,t.jsx)(T.Z,{children:e.length>30?"".concat((0,eF.W0)(e).slice(0,30),"..."):(0,eF.W0)(e)})},s)),s.length>3&&(0,t.jsx)(x.Z,{size:"xs",color:"gray",children:(0,t.jsxs)(T.Z,{children:["+",s.length-3," ",s.length-3==1?"more model":"more models"]})})]}):(0,t.jsx)(x.Z,{size:"xs",color:"red",children:(0,t.jsx)(T.Z,{children:"All Proxy Models"})})}},{id:"organization_id",accessorKey:"organization_id",header:"Organization",size:150,maxSize:200,cell:e=>{let s=e.getValue();return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[200px]",children:s||"-"})})}},{id:"deleted_at",accessorKey:"deleted_at",header:"Deleted At",size:120,maxSize:140,cell:e=>{let s=e.row.original.deleted_at;return(0,t.jsx)("span",{className:"block max-w-[140px]",children:s?new Date(s).toLocaleDateString():"-"})}},{id:"deleted_by",accessorKey:"deleted_by",header:"Deleted By",size:120,maxSize:180,cell:e=>{let s=e.row.original.deleted_by;return(0,t.jsx)(h.Z,{title:s||void 0,children:(0,t.jsx)("span",{className:"truncate block max-w-[180px]",children:s||"-"})})}}],o=(0,eM.b7)({data:s,columns:d,columnResizeMode:"onChange",columnResizeDirection:"ltr",state:{sorting:r},onSortingChange:n,getCoreRowModel:(0,eE.sC)(),getSortedRowModel:(0,eE.tj)(),enableSorting:!0,manualSorting:!1});return(0,t.jsx)("div",{className:"w-full h-full overflow-hidden",children:(0,t.jsxs)("div",{className:"border-b py-4 flex-1 overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between w-full mb-4",children:a||l?(0,t.jsx)("span",{className:"inline-flex text-sm text-gray-700",children:"Loading..."}):(0,t.jsxs)("span",{className:"inline-flex text-sm text-gray-700",children:["Showing ",s.length," ",1===s.length?"team":"teams"]})}),(0,t.jsx)("div",{className:"h-[75vh] overflow-auto",children:(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(eO.Z,{className:"[&_td]:py-0.5 [&_th]:py-1",style:{width:o.getCenterTotalSize()},children:[(0,t.jsx)(eK.Z,{children:o.getHeaderGroups().map(e=>(0,t.jsx)(eP.Z,{children:e.headers.map(e=>(0,t.jsx)(eH.Z,{"data-header-id":e.id,className:"py-1 h-8 relative hover:bg-gray-50",style:{width:e.getSize(),maxWidth:e.column.columnDef.maxSize,position:"relative"},onMouseEnter:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&(s.style.opacity="0.5")},onMouseLeave:()=>{let s=document.querySelector('[data-header-id="'.concat(e.id,'"] .resizer'));s&&!e.column.getIsResizing()&&(s.style.opacity="0")},onClick:e.column.getToggleSortingHandler(),children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:e.isPlaceholder?null:(0,eM.ie)(e.column.columnDef.header,e.getContext())}),(0,t.jsx)("div",{className:"w-4",children:e.column.getIsSorted()?({asc:(0,t.jsx)(eC.Z,{className:"h-4 w-4 text-blue-500"}),desc:(0,t.jsx)(eL.Z,{className:"h-4 w-4 text-blue-500"})})[e.column.getIsSorted()]:(0,t.jsx)(eD.Z,{className:"h-4 w-4 text-gray-400"})}),(0,t.jsx)("div",{onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:"resizer ".concat(o.options.columnResizeDirection," ").concat(e.column.getIsResizing()?"isResizing":""),style:{position:"absolute",right:0,top:0,height:"100%",width:"5px",background:e.column.getIsResizing()?"#3b82f6":"transparent",cursor:"col-resize",userSelect:"none",touchAction:"none",opacity:e.column.getIsResizing()?1:0}})]})},e.id))},e.id))}),(0,t.jsx)(eZ.Z,{children:a||l?(0,t.jsx)(eP.Z,{children:(0,t.jsx)(eI.Z,{colSpan:d.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"\uD83D\uDE85 Loading teams..."})})})}):s.length>0?o.getRowModel().rows.map(e=>(0,t.jsx)(eP.Z,{className:"h-8",children:e.getVisibleCells().map(e=>(0,t.jsx)(eI.Z,{style:{width:e.column.getSize(),maxWidth:e.column.columnDef.maxSize,whiteSpace:"pre-wrap",overflow:"hidden"},className:"py-0.5 max-h-8 overflow-hidden text-ellipsis whitespace-nowrap",children:(0,eM.ie)(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,t.jsx)(eP.Z,{children:(0,t.jsx)(eI.Z,{colSpan:d.length,className:"h-8 text-center",children:(0,t.jsx)("div",{className:"text-center text-gray-500",children:(0,t.jsx)("p",{children:"No deleted teams found"})})})})})]})})})})]})})}function eY(){let{data:e,isPending:s,isFetching:a}=(0,ez.iN)(1,100);return(0,t.jsx)(eq,{teams:e||[],isLoading:s,isFetching:a})}var eB=a(91027);function eV(e){var s,a,l;let{accessToken:m,token:x,userRole:u,userID:h,allTeams:g,premiumUser:p}=e,[j,f]=(0,i.useState)(""),[y,b]=(0,i.useState)(!1),[w,_]=(0,i.useState)(!1),[k,S]=(0,i.useState)(1),[L]=(0,i.useState)(50),M=(0,i.useRef)(null),E=(0,i.useRef)(null),T=(0,i.useRef)(null),[A,R]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),[z,O]=(0,i.useState)(r()().format("YYYY-MM-DDTHH:mm")),[Z,K]=(0,i.useState)(!1),[H,P]=(0,i.useState)(!1),[F,q]=(0,i.useState)(""),[Y,B]=(0,i.useState)(""),[V,U]=(0,i.useState)(""),[W,J]=(0,i.useState)(""),[G,Q]=(0,i.useState)(""),[$,X]=(0,i.useState)(null),[ee,es]=(0,i.useState)(null),[ea,et]=(0,i.useState)(""),[el,er]=(0,i.useState)(""),[en,ei]=(0,i.useState)(u&&C.lo.includes(u)),[ed,em]=(0,i.useState)("request logs"),[eb,eN]=(0,i.useState)(null),[ek,eS]=(0,i.useState)(null),eC=(0,d.NL)(),[eL,eD]=(0,i.useState)(()=>{let e=sessionStorage.getItem("isLiveTail");return null===e||JSON.parse(e)});(0,i.useEffect)(()=>{sessionStorage.setItem("isLiveTail",JSON.stringify(eL))},[eL]);let[eM,eE]=(0,i.useState)({value:24,unit:"hours"});(0,i.useEffect)(()=>{(async()=>{ee&&m&&X({...(await (0,o.keyInfoV1Call)(m,ee)).info,token:ee,api_key:ee})})()},[ee,m]),(0,i.useEffect)(()=>{function e(e){M.current&&!M.current.contains(e.target)&&_(!1),E.current&&!E.current.contains(e.target)&&b(!1),T.current&&!T.current.contains(e.target)&&P(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{u&&C.lo.includes(u)&&ei(!0)},[u]);let eT=(0,n.a)({queryKey:["logs","table",k,L,A,z,V,W,en?h:null,ea,G],queryFn:async()=>{if(!m||!x||!u||!h)return{data:[],total:0,page:1,page_size:L,total_pages:0};let e=r()(A).utc().format("YYYY-MM-DD HH:mm:ss"),s=Z?r()(z).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss"),a=await (0,o.uiSpendLogsCall)(m,W||void 0,V||void 0,void 0,e,s,k,L,en?h:void 0,el,ea,G);return await N(a.data,e,m,eC),a.data=a.data.map(s=>{let a=eC.getQueryData(["logDetails",s.request_id,e]);return(null==a?void 0:a.messages)&&(null==a?void 0:a.response)&&(s.messages=a.messages,s.response=a.response),s}),a},enabled:!!m&&!!x&&!!u&&!!h&&"request logs"===ed,refetchInterval:!!eL&&1===k&&15e3,refetchIntervalInBackground:!0}),eA=eT.data||{data:[],total:0,page:1,page_size:L||10,total_pages:1},{filters:ez,filteredLogs:eO,allTeams:eZ,allKeyAliases:eI,handleFilterChange:eK,handleFilterReset:eH}=function(e){let{logs:s,accessToken:a,startTime:t,endTime:l,pageSize:d=eu.d,isCustomDate:c,setCurrentPage:m,userID:x,userRole:u}=e,h=(0,i.useMemo)(()=>({[eh.TEAM_ID]:"",[eh.KEY_HASH]:"",[eh.REQUEST_ID]:"",[eh.MODEL]:"",[eh.USER_ID]:"",[eh.END_USER]:"",[eh.STATUS]:"",[eh.KEY_ALIAS]:"",[eh.ERROR_CODE]:""}),[]),[g,p]=(0,i.useState)(h),[j,f]=(0,i.useState)({data:[],total:0,page:1,page_size:50,total_pages:0}),v=(0,i.useRef)(0),y=(0,i.useCallback)(async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!a)return;console.log("Filters being sent to API:",e);let n=Date.now();v.current=n;let i=r()(t).utc().format("YYYY-MM-DD HH:mm:ss"),m=c?r()(l).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss");try{let t=await (0,o.uiSpendLogsCall)(a,e[eh.KEY_HASH]||void 0,e[eh.TEAM_ID]||void 0,e[eh.REQUEST_ID]||void 0,i,m,s,d,e[eh.USER_ID]||void 0,e[eh.END_USER]||void 0,e[eh.STATUS]||void 0,e[eh.MODEL]||void 0,e[eh.KEY_ALIAS]||void 0,e[eh.ERROR_CODE]||void 0);n===v.current&&t.data&&f(t)}catch(e){console.error("Error searching users:",e)}},[a,t,l,c,d]),b=(0,i.useMemo)(()=>ex()((e,s)=>y(e,s),300),[y]);(0,i.useEffect)(()=>()=>b.cancel(),[b]);let N=(0,n.a)({queryKey:["allKeys"],queryFn:async()=>{if(!a)throw Error("Access token required");return await (0,ec.LO)(a)},enabled:!!a}).data||[],w=(0,i.useMemo)(()=>!!(g[eh.KEY_ALIAS]||g[eh.KEY_HASH]||g[eh.REQUEST_ID]||g[eh.USER_ID]||g[eh.END_USER]||g[eh.ERROR_CODE]),[g]),_=(0,i.useMemo)(()=>{if(!s||!s.data)return{data:[],total:0,page:1,page_size:50,total_pages:0};if(w)return s;let e=[...s.data];return g[eh.TEAM_ID]&&(e=e.filter(e=>e.team_id===g[eh.TEAM_ID])),g[eh.STATUS]&&(e=e.filter(e=>"success"===g[eh.STATUS]?!e.status||"success"===e.status:e.status===g[eh.STATUS])),g[eh.MODEL]&&(e=e.filter(e=>e.model===g[eh.MODEL])),g[eh.KEY_HASH]&&(e=e.filter(e=>e.api_key===g[eh.KEY_HASH])),g[eh.END_USER]&&(e=e.filter(e=>e.end_user===g[eh.END_USER])),g[eh.ERROR_CODE]&&(e=e.filter(e=>{let s=(e.metadata||{}).error_information;return s&&s.error_code===g[eh.ERROR_CODE]})),{data:e,total:s.total,page:s.page,page_size:s.page_size,total_pages:s.total_pages}},[s,g,w]),k=(0,i.useMemo)(()=>w?j&&j.data&&j.data.length>0?j:s||{data:[],total:0,page:1,page_size:50,total_pages:0}:_,[w,j,_,s]),{data:S}=(0,n.a)({queryKey:["allTeamsForLogFilters",a],queryFn:async()=>a&&await (0,ec.IE)(a)||[],enabled:!!a});return{filters:g,filteredLogs:k,allKeyAliases:N,allTeams:S,handleFilterChange:e=>{p(s=>{let a={...s,...e};for(let e of Object.keys(h))e in a||(a[e]=h[e]);return JSON.stringify(a)!==JSON.stringify(s)&&(m(1),b(a,1)),a})},handleFilterReset:()=>{p(h),f({data:[],total:0,page:1,page_size:50,total_pages:0}),b(h,1)}}}({logs:eA,accessToken:m,startTime:A,endTime:z,pageSize:L,isCustomDate:Z,setCurrentPage:S,userID:h,userRole:u}),eP=(0,i.useCallback)(async e=>{if(m)try{let s=(await (0,o.keyListCall)(m,null,null,e,null,null,k,L)).keys.find(s=>s.key_alias===e);s&&J(s.token)}catch(e){console.error("Error fetching key hash for alias:",e)}},[m,k,L]);(0,i.useEffect)(()=>{m&&(ez["Team ID"]?U(ez["Team ID"]):U(""),et(ez.Status||""),Q(ez.Model||""),er(ez["End User"]||""),ez["Key Hash"]?J(ez["Key Hash"]):ez["Key Alias"]?eP(ez["Key Alias"]):J(""))},[ez,m,eP]);let eF=(0,n.a)({queryKey:["sessionLogs",ek],queryFn:async()=>{if(!m||!ek)return{data:[],total:0,page:1,page_size:50,total_pages:1};let e=await (0,o.sessionSpendLogsCall)(m,ek);return{data:e.data||e||[],total:(e.data||e||[]).length,page:1,page_size:1e3,total_pages:1}},enabled:!!m&&!!ek});if((0,i.useEffect)(()=>{var e;(null===(e=eT.data)||void 0===e?void 0:e.data)&&eb&&!eT.data.data.some(e=>e.request_id===eb)&&eN(null)},[null===(s=eT.data)||void 0===s?void 0:s.data,eb]),!m||!x||!u||!h)return null;let eq=eO.data.filter(e=>!j||e.request_id.includes(j)||e.model.includes(j)||e.user&&e.user.includes(j)).map(e=>({...e,duration:(Date.parse(e.endTime)-Date.parse(e.startTime))/1e3,onKeyHashClick:e=>es(e),onSessionClick:e=>{e&&eS(e)}}))||[],eV=(null===(l=eF.data)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:a.map(e=>({...e,onKeyHashClick:e=>es(e),onSessionClick:e=>{}})))||[],eW=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=new Set;return e.forEach(e=>{let t=e.metadata||{};if("failure"===t.status&&t.error_information){let e=t.error_information.error_code;e&&(!s||e.toLowerCase().includes(s.toLowerCase()))&&a.add(e)}}),Array.from(a).map(e=>({label:e,value:e}))},eJ=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>g&&0!==g.length?g.filter(s=>s.team_id.toLowerCase().includes(e.toLowerCase())||s.team_alias&&s.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Status",label:"Status",isSearchable:!1,options:[{label:"Success",value:"success"},{label:"Failure",value:"failure"}]},{name:"Model",label:"Model",isSearchable:!1},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>m?(await (0,ec.LO)(m)).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e})):[]},{name:"End User",label:"End User",isSearchable:!0,searchFn:async e=>{if(!m)return[];let s=await (0,o.allEndUsersCall)(m);return((null==s?void 0:s.map(e=>e.user_id))||[]).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))}},{name:"Error Code",label:"Error Code",isSearchable:!0,searchFn:async e=>eW(eA.data,e)},{name:"Key Hash",label:"Key Hash",isSearchable:!1}];if(ek&&eF.data)return(0,t.jsx)("div",{className:"w-full p-6",children:(0,t.jsx)(I,{sessionId:ek,logs:eF.data.data,onBack:()=>eS(null)})});let eG=[{label:"Last 15 Minutes",value:15,unit:"minutes"},{label:"Last Hour",value:1,unit:"hours"},{label:"Last 4 Hours",value:4,unit:"hours"},{label:"Last 24 Hours",value:24,unit:"hours"},{label:"Last 7 Days",value:7,unit:"days"}],eQ=eG.find(e=>e.value===eM.value&&e.unit===eM.unit),e$=Z?e_(Z,A,z):null==eQ?void 0:eQ.label;return(0,t.jsx)("div",{className:"w-full max-w-screen p-6 overflow-x-hidden box-border",children:(0,t.jsxs)(ej.Z,{defaultIndex:0,onIndexChange:e=>em(0===e?"request logs":"audit logs"),children:[(0,t.jsxs)(ef.Z,{children:[(0,t.jsx)(ep.Z,{children:"Request Logs"}),(0,t.jsx)(ep.Z,{children:"Audit Logs"}),(0,t.jsx)(ep.Z,{children:(0,t.jsxs)(t.Fragment,{children:["Deleted Keys ",(0,t.jsx)(eB.Z,{})]})}),(0,t.jsx)(ep.Z,{children:(0,t.jsxs)(t.Fragment,{children:["Deleted Teams ",(0,t.jsx)(eB.Z,{})]})})]}),(0,t.jsxs)(ey.Z,{children:[(0,t.jsxs)(ev.Z,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("h1",{className:"text-xl font-semibold",children:ek?(0,t.jsxs)(t.Fragment,{children:["Session: ",(0,t.jsx)("span",{className:"font-mono",children:ek}),(0,t.jsx)("button",{className:"ml-4 px-3 py-1 text-sm border rounded hover:bg-gray-50",onClick:()=>eS(null),children:"← Back to All Logs"})]}):"Request Logs"})}),$&&ee&&$.api_key===ee?(0,t.jsx)(D.Z,{keyId:ee,keyData:$,teams:g,onClose:()=>es(null),backButtonText:"Back to Logs"}):ek?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow",children:(0,t.jsx)(c.w,{columns:v,data:eV,renderSubComponent:eU,getRowCanExpand:()=>!0})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eo.Z,{options:eJ,onApplyFilters:eK,onResetFilters:eH}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full box-border",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4 w-full max-w-full box-border",children:(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"relative w-64 min-w-0 flex-shrink-0",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by Request ID",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:j,onChange:e=>f(e.target.value)}),(0,t.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,t.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,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,t.jsxs)("div",{className:"relative z-50",ref:T,children:[(0,t.jsxs)("button",{onClick:()=>P(!H),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",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:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),e$]}),H&&(0,t.jsx)("div",{className:"absolute right-0 mt-2 w-64 bg-white rounded-lg shadow-lg border p-2 z-50",children:(0,t.jsxs)("div",{className:"space-y-1",children:[eG.map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(e$===e.label?"bg-blue-50 text-blue-600":""),onClick:()=>{O(r()().format("YYYY-MM-DDTHH:mm")),R(r()().subtract(e.value,e.unit).format("YYYY-MM-DDTHH:mm")),eE({value:e.value,unit:e.unit}),K(!1),P(!1)},children:e.label},e.label)),(0,t.jsx)("div",{className:"border-t my-2"}),(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(Z?"bg-blue-50 text-blue-600":""),onClick:()=>K(!Z),children:"Custom Range"})]})})]}),(0,t.jsx)(()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Live Tail"}),(0,t.jsx)(eg.Z,{color:"green",checked:eL,defaultChecked:!0,onChange:eD})]}),{}),(0,t.jsxs)("button",{onClick:()=>{eT.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(eT.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.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"})}),(0,t.jsx)("span",{children:"Refresh"})]})]}),Z&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:A,onChange:e=>{R(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsx)("span",{className:"text-gray-500",children:"to"}),(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:z,onChange:e=>{O(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 whitespace-nowrap",children:["Showing ",eT.isLoading?"...":eO?(k-1)*L+1:0," -"," ",eT.isLoading?"...":eO?Math.min(k*L,eO.total):0," ","of ",eT.isLoading?"...":eO?eO.total:0," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 min-w-[90px]",children:["Page ",eT.isLoading?"...":k," of"," ",eT.isLoading?"...":eO?eO.total_pages:1]}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.max(1,e-1)),disabled:eT.isLoading||1===k,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.min(eO.total_pages||1,e+1)),disabled:eT.isLoading||k===(eO.total_pages||1),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}),eL&&1===k&&(0,t.jsxs)("div",{className:"mb-4 px-4 py-2 bg-green-50 border border-greem-200 rounded-md flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)("span",{className:"text-sm text-green-700",children:"Auto-refreshing every 15 seconds"})}),(0,t.jsx)("button",{onClick:()=>eD(!1),className:"text-sm text-green-600 hover:text-green-800",children:"Stop"})]}),(0,t.jsx)(c.w,{columns:v,data:eq,renderSubComponent:eU,getRowCanExpand:()=>!0})]})]})]}),(0,t.jsx)(ev.Z,{children:(0,t.jsx)(ew,{userID:h,userRole:u,token:x,accessToken:m,isActive:"audit logs"===ed,premiumUser:p,allTeams:g})}),(0,t.jsx)(ev.Z,{children:(0,t.jsx)(eR,{})}),(0,t.jsx)(ev.Z,{children:(0,t.jsx)(eY,{})})]})]})})}function eU(e){var s,a,l,r,n,i,d,o,c,x,u,g;let{row:p}=e,j=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},f=p.original.metadata||{},v="failure"===f.status,y=v?f.error_information:null,b=p.original.messages&&(Array.isArray(p.original.messages)?p.original.messages.length>0:Object.keys(p.original.messages).length>0),N=p.original.response&&Object.keys(j(p.original.response)).length>0,w=f.vector_store_request_metadata&&Array.isArray(f.vector_store_request_metadata)&&f.vector_store_request_metadata.length>0,_=null===(s=p.original.metadata)||void 0===s?void 0:s.guardrail_information,C=Array.isArray(_)?_:_?[_]:[],D=C.length>0,M=C.reduce((e,s)=>{let a=null==s?void 0:s.masked_entity_count;return a?e+Object.values(a).reduce((e,s)=>"number"==typeof s?e+s:e,0):e},0),E=1===C.length?null!==(g=null===(a=C[0])||void 0===a?void 0:a.guardrail_name)&&void 0!==g?g:"-":C.length>1?"".concat(C.length," guardrails"):"-",T=(0,ek.aS)(p.original.request_id,64);return(0,t.jsxs)("div",{className:"p-6 bg-gray-50 space-y-6 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Details"})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Request ID:"}),p.original.request_id.length>64?(0,t.jsx)(h.Z,{title:p.original.request_id,children:(0,t.jsx)("span",{className:"font-mono text-sm",children:T})}):(0,t.jsx)("span",{className:"font-mono text-sm",children:p.original.request_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model:"}),(0,t.jsx)("span",{children:p.original.model})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model ID:"}),(0,t.jsx)("span",{children:p.original.model_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Call Type:"}),(0,t.jsx)("span",{children:p.original.call_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{children:p.original.custom_llm_provider||"-"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"API Base:"}),(0,t.jsx)(h.Z,{title:p.original.api_base||"-",children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:p.original.api_base||"-"})})]}),(null==p?void 0:null===(l=p.original)||void 0===l?void 0:l.requester_ip_address)&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"IP Address:"}),(0,t.jsx)("span",{children:null==p?void 0:null===(r=p.original)||void 0===r?void 0:r.requester_ip_address})]}),D&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail:"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-mono",children:E}),M>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[M," masked"]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Tokens:"}),(0,t.jsxs)("span",{children:[p.original.total_tokens," (",p.original.prompt_tokens," prompt tokens +"," ",p.original.completion_tokens," completion tokens)"]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Read Tokens:"}),(0,t.jsx)("span",{children:(0,m.pw)((null===(i=p.original.metadata)||void 0===i?void 0:null===(n=i.additional_usage_values)||void 0===n?void 0:n.cache_read_input_tokens)||0)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Creation Tokens:"}),(0,t.jsx)("span",{children:(0,m.pw)(null===(d=p.original.metadata)||void 0===d?void 0:d.additional_usage_values.cache_creation_input_tokens)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cost:"}),(0,t.jsxs)("span",{children:["$",(0,m.pw)(p.original.spend||0,6)]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Hit:"}),(0,t.jsx)("span",{children:p.original.cache_hit})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat("failure"!==((null===(o=p.original.metadata)||void 0===o?void 0:o.status)||"Success").toLowerCase()?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:"failure"!==((null===(c=p.original.metadata)||void 0===c?void 0:c.status)||"Success").toLowerCase()?"Success":"Failure"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:p.original.startTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:p.original.endTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[p.original.duration," s."]})]}),(null===(x=p.original.metadata)||void 0===x?void 0:x.litellm_overhead_time_ms)!==void 0&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"LiteLLM Overhead:"}),(0,t.jsxs)("span",{children:[p.original.metadata.litellm_overhead_time_ms," ms"]})]})]})]})]}),(0,t.jsx)(ed,{costBreakdown:null===(u=p.original.metadata)||void 0===u?void 0:u.cost_breakdown,totalSpend:p.original.spend||0}),(0,t.jsx)(L,{show:!b&&!N}),(0,t.jsx)("div",{className:"w-full max-w-full overflow-hidden",children:(0,t.jsx)(k,{row:p,hasMessages:b,hasResponse:N,hasError:v,errorInfo:y,getRawRequest:()=>{var e;return(null===(e=p.original)||void 0===e?void 0:e.proxy_server_request)?j(p.original.proxy_server_request):j(p.original.messages)},formattedResponse:()=>v&&y?{error:{message:y.error_message||"An error occurred",type:y.error_class||"error",code:y.error_code||"unknown",param:null}}:j(p.original.response)})}),D&&(0,t.jsx)(ea,{data:_}),w&&(0,t.jsx)(K,{data:f.vector_store_request_metadata}),v&&y&&(0,t.jsx)(S,{errorInfo:y}),p.original.request_tags&&Object.keys(p.original.request_tags).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"flex justify-between items-center p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Tags"})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(p.original.request_tags).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[s,": ",String(a)]},s)})})})]}),p.original.metadata&&Object.keys(p.original.metadata).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Metadata"}),(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(p.original.metadata,null,2))},className:"p-1 hover:bg-gray-200 rounded",title:"Copy metadata",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",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.jsx)("div",{className:"p-4 overflow-auto max-h-64",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(p.original.metadata,null,2)})})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1909-3c9de76bfc43e12c.js b/litellm/proxy/_experimental/out/_next/static/chunks/1909-3c9de76bfc43e12c.js deleted file mode 100644 index 83918eda48..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1909-3c9de76bfc43e12c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1909],{62338:function(e,s,t){t.d(s,{v:function(){return a.Z}});var a=t(40278)},16312:function(e,s,t){t.d(s,{z:function(){return a.Z}});var a=t(78489)},32176:function(e,s,t){t.d(s,{Z:function(){return g}});var a=t(57437),r=t(2265),l=t(62338),n=t(50665),i=t(19250);let c=e=>{let{key:s,info:t}=e;return{token:s,...t}};var o=t(12322),d=t(99981),u=t(16312),m=t(59872),x=t(44633),h=t(86462),p=t(39760),g=e=>{let{topKeys:s,teams:t,showTags:g=!1}=e,{accessToken:j,userRole:f,userId:_,premiumUser:y}=(0,p.Z)(),[v,k]=(0,r.useState)(!1),[b,Z]=(0,r.useState)(null),[N,w]=(0,r.useState)(void 0),[q,S]=(0,r.useState)("table"),[C,T]=(0,r.useState)(new Set),D=e=>{T(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},L=async e=>{if(j)try{let s=await (0,i.keyInfoV1Call)(j,e.api_key),t=c(s);w(t),Z(e.api_key),k(!0)}catch(e){console.error("Error fetching key info:",e)}},E=()=>{k(!1),Z(null),w(void 0)};r.useEffect(()=>{let e=e=>{"Escape"===e.key&&v&&E()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[v]);let A=[{header:"Key ID",accessorKey:"api_key",cell:e=>(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsx)(d.Z,{title:e.getValue(),children:(0,a.jsx)(u.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 max-w-[200px]",onClick:()=>L(e.row.original),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})})})},{header:"Key Alias",accessorKey:"key_alias",cell:e=>e.getValue()||"-"}],F={header:"Spend (USD)",accessorKey:"spend",cell:e=>{let s=e.getValue();return s>0&&s<.01?"<$0.01":"$".concat((0,m.pw)(s,2))}},O=g?[...A,{header:"Tags",accessorKey:"tags",cell:e=>{let s=e.getValue(),t=e.row.original.api_key,r=C.has(t);if(!s||0===s.length)return"-";let l=s.sort((e,s)=>s.usage-e.usage),n=r?l:l.slice(0,2),i=s.length>2;return(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[n.map((e,s)=>(0,a.jsx)(d.Z,{title:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Tag Name:"})," ",e.tag]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Spend:"})," ",e.usage>0&&e.usage<.01?"<$0.01":"$".concat((0,m.pw)(e.usage,2))]})]}),children:(0,a.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[e.tag.slice(0,7),"..."]})},s)),i&&(0,a.jsx)("button",{onClick:()=>D(t),className:"ml-1 p-1 hover:bg-gray-200 rounded-full transition-colors",title:r?"Show fewer tags":"Show all tags",children:r?(0,a.jsx)(x.Z,{className:"h-3 w-3 text-gray-500"}):(0,a.jsx)(h.Z,{className:"h-3 w-3 text-gray-500"})})]})})}},F]:[...A,F],M=s.map(e=>({...e,display_key_alias:e.key_alias&&e.key_alias.length>10?"".concat(e.key_alias.slice(0,10),"..."):e.key_alias||"-"}));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-4 flex justify-end items-center",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>S("table"),className:"px-3 py-1 text-sm rounded-md ".concat("table"===q?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Table View"}),(0,a.jsx)("button",{onClick:()=>S("chart"),className:"px-3 py-1 text-sm rounded-md ".concat("chart"===q?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Chart View"})]})}),"chart"===q?(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(l.v,{className:"mt-4 h-40 cursor-pointer hover:opacity-90",data:M,index:"display_key_alias",categories:["spend"],colors:["cyan"],yAxisWidth:120,tickGap:5,layout:"vertical",showLegend:!1,valueFormatter:e=>"$".concat((0,m.pw)(e,2)),onValueChange:e=>L(e),showTooltip:!0,customTooltip:e=>{var s,t;let r=null===(t=e.payload)||void 0===t?void 0:null===(s=t[0])||void 0===s?void 0:s.payload;return(0,a.jsx)("div",{className:"relative z-50 p-3 bg-black/90 shadow-lg rounded-lg text-white max-w-xs",children:(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Key Alias: "}),(0,a.jsx)("span",{className:"font-mono text-gray-100 break-all",children:null==r?void 0:r.key_alias})]}),(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Key ID: "}),(0,a.jsx)("span",{className:"font-mono text-gray-100 break-all",children:null==r?void 0:r.api_key})]}),(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Spend: "}),(0,a.jsxs)("span",{className:"text-white font-medium",children:["$",(0,m.pw)(null==r?void 0:r.spend,2)]})]})]})})}})}):(0,a.jsx)("div",{className:"border rounded-lg overflow-hidden",children:(0,a.jsx)(o.w,{columns:O,data:s,renderSubComponent:()=>(0,a.jsx)(a.Fragment,{}),getRowCanExpand:()=>!1,isLoading:!1})}),v&&b&&N&&(console.log("Rendering modal with:",{isModalOpen:v,selectedKey:b,keyData:N}),(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onClick:e=>{e.target===e.currentTarget&&E()},children:(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-xl relative w-11/12 max-w-6xl max-h-[90vh] overflow-y-auto min-h-[750px]",children:[(0,a.jsx)("button",{onClick:E,className:"absolute top-4 right-4 text-gray-500 hover:text-gray-700 focus:outline-none","aria-label":"Close",children:(0,a.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})}),(0,a.jsx)("div",{className:"p-6 h-full",children:(0,a.jsx)(n.Z,{keyId:b,onClose:E,keyData:N,teams:t})})]})}))]})}},1909:function(e,s,t){t.d(s,{Z:function(){return e5}});var a=t(57437),r=t(40278),l=t(12514),n=t(49804),i=t(14042),c=t(67101),o=t(12485),d=t(18135),u=t(35242),m=t(29706),x=t(77991),h=t(21626),p=t(97214),g=t(28241),j=t(58834),f=t(69552),_=t(71876),y=t(84264),v=t(96761),k=t(51653),b=t(2265),Z=t(19250),N=t(11713),w=t(90246),q=t(20347),S=t(39760);let C=(0,w.n)("agents"),T=()=>{let{accessToken:e,userRole:s}=(0,S.Z)();return(0,N.a)({queryKey:C.list({}),queryFn:async()=>await (0,Z.getAgentsList)(e),enabled:!!e&&q.ZL.includes(s||"")})},D=(0,w.n)("customers"),L=()=>{let{accessToken:e,userRole:s}=(0,S.Z)();return(0,N.a)({queryKey:D.list({}),queryFn:async()=>await (0,Z.allEndUsersCall)(e),enabled:!!e&&q.ZL.includes(s)})};var E=t(59872),A=t(16312),F=t(75105),O=t(44851);let M={blue:"#3b82f6",cyan:"#06b6d4",indigo:"#6366f1",green:"#22c55e",red:"#ef4444",purple:"#8b5cf6"},U=e=>{let{active:s,payload:t,label:r}=e;if(s&&t&&t.length){let e=e=>e.replace("metrics.","").replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),s=(e,s)=>{let t=s.substring(s.indexOf(".")+1);if(e.metrics&&t in e.metrics)return e.metrics[t]};return(0,a.jsxs)("div",{className:"w-56 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[(0,a.jsx)("p",{className:"text-tremor-content-strong",children:r}),t.map(t=>{var r;let l=null===(r=t.dataKey)||void 0===r?void 0:r.toString();if(!l||!t.payload)return null;let n=s(t.payload,l),i=l.includes("spend"),c=void 0!==n?i?"$".concat(n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})):n.toLocaleString():"N/A",o=M[t.color]||t.color;return(0,a.jsxs)("div",{className:"flex items-center justify-between space-x-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full ring-2 ring-white drop-shadow-md",style:{backgroundColor:o}}),(0,a.jsx)("p",{className:"font-medium text-tremor-content dark:text-dark-tremor-content",children:e(l)})]}),(0,a.jsx)("p",{className:"font-medium text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",children:c})]},l)})]})}return null},V=e=>{let{categories:s,colors:t}=e,r=e=>e.replace("metrics.","").replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");return(0,a.jsx)("div",{className:"flex items-center justify-end space-x-4",children:s.map((e,s)=>{let l=M[t[s]]||t[s];return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full ring-4 ring-white",style:{backgroundColor:l}}),(0,a.jsx)("p",{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:r(e)})]},e)})})};function z(e){return e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?e/1e3+"k":e.toString()}function I(e){return 0===e?"$0":e>=1e6?"$"+e/1e6+"M":e>=1e3?"$"+e/1e3+"k":"$"+e}var R=t(29299);let Y=e=>{var s,t;let{modelName:n,metrics:i,hidePromptCachingMetrics:o=!1}=e;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Requests"}),(0,a.jsx)(v.Z,{children:i.total_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Successful Requests"}),(0,a.jsx)(v.Z,{children:i.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Tokens"}),(0,a.jsx)(v.Z,{children:i.total_tokens.toLocaleString()}),(0,a.jsxs)(y.Z,{children:[Math.round(i.total_tokens/i.total_successful_requests)," avg per successful request"]})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Spend"}),(0,a.jsxs)(v.Z,{children:["$",(0,E.pw)(i.total_spend,2)]}),(0,a.jsxs)(y.Z,{children:["$",(0,E.pw)(i.total_spend/i.total_successful_requests,3)," per successful request"]})]})]}),i.top_api_keys&&i.top_api_keys.length>0&&(0,a.jsxs)(l.Z,{className:"mt-4",children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys by Spend"}),(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)("div",{className:"grid grid-cols-1 gap-2",children:i.top_api_keys.map((e,s)=>(0,a.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"font-medium",children:e.key_alias||"".concat(e.api_key.substring(0,10),"...")}),e.team_id&&(0,a.jsxs)(y.Z,{className:"text-xs text-gray-500",children:["Team: ",e.team_id]})]}),(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsxs)(y.Z,{className:"font-medium",children:["$",(0,E.pw)(e.spend,2)]}),(0,a.jsxs)(y.Z,{className:"text-xs text-gray-500",children:[e.requests.toLocaleString()," requests | ",e.tokens.toLocaleString()," tokens"]})]})]},e.api_key))})})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(V,{categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"]})]}),(0,a.jsx)(F.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"],valueFormatter:z,customTooltip:U,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Requests per day"}),(0,a.jsx)(V,{categories:["metrics.api_requests"],colors:["blue"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.api_requests"],colors:["blue"],valueFormatter:z,customTooltip:U,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Spend per day"}),(0,a.jsx)(V,{categories:["metrics.spend"],colors:["green"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.spend"],colors:["green"],valueFormatter:e=>"$".concat((0,E.pw)(e,2,!0)),yAxisWidth:72})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Success vs Failed Requests"}),(0,a.jsx)(V,{categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"]})]}),(0,a.jsx)(F.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"],valueFormatter:z,stack:!0,customTooltip:U,showLegend:!1})]}),!o&&(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Prompt Caching Metrics"}),(0,a.jsx)(V,{categories:["metrics.cache_read_input_tokens","metrics.cache_creation_input_tokens"],colors:["cyan","purple"]})]}),(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsxs)(y.Z,{children:["Cache Read: ",(null===(s=i.total_cache_read_input_tokens)||void 0===s?void 0:s.toLocaleString())||0," tokens"]}),(0,a.jsxs)(y.Z,{children:["Cache Creation: ",(null===(t=i.total_cache_creation_input_tokens)||void 0===t?void 0:t.toLocaleString())||0," tokens"]})]}),(0,a.jsx)(F.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.cache_read_input_tokens","metrics.cache_creation_input_tokens"],colors:["cyan","purple"],valueFormatter:z,customTooltip:U,showLegend:!1})]})]})]})},$=e=>{let{modelMetrics:s,hidePromptCachingMetrics:t=!1}=e,r=Object.keys(s).sort((e,t)=>""===e?1:""===t?-1:s[t].total_spend-s[e].total_spend),n={total_requests:0,total_successful_requests:0,total_tokens:0,total_spend:0,total_cache_read_input_tokens:0,total_cache_creation_input_tokens:0,daily_data:{}};Object.values(s).forEach(e=>{n.total_requests+=e.total_requests,n.total_successful_requests+=e.total_successful_requests,n.total_tokens+=e.total_tokens,n.total_spend+=e.total_spend,n.total_cache_read_input_tokens+=e.total_cache_read_input_tokens||0,n.total_cache_creation_input_tokens+=e.total_cache_creation_input_tokens||0,e.daily_data.forEach(e=>{n.daily_data[e.date]||(n.daily_data[e.date]={prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,spend:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0}),n.daily_data[e.date].prompt_tokens+=e.metrics.prompt_tokens,n.daily_data[e.date].completion_tokens+=e.metrics.completion_tokens,n.daily_data[e.date].total_tokens+=e.metrics.total_tokens,n.daily_data[e.date].api_requests+=e.metrics.api_requests,n.daily_data[e.date].spend+=e.metrics.spend,n.daily_data[e.date].successful_requests+=e.metrics.successful_requests,n.daily_data[e.date].failed_requests+=e.metrics.failed_requests,n.daily_data[e.date].cache_read_input_tokens+=e.metrics.cache_read_input_tokens||0,n.daily_data[e.date].cache_creation_input_tokens+=e.metrics.cache_creation_input_tokens||0})});let i=Object.entries(n.daily_data).map(e=>{let[s,t]=e;return{date:s,metrics:t}}).sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime());return(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,a.jsx)(v.Z,{children:"Overall Usage"}),(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4 mb-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Requests"}),(0,a.jsx)(v.Z,{children:n.total_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Successful Requests"}),(0,a.jsx)(v.Z,{children:n.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Tokens"}),(0,a.jsx)(v.Z,{children:n.total_tokens.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Spend"}),(0,a.jsxs)(v.Z,{children:["$",(0,E.pw)(n.total_spend,2)]})]})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Total Tokens Over Time"}),(0,a.jsx)(V,{categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"]})]}),(0,a.jsx)(F.Z,{className:"mt-4",data:i,index:"date",categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"],valueFormatter:z,customTooltip:U,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Requests Over Time"}),(0,a.jsx)(F.Z,{className:"mt-4",data:i,index:"date",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["emerald","red"],valueFormatter:e=>e.toLocaleString(),stack:!0,customTooltip:U,showLegend:!1})]})]})]}),(0,a.jsx)(O.default,{defaultActiveKey:r[0],children:r.map(e=>(0,a.jsx)(O.default.Panel,{header:(0,a.jsxs)("div",{className:"flex justify-between items-center w-full",children:[(0,a.jsx)(v.Z,{children:s[e].label||"Unknown Item"}),(0,a.jsxs)("div",{className:"flex space-x-4 text-sm text-gray-500",children:[(0,a.jsxs)("span",{children:["$",(0,E.pw)(s[e].total_spend,2)]}),(0,a.jsxs)("span",{children:[s[e].total_requests.toLocaleString()," requests"]})]})]}),children:(0,a.jsx)(Y,{modelName:e||"Unknown Model",metrics:s[e],hidePromptCachingMetrics:t})},e))})]})},K=(e,s,t)=>{let a=e.metadata.key_alias||"key-hash-".concat(s),r=e.metadata.team_id;if(r){let e=(0,R.o)(r,t);return e?"".concat(a," (team: ").concat(e,")"):"".concat(a," (team_id: ").concat(r,")")}return a},P=function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a={};return e.results.forEach(e=>{Object.entries(e.breakdown[s]||{}).forEach(r=>{let[l,n]=r;a[l]||(a[l]={label:"api_keys"===s?K(n,l,t):l,total_requests:0,total_successful_requests:0,total_failed_requests:0,total_tokens:0,prompt_tokens:0,completion_tokens:0,total_spend:0,total_cache_read_input_tokens:0,total_cache_creation_input_tokens:0,top_api_keys:[],daily_data:[]}),a[l].total_requests+=n.metrics.api_requests,a[l].prompt_tokens+=n.metrics.prompt_tokens,a[l].completion_tokens+=n.metrics.completion_tokens,a[l].total_tokens+=n.metrics.total_tokens,a[l].total_spend+=n.metrics.spend,a[l].total_successful_requests+=n.metrics.successful_requests,a[l].total_failed_requests+=n.metrics.failed_requests,a[l].total_cache_read_input_tokens+=n.metrics.cache_read_input_tokens||0,a[l].total_cache_creation_input_tokens+=n.metrics.cache_creation_input_tokens||0,a[l].daily_data.push({date:e.date,metrics:{prompt_tokens:n.metrics.prompt_tokens,completion_tokens:n.metrics.completion_tokens,total_tokens:n.metrics.total_tokens,api_requests:n.metrics.api_requests,spend:n.metrics.spend,successful_requests:n.metrics.successful_requests,failed_requests:n.metrics.failed_requests,cache_read_input_tokens:n.metrics.cache_read_input_tokens||0,cache_creation_input_tokens:n.metrics.cache_creation_input_tokens||0}})})}),"api_keys"!==s&&Object.entries(a).forEach(t=>{let[r,l]=t,n={};e.results.forEach(e=>{var t;let a=null===(t=e.breakdown[s])||void 0===t?void 0:t[r];a&&"api_key_breakdown"in a&&Object.entries(a.api_key_breakdown||{}).forEach(e=>{let[s,t]=e;n[s]||(n[s]={api_key:s,key_alias:t.metadata.key_alias,team_id:t.metadata.team_id,spend:0,requests:0,tokens:0}),n[s].spend+=t.metrics.spend,n[s].requests+=t.metrics.api_requests,n[s].tokens+=t.metrics.total_tokens})}),a[r].top_api_keys=Object.values(n).sort((e,s)=>s.spend-e.spend).slice(0,5)}),Object.values(a).forEach(e=>{e.daily_data.sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime())}),a};var W=t(78489),B=t(94789),H=t(49566),G=t(10032),J=t(22116),Q=t(37592),X=t(10353),ee=t(9114),es=e=>{let{isOpen:s,onClose:t,accessToken:r}=e,[l]=G.Z.useForm(),[n,i]=(0,b.useState)(!1),[c,o]=(0,b.useState)(null),[d,u]=(0,b.useState)(!1),[m,x]=(0,b.useState)("cloudzero"),[h,p]=(0,b.useState)(!1);(0,b.useEffect)(()=>{s&&r&&g()},[s,r]);let g=async()=>{u(!0);try{let e=await fetch("/cloudzero/settings",{method:"GET",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"}});if(e.ok){let s=await e.json();o(s),l.setFieldsValue({connection_id:s.connection_id})}else if(404!==e.status){let s=await e.json();ee.Z.fromBackend("Failed to load existing settings: ".concat(s.error||"Unknown error"))}}catch(e){console.error("Error loading CloudZero settings:",e),ee.Z.fromBackend("Failed to load existing settings")}finally{u(!1)}},j=async e=>{if(!r){ee.Z.fromBackend("No access token available");return}i(!0);try{let s={...e,timezone:"UTC"},t=await fetch(c?"/cloudzero/settings":"/cloudzero/init",{method:c?"PUT":"POST",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"},body:JSON.stringify(s)}),a=await t.json();if(t.ok)return ee.Z.success(a.message||"CloudZero settings saved successfully"),o({api_key_masked:e.api_key.substring(0,4)+"****"+e.api_key.slice(-4),connection_id:e.connection_id,status:"configured"}),!0;return ee.Z.fromBackend(a.error||"Failed to save CloudZero settings"),!1}catch(e){return console.error("Error saving CloudZero settings:",e),ee.Z.fromBackend("Failed to save CloudZero settings"),!1}finally{i(!1)}},f=async()=>{if(!r){ee.Z.fromBackend("No access token available");return}p(!0);try{let e=await fetch("/cloudzero/export",{method:"POST",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"},body:JSON.stringify({limit:1e5,operation:"replace_hourly"})}),s=await e.json();e.ok?(ee.Z.success(s.message||"Export to CloudZero completed successfully"),t()):ee.Z.fromBackend(s.error||"Failed to export to CloudZero")}catch(e){console.error("Error exporting to CloudZero:",e),ee.Z.fromBackend("Failed to export to CloudZero")}finally{p(!1)}},_=async()=>{p(!0);try{ee.Z.info("CSV export functionality coming soon!"),t()}catch(e){console.error("Error exporting CSV:",e),ee.Z.fromBackend("Failed to export CSV")}finally{p(!1)}},v=async()=>{if("cloudzero"===m){if(!c){let e=await l.validateFields();if(!await j(e))return}await f()}else await _()},k=()=>{l.resetFields(),x("cloudzero"),o(null),t()},Z=[{value:"cloudzero",label:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("img",{src:"/cloudzero.png",alt:"CloudZero",className:"w-5 h-5",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{children:"Export to CloudZero"})]})},{value:"csv",label:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.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,a.jsx)("span",{children:"Export to CSV"})]})}];return(0,a.jsx)(J.Z,{title:"Export Data",open:s,onCancel:k,footer:null,width:600,destroyOnClose:!0,children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"font-medium mb-2 block",children:"Export Destination"}),(0,a.jsx)(Q.default,{value:m,onChange:x,options:Z,className:"w-full",size:"large"})]}),"cloudzero"===m&&(0,a.jsx)("div",{children:d?(0,a.jsx)("div",{className:"flex justify-center py-8",children:(0,a.jsx)(X.Z,{size:"large"})}):(0,a.jsxs)(a.Fragment,{children:[c&&(0,a.jsx)(B.Z,{title:"Existing CloudZero Configuration",icon:()=>(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.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"})}),color:"green",className:"mb-4",children:(0,a.jsxs)(y.Z,{children:["API Key: ",c.api_key_masked,(0,a.jsx)("br",{}),"Connection ID: ",c.connection_id]})}),!c&&(0,a.jsxs)(G.Z,{form:l,layout:"vertical",children:[(0,a.jsx)(G.Z.Item,{label:"CloudZero API Key",name:"api_key",rules:[{required:!0,message:"Please enter your CloudZero API key"}],children:(0,a.jsx)(H.Z,{type:"password",placeholder:"Enter your CloudZero API key"})}),(0,a.jsx)(G.Z.Item,{label:"Connection ID",name:"connection_id",rules:[{required:!0,message:"Please enter the CloudZero connection ID"}],children:(0,a.jsx)(H.Z,{placeholder:"Enter CloudZero connection ID"})})]})]})}),"csv"===m&&(0,a.jsx)(B.Z,{title:"CSV Export",icon:()=>(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),color:"blue",children:(0,a.jsx)(y.Z,{children:"Export your usage data as a CSV file for analysis in spreadsheet applications."})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-2 pt-4",children:[(0,a.jsx)(W.Z,{variant:"secondary",onClick:k,children:"Cancel"}),(0,a.jsx)(W.Z,{onClick:v,loading:n||h,disabled:n||h,children:"cloudzero"===m?"Export to CloudZero":"Export CSV"})]})]})})},et=e=>{var s,t;let{dateRange:r,selectedFilters:l}=e;return(0,a.jsxs)("div",{className:"text-sm text-gray-500",children:[null===(s=r.from)||void 0===s?void 0:s.toLocaleDateString()," - ",null===(t=r.to)||void 0===t?void 0:t.toLocaleDateString(),l.length>0&&" \xb7 ".concat(l.length," filter").concat(l.length>1?"s":"")]})},ea=t(29967),er=e=>{let{value:s,onChange:t,entityType:r}=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 block mb-2",children:"Export type"}),(0,a.jsx)(ea.ZP.Group,{value:s,onChange:e=>t(e.target.value),className:"w-full",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"flex items-start p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors",children:[(0,a.jsx)(ea.ZP,{value:"daily",className:"mt-0.5"}),(0,a.jsxs)("div",{className:"ml-3 flex-1",children:[(0,a.jsx)("div",{className:"font-medium text-sm",children:"Day-by-day breakdown"}),(0,a.jsxs)("div",{className:"text-xs text-gray-500 mt-0.5",children:["Daily metrics for each ",r]})]})]}),(0,a.jsxs)("label",{className:"flex items-start p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors",children:[(0,a.jsx)(ea.ZP,{value:"daily_with_models",className:"mt-0.5"}),(0,a.jsxs)("div",{className:"ml-3 flex-1",children:[(0,a.jsxs)("div",{className:"font-medium text-sm",children:["Day-by-day by ",r," and model"]}),(0,a.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Daily metrics split by model"})]})]})]})})]})},el=e=>{let{value:s,onChange:t}=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 block mb-2",children:"Format"}),(0,a.jsx)(Q.default,{value:s,onChange:t,className:"w-full",options:[{value:"csv",label:"CSV (Excel, Google Sheets)"},{value:"json",label:"JSON (includes metadata)"}]})]})},en=t(15452),ei=t.n(en);let ec=(e,s)=>{let t=[];return e.results.forEach(e=>{Object.entries(e.breakdown.entities||{}).forEach(a=>{var r;let[l,n]=a;t.push({Date:e.date,[s]:(null===(r=n.metadata)||void 0===r?void 0:r.team_alias)||l,["".concat(s," ID")]:l,"Spend ($)":(0,E.pw)(n.metrics.spend,4),Requests:n.metrics.api_requests,"Successful Requests":n.metrics.successful_requests,"Failed Requests":n.metrics.failed_requests,"Total Tokens":n.metrics.total_tokens,"Prompt Tokens":n.metrics.prompt_tokens||0,"Completion Tokens":n.metrics.completion_tokens||0})})}),t.sort((e,s)=>new Date(e.Date).getTime()-new Date(s.Date).getTime())},eo=(e,s)=>{let t=[];return e.results.forEach(e=>{let a={};Object.entries(e.breakdown.entities||{}).forEach(s=>{var t;let[r,l]=s;null===(t=l.metadata)||void 0===t||t.team_alias,a[r]||(a[r]={}),Object.entries(e.breakdown.models||{}).forEach(e=>{let[s,t]=e;Object.entries(l.api_key_breakdown||{}).forEach(e=>{let[t,l]=e;a[r][s]||(a[r][s]={spend:0,requests:0,successful:0,failed:0,tokens:0}),a[r][s].spend+=l.metrics.spend||0,a[r][s].requests+=l.metrics.api_requests||0,a[r][s].successful+=l.metrics.successful_requests||0,a[r][s].failed+=l.metrics.failed_requests||0,a[r][s].tokens+=l.metrics.total_tokens||0})})}),Object.entries(a).forEach(a=>{var r,l;let[n,i]=a,c=null===(r=e.breakdown.entities)||void 0===r?void 0:r[n],o=(null==c?void 0:null===(l=c.metadata)||void 0===l?void 0:l.team_alias)||n;Object.entries(i).forEach(a=>{let[r,l]=a;t.push({Date:e.date,[s]:o,["".concat(s," ID")]:n,Model:r,"Spend ($)":(0,E.pw)(l.spend,4),Requests:l.requests,Successful:l.successful,Failed:l.failed,"Total Tokens":l.tokens})})})}),t.sort((e,s)=>new Date(e.Date).getTime()-new Date(s.Date).getTime())},ed=(e,s,t)=>{switch(s){case"daily":default:return ec(e,t);case"daily_with_models":return eo(e,t)}},eu=(e,s,t,a,r)=>{var l,n;return{export_date:new Date().toISOString(),entity_type:e,date_range:{from:null===(l=s.from)||void 0===l?void 0:l.toISOString(),to:null===(n=s.to)||void 0===n?void 0:n.toISOString()},filters_applied:t.length>0?t:"None",export_scope:a,summary:{total_spend:r.metadata.total_spend,total_requests:r.metadata.total_api_requests,successful_requests:r.metadata.total_successful_requests,failed_requests:r.metadata.total_failed_requests,total_tokens:r.metadata.total_tokens}}},em=(e,s,t,a)=>{let r=ed(e,s,t),l=new Blob([ei().unparse(r)],{type:"text/csv;charset=utf-8;"}),n=window.URL.createObjectURL(l),i=document.createElement("a");i.href=n;let c="".concat(a,"_usage_").concat(s,"_").concat(new Date().toISOString().split("T")[0],".csv");i.download=c,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(n)},ex=(e,s,t,a,r,l)=>{let n=ed(e,s,t),i=new Blob([JSON.stringify({metadata:eu(a,r,l,s,e),data:n},null,2)],{type:"application/json"}),c=window.URL.createObjectURL(i),o=document.createElement("a");o.href=c;let d="".concat(a,"_usage_").concat(s,"_").concat(new Date().toISOString().split("T")[0],".json");o.download=d,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(c)};var eh=e=>{let{isOpen:s,onClose:t,entityType:r,spendData:l,dateRange:n,selectedFilters:i,customTitle:c}=e,[o,d]=(0,b.useState)("csv"),[u,m]=(0,b.useState)("daily"),[x,h]=(0,b.useState)(!1),p=r.charAt(0).toUpperCase()+r.slice(1),g=c||"Export ".concat(p," Usage"),j=async e=>{let s=e||o;h(!0);try{"csv"===s?(em(l,u,p,r),ee.Z.success("".concat(p," usage data exported successfully as CSV"))):(ex(l,u,p,r,n,i),ee.Z.success("".concat(p," usage data exported successfully as JSON"))),t()}catch(e){console.error("Error exporting data:",e),ee.Z.fromBackend("Failed to export data")}finally{h(!1)}};return(0,a.jsx)(J.Z,{title:(0,a.jsx)("span",{className:"text-base font-semibold",children:g}),open:s,onCancel:t,footer:null,width:480,destroyOnClose:!0,children:(0,a.jsxs)("div",{className:"space-y-5 py-2",children:[(0,a.jsx)(et,{dateRange:n,selectedFilters:i}),(0,a.jsx)(er,{value:u,onChange:m,entityType:r}),(0,a.jsx)(el,{value:o,onChange:d}),(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-4 border-t",children:[(0,a.jsx)(A.z,{variant:"secondary",onClick:t,disabled:x,size:"sm",children:"Cancel"}),(0,a.jsx)(A.z,{onClick:()=>j(),loading:x,disabled:x,size:"sm",children:x?"Exporting...":"Export ".concat(o.toUpperCase())})]})]})})},ep=t(19431),eg=e=>{let{dateValue:s,entityType:t,spendData:r,showFilters:l=!1,filterLabel:n,filterPlaceholder:i,selectedFilters:c=[],onFiltersChange:o,filterOptions:d=[],customTitle:u,compactLayout:m=!1}=e,[x,h]=(0,b.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsxs)("div",{className:"grid ".concat(l&&d.length>0?"grid-cols-[1fr_auto]":"grid-cols-[auto]"," items-end gap-4"),children:[l&&d.length>0&&(0,a.jsxs)("div",{children:[n&&(0,a.jsx)(ep.x,{className:"mb-2",children:n}),(0,a.jsx)(Q.default,{mode:"multiple",style:{width:"100%"},placeholder:i,value:c,onChange:o,options:d,allowClear:!0})]}),(0,a.jsx)("div",{className:"justify-self-end",children:(0,a.jsx)(ep.z,{onClick:()=>h(!0),icon:()=>(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),children:"Export Data"})})]})}),(0,a.jsx)(eh,{isOpen:x,onClose:()=>h(!1),entityType:t,spendData:r,dateRange:s,selectedFilters:c,customTitle:u})]})},ej=t(42673),ef=t(5540),e_=t(49634),ey=t(77398),ev=t.n(ey);let ek=[{label:"Today",shortLabel:"today",getValue:()=>({from:ev()().startOf("day").toDate(),to:ev()().endOf("day").toDate()})},{label:"Last 7 days",shortLabel:"7d",getValue:()=>({from:ev()().subtract(7,"days").startOf("day").toDate(),to:ev()().endOf("day").toDate()})},{label:"Last 30 days",shortLabel:"30d",getValue:()=>({from:ev()().subtract(30,"days").startOf("day").toDate(),to:ev()().endOf("day").toDate()})},{label:"Month to date",shortLabel:"MTD",getValue:()=>({from:ev()().startOf("month").toDate(),to:ev()().endOf("day").toDate()})},{label:"Year to date",shortLabel:"YTD",getValue:()=>({from:ev()().startOf("year").toDate(),to:ev()().endOf("day").toDate()})}];var eb=e=>{let{value:s,onValueChange:t,label:r="Select Time Range",showTimeRange:l=!0}=e,[n,i]=(0,b.useState)(!1),[c,o]=(0,b.useState)(s),[d,u]=(0,b.useState)(null),[m,x]=(0,b.useState)(""),[h,p]=(0,b.useState)(""),g=(0,b.useRef)(null),j=(0,b.useCallback)(e=>{if(!e.from||!e.to)return null;for(let s of ek){let t=s.getValue(),a=ev()(e.from).isSame(ev()(t.from),"day"),r=ev()(e.to).isSame(ev()(t.to),"day");if(a&&r)return s.shortLabel}return null},[]);(0,b.useEffect)(()=>{u(j(s))},[s,j]);let f=(0,b.useCallback)(()=>{if(!m||!h)return{isValid:!0,error:""};let e=ev()(m,"YYYY-MM-DD"),s=ev()(h,"YYYY-MM-DD");return e.isValid()&&s.isValid()?s.isBefore(e)?{isValid:!1,error:"End date cannot be before start date"}:{isValid:!0,error:""}:{isValid:!1,error:"Invalid date format"}},[m,h])();(0,b.useEffect)(()=>{s.from&&x(ev()(s.from).format("YYYY-MM-DD")),s.to&&p(ev()(s.to).format("YYYY-MM-DD")),o(s)},[s]),(0,b.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&i(!1)};return n&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[n]);let _=(0,b.useCallback)((e,s)=>{if(!e||!s)return"Select date range";let t=e=>ev()(e).format("D MMM, HH:mm");return"".concat(t(e)," - ").concat(t(s))},[]),y=(0,b.useCallback)(e=>{let s;if(!e.from)return e;let t={...e},a=new Date(e.from);return s=new Date(e.to?e.to:e.from),a.toDateString(),s.toDateString(),a.setHours(0,0,0,0),s.setHours(23,59,59,999),t.from=a,t.to=s,t},[]),v=e=>{let{from:s,to:t}=e.getValue();o({from:s,to:t}),u(e.shortLabel),x(ev()(s).format("YYYY-MM-DD")),p(ev()(t).format("YYYY-MM-DD"))},k=(0,b.useCallback)(()=>{try{if(m&&h&&f.isValid){let e=ev()(m,"YYYY-MM-DD").startOf("day"),s=ev()(h,"YYYY-MM-DD").endOf("day");if(e.isValid()&&s.isValid()){let t={from:e.toDate(),to:s.toDate()};o(t);let a=j(t);u(a)}}}catch(e){console.warn("Invalid date format:",e)}},[m,h,f.isValid,j]);return(0,b.useEffect)(()=>{k()},[k]),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[r&&(0,a.jsx)(ep.x,{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:r}),(0,a.jsxs)("div",{className:"relative",ref:g,children:[(0,a.jsx)("div",{className:"w-[300px] px-3 py-2 text-sm border border-gray-300 rounded-md bg-white cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",onClick:()=>i(!n),children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ef.Z,{className:"text-gray-600"}),(0,a.jsx)("span",{className:"text-gray-900",children:_(s.from,s.to)})]}),(0,a.jsx)("svg",{className:"w-4 h-4 text-gray-400 transition-transform ".concat(n?"rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}),n&&(0,a.jsx)("div",{className:"absolute top-full right-0 z-[9999] min-w-[600px] mt-1 bg-white border border-gray-200 rounded-lg shadow-xl",children:(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsxs)("div",{className:"w-1/2 border-r border-gray-200",children:[(0,a.jsx)("div",{className:"p-3 border-b border-gray-200",children:(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:"Relative time"})}),(0,a.jsx)("div",{className:"h-[350px] overflow-y-auto",children:ek.map(e=>{let s=d===e.shortLabel;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 cursor-pointer border-b border-gray-100 transition-colors ".concat(s?"bg-blue-50 hover:bg-blue-100 border-blue-200":"hover:bg-gray-50"),onClick:()=>v(e),children:[(0,a.jsx)("span",{className:"text-sm ".concat(s?"text-blue-700 font-medium":"text-gray-700"),children:e.label}),(0,a.jsx)("span",{className:"text-xs px-2 py-1 rounded capitalize ".concat(s?"text-blue-700 bg-blue-100":"text-gray-500 bg-gray-100"),children:e.shortLabel})]},e.label)})})]}),(0,a.jsxs)("div",{className:"w-1/2 relative",children:[(0,a.jsx)("div",{className:"p-3.5 border-b border-gray-200",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(e_.Z,{className:"text-gray-600"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:"Start and end dates"})]})}),(0,a.jsxs)("div",{className:"p-6 space-y-6 pb-20",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm text-gray-700 mb-1 block",children:"Start date"}),(0,a.jsx)("input",{type:"date",value:m,onChange:e=>x(e.target.value),className:"w-65 px-3 py-2 text-sm border rounded-md cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500 ".concat(f.isValid?"border-gray-300":"border-red-300 focus:border-red-500 focus:ring-red-200")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm text-gray-700 mb-1 block",children:"End date"}),(0,a.jsx)("input",{type:"date",value:h,onChange:e=>p(e.target.value),className:"w-65 px-3 py-2 text-sm border rounded-md cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500 ".concat(f.isValid?"border-gray-300":"border-red-300 focus:border-red-500 focus:ring-red-200")})]}),!f.isValid&&f.error&&(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-red-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})}),(0,a.jsx)("span",{className:"text-sm text-red-700 font-medium",children:f.error})]})}),c.from&&c.to&&f.isValid&&(0,a.jsxs)("div",{className:"bg-blue-50 p-3 rounded-md space-y-1",children:[(0,a.jsxs)("div",{className:"text-xs text-blue-800",children:[(0,a.jsx)("span",{className:"font-medium",children:"From:"})," ",ev()(c.from).format("MMM D, YYYY [at] HH:mm:ss")]}),(0,a.jsxs)("div",{className:"text-xs text-blue-800",children:[(0,a.jsx)("span",{className:"font-medium",children:"To:"})," ",ev()(c.to).format("MMM D, YYYY [at] HH:mm:ss")]})]})]}),(0,a.jsx)("div",{className:"absolute bottom-4 right-4",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(ep.z,{variant:"secondary",onClick:()=>{o(s),s.from&&x(ev()(s.from).format("YYYY-MM-DD")),s.to&&p(ev()(s.to).format("YYYY-MM-DD")),u(j(s)),i(!1)},children:"Cancel"}),(0,a.jsx)(ep.z,{onClick:()=>{c.from&&c.to&&f.isValid&&(t(c),requestIdleCallback(()=>{t(y(c))},{timeout:100}),i(!1))},disabled:!c.from||!c.to||!f.isValid,children:"Apply"})]})})]})]})})]})]})},eZ=t(91323);let eN=e=>{let{isDateChanging:s=!1}=e;return(0,a.jsx)("div",{className:"flex items-center justify-center h-40",children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,a.jsx)(eZ.S,{className:"size-5"}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-gray-600 text-sm font-medium",children:s?"Processing date selection...":"Loading chart data..."}),(0,a.jsx)("span",{className:"text-gray-400 text-xs mt-1",children:s?"This will only take a moment":"Fetching your data"})]})]})})};var ew=t(35829),eq=t(97765),eS=t(99981),eC=e=>{let{accessToken:s,selectedTags:t,formatAbbreviatedNumber:l}=e,[n,i]=(0,b.useState)({results:[],total_count:0,page:1,page_size:50,total_pages:0}),[c,k]=(0,b.useState)(!1),[N,w]=(0,b.useState)(1),q=async()=>{if(s){k(!0);try{let e=await (0,Z.perUserAnalyticsCall)(s,N,50,t.length>0?t:void 0);i(e)}catch(e){console.error("Failed to fetch per-user data:",e)}finally{k(!1)}}};return(0,b.useEffect)(()=>{q()},[s,t,N]),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(v.Z,{children:"Per User Usage"}),(0,a.jsx)(eq.Z,{children:"Individual developer usage metrics"}),(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"User Details"}),(0,a.jsx)(o.Z,{children:"Usage Distribution"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"User ID"}),(0,a.jsx)(f.Z,{children:"User Email"}),(0,a.jsx)(f.Z,{children:"User Agent"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Success Generations"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Total Tokens"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Failed Requests"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Total Cost"})]})}),(0,a.jsx)(p.Z,{children:n.results.slice(0,10).map((e,s)=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{className:"font-medium",children:e.user_id})}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{children:e.user_email||"N/A"})}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{children:e.user_agent||"Unknown"})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.successful_requests)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.total_tokens)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.failed_requests)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsxs)(y.Z,{children:["$",l(e.spend,4)]})})]},s))})]}),n.results.length>10&&(0,a.jsxs)("div",{className:"mt-4 flex justify-between items-center",children:[(0,a.jsxs)(y.Z,{className:"text-sm text-gray-500",children:["Showing 10 of ",n.total_count," results"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(W.Z,{size:"sm",variant:"secondary",onClick:()=>{N>1&&w(N-1)},disabled:1===N,children:"Previous"}),(0,a.jsx)(W.Z,{size:"sm",variant:"secondary",onClick:()=>{N=n.total_pages,children:"Next"})]})]})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)(v.Z,{className:"text-lg",children:"User Usage Distribution"}),(0,a.jsx)(eq.Z,{children:"Number of users by successful request frequency"})]}),(0,a.jsx)(r.Z,{data:(()=>{let e=new Map;n.results.forEach(s=>{let t=s.user_agent||"Unknown";e.set(t,(e.get(t)||0)+1)});let s=Array.from(e.entries()).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).slice(0,8).map(e=>{let[s]=e;return s}),t={"1-9 requests":{range:[1,9],agents:{}},"10-99 requests":{range:[10,99],agents:{}},"100-999 requests":{range:[100,999],agents:{}},"1K-9.9K requests":{range:[1e3,9999],agents:{}},"10K-99.9K requests":{range:[1e4,99999],agents:{}},"100K+ requests":{range:[1e5,1/0],agents:{}}};return n.results.forEach(e=>{let a=e.successful_requests,r=e.user_agent||"Unknown";s.includes(r)&&Object.entries(t).forEach(e=>{let[s,t]=e;a>=t.range[0]&&a<=t.range[1]&&(t.agents[r]||(t.agents[r]=0),t.agents[r]++)})}),Object.entries(t).map(e=>{let[t,a]=e,r={category:t};return s.forEach(e=>{r[e]=a.agents[e]||0}),r})})(),index:"category",categories:(()=>{let e=new Map;return n.results.forEach(s=>{let t=s.user_agent||"Unknown";e.set(t,(e.get(t)||0)+1)}),Array.from(e.entries()).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).slice(0,8).map(e=>{let[s]=e;return s})})(),colors:["blue","green","orange","red","purple","yellow","pink","indigo"],valueFormatter:e=>"".concat(e," users"),yAxisWidth:80,showLegend:!0,stack:!0})]})]})]})]})},eT=e=>{let{accessToken:s,userRole:t,dateValue:n,onDateChange:i}=e,[h,p]=(0,b.useState)({results:[]}),[g,j]=(0,b.useState)({results:[]}),[f,_]=(0,b.useState)({results:[]}),[k,N]=(0,b.useState)({results:[]}),[w,q]=(0,b.useState)(""),[S,C]=(0,b.useState)([]),[T,D]=(0,b.useState)([]),[L,E]=(0,b.useState)(!1),[A,F]=(0,b.useState)(!1),[O,M]=(0,b.useState)(!1),[U,V]=(0,b.useState)(!1),[z,I]=(0,b.useState)(!1),R=new Date,Y=async()=>{if(s){E(!0);try{let e=await (0,Z.tagDistinctCall)(s);C(e.results.map(e=>e.tag))}catch(e){console.error("Failed to fetch available tags:",e)}finally{E(!1)}}},$=async()=>{if(s){F(!0);try{let e=await (0,Z.tagDauCall)(s,R,w||void 0,T.length>0?T:void 0);p(e)}catch(e){console.error("Failed to fetch DAU data:",e)}finally{F(!1)}}},K=async()=>{if(s){M(!0);try{let e=await (0,Z.tagWauCall)(s,R,w||void 0,T.length>0?T:void 0);j(e)}catch(e){console.error("Failed to fetch WAU data:",e)}finally{M(!1)}}},P=async()=>{if(s){V(!0);try{let e=await (0,Z.tagMauCall)(s,R,w||void 0,T.length>0?T:void 0);_(e)}catch(e){console.error("Failed to fetch MAU data:",e)}finally{V(!1)}}},W=async()=>{if(s&&n.from&&n.to){I(!0);try{let e=await (0,Z.userAgentSummaryCall)(s,n.from,n.to,T.length>0?T:void 0);N(e)}catch(e){console.error("Failed to fetch user agent summary data:",e)}finally{I(!1)}}};(0,b.useEffect)(()=>{Y()},[s]),(0,b.useEffect)(()=>{if(!s)return;let e=setTimeout(()=>{$(),K(),P()},50);return()=>clearTimeout(e)},[s,w,T]),(0,b.useEffect)(()=>{if(!n.from||!n.to)return;let e=setTimeout(()=>{W()},50);return()=>clearTimeout(e)},[s,n,T]);let B=e=>e.startsWith("User-Agent: ")?e.replace("User-Agent: ",""):e,H=e=>e.length>15?e.substring(0,15)+"...":e,G=e=>Object.entries(e.reduce((e,s)=>(e[s.tag]=(e[s.tag]||0)+s.active_users,e),{})).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).map(e=>{let[s]=e;return s}),J=G(h.results).slice(0,10),X=G(g.results).slice(0,10),ee=G(f.results).slice(0,10),es=(()=>{let e=[],s=new Date;for(let t=6;t>=0;t--){let a=new Date(s);a.setDate(a.getDate()-t);let r={date:a.toISOString().split("T")[0]};J.forEach(e=>{r[B(e)]=0}),e.push(r)}return h.results.forEach(s=>{let t=B(s.tag),a=e.find(e=>e.date===s.date);a&&(a[t]=s.active_users)}),e})(),et=(()=>{let e=[];for(let s=1;s<=7;s++){let t={week:"Week ".concat(s)};X.forEach(e=>{t[B(e)]=0}),e.push(t)}return g.results.forEach(s=>{let t=B(s.tag),a=s.date.match(/Week (\d+)/);if(a){let r="Week ".concat(a[1]),l=e.find(e=>e.week===r);l&&(l[t]=s.active_users)}}),e})(),ea=(()=>{let e=[];for(let s=1;s<=7;s++){let t={month:"Month ".concat(s)};ee.forEach(e=>{t[B(e)]=0}),e.push(t)}return f.results.forEach(s=>{let t=B(s.tag),a=s.date.match(/Month (\d+)/);if(a){let r="Month ".concat(a[1]),l=e.find(e=>e.month===r);l&&(l[t]=s.active_users)}}),e})(),er=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e>=1e8||e>=1e7||e>=1e6?(e/1e6).toFixed(s)+"M":e>=1e4?(e/1e3).toFixed(s)+"K":e>=1e3?(e/1e3).toFixed(s)+"K":e.toFixed(s)};return(0,a.jsxs)("div",{className:"space-y-6 mt-6",children:[(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex justify-between items-start",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(v.Z,{children:"Summary by User Agent"}),(0,a.jsx)(eq.Z,{children:"Performance metrics for different user agents"})]}),(0,a.jsxs)("div",{className:"w-96",children:[(0,a.jsx)(y.Z,{className:"text-sm font-medium block mb-2",children:"Filter by User Agents"}),(0,a.jsx)(Q.default,{mode:"multiple",placeholder:"All User Agents",value:T,onChange:D,style:{width:"100%"},showSearch:!0,allowClear:!0,loading:L,optionFilterProp:"label",className:"rounded-md",maxTagCount:"responsive",children:S.map(e=>{let s=B(e),t=s.length>50?"".concat(s.substring(0,50),"..."):s;return(0,a.jsx)(Q.default.Option,{value:e,label:t,title:s,children:t},e)})})]})]}),z?(0,a.jsx)(eN,{isDateChanging:!1}):(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4",children:[(k.results||[]).slice(0,4).map((e,s)=>{let t=B(e.tag),r=H(t);return(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(eS.Z,{title:t,placement:"top",children:(0,a.jsx)(v.Z,{className:"truncate",children:r})}),(0,a.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Success Requests"}),(0,a.jsx)(ew.Z,{className:"text-lg",children:er(e.successful_requests)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Tokens"}),(0,a.jsx)(ew.Z,{className:"text-lg",children:er(e.total_tokens)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Cost"}),(0,a.jsxs)(ew.Z,{className:"text-lg",children:["$",er(e.total_spend,4)]})]})]})]},s)}),Array.from({length:Math.max(0,4-(k.results||[]).length)}).map((e,s)=>(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"No Data"}),(0,a.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Success Requests"}),(0,a.jsx)(ew.Z,{className:"text-lg",children:"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Tokens"}),(0,a.jsx)(ew.Z,{className:"text-lg",children:"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Cost"}),(0,a.jsx)(ew.Z,{className:"text-lg",children:"-"})]})]})]},"empty-".concat(s)))]})]})}),(0,a.jsx)(l.Z,{children:(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"DAU/WAU/MAU"}),(0,a.jsx)(o.Z,{children:"Per User Usage (Last 30 Days)"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(v.Z,{children:"DAU, WAU & MAU per Agent"}),(0,a.jsx)(eq.Z,{children:"Active users across different time periods"})]}),(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"DAU"}),(0,a.jsx)(o.Z,{children:"WAU"}),(0,a.jsx)(o.Z,{children:"MAU"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Daily Active Users - Last 7 Days"})}),A?(0,a.jsx)(eN,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:es,index:"date",categories:J.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Weekly Active Users - Last 7 Weeks"})}),O?(0,a.jsx)(eN,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:et,index:"week",categories:X.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Monthly Active Users - Last 7 Months"})}),U?(0,a.jsx)(eN,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:ea,index:"month",categories:ee.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]})]})]})]}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eC,{accessToken:s,selectedTags:T,formatAbbreviatedNumber:er})})]})]})})]})},eD=t(47375),eL=t(32176),eE=t(62338),eA=t(12322);function eF(e){let{topModels:s}=e,[t,r]=(0,b.useState)("table");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-4 flex justify-end items-center",children:(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>r("table"),className:"px-3 py-1 text-sm rounded-md ".concat("table"===t?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Table View"}),(0,a.jsx)("button",{onClick:()=>r("chart"),className:"px-3 py-1 text-sm rounded-md ".concat("chart"===t?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Chart View"})]})}),"chart"===t?(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(eE.v,{className:"mt-4 h-40",data:s,index:"key",categories:["spend"],colors:["cyan"],valueFormatter:e=>"$".concat((0,E.pw)(e,2)),layout:"vertical",yAxisWidth:200,showLegend:!1})}):(0,a.jsx)("div",{className:"border rounded-lg overflow-auto",children:(0,a.jsx)(eA.w,{columns:[{header:"Model",accessorKey:"key",cell:e=>e.getValue()||"-"},{header:"Spend (USD)",accessorKey:"spend",cell:e=>{let s=e.getValue();return"$".concat((0,E.pw)(s,2))}},{header:"Successful",accessorKey:"successful_requests",cell:e=>{var s;return(0,a.jsx)("span",{className:"text-green-600",children:(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0})}},{header:"Failed",accessorKey:"failed_requests",cell:e=>{var s;return(0,a.jsx)("span",{className:"text-red-600",children:(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0})}},{header:"Tokens",accessorKey:"tokens",cell:e=>{var s;return(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0}}],data:s,renderSubComponent:()=>(0,a.jsx)(a.Fragment,{}),getRowCanExpand:()=>!1})})]})}var eO=t(49282),eM=e=>{let{endpointData:s}=e,t=s||{},n=b.useMemo(()=>Object.entries(t).map(e=>{let[s,t]=e;return{endpoint:s,"metrics.successful_requests":t.metrics.successful_requests,"metrics.failed_requests":t.metrics.failed_requests,metrics:{successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests}}}),[t]);return(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Success vs Failed Requests by Endpoint"}),(0,a.jsx)(V,{categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:n,index:"endpoint",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"],valueFormatter:e=>e.toLocaleString(),customTooltip:U,showLegend:!1,stack:!0,yAxisWidth:60})]})},eU=t(59664),eV=function(e){let{dailyData:s,endpointData:t}=e,r=(0,b.useMemo)(()=>(null==s?void 0:s.results)&&0!==s.results.length?function(e){let s=[],t=new Set;return e.forEach(e=>{e.breakdown.endpoints&&Object.keys(e.breakdown.endpoints).forEach(e=>t.add(e))}),e.forEach(e=>{let a={date:new Date(e.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})};t.forEach(s=>{var t;let r=null===(t=e.breakdown.endpoints)||void 0===t?void 0:t[s];a[s]=(null==r?void 0:r.metrics.api_requests)||0}),s.push(a)}),s.reverse()}(s.results):[],[s]),n=(0,b.useMemo)(()=>0===r.length?[]:Object.keys(r[0]).filter(e=>"date"!==e),[r]);return(0,a.jsxs)(l.Z,{className:"mb-6",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsx)(v.Z,{children:"Endpoint Usage Trends"})}),(0,a.jsx)(eU.Z,{className:"h-80",data:r,index:"date",categories:n,colors:["blue","cyan","indigo","violet","purple","fuchsia","pink","rose","red","orange"].slice(0,n.length),valueFormatter:e=>e.toLocaleString(),showLegend:!0,showGridLines:!0,yAxisWidth:60,connectNulls:!0,curveType:"natural"})]})},ez=t(68565),eI=t(56609),eR=e=>{let{endpointData:s}=e,t=(e,s)=>0===s?0:e/s*100,r=Object.entries(s).map(e=>{let[s,a]=e;return{key:s,endpoint:s,successful_requests:a.metrics.successful_requests,failed_requests:a.metrics.failed_requests,api_requests:a.metrics.api_requests,total_tokens:a.metrics.total_tokens,spend:a.metrics.spend,successRate:t(a.metrics.successful_requests,a.metrics.api_requests)}}),l=[{title:"Endpoint",dataIndex:"endpoint",key:"endpoint",render:e=>(0,a.jsx)("span",{className:"font-medium",children:e})},{title:"Successful / Failed",key:"requests",render:(e,s)=>{let t=s.api_requests>0?s.successful_requests/s.api_requests*100:0,r=s.api_requests>0?s.failed_requests/s.api_requests*100:0,l={"0%":"#22c55e"};return t>0&&t<100&&(l["".concat(t,"%")]="#22c55e",l["".concat(t+.01,"%")]="#ef4444"),l["100%"]=r>0?"#ef4444":"#22c55e",(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("div",{className:"flex-1 relative",children:(0,a.jsx)(ez.Z,{percent:t+r,size:"small",strokeColor:l,showInfo:!1})}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 text-sm min-w-[100px]",children:[(0,a.jsx)("span",{className:"text-green-600 font-medium",children:s.successful_requests.toLocaleString()}),(0,a.jsx)("span",{className:"text-gray-400",children:"/"}),(0,a.jsx)("span",{className:"text-red-600 font-medium",children:s.failed_requests.toLocaleString()})]})]})}},{title:"Total Request",dataIndex:"api_requests",key:"api_requests",render:e=>e.toLocaleString()},{title:"Success Rate",dataIndex:"successRate",key:"successRate",render:e=>{let s=e.toFixed(2);return(0,a.jsxs)("span",{className:e>=95?"text-green-600 font-medium":e>=80?"text-yellow-600 font-medium":"text-red-600 font-medium",children:[s,"%"]})}},{title:"Total Tokens",dataIndex:"total_tokens",key:"total_tokens",render:e=>e.toLocaleString()},{title:"Spend",dataIndex:"spend",key:"spend",render:e=>"$".concat((0,E.pw)(e,2))}];return(0,a.jsx)(eI.Z,{columns:l,dataSource:r,pagination:!1})},eY=e=>{let{userSpendData:s}=e,t=(0,b.useMemo)(()=>{let e={};return(null==s?void 0:s.results)&&s.results.forEach(s=>{Object.entries(s.breakdown.endpoints||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:a.metadata||{},api_key_breakdown:{}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests||0,e[t].metrics.failed_requests+=a.metrics.failed_requests||0,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),e},[s]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(eR,{endpointData:t}),(0,a.jsx)(eM,{endpointData:t}),(0,a.jsx)(eV,{dailyData:s,endpointData:t})]})},e$=t(91027),eK=e=>{let{accessToken:s,entityType:t,entityId:k,userID:N,userRole:w,entityList:q,premiumUser:S,dateValue:C}=e,[T,D]=(0,b.useState)({results:[],metadata:{total_spend:0,total_api_requests:0,total_successful_requests:0,total_failed_requests:0,total_tokens:0}}),{teams:L}=(0,eO.Z)(),A=P(T,"models",L||[]),F=P(T,"api_keys",L||[]),[O,M]=(0,b.useState)([]),U=async()=>{if(!s||!C.from||!C.to)return;let e=new Date(C.from),a=new Date(C.to);if("tag"===t)D(await (0,Z.tagDailyActivityCall)(s,e,a,1,O.length>0?O:null));else if("team"===t)D(await (0,Z.teamDailyActivityCall)(s,e,a,1,O.length>0?O:null));else if("organization"===t)D(await (0,Z.organizationDailyActivityCall)(s,e,a,1,O.length>0?O:null));else if("customer"===t)D(await (0,Z.customerDailyActivityCall)(s,e,a,1,O.length>0?O:null));else if("agent"===t)D(await (0,Z.agentDailyActivityCall)(s,e,a,1,O.length>0?O:null));else throw Error("Invalid entity type")};(0,b.useEffect)(()=>{U()},[s,C,k,O]);let V=()=>{let e={};return T.results.forEach(s=>{Object.entries(s.breakdown.providers||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={provider:t,spend:0,requests:0,successful_requests:0,failed_requests:0,tokens:0});try{e[t].spend+=a.metrics.spend,e[t].requests+=a.metrics.api_requests,e[t].successful_requests+=a.metrics.successful_requests,e[t].failed_requests+=a.metrics.failed_requests,e[t].tokens+=a.metrics.total_tokens}catch(e){console.error("Error processing provider ".concat(t,": ").concat(e))}})}),Object.values(e).filter(e=>e.spend>0).sort((e,s)=>s.spend-e.spend)},z=(e,s)=>{if(q){let s=q.find(s=>s.value===e);if(s)return s.label}return(null==s?void 0:s.team_alias)?s.team_alias:e},R=e=>0===O.length?e:e.filter(e=>O.includes(e.metadata.id)),Y=()=>{let e={};return T.results.forEach(s=>{Object.entries(s.breakdown.entities||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{alias:z(t,a.metadata),id:t}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests,e[t].metrics.failed_requests+=a.metrics.failed_requests,e[t].metrics.total_tokens+=a.metrics.total_tokens})}),R(Object.values(e).sort((e,s)=>s.metrics.spend-e.metrics.spend))},K=t.charAt(0).toUpperCase()+t.slice(1);return(0,a.jsxs)("div",{style:{width:"100%"},className:"relative",children:[(0,a.jsx)(eg,{dateValue:C,entityType:t,spendData:T,showFilters:null!==q&&q.length>0,filterLabel:"Filter by ".concat(t),filterPlaceholder:"Select ".concat(t," to filter..."),selectedFilters:O,onFiltersChange:M,filterOptions:(()=>{if(q)return q})()||void 0}),(0,a.jsxs)(d.Z,{children:[(0,a.jsx)(e$.Z,{children:(0,a.jsxs)(u.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(o.Z,{children:"Cost"}),(0,a.jsx)(o.Z,{children:"agent"===t?"Request / Token Consumption":"Model Activity"}),(0,a.jsx)(o.Z,{children:"Key Activity"}),(0,a.jsx)(o.Z,{children:"Endpoint Activity"})]})}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsxs)(c.Z,{numItems:2,className:"gap-2 w-full",children:[(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)(v.Z,{children:[K," Spend Overview"]}),(0,a.jsxs)(c.Z,{numItems:5,className:"gap-4 mt-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Spend"}),(0,a.jsxs)(y.Z,{className:"text-2xl font-bold mt-2",children:["$",(0,E.pw)(T.metadata.total_spend,2)]})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:T.metadata.total_api_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Successful Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-green-600",children:T.metadata.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Failed Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-red-600",children:T.metadata.total_failed_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:T.metadata.total_tokens.toLocaleString()})]})]})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Daily Spend"}),(0,a.jsx)(r.Z,{data:[...T.results].sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime()),index:"date",categories:["metrics.spend"],colors:["cyan"],valueFormatter:I,yAxisWidth:100,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload,l=Object.keys(r.breakdown.entities||{}).length;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.date}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Total Spend: $",(0,E.pw)(r.metrics.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Requests: ",r.metrics.api_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Successful: ",r.metrics.successful_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Failed: ",r.metrics.failed_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Tokens: ",r.metrics.total_tokens]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total ",K,"s: ",l]}),(0,a.jsxs)("div",{className:"mt-2 border-t pt-2",children:[(0,a.jsxs)("p",{className:"font-semibold",children:["Spend by ",K,":"]}),Object.entries(r.breakdown.entities||{}).sort((e,s)=>{let[,t]=e,[,a]=s,r=t.metrics.spend;return a.metrics.spend-r}).slice(0,5).map(e=>{let[s,t]=e;return(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:[z(s,t.metadata),": $",(0,E.pw)(t.metrics.spend,2)]},s)}),l>5&&(0,a.jsxs)("p",{className:"text-sm text-gray-500 italic",children:["...and ",l-5," more"]})]})]})}})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-col space-y-2",children:[(0,a.jsxs)(v.Z,{children:["Spend Per ",K]}),(0,a.jsx)(eq.Z,{className:"text-xs",children:"Showing Top 5 by Spend"}),(0,a.jsxs)("div",{className:"flex items-center text-sm text-gray-500",children:[(0,a.jsxs)("span",{children:["Get Started by Tracking cost per ",K," "]}),(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/enterprise#spend-tracking",className:"text-blue-500 hover:text-blue-700 ml-1",children:"here"})]})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-6",children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(r.Z,{className:"mt-4 h-52",data:Y().slice(0,5).map(e=>({...e,metadata:{...e.metadata,alias_display:e.metadata.alias&&e.metadata.alias.length>15?"".concat(e.metadata.alias.slice(0,15),"..."):e.metadata.alias}})),index:"metadata.alias_display",categories:["metrics.spend"],colors:["cyan"],valueFormatter:I,layout:"vertical",showLegend:!1,yAxisWidth:150,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.metadata.alias}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,E.pw)(r.metrics.spend,4)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Requests: ",r.metrics.api_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-green-600",children:["Successful: ",r.metrics.successful_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-red-600",children:["Failed: ",r.metrics.failed_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.metrics.total_tokens.toLocaleString()]})]})}})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)("div",{className:"h-52 overflow-y-auto",children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:K}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:Y().filter(e=>e.metrics.spend>0).map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:e.metadata.alias}),(0,a.jsxs)(g.Z,{children:["$",(0,E.pw)(e.metrics.spend,4)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.metrics.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.metrics.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.metrics.total_tokens.toLocaleString()})]},e.metadata.id))})]})})})]})]})})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys"}),(0,a.jsx)(eL.Z,{topKeys:(()=>{console.log("debugTags",{spendData:T});let e={};return T.results.forEach(s=>{let{breakdown:t}=s,{entities:a}=t;console.log("debugTags",{entities:a});let r=Object.keys(a).reduce((e,s)=>{let{api_key_breakdown:t}=a[s];return Object.keys(t).forEach(a=>{let r={tag:s,usage:t[a].metrics.spend};e[a]?e[a].push(r):e[a]=[r]}),e},{});console.log("debugTags",{tagDictionary:r}),Object.entries(s.breakdown.api_keys||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{key_alias:a.metadata.key_alias,team_id:a.metadata.team_id||null,tags:r[t]||[]}},console.log("debugTags",{keySpend:e})),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests,e[t].metrics.failed_requests+=a.metrics.failed_requests,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(e).map(e=>{let[s,t]=e;return{api_key:s,key_alias:t.metadata.key_alias||"-",tags:t.metadata.tags||"-",spend:t.metrics.spend}}).sort((e,s)=>s.spend-e.spend).slice(0,5)})(),teams:null,showTags:"tag"===t})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"agent"===t?"Top Agents":"Top Models"}),(0,a.jsx)(eF,{topModels:(()=>{let e={};return T.results.forEach(s=>{Object.entries(s.breakdown.models||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={spend:0,requests:0,successful_requests:0,failed_requests:0,tokens:0});try{e[t].spend+=a.metrics.spend}catch(e){console.error("Error adding spend for ".concat(t,": ").concat(e,", got metrics: ").concat(JSON.stringify(a)))}e[t].requests+=a.metrics.api_requests,e[t].successful_requests+=a.metrics.successful_requests,e[t].failed_requests+=a.metrics.failed_requests,e[t].tokens+=a.metrics.total_tokens})}),Object.entries(e).map(e=>{let[s,t]=e;return{key:s,...t}}).sort((e,s)=>s.spend-e.spend).slice(0,5)})()})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,a.jsx)(v.Z,{children:"Provider Usage"}),(0,a.jsxs)(c.Z,{numItems:2,children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(i.Z,{className:"mt-4 h-40",data:V(),index:"provider",category:"spend",valueFormatter:e=>"$".concat((0,E.pw)(e,2)),colors:["cyan","blue","indigo","violet","purple"]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"Provider"}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:V().map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[e.provider&&(0,a.jsx)("img",{src:(0,ej.dr)(e.provider).logo,alt:"".concat(e.provider," logo"),className:"w-4 h-4",onError:s=>{let t=s.target,a=t.parentElement;if(a){var r;let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=(null===(r=e.provider)||void 0===r?void 0:r.charAt(0))||"-",a.replaceChild(s,t)}}}),(0,a.jsx)("span",{children:e.provider})]})}),(0,a.jsxs)(g.Z,{children:["$",(0,E.pw)(e.spend,2)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.tokens.toLocaleString()})]},e.provider))})]})})]})]})})})]})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)($,{modelMetrics:A,hidePromptCachingMetrics:"agent"===t})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)($,{modelMetrics:F,hidePromptCachingMetrics:"agent"===t})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eY,{userSpendData:T})})]})]})]})},eP=t(64739),eW=t(37527),eB=t(41361),eH=t(40312),eG=t(71891),eJ=t(69993),eQ=t(48231),eX=t(9775),e0=t(33866);let e1=[{value:"global",label:"Global Usage",showForAdmin:"Global Usage",showForNonAdmin:"Your Usage",description:"View usage across all resources",descriptionForAdmin:"View usage across all resources",descriptionForNonAdmin:"View your usage",icon:(0,a.jsx)(eP.Z,{style:{fontSize:"16px"}})},{value:"organization",label:"Organization Usage",showForAdmin:"Organization Usage",showForNonAdmin:"Your Organization Usage",description:"View organization-level usage",descriptionForAdmin:"View usage across all organizations",descriptionForNonAdmin:"View your organization's usage",icon:(0,a.jsx)(eW.Z,{style:{fontSize:"16px"}})},{value:"team",label:"Team Usage",description:"View usage by team",icon:(0,a.jsx)(eB.Z,{style:{fontSize:"16px"}})},{value:"customer",label:"Customer Usage",description:"View usage by customer accounts",icon:(0,a.jsx)(eH.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"tag",label:"Tag Usage",description:"View usage grouped by tags",icon:(0,a.jsx)(eG.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"agent",label:"Agent Usage (A2A)",description:"View usage by AI agents",icon:(0,a.jsx)(eJ.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"user-agent-activity",label:"User Agent Activity",description:"View detailed user agent activity logs",icon:(0,a.jsx)(eQ.Z,{style:{fontSize:"16px"}}),adminOnly:!0}],e2=e=>{let{value:s,onChange:t,isAdmin:r,title:l="Usage View",description:n="Select the usage data you want to view","data-id":i}=e,c=e1.filter(e=>!e.adminOnly||!!r).map(e=>{let s=e.label,t=e.description;return e.showForAdmin&&e.showForNonAdmin&&(s=r?e.showForAdmin:e.showForNonAdmin),e.descriptionForAdmin&&e.descriptionForNonAdmin&&(t=r?e.descriptionForAdmin:e.descriptionForNonAdmin),{value:e.value,label:s,description:t,icon:e.icon,badgeText:e.badgeText}});return(0,a.jsx)("div",{className:"w-full","data-id":i,children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-start gap-4",children:[(0,a.jsxs)("div",{className:"flex items-stretch gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"flex-shrink-0 flex items-center",children:(0,a.jsx)(eX.Z,{style:{fontSize:"32px"}})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-gray-900 mb-0.5 leading-tight",children:l}),(0,a.jsx)("p",{className:"text-xs text-gray-600 leading-tight",children:n})]})]}),(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)(Q.default,{value:s,onChange:t,className:"w-54 sm:w-64 md:w-72",size:"large",options:c.map(e=>({value:e.value,label:e.label})),optionRender:e=>{let s=c.find(s=>s.value===e.value);return s?(0,a.jsxs)("div",{className:"flex items-center gap-2 py-1",children:[(0,a.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:s.icon}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900",children:s.label}),(0,a.jsx)("div",{className:"text-xs text-gray-600 mt-0.5",children:s.description})]}),s.badgeText&&(0,a.jsx)("div",{className:"items-center",children:(0,a.jsx)(e0.Z,{color:"blue",count:s.badgeText})})]}):e.label},labelRender:e=>{let s=c.find(s=>s.value===e.value);return s?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{children:s.icon}),(0,a.jsx)("span",{className:"text-sm",children:s.label})]}):e.label}})})]})})},e4=(0,w.n)("users"),e6=()=>{let{accessToken:e,userId:s,userRole:t}=(0,S.Z)();return(0,N.a)({queryKey:e4.detail(s),queryFn:async()=>{let a=await (0,Z.userInfoCall)(e,s,t,!1,null,null);return console.log("userInfo: ".concat(JSON.stringify(a))),a.user_info},enabled:!!(e&&s&&t)})};var e5=e=>{var s,t,N,w,C,D,F,O,M,U,V;let{teams:z,organizations:R}=e,{accessToken:Y,userRole:K,userId:W,premiumUser:B}=(0,S.Z)(),[H,G]=(0,b.useState)({results:[],metadata:{}}),[J,Q]=(0,b.useState)(!1),[X,ee]=(0,b.useState)(!1),et=(0,b.useMemo)(()=>new Date(Date.now()-6048e5),[]),ea=(0,b.useMemo)(()=>new Date,[]),[er,el]=(0,b.useState)({from:et,to:ea}),[en,ei]=(0,b.useState)([]),{data:ec=[]}=L(),{data:eo}=T(),{data:ed}=e6();console.log("currentUser: ".concat(JSON.stringify(ed))),console.log("currentUser max budget: ".concat(null==ed?void 0:ed.max_budget));let[eu,em]=(0,b.useState)("groups"),[ex,ep]=(0,b.useState)(!1),[eg,ef]=(0,b.useState)(!1),[e_,ey]=(0,b.useState)(!0),[ev,ek]=(0,b.useState)(!0),[eZ,ew]=(0,b.useState)("global"),[eq,eS]=(0,b.useState)(!0),eC=async()=>{Y&&ei(Object.values(await (0,Z.tagListCall)(Y)).map(e=>({label:e.name,value:e.name})))};(0,b.useEffect)(()=>{eC()},[Y]);let eE=(null===(s=H.metadata)||void 0===s?void 0:s.total_spend)||0,eA=()=>{let e={};return H.results.forEach(s=>{Object.entries(s.breakdown.providers||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests||0,e[t].metrics.failed_requests+=a.metrics.failed_requests||0,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(e).map(e=>{let[s,t]=e;return{provider:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}})},eF=(0,b.useCallback)(async()=>{if(!Y||!er.from||!er.to)return;Q(!0);let e=new Date(er.from),s=new Date(er.to);try{try{let t=await (0,Z.userDailyActivityAggregatedCall)(Y,e,s);G(t);return}catch(e){}let t=await (0,Z.userDailyActivityCall)(Y,e,s);if(t.metadata.total_pages<=1){G(t);return}let a=[...t.results],r={...t.metadata};for(let l=2;l<=t.metadata.total_pages;l++){let t=await (0,Z.userDailyActivityCall)(Y,e,s,l);a.push(...t.results),t.metadata&&(r.total_spend+=t.metadata.total_spend||0,r.total_api_requests+=t.metadata.total_api_requests||0,r.total_successful_requests+=t.metadata.total_successful_requests||0,r.total_failed_requests+=t.metadata.total_failed_requests||0,r.total_tokens+=t.metadata.total_tokens||0)}G({results:a,metadata:r})}catch(e){console.error("Error fetching user spend data:",e)}finally{Q(!1),ee(!1)}},[Y,er.from,er.to]),eO=(0,b.useCallback)(e=>{ee(!0),Q(!0),el(e)},[]);(0,b.useEffect)(()=>{if(!er.from||!er.to)return;let e=setTimeout(()=>{eF()},50);return()=>clearTimeout(e)},[eF]);let eM=P(H,"models",z),eU=P(H,"api_keys",z),eV=P(H,"mcp_servers",z);return(0,a.jsxs)("div",{style:{width:"100%"},className:"p-8 relative",children:[(0,a.jsx)("div",{className:"flex items-end justify-between gap-6 mb-6",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-end justify-between gap-6 mb-4 w-full",children:[(0,a.jsx)(e2,{value:eZ,onChange:e=>ew(e),isAdmin:q.ZL.includes(K||"")}),(0,a.jsx)(eb,{value:er,onValueChange:eO})]}),"global"===eZ&&(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(e$.Z,{children:(0,a.jsxs)(u.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(o.Z,{children:"Cost"}),(0,a.jsx)(o.Z,{children:"Model Activity"}),(0,a.jsx)(o.Z,{children:"Key Activity"}),(0,a.jsx)(o.Z,{children:"MCP Server Activity"}),(0,a.jsx)(o.Z,{children:"Endpoint Activity"})]})}),(0,a.jsx)(A.z,{onClick:()=>ef(!0),icon:()=>(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),children:"Export Data"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsxs)(c.Z,{numItems:2,className:"gap-2 w-full",children:[(0,a.jsxs)(n.Z,{numColSpan:2,children:[(0,a.jsxs)(y.Z,{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content mb-2 mt-2 text-lg",children:["Project Spend"," ",er.from&&er.to&&(0,a.jsxs)(a.Fragment,{children:[er.from.toLocaleDateString("en-US",{month:"short",day:"numeric",year:er.from.getFullYear()!==er.to.getFullYear()?"numeric":void 0})," - ",er.to.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]}),(0,a.jsx)(eD.Z,{userSpend:eE,selectedTeam:null,userMaxBudget:(null==ed?void 0:ed.max_budget)||null})]}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Usage Metrics"}),(0,a.jsxs)(c.Z,{numItems:5,className:"gap-4 mt-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:(null===(N=H.metadata)||void 0===N?void 0:null===(t=N.total_api_requests)||void 0===t?void 0:t.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Successful Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-green-600",children:(null===(C=H.metadata)||void 0===C?void 0:null===(w=C.total_successful_requests)||void 0===w?void 0:w.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Failed Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-red-600",children:(null===(F=H.metadata)||void 0===F?void 0:null===(D=F.total_failed_requests)||void 0===D?void 0:D.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:(null===(M=H.metadata)||void 0===M?void 0:null===(O=M.total_tokens)||void 0===O?void 0:O.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Average Cost per Request"}),(0,a.jsxs)(y.Z,{className:"text-2xl font-bold mt-2",children:["$",(0,E.pw)((eE||0)/((null===(U=H.metadata)||void 0===U?void 0:U.total_api_requests)||1),4)]})]})]})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Daily Spend"}),J?(0,a.jsx)(eN,{isDateChanging:X}):(0,a.jsx)(r.Z,{data:[...H.results].sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime()),index:"date",categories:["metrics.spend"],colors:["cyan"],valueFormatter:I,yAxisWidth:100,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.date}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,E.pw)(r.metrics.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Requests: ",r.metrics.api_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Successful: ",r.metrics.successful_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Failed: ",r.metrics.failed_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.metrics.total_tokens]})]})}})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys"}),(0,a.jsx)(eL.Z,{topKeys:(()=>{let e={};return H.results.forEach(s=>{Object.entries(s.breakdown.api_keys||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{key_alias:a.metadata.key_alias,team_id:null,tags:a.metadata.tags||[]}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests,e[t].metrics.failed_requests+=a.metrics.failed_requests,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),console.log("debugTags",{keySpend:e,userSpendData:H}),Object.entries(e).map(e=>{let[s,t]=e;return{api_key:s,key_alias:t.metadata.key_alias||"-",tags:t.metadata.tags||[],spend:t.metrics.spend}}).sort((e,s)=>s.spend-e.spend).slice(0,5)})(),teams:null})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)(v.Z,{children:"groups"===eu?"Top Public Model Names":"Top Litellm Models"}),(0,a.jsxs)("div",{className:"flex bg-gray-100 rounded-lg p-1",children:[(0,a.jsx)("button",{className:"px-3 py-1 text-sm rounded-md transition-colors ".concat("groups"===eu?"bg-white shadow-sm text-gray-900":"text-gray-600 hover:text-gray-900"),onClick:()=>em("groups"),children:"Public Model Name"}),(0,a.jsx)("button",{className:"px-3 py-1 text-sm rounded-md transition-colors ".concat("individual"===eu?"bg-white shadow-sm text-gray-900":"text-gray-600 hover:text-gray-900"),onClick:()=>em("individual"),children:"Litellm Model Name"})]})]}),J?(0,a.jsx)(eN,{isDateChanging:X}):(0,a.jsx)(r.Z,{className:"mt-4 h-40",data:"groups"===eu?(()=>{let e={};return H.results.forEach(s=>{Object.entries(s.breakdown.model_groups||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests||0,e[t].metrics.failed_requests+=a.metrics.failed_requests||0,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(e).map(e=>{let[s,t]=e;return{key:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}}).sort((e,s)=>s.spend-e.spend).slice(0,5)})():(()=>{let e={};return H.results.forEach(s=>{Object.entries(s.breakdown.models||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests||0,e[t].metrics.failed_requests+=a.metrics.failed_requests||0,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(e).map(e=>{let[s,t]=e;return{key:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}}).sort((e,s)=>s.spend-e.spend).slice(0,5)})(),index:"key",categories:["spend"],colors:["cyan"],valueFormatter:I,layout:"vertical",yAxisWidth:200,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.key}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,E.pw)(r.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Requests: ",r.requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-green-600",children:["Successful: ",r.successful_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-red-600",children:["Failed: ",r.failed_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.tokens.toLocaleString()]})]})}})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,a.jsx)(v.Z,{children:"Spend by Provider"})}),J?(0,a.jsx)(eN,{isDateChanging:X}):(0,a.jsxs)(c.Z,{numItems:2,children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(i.Z,{className:"mt-4 h-40",data:eA(),index:"provider",category:"spend",valueFormatter:e=>"$".concat((0,E.pw)(e,2)),colors:["cyan"]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"Provider"}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:eA().filter(e=>e.spend>0).map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[e.provider&&(0,a.jsx)("img",{src:(0,ej.dr)(e.provider).logo,alt:"".concat(e.provider," logo"),className:"w-4 h-4",onError:s=>{let t=s.target,a=t.parentElement;if(a){var r;let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=(null===(r=e.provider)||void 0===r?void 0:r.charAt(0))||"-",a.replaceChild(s,t)}}}),(0,a.jsx)("span",{children:e.provider})]})}),(0,a.jsxs)(g.Z,{children:["$",(0,E.pw)(e.spend,2)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.tokens.toLocaleString()})]},e.provider))})]})})]})]})})]})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)($,{modelMetrics:eM})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)($,{modelMetrics:eU})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)($,{modelMetrics:eV})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eY,{userSpendData:H})})]})]}),"organization"===eZ&&(0,a.jsxs)(a.Fragment,{children:[e_&&(0,a.jsx)(k.Z,{banner:!0,type:"info",message:"Organization usage is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>ey(!1),className:"mb-5"}),(0,a.jsx)(eK,{accessToken:Y,entityType:"organization",userID:W,userRole:K,dateValue:er,entityList:(null==R?void 0:R.map(e=>({label:e.organization_alias,value:e.organization_id})))||null,premiumUser:B})]}),"team"===eZ&&(0,a.jsx)(eK,{accessToken:Y,entityType:"team",userID:W,userRole:K,entityList:(null==z?void 0:z.map(e=>({label:e.team_alias,value:e.team_id})))||null,premiumUser:B,dateValue:er}),"customer"===eZ&&(0,a.jsxs)(a.Fragment,{children:[ev&&(0,a.jsx)(k.Z,{banner:!0,type:"info",message:"Customer usage is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>ek(!1),className:"mb-5"}),(0,a.jsx)(eK,{accessToken:Y,entityType:"customer",userID:W,userRole:K,entityList:(null==ec?void 0:ec.map(e=>({label:e.alias||e.user_id,value:e.user_id})))||null,premiumUser:B,dateValue:er})]}),"tag"===eZ&&(0,a.jsx)(eK,{accessToken:Y,entityType:"tag",userID:W,userRole:K,entityList:en,premiumUser:B,dateValue:er}),"agent"===eZ&&(0,a.jsxs)(a.Fragment,{children:[eq&&(0,a.jsx)(k.Z,{banner:!0,type:"info",message:"Agent usage (A2A) is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>eS(!1),className:"mb-5"}),(0,a.jsx)(eK,{accessToken:Y,entityType:"agent",userID:W,userRole:K,entityList:(null==eo?void 0:null===(V=eo.agents)||void 0===V?void 0:V.map(e=>({label:e.agent_name,value:e.agent_id})))||null,premiumUser:B,dateValue:er})," "]}),"user-agent-activity"===eZ&&(0,a.jsx)(eT,{accessToken:Y,userRole:K,dateValue:er})]})}),(0,a.jsx)(es,{isOpen:ex,onClose:()=>ep(!1),accessToken:Y}),(0,a.jsx)(eh,{isOpen:eg,onClose:()=>ef(!1),entityType:"team",spendData:{results:H.results,metadata:H.metadata},dateRange:er,selectedFilters:[],customTitle:"Export Usage Data"})]})}},91027:function(e,s,t){t.d(s,{Z:function(){return o}});var a=t(57437),r=t(33866),l=t(2265),n=t(9245);function i(e){let s=s=>{"disableShowNewBadge"===s.key&&e()},t=s=>{let{key:t}=s.detail;"disableShowNewBadge"===t&&e()};return window.addEventListener("storage",s),window.addEventListener(n.Qg,t),()=>{window.removeEventListener("storage",s),window.removeEventListener(n.Qg,t)}}function c(){return"true"===(0,n.le)("disableShowNewBadge")}function o(e){let{children:s}=e;return(0,l.useSyncExternalStore)(i,c)?s?(0,a.jsx)(a.Fragment,{children:s}):null:s?(0,a.jsx)(r.Z,{color:"blue",count:"New",children:s}):(0,a.jsx)(r.Z,{color:"blue",count:"New"})}},91323:function(e,s,t){t.d(s,{S:function(){return n}});var a=t(57437),r=t(2265),l=t(10012);function n(e){var s,t;let{className:n="",...i}=e,c=(0,r.useId)();return s=()=>{let e=document.getAnimations().filter(e=>e instanceof CSSAnimation&&"spin"===e.animationName),s=e.find(e=>{var s;return(null===(s=e.effect.target)||void 0===s?void 0:s.getAttribute("data-spinner-id"))===c}),t=e.find(e=>{var s;return e.effect instanceof KeyframeEffect&&(null===(s=e.effect.target)||void 0===s?void 0:s.getAttribute("data-spinner-id"))!==c});s&&t&&(s.currentTime=t.currentTime)},t=[c],(0,r.useLayoutEffect)(s,t),(0,a.jsxs)("svg",{"data-spinner-id":c,className:(0,l.cx)("pointer-events-none size-12 animate-spin text-current",n),fill:"none",viewBox:"0 0 24 24",...i,children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.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"})]})}},47375:function(e,s,t){var a=t(57437),r=t(2265),l=t(19250),n=t(59872),i=t(39760);s.Z=e=>{let{userSpend:s,userMaxBudget:t,selectedTeam:c}=e,{accessToken:o,userRole:d,userId:u}=(0,i.Z)(),[m,x]=(0,r.useState)(null!==s?s:0),[h,p]=(0,r.useState)(c?Number((0,n.pw)(c.max_budget,4)):null);(0,r.useEffect)(()=>{if(c){if("Default Team"===c.team_alias)p(t);else{let e=!1;if(c.team_memberships)for(let s of c.team_memberships)s.user_id===u&&"max_budget"in s.litellm_budget_table&&null!==s.litellm_budget_table.max_budget&&(p(s.litellm_budget_table.max_budget),e=!0);e||p(c.max_budget)}}else p(t)},[c,t]);let[g,j]=(0,r.useState)([]);(0,r.useEffect)(()=>{let e=async()=>{if(!o||!u||!d)return};(async()=>{try{if(null===u||null===d)return;if(null!==o){let e=(await (0,l.modelAvailableCall)(o,u,d)).data.map(e=>e.id);console.log("available_model_names:",e),j(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[d,o,u]),(0,r.useEffect)(()=>{null!==s&&x(s)},[s]);let f=[];c&&c.models&&(f=c.models),f&&f.includes("all-proxy-models")?(console.log("user models:",g),f=g):f&&f.includes("all-team-models")?f=c.models:f&&0===f.length&&(f=g);let _=null!==h?"$".concat((0,n.pw)(Number(h),4)," limit"):"No limit",y=void 0!==m?(0,n.pw)(m,4):null;return console.log("spend in view user spend: ".concat(m)),(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsxs)("div",{className:"flex justify-between gap-x-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total Spend"}),(0,a.jsxs)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:["$",y]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Max Budget"}),(0,a.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:_})]})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1918-00295dde1099fe9a.js b/litellm/proxy/_experimental/out/_next/static/chunks/1918-00295dde1099fe9a.js deleted file mode 100644 index 9cb3ea4daf..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1918-00295dde1099fe9a.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1918,7688],{5540:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},45246:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},34419:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.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:"plus-circle",theme:"outlined"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},89245:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},78355:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},8881:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},3632:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var n=r(1119),o=r(2265),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"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},35291:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},58747:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(5853),o=r(2265);let a=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))}},4537:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(5853),o=r(2265);let a=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))}},41649:function(e,t,r){"use strict";r.d(t,{Z:function(){return p}});var n=r(5853),o=r(2265),a=r(47187),l=r(7084),i=r(26898),c=r(13241),s=r(1153);let u={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},d={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},m=(0,s.fn)("Badge"),p=o.forwardRef((e,t)=>{let{color:r,icon:p,size:f=l.u8.SM,tooltip:b,className:g,children:v}=e,h=(0,n._T)(e,["color","icon","size","tooltip","className","children"]),w=p||null,{tooltipProps:y,getReferenceProps:k}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,s.lq)([t,y.refs.setReference]),className:(0,c.q)(m("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",r?(0,c.q)((0,s.bM)(r,i.K.background).bgColor,(0,s.bM)(r,i.K.iconText).textColor,(0,s.bM)(r,i.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,c.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),u[f].paddingX,u[f].paddingY,u[f].fontSize,g)},k,h),o.createElement(a.Z,Object.assign({text:b},y)),w?o.createElement(w,{className:(0,c.q)(m("icon"),"shrink-0 -ml-1 mr-1.5",d[f].height,d[f].width)}):null,o.createElement("span",{className:(0,c.q)(m("text"),"whitespace-nowrap")},v))});p.displayName="Badge"},47323:function(e,t,r){"use strict";r.d(t,{Z:function(){return b}});var n=r(5853),o=r(2265),a=r(47187),l=r(7084),i=r(13241),c=r(1153),s=r(26898);let u={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"}},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:""}},p=(e,t)=>{switch(e){case"simple":return{textColor:t?(0,c.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,c.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.q)((0,c.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,c.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.q)((0,c.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,c.bM)(t,s.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,i.q)((0,c.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,c.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.q)((0,c.bM)(t,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,c.bM)(t,s.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,i.q)((0,c.bM)(t,s.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},f=(0,c.fn)("Icon"),b=o.forwardRef((e,t)=>{let{icon:r,variant:s="simple",tooltip:b,size:g=l.u8.SM,color:v,className:h}=e,w=(0,n._T)(e,["icon","variant","tooltip","size","color","className"]),y=p(s,v),{tooltipProps:k,getReferenceProps:x}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,c.lq)([t,k.refs.setReference]),className:(0,i.q)(f("root"),"inline-flex shrink-0 items-center justify-center",y.bgColor,y.textColor,y.borderColor,y.ringColor,m[s].rounded,m[s].border,m[s].shadow,m[s].ring,u[g].paddingX,u[g].paddingY,h)},x,w),o.createElement(a.Z,Object.assign({text:b},k)),o.createElement(r,{className:(0,i.q)(f("icon"),"shrink-0",d[g].height,d[g].width)}))});b.displayName="Icon"},30150:function(e,t,r){"use strict";r.d(t,{Z:function(){return m}});var n=r(5853),o=r(2265);let a=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M12 4v16m8-8H4"}))},l=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M20 12H4"}))};var i=r(13241),c=r(1153),s=r(69262);let u="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",m=o.forwardRef((e,t)=>{let{onSubmit:r,enableStepper:m=!0,disabled:p,onValueChange:f,onChange:b}=e,g=(0,n._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),v=(0,o.useRef)(null),[h,w]=o.useState(!1),y=o.useCallback(()=>{w(!0)},[]),k=o.useCallback(()=>{w(!1)},[]),[x,C]=o.useState(!1),E=o.useCallback(()=>{C(!0)},[]),O=o.useCallback(()=>{C(!1)},[]);return o.createElement(s.Z,Object.assign({type:"number",ref:(0,c.lq)([v,t]),disabled:p,makeInputClassName:(0,c.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=v.current)||void 0===t?void 0:t.value;null==r||r(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&y(),"ArrowUp"===e.key&&E()},onKeyUp:e=>{"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&O()},onChange:e=>{p||(null==f||f(parseFloat(e.target.value)),null==b||b(e))},stepper:m?o.createElement("div",{className:(0,i.q)("flex justify-center align-middle")},o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=v.current)||void 0===e||e.stepDown(),null===(t=v.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.q)(!p&&d,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(l,{"data-testid":"step-down",className:(h?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=v.current)||void 0===e||e.stepUp(),null===(t=v.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.q)(!p&&d,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(a,{"data-testid":"step-up",className:(x?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},g))});m.displayName="NumberInput"},27281:function(e,t,r){"use strict";r.d(t,{Z:function(){return f}});var n=r(5853),o=r(58747),a=r(2265),l=r(4537),i=r(13241),c=r(1153),s=r(96398),u=r(51975),d=r(85238),m=r(44140);let p=(0,c.fn)("Select"),f=a.forwardRef((e,t)=>{let{defaultValue:r="",value:c,onValueChange:f,placeholder:b="Select...",disabled:g=!1,icon:v,enableClear:h=!1,required:w,children:y,name:k,error:x=!1,errorMessage:C,className:E,id:O}=e,j=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),S=(0,a.useRef)(null),N=a.Children.toArray(y),[Z,M]=(0,m.Z)(r,c),P=(0,a.useMemo)(()=>{let e=a.Children.toArray(y).filter(a.isValidElement);return(0,s.sl)(e)},[y]);return a.createElement("div",{className:(0,i.q)("w-full min-w-[10rem] text-tremor-default",E)},a.createElement("div",{className:"relative"},a.createElement("select",{title:"select-hidden",required:w,className:(0,i.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:Z,onChange:e=>{e.preventDefault()},name:k,disabled:g,id:O,onFocus:()=>{let e=S.current;e&&e.focus()}},a.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},b),N.map(e=>{let t=e.props.value,r=e.props.children;return a.createElement("option",{className:"hidden",key:t,value:t},r)})),a.createElement(u.Ri,Object.assign({as:"div",ref:t,defaultValue:Z,value:Z,onChange:e=>{null==f||f(e),M(e)},disabled:g,id:O},j),e=>{var t;let{value:r}=e;return a.createElement(a.Fragment,null,a.createElement(u.Y4,{ref:S,className:(0,i.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","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",v?"pl-10":"pl-3",(0,s.um)((0,s.Uh)(r),g,x))},v&&a.createElement("span",{className:(0,i.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},a.createElement(v,{className:(0,i.q)(p("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),a.createElement("span",{className:"w-[90%] block truncate"},r&&null!==(t=P.get(r))&&void 0!==t?t:b),a.createElement("span",{className:(0,i.q)("absolute inset-y-0 right-0 flex items-center mr-3")},a.createElement(o.Z,{className:(0,i.q)(p("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),h&&Z?a.createElement("button",{type:"button",className:(0,i.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),M(""),null==f||f("")}},a.createElement(l.Z,{className:(0,i.q)(p("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,a.createElement(d.u,{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"},a.createElement(u.O_,{anchor:"bottom start",className:(0,i.q)("z-10 w-[var(--button-width)] divide-y 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")},y)))})),x&&C?a.createElement("p",{className:(0,i.q)("errorMessage","text-sm text-rose-500 mt-1")},C):null)});f.displayName="Select"},59341:function(e,t,r){"use strict";r.d(t,{Z:function(){return T}});var n=r(5853),o=r(71049),a=r(11323),l=r(2265),i=r(66797),c=r(40099),s=r(74275),u=r(59456),d=r(93980),m=r(65573),p=r(67561),f=r(87550),b=r(628),g=r(80281),v=r(31370),h=r(20131),w=r(38929),y=r(52307),k=r(52724),x=r(7935);let C=(0,l.createContext)(null);C.displayName="GroupContext";let E=l.Fragment,O=Object.assign((0,w.yV)(function(e,t){var r;let n=(0,l.useId)(),E=(0,g.Q)(),O=(0,f.B)(),{id:j=E||"headlessui-switch-".concat(n),disabled:S=O||!1,checked:N,defaultChecked:Z,onChange:M,name:P,value:T,form:L,autoFocus:z=!1,...R}=e,I=(0,l.useContext)(C),[B,D]=(0,l.useState)(null),q=(0,l.useRef)(null),H=(0,p.T)(q,t,null===I?null:I.setSwitch,D),F=(0,s.L)(Z),[W,V]=(0,c.q)(N,M,null!=F&&F),A=(0,u.G)(),[_,K]=(0,l.useState)(!1),X=(0,d.z)(()=>{K(!0),null==V||V(!W),A.nextFrame(()=>{K(!1)})}),Y=(0,d.z)(e=>{if((0,v.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),X()}),U=(0,d.z)(e=>{e.key===k.R.Space?(e.preventDefault(),X()):e.key===k.R.Enter&&(0,h.g)(e.currentTarget)}),G=(0,d.z)(e=>e.preventDefault()),$=(0,x.wp)(),J=(0,y.zH)(),{isFocusVisible:Q,focusProps:ee}=(0,o.F)({autoFocus:z}),{isHovered:et,hoverProps:er}=(0,a.X)({isDisabled:S}),{pressed:en,pressProps:eo}=(0,i.x)({disabled:S}),ea=(0,l.useMemo)(()=>({checked:W,disabled:S,hover:et,focus:Q,active:en,autofocus:z,changing:_}),[W,et,Q,en,S,_,z]),el=(0,w.dG)({id:j,ref:H,role:"switch",type:(0,m.f)(e,B),tabIndex:-1===e.tabIndex?0:null!=(r=e.tabIndex)?r:0,"aria-checked":W,"aria-labelledby":$,"aria-describedby":J,disabled:S||void 0,autoFocus:z,onClick:Y,onKeyUp:U,onKeyPress:G},ee,er,eo),ei=(0,l.useCallback)(()=>{if(void 0!==F)return null==V?void 0:V(F)},[V,F]),ec=(0,w.L6)();return l.createElement(l.Fragment,null,null!=P&&l.createElement(b.Mt,{disabled:S,data:{[P]:T||"on"},overrides:{type:"checkbox",checked:W},form:L,onReset:ei}),ec({ourProps:el,theirProps:R,slot:ea,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,l.useState)(null),[o,a]=(0,x.bE)(),[i,c]=(0,y.fw)(),s=(0,l.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),u=(0,w.L6)();return l.createElement(c,{name:"Switch.Description",value:i},l.createElement(a,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=s.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.createElement(C.Provider,{value:s},u({ourProps:{},theirProps:e,slot:{},defaultTag:E,name:"Switch.Group"}))))},Label:x.__,Description:y.dk});var j=r(44140),S=r(26898),N=r(13241),Z=r(1153),M=r(47187);let P=(0,Z.fn)("Switch"),T=l.forwardRef((e,t)=>{let{checked:r,defaultChecked:o=!1,onChange:a,color:i,name:c,error:s,errorMessage:u,disabled:d,required:m,tooltip:p,id:f}=e,b=(0,n._T)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:i?(0,Z.bM)(i,S.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:i?(0,Z.bM)(i,S.K.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[v,h]=(0,j.Z)(o,r),[w,y]=(0,l.useState)(!1),{tooltipProps:k,getReferenceProps:x}=(0,M.l)(300);return l.createElement("div",{className:"flex flex-row items-center justify-start"},l.createElement(M.Z,Object.assign({text:p},k)),l.createElement("div",Object.assign({ref:(0,Z.lq)([t,k.refs.setReference]),className:(0,N.q)(P("root"),"flex flex-row relative h-5")},b,x),l.createElement("input",{type:"checkbox",className:(0,N.q)(P("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:c,required:m,checked:v,onChange:e=>{e.preventDefault()}}),l.createElement(O,{checked:v,onChange:e=>{h(e),null==a||a(e)},disabled:d,className:(0,N.q)(P("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:()=>y(!0),onBlur:()=>y(!1),id:f},l.createElement("span",{className:(0,N.q)(P("sr-only"),"sr-only")},"Switch ",v?"on":"off"),l.createElement("span",{"aria-hidden":"true",className:(0,N.q)(P("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")}),l.createElement("span",{"aria-hidden":"true",className:(0,N.q)(P("round"),v?(0,N.q)(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",w?(0,N.q)("ring-2",g.ringColor):"")}))),s&&u?l.createElement("p",{className:(0,N.q)(P("errorMessage"),"text-sm text-red-500 mt-1 ")},u):null)});T.displayName="Switch"},87452:function(e,t,r){"use strict";r.d(t,{Z:function(){return d},r:function(){return u}});var n=r(5853),o=r(91054);r(42698),r(64016);var a=r(8710);r(33232);var l=r(13241),i=r(1153),c=r(2265);let s=(0,i.fn)("Accordion"),u=(0,c.createContext)({isOpen:!1}),d=c.forwardRef((e,t)=>{var r;let{defaultOpen:i=!1,children:d,className:m}=e,p=(0,n._T)(e,["defaultOpen","children","className"]),f=null!==(r=(0,c.useContext)(a.Z))&&void 0!==r?r:(0,l.q)("rounded-tremor-default border");return c.createElement(o.pJ,Object.assign({as:"div",ref:t,className:(0,l.q)(s("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",f,m),defaultOpen:i},p),e=>{let{open:t}=e;return c.createElement(u.Provider,{value:{isOpen:t}},d)})});d.displayName="Accordion"},88829:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(5853),o=r(2265),a=r(91054),l=r(13241);let i=(0,r(1153).fn)("AccordionBody"),c=o.forwardRef((e,t)=>{let{children:r,className:c}=e,s=(0,n._T)(e,["children","className"]);return o.createElement(a.pJ.Panel,Object.assign({ref:t,className:(0,l.q)(i("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",c)},s),r)});c.displayName="AccordionBody"},72208:function(e,t,r){"use strict";r.d(t,{Z:function(){return u}});var n=r(5853),o=r(2265),a=r(91054);let l=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var i=r(87452),c=r(13241);let s=(0,r(1153).fn)("AccordionHeader"),u=o.forwardRef((e,t)=>{let{children:r,className:u}=e,d=(0,n._T)(e,["children","className"]),{isOpen:m}=(0,o.useContext)(i.r);return o.createElement(a.pJ.Button,Object.assign({ref:t,className:(0,c.q)(s("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",u)},d),o.createElement("div",{className:(0,c.q)(s("children"),"flex flex-1 text-inherit mr-4")},r),o.createElement("div",null,o.createElement(l,{className:(0,c.q)(s("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",m?"transition-all":"transition-all -rotate-180")})))});u.displayName="AccordionHeader"},49804:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(5853),o=r(13241),a=r(1153),l=r(2265),i=r(9496);let c=(0,a.fn)("Col"),s=l.forwardRef((e,t)=>{let{numColSpan:r=1,numColSpanSm:a,numColSpanMd:s,numColSpanLg:u,children:d,className:m}=e,p=(0,n._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),f=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return l.createElement("div",Object.assign({ref:t,className:(0,o.q)(c("root"),(()=>{let e=f(r,i.PT),t=f(a,i.SP),n=f(s,i.VS),l=f(u,i._w);return(0,o.q)(e,t,n,l)})(),m)},p),d)});s.displayName="Col"},97765:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(5853),o=r(26898),a=r(13241),l=r(1153),i=r(2265);let c=i.forwardRef((e,t)=>{let{color:r,children:c,className:s}=e,u=(0,n._T)(e,["color","children","className"]);return i.createElement("p",Object.assign({ref:t,className:(0,a.q)(r?(0,l.bM)(r,o.K.lightText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",s)},u),c)});c.displayName="Subtitle"},44140:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(2265);let o=(e,t)=>{let r=void 0!==t,[o,a]=(0,n.useState)(e);return[r?t:o,e=>{r||a(e)}]}},92570:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=e=>e?"function"==typeof e?e():e:null},33866:function(e,t,r){"use strict";r.d(t,{Z:function(){return L}});var n=r(2265),o=r(36760),a=r.n(o),l=r(66632),i=r(93350),c=r(19722),s=r(71744),u=r(93463),d=r(12918),m=r(18536),p=r(71140),f=r(99320);let b=new u.E4("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),g=new u.E4("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),v=new u.E4("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),h=new u.E4("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),w=new u.E4("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),y=new u.E4("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),k=e=>{let{componentCls:t,iconCls:r,antCls:n,badgeShadowSize:o,textFontSize:a,textFontSizeSM:l,statusSize:i,dotSize:c,textFontWeight:s,indicatorHeight:p,indicatorHeightSM:f,marginXS:k,calc:x}=e,C="".concat(n,"-scroll-number"),E=(0,m.Z)(e,(e,r)=>{let{darkColor:n}=r;return{["&".concat(t," ").concat(t,"-color-").concat(e)]:{background:n,["&:not(".concat(t,"-count)")]:{color:n},"a:hover &":{background:n}}}});return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,d.Wf)(e)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,["".concat(t,"-count")]:{display:"inline-flex",justifyContent:"center",zIndex:e.indicatorZIndex,minWidth:p,height:p,color:e.badgeTextColor,fontWeight:s,fontSize:a,lineHeight:(0,u.bf)(p),whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:x(p).div(2).equal(),boxShadow:"0 0 0 ".concat((0,u.bf)(o)," ").concat(e.badgeShadowColor),transition:"background ".concat(e.motionDurationMid),a:{color:e.badgeTextColor},"a:hover":{color:e.badgeTextColor},"a:hover &":{background:e.badgeColorHover}},["".concat(t,"-count-sm")]:{minWidth:f,height:f,fontSize:l,lineHeight:(0,u.bf)(f),borderRadius:x(f).div(2).equal()},["".concat(t,"-multiple-words")]:{padding:"0 ".concat((0,u.bf)(e.paddingXS)),bdi:{unicodeBidi:"plaintext"}},["".concat(t,"-dot")]:{zIndex:e.indicatorZIndex,width:c,minWidth:c,height:c,background:e.badgeColor,borderRadius:"100%",boxShadow:"0 0 0 ".concat((0,u.bf)(o)," ").concat(e.badgeShadowColor)},["".concat(t,"-count, ").concat(t,"-dot, ").concat(C,"-custom-component")]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",["&".concat(r,"-spin")]:{animationName:y,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},["&".concat(t,"-status")]:{lineHeight:"inherit",verticalAlign:"baseline",["".concat(t,"-status-dot")]:{position:"relative",top:-1,display:"inline-block",width:i,height:i,verticalAlign:"middle",borderRadius:"50%"},["".concat(t,"-status-success")]:{backgroundColor:e.colorSuccess},["".concat(t,"-status-processing")]:{overflow:"visible",color:e.colorInfo,backgroundColor:e.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:o,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:b,animationDuration:e.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},["".concat(t,"-status-default")]:{backgroundColor:e.colorTextPlaceholder},["".concat(t,"-status-error")]:{backgroundColor:e.colorError},["".concat(t,"-status-warning")]:{backgroundColor:e.colorWarning},["".concat(t,"-status-text")]:{marginInlineStart:k,color:e.colorText,fontSize:e.fontSize}}}),E),{["".concat(t,"-zoom-appear, ").concat(t,"-zoom-enter")]:{animationName:g,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},["".concat(t,"-zoom-leave")]:{animationName:v,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},["&".concat(t,"-not-a-wrapper")]:{["".concat(t,"-zoom-appear, ").concat(t,"-zoom-enter")]:{animationName:h,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},["".concat(t,"-zoom-leave")]:{animationName:w,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},["&:not(".concat(t,"-status)")]:{verticalAlign:"middle"},["".concat(C,"-custom-component, ").concat(t,"-count")]:{transform:"none"},["".concat(C,"-custom-component, ").concat(C)]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[C]:{overflow:"hidden",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseOutBack),["".concat(C,"-only")]:{position:"relative",display:"inline-block",height:p,transition:"all ".concat(e.motionDurationSlow," ").concat(e.motionEaseOutBack),WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",["> p".concat(C,"-only-unit")]:{height:p,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},["".concat(C,"-symbol")]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",["".concat(t,"-count, ").concat(t,"-dot, ").concat(C,"-custom-component")]:{transform:"translate(-50%, -50%)"}}})}},x=e=>{let{fontHeight:t,lineWidth:r,marginXS:n,colorBorderBg:o}=e,a=e.colorTextLightSolid,l=e.colorError,i=e.colorErrorHover;return(0,p.IX)(e,{badgeFontHeight:t,badgeShadowSize:r,badgeTextColor:a,badgeColor:l,badgeColorHover:i,badgeShadowColor:o,badgeProcessingDuration:"1.2s",badgeRibbonOffset:n,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},C=e=>{let{fontSize:t,lineHeight:r,fontSizeSM:n,lineWidth:o}=e;return{indicatorZIndex:"auto",indicatorHeight:Math.round(t*r)-2*o,indicatorHeightSM:t,dotSize:n/2,textFontSize:n,textFontSizeSM:n,textFontWeight:"normal",statusSize:n/2}};var E=(0,f.I$)("Badge",e=>k(x(e)),C);let O=e=>{let{antCls:t,badgeFontHeight:r,marginXS:n,badgeRibbonOffset:o,calc:a}=e,l="".concat(t,"-ribbon"),i=(0,m.Z)(e,(e,t)=>{let{darkColor:r}=t;return{["&".concat(l,"-color-").concat(e)]:{background:r,color:r}}});return{["".concat(t,"-ribbon-wrapper")]:{position:"relative"},[l]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,d.Wf)(e)),{position:"absolute",top:n,padding:"0 ".concat((0,u.bf)(e.paddingXS)),color:e.colorPrimary,lineHeight:(0,u.bf)(r),whiteSpace:"nowrap",backgroundColor:e.colorPrimary,borderRadius:e.borderRadiusSM,["".concat(l,"-text")]:{color:e.badgeTextColor},["".concat(l,"-corner")]:{position:"absolute",top:"100%",width:o,height:o,color:"currentcolor",border:"".concat((0,u.bf)(a(o).div(2).equal())," solid"),transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),i),{["&".concat(l,"-placement-end")]:{insetInlineEnd:a(o).mul(-1).equal(),borderEndEndRadius:0,["".concat(l,"-corner")]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},["&".concat(l,"-placement-start")]:{insetInlineStart:a(o).mul(-1).equal(),borderEndStartRadius:0,["".concat(l,"-corner")]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}};var j=(0,f.I$)(["Badge","Ribbon"],e=>O(x(e)),C);let S=e=>{let t;let{prefixCls:r,value:o,current:l,offset:i=0}=e;return i&&(t={position:"absolute",top:"".concat(i,"00%"),left:0}),n.createElement("span",{style:t,className:a()("".concat(r,"-only-unit"),{current:l})},o)};var N=e=>{let t,r;let{prefixCls:o,count:a,value:l}=e,i=Number(l),c=Math.abs(a),[s,u]=n.useState(i),[d,m]=n.useState(c),p=()=>{u(i),m(c)};if(n.useEffect(()=>{let e=setTimeout(p,1e3);return()=>clearTimeout(e)},[i]),s===i||Number.isNaN(i)||Number.isNaN(s))t=[n.createElement(S,Object.assign({},e,{key:i,current:!0}))],r={transition:"none"};else{t=[];let o=i+10,a=[];for(let e=i;e<=o;e+=1)a.push(e);let l=de%10===s);t=(l<0?a.slice(0,u+1):a.slice(u)).map((t,r)=>n.createElement(S,Object.assign({},e,{key:t,value:t%10,offset:l<0?r-u:r,current:r===u}))),r={transform:"translateY(".concat(-function(e,t,r){let n=e,o=0;for(;(n+10)%10!==t;)n+=r,o+=r;return o}(s,i,l),"00%)")}}return n.createElement("span",{className:"".concat(o,"-only"),style:r,onTransitionEnd:p},t)},Z=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)=>{let{prefixCls:r,count:o,className:l,motionClassName:i,style:u,title:d,show:m,component:p="sup",children:f}=e,b=Z(e,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:g}=n.useContext(s.E_),v=g("scroll-number",r),h=Object.assign(Object.assign({},b),{"data-show":m,style:u,className:a()(v,l,i),title:d}),w=o;if(o&&Number(o)%1==0){let e=String(o).split("");w=n.createElement("bdi",null,e.map((t,r)=>n.createElement(N,{prefixCls:v,count:Number(o),value:t,key:e.length-r})))}return((null==u?void 0:u.borderColor)&&(h.style=Object.assign(Object.assign({},u),{boxShadow:"0 0 0 1px ".concat(u.borderColor," inset")})),f)?(0,c.Tm)(f,e=>({className:a()("".concat(v,"-custom-component"),null==e?void 0:e.className,i)})):n.createElement(p,Object.assign({},h,{ref:t}),w)});var 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 T=n.forwardRef((e,t)=>{var r,o,u,d,m;let{prefixCls:p,scrollNumberPrefixCls:f,children:b,status:g,text:v,color:h,count:w=null,overflowCount:y=99,dot:k=!1,size:x="default",title:C,offset:O,style:j,className:S,rootClassName:N,classNames:Z,styles:T,showZero:L=!1}=e,z=P(e,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:R,direction:I,badge:B}=n.useContext(s.E_),D=R("badge",p),[q,H,F]=E(D),W=w>y?"".concat(y,"+"):w,V="0"===W||0===W||"0"===v||0===v,A=null===w||V&&!L,_=(null!=g||null!=h)&&A,K=null!=g||!V,X=k&&!V,Y=X?"":W,U=(0,n.useMemo)(()=>((null==Y||""===Y)&&(null==v||""===v)||V&&!L)&&!X,[Y,V,L,X,v]),G=(0,n.useRef)(w);U||(G.current=w);let $=G.current,J=(0,n.useRef)(Y);U||(J.current=Y);let Q=J.current,ee=(0,n.useRef)(X);U||(ee.current=X);let et=(0,n.useMemo)(()=>{if(!O)return Object.assign(Object.assign({},null==B?void 0:B.style),j);let e={marginTop:O[1]};return"rtl"===I?e.left=Number.parseInt(O[0],10):e.right=-Number.parseInt(O[0],10),Object.assign(Object.assign(Object.assign({},e),null==B?void 0:B.style),j)},[I,O,j,null==B?void 0:B.style]),er=null!=C?C:"string"==typeof $||"number"==typeof $?$:void 0,en=!U&&(0===v?L:!!v&&!0!==v),eo=en?n.createElement("span",{className:"".concat(D,"-status-text")},v):null,ea=$&&"object"==typeof $?(0,c.Tm)($,e=>({style:Object.assign(Object.assign({},et),e.style)})):void 0,el=(0,i.o2)(h,!1),ei=a()(null==Z?void 0:Z.indicator,null===(r=null==B?void 0:B.classNames)||void 0===r?void 0:r.indicator,{["".concat(D,"-status-dot")]:_,["".concat(D,"-status-").concat(g)]:!!g,["".concat(D,"-color-").concat(h)]:el}),ec={};h&&!el&&(ec.color=h,ec.background=h);let es=a()(D,{["".concat(D,"-status")]:_,["".concat(D,"-not-a-wrapper")]:!b,["".concat(D,"-rtl")]:"rtl"===I},S,N,null==B?void 0:B.className,null===(o=null==B?void 0:B.classNames)||void 0===o?void 0:o.root,null==Z?void 0:Z.root,H,F);if(!b&&_&&(v||K||!A)){let e=et.color;return q(n.createElement("span",Object.assign({},z,{className:es,style:Object.assign(Object.assign(Object.assign({},null==T?void 0:T.root),null===(u=null==B?void 0:B.styles)||void 0===u?void 0:u.root),et)}),n.createElement("span",{className:ei,style:Object.assign(Object.assign(Object.assign({},null==T?void 0:T.indicator),null===(d=null==B?void 0:B.styles)||void 0===d?void 0:d.indicator),ec)}),en&&n.createElement("span",{style:{color:e},className:"".concat(D,"-status-text")},v)))}return q(n.createElement("span",Object.assign({ref:t},z,{className:es,style:Object.assign(Object.assign({},null===(m=null==B?void 0:B.styles)||void 0===m?void 0:m.root),null==T?void 0:T.root)}),b,n.createElement(l.ZP,{visible:!U,motionName:"".concat(D,"-zoom"),motionAppear:!1,motionDeadline:1e3},e=>{var t,r;let{className:o}=e,l=R("scroll-number",f),i=ee.current,c=a()(null==Z?void 0:Z.indicator,null===(t=null==B?void 0:B.classNames)||void 0===t?void 0:t.indicator,{["".concat(D,"-dot")]:i,["".concat(D,"-count")]:!i,["".concat(D,"-count-sm")]:"small"===x,["".concat(D,"-multiple-words")]:!i&&Q&&Q.toString().length>1,["".concat(D,"-status-").concat(g)]:!!g,["".concat(D,"-color-").concat(h)]:el}),s=Object.assign(Object.assign(Object.assign({},null==T?void 0:T.indicator),null===(r=null==B?void 0:B.styles)||void 0===r?void 0:r.indicator),et);return h&&!el&&((s=s||{}).background=h),n.createElement(M,{prefixCls:l,show:!U,motionClassName:o,className:c,count:Q,title:er,style:s,key:"scrollNumber"},ea)}),eo))});T.Ribbon=e=>{let{className:t,prefixCls:r,style:o,color:l,children:c,text:u,placement:d="end",rootClassName:m}=e,{getPrefixCls:p,direction:f}=n.useContext(s.E_),b=p("ribbon",r),g="".concat(b,"-wrapper"),[v,h,w]=j(b,g),y=(0,i.o2)(l,!1),k=a()(b,"".concat(b,"-placement-").concat(d),{["".concat(b,"-rtl")]:"rtl"===f,["".concat(b,"-color-").concat(l)]:y},t),x={},C={};return l&&!y&&(x.background=l,C.color=l),v(n.createElement("div",{className:a()(g,m,h,w)},c,n.createElement("div",{className:a()(k,h),style:Object.assign(Object.assign({},x),o)},n.createElement("span",{className:"".concat(b,"-text")},u),n.createElement("div",{className:"".concat(b,"-corner"),style:C}))))};var L=T},69410:function(e,t,r){"use strict";var n=r(54998);t.Z=n.Z},867:function(e,t,r){"use strict";r.d(t,{Z:function(){return O}});var n=r(2265),o=r(54537),a=r(36760),l=r.n(a),i=r(50506),c=r(18694),s=r(71744),u=r(79326),d=r(59367),m=r(92570),p=r(5545),f=r(51248),b=r(55274),g=r(37381),v=r(20435),h=r(99320);let w=e=>{let{componentCls:t,iconCls:r,antCls:n,zIndexPopup:o,colorText:a,colorWarning:l,marginXXS:i,marginXS:c,fontSize:s,fontWeightStrong:u,colorTextHeading:d}=e;return{[t]:{zIndex:o,["&".concat(n,"-popover")]:{fontSize:s},["".concat(t,"-message")]:{marginBottom:c,display:"flex",flexWrap:"nowrap",alignItems:"start",["> ".concat(t,"-message-icon ").concat(r)]:{color:l,fontSize:s,lineHeight:1,marginInlineEnd:c},["".concat(t,"-title")]:{fontWeight:u,color:d,"&:only-child":{fontWeight:"normal"}},["".concat(t,"-description")]:{marginTop:i,color:a}},["".concat(t,"-buttons")]:{textAlign:"end",whiteSpace:"nowrap",button:{marginInlineStart:c}}}}};var y=(0,h.I$)("Popconfirm",e=>w(e),e=>{let{zIndexPopupBase:t}=e;return{zIndexPopup:t+60}},{resetStyle:!1}),k=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=e=>{let{prefixCls:t,okButtonProps:r,cancelButtonProps:a,title:l,description:i,cancelText:c,okText:u,okType:v="primary",icon:h=n.createElement(o.Z,null),showCancel:w=!0,close:y,onConfirm:k,onCancel:x,onPopupClick:C}=e,{getPrefixCls:E}=n.useContext(s.E_),[O]=(0,b.Z)("Popconfirm",g.Z.Popconfirm),j=(0,m.Z)(l),S=(0,m.Z)(i);return n.createElement("div",{className:"".concat(t,"-inner-content"),onClick:C},n.createElement("div",{className:"".concat(t,"-message")},h&&n.createElement("span",{className:"".concat(t,"-message-icon")},h),n.createElement("div",{className:"".concat(t,"-message-text")},j&&n.createElement("div",{className:"".concat(t,"-title")},j),S&&n.createElement("div",{className:"".concat(t,"-description")},S))),n.createElement("div",{className:"".concat(t,"-buttons")},w&&n.createElement(p.ZP,Object.assign({onClick:x,size:"small"},a),c||(null==O?void 0:O.cancelText)),n.createElement(d.Z,{buttonProps:Object.assign(Object.assign({size:"small"},(0,f.nx)(v)),r),actionFn:k,close:y,prefixCls:E("btn"),quitOnNullishReturnValue:!0,emitEvent:!0},u||(null==O?void 0:O.okText))))};var 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 E=n.forwardRef((e,t)=>{var r,a;let{prefixCls:d,placement:m="top",trigger:p="click",okType:f="primary",icon:b=n.createElement(o.Z,null),children:g,overlayClassName:v,onOpenChange:h,onVisibleChange:w,overlayStyle:k,styles:E,classNames:O}=e,j=C(e,["prefixCls","placement","trigger","okType","icon","children","overlayClassName","onOpenChange","onVisibleChange","overlayStyle","styles","classNames"]),{getPrefixCls:S,className:N,style:Z,classNames:M,styles:P}=(0,s.dj)("popconfirm"),[T,L]=(0,i.Z)(!1,{value:null!==(r=e.open)&&void 0!==r?r:e.visible,defaultValue:null!==(a=e.defaultOpen)&&void 0!==a?a:e.defaultVisible}),z=(e,t)=>{L(e,!0),null==w||w(e),null==h||h(e,t)},R=S("popconfirm",d),I=l()(R,N,v,M.root,null==O?void 0:O.root),B=l()(M.body,null==O?void 0:O.body),[D]=y(R);return D(n.createElement(u.Z,Object.assign({},(0,c.Z)(j,["title"]),{trigger:p,placement:m,onOpenChange:(t,r)=>{let{disabled:n=!1}=e;n||z(t,r)},open:T,ref:t,classNames:{root:I,body:B},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},P.root),Z),k),null==E?void 0:E.root),body:Object.assign(Object.assign({},P.body),null==E?void 0:E.body)},content:n.createElement(x,Object.assign({okType:f,icon:b},e,{prefixCls:R,close:e=>{z(!1,e)},onConfirm:t=>{var r;return null===(r=e.onConfirm)||void 0===r?void 0:r.call(void 0,t)},onCancel:t=>{var r;z(!1,t),null===(r=e.onCancel)||void 0===r||r.call(void 0,t)}})),"data-popover-inject":!0}),g))});E._InternalPanelDoNotUseOrYouWillBeFired=e=>{let{prefixCls:t,placement:r,className:o,style:a}=e,i=k(e,["prefixCls","placement","className","style"]),{getPrefixCls:c}=n.useContext(s.E_),u=c("popconfirm",t),[d]=y(u);return d(n.createElement(v.ZP,{placement:r,className:l()(u,o),style:a,content:n.createElement(x,Object.assign({prefixCls:u},i))}))};var O=E},20435:function(e,t,r){"use strict";r.d(t,{aV:function(){return d}});var n=r(2265),o=r(36760),a=r.n(o),l=r(5769),i=r(92570),c=r(71744),s=r(72262),u=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 d=e=>{let{title:t,content:r,prefixCls:o}=e;return t||r?n.createElement(n.Fragment,null,t&&n.createElement("div",{className:"".concat(o,"-title")},t),r&&n.createElement("div",{className:"".concat(o,"-inner-content")},r)):null},m=e=>{let{hashId:t,prefixCls:r,className:o,style:c,placement:s="top",title:u,content:m,children:p}=e,f=(0,i.Z)(u),b=(0,i.Z)(m),g=a()(t,r,"".concat(r,"-pure"),"".concat(r,"-placement-").concat(s),o);return n.createElement("div",{className:g,style:c},n.createElement("div",{className:"".concat(r,"-arrow")}),n.createElement(l.G,Object.assign({},e,{className:t,prefixCls:r}),p||n.createElement(d,{prefixCls:r,title:f,content:b})))};t.ZP=e=>{let{prefixCls:t,className:r}=e,o=u(e,["prefixCls","className"]),{getPrefixCls:l}=n.useContext(c.E_),i=l("popover",t),[d,p,f]=(0,s.Z)(i);return d(n.createElement(m,Object.assign({},o,{prefixCls:i,hashId:p,className:a()(r,f)})))}},79326:function(e,t,r){"use strict";var n=r(2265),o=r(36760),a=r.n(o),l=r(50506),i=r(95814),c=r(92570),s=r(68710),u=r(19722),d=r(71744),m=r(99981),p=r(20435),f=r(72262),b=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 g=n.forwardRef((e,t)=>{var r,o;let{prefixCls:g,title:v,content:h,overlayClassName:w,placement:y="top",trigger:k="hover",children:x,mouseEnterDelay:C=.1,mouseLeaveDelay:E=.1,onOpenChange:O,overlayStyle:j={},styles:S,classNames:N}=e,Z=b(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:M,className:P,style:T,classNames:L,styles:z}=(0,d.dj)("popover"),R=M("popover",g),[I,B,D]=(0,f.Z)(R),q=M(),H=a()(w,B,D,P,L.root,null==N?void 0:N.root),F=a()(L.body,null==N?void 0:N.body),[W,V]=(0,l.Z)(!1,{value:null!==(r=e.open)&&void 0!==r?r:e.visible,defaultValue:null!==(o=e.defaultOpen)&&void 0!==o?o:e.defaultVisible}),A=(e,t)=>{V(e,!0),null==O||O(e,t)},_=e=>{e.keyCode===i.Z.ESC&&A(!1,e)},K=(0,c.Z)(v),X=(0,c.Z)(h);return I(n.createElement(m.Z,Object.assign({placement:y,trigger:k,mouseEnterDelay:C,mouseLeaveDelay:E},Z,{prefixCls:R,classNames:{root:H,body:F},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},z.root),T),j),null==S?void 0:S.root),body:Object.assign(Object.assign({},z.body),null==S?void 0:S.body)},ref:t,open:W,onOpenChange:e=>{A(e)},overlay:K||X?n.createElement(p.aV,{prefixCls:R,title:K,content:X}):null,transitionName:(0,s.m)(q,"zoom-big",Z.transitionName),"data-popover-inject":!0}),(0,u.Tm)(x,{onKeyDown:e=>{var t,r;(0,n.isValidElement)(x)&&(null===(r=null==x?void 0:(t=x.props).onKeyDown)||void 0===r||r.call(t,e)),_(e)}})))});g._InternalPanelDoNotUseOrYouWillBeFired=p.ZP,t.Z=g},72262:function(e,t,r){"use strict";var n=r(12918),o=r(691),a=r(88260),l=r(34442),i=r(53454),c=r(99320),s=r(71140);let u=e=>{let{componentCls:t,popoverColor:r,titleMinWidth:o,fontWeightStrong:l,innerPadding:i,boxShadowSecondary:c,colorTextHeading:s,borderRadiusLG:u,zIndexPopup:d,titleMarginBottom:m,colorBgElevated:p,popoverBg:f,titleBorderBottom:b,innerContentPadding:g,titlePadding:v}=e;return[{[t]:Object.assign(Object.assign({},(0,n.Wf)(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:d,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"},["".concat(t,"-content")]:{position:"relative"},["".concat(t,"-inner")]:{backgroundColor:f,backgroundClip:"padding-box",borderRadius:u,boxShadow:c,padding:i},["".concat(t,"-title")]:{minWidth:o,marginBottom:m,color:s,fontWeight:l,borderBottom:b,padding:v},["".concat(t,"-inner-content")]:{color:r,padding:g}})},(0,a.ZP)(e,"var(--antd-arrow-background-color)"),{["".concat(t,"-pure")]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",["".concat(t,"-content")]:{display:"inline-block"}}}]},d=e=>{let{componentCls:t}=e;return{[t]:i.i.map(r=>{let n=e["".concat(r,"6")];return{["&".concat(t,"-").concat(r)]:{"--antd-arrow-background-color":n,["".concat(t,"-inner")]:{backgroundColor:n},["".concat(t,"-arrow")]:{background:"transparent"}}}})}};t.Z=(0,c.I$)("Popover",e=>{let{colorBgElevated:t,colorText:r}=e,n=(0,s.IX)(e,{popoverBg:t,popoverColor:r});return[u(n),d(n),(0,o._y)(n,"zoom-big")]},e=>{let{lineWidth:t,controlHeight:r,fontHeight:n,padding:o,wireframe:i,zIndexPopupBase:c,borderRadiusLG:s,marginXS:u,lineType:d,colorSplit:m,paddingSM:p}=e,f=r-n;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:c+30},(0,l.w)(e)),(0,a.wZ)({contentRadius:s,limitVerticalRadius:!0})),{innerPadding:i?0:12,titleMarginBottom:i?0:u,titlePadding:i?"".concat(f/2,"px ").concat(o,"px ").concat(f/2-t,"px"):0,titleBorderBottom:i?"".concat(t,"px ").concat(d," ").concat(m):"none",innerContentPadding:i?"".concat(p,"px ").concat(o,"px"):0})},{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]})},47451:function(e,t,r){"use strict";var n=r(77774);t.Z=n.Z},3810:function(e,t,r){"use strict";r.d(t,{Z:function(){return M}});var n=r(2265),o=r(36760),a=r.n(o),l=r(18694),i=r(93350),c=r(53445),s=r(19722),u=r(6694),d=r(71744),m=r(93463),p=r(54558),f=r(12918),b=r(71140),g=r(99320);let v=e=>{let{paddingXXS:t,lineWidth:r,tagPaddingHorizontal:n,componentCls:o,calc:a}=e,l=a(n).sub(r).equal(),i=a(t).sub(r).equal();return{[o]:Object.assign(Object.assign({},(0,f.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:l,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:i,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:l}}),["".concat(o,"-borderless")]:{borderColor:"transparent",background:e.tagBorderlessBg}}},h=e=>{let{lineWidth:t,fontSizeIcon:r,calc:n}=e,o=e.fontSizeSM;return(0,b.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})},w=e=>({defaultBg:new p.t(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText});var y=(0,g.I$)("Tag",e=>v(h(e)),w),k=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:l,checked:i,children:c,icon:s,onChange:u,onClick:m}=e,p=k(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:f,tag:b}=n.useContext(d.E_),g=f("tag",r),[v,h,w]=y(g),x=a()(g,"".concat(g,"-checkable"),{["".concat(g,"-checkable-checked")]:i},null==b?void 0:b.className,l,h,w);return v(n.createElement("span",Object.assign({},p,{ref:t,style:Object.assign(Object.assign({},o),null==b?void 0:b.style),className:x,onClick:e=>{null==u||u(!i),null==m||m(e)}}),s,n.createElement("span",null,c)))});var C=r(18536);let E=e=>(0,C.Z)(e,(t,r)=>{let{textColor:n,lightBorderColor:o,lightColor:a,darkColor:l}=r;return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(t)]:{color:n,background:a,borderColor:o,"&-inverse":{color:e.colorTextLightSolid,background:l,borderColor:l},["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}});var O=(0,g.bk)(["Tag","preset"],e=>E(h(e)),w);let j=(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 S=(0,g.bk)(["Tag","status"],e=>{let t=h(e);return[j(t,"success","Success"),j(t,"processing","Info"),j(t,"error","Error"),j(t,"warning","Warning")]},w),N=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:p,children:f,icon:b,color:g,onClose:v,bordered:h=!0,visible:w}=e,k=N(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:x,direction:C,tag:E}=n.useContext(d.E_),[j,Z]=n.useState(!0),M=(0,l.Z)(k,["closeIcon","closable"]);n.useEffect(()=>{void 0!==w&&Z(w)},[w]);let P=(0,i.o2)(g),T=(0,i.yT)(g),L=P||T,z=Object.assign(Object.assign({backgroundColor:g&&!L?g:void 0},null==E?void 0:E.style),p),R=x("tag",r),[I,B,D]=y(R),q=a()(R,null==E?void 0:E.className,{["".concat(R,"-").concat(g)]:L,["".concat(R,"-has-color")]:g&&!L,["".concat(R,"-hidden")]:!j,["".concat(R,"-rtl")]:"rtl"===C,["".concat(R,"-borderless")]:!h},o,m,B,D),H=e=>{e.stopPropagation(),null==v||v(e),e.defaultPrevented||Z(!1)},[,F]=(0,c.b)((0,c.w)(e),(0,c.w)(E),{closable:!1,closeIconRender:e=>{let t=n.createElement("span",{className:"".concat(R,"-close-icon"),onClick:H},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),H(t)},className:a()(null==e?void 0:e.className,"".concat(R,"-close-icon"))}))}}),W="function"==typeof k.onClick||f&&"a"===f.type,V=b||null,A=V?n.createElement(n.Fragment,null,V,f&&n.createElement("span",null,f)):f,_=n.createElement("span",Object.assign({},M,{ref:t,className:q,style:z}),A,F,P&&n.createElement(O,{key:"preset",prefixCls:R}),T&&n.createElement(S,{key:"status",prefixCls:R}));return I(W?n.createElement(u.Z,{component:"Tag"},_):_)});Z.CheckableTag=x;var M=Z},23910:function(e,t,r){var n=r(74288).Symbol;e.exports=n},54506:function(e,t,r){var n=r(23910),o=r(4479),a=r(80910),l=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":l&&l in Object(e)?o(e):a(e)}},41087:function(e,t,r){var n=r(5035),o=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(o,""):e}},17071:function(e,t,r){var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},4479:function(e,t,r){var n=r(23910),o=Object.prototype,a=o.hasOwnProperty,l=o.toString,i=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,i),r=e[i];try{e[i]=void 0;var n=!0}catch(e){}var o=l.call(e);return n&&(t?e[i]=r:delete e[i]),o}},80910:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},74288:function(e,t,r){var n=r(17071),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},5035:function(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},7310:function(e,t,r){var n=r(28302),o=r(11121),a=r(6660),l=Math.max,i=Math.min;e.exports=function(e,t,r){var c,s,u,d,m,p,f=0,b=!1,g=!1,v=!0;if("function"!=typeof e)throw TypeError("Expected a function");function h(t){var r=c,n=s;return c=s=void 0,f=t,d=e.apply(n,r)}function w(e){var r=e-p,n=e-f;return void 0===p||r>=t||r<0||g&&n>=u}function y(){var e,r,n,a=o();if(w(a))return k(a);m=setTimeout(y,(e=a-p,r=a-f,n=t-e,g?i(n,u-r):n))}function k(e){return(m=void 0,v&&c)?h(e):(c=s=void 0,d)}function x(){var e,r=o(),n=w(r);if(c=arguments,s=this,p=r,n){if(void 0===m)return f=e=p,m=setTimeout(y,t),b?h(e):d;if(g)return clearTimeout(m),m=setTimeout(y,t),h(p)}return void 0===m&&(m=setTimeout(y,t)),d}return t=a(t)||0,n(r)&&(b=!!r.leading,u=(g="maxWait"in r)?l(a(r.maxWait)||0,t):u,v="trailing"in r?!!r.trailing:v),x.cancel=function(){void 0!==m&&clearTimeout(m),f=0,c=p=s=m=void 0},x.flush=function(){return void 0===m?d:k(o())},x}},28302:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},10303:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},78371:function(e,t,r){var n=r(54506),o=r(10303);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==n(e)}},11121:function(e,t,r){var n=r(74288);e.exports=function(){return n.Date.now()}},6660:function(e,t,r){var n=r(41087),o=r(28302),a=r(78371),l=0/0,i=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,s=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(a(e))return l;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=c.test(e);return r||s.test(e)?u(e.slice(2),r?2:8):i.test(e)?l:+e}},30401:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,r){"use strict";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"}]])},87769:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},42208:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},32489:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},10900:function(e,t,r){"use strict";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},91777:function(e,t,r){"use strict";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:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});t.Z=o},86462:function(e,t,r){"use strict";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 9l-7 7-7-7"}))});t.Z=o},47686:function(e,t,r){"use strict";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:"M9 5l7 7-7 7"}))});t.Z=o},44633:function(e,t,r){"use strict";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:"M5 15l7-7 7 7"}))});t.Z=o},82182:function(e,t,r){"use strict";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.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});t.Z=o},79814:function(e,t,r){"use strict";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:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});t.Z=o},15731:function(e,t,r){"use strict";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 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o},45589:function(e,t,r){"use strict";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 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"}))});t.Z=o},53410:function(e,t,r){"use strict";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},93416:function(e,t,r){"use strict";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.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"}))});t.Z=o},91126:function(e,t,r){"use strict";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:"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"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o},77355:function(e,t,r){"use strict";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:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o},22452:function(e,t,r){"use strict";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:"M12 4v16m8-8H4"}))});t.Z=o},23628:function(e,t,r){"use strict";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:"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"}))});t.Z=o},25327:function(e,t,r){"use strict";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:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});t.Z=o},49084:function(e,t,r){"use strict";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:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=o},74998:function(e,t,r){"use strict";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},3497:function(e,t,r){"use strict";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:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))});t.Z=o},91054:function(e,t,r){"use strict";let n,o;r.d(t,{pJ:function(){return T}});var a,l=r(71049),i=r(11323),c=r(2265),s=r(66797),u=r(93980),d=r(65573),m=r(67561),p=r(98218),f=r(33443),b=r(28294),g=r(31370),v=r(72468),h=r(5664),w=r(38929);let y=null!=(a=c.startTransition)?a:function(e){e()};var k=r(52724),x=((n=x||{})[n.Open=0]="Open",n[n.Closed=1]="Closed",n),C=((o=C||{})[o.ToggleDisclosure=0]="ToggleDisclosure",o[o.CloseDisclosure=1]="CloseDisclosure",o[o.SetButtonId=2]="SetButtonId",o[o.SetPanelId=3]="SetPanelId",o[o.SetButtonElement=4]="SetButtonElement",o[o.SetPanelElement=5]="SetPanelElement",o);let E={0:e=>({...e,disclosureState:(0,v.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},O=(0,c.createContext)(null);function j(e){let t=(0,c.useContext)(O);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,j),t}return t}O.displayName="DisclosureContext";let S=(0,c.createContext)(null);S.displayName="DisclosureAPIContext";let N=(0,c.createContext)(null);function Z(e,t){return(0,v.E)(t.type,E,e,t)}N.displayName="DisclosurePanelContext";let M=c.Fragment,P=w.VN.RenderStrategy|w.VN.Static,T=Object.assign((0,w.yV)(function(e,t){let{defaultOpen:r=!1,...n}=e,o=(0,c.useRef)(null),a=(0,m.T)(t,(0,m.h)(e=>{o.current=e},void 0===e.as||e.as===c.Fragment)),l=(0,c.useReducer)(Z,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:i,buttonId:s},d]=l,p=(0,u.z)(e=>{d({type:1});let t=(0,h.r)(o);if(!t||!s)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(s):t.getElementById(s);null==r||r.focus()}),g=(0,c.useMemo)(()=>({close:p}),[p]),y=(0,c.useMemo)(()=>({open:0===i,close:p}),[i,p]),k=(0,w.L6)();return c.createElement(O.Provider,{value:l},c.createElement(S.Provider,{value:g},c.createElement(f.Z,{value:p},c.createElement(b.up,{value:(0,v.E)(i,{0:b.ZM.Open,1:b.ZM.Closed})},k({ourProps:{ref:a},theirProps:n,slot:y,defaultTag:M,name:"Disclosure"})))))}),{Button:(0,w.yV)(function(e,t){let r=(0,c.useId)(),{id:n="headlessui-disclosure-button-".concat(r),disabled:o=!1,autoFocus:a=!1,...p}=e,[f,b]=j("Disclosure.Button"),v=(0,c.useContext)(N),h=null!==v&&v===f.panelId,y=(0,c.useRef)(null),x=(0,m.T)(y,t,(0,u.z)(e=>{if(!h)return b({type:4,element:e})}));(0,c.useEffect)(()=>{if(!h)return b({type:2,buttonId:n}),()=>{b({type:2,buttonId:null})}},[n,b,h]);let C=(0,u.z)(e=>{var t;if(h){if(1===f.disclosureState)return;switch(e.key){case k.R.Space:case k.R.Enter:e.preventDefault(),e.stopPropagation(),b({type:0}),null==(t=f.buttonElement)||t.focus()}}else switch(e.key){case k.R.Space:case k.R.Enter:e.preventDefault(),e.stopPropagation(),b({type:0})}}),E=(0,u.z)(e=>{e.key===k.R.Space&&e.preventDefault()}),O=(0,u.z)(e=>{var t;(0,g.P)(e.currentTarget)||o||(h?(b({type:0}),null==(t=f.buttonElement)||t.focus()):b({type:0}))}),{isFocusVisible:S,focusProps:Z}=(0,l.F)({autoFocus:a}),{isHovered:M,hoverProps:P}=(0,i.X)({isDisabled:o}),{pressed:T,pressProps:L}=(0,s.x)({disabled:o}),z=(0,c.useMemo)(()=>({open:0===f.disclosureState,hover:M,active:T,disabled:o,focus:S,autofocus:a}),[f,M,T,S,o,a]),R=(0,d.f)(e,f.buttonElement),I=h?(0,w.dG)({ref:x,type:R,disabled:o||void 0,autoFocus:a,onKeyDown:C,onClick:O},Z,P,L):(0,w.dG)({ref:x,id:n,type:R,"aria-expanded":0===f.disclosureState,"aria-controls":f.panelElement?f.panelId:void 0,disabled:o||void 0,autoFocus:a,onKeyDown:C,onKeyUp:E,onClick:O},Z,P,L);return(0,w.L6)()({ourProps:I,theirProps:p,slot:z,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,w.yV)(function(e,t){let r=(0,c.useId)(),{id:n="headlessui-disclosure-panel-".concat(r),transition:o=!1,...a}=e,[l,i]=j("Disclosure.Panel"),{close:s}=function e(t){let r=(0,c.useContext)(S);if(null===r){let r=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[d,f]=(0,c.useState)(null),g=(0,m.T)(t,(0,u.z)(e=>{y(()=>i({type:5,element:e}))}),f);(0,c.useEffect)(()=>(i({type:3,panelId:n}),()=>{i({type:3,panelId:null})}),[n,i]);let v=(0,b.oJ)(),[h,k]=(0,p.Y)(o,d,null!==v?(v&b.ZM.Open)===b.ZM.Open:0===l.disclosureState),x=(0,c.useMemo)(()=>({open:0===l.disclosureState,close:s}),[l.disclosureState,s]),C={ref:g,id:n,...(0,p.X)(k)},E=(0,w.L6)();return c.createElement(b.uu,null,c.createElement(N.Provider,{value:l.panelId},E({ourProps:C,theirProps:a,slot:x,defaultTag:"div",features:P,visible:h,name:"Disclosure.Panel"})))})})},85238:function(e,t,r){"use strict";let n;r.d(t,{u:function(){return N}});var o=r(2265),a=r(59456),l=r(93980),i=r(25289),c=r(73389),s=r(43507),u=r(180),d=r(67561),m=r(98218),p=r(28294),f=r(95504),b=r(72468),g=r(38929);function v(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:C)!==o.Fragment||1===o.Children.count(e.children)}let h=(0,o.createContext)(null);h.displayName="TransitionContext";var w=((n=w||{}).Visible="visible",n.Hidden="hidden",n);let y=(0,o.createContext)(null);function k(e){return"children"in e?k(e.children):e.current.filter(e=>{let{el:t}=e;return null!==t.current}).filter(e=>{let{state:t}=e;return"visible"===t}).length>0}function x(e,t){let r=(0,s.E)(e),n=(0,o.useRef)([]),c=(0,i.t)(),u=(0,a.G)(),d=(0,l.z)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.l4.Hidden,o=n.current.findIndex(t=>{let{el:r}=t;return r===e});-1!==o&&((0,b.E)(t,{[g.l4.Unmount](){n.current.splice(o,1)},[g.l4.Hidden](){n.current[o].state="hidden"}}),u.microTask(()=>{var e;!k(n)&&c.current&&(null==(e=r.current)||e.call(r))}))}),m=(0,l.z)(e=>{let t=n.current.find(t=>{let{el:r}=t;return r===e});return t?"visible"!==t.state&&(t.state="visible"):n.current.push({el:e,state:"visible"}),()=>d(e,g.l4.Unmount)}),p=(0,o.useRef)([]),f=(0,o.useRef)(Promise.resolve()),v=(0,o.useRef)({enter:[],leave:[]}),h=(0,l.z)((e,r,n)=>{p.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(t=>{let[r]=t;return r!==e})),null==t||t.chains.current[r].push([e,new Promise(e=>{p.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(v.current[r].map(e=>{let[t,r]=e;return r})).then(()=>e())})]),"enter"===r?f.current=f.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),w=(0,l.z)((e,t,r)=>{Promise.all(v.current[t].splice(0).map(e=>{let[t,r]=e;return r})).then(()=>{var e;null==(e=p.current.shift())||e()}).then(()=>r(t))});return(0,o.useMemo)(()=>({children:n,register:m,unregister:d,onStart:h,onStop:w,wait:f,chains:v}),[m,d,n,h,w,v,f])}y.displayName="NestingContext";let C=o.Fragment,E=g.VN.RenderStrategy,O=(0,g.yV)(function(e,t){let{show:r,appear:n=!1,unmount:a=!0,...i}=e,s=(0,o.useRef)(null),m=v(e),f=(0,d.T)(...m?[s,t]:null===t?[]:[t]);(0,u.H)();let b=(0,p.oJ)();if(void 0===r&&null!==b&&(r=(b&p.ZM.Open)===p.ZM.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[w,C]=(0,o.useState)(r?"visible":"hidden"),O=x(()=>{r||C("hidden")}),[S,N]=(0,o.useState)(!0),Z=(0,o.useRef)([r]);(0,c.e)(()=>{!1!==S&&Z.current[Z.current.length-1]!==r&&(Z.current.push(r),N(!1))},[Z,r]);let M=(0,o.useMemo)(()=>({show:r,appear:n,initial:S}),[r,n,S]);(0,c.e)(()=>{r?C("visible"):k(O)||null===s.current||C("hidden")},[r,O]);let P={unmount:a},T=(0,l.z)(()=>{var t;S&&N(!1),null==(t=e.beforeEnter)||t.call(e)}),L=(0,l.z)(()=>{var t;S&&N(!1),null==(t=e.beforeLeave)||t.call(e)}),z=(0,g.L6)();return o.createElement(y.Provider,{value:O},o.createElement(h.Provider,{value:M},z({ourProps:{...P,as:o.Fragment,children:o.createElement(j,{ref:f,...P,...i,beforeEnter:T,beforeLeave:L})},theirProps:{},defaultTag:o.Fragment,features:E,visible:"visible"===w,name:"Transition"})))}),j=(0,g.yV)(function(e,t){var r,n;let{transition:a=!0,beforeEnter:i,afterEnter:s,beforeLeave:w,afterLeave:O,enter:j,enterFrom:S,enterTo:N,entered:Z,leave:M,leaveFrom:P,leaveTo:T,...L}=e,[z,R]=(0,o.useState)(null),I=(0,o.useRef)(null),B=v(e),D=(0,d.T)(...B?[I,t,R]:null===t?[]:[t]),q=null==(r=L.unmount)||r?g.l4.Unmount:g.l4.Hidden,{show:H,appear:F,initial:W}=function(){let e=(0,o.useContext)(h);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[V,A]=(0,o.useState)(H?"visible":"hidden"),_=function(){let e=(0,o.useContext)(y);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:K,unregister:X}=_;(0,c.e)(()=>K(I),[K,I]),(0,c.e)(()=>{if(q===g.l4.Hidden&&I.current){if(H&&"visible"!==V){A("visible");return}return(0,b.E)(V,{hidden:()=>X(I),visible:()=>K(I)})}},[V,I,K,X,H,q]);let Y=(0,u.H)();(0,c.e)(()=>{if(B&&Y&&"visible"===V&&null===I.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[I,V,Y,B]);let U=W&&!F,G=F&&H&&W,$=(0,o.useRef)(!1),J=x(()=>{$.current||(A("hidden"),X(I))},_),Q=(0,l.z)(e=>{$.current=!0,J.onStart(I,e?"enter":"leave",e=>{"enter"===e?null==i||i():"leave"===e&&(null==w||w())})}),ee=(0,l.z)(e=>{let t=e?"enter":"leave";$.current=!1,J.onStop(I,t,e=>{"enter"===e?null==s||s():"leave"===e&&(null==O||O())}),"leave"!==t||k(J)||(A("hidden"),X(I))});(0,o.useEffect)(()=>{B&&a||(Q(H),ee(H))},[H,B,a]);let et=!(!a||!B||!Y||U),[,er]=(0,m.Y)(et,z,H,{start:Q,end:ee}),en=(0,g.oA)({ref:D,className:(null==(n=(0,f.A)(L.className,G&&j,G&&S,er.enter&&j,er.enter&&er.closed&&S,er.enter&&!er.closed&&N,er.leave&&M,er.leave&&!er.closed&&P,er.leave&&er.closed&&T,!er.transition&&H&&Z))?void 0:n.trim())||void 0,...(0,m.X)(er)}),eo=0;"visible"===V&&(eo|=p.ZM.Open),"hidden"===V&&(eo|=p.ZM.Closed),er.enter&&(eo|=p.ZM.Opening),er.leave&&(eo|=p.ZM.Closing);let ea=(0,g.L6)();return o.createElement(y.Provider,{value:J},o.createElement(p.up,{value:eo},ea({ourProps:en,theirProps:L,defaultTag:C,features:E,visible:"visible"===V,name:"Transition.Child"})))}),S=(0,g.yV)(function(e,t){let r=null!==(0,o.useContext)(h),n=null!==(0,p.oJ)();return o.createElement(o.Fragment,null,!r&&n?o.createElement(O,{ref:t,...e}):o.createElement(j,{ref:t,...e}))}),N=Object.assign(O,{Child:S,Root:O})},33443:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(2265);let o=(0,n.createContext)(()=>{});function a(e){let{value:t,children:r}=e;return n.createElement(o.Provider,{value:t},r)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1994-6637a121c9ee1602.js b/litellm/proxy/_experimental/out/_next/static/chunks/1994-6637a121c9ee1602.js new file mode 100644 index 0000000000..90f29480d6 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/1994-6637a121c9ee1602.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1994],{4156:function(e,n,t){t.d(n,{Z:function(){return O}});var o=t(2265),a=t(36760),r=t.n(a),c=t(20873),l=t(28791),i=t(6694),s=t(34709),u=t(71744),d=t(86586),b=t(64024),p=t(39109);let f=o.createContext(null);var v=t(23159),m=t(66531),h=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>n.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let g=o.forwardRef((e,n)=>{var t;let{prefixCls:a,className:g,rootClassName:C,children:y,indeterminate:k=!1,style:x,onMouseEnter:O,onMouseLeave:E,skipGroup:S=!1,disabled:w}=e,Z=h(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:P,direction:N,checkbox:j}=o.useContext(u.E_),I=o.useContext(f),{isFormItemInput:R}=o.useContext(p.aM),z=o.useContext(d.Z),B=null!==(t=(null==I?void 0:I.disabled)||w)&&void 0!==t?t:z,D=o.useRef(Z.value),M=o.useRef(null),_=(0,l.sQ)(n,M);o.useEffect(()=>{null==I||I.registerValue(Z.value)},[]),o.useEffect(()=>{if(!S)return Z.value!==D.current&&(null==I||I.cancelValue(D.current),null==I||I.registerValue(Z.value),D.current=Z.value),()=>null==I?void 0:I.cancelValue(Z.value)},[Z.value]),o.useEffect(()=>{var e;(null===(e=M.current)||void 0===e?void 0:e.input)&&(M.current.input.indeterminate=k)},[k]);let W=P("checkbox",a),q=(0,b.Z)(W),[H,T,G]=(0,v.ZP)(W,q),V=Object.assign({},Z);I&&!S&&(V.onChange=function(){for(var e=arguments.length,n=Array(e),t=0;tn.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let x=o.forwardRef((e,n)=>{let{defaultValue:t,children:a,options:c=[],prefixCls:l,className:i,rootClassName:s,style:d,onChange:p}=e,m=k(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:h,direction:x}=o.useContext(u.E_),[O,E]=o.useState(m.value||t||[]),[S,w]=o.useState([]);o.useEffect(()=>{"value"in m&&E(m.value||[])},[m.value]);let Z=o.useMemo(()=>c.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[c]),P=e=>{w(n=>n.filter(n=>n!==e))},N=e=>{w(n=>[].concat((0,C.Z)(n),[e]))},j=e=>{let n=O.indexOf(e.value),t=(0,C.Z)(O);-1===n?t.push(e.value):t.splice(n,1),"value"in m||E(t),null==p||p(t.filter(e=>S.includes(e)).sort((e,n)=>Z.findIndex(n=>n.value===e)-Z.findIndex(e=>e.value===n)))},I=h("checkbox",l),R="".concat(I,"-group"),z=(0,b.Z)(I),[B,D,M]=(0,v.ZP)(I,z),_=(0,y.Z)(m,["value","disabled"]),W=c.length?Z.map(e=>o.createElement(g,{prefixCls:I,key:e.value.toString(),disabled:"disabled"in e?e.disabled:m.disabled,value:e.value,checked:O.includes(e.value),onChange:e.onChange,className:r()("".concat(R,"-item"),e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):a,q=o.useMemo(()=>({toggleOption:j,value:O,disabled:m.disabled,name:m.name,registerValue:N,cancelValue:P}),[j,O,m.disabled,m.name,N,P]),H=r()(R,{["".concat(R,"-rtl")]:"rtl"===x},i,s,M,z,D);return B(o.createElement("div",Object.assign({className:H,style:d},_,{ref:n}),o.createElement(f.Provider,{value:q},W)))});g.Group=x,g.__ANT_CHECKBOX=!0;var O=g},23159:function(e,n,t){t.d(n,{C2:function(){return i}});var o=t(93463),a=t(12918),r=t(71140),c=t(99320);let l=e=>{let{checkboxCls:n}=e,t="".concat(n,"-wrapper");return[{["".concat(n,"-group")]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",flexWrap:"wrap",columnGap:e.marginXS,["> ".concat(e.antCls,"-row")]:{flex:1}}),[t]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},["& + ".concat(t)]:{marginInlineStart:0},["&".concat(t,"-in-form-item")]:{'input[type="checkbox"]':{width:14,height:14}}}),[n]:Object.assign(Object.assign({},(0,a.Wf)(e)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:e.borderRadiusSM,alignSelf:"center",["".concat(n,"-input")]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,["&:focus-visible + ".concat(n,"-inner")]:(0,a.oN)(e)},["".concat(n,"-inner")]:{boxSizing:"border-box",display:"block",width:e.checkboxSize,height:e.checkboxSize,direction:"ltr",backgroundColor:e.colorBgContainer,border:"".concat((0,o.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,borderCollapse:"separate",transition:"all ".concat(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:"".concat((0,o.bf)(e.lineWidthBold)," solid ").concat(e.colorWhite),borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:"all ".concat(e.motionDurationFast," ").concat(e.motionEaseInBack,", opacity ").concat(e.motionDurationFast)}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{["\n ".concat(t,":not(").concat(t,"-disabled),\n ").concat(n,":not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{borderColor:e.colorPrimary}},["".concat(t,":not(").concat(t,"-disabled)")]:{["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled) ").concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled):after")]:{borderColor:e.colorPrimaryHover}}},{["".concat(n,"-checked")]:{["".concat(n,"-inner")]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseOutBack," ").concat(e.motionDurationFast)}}},["\n ".concat(t,"-checked:not(").concat(t,"-disabled),\n ").concat(n,"-checked:not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[n]:{"&-indeterminate":{"&":{["".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(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 ".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(e.colorPrimary)}}}}},{["".concat(t,"-disabled")]:{cursor:"not-allowed"},["".concat(n,"-disabled")]:{["&, ".concat(n,"-input")]:{cursor:"not-allowed",pointerEvents:"none"},["".concat(n,"-inner")]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},["&".concat(n,"-indeterminate ").concat(n,"-inner::after")]:{background:e.colorTextDisabled}}}]};function i(e,n){return l((0,r.IX)(n,{checkboxCls:".".concat(e),checkboxSize:n.controlInteractiveSize}))}n.ZP=(0,c.I$)("Checkbox",(e,n)=>{let{prefixCls:t}=n;return[i(t,e)]})},66531:function(e,n,t){t.d(n,{Z:function(){return r}});var o=t(2265),a=t(53346);function r(e){let n=o.useRef(null),t=()=>{a.Z.cancel(n.current),n.current=null};return[()=>{t(),n.current=(0,a.Z)(()=>{n.current=null})},o=>{n.current&&(o.stopPropagation(),t()),null==e||e(o)}]}},20873:function(e,n,t){var o=t(1119),a=t(31686),r=t(11993),c=t(26365),l=t(6989),i=t(36760),s=t.n(i),u=t(50506),d=t(2265),b=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],p=(0,d.forwardRef)(function(e,n){var t=e.prefixCls,i=void 0===t?"rc-checkbox":t,p=e.className,f=e.style,v=e.checked,m=e.disabled,h=e.defaultChecked,g=e.type,C=void 0===g?"checkbox":g,y=e.title,k=e.onChange,x=(0,l.Z)(e,b),O=(0,d.useRef)(null),E=(0,d.useRef)(null),S=(0,u.Z)(void 0!==h&&h,{value:v}),w=(0,c.Z)(S,2),Z=w[0],P=w[1];(0,d.useImperativeHandle)(n,function(){return{focus:function(e){var n;null===(n=O.current)||void 0===n||n.focus(e)},blur:function(){var e;null===(e=O.current)||void 0===e||e.blur()},input:O.current,nativeElement:E.current}});var N=s()(i,p,(0,r.Z)((0,r.Z)({},"".concat(i,"-checked"),Z),"".concat(i,"-disabled"),m));return d.createElement("span",{className:N,title:y,style:f,ref:E},d.createElement("input",(0,o.Z)({},x,{className:"".concat(i,"-input"),ref:O,onChange:function(n){m||("checked"in e||P(n.target.checked),null==k||k({target:(0,a.Z)((0,a.Z)({},e),{},{type:C,checked:n.target.checked}),stopPropagation:function(){n.stopPropagation()},preventDefault:function(){n.preventDefault()},nativeEvent:n.nativeEvent}))},disabled:m,checked:!!Z,type:C})),d.createElement("span",{className:"".concat(i,"-inner")}))});n.Z=p}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/1994-a4d0b99849c16b62.js b/litellm/proxy/_experimental/out/_next/static/chunks/1994-a4d0b99849c16b62.js deleted file mode 100644 index 3211472683..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/1994-a4d0b99849c16b62.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1994],{61994:function(e,n,t){t.d(n,{Z:function(){return O}});var o=t(2265),a=t(36760),r=t.n(a),c=t(20873),l=t(28791),i=t(6694),s=t(34709),u=t(71744),d=t(86586),b=t(64024),p=t(39109);let f=o.createContext(null);var v=t(23159),m=t(66531),h=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>n.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let g=o.forwardRef((e,n)=>{var t;let{prefixCls:a,className:g,rootClassName:C,children:y,indeterminate:k=!1,style:x,onMouseEnter:O,onMouseLeave:E,skipGroup:S=!1,disabled:w}=e,Z=h(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:P,direction:N,checkbox:j}=o.useContext(u.E_),I=o.useContext(f),{isFormItemInput:R}=o.useContext(p.aM),z=o.useContext(d.Z),B=null!==(t=(null==I?void 0:I.disabled)||w)&&void 0!==t?t:z,D=o.useRef(Z.value),M=o.useRef(null),_=(0,l.sQ)(n,M);o.useEffect(()=>{null==I||I.registerValue(Z.value)},[]),o.useEffect(()=>{if(!S)return Z.value!==D.current&&(null==I||I.cancelValue(D.current),null==I||I.registerValue(Z.value),D.current=Z.value),()=>null==I?void 0:I.cancelValue(Z.value)},[Z.value]),o.useEffect(()=>{var e;(null===(e=M.current)||void 0===e?void 0:e.input)&&(M.current.input.indeterminate=k)},[k]);let W=P("checkbox",a),q=(0,b.Z)(W),[H,T,G]=(0,v.ZP)(W,q),V=Object.assign({},Z);I&&!S&&(V.onChange=function(){for(var e=arguments.length,n=Array(e),t=0;tn.indexOf(o)&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(e);an.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]]);return t};let x=o.forwardRef((e,n)=>{let{defaultValue:t,children:a,options:c=[],prefixCls:l,className:i,rootClassName:s,style:d,onChange:p}=e,m=k(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:h,direction:x}=o.useContext(u.E_),[O,E]=o.useState(m.value||t||[]),[S,w]=o.useState([]);o.useEffect(()=>{"value"in m&&E(m.value||[])},[m.value]);let Z=o.useMemo(()=>c.map(e=>"string"==typeof e||"number"==typeof e?{label:e,value:e}:e),[c]),P=e=>{w(n=>n.filter(n=>n!==e))},N=e=>{w(n=>[].concat((0,C.Z)(n),[e]))},j=e=>{let n=O.indexOf(e.value),t=(0,C.Z)(O);-1===n?t.push(e.value):t.splice(n,1),"value"in m||E(t),null==p||p(t.filter(e=>S.includes(e)).sort((e,n)=>Z.findIndex(n=>n.value===e)-Z.findIndex(e=>e.value===n)))},I=h("checkbox",l),R="".concat(I,"-group"),z=(0,b.Z)(I),[B,D,M]=(0,v.ZP)(I,z),_=(0,y.Z)(m,["value","disabled"]),W=c.length?Z.map(e=>o.createElement(g,{prefixCls:I,key:e.value.toString(),disabled:"disabled"in e?e.disabled:m.disabled,value:e.value,checked:O.includes(e.value),onChange:e.onChange,className:r()("".concat(R,"-item"),e.className),style:e.style,title:e.title,id:e.id,required:e.required},e.label)):a,q=o.useMemo(()=>({toggleOption:j,value:O,disabled:m.disabled,name:m.name,registerValue:N,cancelValue:P}),[j,O,m.disabled,m.name,N,P]),H=r()(R,{["".concat(R,"-rtl")]:"rtl"===x},i,s,M,z,D);return B(o.createElement("div",Object.assign({className:H,style:d},_,{ref:n}),o.createElement(f.Provider,{value:q},W)))});g.Group=x,g.__ANT_CHECKBOX=!0;var O=g},23159:function(e,n,t){t.d(n,{C2:function(){return i}});var o=t(93463),a=t(12918),r=t(71140),c=t(99320);let l=e=>{let{checkboxCls:n}=e,t="".concat(n,"-wrapper");return[{["".concat(n,"-group")]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",flexWrap:"wrap",columnGap:e.marginXS,["> ".concat(e.antCls,"-row")]:{flex:1}}),[t]:Object.assign(Object.assign({},(0,a.Wf)(e)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},["& + ".concat(t)]:{marginInlineStart:0},["&".concat(t,"-in-form-item")]:{'input[type="checkbox"]':{width:14,height:14}}}),[n]:Object.assign(Object.assign({},(0,a.Wf)(e)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:e.borderRadiusSM,alignSelf:"center",["".concat(n,"-input")]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,["&:focus-visible + ".concat(n,"-inner")]:(0,a.oN)(e)},["".concat(n,"-inner")]:{boxSizing:"border-box",display:"block",width:e.checkboxSize,height:e.checkboxSize,direction:"ltr",backgroundColor:e.colorBgContainer,border:"".concat((0,o.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:e.borderRadiusSM,borderCollapse:"separate",transition:"all ".concat(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:"".concat((0,o.bf)(e.lineWidthBold)," solid ").concat(e.colorWhite),borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:"all ".concat(e.motionDurationFast," ").concat(e.motionEaseInBack,", opacity ").concat(e.motionDurationFast)}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{["\n ".concat(t,":not(").concat(t,"-disabled),\n ").concat(n,":not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{borderColor:e.colorPrimary}},["".concat(t,":not(").concat(t,"-disabled)")]:{["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled) ").concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},["&:hover ".concat(n,"-checked:not(").concat(n,"-disabled):after")]:{borderColor:e.colorPrimaryHover}}},{["".concat(n,"-checked")]:{["".concat(n,"-inner")]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseOutBack," ").concat(e.motionDurationFast)}}},["\n ".concat(t,"-checked:not(").concat(t,"-disabled),\n ").concat(n,"-checked:not(").concat(n,"-disabled)\n ")]:{["&:hover ".concat(n,"-inner")]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[n]:{"&-indeterminate":{"&":{["".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(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 ".concat(n,"-inner")]:{backgroundColor:"".concat(e.colorBgContainer),borderColor:"".concat(e.colorPrimary)}}}}},{["".concat(t,"-disabled")]:{cursor:"not-allowed"},["".concat(n,"-disabled")]:{["&, ".concat(n,"-input")]:{cursor:"not-allowed",pointerEvents:"none"},["".concat(n,"-inner")]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},["&".concat(n,"-indeterminate ").concat(n,"-inner::after")]:{background:e.colorTextDisabled}}}]};function i(e,n){return l((0,r.IX)(n,{checkboxCls:".".concat(e),checkboxSize:n.controlInteractiveSize}))}n.ZP=(0,c.I$)("Checkbox",(e,n)=>{let{prefixCls:t}=n;return[i(t,e)]})},66531:function(e,n,t){t.d(n,{Z:function(){return r}});var o=t(2265),a=t(53346);function r(e){let n=o.useRef(null),t=()=>{a.Z.cancel(n.current),n.current=null};return[()=>{t(),n.current=(0,a.Z)(()=>{n.current=null})},o=>{n.current&&(o.stopPropagation(),t()),null==e||e(o)}]}},20873:function(e,n,t){var o=t(1119),a=t(31686),r=t(11993),c=t(26365),l=t(6989),i=t(36760),s=t.n(i),u=t(50506),d=t(2265),b=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],p=(0,d.forwardRef)(function(e,n){var t=e.prefixCls,i=void 0===t?"rc-checkbox":t,p=e.className,f=e.style,v=e.checked,m=e.disabled,h=e.defaultChecked,g=e.type,C=void 0===g?"checkbox":g,y=e.title,k=e.onChange,x=(0,l.Z)(e,b),O=(0,d.useRef)(null),E=(0,d.useRef)(null),S=(0,u.Z)(void 0!==h&&h,{value:v}),w=(0,c.Z)(S,2),Z=w[0],P=w[1];(0,d.useImperativeHandle)(n,function(){return{focus:function(e){var n;null===(n=O.current)||void 0===n||n.focus(e)},blur:function(){var e;null===(e=O.current)||void 0===e||e.blur()},input:O.current,nativeElement:E.current}});var N=s()(i,p,(0,r.Z)((0,r.Z)({},"".concat(i,"-checked"),Z),"".concat(i,"-disabled"),m));return d.createElement("span",{className:N,title:y,style:f,ref:E},d.createElement("input",(0,o.Z)({},x,{className:"".concat(i,"-input"),ref:O,onChange:function(n){m||("checked"in e||P(n.target.checked),null==k||k({target:(0,a.Z)((0,a.Z)({},e),{},{type:C,checked:n.target.checked}),stopPropagation:function(){n.stopPropagation()},preventDefault:function(){n.preventDefault()},nativeEvent:n.nativeEvent}))},disabled:m,checked:!!Z,type:C})),d.createElement("span",{className:"".concat(i,"-inner")}))});n.Z=p}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2117-bb4323b3c0b11a1f.js b/litellm/proxy/_experimental/out/_next/static/chunks/2117-26a589a1115bdd0a.js similarity index 83% rename from litellm/proxy/_experimental/out/_next/static/chunks/2117-bb4323b3c0b11a1f.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2117-26a589a1115bdd0a.js index fae288cfed..10b7be385d 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2117-bb4323b3c0b11a1f.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2117-26a589a1115bdd0a.js @@ -1,2 +1,2 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2117],{65157:function(e,t){"use strict";function n(){return""}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getDeploymentIdQueryOrEmptyString",{enumerable:!0,get:function(){return n}})},91572:function(){"trimStart"in String.prototype||(String.prototype.trimStart=String.prototype.trimLeft),"trimEnd"in String.prototype||(String.prototype.trimEnd=String.prototype.trimRight),"description"in Symbol.prototype||Object.defineProperty(Symbol.prototype,"description",{configurable:!0,get:function(){var e=/\((.*)\)/.exec(this.toString());return e?e[1]:void 0}}),Array.prototype.flat||(Array.prototype.flat=function(e,t){return t=this.concat.apply([],this),e>1&&t.some(Array.isArray)?t.flat(e-1):t},Array.prototype.flatMap=function(e,t){return this.map(e,t).flat()}),Promise.prototype.finally||(Promise.prototype.finally=function(e){if("function"!=typeof e)return this.then(e,e);var t=this.constructor||Promise;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})}),Object.fromEntries||(Object.fromEntries=function(e){return Array.from(e).reduce(function(e,t){return e[t[0]]=t[1],e},{})}),Array.prototype.at||(Array.prototype.at=function(e){var t=Math.trunc(e)||0;if(t<0&&(t+=this.length),!(t<0||t>=this.length))return this[t]}),Object.hasOwn||(Object.hasOwn=function(e,t){if(null==e)throw TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(e),t)}),"canParse"in URL||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch(e){return!1}})},1634:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addBasePath",{enumerable:!0,get:function(){return u}});let r=n(68498),o=n(33068);function u(e,t){return(0,o.normalizePathTrailingSlash)((0,r.addPathPrefix)(e,""))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},75266:function(e,t){"use strict";function n(e){var t,n;t=self.__next_s,n=()=>{e()},t&&t.length?t.reduce((e,t)=>{let[n,r]=t;return e.then(()=>new Promise((e,t)=>{let o=document.createElement("script");if(r)for(let e in r)"children"!==e&&o.setAttribute(e,r[e]);n?(o.src=n,o.onload=()=>e(),o.onerror=t):r&&(o.innerHTML=r.children,setTimeout(e)),document.head.appendChild(o)}))},Promise.resolve()).catch(e=>{console.error(e)}).then(()=>{n()}):n()}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"appBootstrap",{enumerable:!0,get:function(){return n}}),window.next={version:"14.2.33",appDir:!0},("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},83079:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"callServer",{enumerable:!0,get:function(){return o}});let r=n(12846);async function o(e,t){let n=(0,r.getServerActionDispatcher)();if(!n)throw Error("Invariant: missing action dispatcher.");return new Promise((r,o)=>{n({actionId:e,actionArgs:t,resolve:r,reject:o})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},92304:function(e,t,n){"use strict";let r,o;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hydrate",{enumerable:!0,get:function(){return x}});let u=n(47043),l=n(53099),a=n(57437);n(91572);let i=u._(n(34040)),c=l._(n(2265)),s=n(6671),f=n(48701),d=u._(n(61404)),p=n(83079),h=n(89721),y=n(2103);n(70647);let _=window.console.error;window.console.error=function(){for(var e=arguments.length,t=Array(e),n=0;n{if((0,h.isNextRouterError)(e.error)){e.preventDefault();return}});let v=document,b=new TextEncoder,g=!1,m=!1,R=null;function P(e){if(0===e[0])r=[];else if(1===e[0]){if(!r)throw Error("Unexpected server data: missing bootstrap script.");o?o.enqueue(b.encode(e[1])):r.push(e[1])}else 2===e[0]&&(R=e[1])}let j=function(){o&&!m&&(o.close(),m=!0,r=void 0),g=!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",j,!1):j();let O=self.__next_f=self.__next_f||[];O.forEach(P),O.push=P;let E=new ReadableStream({start(e){r&&(r.forEach(t=>{e.enqueue(b.encode(t))}),g&&!m&&(e.close(),m=!0,r=void 0)),o=e}}),S=(0,s.createFromReadableStream)(E,{callServer:p.callServer});function w(){return(0,c.use)(S)}let M=c.default.StrictMode;function T(e){let{children:t}=e;return t}function x(){let e=(0,y.createMutableActionQueue)(),t=(0,a.jsx)(M,{children:(0,a.jsx)(f.HeadManagerContext.Provider,{value:{appDir:!0},children:(0,a.jsx)(y.ActionQueueContext.Provider,{value:e,children:(0,a.jsx)(T,{children:(0,a.jsx)(w,{})})})})}),n=window.__next_root_layout_missing_tags,r=!!(null==n?void 0:n.length),o={onRecoverableError:d.default};"__next_error__"===document.documentElement.id||r?i.default.createRoot(v,o).render(t):c.default.startTransition(()=>i.default.hydrateRoot(v,t,{...o,formState:R}))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},54278:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(19506),(0,n(75266).appBootstrap)(()=>{let{hydrate:e}=n(92304);n(12846),n(4707),e()}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},19506:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(65157);{let e=n.u;n.u=function(){for(var t=arguments.length,n=Array(t),r=0;r(l(function(){var e;let t=document.getElementsByName(u)[0];if(null==t?void 0:null==(e=t.shadowRoot)?void 0:e.childNodes[0])return t.shadowRoot.childNodes[0];{let e=document.createElement(u);e.style.cssText="position:absolute";let t=document.createElement("div");return t.ariaLive="assertive",t.id="__next-route-announcer__",t.role="alert",t.style.cssText="position:absolute;border:0;height:1px;margin:-1px;padding:0;width:1px;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap;word-wrap:normal",e.attachShadow({mode:"open"}).appendChild(t),document.body.appendChild(e),t}}()),()=>{let e=document.getElementsByTagName(u)[0];(null==e?void 0:e.isConnected)&&document.body.removeChild(e)}),[]);let[a,i]=(0,r.useState)(""),c=(0,r.useRef)();return(0,r.useEffect)(()=>{let e="";if(document.title)e=document.title;else{let t=document.querySelector("h1");t&&(e=t.innerText||t.textContent||"")}void 0!==c.current&&c.current!==e&&i(e),c.current=e},[t]),n?(0,o.createPortal)(a,n):null}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6866:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ACTION:function(){return r},FLIGHT_PARAMETERS:function(){return i},NEXT_DID_POSTPONE_HEADER:function(){return s},NEXT_ROUTER_PREFETCH_HEADER:function(){return u},NEXT_ROUTER_STATE_TREE:function(){return o},NEXT_RSC_UNION_QUERY:function(){return c},NEXT_URL:function(){return l},RSC_CONTENT_TYPE_HEADER:function(){return a},RSC_HEADER:function(){return n}});let n="RSC",r="Next-Action",o="Next-Router-State-Tree",u="Next-Router-Prefetch",l="Next-Url",a="text/x-component",i=[[n],[o],[u]],c="_rsc",s="x-nextjs-postponed";("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},12846:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createEmptyCacheNode:function(){return C},default:function(){return I},getServerActionDispatcher:function(){return S},urlToUrlWithoutFlightMarker:function(){return M}});let r=n(53099),o=n(57437),u=r._(n(2265)),l=n(61956),a=n(24673),i=n(33456),c=n(79060),s=n(47744),f=n(61060),d=n(82952),p=n(86146),h=n(1634),y=n(6495),_=n(4123),v=n(39320),b=n(38137),g=n(6866),m=n(35076),R=n(11283),P=n(84541),j="undefined"==typeof window,O=j?null:new Map,E=null;function S(){return E}let w={};function M(e){let t=new URL(e,location.origin);if(t.searchParams.delete(g.NEXT_RSC_UNION_QUERY),t.pathname.endsWith(".txt")){let{pathname:e}=t,n=e.endsWith("/index.txt")?10:4;t.pathname=e.slice(0,-n)}return t}function T(e){return e.origin!==window.location.origin}function x(e){let{appRouterState:t,sync:n}=e;return(0,u.useInsertionEffect)(()=>{let{tree:e,pushRef:r,canonicalUrl:o}=t,u={...r.preserveCustomHistoryState?window.history.state:{},__NA:!0,__PRIVATE_NEXTJS_INTERNALS_TREE:e};r.pendingPush&&(0,i.createHrefFromUrl)(new URL(window.location.href))!==o?(r.pendingPush=!1,window.history.pushState(u,"",o)):window.history.replaceState(u,"",o),n(t)},[t,n]),null}function C(){return{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null}}function A(e){null==e&&(e={});let t=window.history.state,n=null==t?void 0:t.__NA;n&&(e.__NA=n);let r=null==t?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE;return r&&(e.__PRIVATE_NEXTJS_INTERNALS_TREE=r),e}function N(e){let{headCacheNode:t}=e,n=null!==t?t.head:null,r=null!==t?t.prefetchHead:null,o=null!==r?r:n;return(0,u.useDeferredValue)(n,o)}function D(e){let t,{buildId:n,initialHead:r,initialTree:i,urlParts:f,initialSeedData:g,couldBeIntercepted:S,assetPrefix:M,missingSlots:C}=e,D=(0,u.useMemo)(()=>(0,d.createInitialRouterState)({buildId:n,initialSeedData:g,urlParts:f,initialTree:i,initialParallelRoutes:O,location:j?null:window.location,initialHead:r,couldBeIntercepted:S}),[n,g,f,i,r,S]),[I,U,k]=(0,s.useReducerWithReduxDevtools)(D);(0,u.useEffect)(()=>{O=null},[]);let{canonicalUrl:F}=(0,s.useUnwrapState)(I),{searchParams:L,pathname:H}=(0,u.useMemo)(()=>{let e=new URL(F,"undefined"==typeof window?"http://n":window.location.href);return{searchParams:e.searchParams,pathname:(0,R.hasBasePath)(e.pathname)?(0,m.removeBasePath)(e.pathname):e.pathname}},[F]),G=(0,u.useCallback)(e=>{let{previousTree:t,serverResponse:n}=e;(0,u.startTransition)(()=>{U({type:a.ACTION_SERVER_PATCH,previousTree:t,serverResponse:n})})},[U]),$=(0,u.useCallback)((e,t,n)=>{let r=new URL((0,h.addBasePath)(e),location.href);return U({type:a.ACTION_NAVIGATE,url:r,isExternalUrl:T(r),locationSearch:location.search,shouldScroll:null==n||n,navigateType:t})},[U]);E=(0,u.useCallback)(e=>{(0,u.startTransition)(()=>{U({...e,type:a.ACTION_SERVER_ACTION})})},[U]);let z=(0,u.useMemo)(()=>({back:()=>window.history.back(),forward:()=>window.history.forward(),prefetch:(e,t)=>{let n;if(!(0,p.isBot)(window.navigator.userAgent)){try{n=new URL((0,h.addBasePath)(e),window.location.href)}catch(t){throw Error("Cannot prefetch '"+e+"' because it cannot be converted to a URL.")}T(n)||(0,u.startTransition)(()=>{var e;U({type:a.ACTION_PREFETCH,url:n,kind:null!=(e=null==t?void 0:t.kind)?e:a.PrefetchKind.FULL})})}},replace:(e,t)=>{void 0===t&&(t={}),(0,u.startTransition)(()=>{var n;$(e,"replace",null==(n=t.scroll)||n)})},push:(e,t)=>{void 0===t&&(t={}),(0,u.startTransition)(()=>{var n;$(e,"push",null==(n=t.scroll)||n)})},refresh:()=>{(0,u.startTransition)(()=>{U({type:a.ACTION_REFRESH,origin:window.location.origin})})},fastRefresh:()=>{throw Error("fastRefresh can only be used in development mode. Please use refresh instead.")}}),[U,$]);(0,u.useEffect)(()=>{window.next&&(window.next.router=z)},[z]),(0,u.useEffect)(()=>{function e(e){var t;e.persisted&&(null==(t=window.history.state)?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE)&&(w.pendingMpaPath=void 0,U({type:a.ACTION_RESTORE,url:new URL(window.location.href),tree:window.history.state.__PRIVATE_NEXTJS_INTERNALS_TREE}))}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}},[U]);let{pushRef:B}=(0,s.useUnwrapState)(I);if(B.mpaNavigation){if(w.pendingMpaPath!==F){let e=window.location;B.pendingPush?e.assign(F):e.replace(F),w.pendingMpaPath=F}(0,u.use)(b.unresolvedThenable)}(0,u.useEffect)(()=>{let e=window.history.pushState.bind(window.history),t=window.history.replaceState.bind(window.history),n=e=>{var t;let n=window.location.href,r=null==(t=window.history.state)?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE;(0,u.startTransition)(()=>{U({type:a.ACTION_RESTORE,url:new URL(null!=e?e:n,n),tree:r})})};window.history.pushState=function(t,r,o){return(null==t?void 0:t.__NA)||(null==t?void 0:t._N)||(t=A(t),o&&n(o)),e(t,r,o)},window.history.replaceState=function(e,r,o){return(null==e?void 0:e.__NA)||(null==e?void 0:e._N)||(e=A(e),o&&n(o)),t(e,r,o)};let r=e=>{let{state:t}=e;if(t){if(!t.__NA){window.location.reload();return}(0,u.startTransition)(()=>{U({type:a.ACTION_RESTORE,url:new URL(window.location.href),tree:t.__PRIVATE_NEXTJS_INTERNALS_TREE})})}};return window.addEventListener("popstate",r),()=>{window.history.pushState=e,window.history.replaceState=t,window.removeEventListener("popstate",r)}},[U]);let{cache:W,tree:K,nextUrl:V,focusAndScrollRef:Y}=(0,s.useUnwrapState)(I),X=(0,u.useMemo)(()=>(0,v.findHeadInCache)(W,K[1]),[W,K]),q=(0,u.useMemo)(()=>(function e(t,n){for(let r of(void 0===n&&(n={}),Object.values(t[1]))){let t=r[0],o=Array.isArray(t),u=o?t[1]:t;!u||u.startsWith(P.PAGE_SEGMENT_KEY)||(o&&("c"===t[2]||"oc"===t[2])?n[t[0]]=t[1].split("/"):o&&(n[t[0]]=t[1]),n=e(r,n))}return n})(K),[K]);if(null!==X){let[e,n]=X;t=(0,o.jsx)(N,{headCacheNode:e},n)}else t=null;let J=(0,o.jsxs)(_.RedirectBoundary,{children:[t,W.rsc,(0,o.jsx)(y.AppRouterAnnouncer,{tree:K})]});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(x,{appRouterState:(0,s.useUnwrapState)(I),sync:k}),(0,o.jsx)(c.PathParamsContext.Provider,{value:q,children:(0,o.jsx)(c.PathnameContext.Provider,{value:H,children:(0,o.jsx)(c.SearchParamsContext.Provider,{value:L,children:(0,o.jsx)(l.GlobalLayoutRouterContext.Provider,{value:{buildId:n,changeByServerResponse:G,tree:K,focusAndScrollRef:Y,nextUrl:V},children:(0,o.jsx)(l.AppRouterContext.Provider,{value:z,children:(0,o.jsx)(l.LayoutRouterContext.Provider,{value:{childNodes:W.parallelRoutes,tree:K,url:F,loading:W.loading},children:J})})})})})})]})}function I(e){let{globalErrorComponent:t,...n}=e;return(0,o.jsx)(f.ErrorBoundary,{errorComponent:t,children:(0,o.jsx)(D,{...n})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},96149:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"bailoutToClientRendering",{enumerable:!0,get:function(){return u}});let r=n(18993),o=n(51845);function u(e){let t=o.staticGenerationAsyncStorage.getStore();if((null==t||!t.forceStatic)&&(null==t?void 0:t.isStaticGeneration))throw new r.BailoutToCSRError(e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},19107:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ClientPageRoot",{enumerable:!0,get:function(){return u}});let r=n(57437),o=n(54535);function u(e){let{Component:t,props:n}=e;return n.searchParams=(0,o.createDynamicallyTrackedSearchParams)(n.searchParams||{}),(0,r.jsx)(t,{...n})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},61060:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ErrorBoundary:function(){return h},ErrorBoundaryHandler:function(){return f},GlobalError:function(){return d},default:function(){return p}});let r=n(47043),o=n(57437),u=r._(n(2265)),l=n(35475),a=n(89721),i=n(51845),c={error:{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"},text:{fontSize:"14px",fontWeight:400,lineHeight:"28px",margin:"0 8px"}};function s(e){let{error:t}=e,n=i.staticGenerationAsyncStorage.getStore();if((null==n?void 0:n.isRevalidate)||(null==n?void 0:n.isStaticGeneration))throw console.error(t),t;return null}class f extends u.default.Component{static getDerivedStateFromError(e){if((0,a.isNextRouterError)(e))throw e;return{error:e}}static getDerivedStateFromProps(e,t){return e.pathname!==t.previousPathname&&t.error?{error:null,previousPathname:e.pathname}:{error:t.error,previousPathname:e.pathname}}render(){return this.state.error?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s,{error:this.state.error}),this.props.errorStyles,this.props.errorScripts,(0,o.jsx)(this.props.errorComponent,{error:this.state.error,reset:this.reset})]}):this.props.children}constructor(e){super(e),this.reset=()=>{this.setState({error:null})},this.state={error:null,previousPathname:this.props.pathname}}}function d(e){let{error:t}=e,n=null==t?void 0:t.digest;return(0,o.jsxs)("html",{id:"__next_error__",children:[(0,o.jsx)("head",{}),(0,o.jsxs)("body",{children:[(0,o.jsx)(s,{error:t}),(0,o.jsx)("div",{style:c.error,children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{style:c.text,children:"Application error: a "+(n?"server":"client")+"-side exception has occurred (see the "+(n?"server logs":"browser console")+" for more information)."}),n?(0,o.jsx)("p",{style:c.text,children:"Digest: "+n}):null]})})]})]})}let p=d;function h(e){let{errorComponent:t,errorStyles:n,errorScripts:r,children:u}=e,a=(0,l.usePathname)();return t?(0,o.jsx)(f,{pathname:a,errorComponent:t,errorStyles:n,errorScripts:r,children:u}):(0,o.jsx)(o.Fragment,{children:u})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},46177:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{DynamicServerError:function(){return r},isDynamicServerError:function(){return o}});let n="DYNAMIC_SERVER_USAGE";class r extends Error{constructor(e){super("Dynamic server usage: "+e),this.description=e,this.digest=n}}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&"string"==typeof e.digest&&e.digest===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},89721:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isNextRouterError",{enumerable:!0,get:function(){return u}});let r=n(98200),o=n(88968);function u(e){return e&&e.digest&&((0,o.isRedirectError)(e)||(0,r.isNotFoundError)(e))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4707:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return E}});let r=n(47043),o=n(53099),u=n(57437),l=o._(n(2265)),a=r._(n(54887)),i=n(61956),c=n(44848),s=n(38137),f=n(61060),d=n(76015),p=n(7092),h=n(4123),y=n(80),_=n(73171),v=n(78505),b=n(28077),g=["bottom","height","left","right","top","width","x","y"];function m(e,t){let n=e.getBoundingClientRect();return n.top>=0&&n.top<=t}class R extends l.default.Component{componentDidMount(){this.handlePotentialScroll()}componentDidUpdate(){this.props.focusAndScrollRef.apply&&this.handlePotentialScroll()}render(){return this.props.children}constructor(...e){super(...e),this.handlePotentialScroll=()=>{let{focusAndScrollRef:e,segmentPath:t}=this.props;if(e.apply){var n;if(0!==e.segmentPaths.length&&!e.segmentPaths.some(e=>t.every((t,n)=>(0,d.matchSegment)(t,e[n]))))return;let r=null,o=e.hashFragment;if(o&&(r="top"===o?document.body:null!=(n=document.getElementById(o))?n:document.getElementsByName(o)[0]),r||(r="undefined"==typeof window?null:a.default.findDOMNode(this)),!(r instanceof Element))return;for(;!(r instanceof HTMLElement)||function(e){if(["sticky","fixed"].includes(getComputedStyle(e).position))return!0;let t=e.getBoundingClientRect();return g.every(e=>0===t[e])}(r);){if(null===r.nextElementSibling)return;r=r.nextElementSibling}e.apply=!1,e.hashFragment=null,e.segmentPaths=[],(0,p.handleSmoothScroll)(()=>{if(o){r.scrollIntoView();return}let e=document.documentElement,t=e.clientHeight;!m(r,t)&&(e.scrollTop=0,m(r,t)||r.scrollIntoView())},{dontForceLayout:!0,onlyHashChange:e.onlyHashChange}),e.onlyHashChange=!1,r.focus()}}}}function P(e){let{segmentPath:t,children:n}=e,r=(0,l.useContext)(i.GlobalLayoutRouterContext);if(!r)throw Error("invariant global layout router not mounted");return(0,u.jsx)(R,{segmentPath:t,focusAndScrollRef:r.focusAndScrollRef,children:n})}function j(e){let{parallelRouterKey:t,url:n,childNodes:r,segmentPath:o,tree:a,cacheKey:f}=e,p=(0,l.useContext)(i.GlobalLayoutRouterContext);if(!p)throw Error("invariant global layout router not mounted");let{buildId:h,changeByServerResponse:y,tree:_}=p,v=r.get(f);if(void 0===v){let e={lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null};v=e,r.set(f,e)}let g=null!==v.prefetchRsc?v.prefetchRsc:v.rsc,m=(0,l.useDeferredValue)(v.rsc,g),R="object"==typeof m&&null!==m&&"function"==typeof m.then?(0,l.use)(m):m;if(!R){let e=v.lazyData;if(null===e){let t=function e(t,n){if(t){let[r,o]=t,u=2===t.length;if((0,d.matchSegment)(n[0],r)&&n[1].hasOwnProperty(o)){if(u){let t=e(void 0,n[1][o]);return[n[0],{...n[1],[o]:[t[0],t[1],t[2],"refetch"]}]}return[n[0],{...n[1],[o]:e(t.slice(2),n[1][o])}]}}return n}(["",...o],_),r=(0,b.hasInterceptionRouteInCurrentTree)(_);v.lazyData=e=(0,c.fetchServerResponse)(new URL(n,location.origin),t,r?p.nextUrl:null,h),v.lazyDataResolved=!1}let t=(0,l.use)(e);v.lazyDataResolved||(setTimeout(()=>{(0,l.startTransition)(()=>{y({previousTree:_,serverResponse:t})})}),v.lazyDataResolved=!0),(0,l.use)(s.unresolvedThenable)}return(0,u.jsx)(i.LayoutRouterContext.Provider,{value:{tree:a[1][t],childNodes:v.parallelRoutes,url:n,loading:v.loading},children:R})}function O(e){let{children:t,hasLoading:n,loading:r,loadingStyles:o,loadingScripts:a}=e;return n?(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(u.Fragment,{children:[o,a,r]}),children:t}):(0,u.jsx)(u.Fragment,{children:t})}function E(e){let{parallelRouterKey:t,segmentPath:n,error:r,errorStyles:o,errorScripts:a,templateStyles:c,templateScripts:s,template:d,notFound:p,notFoundStyles:b}=e,g=(0,l.useContext)(i.LayoutRouterContext);if(!g)throw Error("invariant expected layout router to be mounted");let{childNodes:m,tree:R,url:E,loading:S}=g,w=m.get(t);w||(w=new Map,m.set(t,w));let M=R[1][t][0],T=(0,_.getSegmentValue)(M),x=[M];return(0,u.jsx)(u.Fragment,{children:x.map(e=>{let l=(0,_.getSegmentValue)(e),g=(0,v.createRouterCacheKey)(e);return(0,u.jsxs)(i.TemplateContext.Provider,{value:(0,u.jsx)(P,{segmentPath:n,children:(0,u.jsx)(f.ErrorBoundary,{errorComponent:r,errorStyles:o,errorScripts:a,children:(0,u.jsx)(O,{hasLoading:!!S,loading:null==S?void 0:S[0],loadingStyles:null==S?void 0:S[1],loadingScripts:null==S?void 0:S[2],children:(0,u.jsx)(y.NotFoundBoundary,{notFound:p,notFoundStyles:b,children:(0,u.jsx)(h.RedirectBoundary,{children:(0,u.jsx)(j,{parallelRouterKey:t,url:E,tree:R,childNodes:w,segmentPath:n,cacheKey:g,isActive:T===l})})})})})}),children:[c,s,d]},(0,v.createRouterCacheKey)(e,!0))})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},76015:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{canSegmentBeOverridden:function(){return u},matchSegment:function(){return o}});let r=n(87417),o=(e,t)=>"string"==typeof e?"string"==typeof t&&e===t:"string"!=typeof t&&e[0]===t[0]&&e[1]===t[1],u=(e,t)=>{var n;return!Array.isArray(e)&&!!Array.isArray(t)&&(null==(n=(0,r.getSegmentParam)(e))?void 0:n.param)===t[0]};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},35475:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ReadonlyURLSearchParams:function(){return i.ReadonlyURLSearchParams},RedirectType:function(){return i.RedirectType},ServerInsertedHTMLContext:function(){return c.ServerInsertedHTMLContext},notFound:function(){return i.notFound},permanentRedirect:function(){return i.permanentRedirect},redirect:function(){return i.redirect},useParams:function(){return p},usePathname:function(){return f},useRouter:function(){return d},useSearchParams:function(){return s},useSelectedLayoutSegment:function(){return y},useSelectedLayoutSegments:function(){return h},useServerInsertedHTML:function(){return c.useServerInsertedHTML}});let r=n(2265),o=n(61956),u=n(79060),l=n(73171),a=n(84541),i=n(52646),c=n(55501);function s(){let e=(0,r.useContext)(u.SearchParamsContext),t=(0,r.useMemo)(()=>e?new i.ReadonlyURLSearchParams(e):null,[e]);if("undefined"==typeof window){let{bailoutToClientRendering:e}=n(96149);e("useSearchParams()")}return t}function f(){return(0,r.useContext)(u.PathnameContext)}function d(){let e=(0,r.useContext)(o.AppRouterContext);if(null===e)throw Error("invariant expected app router to be mounted");return e}function p(){return(0,r.useContext)(u.PathParamsContext)}function h(e){void 0===e&&(e="children");let t=(0,r.useContext)(o.LayoutRouterContext);return t?function e(t,n,r,o){let u;if(void 0===r&&(r=!0),void 0===o&&(o=[]),r)u=t[1][n];else{var i;let e=t[1];u=null!=(i=e.children)?i:Object.values(e)[0]}if(!u)return o;let c=u[0],s=(0,l.getSegmentValue)(c);return!s||s.startsWith(a.PAGE_SEGMENT_KEY)?o:(o.push(s),e(u,n,!1,o))}(t.tree,e):null}function y(e){void 0===e&&(e="children");let t=h(e);if(!t||0===t.length)return null;let n="children"===e?t[0]:t[t.length-1];return n===a.DEFAULT_SEGMENT_KEY?null:n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},52646:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ReadonlyURLSearchParams:function(){return l},RedirectType:function(){return r.RedirectType},notFound:function(){return o.notFound},permanentRedirect:function(){return r.permanentRedirect},redirect:function(){return r.redirect}});let r=n(88968),o=n(98200);class u extends Error{constructor(){super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams")}}class l extends URLSearchParams{append(){throw new u}delete(){throw new u}set(){throw new u}sort(){throw new u}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},80:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"NotFoundBoundary",{enumerable:!0,get:function(){return s}});let r=n(53099),o=n(57437),u=r._(n(2265)),l=n(35475),a=n(98200);n(31765);let i=n(61956);class c extends u.default.Component{componentDidCatch(){}static getDerivedStateFromError(e){if((0,a.isNotFoundError)(e))return{notFoundTriggered:!0};throw e}static getDerivedStateFromProps(e,t){return e.pathname!==t.previousPathname&&t.notFoundTriggered?{notFoundTriggered:!1,previousPathname:e.pathname}:{notFoundTriggered:t.notFoundTriggered,previousPathname:e.pathname}}render(){return this.state.notFoundTriggered?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("meta",{name:"robots",content:"noindex"}),!1,this.props.notFoundStyles,this.props.notFound]}):this.props.children}constructor(e){super(e),this.state={notFoundTriggered:!!e.asNotFound,previousPathname:e.pathname}}}function s(e){let{notFound:t,notFoundStyles:n,asNotFound:r,children:a}=e,s=(0,l.usePathname)(),f=(0,u.useContext)(i.MissingSlotContext);return t?(0,o.jsx)(c,{pathname:s,notFound:t,notFoundStyles:n,asNotFound:r,missingSlots:f,children:a}):(0,o.jsx)(o.Fragment,{children:a})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},98200:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{isNotFoundError:function(){return o},notFound:function(){return r}});let n="NEXT_NOT_FOUND";function r(){let e=Error(n);throw e.digest=n,e}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},29744:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PromiseQueue",{enumerable:!0,get:function(){return c}});let r=n(2522),o=n(90675);var u=o._("_maxConcurrency"),l=o._("_runningCount"),a=o._("_queue"),i=o._("_processNext");class c{enqueue(e){let t,n;let o=new Promise((e,r)=>{t=e,n=r}),u=async()=>{try{r._(this,l)[l]++;let n=await e();t(n)}catch(e){n(e)}finally{r._(this,l)[l]--,r._(this,i)[i]()}};return r._(this,a)[a].push({promiseFn:o,task:u}),r._(this,i)[i](),o}bump(e){let t=r._(this,a)[a].findIndex(t=>t.promiseFn===e);if(t>-1){let e=r._(this,a)[a].splice(t,1)[0];r._(this,a)[a].unshift(e),r._(this,i)[i](!0)}}constructor(e=5){Object.defineProperty(this,i,{value:s}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,a,{writable:!0,value:void 0}),r._(this,u)[u]=e,r._(this,l)[l]=0,r._(this,a)[a]=[]}}function s(e){if(void 0===e&&(e=!1),(r._(this,l)[l]0){var t;null==(t=r._(this,a)[a].shift())||t.task()}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4123:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{RedirectBoundary:function(){return s},RedirectErrorBoundary:function(){return c}});let r=n(53099),o=n(57437),u=r._(n(2265)),l=n(35475),a=n(88968);function i(e){let{redirect:t,reset:n,redirectType:r}=e,o=(0,l.useRouter)();return(0,u.useEffect)(()=>{u.default.startTransition(()=>{r===a.RedirectType.push?o.push(t,{}):o.replace(t,{}),n()})},[t,r,n,o]),null}class c extends u.default.Component{static getDerivedStateFromError(e){if((0,a.isRedirectError)(e))return{redirect:(0,a.getURLFromRedirectError)(e),redirectType:(0,a.getRedirectTypeFromError)(e)};throw e}render(){let{redirect:e,redirectType:t}=this.state;return null!==e&&null!==t?(0,o.jsx)(i,{redirect:e,redirectType:t,reset:()=>this.setState({redirect:null})}):this.props.children}constructor(e){super(e),this.state={redirect:null,redirectType:null}}}function s(e){let{children:t}=e,n=(0,l.useRouter)();return(0,o.jsx)(c,{router:n,children:t})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5001:function(e,t){"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RedirectStatusCode",{enumerable:!0,get:function(){return n}}),(r=n||(n={}))[r.SeeOther=303]="SeeOther",r[r.TemporaryRedirect=307]="TemporaryRedirect",r[r.PermanentRedirect=308]="PermanentRedirect",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},88968:function(e,t,n){"use strict";var r,o;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{RedirectType:function(){return r},getRedirectError:function(){return c},getRedirectStatusCodeFromError:function(){return y},getRedirectTypeFromError:function(){return h},getURLFromRedirectError:function(){return p},isRedirectError:function(){return d},permanentRedirect:function(){return f},redirect:function(){return s}});let u=n(20544),l=n(90295),a=n(5001),i="NEXT_REDIRECT";function c(e,t,n){void 0===n&&(n=a.RedirectStatusCode.TemporaryRedirect);let r=Error(i);r.digest=i+";"+t+";"+e+";"+n+";";let o=u.requestAsyncStorage.getStore();return o&&(r.mutableCookies=o.mutableCookies),r}function s(e,t){void 0===t&&(t="replace");let n=l.actionAsyncStorage.getStore();throw c(e,t,(null==n?void 0:n.isAction)?a.RedirectStatusCode.SeeOther:a.RedirectStatusCode.TemporaryRedirect)}function f(e,t){void 0===t&&(t="replace");let n=l.actionAsyncStorage.getStore();throw c(e,t,(null==n?void 0:n.isAction)?a.RedirectStatusCode.SeeOther:a.RedirectStatusCode.PermanentRedirect)}function d(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let[t,n,r,o]=e.digest.split(";",4),u=Number(o);return t===i&&("replace"===n||"push"===n)&&"string"==typeof r&&!isNaN(u)&&u in a.RedirectStatusCode}function p(e){return d(e)?e.digest.split(";",3)[2]:null}function h(e){if(!d(e))throw Error("Not a redirect error");return e.digest.split(";",2)[1]}function y(e){if(!d(e))throw Error("Not a redirect error");return Number(e.digest.split(";",4)[3])}(o=r||(r={})).push="push",o.replace="replace",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},36423:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let r=n(53099),o=n(57437),u=r._(n(2265)),l=n(61956);function a(){let e=(0,u.useContext)(l.TemplateContext);return(0,o.jsx)(o.Fragment,{children:e})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},20544:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{getExpectedRequestStore:function(){return o},requestAsyncStorage:function(){return r.requestAsyncStorage}});let r=n(25575);function o(e){let t=r.requestAsyncStorage.getStore();if(t)return t;throw Error("`"+e+"` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},22356:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"applyFlightData",{enumerable:!0,get:function(){return u}});let r=n(27420),o=n(92576);function u(e,t,n,u){let[l,a,i]=n.slice(-3);if(null===a)return!1;if(3===n.length){let n=a[2],o=a[3];t.loading=o,t.rsc=n,t.prefetchRsc=null,(0,r.fillLazyItemsTillLeafWithHead)(t,e,l,a,i,u)}else t.rsc=e.rsc,t.prefetchRsc=e.prefetchRsc,t.parallelRoutes=new Map(e.parallelRoutes),t.loading=e.loading,(0,o.fillCacheWithNewSubTreeData)(t,e,n,u);return!0}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},81935:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"applyRouterStatePatchToTree",{enumerable:!0,get:function(){return function e(t,n,r,a){let i;let[c,s,f,d,p]=n;if(1===t.length){let e=l(n,r,t);return(0,u.addRefreshMarkerToActiveParallelSegments)(e,a),e}let[h,y]=t;if(!(0,o.matchSegment)(h,c))return null;if(2===t.length)i=l(s[y],r,t);else if(null===(i=e(t.slice(2),s[y],r,a)))return null;let _=[t[0],{...s,[y]:i},f,d];return p&&(_[4]=!0),(0,u.addRefreshMarkerToActiveParallelSegments)(_,a),_}}});let r=n(84541),o=n(76015),u=n(50232);function l(e,t,n){let[u,a]=e,[i,c]=t;if(i===r.DEFAULT_SEGMENT_KEY&&u!==r.DEFAULT_SEGMENT_KEY)return e;if((0,o.matchSegment)(u,i)){let t={};for(let e in a)void 0!==c[e]?t[e]=l(a[e],c[e],n):t[e]=a[e];for(let e in c)t[e]||(t[e]=c[e]);let r=[u,t];return e[2]&&(r[2]=e[2]),e[3]&&(r[3]=e[3]),e[4]&&(r[4]=e[4]),r}return t}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},65556:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"clearCacheNodeDataForSegmentPath",{enumerable:!0,get:function(){return function e(t,n,o){let u=o.length<=2,[l,a]=o,i=(0,r.createRouterCacheKey)(a),c=n.parallelRoutes.get(l),s=t.parallelRoutes.get(l);s&&s!==c||(s=new Map(c),t.parallelRoutes.set(l,s));let f=null==c?void 0:c.get(i),d=s.get(i);if(u){d&&d.lazyData&&d!==f||s.set(i,{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null});return}if(!d||!f){d||s.set(i,{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null});return}return d===f&&(d={lazyData:d.lazyData,rsc:d.rsc,prefetchRsc:d.prefetchRsc,head:d.head,prefetchHead:d.prefetchHead,parallelRoutes:new Map(d.parallelRoutes),lazyDataResolved:d.lazyDataResolved,loading:d.loading},s.set(i,d)),e(d,f,o.slice(2))}}});let r=n(78505);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5410:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{computeChangedPath:function(){return s},extractPathFromFlightRouterState:function(){return c}});let r=n(91182),o=n(84541),u=n(76015),l=e=>"/"===e[0]?e.slice(1):e,a=e=>"string"==typeof e?"children"===e?"":e:e[1];function i(e){return e.reduce((e,t)=>""===(t=l(t))||(0,o.isGroupSegment)(t)?e:e+"/"+t,"")||"/"}function c(e){var t;let n=Array.isArray(e[0])?e[0][1]:e[0];if(n===o.DEFAULT_SEGMENT_KEY||r.INTERCEPTION_ROUTE_MARKERS.some(e=>n.startsWith(e)))return;if(n.startsWith(o.PAGE_SEGMENT_KEY))return"";let u=[a(n)],l=null!=(t=e[1])?t:{},s=l.children?c(l.children):void 0;if(void 0!==s)u.push(s);else for(let[e,t]of Object.entries(l)){if("children"===e)continue;let n=c(t);void 0!==n&&u.push(n)}return i(u)}function s(e,t){let n=function e(t,n){let[o,l]=t,[i,s]=n,f=a(o),d=a(i);if(r.INTERCEPTION_ROUTE_MARKERS.some(e=>f.startsWith(e)||d.startsWith(e)))return"";if(!(0,u.matchSegment)(o,i)){var p;return null!=(p=c(n))?p:""}for(let t in l)if(s[t]){let n=e(l[t],s[t]);if(null!==n)return a(i)+"/"+n}return null}(e,t);return null==n||"/"===n?n:i(n.split("/"))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},33456:function(e,t){"use strict";function n(e,t){return void 0===t&&(t=!0),e.pathname+e.search+(t?e.hash:"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createHrefFromUrl",{enumerable:!0,get:function(){return n}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},82952:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createInitialRouterState",{enumerable:!0,get:function(){return c}});let r=n(33456),o=n(27420),u=n(5410),l=n(60305),a=n(24673),i=n(50232);function c(e){var t;let{buildId:n,initialTree:c,initialSeedData:s,urlParts:f,initialParallelRoutes:d,location:p,initialHead:h,couldBeIntercepted:y}=e,_=f.join("/"),v=!p,b={lazyData:null,rsc:s[2],prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:v?new Map:d,lazyDataResolved:!1,loading:s[3]},g=p?(0,r.createHrefFromUrl)(p):_;(0,i.addRefreshMarkerToActiveParallelSegments)(c,g);let m=new Map;(null===d||0===d.size)&&(0,o.fillLazyItemsTillLeafWithHead)(b,void 0,c,s,h);let R={buildId:n,tree:c,cache:b,prefetchCache:m,pushRef:{pendingPush:!1,mpaNavigation:!1,preserveCustomHistoryState:!0},focusAndScrollRef:{apply:!1,onlyHashChange:!1,hashFragment:null,segmentPaths:[]},canonicalUrl:g,nextUrl:null!=(t=(0,u.extractPathFromFlightRouterState)(c)||(null==p?void 0:p.pathname))?t:null};if(p){let e=new URL(""+p.pathname+p.search,p.origin),t=[["",c,null,null]];(0,l.createPrefetchCacheEntryForInitialLoad)({url:e,kind:a.PrefetchKind.AUTO,data:[t,void 0,!1,y],tree:R.tree,prefetchCache:R.prefetchCache,nextUrl:R.nextUrl})}return R}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},78505:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createRouterCacheKey",{enumerable:!0,get:function(){return o}});let r=n(84541);function o(e,t){return(void 0===t&&(t=!1),Array.isArray(e))?e[0]+"|"+e[1]+"|"+e[2]:t&&e.startsWith(r.PAGE_SEGMENT_KEY)?r.PAGE_SEGMENT_KEY:e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},44848:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fetchServerResponse",{enumerable:!0,get:function(){return f}});let r=n(6866),o=n(12846),u=n(83079),l=n(24673),a=n(37207),i=n(91311),{createFromFetch:c}=n(6671);function s(e){return[(0,o.urlToUrlWithoutFlightMarker)(e).toString(),void 0,!1,!1]}async function f(e,t,n,f,d){let p={[r.RSC_HEADER]:"1",[r.NEXT_ROUTER_STATE_TREE]:(0,i.prepareFlightRouterStateForRequest)(t)};d===l.PrefetchKind.AUTO&&(p[r.NEXT_ROUTER_PREFETCH_HEADER]="1"),n&&(p[r.NEXT_URL]=n);let h=(0,a.hexHash)([p[r.NEXT_ROUTER_PREFETCH_HEADER]||"0",p[r.NEXT_ROUTER_STATE_TREE],p[r.NEXT_URL]].join(","));try{var y;let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="index.txt":t.pathname+=".txt",t.searchParams.set(r.NEXT_RSC_UNION_QUERY,h);let n=await fetch(t,{credentials:"same-origin",headers:p}),l=(0,o.urlToUrlWithoutFlightMarker)(n.url),a=n.redirected?l:void 0,i=n.headers.get("content-type")||"",d=!!n.headers.get(r.NEXT_DID_POSTPONE_HEADER),_=!!(null==(y=n.headers.get("vary"))?void 0:y.includes(r.NEXT_URL)),v=i===r.RSC_CONTENT_TYPE_HEADER;if(v||(v=i.startsWith("text/plain")),!v||!n.ok)return e.hash&&(l.hash=e.hash),s(l.toString());let[b,g]=await c(Promise.resolve(n),{callServer:u.callServer});if(f!==b)return s(n.url);return[g,a,d,_]}catch(t){return console.error("Failed to fetch RSC payload for "+e+". Falling back to browser navigation.",t),[e.toString(),void 0,!1,!1]}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},92576:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fillCacheWithNewSubTreeData",{enumerable:!0,get:function(){return function e(t,n,l,a){let i=l.length<=5,[c,s]=l,f=(0,u.createRouterCacheKey)(s),d=n.parallelRoutes.get(c);if(!d)return;let p=t.parallelRoutes.get(c);p&&p!==d||(p=new Map(d),t.parallelRoutes.set(c,p));let h=d.get(f),y=p.get(f);if(i){if(!y||!y.lazyData||y===h){let e=l[3];y={lazyData:null,rsc:e[2],prefetchRsc:null,head:null,prefetchHead:null,loading:e[3],parallelRoutes:h?new Map(h.parallelRoutes):new Map,lazyDataResolved:!1},h&&(0,r.invalidateCacheByRouterState)(y,h,l[2]),(0,o.fillLazyItemsTillLeafWithHead)(y,h,l[2],e,l[4],a),p.set(f,y)}return}y&&h&&(y===h&&(y={lazyData:y.lazyData,rsc:y.rsc,prefetchRsc:y.prefetchRsc,head:y.head,prefetchHead:y.prefetchHead,parallelRoutes:new Map(y.parallelRoutes),lazyDataResolved:!1,loading:y.loading},p.set(f,y)),e(y,h,l.slice(2),a))}}});let r=n(94377),o=n(27420),u=n(78505);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},27420:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fillLazyItemsTillLeafWithHead",{enumerable:!0,get:function(){return function e(t,n,u,l,a,i){if(0===Object.keys(u[1]).length){t.head=a;return}for(let c in u[1]){let s;let f=u[1][c],d=f[0],p=(0,r.createRouterCacheKey)(d),h=null!==l&&void 0!==l[1][c]?l[1][c]:null;if(n){let r=n.parallelRoutes.get(c);if(r){let n;let u=(null==i?void 0:i.kind)==="auto"&&i.status===o.PrefetchCacheEntryStatus.reusable,l=new Map(r),s=l.get(p);n=null!==h?{lazyData:null,rsc:h[2],prefetchRsc:null,head:null,prefetchHead:null,loading:h[3],parallelRoutes:new Map(null==s?void 0:s.parallelRoutes),lazyDataResolved:!1}:u&&s?{lazyData:s.lazyData,rsc:s.rsc,prefetchRsc:s.prefetchRsc,head:s.head,prefetchHead:s.prefetchHead,parallelRoutes:new Map(s.parallelRoutes),lazyDataResolved:s.lazyDataResolved,loading:s.loading}:{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map(null==s?void 0:s.parallelRoutes),lazyDataResolved:!1,loading:null},l.set(p,n),e(n,s,f,h||null,a,i),t.parallelRoutes.set(c,l);continue}}if(null!==h){let e=h[2],t=h[3];s={lazyData:null,rsc:e,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:t}}else s={lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null};let y=t.parallelRoutes.get(c);y?y.set(p,s):t.parallelRoutes.set(c,new Map([[p,s]])),e(s,void 0,f,h,a,i)}}}});let r=n(78505),o=n(24673);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},44510:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleMutable",{enumerable:!0,get:function(){return u}});let r=n(5410);function o(e){return void 0!==e}function u(e,t){var n,u,l;let a=null==(u=t.shouldScroll)||u,i=e.nextUrl;if(o(t.patchedTree)){let n=(0,r.computeChangedPath)(e.tree,t.patchedTree);n?i=n:i||(i=e.canonicalUrl)}return{buildId:e.buildId,canonicalUrl:o(t.canonicalUrl)?t.canonicalUrl===e.canonicalUrl?e.canonicalUrl:t.canonicalUrl:e.canonicalUrl,pushRef:{pendingPush:o(t.pendingPush)?t.pendingPush:e.pushRef.pendingPush,mpaNavigation:o(t.mpaNavigation)?t.mpaNavigation:e.pushRef.mpaNavigation,preserveCustomHistoryState:o(t.preserveCustomHistoryState)?t.preserveCustomHistoryState:e.pushRef.preserveCustomHistoryState},focusAndScrollRef:{apply:!!a&&(!!o(null==t?void 0:t.scrollableSegments)||e.focusAndScrollRef.apply),onlyHashChange:!!t.hashFragment&&e.canonicalUrl.split("#",1)[0]===(null==(n=t.canonicalUrl)?void 0:n.split("#",1)[0]),hashFragment:a?t.hashFragment&&""!==t.hashFragment?decodeURIComponent(t.hashFragment.slice(1)):e.focusAndScrollRef.hashFragment:null,segmentPaths:a?null!=(l=null==t?void 0:t.scrollableSegments)?l:e.focusAndScrollRef.segmentPaths:[]},cache:t.cache?t.cache:e.cache,prefetchCache:t.prefetchCache?t.prefetchCache:e.prefetchCache,tree:o(t.patchedTree)?t.patchedTree:e.tree,nextUrl:i}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77831:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleSegmentMismatch",{enumerable:!0,get:function(){return o}});let r=n(95967);function o(e,t,n){return(0,r.handleExternalUrl)(e,{},e.canonicalUrl,!0)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77058:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"invalidateCacheBelowFlightSegmentPath",{enumerable:!0,get:function(){return function e(t,n,o){let u=o.length<=2,[l,a]=o,i=(0,r.createRouterCacheKey)(a),c=n.parallelRoutes.get(l);if(!c)return;let s=t.parallelRoutes.get(l);if(s&&s!==c||(s=new Map(c),t.parallelRoutes.set(l,s)),u){s.delete(i);return}let f=c.get(i),d=s.get(i);d&&f&&(d===f&&(d={lazyData:d.lazyData,rsc:d.rsc,prefetchRsc:d.prefetchRsc,head:d.head,prefetchHead:d.prefetchHead,parallelRoutes:new Map(d.parallelRoutes),lazyDataResolved:d.lazyDataResolved},s.set(i,d)),e(d,f,o.slice(2)))}}});let r=n(78505);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},94377:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"invalidateCacheByRouterState",{enumerable:!0,get:function(){return o}});let r=n(78505);function o(e,t,n){for(let o in n[1]){let u=n[1][o][0],l=(0,r.createRouterCacheKey)(u),a=t.parallelRoutes.get(o);if(a){let t=new Map(a);t.delete(l),e.parallelRoutes.set(o,t)}}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},63237:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isNavigatingToNewRootLayout",{enumerable:!0,get:function(){return function e(t,n){let r=t[0],o=n[0];if(Array.isArray(r)&&Array.isArray(o)){if(r[0]!==o[0]||r[2]!==o[2])return!0}else if(r!==o)return!0;if(t[4])return!n[4];if(n[4])return!0;let u=Object.values(t[1])[0],l=Object.values(n[1])[0];return!u||!l||e(u,l)}}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},56118:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{abortTask:function(){return c},listenForDynamicRequest:function(){return a},updateCacheNodeOnNavigation:function(){return function e(t,n,a,c,s){let f=n[1],d=a[1],p=c[1],h=t.parallelRoutes,y=new Map(h),_={},v=null;for(let t in d){let n;let a=d[t],c=f[t],b=h.get(t),g=p[t],m=a[0],R=(0,u.createRouterCacheKey)(m),P=void 0!==c?c[0]:void 0,j=void 0!==b?b.get(R):void 0;if(null!==(n=m===r.PAGE_SEGMENT_KEY?l(a,void 0!==g?g:null,s):m===r.DEFAULT_SEGMENT_KEY?void 0!==c?{route:c,node:null,children:null}:l(a,void 0!==g?g:null,s):void 0!==P&&(0,o.matchSegment)(m,P)&&void 0!==j&&void 0!==c?null!=g?e(j,c,a,g,s):function(e){let t=i(e,null,null);return{route:e,node:t,children:null}}(a):l(a,void 0!==g?g:null,s))){null===v&&(v=new Map),v.set(t,n);let e=n.node;if(null!==e){let n=new Map(b);n.set(R,e),y.set(t,n)}_[t]=n.route}else _[t]=a}if(null===v)return null;let b={lazyData:null,rsc:t.rsc,prefetchRsc:t.prefetchRsc,head:t.head,prefetchHead:t.prefetchHead,loading:t.loading,parallelRoutes:y,lazyDataResolved:!1};return{route:function(e,t){let n=[e[0],t];return 2 in e&&(n[2]=e[2]),3 in e&&(n[3]=e[3]),4 in e&&(n[4]=e[4]),n}(a,_),node:b,children:v}}},updateCacheNodeOnPopstateRestoration:function(){return function e(t,n){let r=n[1],o=t.parallelRoutes,l=new Map(o);for(let t in r){let n=r[t],a=n[0],i=(0,u.createRouterCacheKey)(a),c=o.get(t);if(void 0!==c){let r=c.get(i);if(void 0!==r){let o=e(r,n),u=new Map(c);u.set(i,o),l.set(t,u)}}}let a=t.rsc,i=d(a)&&"pending"===a.status;return{lazyData:null,rsc:a,head:t.head,prefetchHead:i?t.prefetchHead:null,prefetchRsc:i?t.prefetchRsc:null,loading:i?t.loading:null,parallelRoutes:l,lazyDataResolved:!1}}}});let r=n(84541),o=n(76015),u=n(78505);function l(e,t,n){let r=i(e,t,n);return{route:e,node:r,children:null}}function a(e,t){t.then(t=>{for(let n of t[0]){let t=n.slice(0,-3),r=n[n.length-3],l=n[n.length-2],a=n[n.length-1];"string"!=typeof t&&function(e,t,n,r,l){let a=e;for(let e=0;e{c(e,t)})}function i(e,t,n){let r=e[1],o=null!==t?t[1]:null,l=new Map;for(let e in r){let t=r[e],a=null!==o?o[e]:null,c=t[0],s=(0,u.createRouterCacheKey)(c),f=i(t,void 0===a?null:a,n),d=new Map;d.set(s,f),l.set(e,d)}let a=0===l.size,c=null!==t?t[2]:null,s=null!==t?t[3]:null;return{lazyData:null,parallelRoutes:l,prefetchRsc:void 0!==c?c:null,prefetchHead:a?n:null,loading:void 0!==s?s:null,rsc:p(),head:a?p():null,lazyDataResolved:!1}}function c(e,t){let n=e.node;if(null===n)return;let r=e.children;if(null===r)s(e.route,n,t);else for(let e of r.values())c(e,t);e.node=null}function s(e,t,n){let r=e[1],o=t.parallelRoutes;for(let e in r){let t=r[e],l=o.get(e);if(void 0===l)continue;let a=t[0],i=(0,u.createRouterCacheKey)(a),c=l.get(i);void 0!==c&&s(t,c,n)}let l=t.rsc;d(l)&&(null===n?l.resolve(null):l.reject(n));let a=t.head;d(a)&&a.resolve(null)}let f=Symbol();function d(e){return e&&e.tag===f}function p(){let e,t;let n=new Promise((n,r)=>{e=n,t=r});return n.status="pending",n.resolve=t=>{"pending"===n.status&&(n.status="fulfilled",n.value=t,e(t))},n.reject=e=>{"pending"===n.status&&(n.status="rejected",n.reason=e,t(e))},n.tag=f,n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},60305:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createPrefetchCacheEntryForInitialLoad:function(){return c},getOrCreatePrefetchCacheEntry:function(){return i},prunePrefetchCache:function(){return f}});let r=n(33456),o=n(44848),u=n(24673),l=n(24819);function a(e,t){let n=(0,r.createHrefFromUrl)(e,!1);return t?t+"%"+n:n}function i(e){let t,{url:n,nextUrl:r,tree:o,buildId:l,prefetchCache:i,kind:c}=e,f=a(n,r),d=i.get(f);if(d)t=d;else{let e=a(n),r=i.get(e);r&&(t=r)}return t?(t.status=h(t),t.kind!==u.PrefetchKind.FULL&&c===u.PrefetchKind.FULL)?s({tree:o,url:n,buildId:l,nextUrl:r,prefetchCache:i,kind:null!=c?c:u.PrefetchKind.TEMPORARY}):(c&&t.kind===u.PrefetchKind.TEMPORARY&&(t.kind=c),t):s({tree:o,url:n,buildId:l,nextUrl:r,prefetchCache:i,kind:c||u.PrefetchKind.TEMPORARY})}function c(e){let{nextUrl:t,tree:n,prefetchCache:r,url:o,kind:l,data:i}=e,[,,,c]=i,s=c?a(o,t):a(o),f={treeAtTimeOfPrefetch:n,data:Promise.resolve(i),kind:l,prefetchTime:Date.now(),lastUsedTime:Date.now(),key:s,status:u.PrefetchCacheEntryStatus.fresh};return r.set(s,f),f}function s(e){let{url:t,kind:n,tree:r,nextUrl:i,buildId:c,prefetchCache:s}=e,f=a(t),d=l.prefetchQueue.enqueue(()=>(0,o.fetchServerResponse)(t,r,i,c,n).then(e=>{let[,,,n]=e;return n&&function(e){let{url:t,nextUrl:n,prefetchCache:r}=e,o=a(t),u=r.get(o);if(!u)return;let l=a(t,n);r.set(l,u),r.delete(o)}({url:t,nextUrl:i,prefetchCache:s}),e})),p={treeAtTimeOfPrefetch:r,data:d,kind:n,prefetchTime:Date.now(),lastUsedTime:null,key:f,status:u.PrefetchCacheEntryStatus.fresh};return s.set(f,p),p}function f(e){for(let[t,n]of e)h(n)===u.PrefetchCacheEntryStatus.expired&&e.delete(t)}let d=1e3*Number("30"),p=1e3*Number("300");function h(e){let{kind:t,prefetchTime:n,lastUsedTime:r}=e;return Date.now()<(null!=r?r:n)+d?r?u.PrefetchCacheEntryStatus.reusable:u.PrefetchCacheEntryStatus.fresh:"auto"===t&&Date.now(){let[n,f]=t,h=!1;if(E.lastUsedTime||(E.lastUsedTime=Date.now(),h=!0),"string"==typeof n)return _(e,R,n,O);if(document.getElementById("__next-page-redirect"))return _(e,R,j,O);let b=e.tree,g=e.cache,w=[];for(let t of n){let n=t.slice(0,-4),r=t.slice(-3)[0],c=["",...n],f=(0,u.applyRouterStatePatchToTree)(c,b,r,j);if(null===f&&(f=(0,u.applyRouterStatePatchToTree)(c,S,r,j)),null!==f){if((0,a.isNavigatingToNewRootLayout)(b,f))return _(e,R,j,O);let u=(0,d.createEmptyCacheNode)(),m=!1;for(let e of(E.status!==i.PrefetchCacheEntryStatus.stale||h?m=(0,s.applyFlightData)(g,u,t,E):(m=function(e,t,n,r){let o=!1;for(let u of(e.rsc=t.rsc,e.prefetchRsc=t.prefetchRsc,e.loading=t.loading,e.parallelRoutes=new Map(t.parallelRoutes),v(r).map(e=>[...n,...e])))(0,y.clearCacheNodeDataForSegmentPath)(e,t,u),o=!0;return o}(u,g,n,r),E.lastUsedTime=Date.now()),(0,l.shouldHardNavigate)(c,b)?(u.rsc=g.rsc,u.prefetchRsc=g.prefetchRsc,(0,o.invalidateCacheBelowFlightSegmentPath)(u,g,n),R.cache=u):m&&(R.cache=u,g=u),b=f,v(r))){let t=[...n,...e];t[t.length-1]!==p.DEFAULT_SEGMENT_KEY&&w.push(t)}}}return R.patchedTree=b,R.canonicalUrl=f?(0,r.createHrefFromUrl)(f):j,R.pendingPush=O,R.scrollableSegments=w,R.hashFragment=P,R.shouldScroll=m,(0,c.handleMutable)(e,R)},()=>e)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},24819:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{prefetchQueue:function(){return l},prefetchReducer:function(){return a}});let r=n(6866),o=n(29744),u=n(60305),l=new o.PromiseQueue(5);function a(e,t){(0,u.prunePrefetchCache)(e.prefetchCache);let{url:n}=t;return n.searchParams.delete(r.NEXT_RSC_UNION_QUERY),(0,u.getOrCreatePrefetchCacheEntry)({url:n,nextUrl:e.nextUrl,prefetchCache:e.prefetchCache,kind:t.kind,tree:e.tree,buildId:e.buildId}),e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},99601:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"refreshReducer",{enumerable:!0,get:function(){return h}});let r=n(44848),o=n(33456),u=n(81935),l=n(63237),a=n(95967),i=n(44510),c=n(27420),s=n(12846),f=n(77831),d=n(28077),p=n(50232);function h(e,t){let{origin:n}=t,h={},y=e.canonicalUrl,_=e.tree;h.preserveCustomHistoryState=!1;let v=(0,s.createEmptyCacheNode)(),b=(0,d.hasInterceptionRouteInCurrentTree)(e.tree);return v.lazyData=(0,r.fetchServerResponse)(new URL(y,n),[_[0],_[1],_[2],"refetch"],b?e.nextUrl:null,e.buildId),v.lazyData.then(async n=>{let[r,s]=n;if("string"==typeof r)return(0,a.handleExternalUrl)(e,h,r,e.pushRef.pendingPush);for(let n of(v.lazyData=null,r)){if(3!==n.length)return console.log("REFRESH FAILED"),e;let[r]=n,i=(0,u.applyRouterStatePatchToTree)([""],_,r,e.canonicalUrl);if(null===i)return(0,f.handleSegmentMismatch)(e,t,r);if((0,l.isNavigatingToNewRootLayout)(_,i))return(0,a.handleExternalUrl)(e,h,y,e.pushRef.pendingPush);let d=s?(0,o.createHrefFromUrl)(s):void 0;s&&(h.canonicalUrl=d);let[g,m]=n.slice(-2);if(null!==g){let e=g[2];v.rsc=e,v.prefetchRsc=null,(0,c.fillLazyItemsTillLeafWithHead)(v,void 0,r,g,m),h.prefetchCache=new Map}await (0,p.refreshInactiveParallelSegments)({state:e,updatedTree:i,updatedCache:v,includeNextUrl:b,canonicalUrl:h.canonicalUrl||e.canonicalUrl}),h.cache=v,h.patchedTree=i,h.canonicalUrl=y,_=i}return(0,i.handleMutable)(e,h)},()=>e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77784:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"restoreReducer",{enumerable:!0,get:function(){return u}});let r=n(33456),o=n(5410);function u(e,t){var n;let{url:u,tree:l}=t,a=(0,r.createHrefFromUrl)(u),i=l||e.tree,c=e.cache;return{buildId:e.buildId,canonicalUrl:a,pushRef:{pendingPush:!1,mpaNavigation:!1,preserveCustomHistoryState:!0},focusAndScrollRef:e.focusAndScrollRef,cache:c,prefetchCache:e.prefetchCache,tree:i,nextUrl:null!=(n=(0,o.extractPathFromFlightRouterState)(i))?n:u.pathname}}n(56118),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},13722:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"serverActionReducer",{enumerable:!0,get:function(){return m}});let r=n(83079),o=n(6866),u=n(1634),l=n(33456),a=n(95967),i=n(81935),c=n(63237),s=n(44510),f=n(27420),d=n(12846),p=n(28077),h=n(77831),y=n(50232),_=n(91311),{createFromFetch:v,encodeReply:b}=n(6671);async function g(e,t,n){let l,{actionId:a,actionArgs:i}=n,c=await b(i),s=await fetch("",{method:"POST",headers:{Accept:o.RSC_CONTENT_TYPE_HEADER,[o.ACTION]:a,[o.NEXT_ROUTER_STATE_TREE]:(0,_.prepareFlightRouterStateForRequest)(e.tree),...t?{[o.NEXT_URL]:t}:{}},body:c}),f=s.headers.get("x-action-redirect");try{let e=JSON.parse(s.headers.get("x-action-revalidated")||"[[],0,0]");l={paths:e[0]||[],tag:!!e[1],cookie:e[2]}}catch(e){l={paths:[],tag:!1,cookie:!1}}let d=f?new URL((0,u.addBasePath)(f),new URL(e.canonicalUrl,window.location.href)):void 0;if(s.headers.get("content-type")===o.RSC_CONTENT_TYPE_HEADER){let e=await v(Promise.resolve(s),{callServer:r.callServer});if(f){let[,t]=null!=e?e:[];return{actionFlightData:t,redirectLocation:d,revalidatedParts:l}}let[t,[,n]]=null!=e?e:[];return{actionResult:t,actionFlightData:n,redirectLocation:d,revalidatedParts:l}}return{redirectLocation:d,revalidatedParts:l}}function m(e,t){let{resolve:n,reject:r}=t,o={},u=e.canonicalUrl,_=e.tree;o.preserveCustomHistoryState=!1;let v=e.nextUrl&&(0,p.hasInterceptionRouteInCurrentTree)(e.tree)?e.nextUrl:null;return o.inFlightServerAction=g(e,v,t),o.inFlightServerAction.then(async r=>{let{actionResult:p,actionFlightData:b,redirectLocation:g}=r;if(g&&(e.pushRef.pendingPush=!0,o.pendingPush=!0),!b)return(n(p),g)?(0,a.handleExternalUrl)(e,o,g.href,e.pushRef.pendingPush):e;if("string"==typeof b)return(0,a.handleExternalUrl)(e,o,b,e.pushRef.pendingPush);if(o.inFlightServerAction=null,g){let e=(0,l.createHrefFromUrl)(g,!1);o.canonicalUrl=e}for(let n of b){if(3!==n.length)return console.log("SERVER ACTION APPLY FAILED"),e;let[r]=n,s=(0,i.applyRouterStatePatchToTree)([""],_,r,g?(0,l.createHrefFromUrl)(g):e.canonicalUrl);if(null===s)return(0,h.handleSegmentMismatch)(e,t,r);if((0,c.isNavigatingToNewRootLayout)(_,s))return(0,a.handleExternalUrl)(e,o,u,e.pushRef.pendingPush);let[p,b]=n.slice(-2),m=null!==p?p[2]:null;if(null!==m){let t=(0,d.createEmptyCacheNode)();t.rsc=m,t.prefetchRsc=null,(0,f.fillLazyItemsTillLeafWithHead)(t,void 0,r,p,b),await (0,y.refreshInactiveParallelSegments)({state:e,updatedTree:s,updatedCache:t,includeNextUrl:!!v,canonicalUrl:o.canonicalUrl||e.canonicalUrl}),o.cache=t,o.prefetchCache=new Map}o.patchedTree=s,_=s}return n(p),(0,s.handleMutable)(e,o)},t=>(r(t),e))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},68448:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"serverPatchReducer",{enumerable:!0,get:function(){return f}});let r=n(33456),o=n(81935),u=n(63237),l=n(95967),a=n(22356),i=n(44510),c=n(12846),s=n(77831);function f(e,t){let{serverResponse:n}=t,[f,d]=n,p={};if(p.preserveCustomHistoryState=!1,"string"==typeof f)return(0,l.handleExternalUrl)(e,p,f,e.pushRef.pendingPush);let h=e.tree,y=e.cache;for(let n of f){let i=n.slice(0,-4),[f]=n.slice(-3,-2),_=(0,o.applyRouterStatePatchToTree)(["",...i],h,f,e.canonicalUrl);if(null===_)return(0,s.handleSegmentMismatch)(e,t,f);if((0,u.isNavigatingToNewRootLayout)(h,_))return(0,l.handleExternalUrl)(e,p,e.canonicalUrl,e.pushRef.pendingPush);let v=d?(0,r.createHrefFromUrl)(d):void 0;v&&(p.canonicalUrl=v);let b=(0,c.createEmptyCacheNode)();(0,a.applyFlightData)(y,b,n),p.patchedTree=_,p.cache=b,y=b,h=_}return(0,i.handleMutable)(e,p)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},50232:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{addRefreshMarkerToActiveParallelSegments:function(){return function e(t,n){let[r,o,,l]=t;for(let a in r.includes(u.PAGE_SEGMENT_KEY)&&"refresh"!==l&&(t[2]=n,t[3]="refresh"),o)e(o[a],n)}},refreshInactiveParallelSegments:function(){return l}});let r=n(22356),o=n(44848),u=n(84541);async function l(e){let t=new Set;await a({...e,rootTree:e.updatedTree,fetchedSegments:t})}async function a(e){let{state:t,updatedTree:n,updatedCache:u,includeNextUrl:l,fetchedSegments:i,rootTree:c=n,canonicalUrl:s}=e,[,f,d,p]=n,h=[];if(d&&d!==s&&"refresh"===p&&!i.has(d)){i.add(d);let e=(0,o.fetchServerResponse)(new URL(d,location.origin),[c[0],c[1],c[2],"refetch"],l?t.nextUrl:null,t.buildId).then(e=>{let t=e[0];if("string"!=typeof t)for(let e of t)(0,r.applyFlightData)(u,u,e)});h.push(e)}for(let e in f){let n=a({state:t,updatedTree:f[e],updatedCache:u,includeNextUrl:l,fetchedSegments:i,rootTree:c,canonicalUrl:s});h.push(n)}await Promise.all(h)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},24673:function(e,t){"use strict";var n,r,o,u;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ACTION_FAST_REFRESH:function(){return f},ACTION_NAVIGATE:function(){return a},ACTION_PREFETCH:function(){return s},ACTION_REFRESH:function(){return l},ACTION_RESTORE:function(){return i},ACTION_SERVER_ACTION:function(){return d},ACTION_SERVER_PATCH:function(){return c},PrefetchCacheEntryStatus:function(){return r},PrefetchKind:function(){return n},isThenable:function(){return p}});let l="refresh",a="navigate",i="restore",c="server-patch",s="prefetch",f="fast-refresh",d="server-action";function p(e){return e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}(o=n||(n={})).AUTO="auto",o.FULL="full",o.TEMPORARY="temporary",(u=r||(r={})).fresh="fresh",u.reusable="reusable",u.expired="expired",u.stale="stale",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},91450:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"reducer",{enumerable:!0,get:function(){return f}});let r=n(24673),o=n(95967),u=n(68448),l=n(77784),a=n(99601),i=n(24819),c=n(44529),s=n(13722),f="undefined"==typeof window?function(e,t){return e}:function(e,t){switch(t.type){case r.ACTION_NAVIGATE:return(0,o.navigateReducer)(e,t);case r.ACTION_SERVER_PATCH:return(0,u.serverPatchReducer)(e,t);case r.ACTION_RESTORE:return(0,l.restoreReducer)(e,t);case r.ACTION_REFRESH:return(0,a.refreshReducer)(e,t);case r.ACTION_FAST_REFRESH:return(0,c.fastRefreshReducer)(e,t);case r.ACTION_PREFETCH:return(0,i.prefetchReducer)(e,t);case r.ACTION_SERVER_ACTION:return(0,s.serverActionReducer)(e,t);default:throw Error("Unknown action")}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},53728:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"shouldHardNavigate",{enumerable:!0,get:function(){return function e(t,n){let[o,u]=n,[l,a]=t;return(0,r.matchSegment)(l,o)?!(t.length<=2)&&e(t.slice(2),u[a]):!!Array.isArray(l)}}});let r=n(76015);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},54535:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createDynamicallyTrackedSearchParams:function(){return a},createUntrackedSearchParams:function(){return l}});let r=n(51845),o=n(86999),u=n(30650);function l(e){let t=r.staticGenerationAsyncStorage.getStore();return t&&t.forceStatic?{}:e}function a(e){let t=r.staticGenerationAsyncStorage.getStore();return t?t.forceStatic?{}:t.isStaticGeneration||t.dynamicShouldError?new Proxy({},{get:(e,n,r)=>("string"==typeof n&&(0,o.trackDynamicDataAccessed)(t,"searchParams."+n),u.ReflectAdapter.get(e,n,r)),has:(e,n)=>("string"==typeof n&&(0,o.trackDynamicDataAccessed)(t,"searchParams."+n),Reflect.has(e,n)),ownKeys:e=>((0,o.trackDynamicDataAccessed)(t,"searchParams"),Reflect.ownKeys(e))}):e:e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},51845:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"staticGenerationAsyncStorage",{enumerable:!0,get:function(){return r.staticGenerationAsyncStorage}});let r=n(20030);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},36864:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{StaticGenBailoutError:function(){return r},isStaticGenBailoutError:function(){return o}});let n="NEXT_STATIC_GEN_BAILOUT";class r extends Error{constructor(...e){super(...e),this.code=n}}function o(e){return"object"==typeof e&&null!==e&&"code"in e&&e.code===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},38137:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unresolvedThenable",{enumerable:!0,get:function(){return n}});let n={then:()=>{}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},47744:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{useReducerWithReduxDevtools:function(){return i},useUnwrapState:function(){return a}});let r=n(53099)._(n(2265)),o=n(24673),u=n(2103);function l(e){if(e instanceof Map){let t={};for(let[n,r]of e.entries()){if("function"==typeof r){t[n]="fn()";continue}if("object"==typeof r&&null!==r){if(r.$$typeof){t[n]=r.$$typeof.toString();continue}if(r._bundlerConfig){t[n]="FlightData";continue}}t[n]=l(r)}return t}if("object"==typeof e&&null!==e){let t={};for(let n in e){let r=e[n];if("function"==typeof r){t[n]="fn()";continue}if("object"==typeof r&&null!==r){if(r.$$typeof){t[n]=r.$$typeof.toString();continue}if(r.hasOwnProperty("_bundlerConfig")){t[n]="FlightData";continue}}t[n]=l(r)}return t}return Array.isArray(e)?e.map(l):e}function a(e){return(0,o.isThenable)(e)?(0,r.use)(e):e}let i="undefined"!=typeof window?function(e){let[t,n]=r.default.useState(e),o=(0,r.useContext)(u.ActionQueueContext);if(!o)throw Error("Invariant: Missing ActionQueueContext");let a=(0,r.useRef)(),i=(0,r.useRef)();return(0,r.useEffect)(()=>{if(!a.current&&!1!==i.current){if(void 0===i.current&&void 0===window.__REDUX_DEVTOOLS_EXTENSION__){i.current=!1;return}return a.current=window.__REDUX_DEVTOOLS_EXTENSION__.connect({instanceId:8e3,name:"next-router"}),a.current&&(a.current.init(l(e)),o&&(o.devToolsInstance=a.current)),()=>{a.current=void 0}}},[e,o]),[t,(0,r.useCallback)(t=>{o.state||(o.state=e),o.dispatch(t,n)},[o,e]),(0,r.useCallback)(e=>{a.current&&a.current.send({type:"RENDER_SYNC"},l(e))},[])]}:function(e){return[e,()=>{},()=>{}]};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},91311:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"prepareFlightRouterStateForRequest",{enumerable:!0,get:function(){return o}});let r=n(84541);function o(e,t){return t?encodeURIComponent(JSON.stringify(e)):encodeURIComponent(JSON.stringify(function e(t){let[n,o,,u,l]=t,a="string"==typeof n&&n.startsWith(r.PAGE_SEGMENT_KEY+"?")?r.PAGE_SEGMENT_KEY:n,i={};for(let[t,n]of Object.entries(o))i[t]=e(n);let c=[a,i,null,u&&"refresh"!==u?u:null];return void 0!==l&&(c[4]=l),c}(e)))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},11283:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hasBasePath",{enumerable:!0,get:function(){return o}});let r=n(10580);function o(e){return(0,r.pathHasPrefix)(e,"")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},33068:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"normalizePathTrailingSlash",{enumerable:!0,get:function(){return u}});let r=n(26674),o=n(63381),u=e=>{if(!e.startsWith("/"))return e;let{pathname:t,query:n,hash:u}=(0,o.parsePath)(e);return""+(0,r.removeTrailingSlash)(t)+n+u};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},61404:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o}});let r=n(18993);function o(e){let t="function"==typeof reportError?reportError:e=>{window.console.error(e)};(0,r.isBailoutToCSRError)(e)||t(e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},35076:function(e,t,n){"use strict";function r(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeBasePath",{enumerable:!0,get:function(){return r}}),n(11283),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},12010:function(e,t){"use strict";function n(e,t){var n=e.length;for(e.push(t);0>>1,o=e[r];if(0>>1;ru(i,n))cu(s,i)?(e[r]=s,e[c]=n,r=c):(e[r]=i,e[a]=n,r=a);else if(cu(s,n))e[r]=s,e[c]=n,r=c;else break}}return t}function u(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,a=performance;t.unstable_now=function(){return a.now()}}else{var i=Date,c=i.now();t.unstable_now=function(){return i.now()-c}}var s=[],f=[],d=1,p=null,h=3,y=!1,_=!1,v=!1,b="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,m="undefined"!=typeof setImmediate?setImmediate:null;function R(e){for(var t=r(f);null!==t;){if(null===t.callback)o(f);else if(t.startTime<=e)o(f),t.sortIndex=t.expirationTime,n(s,t);else break;t=r(f)}}function P(e){if(v=!1,R(e),!_){if(null!==r(s))_=!0,C();else{var t=r(f);null!==t&&A(P,t.startTime-e)}}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var j=!1,O=-1,E=5,S=-1;function w(){return!(t.unstable_now()-Se&&w());){var a=p.callback;if("function"==typeof a){p.callback=null,h=p.priorityLevel;var i=a(p.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof i){p.callback=i,R(e),n=!0;break t}p===r(s)&&o(s),R(e)}else o(s);p=r(s)}if(null!==p)n=!0;else{var c=r(f);null!==c&&A(P,c.startTime-e),n=!1}}break e}finally{p=null,h=u,y=!1}n=void 0}}finally{n?l():j=!1}}}if("function"==typeof m)l=function(){m(M)};else if("undefined"!=typeof MessageChannel){var T=new MessageChannel,x=T.port2;T.port1.onmessage=M,l=function(){x.postMessage(null)}}else l=function(){b(M,0)};function C(){j||(j=!0,l())}function A(e,n){O=b(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){_||y||(_=!0,C())},t.unstable_forceFrameRate=function(e){0>e||125l?(e.sortIndex=u,n(f,e),null===r(s)&&e===r(f)&&(v?(g(O),O=-1):v=!0,A(P,u-l))):(e.sortIndex=a,n(s,e),_||y||(_=!0,C())),e},t.unstable_shouldYield=w,t.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}},71767:function(e,t,n){"use strict";e.exports=n(12010)},60934:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{getPathname:function(){return r},isFullStringUrl:function(){return o},parseUrl:function(){return u}});let n="http://n";function r(e){return new URL(e,n).pathname}function o(e){return/https?:\/\//.test(e)}function u(e){let t;try{t=new URL(e,n)}catch{}return t}},86999:function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{Postpone:function(){return d},createPostponedAbortSignal:function(){return b},createPrerenderState:function(){return c},formatDynamicAPIAccesses:function(){return _},markCurrentScopeAsDynamic:function(){return s},trackDynamicDataAccessed:function(){return f},trackDynamicFetch:function(){return p},usedDynamicAPIs:function(){return y}});let o=(r=n(2265))&&r.__esModule?r:{default:r},u=n(46177),l=n(36864),a=n(60934),i="function"==typeof o.default.unstable_postpone;function c(e){return{isDebugSkeleton:e,dynamicAccesses:[]}}function s(e,t){let n=(0,a.getPathname)(e.urlPathname);if(!e.isUnstableCacheCallback){if(e.dynamicShouldError)throw new l.StaticGenBailoutError(`Route ${n} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);if(e.prerenderState)h(e.prerenderState,t,n);else if(e.revalidate=0,e.isStaticGeneration){let r=new u.DynamicServerError(`Route ${n} couldn't be rendered statically because it used ${t}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`);throw e.dynamicUsageDescription=t,e.dynamicUsageStack=r.stack,r}}}function f(e,t){let n=(0,a.getPathname)(e.urlPathname);if(e.isUnstableCacheCallback)throw Error(`Route ${n} used "${t}" inside a function cached with "unstable_cache(...)". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "${t}" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`);if(e.dynamicShouldError)throw new l.StaticGenBailoutError(`Route ${n} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);if(e.prerenderState)h(e.prerenderState,t,n);else if(e.revalidate=0,e.isStaticGeneration){let r=new u.DynamicServerError(`Route ${n} couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`);throw e.dynamicUsageDescription=t,e.dynamicUsageStack=r.stack,r}}function d({reason:e,prerenderState:t,pathname:n}){h(t,e,n)}function p(e,t){e.prerenderState&&h(e.prerenderState,t,e.urlPathname)}function h(e,t,n){v();let r=`Route ${n} needs to bail out of prerendering at this point because it used ${t}. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`;e.dynamicAccesses.push({stack:e.isDebugSkeleton?Error().stack:void 0,expression:t}),o.default.unstable_postpone(r)}function y(e){return e.dynamicAccesses.length>0}function _(e){return e.dynamicAccesses.filter(e=>"string"==typeof e.stack&&e.stack.length>0).map(({expression:e,stack:t})=>(t=t.split("\n").slice(4).filter(e=>!(e.includes("node_modules/next/")||e.includes(" ()")||e.includes(" (node:"))).join("\n"),`Dynamic API Usage Debug - ${e}: -${t}`))}function v(){if(!i)throw Error("Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js")}function b(e){v();let t=new AbortController;try{o.default.unstable_postpone(e)}catch(e){t.abort(e)}return t.signal}},87417:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getSegmentParam",{enumerable:!0,get:function(){return o}});let r=n(91182);function o(e){let t=r.INTERCEPTION_ROUTE_MARKERS.find(t=>e.startsWith(t));return(t&&(e=e.slice(t.length)),e.startsWith("[[...")&&e.endsWith("]]"))?{type:"optional-catchall",param:e.slice(5,-2)}:e.startsWith("[...")&&e.endsWith("]")?{type:t?"catchall-intercepted":"catchall",param:e.slice(4,-1)}:e.startsWith("[")&&e.endsWith("]")?{type:t?"dynamic-intercepted":"dynamic",param:e.slice(1,-1)}:null}},70647:function(e,t){"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HMR_ACTIONS_SENT_TO_BROWSER",{enumerable:!0,get:function(){return n}}),(r=n||(n={})).ADDED_PAGE="addedPage",r.REMOVED_PAGE="removedPage",r.RELOAD_PAGE="reloadPage",r.SERVER_COMPONENT_CHANGES="serverComponentChanges",r.MIDDLEWARE_CHANGES="middlewareChanges",r.CLIENT_CHANGES="clientChanges",r.SERVER_ONLY_CHANGES="serverOnlyChanges",r.SYNC="sync",r.BUILT="built",r.BUILDING="building",r.DEV_PAGES_MANIFEST_UPDATE="devPagesManifestUpdate",r.TURBOPACK_MESSAGE="turbopack-message",r.SERVER_ERROR="serverError",r.TURBOPACK_CONNECTED="turbopack-connected"},91182:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{INTERCEPTION_ROUTE_MARKERS:function(){return o},extractInterceptionRouteInformation:function(){return l},isInterceptionRouteAppPath:function(){return u}});let r=n(20926),o=["(..)(..)","(.)","(..)","(...)"];function u(e){return void 0!==e.split("/").find(e=>o.find(t=>e.startsWith(t)))}function l(e){let t,n,u;for(let r of e.split("/"))if(n=o.find(e=>r.startsWith(e))){[t,u]=e.split(n,2);break}if(!t||!n||!u)throw Error(`Invalid interception route: ${e}. Must be in the format //(..|...|..)(..)/`);switch(t=(0,r.normalizeAppPath)(t),n){case"(.)":u="/"===t?`/${u}`:t+"/"+u;break;case"(..)":if("/"===t)throw Error(`Invalid interception route: ${e}. Cannot use (..) marker at the root level, use (.) instead.`);u=t.split("/").slice(0,-1).concat(u).join("/");break;case"(...)":u="/"+u;break;case"(..)(..)":let l=t.split("/");if(l.length<=2)throw Error(`Invalid interception route: ${e}. Cannot use (..)(..) marker at the root level or one level up.`);u=l.slice(0,-2).concat(u).join("/");break;default:throw Error("Invariant: unexpected marker")}return{interceptingRoute:t,interceptedRoute:u}}},30650:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ReflectAdapter",{enumerable:!0,get:function(){return n}});class n{static get(e,t,n){let r=Reflect.get(e,t,n);return"function"==typeof r?r.bind(e):r}static set(e,t,n,r){return Reflect.set(e,t,n,r)}static has(e,t){return Reflect.has(e,t)}static deleteProperty(e,t){return Reflect.deleteProperty(e,t)}}},61956:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{AppRouterContext:function(){return o},GlobalLayoutRouterContext:function(){return l},LayoutRouterContext:function(){return u},MissingSlotContext:function(){return i},TemplateContext:function(){return a}});let r=n(47043)._(n(2265)),o=r.default.createContext(null),u=r.default.createContext(null),l=r.default.createContext(null),a=r.default.createContext(null),i=r.default.createContext(new Set)},37207:function(e,t){"use strict";function n(e){let t=5381;for(let n=0;n>>0}function r(e){return n(e).toString(36).slice(0,5)}Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{djb2Hash:function(){return n},hexHash:function(){return r}})},48701:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HeadManagerContext",{enumerable:!0,get:function(){return r}});let r=n(47043)._(n(2265)).default.createContext({})},79060:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{PathParamsContext:function(){return l},PathnameContext:function(){return u},SearchParamsContext:function(){return o}});let r=n(2265),o=(0,r.createContext)(null),u=(0,r.createContext)(null),l=(0,r.createContext)(null)},18993:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{BailoutToCSRError:function(){return r},isBailoutToCSRError:function(){return o}});let n="BAILOUT_TO_CLIENT_SIDE_RENDERING";class r extends Error{constructor(e){super("Bail out to client-side rendering: "+e),this.reason=e,this.digest=n}}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===n}},78162:function(e,t){"use strict";function n(e){return e.startsWith("/")?e:"/"+e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ensureLeadingSlash",{enumerable:!0,get:function(){return n}})},2103:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ActionQueueContext:function(){return a},createMutableActionQueue:function(){return s}});let r=n(53099),o=n(24673),u=n(91450),l=r._(n(2265)),a=l.default.createContext(null);function i(e,t){null!==e.pending&&(e.pending=e.pending.next,null!==e.pending?c({actionQueue:e,action:e.pending,setState:t}):e.needsRefresh&&(e.needsRefresh=!1,e.dispatch({type:o.ACTION_REFRESH,origin:window.location.origin},t)))}async function c(e){let{actionQueue:t,action:n,setState:r}=e,u=t.state;if(!u)throw Error("Invariant: Router state not initialized");t.pending=n;let l=n.payload,a=t.action(u,l);function c(e){n.discarded||(t.state=e,t.devToolsInstance&&t.devToolsInstance.send(l,e),i(t,r),n.resolve(e))}(0,o.isThenable)(a)?a.then(c,e=>{i(t,r),n.reject(e)}):c(a)}function s(){let e={state:null,dispatch:(t,n)=>(function(e,t,n){let r={resolve:n,reject:()=>{}};if(t.type!==o.ACTION_RESTORE){let e=new Promise((e,t)=>{r={resolve:e,reject:t}});(0,l.startTransition)(()=>{n(e)})}let u={payload:t,next:null,resolve:r.resolve,reject:r.reject};null===e.pending?(e.last=u,c({actionQueue:e,action:u,setState:n})):t.type===o.ACTION_NAVIGATE||t.type===o.ACTION_RESTORE?(e.pending.discarded=!0,e.last=u,e.pending.payload.type===o.ACTION_SERVER_ACTION&&(e.needsRefresh=!0),c({actionQueue:e,action:u,setState:n})):(null!==e.last&&(e.last.next=u),e.last=u)})(e,t,n),action:async(e,t)=>{if(null===e)throw Error("Invariant: Router state not initialized");return(0,u.reducer)(e,t)},pending:null,last:null};return e}},68498:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addPathPrefix",{enumerable:!0,get:function(){return o}});let r=n(63381);function o(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:n,query:o,hash:u}=(0,r.parsePath)(e);return""+t+n+o+u}},20926:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{normalizeAppPath:function(){return u},normalizeRscURL:function(){return l}});let r=n(78162),o=n(84541);function u(e){return(0,r.ensureLeadingSlash)(e.split("/").reduce((e,t,n,r)=>!t||(0,o.isGroupSegment)(t)||"@"===t[0]||("page"===t||"route"===t)&&n===r.length-1?e:e+"/"+t,""))}function l(e){return e.replace(/\.rsc($|\?)/,"$1")}},7092:function(e,t){"use strict";function n(e,t){if(void 0===t&&(t={}),t.onlyHashChange){e();return}let n=document.documentElement,r=n.style.scrollBehavior;n.style.scrollBehavior="auto",t.dontForceLayout||n.getClientRects(),e(),n.style.scrollBehavior=r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleSmoothScroll",{enumerable:!0,get:function(){return n}})},86146:function(e,t){"use strict";function n(e){return/Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isBot",{enumerable:!0,get:function(){return n}})},63381:function(e,t){"use strict";function n(e){let t=e.indexOf("#"),n=e.indexOf("?"),r=n>-1&&(t<0||n-1?{pathname:e.substring(0,r?n:t),query:r?e.substring(n,t>-1?t:void 0):"",hash:t>-1?e.slice(t):""}:{pathname:e,query:"",hash:""}}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"parsePath",{enumerable:!0,get:function(){return n}})},10580:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"pathHasPrefix",{enumerable:!0,get:function(){return o}});let r=n(63381);function o(e,t){if("string"!=typeof e)return!1;let{pathname:n}=(0,r.parsePath)(e);return n===t||n.startsWith(t+"/")}},26674:function(e,t){"use strict";function n(e){return e.replace(/\/$/,"")||"/"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeTrailingSlash",{enumerable:!0,get:function(){return n}})},84541:function(e,t){"use strict";function n(e){return"("===e[0]&&e.endsWith(")")}Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{DEFAULT_SEGMENT_KEY:function(){return o},PAGE_SEGMENT_KEY:function(){return r},isGroupSegment:function(){return n}});let r="__PAGE__",o="__DEFAULT__"},55501:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ServerInsertedHTMLContext:function(){return o},useServerInsertedHTML:function(){return u}});let r=n(53099)._(n(2265)),o=r.default.createContext(null);function u(e){let t=(0,r.useContext)(o);t&&t(e)}},31765:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"warnOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},47149:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"actionAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(54832).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},54832:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createAsyncLocalStorage",{enumerable:!0,get:function(){return u}});let n=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class r{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}}let o=globalThis.AsyncLocalStorage;function u(){return o?new o:new r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},25575:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"requestAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(54832).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},20030:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"staticGenerationAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(54832).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},34040:function(e,t,n){"use strict";var r=n(54887);t.createRoot=r.createRoot,t.hydrateRoot=r.hydrateRoot},54887:function(e,t,n){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(84417)},97950:function(e,t,n){"use strict";var r=n(54887),o={stream:!0},u=new Map;function l(e){var t=n(e);return"function"!=typeof t.then||"fulfilled"===t.status?null:(t.then(function(e){t.status="fulfilled",t.value=e},function(e){t.status="rejected",t.reason=e}),t)}function a(){}var i=new Map,c=n.u;n.u=function(e){var t=i.get(e);return void 0!==t?t:c(e)};var s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher,f=Symbol.for("react.element"),d=Symbol.for("react.lazy"),p=Symbol.iterator,h=Array.isArray,y=Object.getPrototypeOf,_=Object.prototype,v=new WeakMap;function b(e,t,n,r){this.status=e,this.value=t,this.reason=n,this._response=r}function g(e){switch(e.status){case"resolved_model":S(e);break;case"resolved_module":w(e)}switch(e.status){case"fulfilled":return e.value;case"pending":case"blocked":case"cyclic":throw e;default:throw e.reason}}function m(e,t){for(var n=0;nh?(_=h,h=3,p++):(_=0,h=3);continue;case 2:44===(m=d[p++])?h=4:v=v<<4|(96d.length&&(m=-1)}var O=d.byteOffset+p;if(-11&&t.some(Array.isArray)?t.flat(e-1):t},Array.prototype.flatMap=function(e,t){return this.map(e,t).flat()}),Promise.prototype.finally||(Promise.prototype.finally=function(e){if("function"!=typeof e)return this.then(e,e);var t=this.constructor||Promise;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})}),Object.fromEntries||(Object.fromEntries=function(e){return Array.from(e).reduce(function(e,t){return e[t[0]]=t[1],e},{})}),Array.prototype.at||(Array.prototype.at=function(e){var t=Math.trunc(e)||0;if(t<0&&(t+=this.length),!(t<0||t>=this.length))return this[t]}),Object.hasOwn||(Object.hasOwn=function(e,t){if(null==e)throw TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(e),t)}),"canParse"in URL||(URL.canParse=function(e,t){try{return new URL(e,t),!0}catch(e){return!1}})},1634:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addBasePath",{enumerable:!0,get:function(){return u}});let r=n(68498),o=n(33068);function u(e,t){return(0,o.normalizePathTrailingSlash)((0,r.addPathPrefix)(e,""))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},75266:function(e,t){"use strict";function n(e){var t,n;t=self.__next_s,n=()=>{e()},t&&t.length?t.reduce((e,t)=>{let[n,r]=t;return e.then(()=>new Promise((e,t)=>{let o=document.createElement("script");if(r)for(let e in r)"children"!==e&&o.setAttribute(e,r[e]);n?(o.src=n,o.onload=()=>e(),o.onerror=t):r&&(o.innerHTML=r.children,setTimeout(e)),document.head.appendChild(o)}))},Promise.resolve()).catch(e=>{console.error(e)}).then(()=>{n()}):n()}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"appBootstrap",{enumerable:!0,get:function(){return n}}),window.next={version:"14.2.35",appDir:!0},("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},83079:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"callServer",{enumerable:!0,get:function(){return o}});let r=n(12846);async function o(e,t){let n=(0,r.getServerActionDispatcher)();if(!n)throw Error("Invariant: missing action dispatcher.");return new Promise((r,o)=>{n({actionId:e,actionArgs:t,resolve:r,reject:o})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},92304:function(e,t,n){"use strict";let r,o;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hydrate",{enumerable:!0,get:function(){return x}});let u=n(47043),l=n(53099),a=n(57437);n(91572);let i=u._(n(34040)),c=l._(n(2265)),s=n(6671),f=n(48701),d=u._(n(61404)),p=n(83079),h=n(89721),y=n(2103);n(70647);let _=window.console.error;window.console.error=function(){for(var e=arguments.length,t=Array(e),n=0;n{if((0,h.isNextRouterError)(e.error)){e.preventDefault();return}});let v=document,b=new TextEncoder,g=!1,m=!1,R=null;function P(e){if(0===e[0])r=[];else if(1===e[0]){if(!r)throw Error("Unexpected server data: missing bootstrap script.");o?o.enqueue(b.encode(e[1])):r.push(e[1])}else 2===e[0]&&(R=e[1])}let j=function(){o&&!m&&(o.close(),m=!0,r=void 0),g=!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",j,!1):j();let O=self.__next_f=self.__next_f||[];O.forEach(P),O.push=P;let E=new ReadableStream({start(e){r&&(r.forEach(t=>{e.enqueue(b.encode(t))}),g&&!m&&(e.close(),m=!0,r=void 0)),o=e}}),S=(0,s.createFromReadableStream)(E,{callServer:p.callServer});function w(){return(0,c.use)(S)}let M=c.default.StrictMode;function T(e){let{children:t}=e;return t}function x(){let e=(0,y.createMutableActionQueue)(),t=(0,a.jsx)(M,{children:(0,a.jsx)(f.HeadManagerContext.Provider,{value:{appDir:!0},children:(0,a.jsx)(y.ActionQueueContext.Provider,{value:e,children:(0,a.jsx)(T,{children:(0,a.jsx)(w,{})})})})}),n=window.__next_root_layout_missing_tags,r=!!(null==n?void 0:n.length),o={onRecoverableError:d.default};"__next_error__"===document.documentElement.id||r?i.default.createRoot(v,o).render(t):c.default.startTransition(()=>i.default.hydrateRoot(v,t,{...o,formState:R}))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},54278:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(19506),(0,n(75266).appBootstrap)(()=>{let{hydrate:e}=n(92304);n(12846),n(4707),e()}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},19506:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(65157);{let e=n.u;n.u=function(){for(var t=arguments.length,n=Array(t),r=0;r(l(function(){var e;let t=document.getElementsByName(u)[0];if(null==t?void 0:null==(e=t.shadowRoot)?void 0:e.childNodes[0])return t.shadowRoot.childNodes[0];{let e=document.createElement(u);e.style.cssText="position:absolute";let t=document.createElement("div");return t.ariaLive="assertive",t.id="__next-route-announcer__",t.role="alert",t.style.cssText="position:absolute;border:0;height:1px;margin:-1px;padding:0;width:1px;clip:rect(0 0 0 0);overflow:hidden;white-space:nowrap;word-wrap:normal",e.attachShadow({mode:"open"}).appendChild(t),document.body.appendChild(e),t}}()),()=>{let e=document.getElementsByTagName(u)[0];(null==e?void 0:e.isConnected)&&document.body.removeChild(e)}),[]);let[a,i]=(0,r.useState)(""),c=(0,r.useRef)();return(0,r.useEffect)(()=>{let e="";if(document.title)e=document.title;else{let t=document.querySelector("h1");t&&(e=t.innerText||t.textContent||"")}void 0!==c.current&&c.current!==e&&i(e),c.current=e},[t]),n?(0,o.createPortal)(a,n):null}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6866:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ACTION:function(){return r},FLIGHT_PARAMETERS:function(){return i},NEXT_DID_POSTPONE_HEADER:function(){return s},NEXT_ROUTER_PREFETCH_HEADER:function(){return u},NEXT_ROUTER_STATE_TREE:function(){return o},NEXT_RSC_UNION_QUERY:function(){return c},NEXT_URL:function(){return l},RSC_CONTENT_TYPE_HEADER:function(){return a},RSC_HEADER:function(){return n}});let n="RSC",r="Next-Action",o="Next-Router-State-Tree",u="Next-Router-Prefetch",l="Next-Url",a="text/x-component",i=[[n],[o],[u]],c="_rsc",s="x-nextjs-postponed";("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},12846:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createEmptyCacheNode:function(){return C},default:function(){return I},getServerActionDispatcher:function(){return S},urlToUrlWithoutFlightMarker:function(){return M}});let r=n(53099),o=n(57437),u=r._(n(2265)),l=n(61956),a=n(24673),i=n(33456),c=n(79060),s=n(47744),f=n(61060),d=n(82952),p=n(86146),h=n(1634),y=n(6495),_=n(4123),v=n(39320),b=n(38137),g=n(6866),m=n(35076),R=n(11283),P=n(84541),j="undefined"==typeof window,O=j?null:new Map,E=null;function S(){return E}let w={};function M(e){let t=new URL(e,location.origin);if(t.searchParams.delete(g.NEXT_RSC_UNION_QUERY),t.pathname.endsWith(".txt")){let{pathname:e}=t,n=e.endsWith("/index.txt")?10:4;t.pathname=e.slice(0,-n)}return t}function T(e){return e.origin!==window.location.origin}function x(e){let{appRouterState:t,sync:n}=e;return(0,u.useInsertionEffect)(()=>{let{tree:e,pushRef:r,canonicalUrl:o}=t,u={...r.preserveCustomHistoryState?window.history.state:{},__NA:!0,__PRIVATE_NEXTJS_INTERNALS_TREE:e};r.pendingPush&&(0,i.createHrefFromUrl)(new URL(window.location.href))!==o?(r.pendingPush=!1,window.history.pushState(u,"",o)):window.history.replaceState(u,"",o),n(t)},[t,n]),null}function C(){return{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null}}function A(e){null==e&&(e={});let t=window.history.state,n=null==t?void 0:t.__NA;n&&(e.__NA=n);let r=null==t?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE;return r&&(e.__PRIVATE_NEXTJS_INTERNALS_TREE=r),e}function N(e){let{headCacheNode:t}=e,n=null!==t?t.head:null,r=null!==t?t.prefetchHead:null,o=null!==r?r:n;return(0,u.useDeferredValue)(n,o)}function D(e){let t,{buildId:n,initialHead:r,initialTree:i,urlParts:f,initialSeedData:g,couldBeIntercepted:S,assetPrefix:M,missingSlots:C}=e,D=(0,u.useMemo)(()=>(0,d.createInitialRouterState)({buildId:n,initialSeedData:g,urlParts:f,initialTree:i,initialParallelRoutes:O,location:j?null:window.location,initialHead:r,couldBeIntercepted:S}),[n,g,f,i,r,S]),[I,U,k]=(0,s.useReducerWithReduxDevtools)(D);(0,u.useEffect)(()=>{O=null},[]);let{canonicalUrl:F}=(0,s.useUnwrapState)(I),{searchParams:L,pathname:H}=(0,u.useMemo)(()=>{let e=new URL(F,"undefined"==typeof window?"http://n":window.location.href);return{searchParams:e.searchParams,pathname:(0,R.hasBasePath)(e.pathname)?(0,m.removeBasePath)(e.pathname):e.pathname}},[F]),G=(0,u.useCallback)(e=>{let{previousTree:t,serverResponse:n}=e;(0,u.startTransition)(()=>{U({type:a.ACTION_SERVER_PATCH,previousTree:t,serverResponse:n})})},[U]),$=(0,u.useCallback)((e,t,n)=>{let r=new URL((0,h.addBasePath)(e),location.href);return U({type:a.ACTION_NAVIGATE,url:r,isExternalUrl:T(r),locationSearch:location.search,shouldScroll:null==n||n,navigateType:t})},[U]);E=(0,u.useCallback)(e=>{(0,u.startTransition)(()=>{U({...e,type:a.ACTION_SERVER_ACTION})})},[U]);let z=(0,u.useMemo)(()=>({back:()=>window.history.back(),forward:()=>window.history.forward(),prefetch:(e,t)=>{let n;if(!(0,p.isBot)(window.navigator.userAgent)){try{n=new URL((0,h.addBasePath)(e),window.location.href)}catch(t){throw Error("Cannot prefetch '"+e+"' because it cannot be converted to a URL.")}T(n)||(0,u.startTransition)(()=>{var e;U({type:a.ACTION_PREFETCH,url:n,kind:null!=(e=null==t?void 0:t.kind)?e:a.PrefetchKind.FULL})})}},replace:(e,t)=>{void 0===t&&(t={}),(0,u.startTransition)(()=>{var n;$(e,"replace",null==(n=t.scroll)||n)})},push:(e,t)=>{void 0===t&&(t={}),(0,u.startTransition)(()=>{var n;$(e,"push",null==(n=t.scroll)||n)})},refresh:()=>{(0,u.startTransition)(()=>{U({type:a.ACTION_REFRESH,origin:window.location.origin})})},fastRefresh:()=>{throw Error("fastRefresh can only be used in development mode. Please use refresh instead.")}}),[U,$]);(0,u.useEffect)(()=>{window.next&&(window.next.router=z)},[z]),(0,u.useEffect)(()=>{function e(e){var t;e.persisted&&(null==(t=window.history.state)?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE)&&(w.pendingMpaPath=void 0,U({type:a.ACTION_RESTORE,url:new URL(window.location.href),tree:window.history.state.__PRIVATE_NEXTJS_INTERNALS_TREE}))}return window.addEventListener("pageshow",e),()=>{window.removeEventListener("pageshow",e)}},[U]);let{pushRef:B}=(0,s.useUnwrapState)(I);if(B.mpaNavigation){if(w.pendingMpaPath!==F){let e=window.location;B.pendingPush?e.assign(F):e.replace(F),w.pendingMpaPath=F}(0,u.use)(b.unresolvedThenable)}(0,u.useEffect)(()=>{let e=window.history.pushState.bind(window.history),t=window.history.replaceState.bind(window.history),n=e=>{var t;let n=window.location.href,r=null==(t=window.history.state)?void 0:t.__PRIVATE_NEXTJS_INTERNALS_TREE;(0,u.startTransition)(()=>{U({type:a.ACTION_RESTORE,url:new URL(null!=e?e:n,n),tree:r})})};window.history.pushState=function(t,r,o){return(null==t?void 0:t.__NA)||(null==t?void 0:t._N)||(t=A(t),o&&n(o)),e(t,r,o)},window.history.replaceState=function(e,r,o){return(null==e?void 0:e.__NA)||(null==e?void 0:e._N)||(e=A(e),o&&n(o)),t(e,r,o)};let r=e=>{let{state:t}=e;if(t){if(!t.__NA){window.location.reload();return}(0,u.startTransition)(()=>{U({type:a.ACTION_RESTORE,url:new URL(window.location.href),tree:t.__PRIVATE_NEXTJS_INTERNALS_TREE})})}};return window.addEventListener("popstate",r),()=>{window.history.pushState=e,window.history.replaceState=t,window.removeEventListener("popstate",r)}},[U]);let{cache:W,tree:K,nextUrl:V,focusAndScrollRef:Y}=(0,s.useUnwrapState)(I),X=(0,u.useMemo)(()=>(0,v.findHeadInCache)(W,K[1]),[W,K]),q=(0,u.useMemo)(()=>(function e(t,n){for(let r of(void 0===n&&(n={}),Object.values(t[1]))){let t=r[0],o=Array.isArray(t),u=o?t[1]:t;!u||u.startsWith(P.PAGE_SEGMENT_KEY)||(o&&("c"===t[2]||"oc"===t[2])?n[t[0]]=t[1].split("/"):o&&(n[t[0]]=t[1]),n=e(r,n))}return n})(K),[K]);if(null!==X){let[e,n]=X;t=(0,o.jsx)(N,{headCacheNode:e},n)}else t=null;let J=(0,o.jsxs)(_.RedirectBoundary,{children:[t,W.rsc,(0,o.jsx)(y.AppRouterAnnouncer,{tree:K})]});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(x,{appRouterState:(0,s.useUnwrapState)(I),sync:k}),(0,o.jsx)(c.PathParamsContext.Provider,{value:q,children:(0,o.jsx)(c.PathnameContext.Provider,{value:H,children:(0,o.jsx)(c.SearchParamsContext.Provider,{value:L,children:(0,o.jsx)(l.GlobalLayoutRouterContext.Provider,{value:{buildId:n,changeByServerResponse:G,tree:K,focusAndScrollRef:Y,nextUrl:V},children:(0,o.jsx)(l.AppRouterContext.Provider,{value:z,children:(0,o.jsx)(l.LayoutRouterContext.Provider,{value:{childNodes:W.parallelRoutes,tree:K,url:F,loading:W.loading},children:J})})})})})})]})}function I(e){let{globalErrorComponent:t,...n}=e;return(0,o.jsx)(f.ErrorBoundary,{errorComponent:t,children:(0,o.jsx)(D,{...n})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},96149:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"bailoutToClientRendering",{enumerable:!0,get:function(){return u}});let r=n(18993),o=n(51845);function u(e){let t=o.staticGenerationAsyncStorage.getStore();if((null==t||!t.forceStatic)&&(null==t?void 0:t.isStaticGeneration))throw new r.BailoutToCSRError(e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},19107:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ClientPageRoot",{enumerable:!0,get:function(){return u}});let r=n(57437),o=n(54535);function u(e){let{Component:t,props:n}=e;return n.searchParams=(0,o.createDynamicallyTrackedSearchParams)(n.searchParams||{}),(0,r.jsx)(t,{...n})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},61060:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ErrorBoundary:function(){return h},ErrorBoundaryHandler:function(){return f},GlobalError:function(){return d},default:function(){return p}});let r=n(47043),o=n(57437),u=r._(n(2265)),l=n(35475),a=n(89721),i=n(51845),c={error:{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"},text:{fontSize:"14px",fontWeight:400,lineHeight:"28px",margin:"0 8px"}};function s(e){let{error:t}=e,n=i.staticGenerationAsyncStorage.getStore();if((null==n?void 0:n.isRevalidate)||(null==n?void 0:n.isStaticGeneration))throw console.error(t),t;return null}class f extends u.default.Component{static getDerivedStateFromError(e){if((0,a.isNextRouterError)(e))throw e;return{error:e}}static getDerivedStateFromProps(e,t){return e.pathname!==t.previousPathname&&t.error?{error:null,previousPathname:e.pathname}:{error:t.error,previousPathname:e.pathname}}render(){return this.state.error?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s,{error:this.state.error}),this.props.errorStyles,this.props.errorScripts,(0,o.jsx)(this.props.errorComponent,{error:this.state.error,reset:this.reset})]}):this.props.children}constructor(e){super(e),this.reset=()=>{this.setState({error:null})},this.state={error:null,previousPathname:this.props.pathname}}}function d(e){let{error:t}=e,n=null==t?void 0:t.digest;return(0,o.jsxs)("html",{id:"__next_error__",children:[(0,o.jsx)("head",{}),(0,o.jsxs)("body",{children:[(0,o.jsx)(s,{error:t}),(0,o.jsx)("div",{style:c.error,children:(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{style:c.text,children:"Application error: a "+(n?"server":"client")+"-side exception has occurred (see the "+(n?"server logs":"browser console")+" for more information)."}),n?(0,o.jsx)("p",{style:c.text,children:"Digest: "+n}):null]})})]})]})}let p=d;function h(e){let{errorComponent:t,errorStyles:n,errorScripts:r,children:u}=e,a=(0,l.usePathname)();return t?(0,o.jsx)(f,{pathname:a,errorComponent:t,errorStyles:n,errorScripts:r,children:u}):(0,o.jsx)(o.Fragment,{children:u})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},46177:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{DynamicServerError:function(){return r},isDynamicServerError:function(){return o}});let n="DYNAMIC_SERVER_USAGE";class r extends Error{constructor(e){super("Dynamic server usage: "+e),this.description=e,this.digest=n}}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&"string"==typeof e.digest&&e.digest===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},89721:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isNextRouterError",{enumerable:!0,get:function(){return u}});let r=n(98200),o=n(88968);function u(e){return e&&e.digest&&((0,o.isRedirectError)(e)||(0,r.isNotFoundError)(e))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4707:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return E}});let r=n(47043),o=n(53099),u=n(57437),l=o._(n(2265)),a=r._(n(54887)),i=n(61956),c=n(44848),s=n(38137),f=n(61060),d=n(76015),p=n(7092),h=n(4123),y=n(80),_=n(73171),v=n(78505),b=n(28077),g=["bottom","height","left","right","top","width","x","y"];function m(e,t){let n=e.getBoundingClientRect();return n.top>=0&&n.top<=t}class R extends l.default.Component{componentDidMount(){this.handlePotentialScroll()}componentDidUpdate(){this.props.focusAndScrollRef.apply&&this.handlePotentialScroll()}render(){return this.props.children}constructor(...e){super(...e),this.handlePotentialScroll=()=>{let{focusAndScrollRef:e,segmentPath:t}=this.props;if(e.apply){var n;if(0!==e.segmentPaths.length&&!e.segmentPaths.some(e=>t.every((t,n)=>(0,d.matchSegment)(t,e[n]))))return;let r=null,o=e.hashFragment;if(o&&(r="top"===o?document.body:null!=(n=document.getElementById(o))?n:document.getElementsByName(o)[0]),r||(r="undefined"==typeof window?null:a.default.findDOMNode(this)),!(r instanceof Element))return;for(;!(r instanceof HTMLElement)||function(e){if(["sticky","fixed"].includes(getComputedStyle(e).position))return!0;let t=e.getBoundingClientRect();return g.every(e=>0===t[e])}(r);){if(null===r.nextElementSibling)return;r=r.nextElementSibling}e.apply=!1,e.hashFragment=null,e.segmentPaths=[],(0,p.handleSmoothScroll)(()=>{if(o){r.scrollIntoView();return}let e=document.documentElement,t=e.clientHeight;!m(r,t)&&(e.scrollTop=0,m(r,t)||r.scrollIntoView())},{dontForceLayout:!0,onlyHashChange:e.onlyHashChange}),e.onlyHashChange=!1,r.focus()}}}}function P(e){let{segmentPath:t,children:n}=e,r=(0,l.useContext)(i.GlobalLayoutRouterContext);if(!r)throw Error("invariant global layout router not mounted");return(0,u.jsx)(R,{segmentPath:t,focusAndScrollRef:r.focusAndScrollRef,children:n})}function j(e){let{parallelRouterKey:t,url:n,childNodes:r,segmentPath:o,tree:a,cacheKey:f}=e,p=(0,l.useContext)(i.GlobalLayoutRouterContext);if(!p)throw Error("invariant global layout router not mounted");let{buildId:h,changeByServerResponse:y,tree:_}=p,v=r.get(f);if(void 0===v){let e={lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null};v=e,r.set(f,e)}let g=null!==v.prefetchRsc?v.prefetchRsc:v.rsc,m=(0,l.useDeferredValue)(v.rsc,g),R="object"==typeof m&&null!==m&&"function"==typeof m.then?(0,l.use)(m):m;if(!R){let e=v.lazyData;if(null===e){let t=function e(t,n){if(t){let[r,o]=t,u=2===t.length;if((0,d.matchSegment)(n[0],r)&&n[1].hasOwnProperty(o)){if(u){let t=e(void 0,n[1][o]);return[n[0],{...n[1],[o]:[t[0],t[1],t[2],"refetch"]}]}return[n[0],{...n[1],[o]:e(t.slice(2),n[1][o])}]}}return n}(["",...o],_),r=(0,b.hasInterceptionRouteInCurrentTree)(_);v.lazyData=e=(0,c.fetchServerResponse)(new URL(n,location.origin),t,r?p.nextUrl:null,h),v.lazyDataResolved=!1}let t=(0,l.use)(e);v.lazyDataResolved||(setTimeout(()=>{(0,l.startTransition)(()=>{y({previousTree:_,serverResponse:t})})}),v.lazyDataResolved=!0),(0,l.use)(s.unresolvedThenable)}return(0,u.jsx)(i.LayoutRouterContext.Provider,{value:{tree:a[1][t],childNodes:v.parallelRoutes,url:n,loading:v.loading},children:R})}function O(e){let{children:t,hasLoading:n,loading:r,loadingStyles:o,loadingScripts:a}=e;return n?(0,u.jsx)(l.Suspense,{fallback:(0,u.jsxs)(u.Fragment,{children:[o,a,r]}),children:t}):(0,u.jsx)(u.Fragment,{children:t})}function E(e){let{parallelRouterKey:t,segmentPath:n,error:r,errorStyles:o,errorScripts:a,templateStyles:c,templateScripts:s,template:d,notFound:p,notFoundStyles:b}=e,g=(0,l.useContext)(i.LayoutRouterContext);if(!g)throw Error("invariant expected layout router to be mounted");let{childNodes:m,tree:R,url:E,loading:S}=g,w=m.get(t);w||(w=new Map,m.set(t,w));let M=R[1][t][0],T=(0,_.getSegmentValue)(M),x=[M];return(0,u.jsx)(u.Fragment,{children:x.map(e=>{let l=(0,_.getSegmentValue)(e),g=(0,v.createRouterCacheKey)(e);return(0,u.jsxs)(i.TemplateContext.Provider,{value:(0,u.jsx)(P,{segmentPath:n,children:(0,u.jsx)(f.ErrorBoundary,{errorComponent:r,errorStyles:o,errorScripts:a,children:(0,u.jsx)(O,{hasLoading:!!S,loading:null==S?void 0:S[0],loadingStyles:null==S?void 0:S[1],loadingScripts:null==S?void 0:S[2],children:(0,u.jsx)(y.NotFoundBoundary,{notFound:p,notFoundStyles:b,children:(0,u.jsx)(h.RedirectBoundary,{children:(0,u.jsx)(j,{parallelRouterKey:t,url:E,tree:R,childNodes:w,segmentPath:n,cacheKey:g,isActive:T===l})})})})})}),children:[c,s,d]},(0,v.createRouterCacheKey)(e,!0))})})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},76015:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{canSegmentBeOverridden:function(){return u},matchSegment:function(){return o}});let r=n(87417),o=(e,t)=>"string"==typeof e?"string"==typeof t&&e===t:"string"!=typeof t&&e[0]===t[0]&&e[1]===t[1],u=(e,t)=>{var n;return!Array.isArray(e)&&!!Array.isArray(t)&&(null==(n=(0,r.getSegmentParam)(e))?void 0:n.param)===t[0]};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},35475:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ReadonlyURLSearchParams:function(){return i.ReadonlyURLSearchParams},RedirectType:function(){return i.RedirectType},ServerInsertedHTMLContext:function(){return c.ServerInsertedHTMLContext},notFound:function(){return i.notFound},permanentRedirect:function(){return i.permanentRedirect},redirect:function(){return i.redirect},useParams:function(){return p},usePathname:function(){return f},useRouter:function(){return d},useSearchParams:function(){return s},useSelectedLayoutSegment:function(){return y},useSelectedLayoutSegments:function(){return h},useServerInsertedHTML:function(){return c.useServerInsertedHTML}});let r=n(2265),o=n(61956),u=n(79060),l=n(73171),a=n(84541),i=n(52646),c=n(55501);function s(){let e=(0,r.useContext)(u.SearchParamsContext),t=(0,r.useMemo)(()=>e?new i.ReadonlyURLSearchParams(e):null,[e]);if("undefined"==typeof window){let{bailoutToClientRendering:e}=n(96149);e("useSearchParams()")}return t}function f(){return(0,r.useContext)(u.PathnameContext)}function d(){let e=(0,r.useContext)(o.AppRouterContext);if(null===e)throw Error("invariant expected app router to be mounted");return e}function p(){return(0,r.useContext)(u.PathParamsContext)}function h(e){void 0===e&&(e="children");let t=(0,r.useContext)(o.LayoutRouterContext);return t?function e(t,n,r,o){let u;if(void 0===r&&(r=!0),void 0===o&&(o=[]),r)u=t[1][n];else{var i;let e=t[1];u=null!=(i=e.children)?i:Object.values(e)[0]}if(!u)return o;let c=u[0],s=(0,l.getSegmentValue)(c);return!s||s.startsWith(a.PAGE_SEGMENT_KEY)?o:(o.push(s),e(u,n,!1,o))}(t.tree,e):null}function y(e){void 0===e&&(e="children");let t=h(e);if(!t||0===t.length)return null;let n="children"===e?t[0]:t[t.length-1];return n===a.DEFAULT_SEGMENT_KEY?null:n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},52646:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ReadonlyURLSearchParams:function(){return l},RedirectType:function(){return r.RedirectType},notFound:function(){return o.notFound},permanentRedirect:function(){return r.permanentRedirect},redirect:function(){return r.redirect}});let r=n(88968),o=n(98200);class u extends Error{constructor(){super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams")}}class l extends URLSearchParams{append(){throw new u}delete(){throw new u}set(){throw new u}sort(){throw new u}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},80:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"NotFoundBoundary",{enumerable:!0,get:function(){return s}});let r=n(53099),o=n(57437),u=r._(n(2265)),l=n(35475),a=n(98200);n(31765);let i=n(61956);class c extends u.default.Component{componentDidCatch(){}static getDerivedStateFromError(e){if((0,a.isNotFoundError)(e))return{notFoundTriggered:!0};throw e}static getDerivedStateFromProps(e,t){return e.pathname!==t.previousPathname&&t.notFoundTriggered?{notFoundTriggered:!1,previousPathname:e.pathname}:{notFoundTriggered:t.notFoundTriggered,previousPathname:e.pathname}}render(){return this.state.notFoundTriggered?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("meta",{name:"robots",content:"noindex"}),!1,this.props.notFoundStyles,this.props.notFound]}):this.props.children}constructor(e){super(e),this.state={notFoundTriggered:!!e.asNotFound,previousPathname:e.pathname}}}function s(e){let{notFound:t,notFoundStyles:n,asNotFound:r,children:a}=e,s=(0,l.usePathname)(),f=(0,u.useContext)(i.MissingSlotContext);return t?(0,o.jsx)(c,{pathname:s,notFound:t,notFoundStyles:n,asNotFound:r,missingSlots:f,children:a}):(0,o.jsx)(o.Fragment,{children:a})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},98200:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{isNotFoundError:function(){return o},notFound:function(){return r}});let n="NEXT_NOT_FOUND";function r(){let e=Error(n);throw e.digest=n,e}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},29744:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PromiseQueue",{enumerable:!0,get:function(){return c}});let r=n(2522),o=n(90675);var u=o._("_maxConcurrency"),l=o._("_runningCount"),a=o._("_queue"),i=o._("_processNext");class c{enqueue(e){let t,n;let o=new Promise((e,r)=>{t=e,n=r}),u=async()=>{try{r._(this,l)[l]++;let n=await e();t(n)}catch(e){n(e)}finally{r._(this,l)[l]--,r._(this,i)[i]()}};return r._(this,a)[a].push({promiseFn:o,task:u}),r._(this,i)[i](),o}bump(e){let t=r._(this,a)[a].findIndex(t=>t.promiseFn===e);if(t>-1){let e=r._(this,a)[a].splice(t,1)[0];r._(this,a)[a].unshift(e),r._(this,i)[i](!0)}}constructor(e=5){Object.defineProperty(this,i,{value:s}),Object.defineProperty(this,u,{writable:!0,value:void 0}),Object.defineProperty(this,l,{writable:!0,value:void 0}),Object.defineProperty(this,a,{writable:!0,value:void 0}),r._(this,u)[u]=e,r._(this,l)[l]=0,r._(this,a)[a]=[]}}function s(e){if(void 0===e&&(e=!1),(r._(this,l)[l]0){var t;null==(t=r._(this,a)[a].shift())||t.task()}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4123:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{RedirectBoundary:function(){return s},RedirectErrorBoundary:function(){return c}});let r=n(53099),o=n(57437),u=r._(n(2265)),l=n(35475),a=n(88968);function i(e){let{redirect:t,reset:n,redirectType:r}=e,o=(0,l.useRouter)();return(0,u.useEffect)(()=>{u.default.startTransition(()=>{r===a.RedirectType.push?o.push(t,{}):o.replace(t,{}),n()})},[t,r,n,o]),null}class c extends u.default.Component{static getDerivedStateFromError(e){if((0,a.isRedirectError)(e))return{redirect:(0,a.getURLFromRedirectError)(e),redirectType:(0,a.getRedirectTypeFromError)(e)};throw e}render(){let{redirect:e,redirectType:t}=this.state;return null!==e&&null!==t?(0,o.jsx)(i,{redirect:e,redirectType:t,reset:()=>this.setState({redirect:null})}):this.props.children}constructor(e){super(e),this.state={redirect:null,redirectType:null}}}function s(e){let{children:t}=e,n=(0,l.useRouter)();return(0,o.jsx)(c,{router:n,children:t})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5001:function(e,t){"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RedirectStatusCode",{enumerable:!0,get:function(){return n}}),(r=n||(n={}))[r.SeeOther=303]="SeeOther",r[r.TemporaryRedirect=307]="TemporaryRedirect",r[r.PermanentRedirect=308]="PermanentRedirect",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},88968:function(e,t,n){"use strict";var r,o;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{RedirectType:function(){return r},getRedirectError:function(){return c},getRedirectStatusCodeFromError:function(){return y},getRedirectTypeFromError:function(){return h},getURLFromRedirectError:function(){return p},isRedirectError:function(){return d},permanentRedirect:function(){return f},redirect:function(){return s}});let u=n(20544),l=n(90295),a=n(5001),i="NEXT_REDIRECT";function c(e,t,n){void 0===n&&(n=a.RedirectStatusCode.TemporaryRedirect);let r=Error(i);r.digest=i+";"+t+";"+e+";"+n+";";let o=u.requestAsyncStorage.getStore();return o&&(r.mutableCookies=o.mutableCookies),r}function s(e,t){void 0===t&&(t="replace");let n=l.actionAsyncStorage.getStore();throw c(e,t,(null==n?void 0:n.isAction)?a.RedirectStatusCode.SeeOther:a.RedirectStatusCode.TemporaryRedirect)}function f(e,t){void 0===t&&(t="replace");let n=l.actionAsyncStorage.getStore();throw c(e,t,(null==n?void 0:n.isAction)?a.RedirectStatusCode.SeeOther:a.RedirectStatusCode.PermanentRedirect)}function d(e){if("object"!=typeof e||null===e||!("digest"in e)||"string"!=typeof e.digest)return!1;let[t,n,r,o]=e.digest.split(";",4),u=Number(o);return t===i&&("replace"===n||"push"===n)&&"string"==typeof r&&!isNaN(u)&&u in a.RedirectStatusCode}function p(e){return d(e)?e.digest.split(";",3)[2]:null}function h(e){if(!d(e))throw Error("Not a redirect error");return e.digest.split(";",2)[1]}function y(e){if(!d(e))throw Error("Not a redirect error");return Number(e.digest.split(";",4)[3])}(o=r||(r={})).push="push",o.replace="replace",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},36423:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return a}});let r=n(53099),o=n(57437),u=r._(n(2265)),l=n(61956);function a(){let e=(0,u.useContext)(l.TemplateContext);return(0,o.jsx)(o.Fragment,{children:e})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},20544:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{getExpectedRequestStore:function(){return o},requestAsyncStorage:function(){return r.requestAsyncStorage}});let r=n(25575);function o(e){let t=r.requestAsyncStorage.getStore();if(t)return t;throw Error("`"+e+"` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},22356:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"applyFlightData",{enumerable:!0,get:function(){return u}});let r=n(27420),o=n(92576);function u(e,t,n,u){let[l,a,i]=n.slice(-3);if(null===a)return!1;if(3===n.length){let n=a[2],o=a[3];t.loading=o,t.rsc=n,t.prefetchRsc=null,(0,r.fillLazyItemsTillLeafWithHead)(t,e,l,a,i,u)}else t.rsc=e.rsc,t.prefetchRsc=e.prefetchRsc,t.parallelRoutes=new Map(e.parallelRoutes),t.loading=e.loading,(0,o.fillCacheWithNewSubTreeData)(t,e,n,u);return!0}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},81935:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"applyRouterStatePatchToTree",{enumerable:!0,get:function(){return function e(t,n,r,a){let i;let[c,s,f,d,p]=n;if(1===t.length){let e=l(n,r,t);return(0,u.addRefreshMarkerToActiveParallelSegments)(e,a),e}let[h,y]=t;if(!(0,o.matchSegment)(h,c))return null;if(2===t.length)i=l(s[y],r,t);else if(null===(i=e(t.slice(2),s[y],r,a)))return null;let _=[t[0],{...s,[y]:i},f,d];return p&&(_[4]=!0),(0,u.addRefreshMarkerToActiveParallelSegments)(_,a),_}}});let r=n(84541),o=n(76015),u=n(50232);function l(e,t,n){let[u,a]=e,[i,c]=t;if(i===r.DEFAULT_SEGMENT_KEY&&u!==r.DEFAULT_SEGMENT_KEY)return e;if((0,o.matchSegment)(u,i)){let t={};for(let e in a)void 0!==c[e]?t[e]=l(a[e],c[e],n):t[e]=a[e];for(let e in c)t[e]||(t[e]=c[e]);let r=[u,t];return e[2]&&(r[2]=e[2]),e[3]&&(r[3]=e[3]),e[4]&&(r[4]=e[4]),r}return t}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},65556:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"clearCacheNodeDataForSegmentPath",{enumerable:!0,get:function(){return function e(t,n,o){let u=o.length<=2,[l,a]=o,i=(0,r.createRouterCacheKey)(a),c=n.parallelRoutes.get(l),s=t.parallelRoutes.get(l);s&&s!==c||(s=new Map(c),t.parallelRoutes.set(l,s));let f=null==c?void 0:c.get(i),d=s.get(i);if(u){d&&d.lazyData&&d!==f||s.set(i,{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null});return}if(!d||!f){d||s.set(i,{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null});return}return d===f&&(d={lazyData:d.lazyData,rsc:d.rsc,prefetchRsc:d.prefetchRsc,head:d.head,prefetchHead:d.prefetchHead,parallelRoutes:new Map(d.parallelRoutes),lazyDataResolved:d.lazyDataResolved,loading:d.loading},s.set(i,d)),e(d,f,o.slice(2))}}});let r=n(78505);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},5410:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{computeChangedPath:function(){return s},extractPathFromFlightRouterState:function(){return c}});let r=n(91182),o=n(84541),u=n(76015),l=e=>"/"===e[0]?e.slice(1):e,a=e=>"string"==typeof e?"children"===e?"":e:e[1];function i(e){return e.reduce((e,t)=>""===(t=l(t))||(0,o.isGroupSegment)(t)?e:e+"/"+t,"")||"/"}function c(e){var t;let n=Array.isArray(e[0])?e[0][1]:e[0];if(n===o.DEFAULT_SEGMENT_KEY||r.INTERCEPTION_ROUTE_MARKERS.some(e=>n.startsWith(e)))return;if(n.startsWith(o.PAGE_SEGMENT_KEY))return"";let u=[a(n)],l=null!=(t=e[1])?t:{},s=l.children?c(l.children):void 0;if(void 0!==s)u.push(s);else for(let[e,t]of Object.entries(l)){if("children"===e)continue;let n=c(t);void 0!==n&&u.push(n)}return i(u)}function s(e,t){let n=function e(t,n){let[o,l]=t,[i,s]=n,f=a(o),d=a(i);if(r.INTERCEPTION_ROUTE_MARKERS.some(e=>f.startsWith(e)||d.startsWith(e)))return"";if(!(0,u.matchSegment)(o,i)){var p;return null!=(p=c(n))?p:""}for(let t in l)if(s[t]){let n=e(l[t],s[t]);if(null!==n)return a(i)+"/"+n}return null}(e,t);return null==n||"/"===n?n:i(n.split("/"))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},33456:function(e,t){"use strict";function n(e,t){return void 0===t&&(t=!0),e.pathname+e.search+(t?e.hash:"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createHrefFromUrl",{enumerable:!0,get:function(){return n}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},82952:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createInitialRouterState",{enumerable:!0,get:function(){return c}});let r=n(33456),o=n(27420),u=n(5410),l=n(60305),a=n(24673),i=n(50232);function c(e){var t;let{buildId:n,initialTree:c,initialSeedData:s,urlParts:f,initialParallelRoutes:d,location:p,initialHead:h,couldBeIntercepted:y}=e,_=f.join("/"),v=!p,b={lazyData:null,rsc:s[2],prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:v?new Map:d,lazyDataResolved:!1,loading:s[3]},g=p?(0,r.createHrefFromUrl)(p):_;(0,i.addRefreshMarkerToActiveParallelSegments)(c,g);let m=new Map;(null===d||0===d.size)&&(0,o.fillLazyItemsTillLeafWithHead)(b,void 0,c,s,h);let R={buildId:n,tree:c,cache:b,prefetchCache:m,pushRef:{pendingPush:!1,mpaNavigation:!1,preserveCustomHistoryState:!0},focusAndScrollRef:{apply:!1,onlyHashChange:!1,hashFragment:null,segmentPaths:[]},canonicalUrl:g,nextUrl:null!=(t=(0,u.extractPathFromFlightRouterState)(c)||(null==p?void 0:p.pathname))?t:null};if(p){let e=new URL(""+p.pathname+p.search,p.origin),t=[["",c,null,null]];(0,l.createPrefetchCacheEntryForInitialLoad)({url:e,kind:a.PrefetchKind.AUTO,data:[t,void 0,!1,y],tree:R.tree,prefetchCache:R.prefetchCache,nextUrl:R.nextUrl})}return R}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},78505:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createRouterCacheKey",{enumerable:!0,get:function(){return o}});let r=n(84541);function o(e,t){return(void 0===t&&(t=!1),Array.isArray(e))?e[0]+"|"+e[1]+"|"+e[2]:t&&e.startsWith(r.PAGE_SEGMENT_KEY)?r.PAGE_SEGMENT_KEY:e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},44848:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fetchServerResponse",{enumerable:!0,get:function(){return f}});let r=n(6866),o=n(12846),u=n(83079),l=n(24673),a=n(37207),i=n(91311),{createFromFetch:c}=n(6671);function s(e){return[(0,o.urlToUrlWithoutFlightMarker)(e).toString(),void 0,!1,!1]}async function f(e,t,n,f,d){let p={[r.RSC_HEADER]:"1",[r.NEXT_ROUTER_STATE_TREE]:(0,i.prepareFlightRouterStateForRequest)(t)};d===l.PrefetchKind.AUTO&&(p[r.NEXT_ROUTER_PREFETCH_HEADER]="1"),n&&(p[r.NEXT_URL]=n);let h=(0,a.hexHash)([p[r.NEXT_ROUTER_PREFETCH_HEADER]||"0",p[r.NEXT_ROUTER_STATE_TREE],p[r.NEXT_URL]].join(","));try{var y;let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="index.txt":t.pathname+=".txt",t.searchParams.set(r.NEXT_RSC_UNION_QUERY,h);let n=await fetch(t,{credentials:"same-origin",headers:p}),l=(0,o.urlToUrlWithoutFlightMarker)(n.url),a=n.redirected?l:void 0,i=n.headers.get("content-type")||"",d=!!n.headers.get(r.NEXT_DID_POSTPONE_HEADER),_=!!(null==(y=n.headers.get("vary"))?void 0:y.includes(r.NEXT_URL)),v=i===r.RSC_CONTENT_TYPE_HEADER;if(v||(v=i.startsWith("text/plain")),!v||!n.ok)return e.hash&&(l.hash=e.hash),s(l.toString());let[b,g]=await c(Promise.resolve(n),{callServer:u.callServer});if(f!==b)return s(n.url);return[g,a,d,_]}catch(t){return console.error("Failed to fetch RSC payload for "+e+". Falling back to browser navigation.",t),[e.toString(),void 0,!1,!1]}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},92576:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fillCacheWithNewSubTreeData",{enumerable:!0,get:function(){return function e(t,n,l,a){let i=l.length<=5,[c,s]=l,f=(0,u.createRouterCacheKey)(s),d=n.parallelRoutes.get(c);if(!d)return;let p=t.parallelRoutes.get(c);p&&p!==d||(p=new Map(d),t.parallelRoutes.set(c,p));let h=d.get(f),y=p.get(f);if(i){if(!y||!y.lazyData||y===h){let e=l[3];y={lazyData:null,rsc:e[2],prefetchRsc:null,head:null,prefetchHead:null,loading:e[3],parallelRoutes:h?new Map(h.parallelRoutes):new Map,lazyDataResolved:!1},h&&(0,r.invalidateCacheByRouterState)(y,h,l[2]),(0,o.fillLazyItemsTillLeafWithHead)(y,h,l[2],e,l[4],a),p.set(f,y)}return}y&&h&&(y===h&&(y={lazyData:y.lazyData,rsc:y.rsc,prefetchRsc:y.prefetchRsc,head:y.head,prefetchHead:y.prefetchHead,parallelRoutes:new Map(y.parallelRoutes),lazyDataResolved:!1,loading:y.loading},p.set(f,y)),e(y,h,l.slice(2),a))}}});let r=n(94377),o=n(27420),u=n(78505);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},27420:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"fillLazyItemsTillLeafWithHead",{enumerable:!0,get:function(){return function e(t,n,u,l,a,i){if(0===Object.keys(u[1]).length){t.head=a;return}for(let c in u[1]){let s;let f=u[1][c],d=f[0],p=(0,r.createRouterCacheKey)(d),h=null!==l&&void 0!==l[1][c]?l[1][c]:null;if(n){let r=n.parallelRoutes.get(c);if(r){let n;let u=(null==i?void 0:i.kind)==="auto"&&i.status===o.PrefetchCacheEntryStatus.reusable,l=new Map(r),s=l.get(p);n=null!==h?{lazyData:null,rsc:h[2],prefetchRsc:null,head:null,prefetchHead:null,loading:h[3],parallelRoutes:new Map(null==s?void 0:s.parallelRoutes),lazyDataResolved:!1}:u&&s?{lazyData:s.lazyData,rsc:s.rsc,prefetchRsc:s.prefetchRsc,head:s.head,prefetchHead:s.prefetchHead,parallelRoutes:new Map(s.parallelRoutes),lazyDataResolved:s.lazyDataResolved,loading:s.loading}:{lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map(null==s?void 0:s.parallelRoutes),lazyDataResolved:!1,loading:null},l.set(p,n),e(n,s,f,h||null,a,i),t.parallelRoutes.set(c,l);continue}}if(null!==h){let e=h[2],t=h[3];s={lazyData:null,rsc:e,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:t}}else s={lazyData:null,rsc:null,prefetchRsc:null,head:null,prefetchHead:null,parallelRoutes:new Map,lazyDataResolved:!1,loading:null};let y=t.parallelRoutes.get(c);y?y.set(p,s):t.parallelRoutes.set(c,new Map([[p,s]])),e(s,void 0,f,h,a,i)}}}});let r=n(78505),o=n(24673);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},44510:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleMutable",{enumerable:!0,get:function(){return u}});let r=n(5410);function o(e){return void 0!==e}function u(e,t){var n,u,l;let a=null==(u=t.shouldScroll)||u,i=e.nextUrl;if(o(t.patchedTree)){let n=(0,r.computeChangedPath)(e.tree,t.patchedTree);n?i=n:i||(i=e.canonicalUrl)}return{buildId:e.buildId,canonicalUrl:o(t.canonicalUrl)?t.canonicalUrl===e.canonicalUrl?e.canonicalUrl:t.canonicalUrl:e.canonicalUrl,pushRef:{pendingPush:o(t.pendingPush)?t.pendingPush:e.pushRef.pendingPush,mpaNavigation:o(t.mpaNavigation)?t.mpaNavigation:e.pushRef.mpaNavigation,preserveCustomHistoryState:o(t.preserveCustomHistoryState)?t.preserveCustomHistoryState:e.pushRef.preserveCustomHistoryState},focusAndScrollRef:{apply:!!a&&(!!o(null==t?void 0:t.scrollableSegments)||e.focusAndScrollRef.apply),onlyHashChange:!!t.hashFragment&&e.canonicalUrl.split("#",1)[0]===(null==(n=t.canonicalUrl)?void 0:n.split("#",1)[0]),hashFragment:a?t.hashFragment&&""!==t.hashFragment?decodeURIComponent(t.hashFragment.slice(1)):e.focusAndScrollRef.hashFragment:null,segmentPaths:a?null!=(l=null==t?void 0:t.scrollableSegments)?l:e.focusAndScrollRef.segmentPaths:[]},cache:t.cache?t.cache:e.cache,prefetchCache:t.prefetchCache?t.prefetchCache:e.prefetchCache,tree:o(t.patchedTree)?t.patchedTree:e.tree,nextUrl:i}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77831:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleSegmentMismatch",{enumerable:!0,get:function(){return o}});let r=n(95967);function o(e,t,n){return(0,r.handleExternalUrl)(e,{},e.canonicalUrl,!0)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77058:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"invalidateCacheBelowFlightSegmentPath",{enumerable:!0,get:function(){return function e(t,n,o){let u=o.length<=2,[l,a]=o,i=(0,r.createRouterCacheKey)(a),c=n.parallelRoutes.get(l);if(!c)return;let s=t.parallelRoutes.get(l);if(s&&s!==c||(s=new Map(c),t.parallelRoutes.set(l,s)),u){s.delete(i);return}let f=c.get(i),d=s.get(i);d&&f&&(d===f&&(d={lazyData:d.lazyData,rsc:d.rsc,prefetchRsc:d.prefetchRsc,head:d.head,prefetchHead:d.prefetchHead,parallelRoutes:new Map(d.parallelRoutes),lazyDataResolved:d.lazyDataResolved},s.set(i,d)),e(d,f,o.slice(2)))}}});let r=n(78505);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},94377:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"invalidateCacheByRouterState",{enumerable:!0,get:function(){return o}});let r=n(78505);function o(e,t,n){for(let o in n[1]){let u=n[1][o][0],l=(0,r.createRouterCacheKey)(u),a=t.parallelRoutes.get(o);if(a){let t=new Map(a);t.delete(l),e.parallelRoutes.set(o,t)}}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},63237:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isNavigatingToNewRootLayout",{enumerable:!0,get:function(){return function e(t,n){let r=t[0],o=n[0];if(Array.isArray(r)&&Array.isArray(o)){if(r[0]!==o[0]||r[2]!==o[2])return!0}else if(r!==o)return!0;if(t[4])return!n[4];if(n[4])return!0;let u=Object.values(t[1])[0],l=Object.values(n[1])[0];return!u||!l||e(u,l)}}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},56118:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{abortTask:function(){return c},listenForDynamicRequest:function(){return a},updateCacheNodeOnNavigation:function(){return function e(t,n,a,c,s){let f=n[1],d=a[1],p=c[1],h=t.parallelRoutes,y=new Map(h),_={},v=null;for(let t in d){let n;let a=d[t],c=f[t],b=h.get(t),g=p[t],m=a[0],R=(0,u.createRouterCacheKey)(m),P=void 0!==c?c[0]:void 0,j=void 0!==b?b.get(R):void 0;if(null!==(n=m===r.PAGE_SEGMENT_KEY?l(a,void 0!==g?g:null,s):m===r.DEFAULT_SEGMENT_KEY?void 0!==c?{route:c,node:null,children:null}:l(a,void 0!==g?g:null,s):void 0!==P&&(0,o.matchSegment)(m,P)&&void 0!==j&&void 0!==c?null!=g?e(j,c,a,g,s):function(e){let t=i(e,null,null);return{route:e,node:t,children:null}}(a):l(a,void 0!==g?g:null,s))){null===v&&(v=new Map),v.set(t,n);let e=n.node;if(null!==e){let n=new Map(b);n.set(R,e),y.set(t,n)}_[t]=n.route}else _[t]=a}if(null===v)return null;let b={lazyData:null,rsc:t.rsc,prefetchRsc:t.prefetchRsc,head:t.head,prefetchHead:t.prefetchHead,loading:t.loading,parallelRoutes:y,lazyDataResolved:!1};return{route:function(e,t){let n=[e[0],t];return 2 in e&&(n[2]=e[2]),3 in e&&(n[3]=e[3]),4 in e&&(n[4]=e[4]),n}(a,_),node:b,children:v}}},updateCacheNodeOnPopstateRestoration:function(){return function e(t,n){let r=n[1],o=t.parallelRoutes,l=new Map(o);for(let t in r){let n=r[t],a=n[0],i=(0,u.createRouterCacheKey)(a),c=o.get(t);if(void 0!==c){let r=c.get(i);if(void 0!==r){let o=e(r,n),u=new Map(c);u.set(i,o),l.set(t,u)}}}let a=t.rsc,i=d(a)&&"pending"===a.status;return{lazyData:null,rsc:a,head:t.head,prefetchHead:i?t.prefetchHead:null,prefetchRsc:i?t.prefetchRsc:null,loading:i?t.loading:null,parallelRoutes:l,lazyDataResolved:!1}}}});let r=n(84541),o=n(76015),u=n(78505);function l(e,t,n){let r=i(e,t,n);return{route:e,node:r,children:null}}function a(e,t){t.then(t=>{for(let n of t[0]){let t=n.slice(0,-3),r=n[n.length-3],l=n[n.length-2],a=n[n.length-1];"string"!=typeof t&&function(e,t,n,r,l){let a=e;for(let e=0;e{c(e,t)})}function i(e,t,n){let r=e[1],o=null!==t?t[1]:null,l=new Map;for(let e in r){let t=r[e],a=null!==o?o[e]:null,c=t[0],s=(0,u.createRouterCacheKey)(c),f=i(t,void 0===a?null:a,n),d=new Map;d.set(s,f),l.set(e,d)}let a=0===l.size,c=null!==t?t[2]:null,s=null!==t?t[3]:null;return{lazyData:null,parallelRoutes:l,prefetchRsc:void 0!==c?c:null,prefetchHead:a?n:null,loading:void 0!==s?s:null,rsc:p(),head:a?p():null,lazyDataResolved:!1}}function c(e,t){let n=e.node;if(null===n)return;let r=e.children;if(null===r)s(e.route,n,t);else for(let e of r.values())c(e,t);e.node=null}function s(e,t,n){let r=e[1],o=t.parallelRoutes;for(let e in r){let t=r[e],l=o.get(e);if(void 0===l)continue;let a=t[0],i=(0,u.createRouterCacheKey)(a),c=l.get(i);void 0!==c&&s(t,c,n)}let l=t.rsc;d(l)&&(null===n?l.resolve(null):l.reject(n));let a=t.head;d(a)&&a.resolve(null)}let f=Symbol();function d(e){return e&&e.tag===f}function p(){let e,t;let n=new Promise((n,r)=>{e=n,t=r});return n.status="pending",n.resolve=t=>{"pending"===n.status&&(n.status="fulfilled",n.value=t,e(t))},n.reject=e=>{"pending"===n.status&&(n.status="rejected",n.reason=e,t(e))},n.tag=f,n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},60305:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createPrefetchCacheEntryForInitialLoad:function(){return c},getOrCreatePrefetchCacheEntry:function(){return i},prunePrefetchCache:function(){return f}});let r=n(33456),o=n(44848),u=n(24673),l=n(24819);function a(e,t){let n=(0,r.createHrefFromUrl)(e,!1);return t?t+"%"+n:n}function i(e){let t,{url:n,nextUrl:r,tree:o,buildId:l,prefetchCache:i,kind:c}=e,f=a(n,r),d=i.get(f);if(d)t=d;else{let e=a(n),r=i.get(e);r&&(t=r)}return t?(t.status=h(t),t.kind!==u.PrefetchKind.FULL&&c===u.PrefetchKind.FULL)?s({tree:o,url:n,buildId:l,nextUrl:r,prefetchCache:i,kind:null!=c?c:u.PrefetchKind.TEMPORARY}):(c&&t.kind===u.PrefetchKind.TEMPORARY&&(t.kind=c),t):s({tree:o,url:n,buildId:l,nextUrl:r,prefetchCache:i,kind:c||u.PrefetchKind.TEMPORARY})}function c(e){let{nextUrl:t,tree:n,prefetchCache:r,url:o,kind:l,data:i}=e,[,,,c]=i,s=c?a(o,t):a(o),f={treeAtTimeOfPrefetch:n,data:Promise.resolve(i),kind:l,prefetchTime:Date.now(),lastUsedTime:Date.now(),key:s,status:u.PrefetchCacheEntryStatus.fresh};return r.set(s,f),f}function s(e){let{url:t,kind:n,tree:r,nextUrl:i,buildId:c,prefetchCache:s}=e,f=a(t),d=l.prefetchQueue.enqueue(()=>(0,o.fetchServerResponse)(t,r,i,c,n).then(e=>{let[,,,n]=e;return n&&function(e){let{url:t,nextUrl:n,prefetchCache:r}=e,o=a(t),u=r.get(o);if(!u)return;let l=a(t,n);r.set(l,u),r.delete(o)}({url:t,nextUrl:i,prefetchCache:s}),e})),p={treeAtTimeOfPrefetch:r,data:d,kind:n,prefetchTime:Date.now(),lastUsedTime:null,key:f,status:u.PrefetchCacheEntryStatus.fresh};return s.set(f,p),p}function f(e){for(let[t,n]of e)h(n)===u.PrefetchCacheEntryStatus.expired&&e.delete(t)}let d=1e3*Number("30"),p=1e3*Number("300");function h(e){let{kind:t,prefetchTime:n,lastUsedTime:r}=e;return Date.now()<(null!=r?r:n)+d?r?u.PrefetchCacheEntryStatus.reusable:u.PrefetchCacheEntryStatus.fresh:"auto"===t&&Date.now(){let[n,f]=t,h=!1;if(E.lastUsedTime||(E.lastUsedTime=Date.now(),h=!0),"string"==typeof n)return _(e,R,n,O);if(document.getElementById("__next-page-redirect"))return _(e,R,j,O);let b=e.tree,g=e.cache,w=[];for(let t of n){let n=t.slice(0,-4),r=t.slice(-3)[0],c=["",...n],f=(0,u.applyRouterStatePatchToTree)(c,b,r,j);if(null===f&&(f=(0,u.applyRouterStatePatchToTree)(c,S,r,j)),null!==f){if((0,a.isNavigatingToNewRootLayout)(b,f))return _(e,R,j,O);let u=(0,d.createEmptyCacheNode)(),m=!1;for(let e of(E.status!==i.PrefetchCacheEntryStatus.stale||h?m=(0,s.applyFlightData)(g,u,t,E):(m=function(e,t,n,r){let o=!1;for(let u of(e.rsc=t.rsc,e.prefetchRsc=t.prefetchRsc,e.loading=t.loading,e.parallelRoutes=new Map(t.parallelRoutes),v(r).map(e=>[...n,...e])))(0,y.clearCacheNodeDataForSegmentPath)(e,t,u),o=!0;return o}(u,g,n,r),E.lastUsedTime=Date.now()),(0,l.shouldHardNavigate)(c,b)?(u.rsc=g.rsc,u.prefetchRsc=g.prefetchRsc,(0,o.invalidateCacheBelowFlightSegmentPath)(u,g,n),R.cache=u):m&&(R.cache=u,g=u),b=f,v(r))){let t=[...n,...e];t[t.length-1]!==p.DEFAULT_SEGMENT_KEY&&w.push(t)}}}return R.patchedTree=b,R.canonicalUrl=f?(0,r.createHrefFromUrl)(f):j,R.pendingPush=O,R.scrollableSegments=w,R.hashFragment=P,R.shouldScroll=m,(0,c.handleMutable)(e,R)},()=>e)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},24819:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{prefetchQueue:function(){return l},prefetchReducer:function(){return a}});let r=n(6866),o=n(29744),u=n(60305),l=new o.PromiseQueue(5);function a(e,t){(0,u.prunePrefetchCache)(e.prefetchCache);let{url:n}=t;return n.searchParams.delete(r.NEXT_RSC_UNION_QUERY),(0,u.getOrCreatePrefetchCacheEntry)({url:n,nextUrl:e.nextUrl,prefetchCache:e.prefetchCache,kind:t.kind,tree:e.tree,buildId:e.buildId}),e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},99601:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"refreshReducer",{enumerable:!0,get:function(){return h}});let r=n(44848),o=n(33456),u=n(81935),l=n(63237),a=n(95967),i=n(44510),c=n(27420),s=n(12846),f=n(77831),d=n(28077),p=n(50232);function h(e,t){let{origin:n}=t,h={},y=e.canonicalUrl,_=e.tree;h.preserveCustomHistoryState=!1;let v=(0,s.createEmptyCacheNode)(),b=(0,d.hasInterceptionRouteInCurrentTree)(e.tree);return v.lazyData=(0,r.fetchServerResponse)(new URL(y,n),[_[0],_[1],_[2],"refetch"],b?e.nextUrl:null,e.buildId),v.lazyData.then(async n=>{let[r,s]=n;if("string"==typeof r)return(0,a.handleExternalUrl)(e,h,r,e.pushRef.pendingPush);for(let n of(v.lazyData=null,r)){if(3!==n.length)return console.log("REFRESH FAILED"),e;let[r]=n,i=(0,u.applyRouterStatePatchToTree)([""],_,r,e.canonicalUrl);if(null===i)return(0,f.handleSegmentMismatch)(e,t,r);if((0,l.isNavigatingToNewRootLayout)(_,i))return(0,a.handleExternalUrl)(e,h,y,e.pushRef.pendingPush);let d=s?(0,o.createHrefFromUrl)(s):void 0;s&&(h.canonicalUrl=d);let[g,m]=n.slice(-2);if(null!==g){let e=g[2];v.rsc=e,v.prefetchRsc=null,(0,c.fillLazyItemsTillLeafWithHead)(v,void 0,r,g,m),h.prefetchCache=new Map}await (0,p.refreshInactiveParallelSegments)({state:e,updatedTree:i,updatedCache:v,includeNextUrl:b,canonicalUrl:h.canonicalUrl||e.canonicalUrl}),h.cache=v,h.patchedTree=i,h.canonicalUrl=y,_=i}return(0,i.handleMutable)(e,h)},()=>e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},77784:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"restoreReducer",{enumerable:!0,get:function(){return u}});let r=n(33456),o=n(5410);function u(e,t){var n;let{url:u,tree:l}=t,a=(0,r.createHrefFromUrl)(u),i=l||e.tree,c=e.cache;return{buildId:e.buildId,canonicalUrl:a,pushRef:{pendingPush:!1,mpaNavigation:!1,preserveCustomHistoryState:!0},focusAndScrollRef:e.focusAndScrollRef,cache:c,prefetchCache:e.prefetchCache,tree:i,nextUrl:null!=(n=(0,o.extractPathFromFlightRouterState)(i))?n:u.pathname}}n(56118),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},13722:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"serverActionReducer",{enumerable:!0,get:function(){return m}});let r=n(83079),o=n(6866),u=n(1634),l=n(33456),a=n(95967),i=n(81935),c=n(63237),s=n(44510),f=n(27420),d=n(12846),p=n(28077),h=n(77831),y=n(50232),_=n(91311),{createFromFetch:v,encodeReply:b}=n(6671);async function g(e,t,n){let l,{actionId:a,actionArgs:i}=n,c=await b(i),s=await fetch("",{method:"POST",headers:{Accept:o.RSC_CONTENT_TYPE_HEADER,[o.ACTION]:a,[o.NEXT_ROUTER_STATE_TREE]:(0,_.prepareFlightRouterStateForRequest)(e.tree),...t?{[o.NEXT_URL]:t}:{}},body:c}),f=s.headers.get("x-action-redirect");try{let e=JSON.parse(s.headers.get("x-action-revalidated")||"[[],0,0]");l={paths:e[0]||[],tag:!!e[1],cookie:e[2]}}catch(e){l={paths:[],tag:!1,cookie:!1}}let d=f?new URL((0,u.addBasePath)(f),new URL(e.canonicalUrl,window.location.href)):void 0;if(s.headers.get("content-type")===o.RSC_CONTENT_TYPE_HEADER){let e=await v(Promise.resolve(s),{callServer:r.callServer});if(f){let[,t]=null!=e?e:[];return{actionFlightData:t,redirectLocation:d,revalidatedParts:l}}let[t,[,n]]=null!=e?e:[];return{actionResult:t,actionFlightData:n,redirectLocation:d,revalidatedParts:l}}return{redirectLocation:d,revalidatedParts:l}}function m(e,t){let{resolve:n,reject:r}=t,o={},u=e.canonicalUrl,_=e.tree;o.preserveCustomHistoryState=!1;let v=e.nextUrl&&(0,p.hasInterceptionRouteInCurrentTree)(e.tree)?e.nextUrl:null;return o.inFlightServerAction=g(e,v,t),o.inFlightServerAction.then(async r=>{let{actionResult:p,actionFlightData:b,redirectLocation:g}=r;if(g&&(e.pushRef.pendingPush=!0,o.pendingPush=!0),!b)return(n(p),g)?(0,a.handleExternalUrl)(e,o,g.href,e.pushRef.pendingPush):e;if("string"==typeof b)return(0,a.handleExternalUrl)(e,o,b,e.pushRef.pendingPush);if(o.inFlightServerAction=null,g){let e=(0,l.createHrefFromUrl)(g,!1);o.canonicalUrl=e}for(let n of b){if(3!==n.length)return console.log("SERVER ACTION APPLY FAILED"),e;let[r]=n,s=(0,i.applyRouterStatePatchToTree)([""],_,r,g?(0,l.createHrefFromUrl)(g):e.canonicalUrl);if(null===s)return(0,h.handleSegmentMismatch)(e,t,r);if((0,c.isNavigatingToNewRootLayout)(_,s))return(0,a.handleExternalUrl)(e,o,u,e.pushRef.pendingPush);let[p,b]=n.slice(-2),m=null!==p?p[2]:null;if(null!==m){let t=(0,d.createEmptyCacheNode)();t.rsc=m,t.prefetchRsc=null,(0,f.fillLazyItemsTillLeafWithHead)(t,void 0,r,p,b),await (0,y.refreshInactiveParallelSegments)({state:e,updatedTree:s,updatedCache:t,includeNextUrl:!!v,canonicalUrl:o.canonicalUrl||e.canonicalUrl}),o.cache=t,o.prefetchCache=new Map}o.patchedTree=s,_=s}return n(p),(0,s.handleMutable)(e,o)},t=>(r(t),e))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},68448:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"serverPatchReducer",{enumerable:!0,get:function(){return f}});let r=n(33456),o=n(81935),u=n(63237),l=n(95967),a=n(22356),i=n(44510),c=n(12846),s=n(77831);function f(e,t){let{serverResponse:n}=t,[f,d]=n,p={};if(p.preserveCustomHistoryState=!1,"string"==typeof f)return(0,l.handleExternalUrl)(e,p,f,e.pushRef.pendingPush);let h=e.tree,y=e.cache;for(let n of f){let i=n.slice(0,-4),[f]=n.slice(-3,-2),_=(0,o.applyRouterStatePatchToTree)(["",...i],h,f,e.canonicalUrl);if(null===_)return(0,s.handleSegmentMismatch)(e,t,f);if((0,u.isNavigatingToNewRootLayout)(h,_))return(0,l.handleExternalUrl)(e,p,e.canonicalUrl,e.pushRef.pendingPush);let v=d?(0,r.createHrefFromUrl)(d):void 0;v&&(p.canonicalUrl=v);let b=(0,c.createEmptyCacheNode)();(0,a.applyFlightData)(y,b,n),p.patchedTree=_,p.cache=b,y=b,h=_}return(0,i.handleMutable)(e,p)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},50232:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{addRefreshMarkerToActiveParallelSegments:function(){return function e(t,n){let[r,o,,l]=t;for(let a in r.includes(u.PAGE_SEGMENT_KEY)&&"refresh"!==l&&(t[2]=n,t[3]="refresh"),o)e(o[a],n)}},refreshInactiveParallelSegments:function(){return l}});let r=n(22356),o=n(44848),u=n(84541);async function l(e){let t=new Set;await a({...e,rootTree:e.updatedTree,fetchedSegments:t})}async function a(e){let{state:t,updatedTree:n,updatedCache:u,includeNextUrl:l,fetchedSegments:i,rootTree:c=n,canonicalUrl:s}=e,[,f,d,p]=n,h=[];if(d&&d!==s&&"refresh"===p&&!i.has(d)){i.add(d);let e=(0,o.fetchServerResponse)(new URL(d,location.origin),[c[0],c[1],c[2],"refetch"],l?t.nextUrl:null,t.buildId).then(e=>{let t=e[0];if("string"!=typeof t)for(let e of t)(0,r.applyFlightData)(u,u,e)});h.push(e)}for(let e in f){let n=a({state:t,updatedTree:f[e],updatedCache:u,includeNextUrl:l,fetchedSegments:i,rootTree:c,canonicalUrl:s});h.push(n)}await Promise.all(h)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},24673:function(e,t){"use strict";var n,r,o,u;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ACTION_FAST_REFRESH:function(){return f},ACTION_NAVIGATE:function(){return a},ACTION_PREFETCH:function(){return s},ACTION_REFRESH:function(){return l},ACTION_RESTORE:function(){return i},ACTION_SERVER_ACTION:function(){return d},ACTION_SERVER_PATCH:function(){return c},PrefetchCacheEntryStatus:function(){return r},PrefetchKind:function(){return n},isThenable:function(){return p}});let l="refresh",a="navigate",i="restore",c="server-patch",s="prefetch",f="fast-refresh",d="server-action";function p(e){return e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}(o=n||(n={})).AUTO="auto",o.FULL="full",o.TEMPORARY="temporary",(u=r||(r={})).fresh="fresh",u.reusable="reusable",u.expired="expired",u.stale="stale",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},91450:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"reducer",{enumerable:!0,get:function(){return f}});let r=n(24673),o=n(95967),u=n(68448),l=n(77784),a=n(99601),i=n(24819),c=n(44529),s=n(13722),f="undefined"==typeof window?function(e,t){return e}:function(e,t){switch(t.type){case r.ACTION_NAVIGATE:return(0,o.navigateReducer)(e,t);case r.ACTION_SERVER_PATCH:return(0,u.serverPatchReducer)(e,t);case r.ACTION_RESTORE:return(0,l.restoreReducer)(e,t);case r.ACTION_REFRESH:return(0,a.refreshReducer)(e,t);case r.ACTION_FAST_REFRESH:return(0,c.fastRefreshReducer)(e,t);case r.ACTION_PREFETCH:return(0,i.prefetchReducer)(e,t);case r.ACTION_SERVER_ACTION:return(0,s.serverActionReducer)(e,t);default:throw Error("Unknown action")}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},53728:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"shouldHardNavigate",{enumerable:!0,get:function(){return function e(t,n){let[o,u]=n,[l,a]=t;return(0,r.matchSegment)(l,o)?!(t.length<=2)&&e(t.slice(2),u[a]):!!Array.isArray(l)}}});let r=n(76015);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},54535:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{createDynamicallyTrackedSearchParams:function(){return a},createUntrackedSearchParams:function(){return l}});let r=n(51845),o=n(86999),u=n(30650);function l(e){let t=r.staticGenerationAsyncStorage.getStore();return t&&t.forceStatic?{}:e}function a(e){let t=r.staticGenerationAsyncStorage.getStore();return t?t.forceStatic?{}:t.isStaticGeneration||t.dynamicShouldError?new Proxy({},{get:(e,n,r)=>("string"==typeof n&&(0,o.trackDynamicDataAccessed)(t,"searchParams."+n),u.ReflectAdapter.get(e,n,r)),has:(e,n)=>("string"==typeof n&&(0,o.trackDynamicDataAccessed)(t,"searchParams."+n),Reflect.has(e,n)),ownKeys:e=>((0,o.trackDynamicDataAccessed)(t,"searchParams"),Reflect.ownKeys(e))}):e:e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},51845:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"staticGenerationAsyncStorage",{enumerable:!0,get:function(){return r.staticGenerationAsyncStorage}});let r=n(20030);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},36864:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{StaticGenBailoutError:function(){return r},isStaticGenBailoutError:function(){return o}});let n="NEXT_STATIC_GEN_BAILOUT";class r extends Error{constructor(...e){super(...e),this.code=n}}function o(e){return"object"==typeof e&&null!==e&&"code"in e&&e.code===n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},38137:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unresolvedThenable",{enumerable:!0,get:function(){return n}});let n={then:()=>{}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},47744:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{useReducerWithReduxDevtools:function(){return i},useUnwrapState:function(){return a}});let r=n(53099)._(n(2265)),o=n(24673),u=n(2103);function l(e){if(e instanceof Map){let t={};for(let[n,r]of e.entries()){if("function"==typeof r){t[n]="fn()";continue}if("object"==typeof r&&null!==r){if(r.$$typeof){t[n]=r.$$typeof.toString();continue}if(r._bundlerConfig){t[n]="FlightData";continue}}t[n]=l(r)}return t}if("object"==typeof e&&null!==e){let t={};for(let n in e){let r=e[n];if("function"==typeof r){t[n]="fn()";continue}if("object"==typeof r&&null!==r){if(r.$$typeof){t[n]=r.$$typeof.toString();continue}if(r.hasOwnProperty("_bundlerConfig")){t[n]="FlightData";continue}}t[n]=l(r)}return t}return Array.isArray(e)?e.map(l):e}function a(e){return(0,o.isThenable)(e)?(0,r.use)(e):e}let i="undefined"!=typeof window?function(e){let[t,n]=r.default.useState(e),o=(0,r.useContext)(u.ActionQueueContext);if(!o)throw Error("Invariant: Missing ActionQueueContext");let a=(0,r.useRef)(),i=(0,r.useRef)();return(0,r.useEffect)(()=>{if(!a.current&&!1!==i.current){if(void 0===i.current&&void 0===window.__REDUX_DEVTOOLS_EXTENSION__){i.current=!1;return}return a.current=window.__REDUX_DEVTOOLS_EXTENSION__.connect({instanceId:8e3,name:"next-router"}),a.current&&(a.current.init(l(e)),o&&(o.devToolsInstance=a.current)),()=>{a.current=void 0}}},[e,o]),[t,(0,r.useCallback)(t=>{o.state||(o.state=e),o.dispatch(t,n)},[o,e]),(0,r.useCallback)(e=>{a.current&&a.current.send({type:"RENDER_SYNC"},l(e))},[])]}:function(e){return[e,()=>{},()=>{}]};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},91311:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"prepareFlightRouterStateForRequest",{enumerable:!0,get:function(){return o}});let r=n(84541);function o(e,t){return t?encodeURIComponent(JSON.stringify(e)):encodeURIComponent(JSON.stringify(function e(t){let[n,o,,u,l]=t,a="string"==typeof n&&n.startsWith(r.PAGE_SEGMENT_KEY+"?")?r.PAGE_SEGMENT_KEY:n,i={};for(let[t,n]of Object.entries(o))i[t]=e(n);let c=[a,i,null,u&&"refresh"!==u?u:null];return void 0!==l&&(c[4]=l),c}(e)))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},11283:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"hasBasePath",{enumerable:!0,get:function(){return o}});let r=n(10580);function o(e){return(0,r.pathHasPrefix)(e,"")}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},33068:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"normalizePathTrailingSlash",{enumerable:!0,get:function(){return u}});let r=n(26674),o=n(63381),u=e=>{if(!e.startsWith("/"))return e;let{pathname:t,query:n,hash:u}=(0,o.parsePath)(e);return""+(0,r.removeTrailingSlash)(t)+n+u};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},61404:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o}});let r=n(18993);function o(e){let t="function"==typeof reportError?reportError:e=>{window.console.error(e)};(0,r.isBailoutToCSRError)(e)||t(e)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},35076:function(e,t,n){"use strict";function r(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeBasePath",{enumerable:!0,get:function(){return r}}),n(11283),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},12010:function(e,t){"use strict";function n(e,t){var n=e.length;for(e.push(t);0>>1,o=e[r];if(0>>1;ru(i,n))cu(s,i)?(e[r]=s,e[c]=n,r=c):(e[r]=i,e[a]=n,r=a);else if(cu(s,n))e[r]=s,e[c]=n,r=c;else break}}return t}function u(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,a=performance;t.unstable_now=function(){return a.now()}}else{var i=Date,c=i.now();t.unstable_now=function(){return i.now()-c}}var s=[],f=[],d=1,p=null,h=3,y=!1,_=!1,v=!1,b="function"==typeof setTimeout?setTimeout:null,g="function"==typeof clearTimeout?clearTimeout:null,m="undefined"!=typeof setImmediate?setImmediate:null;function R(e){for(var t=r(f);null!==t;){if(null===t.callback)o(f);else if(t.startTime<=e)o(f),t.sortIndex=t.expirationTime,n(s,t);else break;t=r(f)}}function P(e){if(v=!1,R(e),!_){if(null!==r(s))_=!0,C();else{var t=r(f);null!==t&&A(P,t.startTime-e)}}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var j=!1,O=-1,E=5,S=-1;function w(){return!(t.unstable_now()-Se&&w());){var a=p.callback;if("function"==typeof a){p.callback=null,h=p.priorityLevel;var i=a(p.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof i){p.callback=i,R(e),n=!0;break t}p===r(s)&&o(s),R(e)}else o(s);p=r(s)}if(null!==p)n=!0;else{var c=r(f);null!==c&&A(P,c.startTime-e),n=!1}}break e}finally{p=null,h=u,y=!1}n=void 0}}finally{n?l():j=!1}}}if("function"==typeof m)l=function(){m(M)};else if("undefined"!=typeof MessageChannel){var T=new MessageChannel,x=T.port2;T.port1.onmessage=M,l=function(){x.postMessage(null)}}else l=function(){b(M,0)};function C(){j||(j=!0,l())}function A(e,n){O=b(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){_||y||(_=!0,C())},t.unstable_forceFrameRate=function(e){0>e||125l?(e.sortIndex=u,n(f,e),null===r(s)&&e===r(f)&&(v?(g(O),O=-1):v=!0,A(P,u-l))):(e.sortIndex=a,n(s,e),_||y||(_=!0,C())),e},t.unstable_shouldYield=w,t.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}},71767:function(e,t,n){"use strict";e.exports=n(12010)},60934:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{getPathname:function(){return r},isFullStringUrl:function(){return o},parseUrl:function(){return u}});let n="http://n";function r(e){return new URL(e,n).pathname}function o(e){return/https?:\/\//.test(e)}function u(e){let t;try{t=new URL(e,n)}catch{}return t}},86999:function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{Postpone:function(){return d},createPostponedAbortSignal:function(){return b},createPrerenderState:function(){return c},formatDynamicAPIAccesses:function(){return _},markCurrentScopeAsDynamic:function(){return s},trackDynamicDataAccessed:function(){return f},trackDynamicFetch:function(){return p},usedDynamicAPIs:function(){return y}});let o=(r=n(2265))&&r.__esModule?r:{default:r},u=n(46177),l=n(36864),a=n(60934),i="function"==typeof o.default.unstable_postpone;function c(e){return{isDebugSkeleton:e,dynamicAccesses:[]}}function s(e,t){let n=(0,a.getPathname)(e.urlPathname);if(!e.isUnstableCacheCallback){if(e.dynamicShouldError)throw new l.StaticGenBailoutError(`Route ${n} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);if(e.prerenderState)h(e.prerenderState,t,n);else if(e.revalidate=0,e.isStaticGeneration){let r=new u.DynamicServerError(`Route ${n} couldn't be rendered statically because it used ${t}. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`);throw e.dynamicUsageDescription=t,e.dynamicUsageStack=r.stack,r}}}function f(e,t){let n=(0,a.getPathname)(e.urlPathname);if(e.isUnstableCacheCallback)throw Error(`Route ${n} used "${t}" inside a function cached with "unstable_cache(...)". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "${t}" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/app/api-reference/functions/unstable_cache`);if(e.dynamicShouldError)throw new l.StaticGenBailoutError(`Route ${n} with \`dynamic = "error"\` couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);if(e.prerenderState)h(e.prerenderState,t,n);else if(e.revalidate=0,e.isStaticGeneration){let r=new u.DynamicServerError(`Route ${n} couldn't be rendered statically because it used \`${t}\`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error`);throw e.dynamicUsageDescription=t,e.dynamicUsageStack=r.stack,r}}function d({reason:e,prerenderState:t,pathname:n}){h(t,e,n)}function p(e,t){e.prerenderState&&h(e.prerenderState,t,e.urlPathname)}function h(e,t,n){v();let r=`Route ${n} needs to bail out of prerendering at this point because it used ${t}. React throws this special object to indicate where. It should not be caught by your own try/catch. Learn more: https://nextjs.org/docs/messages/ppr-caught-error`;e.dynamicAccesses.push({stack:e.isDebugSkeleton?Error().stack:void 0,expression:t}),o.default.unstable_postpone(r)}function y(e){return e.dynamicAccesses.length>0}function _(e){return e.dynamicAccesses.filter(e=>"string"==typeof e.stack&&e.stack.length>0).map(({expression:e,stack:t})=>(t=t.split("\n").slice(4).filter(e=>!(e.includes("node_modules/next/")||e.includes(" ()")||e.includes(" (node:"))).join("\n"),`Dynamic API Usage Debug - ${e}: +${t}`))}function v(){if(!i)throw Error("Invariant: React.unstable_postpone is not defined. This suggests the wrong version of React was loaded. This is a bug in Next.js")}function b(e){v();let t=new AbortController;try{o.default.unstable_postpone(e)}catch(e){t.abort(e)}return t.signal}},87417:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getSegmentParam",{enumerable:!0,get:function(){return o}});let r=n(91182);function o(e){let t=r.INTERCEPTION_ROUTE_MARKERS.find(t=>e.startsWith(t));return(t&&(e=e.slice(t.length)),e.startsWith("[[...")&&e.endsWith("]]"))?{type:"optional-catchall",param:e.slice(5,-2)}:e.startsWith("[...")&&e.endsWith("]")?{type:t?"catchall-intercepted":"catchall",param:e.slice(4,-1)}:e.startsWith("[")&&e.endsWith("]")?{type:t?"dynamic-intercepted":"dynamic",param:e.slice(1,-1)}:null}},70647:function(e,t){"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HMR_ACTIONS_SENT_TO_BROWSER",{enumerable:!0,get:function(){return n}}),(r=n||(n={})).ADDED_PAGE="addedPage",r.REMOVED_PAGE="removedPage",r.RELOAD_PAGE="reloadPage",r.SERVER_COMPONENT_CHANGES="serverComponentChanges",r.MIDDLEWARE_CHANGES="middlewareChanges",r.CLIENT_CHANGES="clientChanges",r.SERVER_ONLY_CHANGES="serverOnlyChanges",r.SYNC="sync",r.BUILT="built",r.BUILDING="building",r.DEV_PAGES_MANIFEST_UPDATE="devPagesManifestUpdate",r.TURBOPACK_MESSAGE="turbopack-message",r.SERVER_ERROR="serverError",r.TURBOPACK_CONNECTED="turbopack-connected"},91182:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{INTERCEPTION_ROUTE_MARKERS:function(){return o},extractInterceptionRouteInformation:function(){return l},isInterceptionRouteAppPath:function(){return u}});let r=n(20926),o=["(..)(..)","(.)","(..)","(...)"];function u(e){return void 0!==e.split("/").find(e=>o.find(t=>e.startsWith(t)))}function l(e){let t,n,u;for(let r of e.split("/"))if(n=o.find(e=>r.startsWith(e))){[t,u]=e.split(n,2);break}if(!t||!n||!u)throw Error(`Invalid interception route: ${e}. Must be in the format //(..|...|..)(..)/`);switch(t=(0,r.normalizeAppPath)(t),n){case"(.)":u="/"===t?`/${u}`:t+"/"+u;break;case"(..)":if("/"===t)throw Error(`Invalid interception route: ${e}. Cannot use (..) marker at the root level, use (.) instead.`);u=t.split("/").slice(0,-1).concat(u).join("/");break;case"(...)":u="/"+u;break;case"(..)(..)":let l=t.split("/");if(l.length<=2)throw Error(`Invalid interception route: ${e}. Cannot use (..)(..) marker at the root level or one level up.`);u=l.slice(0,-2).concat(u).join("/");break;default:throw Error("Invariant: unexpected marker")}return{interceptingRoute:t,interceptedRoute:u}}},30650:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ReflectAdapter",{enumerable:!0,get:function(){return n}});class n{static get(e,t,n){let r=Reflect.get(e,t,n);return"function"==typeof r?r.bind(e):r}static set(e,t,n,r){return Reflect.set(e,t,n,r)}static has(e,t){return Reflect.has(e,t)}static deleteProperty(e,t){return Reflect.deleteProperty(e,t)}}},61956:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{AppRouterContext:function(){return o},GlobalLayoutRouterContext:function(){return l},LayoutRouterContext:function(){return u},MissingSlotContext:function(){return i},TemplateContext:function(){return a}});let r=n(47043)._(n(2265)),o=r.default.createContext(null),u=r.default.createContext(null),l=r.default.createContext(null),a=r.default.createContext(null),i=r.default.createContext(new Set)},37207:function(e,t){"use strict";function n(e){let t=5381;for(let n=0;n>>0}function r(e){return n(e).toString(36).slice(0,5)}Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{djb2Hash:function(){return n},hexHash:function(){return r}})},48701:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HeadManagerContext",{enumerable:!0,get:function(){return r}});let r=n(47043)._(n(2265)).default.createContext({})},79060:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{PathParamsContext:function(){return l},PathnameContext:function(){return u},SearchParamsContext:function(){return o}});let r=n(2265),o=(0,r.createContext)(null),u=(0,r.createContext)(null),l=(0,r.createContext)(null)},18993:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{BailoutToCSRError:function(){return r},isBailoutToCSRError:function(){return o}});let n="BAILOUT_TO_CLIENT_SIDE_RENDERING";class r extends Error{constructor(e){super("Bail out to client-side rendering: "+e),this.reason=e,this.digest=n}}function o(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===n}},78162:function(e,t){"use strict";function n(e){return e.startsWith("/")?e:"/"+e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ensureLeadingSlash",{enumerable:!0,get:function(){return n}})},2103:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ActionQueueContext:function(){return a},createMutableActionQueue:function(){return s}});let r=n(53099),o=n(24673),u=n(91450),l=r._(n(2265)),a=l.default.createContext(null);function i(e,t){null!==e.pending&&(e.pending=e.pending.next,null!==e.pending?c({actionQueue:e,action:e.pending,setState:t}):e.needsRefresh&&(e.needsRefresh=!1,e.dispatch({type:o.ACTION_REFRESH,origin:window.location.origin},t)))}async function c(e){let{actionQueue:t,action:n,setState:r}=e,u=t.state;if(!u)throw Error("Invariant: Router state not initialized");t.pending=n;let l=n.payload,a=t.action(u,l);function c(e){n.discarded||(t.state=e,t.devToolsInstance&&t.devToolsInstance.send(l,e),i(t,r),n.resolve(e))}(0,o.isThenable)(a)?a.then(c,e=>{i(t,r),n.reject(e)}):c(a)}function s(){let e={state:null,dispatch:(t,n)=>(function(e,t,n){let r={resolve:n,reject:()=>{}};if(t.type!==o.ACTION_RESTORE){let e=new Promise((e,t)=>{r={resolve:e,reject:t}});(0,l.startTransition)(()=>{n(e)})}let u={payload:t,next:null,resolve:r.resolve,reject:r.reject};null===e.pending?(e.last=u,c({actionQueue:e,action:u,setState:n})):t.type===o.ACTION_NAVIGATE||t.type===o.ACTION_RESTORE?(e.pending.discarded=!0,e.last=u,e.pending.payload.type===o.ACTION_SERVER_ACTION&&(e.needsRefresh=!0),c({actionQueue:e,action:u,setState:n})):(null!==e.last&&(e.last.next=u),e.last=u)})(e,t,n),action:async(e,t)=>{if(null===e)throw Error("Invariant: Router state not initialized");return(0,u.reducer)(e,t)},pending:null,last:null};return e}},68498:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"addPathPrefix",{enumerable:!0,get:function(){return o}});let r=n(63381);function o(e,t){if(!e.startsWith("/")||!t)return e;let{pathname:n,query:o,hash:u}=(0,r.parsePath)(e);return""+t+n+o+u}},20926:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{normalizeAppPath:function(){return u},normalizeRscURL:function(){return l}});let r=n(78162),o=n(84541);function u(e){return(0,r.ensureLeadingSlash)(e.split("/").reduce((e,t,n,r)=>!t||(0,o.isGroupSegment)(t)||"@"===t[0]||("page"===t||"route"===t)&&n===r.length-1?e:e+"/"+t,""))}function l(e){return e.replace(/\.rsc($|\?)/,"$1")}},7092:function(e,t){"use strict";function n(e,t){if(void 0===t&&(t={}),t.onlyHashChange){e();return}let n=document.documentElement,r=n.style.scrollBehavior;n.style.scrollBehavior="auto",t.dontForceLayout||n.getClientRects(),e(),n.style.scrollBehavior=r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"handleSmoothScroll",{enumerable:!0,get:function(){return n}})},86146:function(e,t){"use strict";function n(e){return/Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isBot",{enumerable:!0,get:function(){return n}})},63381:function(e,t){"use strict";function n(e){let t=e.indexOf("#"),n=e.indexOf("?"),r=n>-1&&(t<0||n-1?{pathname:e.substring(0,r?n:t),query:r?e.substring(n,t>-1?t:void 0):"",hash:t>-1?e.slice(t):""}:{pathname:e,query:"",hash:""}}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"parsePath",{enumerable:!0,get:function(){return n}})},10580:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"pathHasPrefix",{enumerable:!0,get:function(){return o}});let r=n(63381);function o(e,t){if("string"!=typeof e)return!1;let{pathname:n}=(0,r.parsePath)(e);return n===t||n.startsWith(t+"/")}},26674:function(e,t){"use strict";function n(e){return e.replace(/\/$/,"")||"/"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"removeTrailingSlash",{enumerable:!0,get:function(){return n}})},84541:function(e,t){"use strict";function n(e){return"("===e[0]&&e.endsWith(")")}Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{DEFAULT_SEGMENT_KEY:function(){return o},PAGE_SEGMENT_KEY:function(){return r},isGroupSegment:function(){return n}});let r="__PAGE__",o="__DEFAULT__"},55501:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ServerInsertedHTMLContext:function(){return o},useServerInsertedHTML:function(){return u}});let r=n(53099)._(n(2265)),o=r.default.createContext(null);function u(e){let t=(0,r.useContext)(o);t&&t(e)}},31765:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"warnOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},47149:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"actionAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(54832).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},54832:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createAsyncLocalStorage",{enumerable:!0,get:function(){return u}});let n=Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");class r{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}}let o=globalThis.AsyncLocalStorage;function u(){return o?new o:new r}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},25575:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"requestAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(54832).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},20030:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"staticGenerationAsyncStorage",{enumerable:!0,get:function(){return r}});let r=(0,n(54832).createAsyncLocalStorage)();("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},34040:function(e,t,n){"use strict";var r=n(54887);t.createRoot=r.createRoot,t.hydrateRoot=r.hydrateRoot},54887:function(e,t,n){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(84417)},97950:function(e,t,n){"use strict";var r=n(54887),o={stream:!0},u=Object.prototype.hasOwnProperty,l=new Map;function a(e){var t=n(e);return"function"!=typeof t.then||"fulfilled"===t.status?null:(t.then(function(e){t.status="fulfilled",t.value=e},function(e){t.status="rejected",t.reason=e}),t)}function i(){}var c=new Map,s=n.u;n.u=function(e){var t=c.get(e);return void 0!==t?t:s(e)};var f=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher,d=Symbol.for("react.element"),p=Symbol.for("react.lazy"),h=Symbol.iterator,y=Array.isArray,_=Object.getPrototypeOf,v=Object.prototype,b=new WeakMap;function g(e,t,n,r){this.status=e,this.value=t,this.reason=n,this._response=r}function m(e){switch(e.status){case"resolved_model":w(e);break;case"resolved_module":M(e)}switch(e.status){case"fulfilled":return e.value;case"pending":case"blocked":case"cyclic":throw e;default:throw e.reason}}function R(e,t){for(var n=0;nh?(_=h,h=3,p++):(_=0,h=3);continue;case 2:44===(m=d[p++])?h=4:v=v<<4|(96d.length&&(m=-1)}var R=d.byteOffset+p;if(-1{switch(e){case"simple":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,u.bM)(t,l.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?(0,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,u.bM)(t,l.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,u.bM)(t,l.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,s.q)((0,u.bM)(t,l.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,u.bM)(t,l.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,s.q)((0,u.bM)(t,l.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,u.bM)(t,l.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,s.q)((0,u.bM)(t,l.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},m=(0,u.fn)("Icon"),p=a.forwardRef((e,t)=>{let{icon:r,variant:l="simple",tooltip:p,size:g=o.u8.SM,color:b,className:y}=e,v=(0,n._T)(e,["icon","variant","tooltip","size","color","className"]),w=f(l,b),{tooltipProps:C,getReferenceProps:k}=(0,i.l)();return a.createElement("span",Object.assign({ref:(0,u.lq)([t,C.refs.setReference]),className:(0,s.q)(m("root"),"inline-flex shrink-0 items-center justify-center",w.bgColor,w.textColor,w.borderColor,w.ringColor,h[l].rounded,h[l].border,h[l].shadow,h[l].ring,c[g].paddingX,c[g].paddingY,y)},k,v),a.createElement(i.Z,Object.assign({text:p},C)),a.createElement(r,{className:(0,s.q)(m("icon"),"shrink-0",d[g].height,d[g].width)}))});p.displayName="Icon"},49804:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(13241),i=r(1153),o=r(2265),s=r(9496);let u=(0,i.fn)("Col"),l=o.forwardRef((e,t)=>{let{numColSpan:r=1,numColSpanSm:i,numColSpanMd:l,numColSpanLg:c,children:d,className:h}=e,f=(0,n._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),m=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return o.createElement("div",Object.assign({ref:t,className:(0,a.q)(u("root"),(()=>{let e=m(r,s.PT),t=m(i,s.SP),n=m(l,s.VS),o=m(c,s._w);return(0,a.q)(e,t,n,o)})(),h)},f),d)});l.displayName="Col"},94789:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(5853),a=r(2265),i=r(26898),o=r(13241),s=r(1153);let u=(0,s.fn)("Callout"),l=a.forwardRef((e,t)=>{let{title:r,icon:l,color:c,className:d,children:h}=e,f=(0,n._T)(e,["title","icon","color","className","children"]);return a.createElement("div",Object.assign({ref:t,className:(0,o.q)(u("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",c?(0,o.q)((0,s.bM)(c,i.K.background).bgColor,(0,s.bM)(c,i.K.darkBorder).borderColor,(0,s.bM)(c,i.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,o.q)("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),d)},f),a.createElement("div",{className:(0,o.q)(u("header"),"flex items-start")},l?a.createElement(l,{className:(0,o.q)(u("icon"),"flex-none h-5 w-5 mr-1.5")}):null,a.createElement("h4",{className:(0,o.q)(u("title"),"font-semibold")},r)),a.createElement("p",{className:(0,o.q)(u("body"),"overflow-y-auto",h?"mt-2":"")},h))});l.displayName="Callout"},32489:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},10900:function(e,t,r){var n=r(2265);let a=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=a},91777:function(e,t,r){var n=r(2265);let a=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:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});t.Z=a},47686:function(e,t,r){var n=r(2265);let a=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:"M9 5l7 7-7 7"}))});t.Z=a},58710:function(e,t,r){var n=r(2265);let a=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:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},82182:function(e,t,r){var n=r(2265);let a=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.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});t.Z=a},79814:function(e,t,r){var n=r(2265);let a=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:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});t.Z=a},2356:function(e,t,r){var n=r(2265);let a=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:"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"}))});t.Z=a},93416:function(e,t,r){var n=r(2265);let a=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.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"}))});t.Z=a},77355:function(e,t,r){var n=r(2265);let a=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:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=a},22452:function(e,t,r){var n=r(2265);let a=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:"M12 4v16m8-8H4"}))});t.Z=a},25327:function(e,t,r){var n=r(2265);let a=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:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});t.Z=a},49084:function(e,t,r){var n=r(2265);let a=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:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=a},3497:function(e,t,r){var n=r(2265);let a=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:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))});t.Z=a},2894:function(e,t,r){r.d(t,{R:function(){return s},m:function(){return o}});var n=r(18238),a=r(7989),i=r(11255),o=class extends a.F{#e;#t;#r;#n;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||s(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#n=(0,i.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let n="pending"===this.state.status,a=!this.#n.canStart();try{if(n)t();else{this.#a({type:"pending",variables:e,isPaused:a}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e,isPaused:a})}let i=await this.#n.start();return await this.#r.config.onSuccess?.(i,e,this.state.context,this,r),await this.options.onSuccess?.(i,e,this.state.context,r),await this.#r.config.onSettled?.(i,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(i,null,e,this.state.context,r),this.#a({type:"success",data:i}),i}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#a({type:"error",error:t})}}finally{this.#r.runNext(this)}}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),n.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function s(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){r.d(t,{S:function(){return p}});var n=r(45345),a=r(21733),i=r(18238),o=r(24112),s=class extends o.l{constructor(e={}){super(),this.config=e,this.#i=new Map}#i;build(e,t,r){let i=t.queryKey,o=t.queryHash??(0,n.Rm)(i,t),s=this.get(o);return s||(s=new a.A({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){this.#i.has(e.queryHash)||(this.#i.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#i.get(e.queryHash);t&&(e.destroy(),t===e&&this.#i.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){i.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#i.get(e)}getAll(){return[...this.#i.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){i.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){i.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){i.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},u=r(2894),l=class extends o.l{constructor(e={}){super(),this.config=e,this.#o=new Set,this.#s=new Map,this.#u=0}#o;#s;#u;build(e,t,r){let n=new u.m({client:e,mutationCache:this,mutationId:++this.#u,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#o.add(e);let t=c(e);if("string"==typeof t){let r=this.#s.get(t);r?r.push(e):this.#s.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#o.delete(e)){let t=c(e);if("string"==typeof t){let r=this.#s.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#s.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=c(e);if("string"!=typeof t)return!0;{let r=this.#s.get(t),n=r?.find(e=>"pending"===e.state.status);return!n||n===e}}runNext(e){let t=c(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#s.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){i.Vr.batch(()=>{this.#o.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#o.clear(),this.#s.clear()})}getAll(){return Array.from(this.#o)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,n.X7)(e,t))}notify(e){i.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return i.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(n.ZT))))}};function c(e){return e.options.scope?.id}var d=r(87045),h=r(57853);function f(e){return{onFetch:(t,r)=>{let a=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],u={pages:[],pageParams:[]},l=0,c=async()=>{let r=!1,c=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},d=(0,n.cG)(t.options,t.fetchOptions),h=async(e,a,i)=>{if(r)return Promise.reject();if(null==a&&e.pages.length)return Promise.resolve(e);let o=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:a,direction:i?"backward":"forward",meta:t.options.meta};return c(e),e})(),s=await d(o),{maxPages:u}=t.options,l=i?n.Ht:n.VX;return{pages:l(e.pages,s,u),pageParams:l(e.pageParams,a,u)}};if(i&&o.length){let e="backward"===i,t={pages:o,pageParams:s},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:m)(a,t);u=await h(t,r,e)}else{let t=e??o.length;do{let e=0===l?s[0]??a.initialPageParam:m(a,u);if(l>0&&null==e)break;u=await h(u,e),l++}while(lt.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c}}}function m(e,{pages:t,pageParams:r}){let n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}var p=class{#l;#r;#c;#d;#h;#f;#m;#p;constructor(e={}){this.#l=e.queryCache||new s,this.#r=e.mutationCache||new l,this.#c=e.defaultOptions||{},this.#d=new Map,this.#h=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#m=d.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onFocus())}),this.#p=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#l.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#m?.(),this.#m=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#l.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#l.build(this,t),a=r.state.data;return void 0===a?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,n.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#l.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let a=this.defaultQueryOptions({queryKey:e}),i=this.#l.get(a.queryHash),o=i?.state.data,s=(0,n.SE)(t,o);if(void 0!==s)return this.#l.build(this,a).setData(s,{...r,manual:!0})}setQueriesData(e,t,r){return i.Vr.batch(()=>this.#l.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#l.get(t.queryHash)?.state}removeQueries(e){let t=this.#l;i.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#l;return i.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(i.Vr.batch(()=>this.#l.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e,t={}){return i.Vr.batch(()=>(this.#l.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(i.Vr.batch(()=>this.#l.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#l.build(this,t);return r.isStaleByTime((0,n.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=f(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}ensureInfiniteQueryData(e){return e.behavior=f(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#l}getMutationCache(){return this.#r}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#d.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#h.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#l.clear(),this.#r.clear()}}},92668:function(e,t,r){r.d(t,{I:function(){return s}});var n=r(59121),a=r(31091),i=r(63497),o=r(99649);function s(e,t){let{years:r=0,months:s=0,weeks:u=0,days:l=0,hours:c=0,minutes:d=0,seconds:h=0}=t,f=(0,o.Q)(e),m=s||r?(0,a.z)(f,s+12*r):f,p=l||u?(0,n.E)(m,l+7*u):m;return(0,i.L)(e,p.getTime()+1e3*(h+60*(d+60*c)))}},59121:function(e,t,r){r.d(t,{E:function(){return i}});var n=r(99649),a=r(63497);function i(e,t){let r=(0,n.Q)(e);return isNaN(t)?(0,a.L)(e,NaN):(t&&r.setDate(r.getDate()+t),r)}},31091:function(e,t,r){r.d(t,{z:function(){return i}});var n=r(99649),a=r(63497);function i(e,t){let r=(0,n.Q)(e);if(isNaN(t))return(0,a.L)(e,NaN);if(!t)return r;let i=r.getDate(),o=(0,a.L)(e,r.getTime());return(o.setMonth(r.getMonth()+t+1,0),i>=o.getDate())?o:(r.setFullYear(o.getFullYear(),o.getMonth(),i),r)}},63497:function(e,t,r){r.d(t,{L:function(){return n}});function n(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}},99649:function(e,t,r){r.d(t,{Q:function(){return n}});function n(e){let t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):new Date("number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?e:NaN)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2202-6fd6882207f0e000.js b/litellm/proxy/_experimental/out/_next/static/chunks/2202-a83ad035a17401aa.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/2202-6fd6882207f0e000.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2202-a83ad035a17401aa.js index d36ff56953..fe20b03d91 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2202-6fd6882207f0e000.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2202-a83ad035a17401aa.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2202],{19431:function(e,s,t){t.d(s,{x:function(){return a.Z},z:function(){return l.Z}});var l=t(78489),a=t(84264)},65925:function(e,s,t){t.d(s,{m:function(){return i}});var l=t(57437);t(2265);var a=t(37592);let{Option:r}=a.default,i=e=>e?({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||e:"Not set";s.Z=e=>{let{value:s,onChange:t,className:i="",style:n={}}=e;return(0,l.jsxs)(a.default,{style:{width:"100%",...n},value:s||void 0,onChange:t,className:i,placeholder:"n/a",allowClear:!0,children:[(0,l.jsx)(r,{value:"24h",children:"daily"}),(0,l.jsx)(r,{value:"7d",children:"weekly"}),(0,l.jsx)(r,{value:"30d",children:"monthly"})]})}},84376:function(e,s,t){var l=t(57437);t(2265);var a=t(37592);s.Z=e=>{let{teams:s,value:t,onChange:r,disabled:i}=e;return console.log("disabled",i),(0,l.jsx)(a.default,{showSearch:!0,placeholder:"Search or select a team",value:t,onChange:r,disabled:i,allowClear:!0,filterOption:(e,t)=>{if(!t)return!1;let l=null==s?void 0:s.find(e=>e.team_id===t.key);if(!l)return!1;let a=e.toLowerCase().trim(),r=(l.team_alias||"").toLowerCase(),i=(l.team_id||"").toLowerCase();return r.includes(a)||i.includes(a)},optionFilterProp:"children",children:null==s?void 0:s.map(e=>(0,l.jsxs)(a.default.Option,{value:e.team_id,children:[(0,l.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,l.jsxs)("span",{className:"text-gray-500",children:["(",e.team_id,")"]})]},e.team_id))})}},7765:function(e,s,t){t.d(s,{Z:function(){return K}});var l=t(57437),a=t(2265),r=t(37592),i=t(10032),n=t(4260),d=t(5545),o=t(22116),c=t(87452),m=t(88829),u=t(72208),x=t(78489),h=t(57365),f=t(84264),p=t(49566),j=t(96761),g=t(98187),v=t(19250),b=t(19431),y=t(57840),N=t(65319),w=t(56609),_=t(73879),C=t(34310),k=t(38434),S=t(26349),Z=t(35291),U=t(3632),I=t(15452),V=t.n(I),L=t(71157),P=t(44643),R=t(88532),E=t(29233),O=t(9114),T=e=>{let{accessToken:s,teams:t,possibleUIRoles:r,onUsersCreated:i}=e,[n,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)([]),[u,x]=(0,a.useState)(!1),[h,f]=(0,a.useState)(null),[p,j]=(0,a.useState)(null),[g,I]=(0,a.useState)(null),[T,z]=(0,a.useState)(null),[F,B]=(0,a.useState)(null),[D,M]=(0,a.useState)("http://localhost:4000");(0,a.useEffect)(()=>{(async()=>{try{let e=await (0,v.getProxyUISettings)(s);B(e)}catch(e){console.error("Error fetching UI settings:",e)}})(),M(new URL("/",window.location.href).toString())},[s]);let A=async()=>{x(!0);let e=c.map(e=>({...e,status:"pending"}));m(e);let t=!1;for(let i=0;ie.trim()).filter(Boolean),0===e.teams.length&&delete e.teams),n.models&&"string"==typeof n.models&&""!==n.models.trim()&&(e.models=n.models.split(",").map(e=>e.trim()).filter(Boolean),0===e.models.length&&delete e.models),n.max_budget&&""!==n.max_budget.toString().trim()){let s=parseFloat(n.max_budget.toString());!isNaN(s)&&s>0&&(e.max_budget=s)}n.budget_duration&&""!==n.budget_duration.trim()&&(e.budget_duration=n.budget_duration.trim()),n.metadata&&"string"==typeof n.metadata&&""!==n.metadata.trim()&&(e.metadata=n.metadata.trim()),console.log("Sending user data:",e);let a=await (0,v.userCreateCall)(s,null,e);if(console.log("Full response:",a),a&&(a.key||a.user_id)){t=!0,console.log("Success case triggered");let e=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;try{if(null==F?void 0:F.SSO_ENABLED){let e=new URL("/ui",D).toString();m(s=>s.map((s,t)=>t===i?{...s,status:"success",key:a.key||a.user_id,invitation_link:e}:s))}else{let t=await (0,v.invitationCreateCall)(s,e),l=new URL("/ui?invitation_id=".concat(t.id),D).toString();m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,invitation_link:l}:e))}}catch(e){console.error("Error creating invitation:",e),m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,error:"User created but failed to generate invitation link"}:e))}}else{console.log("Error case triggered");let e=(null==a?void 0:a.error)||"Failed to create user";console.log("Error message:",e),m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}catch(s){console.error("Caught error:",s);let e=(null==s?void 0:null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.error)||(null==s?void 0:s.message)||String(s);m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}x(!1),t&&i&&i()};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b.z,{className:"mb-0",onClick:()=>d(!0),children:"+ Bulk Invite Users"}),(0,l.jsx)(o.Z,{title:"Bulk Invite Users",visible:n,width:800,onCancel:()=>d(!1),bodyStyle:{maxHeight:"70vh",overflow:"auto"},footer:null,children:(0,l.jsx)("div",{className:"flex flex-col",children:0===c.length?(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"1"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Download and fill the template"})]}),(0,l.jsxs)("div",{className:"ml-11 mb-6",children:[(0,l.jsx)("p",{className:"mb-4",children:"Add multiple users at once by following these steps:"}),(0,l.jsxs)("ol",{className:"list-decimal list-inside space-y-2 ml-2 mb-4",children:[(0,l.jsx)("li",{children:"Download our CSV template"}),(0,l.jsx)("li",{children:"Add your users' information to the spreadsheet"}),(0,l.jsx)("li",{children:"Save the file and upload it here"}),(0,l.jsx)("li",{children:"After creation, download the results file containing the Virtual Keys for each user"})]}),(0,l.jsxs)("div",{className:"bg-gray-50 p-4 rounded-md border border-gray-200 mb-4",children:[(0,l.jsx)("h4",{className:"font-medium mb-2",children:"Template Column Names"}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_email"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:"User's email address (required)"})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_role"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'User\'s role (one of: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"teams"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated team IDs (e.g., "team-1,team-2")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"max_budget"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Maximum budget as a number (e.g., "100")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"budget_duration"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Budget reset period (e.g., "30d", "1mo")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"models"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated allowed models (e.g., "gpt-3.5-turbo,gpt-4")'})]})]})]})]}),(0,l.jsxs)(b.z,{onClick:()=>{let e=new Blob([V().unparse([["user_email","user_role","teams","max_budget","budget_duration","models"],["user@example.com","internal_user","team-id-1,team-id-2","100","30d","gpt-3.5-turbo,gpt-4"]])],{type:"text/csv"}),s=window.URL.createObjectURL(e),t=document.createElement("a");t.href=s,t.download="bulk_users_template.csv",document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(s)},size:"lg",className:"w-full md:w-auto",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download CSV Template"]})]}),(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"2"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Upload your completed CSV"})]}),(0,l.jsxs)("div",{className:"ml-11",children:[T?(0,l.jsxs)("div",{className:"mb-4 p-4 rounded-md border ".concat(g?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"),children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[g?(0,l.jsx)(C.Z,{className:"text-red-500 text-xl mr-3"}):(0,l.jsx)(k.Z,{className:"text-blue-500 text-xl mr-3"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:g?"text-red-800":"text-blue-800",children:T.name}),(0,l.jsxs)(y.default.Text,{className:"block text-xs ".concat(g?"text-red-600":"text-blue-600"),children:[(T.size/1024).toFixed(1)," KB • ",new Date().toLocaleDateString()]})]})]}),(0,l.jsxs)(b.z,{size:"xs",variant:"secondary",onClick:()=>{z(null),m([]),f(null),j(null),I(null)},className:"flex items-center",children:[(0,l.jsx)(S.Z,{className:"mr-1"})," Remove"]})]}),g?(0,l.jsxs)("div",{className:"mt-3 text-red-600 text-sm flex items-start",children:[(0,l.jsx)(Z.Z,{className:"mr-2 mt-0.5"}),(0,l.jsx)("span",{children:g})]}):!p&&(0,l.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,l.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:(0,l.jsx)("div",{className:"bg-blue-500 h-1.5 rounded-full w-full animate-pulse"})}),(0,l.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:"Processing..."})]})]}):(0,l.jsx)(N.default,{beforeUpload:e=>((f(null),j(null),I(null),z(e),"text/csv"===e.type||e.name.endsWith(".csv"))?e.size>5242880?I("File is too large (".concat((e.size/1048576).toFixed(1)," MB). Please upload a CSV file smaller than 5MB.")):V().parse(e,{complete:e=>{if(!e.data||0===e.data.length){j("The CSV file appears to be empty. Please upload a file with data."),m([]);return}if(1===e.data.length){j("The CSV file only contains headers but no user data. Please add user data to your CSV."),m([]);return}let s=e.data[0];if(0===s.length||1===s.length&&""===s[0]){j("The CSV file doesn't contain any column headers. Please make sure your CSV has headers."),m([]);return}let l=["user_email","user_role"].filter(e=>!s.includes(e));if(l.length>0){j("Your CSV is missing these required columns: ".concat(l.join(", "),". Please add these columns to your CSV file.")),m([]);return}try{let l=e.data.slice(1).map((e,l)=>{var a,r,i,n,d,o;if(0===e.length||1===e.length&&""===e[0])return null;if(e.length=parseFloat(c.max_budget.toString())&&m.push("Max budget must be greater than 0")),c.budget_duration&&!c.budget_duration.match(/^\d+[dhmwy]$|^\d+mo$/)&&m.push('Invalid budget duration format "'.concat(c.budget_duration,'". Use format like "30d", "1mo", "2w", "6h"')),c.teams&&"string"==typeof c.teams&&t&&t.length>0){let e=t.map(e=>e.team_id),s=c.teams.split(",").map(e=>e.trim()).filter(s=>!e.includes(s));s.length>0&&m.push("Unknown team(s): ".concat(s.join(", ")))}return m.length>0&&(c.isValid=!1,c.error=m.join(", ")),c}).filter(Boolean),a=l.filter(e=>e.isValid);m(l),0===l.length?j("No valid data rows found in the CSV file. Please check your file format."):0===a.length?f("No valid users found in the CSV. Please check the errors below and fix your CSV file."):a.length{f("Failed to parse CSV file: ".concat(e.message)),m([])},header:!1}):(I("Invalid file type: ".concat(e.name,". Please upload a CSV file (.csv extension).")),O.Z.fromBackend("Invalid file type. Please upload a CSV file.")),!1),accept:".csv",maxCount:1,showUploadList:!1,children:(0,l.jsxs)("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-8 text-center hover:border-blue-500 transition-colors cursor-pointer",children:[(0,l.jsx)(U.Z,{className:"text-3xl text-gray-400 mb-2"}),(0,l.jsx)("p",{className:"mb-1",children:"Drag and drop your CSV file here"}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:"or"}),(0,l.jsx)(b.z,{size:"sm",children:"Browse files"}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Only CSV files (.csv) are supported"})]})}),p&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(R.Z,{className:"h-5 w-5 text-yellow-500 mr-2 mt-0.5"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:"text-yellow-800",children:"CSV Structure Error"}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-1 mb-0",children:p}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-2 mb-0",children:"Please download our template and ensure your CSV follows the required format."})]})]})})]})]}):(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"3"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:c.some(e=>"success"===e.status||"failed"===e.status)?"User Creation Results":"Review and create users"})]}),h&&(0,l.jsx)("div",{className:"ml-11 mb-4 p-4 bg-red-50 border border-red-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(Z.Z,{className:"text-red-500 mr-2 mt-1"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"text-red-600 font-medium",children:h}),c.some(e=>!e.isValid)&&(0,l.jsxs)("ul",{className:"mt-2 list-disc list-inside text-red-600 text-sm",children:[(0,l.jsx)("li",{children:"Check the table below for specific errors in each row"}),(0,l.jsx)("li",{children:"Common issues include invalid email formats, missing required fields, or incorrect role values"}),(0,l.jsx)("li",{children:"Fix these issues in your CSV file and upload again"})]})]})]})}),(0,l.jsxs)("div",{className:"ml-11",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,l.jsx)("div",{className:"flex items-center",children:c.some(e=>"success"===e.status||"failed"===e.status)?(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"Creation Summary"}),(0,l.jsxs)(b.x,{className:"text-sm bg-green-100 text-green-800 px-2 py-1 rounded mr-2",children:[c.filter(e=>"success"===e.status).length," Successful"]}),c.some(e=>"failed"===e.status)&&(0,l.jsxs)(b.x,{className:"text-sm bg-red-100 text-red-800 px-2 py-1 rounded",children:[c.filter(e=>"failed"===e.status).length," Failed"]})]}):(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"User Preview"}),(0,l.jsxs)(b.x,{className:"text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded",children:[c.filter(e=>e.isValid).length," of ",c.length," users valid"]})]})}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex space-x-3",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]})]}),c.some(e=>"success"===e.status)&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"mr-3 mt-1",children:(0,l.jsx)(P.Z,{className:"h-5 w-5 text-blue-500"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"font-medium text-blue-800",children:"User creation complete"}),(0,l.jsxs)(b.x,{className:"block text-sm text-blue-700 mt-1",children:[(0,l.jsx)("span",{className:"font-medium",children:"Next step:"})," Download the credentials file containing Virtual Keys and invitation links. Users will need these Virtual Keys to make LLM requests through LiteLLM."]})]})]})}),(0,l.jsx)(w.Z,{dataSource:c,columns:[{title:"Row",dataIndex:"rowNumber",key:"rowNumber",width:80},{title:"Email",dataIndex:"user_email",key:"user_email"},{title:"Role",dataIndex:"user_role",key:"user_role"},{title:"Teams",dataIndex:"teams",key:"teams"},{title:"Budget",dataIndex:"max_budget",key:"max_budget"},{title:"Status",key:"status",render:(e,s)=>s.isValid?s.status&&"pending"!==s.status?"success"===s.status?(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(P.Z,{className:"h-5 w-5 text-green-500 mr-2"}),(0,l.jsx)("span",{className:"text-green-500",children:"Success"})]}),s.invitation_link&&(0,l.jsx)("div",{className:"mt-1",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:s.invitation_link}),(0,l.jsx)(E.CopyToClipboard,{text:s.invitation_link,onCopy:()=>O.Z.success("Invitation link copied!"),children:(0,l.jsx)("button",{className:"ml-1 text-blue-500 text-xs hover:text-blue-700",children:"Copy"})})]})})]}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Failed"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:JSON.stringify(s.error)})]}):(0,l.jsx)("span",{className:"text-gray-500",children:"Pending"}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Invalid"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:s.error})]})}],size:"small",pagination:{pageSize:5},scroll:{y:300},rowClassName:e=>e.isValid?"":"bg-red-50"}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]}),c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Start New Bulk Import"}),(0,l.jsxs)(b.z,{onClick:()=>{let e=c.map(e=>({user_email:e.user_email,user_role:e.user_role,status:e.status,key:e.key||"",invitation_link:e.invitation_link||"",error:e.error||""})),s=new Blob([V().unparse(e)],{type:"text/csv"}),t=window.URL.createObjectURL(s),l=document.createElement("a");l.href=t,l.download="bulk_users_results.csv",document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(t)},variant:"primary",className:"flex items-center",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download User Credentials"]})]})]})]})})})]})},z=t(99981),F=t(15424),B=t(46468),D=t(29827),M=t(84376);let{Option:A}=r.default,q=()=>"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let s=16*Math.random()|0;return("x"==e?s:3&s|8).toString(16)});var K=e=>{let{userID:s,accessToken:t,teams:b,possibleUIRoles:y,onUserCreated:N,isEmbedded:w=!1}=e,_=(0,D.NL)(),[C,k]=(0,a.useState)(null),[S]=i.Z.useForm(),[Z,U]=(0,a.useState)(!1),[I,V]=(0,a.useState)(!1),[L,P]=(0,a.useState)([]),[R,E]=(0,a.useState)(!1),[A,K]=(0,a.useState)(null),[J,W]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=async()=>{try{let e=await (0,v.modelAvailableCall)(t,s,"any"),l=[];for(let s=0;s{var l,a,r;try{O.Z.info("Making API Call"),w||U(!0),e.models&&0!==e.models.length||"proxy_admin"===e.user_role||(console.log("formValues.user_role",e.user_role),e.models=["no-default-models"]),console.log("formValues in create user:",e);let a=await (0,v.userCreateCall)(t,null,e);await _.invalidateQueries({queryKey:["userList"]}),console.log("user create Response:",a),V(!0);let r=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;if(N&&w){N(r),S.resetFields();return}if(null==C?void 0:C.SSO_ENABLED){let e={id:q(),user_id:r,is_accepted:!1,accepted_at:null,expires_at:new Date(Date.now()+6048e5),created_at:new Date,created_by:s,updated_at:new Date,updated_by:s,has_user_setup_sso:!0};K(e),E(!0)}else(0,v.invitationCreateCall)(t,r).then(e=>{e.has_user_setup_sso=!1,K(e),E(!0)});O.Z.success("API user Created"),S.resetFields(),localStorage.removeItem("userData"+s)}catch(s){let e=(null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.detail)||(null==s?void 0:s.message)||"Error creating the user";O.Z.fromBackend(e),console.error("Error creating the user:",s)}};return w?(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:"User Role",name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",name:"team_id",children:(0,l.jsx)(r.default,{placeholder:"Select Team",style:{width:"100%"},children:(0,l.jsx)(M.Z,{teams:b})})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]}):(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(x.Z,{className:"mb-0",onClick:()=>U(!0),children:"+ Invite User"}),(0,l.jsx)(T,{accessToken:t,teams:b,possibleUIRoles:y}),(0,l.jsxs)(o.Z,{title:"Invite User",visible:Z,width:800,footer:null,onOk:()=>{U(!1),S.resetFields()},onCancel:()=>{U(!1),V(!1),S.resetFields()},children:[(0,l.jsx)(f.Z,{className:"mb-1",children:"Create a User who can own keys"}),(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:(0,l.jsxs)("span",{children:["Global Proxy Role"," ",(0,l.jsx)(z.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,l.jsx)(F.Z,{})})]}),name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",className:"gap-2",name:"team_id",help:"If selected, user will be added as a 'user' role to the team.",children:(0,l.jsx)(M.Z,{teams:b})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsxs)(c.Z,{children:[(0,l.jsx)(u.Z,{children:(0,l.jsx)(j.Z,{children:"Personal Key Creation"})}),(0,l.jsx)(m.Z,{children:(0,l.jsx)(i.Z.Item,{className:"gap-2",label:(0,l.jsxs)("span",{children:["Models"," ",(0,l.jsx)(z.Z,{title:"Models user has access to, outside of team scope.",children:(0,l.jsx)(F.Z,{style:{marginLeft:"4px"}})})]}),name:"models",help:"Models user has access to, outside of team scope.",children:(0,l.jsxs)(r.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,l.jsx)(r.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,l.jsx)(r.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),L.map(e=>(0,l.jsx)(r.default.Option,{value:e,children:(0,B.W0)(e)},e))]})})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]})]}),I&&(0,l.jsx)(g.Z,{isInvitationLinkModalVisible:R,setIsInvitationLinkModalVisible:E,baseUrl:J||"",invitationLinkData:A})]})}},98187:function(e,s,t){t.d(s,{Z:function(){return o}});var l=t(57437);t(2265);var a=t(57840),r=t(22116),i=t(29233),n=t(19431),d=t(9114);function o(e){let{isInvitationLinkModalVisible:s,setIsInvitationLinkModalVisible:t,baseUrl:o,invitationLinkData:c,modalType:m="invitation"}=e,{Title:u,Paragraph:x}=a.default,h=()=>{if(!o)return"";let e=new URL(o).pathname,s=e&&"/"!==e?"".concat(e,"/ui"):"ui";if(null==c?void 0:c.has_user_setup_sso)return new URL(s,o).toString();let t="".concat(s,"?invitation_id=").concat(null==c?void 0:c.id);return"resetPassword"===m&&(t+="&action=reset_password"),new URL(t,o).toString()};return(0,l.jsxs)(r.Z,{title:"invitation"===m?"Invitation Link":"Reset Password Link",visible:s,width:800,footer:null,onOk:()=>{t(!1)},onCancel:()=>{t(!1)},children:[(0,l.jsx)(x,{children:"invitation"===m?"Copy and send the generated link to onboard this user to the proxy.":"Copy and send the generated link to the user to reset their password."}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{className:"text-base",children:"User ID"}),(0,l.jsx)(n.x,{children:null==c?void 0:c.user_id})]}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{children:"invitation"===m?"Invitation Link":"Reset Password Link"}),(0,l.jsx)(n.x,{children:(0,l.jsx)(n.x,{children:h()})})]}),(0,l.jsx)("div",{className:"flex justify-end mt-5",children:(0,l.jsx)(i.CopyToClipboard,{text:h(),onCopy:()=>d.Z.success("Copied!"),children:(0,l.jsx)(n.z,{variant:"primary",children:"invitation"===m?"Copy invitation link":"Copy password reset link"})})})]})}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2202],{19431:function(e,s,t){t.d(s,{x:function(){return a.Z},z:function(){return l.Z}});var l=t(78489),a=t(84264)},65925:function(e,s,t){t.d(s,{m:function(){return i}});var l=t(57437);t(2265);var a=t(37592);let{Option:r}=a.default,i=e=>e?({"24h":"daily","7d":"weekly","30d":"monthly"})[e]||e:"Not set";s.Z=e=>{let{value:s,onChange:t,className:i="",style:n={}}=e;return(0,l.jsxs)(a.default,{style:{width:"100%",...n},value:s||void 0,onChange:t,className:i,placeholder:"n/a",allowClear:!0,children:[(0,l.jsx)(r,{value:"24h",children:"daily"}),(0,l.jsx)(r,{value:"7d",children:"weekly"}),(0,l.jsx)(r,{value:"30d",children:"monthly"})]})}},84376:function(e,s,t){var l=t(57437);t(2265);var a=t(37592);s.Z=e=>{let{teams:s,value:t,onChange:r,disabled:i}=e;return console.log("disabled",i),(0,l.jsx)(a.default,{showSearch:!0,placeholder:"Search or select a team",value:t,onChange:r,disabled:i,allowClear:!0,filterOption:(e,t)=>{if(!t)return!1;let l=null==s?void 0:s.find(e=>e.team_id===t.key);if(!l)return!1;let a=e.toLowerCase().trim(),r=(l.team_alias||"").toLowerCase(),i=(l.team_id||"").toLowerCase();return r.includes(a)||i.includes(a)},optionFilterProp:"children",children:null==s?void 0:s.map(e=>(0,l.jsxs)(a.default.Option,{value:e.team_id,children:[(0,l.jsx)("span",{className:"font-medium",children:e.team_alias})," ",(0,l.jsxs)("span",{className:"text-gray-500",children:["(",e.team_id,")"]})]},e.team_id))})}},7765:function(e,s,t){t.d(s,{Z:function(){return K}});var l=t(57437),a=t(2265),r=t(37592),i=t(10032),n=t(4260),d=t(5545),o=t(22116),c=t(87452),m=t(88829),u=t(72208),x=t(78489),h=t(43227),f=t(84264),p=t(49566),j=t(96761),g=t(98187),v=t(19250),b=t(19431),y=t(57840),N=t(65319),w=t(56609),_=t(73879),C=t(34310),k=t(38434),S=t(26349),Z=t(35291),U=t(3632),I=t(15452),V=t.n(I),L=t(71157),P=t(44643),R=t(88532),E=t(29233),O=t(9114),T=e=>{let{accessToken:s,teams:t,possibleUIRoles:r,onUsersCreated:i}=e,[n,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)([]),[u,x]=(0,a.useState)(!1),[h,f]=(0,a.useState)(null),[p,j]=(0,a.useState)(null),[g,I]=(0,a.useState)(null),[T,z]=(0,a.useState)(null),[F,B]=(0,a.useState)(null),[D,M]=(0,a.useState)("http://localhost:4000");(0,a.useEffect)(()=>{(async()=>{try{let e=await (0,v.getProxyUISettings)(s);B(e)}catch(e){console.error("Error fetching UI settings:",e)}})(),M(new URL("/",window.location.href).toString())},[s]);let A=async()=>{x(!0);let e=c.map(e=>({...e,status:"pending"}));m(e);let t=!1;for(let i=0;ie.trim()).filter(Boolean),0===e.teams.length&&delete e.teams),n.models&&"string"==typeof n.models&&""!==n.models.trim()&&(e.models=n.models.split(",").map(e=>e.trim()).filter(Boolean),0===e.models.length&&delete e.models),n.max_budget&&""!==n.max_budget.toString().trim()){let s=parseFloat(n.max_budget.toString());!isNaN(s)&&s>0&&(e.max_budget=s)}n.budget_duration&&""!==n.budget_duration.trim()&&(e.budget_duration=n.budget_duration.trim()),n.metadata&&"string"==typeof n.metadata&&""!==n.metadata.trim()&&(e.metadata=n.metadata.trim()),console.log("Sending user data:",e);let a=await (0,v.userCreateCall)(s,null,e);if(console.log("Full response:",a),a&&(a.key||a.user_id)){t=!0,console.log("Success case triggered");let e=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;try{if(null==F?void 0:F.SSO_ENABLED){let e=new URL("/ui",D).toString();m(s=>s.map((s,t)=>t===i?{...s,status:"success",key:a.key||a.user_id,invitation_link:e}:s))}else{let t=await (0,v.invitationCreateCall)(s,e),l=new URL("/ui?invitation_id=".concat(t.id),D).toString();m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,invitation_link:l}:e))}}catch(e){console.error("Error creating invitation:",e),m(e=>e.map((e,s)=>s===i?{...e,status:"success",key:a.key||a.user_id,error:"User created but failed to generate invitation link"}:e))}}else{console.log("Error case triggered");let e=(null==a?void 0:a.error)||"Failed to create user";console.log("Error message:",e),m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}catch(s){console.error("Caught error:",s);let e=(null==s?void 0:null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.error)||(null==s?void 0:s.message)||String(s);m(s=>s.map((s,t)=>t===i?{...s,status:"failed",error:e}:s))}}x(!1),t&&i&&i()};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(b.z,{className:"mb-0",onClick:()=>d(!0),children:"+ Bulk Invite Users"}),(0,l.jsx)(o.Z,{title:"Bulk Invite Users",visible:n,width:800,onCancel:()=>d(!1),bodyStyle:{maxHeight:"70vh",overflow:"auto"},footer:null,children:(0,l.jsx)("div",{className:"flex flex-col",children:0===c.length?(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"1"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Download and fill the template"})]}),(0,l.jsxs)("div",{className:"ml-11 mb-6",children:[(0,l.jsx)("p",{className:"mb-4",children:"Add multiple users at once by following these steps:"}),(0,l.jsxs)("ol",{className:"list-decimal list-inside space-y-2 ml-2 mb-4",children:[(0,l.jsx)("li",{children:"Download our CSV template"}),(0,l.jsx)("li",{children:"Add your users' information to the spreadsheet"}),(0,l.jsx)("li",{children:"Save the file and upload it here"}),(0,l.jsx)("li",{children:"After creation, download the results file containing the Virtual Keys for each user"})]}),(0,l.jsxs)("div",{className:"bg-gray-50 p-4 rounded-md border border-gray-200 mb-4",children:[(0,l.jsx)("h4",{className:"font-medium mb-2",children:"Template Column Names"}),(0,l.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_email"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:"User's email address (required)"})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-red-500 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"user_role"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'User\'s role (one of: "proxy_admin", "proxy_admin_viewer", "internal_user", "internal_user_viewer")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"teams"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated team IDs (e.g., "team-1,team-2")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"max_budget"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Maximum budget as a number (e.g., "100")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"budget_duration"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Budget reset period (e.g., "30d", "1mo")'})]})]}),(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"w-3 h-3 rounded-full bg-gray-300 mt-1.5 mr-2 flex-shrink-0"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"models"}),(0,l.jsx)("p",{className:"text-sm text-gray-600",children:'Comma-separated allowed models (e.g., "gpt-3.5-turbo,gpt-4")'})]})]})]})]}),(0,l.jsxs)(b.z,{onClick:()=>{let e=new Blob([V().unparse([["user_email","user_role","teams","max_budget","budget_duration","models"],["user@example.com","internal_user","team-id-1,team-id-2","100","30d","gpt-3.5-turbo,gpt-4"]])],{type:"text/csv"}),s=window.URL.createObjectURL(e),t=document.createElement("a");t.href=s,t.download="bulk_users_template.csv",document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(s)},size:"lg",className:"w-full md:w-auto",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download CSV Template"]})]}),(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"2"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:"Upload your completed CSV"})]}),(0,l.jsxs)("div",{className:"ml-11",children:[T?(0,l.jsxs)("div",{className:"mb-4 p-4 rounded-md border ".concat(g?"bg-red-50 border-red-200":"bg-blue-50 border-blue-200"),children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[g?(0,l.jsx)(C.Z,{className:"text-red-500 text-xl mr-3"}):(0,l.jsx)(k.Z,{className:"text-blue-500 text-xl mr-3"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:g?"text-red-800":"text-blue-800",children:T.name}),(0,l.jsxs)(y.default.Text,{className:"block text-xs ".concat(g?"text-red-600":"text-blue-600"),children:[(T.size/1024).toFixed(1)," KB • ",new Date().toLocaleDateString()]})]})]}),(0,l.jsxs)(b.z,{size:"xs",variant:"secondary",onClick:()=>{z(null),m([]),f(null),j(null),I(null)},className:"flex items-center",children:[(0,l.jsx)(S.Z,{className:"mr-1"})," Remove"]})]}),g?(0,l.jsxs)("div",{className:"mt-3 text-red-600 text-sm flex items-start",children:[(0,l.jsx)(Z.Z,{className:"mr-2 mt-0.5"}),(0,l.jsx)("span",{children:g})]}):!p&&(0,l.jsxs)("div",{className:"mt-3 flex items-center",children:[(0,l.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:(0,l.jsx)("div",{className:"bg-blue-500 h-1.5 rounded-full w-full animate-pulse"})}),(0,l.jsx)("span",{className:"ml-2 text-xs text-blue-600",children:"Processing..."})]})]}):(0,l.jsx)(N.default,{beforeUpload:e=>((f(null),j(null),I(null),z(e),"text/csv"===e.type||e.name.endsWith(".csv"))?e.size>5242880?I("File is too large (".concat((e.size/1048576).toFixed(1)," MB). Please upload a CSV file smaller than 5MB.")):V().parse(e,{complete:e=>{if(!e.data||0===e.data.length){j("The CSV file appears to be empty. Please upload a file with data."),m([]);return}if(1===e.data.length){j("The CSV file only contains headers but no user data. Please add user data to your CSV."),m([]);return}let s=e.data[0];if(0===s.length||1===s.length&&""===s[0]){j("The CSV file doesn't contain any column headers. Please make sure your CSV has headers."),m([]);return}let l=["user_email","user_role"].filter(e=>!s.includes(e));if(l.length>0){j("Your CSV is missing these required columns: ".concat(l.join(", "),". Please add these columns to your CSV file.")),m([]);return}try{let l=e.data.slice(1).map((e,l)=>{var a,r,i,n,d,o;if(0===e.length||1===e.length&&""===e[0])return null;if(e.length=parseFloat(c.max_budget.toString())&&m.push("Max budget must be greater than 0")),c.budget_duration&&!c.budget_duration.match(/^\d+[dhmwy]$|^\d+mo$/)&&m.push('Invalid budget duration format "'.concat(c.budget_duration,'". Use format like "30d", "1mo", "2w", "6h"')),c.teams&&"string"==typeof c.teams&&t&&t.length>0){let e=t.map(e=>e.team_id),s=c.teams.split(",").map(e=>e.trim()).filter(s=>!e.includes(s));s.length>0&&m.push("Unknown team(s): ".concat(s.join(", ")))}return m.length>0&&(c.isValid=!1,c.error=m.join(", ")),c}).filter(Boolean),a=l.filter(e=>e.isValid);m(l),0===l.length?j("No valid data rows found in the CSV file. Please check your file format."):0===a.length?f("No valid users found in the CSV. Please check the errors below and fix your CSV file."):a.length{f("Failed to parse CSV file: ".concat(e.message)),m([])},header:!1}):(I("Invalid file type: ".concat(e.name,". Please upload a CSV file (.csv extension).")),O.Z.fromBackend("Invalid file type. Please upload a CSV file.")),!1),accept:".csv",maxCount:1,showUploadList:!1,children:(0,l.jsxs)("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-8 text-center hover:border-blue-500 transition-colors cursor-pointer",children:[(0,l.jsx)(U.Z,{className:"text-3xl text-gray-400 mb-2"}),(0,l.jsx)("p",{className:"mb-1",children:"Drag and drop your CSV file here"}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mb-3",children:"or"}),(0,l.jsx)(b.z,{size:"sm",children:"Browse files"}),(0,l.jsx)("p",{className:"text-xs text-gray-500 mt-4",children:"Only CSV files (.csv) are supported"})]})}),p&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(R.Z,{className:"h-5 w-5 text-yellow-500 mr-2 mt-0.5"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(y.default.Text,{strong:!0,className:"text-yellow-800",children:"CSV Structure Error"}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-1 mb-0",children:p}),(0,l.jsx)(y.default.Paragraph,{className:"text-yellow-700 mt-2 mb-0",children:"Please download our template and ensure your CSV follows the required format."})]})]})})]})]}):(0,l.jsxs)("div",{className:"mb-6",children:[(0,l.jsxs)("div",{className:"flex items-center mb-4",children:[(0,l.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3",children:"3"}),(0,l.jsx)("h3",{className:"text-lg font-medium",children:c.some(e=>"success"===e.status||"failed"===e.status)?"User Creation Results":"Review and create users"})]}),h&&(0,l.jsx)("div",{className:"ml-11 mb-4 p-4 bg-red-50 border border-red-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)(Z.Z,{className:"text-red-500 mr-2 mt-1"}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"text-red-600 font-medium",children:h}),c.some(e=>!e.isValid)&&(0,l.jsxs)("ul",{className:"mt-2 list-disc list-inside text-red-600 text-sm",children:[(0,l.jsx)("li",{children:"Check the table below for specific errors in each row"}),(0,l.jsx)("li",{children:"Common issues include invalid email formats, missing required fields, or incorrect role values"}),(0,l.jsx)("li",{children:"Fix these issues in your CSV file and upload again"})]})]})]})}),(0,l.jsxs)("div",{className:"ml-11",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center mb-3",children:[(0,l.jsx)("div",{className:"flex items-center",children:c.some(e=>"success"===e.status||"failed"===e.status)?(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"Creation Summary"}),(0,l.jsxs)(b.x,{className:"text-sm bg-green-100 text-green-800 px-2 py-1 rounded mr-2",children:[c.filter(e=>"success"===e.status).length," Successful"]}),c.some(e=>"failed"===e.status)&&(0,l.jsxs)(b.x,{className:"text-sm bg-red-100 text-red-800 px-2 py-1 rounded",children:[c.filter(e=>"failed"===e.status).length," Failed"]})]}):(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(b.x,{className:"text-lg font-medium mr-3",children:"User Preview"}),(0,l.jsxs)(b.x,{className:"text-sm bg-blue-100 text-blue-800 px-2 py-1 rounded",children:[c.filter(e=>e.isValid).length," of ",c.length," users valid"]})]})}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex space-x-3",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]})]}),c.some(e=>"success"===e.status)&&(0,l.jsx)("div",{className:"mb-4 p-4 bg-blue-50 border border-blue-200 rounded-md",children:(0,l.jsxs)("div",{className:"flex items-start",children:[(0,l.jsx)("div",{className:"mr-3 mt-1",children:(0,l.jsx)(P.Z,{className:"h-5 w-5 text-blue-500"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)(b.x,{className:"font-medium text-blue-800",children:"User creation complete"}),(0,l.jsxs)(b.x,{className:"block text-sm text-blue-700 mt-1",children:[(0,l.jsx)("span",{className:"font-medium",children:"Next step:"})," Download the credentials file containing Virtual Keys and invitation links. Users will need these Virtual Keys to make LLM requests through LiteLLM."]})]})]})}),(0,l.jsx)(w.Z,{dataSource:c,columns:[{title:"Row",dataIndex:"rowNumber",key:"rowNumber",width:80},{title:"Email",dataIndex:"user_email",key:"user_email"},{title:"Role",dataIndex:"user_role",key:"user_role"},{title:"Teams",dataIndex:"teams",key:"teams"},{title:"Budget",dataIndex:"max_budget",key:"max_budget"},{title:"Status",key:"status",render:(e,s)=>s.isValid?s.status&&"pending"!==s.status?"success"===s.status?(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(P.Z,{className:"h-5 w-5 text-green-500 mr-2"}),(0,l.jsx)("span",{className:"text-green-500",children:"Success"})]}),s.invitation_link&&(0,l.jsx)("div",{className:"mt-1",children:(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:s.invitation_link}),(0,l.jsx)(E.CopyToClipboard,{text:s.invitation_link,onCopy:()=>O.Z.success("Invitation link copied!"),children:(0,l.jsx)("button",{className:"ml-1 text-blue-500 text-xs hover:text-blue-700",children:"Copy"})})]})})]}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Failed"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:JSON.stringify(s.error)})]}):(0,l.jsx)("span",{className:"text-gray-500",children:"Pending"}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)(L.Z,{className:"h-5 w-5 text-red-500 mr-2"}),(0,l.jsx)("span",{className:"text-red-500",children:"Invalid"})]}),s.error&&(0,l.jsx)("span",{className:"text-sm text-red-500 ml-7",children:s.error})]})}],size:"small",pagination:{pageSize:5},scroll:{y:300},rowClassName:e=>e.isValid?"":"bg-red-50"}),!c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Back"}),(0,l.jsx)(b.z,{onClick:A,disabled:0===c.filter(e=>e.isValid).length||u,children:u?"Creating...":"Create ".concat(c.filter(e=>e.isValid).length," Users")})]}),c.some(e=>"success"===e.status||"failed"===e.status)&&(0,l.jsxs)("div",{className:"flex justify-end mt-4",children:[(0,l.jsx)(b.z,{onClick:()=>{m([]),f(null)},variant:"secondary",className:"mr-3",children:"Start New Bulk Import"}),(0,l.jsxs)(b.z,{onClick:()=>{let e=c.map(e=>({user_email:e.user_email,user_role:e.user_role,status:e.status,key:e.key||"",invitation_link:e.invitation_link||"",error:e.error||""})),s=new Blob([V().unparse(e)],{type:"text/csv"}),t=window.URL.createObjectURL(s),l=document.createElement("a");l.href=t,l.download="bulk_users_results.csv",document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(t)},variant:"primary",className:"flex items-center",children:[(0,l.jsx)(_.Z,{className:"mr-2"})," Download User Credentials"]})]})]})]})})})]})},z=t(99981),F=t(15424),B=t(46468),D=t(29827),M=t(84376);let{Option:A}=r.default,q=()=>"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let s=16*Math.random()|0;return("x"==e?s:3&s|8).toString(16)});var K=e=>{let{userID:s,accessToken:t,teams:b,possibleUIRoles:y,onUserCreated:N,isEmbedded:w=!1}=e,_=(0,D.NL)(),[C,k]=(0,a.useState)(null),[S]=i.Z.useForm(),[Z,U]=(0,a.useState)(!1),[I,V]=(0,a.useState)(!1),[L,P]=(0,a.useState)([]),[R,E]=(0,a.useState)(!1),[A,K]=(0,a.useState)(null),[J,W]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=async()=>{try{let e=await (0,v.modelAvailableCall)(t,s,"any"),l=[];for(let s=0;s{var l,a,r;try{O.Z.info("Making API Call"),w||U(!0),e.models&&0!==e.models.length||"proxy_admin"===e.user_role||(console.log("formValues.user_role",e.user_role),e.models=["no-default-models"]),console.log("formValues in create user:",e);let a=await (0,v.userCreateCall)(t,null,e);await _.invalidateQueries({queryKey:["userList"]}),console.log("user create Response:",a),V(!0);let r=(null===(l=a.data)||void 0===l?void 0:l.user_id)||a.user_id;if(N&&w){N(r),S.resetFields();return}if(null==C?void 0:C.SSO_ENABLED){let e={id:q(),user_id:r,is_accepted:!1,accepted_at:null,expires_at:new Date(Date.now()+6048e5),created_at:new Date,created_by:s,updated_at:new Date,updated_by:s,has_user_setup_sso:!0};K(e),E(!0)}else(0,v.invitationCreateCall)(t,r).then(e=>{e.has_user_setup_sso=!1,K(e),E(!0)});O.Z.success("API user Created"),S.resetFields(),localStorage.removeItem("userData"+s)}catch(s){let e=(null===(r=s.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.detail)||(null==s?void 0:s.message)||"Error creating the user";O.Z.fromBackend(e),console.error("Error creating the user:",s)}};return w?(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:"User Role",name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",name:"team_id",children:(0,l.jsx)(r.default,{placeholder:"Select Team",style:{width:"100%"},children:(0,l.jsx)(M.Z,{teams:b})})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]}):(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(x.Z,{className:"mb-0",onClick:()=>U(!0),children:"+ Invite User"}),(0,l.jsx)(T,{accessToken:t,teams:b,possibleUIRoles:y}),(0,l.jsxs)(o.Z,{title:"Invite User",visible:Z,width:800,footer:null,onOk:()=>{U(!1),S.resetFields()},onCancel:()=>{U(!1),V(!1),S.resetFields()},children:[(0,l.jsx)(f.Z,{className:"mb-1",children:"Create a User who can own keys"}),(0,l.jsxs)(i.Z,{form:S,onFinish:$,labelCol:{span:8},wrapperCol:{span:16},labelAlign:"left",children:[(0,l.jsx)(i.Z.Item,{label:"User Email",name:"user_email",children:(0,l.jsx)(p.Z,{placeholder:""})}),(0,l.jsx)(i.Z.Item,{label:(0,l.jsxs)("span",{children:["Global Proxy Role"," ",(0,l.jsx)(z.Z,{title:"This is the role that the user will globally on the proxy. This role is independent of any team/org specific roles.",children:(0,l.jsx)(F.Z,{})})]}),name:"user_role",children:(0,l.jsx)(r.default,{children:y&&Object.entries(y).map(e=>{let[s,{ui_label:t,description:a}]=e;return(0,l.jsx)(h.Z,{value:s,title:t,children:(0,l.jsxs)("div",{className:"flex",children:[t," ",(0,l.jsx)("p",{className:"ml-2",style:{color:"gray",fontSize:"12px"},children:a})]})},s)})})}),(0,l.jsx)(i.Z.Item,{label:"Team",className:"gap-2",name:"team_id",help:"If selected, user will be added as a 'user' role to the team.",children:(0,l.jsx)(M.Z,{teams:b})}),(0,l.jsx)(i.Z.Item,{label:"Metadata",name:"metadata",children:(0,l.jsx)(n.default.TextArea,{rows:4,placeholder:"Enter metadata as JSON"})}),(0,l.jsxs)(c.Z,{children:[(0,l.jsx)(u.Z,{children:(0,l.jsx)(j.Z,{children:"Personal Key Creation"})}),(0,l.jsx)(m.Z,{children:(0,l.jsx)(i.Z.Item,{className:"gap-2",label:(0,l.jsxs)("span",{children:["Models"," ",(0,l.jsx)(z.Z,{title:"Models user has access to, outside of team scope.",children:(0,l.jsx)(F.Z,{style:{marginLeft:"4px"}})})]}),name:"models",help:"Models user has access to, outside of team scope.",children:(0,l.jsxs)(r.default,{mode:"multiple",placeholder:"Select models",style:{width:"100%"},children:[(0,l.jsx)(r.default.Option,{value:"all-proxy-models",children:"All Proxy Models"},"all-proxy-models"),(0,l.jsx)(r.default.Option,{value:"no-default-models",children:"No Default Models"},"no-default-models"),L.map(e=>(0,l.jsx)(r.default.Option,{value:e,children:(0,B.W0)(e)},e))]})})})]}),(0,l.jsx)("div",{style:{textAlign:"right",marginTop:"10px"},children:(0,l.jsx)(d.ZP,{htmlType:"submit",children:"Create User"})})]})]}),I&&(0,l.jsx)(g.Z,{isInvitationLinkModalVisible:R,setIsInvitationLinkModalVisible:E,baseUrl:J||"",invitationLinkData:A})]})}},98187:function(e,s,t){t.d(s,{Z:function(){return o}});var l=t(57437);t(2265);var a=t(57840),r=t(22116),i=t(29233),n=t(19431),d=t(9114);function o(e){let{isInvitationLinkModalVisible:s,setIsInvitationLinkModalVisible:t,baseUrl:o,invitationLinkData:c,modalType:m="invitation"}=e,{Title:u,Paragraph:x}=a.default,h=()=>{if(!o)return"";let e=new URL(o).pathname,s=e&&"/"!==e?"".concat(e,"/ui"):"ui";if(null==c?void 0:c.has_user_setup_sso)return new URL(s,o).toString();let t="".concat(s,"?invitation_id=").concat(null==c?void 0:c.id);return"resetPassword"===m&&(t+="&action=reset_password"),new URL(t,o).toString()};return(0,l.jsxs)(r.Z,{title:"invitation"===m?"Invitation Link":"Reset Password Link",visible:s,width:800,footer:null,onOk:()=>{t(!1)},onCancel:()=>{t(!1)},children:[(0,l.jsx)(x,{children:"invitation"===m?"Copy and send the generated link to onboard this user to the proxy.":"Copy and send the generated link to the user to reset their password."}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{className:"text-base",children:"User ID"}),(0,l.jsx)(n.x,{children:null==c?void 0:c.user_id})]}),(0,l.jsxs)("div",{className:"flex justify-between pt-5 pb-2",children:[(0,l.jsx)(n.x,{children:"invitation"===m?"Invitation Link":"Reset Password Link"}),(0,l.jsx)(n.x,{children:(0,l.jsx)(n.x,{children:h()})})]}),(0,l.jsx)("div",{className:"flex justify-end mt-5",children:(0,l.jsx)(i.CopyToClipboard,{text:h(),onCopy:()=>d.Z.success("Copied!"),children:(0,l.jsx)(n.z,{variant:"primary",children:"invitation"===m?"Copy invitation link":"Copy password reset link"})})})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2227-5ae3f36b0a81c5b4.js b/litellm/proxy/_experimental/out/_next/static/chunks/2227-5ae3f36b0a81c5b4.js new file mode 100644 index 0000000000..58d3db1949 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2227-5ae3f36b0a81c5b4.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2227],{75105:function(e,t,n){"use strict";n.d(t,{Z:function(){return eo}});var r=n(5853),o=n(2265),i=n(47625),a=n(93765),l=n(61994),c=n(84735),s=n(86757),u=n.n(s),d=n(95645),p=n.n(d),f=n(77571),m=n.n(f),h=n(82559),y=n.n(h),v=n(21652),b=n.n(v),g=n(57165),k=n(81889),x=n(9841),A=n(58772),O=n(34067),w=n(16630),j=n(85355),E=n(82944),P=["layout","type","stroke","connectNulls","isRange","ref"],S=["key"];function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function N(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function C(){return(C=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!b()(l,r)||!b()(c,o))?this.renderAreaWithAnimation(e,t):this.renderAreaStatically(r,o,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,r=t.dot,i=t.points,a=t.className,c=t.top,s=t.left,u=t.xAxis,d=t.yAxis,p=t.width,f=t.height,h=t.isAnimationActive,y=t.id;if(n||!i||!i.length)return null;var v=this.state.isAnimationFinished,b=1===i.length,g=(0,l.Z)("recharts-area",a),k=u&&u.allowDataOverflow,O=d&&d.allowDataOverflow,w=k||O,j=m()(y)?this.id:y,P=null!==(e=(0,E.L6)(r,!1))&&void 0!==e?e:{r:3,strokeWidth:2},S=P.r,L=P.strokeWidth,N=((0,E.jf)(r)?r:{}).clipDot,C=void 0===N||N,T=2*(void 0===S?3:S)+(void 0===L?2:L);return o.createElement(x.m,{className:g},k||O?o.createElement("defs",null,o.createElement("clipPath",{id:"clipPath-".concat(j)},o.createElement("rect",{x:k?s:s-p/2,y:O?c:c-f/2,width:k?p:2*p,height:O?f:2*f})),!C&&o.createElement("clipPath",{id:"clipPath-dots-".concat(j)},o.createElement("rect",{x:s-T/2,y:c-T/2,width:p+T,height:f+T}))):null,b?null:this.renderArea(w,j),(r||b)&&this.renderDots(w,C,j),(!h||v)&&A.e.renderCallByParent(this.props,i))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,curBaseLine:e.baseLine,prevPoints:t.curPoints,prevBaseLine:t.curBaseLine}:e.points!==t.curPoints||e.baseLine!==t.curBaseLine?{curPoints:e.points,curBaseLine:e.baseLine}:null}}],t&&D(r.prototype,t),n&&D(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(o.PureComponent);B(K,"displayName","Area"),B(K,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!O.x.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"}),B(K,"getBaseValue",function(e,t,n,r){var o=e.layout,i=e.baseValue,a=t.props.baseValue,l=null!=a?a:i;if((0,w.hj)(l)&&"number"==typeof l)return l;var c="horizontal"===o?r:n,s=c.scale.domain();if("number"===c.type){var u=Math.max(s[0],s[1]),d=Math.min(s[0],s[1]);return"dataMin"===l?d:"dataMax"===l?u:u<0?u:Math.max(Math.min(s[0],s[1]),0)}return"dataMin"===l?s[0]:"dataMax"===l?s[1]:s[0]}),B(K,"getComposedData",function(e){var t,n=e.props,r=e.item,o=e.xAxis,i=e.yAxis,a=e.xAxisTicks,l=e.yAxisTicks,c=e.bandSize,s=e.dataKey,u=e.stackedData,d=e.dataStartIndex,p=e.displayedData,f=e.offset,m=n.layout,h=u&&u.length,y=K.getBaseValue(n,r,o,i),v="horizontal"===m,b=!1,g=p.map(function(e,t){h?n=u[d+t]:Array.isArray(n=(0,j.F$)(e,s))?b=!0:n=[y,n];var n,r=null==n[1]||h&&null==(0,j.F$)(e,s);return v?{x:(0,j.Hv)({axis:o,ticks:a,bandSize:c,entry:e,index:t}),y:r?null:i.scale(n[1]),value:n,payload:e}:{x:r?null:o.scale(n[1]),y:(0,j.Hv)({axis:i,ticks:l,bandSize:c,entry:e,index:t}),value:n,payload:e}});return t=h||b?g.map(function(e){var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:null!=t&&null!=e.y?i.scale(t):null}:{x:null!=t?o.scale(t):null,y:e.y}}):v?i.scale(y):o.scale(y),R({points:g,baseLine:t,layout:m,isRange:b},f)}),B(K,"renderDotItem",function(e,t){var n;if(o.isValidElement(e))n=o.cloneElement(e,t);else if(u()(e))n=e(t);else{var r=(0,l.Z)("recharts-area-dot","boolean"!=typeof e?e.className:""),i=t.key,a=N(t,S);n=o.createElement(k.o,C({},a,{key:i,className:r}))}return n});var _=n(97059),H=n(62994),W=n(25311),z=(0,a.z)({chartName:"AreaChart",GraphicalChild:K,axisComponents:[{axisType:"xAxis",AxisComp:_.K},{axisType:"yAxis",AxisComp:H.B}],formatAxisMap:W.t9}),V=n(56940),G=n(26680),q=n(8147),$=n(22190),X=n(54061),U=n(65278),Y=n(98593),Q=n(92666),J=n(32644),ee=n(7084),et=n(26898),en=n(13241),er=n(1153);let eo=o.forwardRef((e,t)=>{let{data:n=[],categories:a=[],index:l,stack:c=!1,colors:s=et.s,valueFormatter:u=er.Cj,startEndOnly:d=!1,showXAxis:p=!0,showYAxis:f=!0,yAxisWidth:m=56,intervalType:h="equidistantPreserveStart",showAnimation:y=!1,animationDuration:v=900,showTooltip:b=!0,showLegend:g=!0,showGridLines:x=!0,showGradient:A=!0,autoMinValue:O=!1,curveType:w="linear",minValue:j,maxValue:E,connectNulls:P=!1,allowDecimals:S=!0,noDataText:L,className:N,onValueChange:C,enableLegendSlider:T=!1,customTooltip:R,rotateLabelX:D,padding:M=(p||f)&&(!d||f)?{left:20,right:20}:{left:0,right:0},tickGap:I=5,xAxisLabel:Z,yAxisLabel:B}=e,F=(0,r._T)(e,["data","categories","index","stack","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","showAnimation","animationDuration","showTooltip","showLegend","showGridLines","showGradient","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),[W,eo]=(0,o.useState)(60),[ei,ea]=(0,o.useState)(void 0),[el,ec]=(0,o.useState)(void 0),es=(0,J.me)(a,s),eu=(0,J.i4)(O,j,E),ed=!!C;function ep(e){ed&&(e===el&&!ei||(0,J.FB)(n,e)&&ei&&ei.dataKey===e?(ec(void 0),null==C||C(null)):(ec(e),null==C||C({eventType:"category",categoryClicked:e})),ea(void 0))}return o.createElement("div",Object.assign({ref:t,className:(0,en.q)("w-full h-80",N)},F),o.createElement(i.h,{className:"h-full w-full"},(null==n?void 0:n.length)?o.createElement(z,{data:n,onClick:ed&&(el||ei)?()=>{ea(void 0),ec(void 0),null==C||C(null)}:void 0,margin:{bottom:Z?30:void 0,left:B?20:void 0,right:B?5:void 0,top:5}},x?o.createElement(V.q,{className:(0,en.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,o.createElement(_.K,{padding:M,hide:!p,dataKey:l,tick:{transform:"translate(0, 6)"},ticks:d?[n[0][l],n[n.length-1][l]]:void 0,fill:"",stroke:"",className:(0,en.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),interval:d?"preserveStartEnd":h,tickLine:!1,axisLine:!1,minTickGap:I,angle:null==D?void 0:D.angle,dy:null==D?void 0:D.verticalShift,height:null==D?void 0:D.xAxisHeight},Z&&o.createElement(G._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},Z)),o.createElement(H.B,{width:m,hide:!f,axisLine:!1,tickLine:!1,type:"number",domain:eu,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,en.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:u,allowDecimals:S},B&&o.createElement(G._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},B)),o.createElement(q.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:b?e=>{let{active:t,payload:n,label:r}=e;return R?o.createElement(R,{payload:null==n?void 0:n.map(e=>{var t;return Object.assign(Object.assign({},e),{color:null!==(t=es.get(e.dataKey))&&void 0!==t?t:ee.fr.Gray})}),active:t,label:r}):o.createElement(Y.ZP,{active:t,payload:n,label:r,valueFormatter:u,categoryColors:es})}:o.createElement(o.Fragment,null),position:{y:0}}),g?o.createElement($.D,{verticalAlign:"top",height:W,content:e=>{let{payload:t}=e;return(0,U.Z)({payload:t},es,eo,el,ed?e=>ep(e):void 0,T)}}):null,a.map(e=>{var t,n,r;let i=(null!==(t=es.get(e))&&void 0!==t?t:ee.fr.Gray).replace("#","");return o.createElement("defs",{key:e},A?o.createElement("linearGradient",{className:(0,er.bM)(null!==(n=es.get(e))&&void 0!==n?n:ee.fr.Gray,et.K.text).textColor,id:i,x1:"0",y1:"0",x2:"0",y2:"1"},o.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:ei||el&&el!==e?.15:.4}),o.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:0})):o.createElement("linearGradient",{className:(0,er.bM)(null!==(r=es.get(e))&&void 0!==r?r:ee.fr.Gray,et.K.text).textColor,id:i,x1:"0",y1:"0",x2:"0",y2:"1"},o.createElement("stop",{stopColor:"currentColor",stopOpacity:ei||el&&el!==e?.1:.3})))}),a.map(e=>{var t,r;let i=(null!==(t=es.get(e))&&void 0!==t?t:ee.fr.Gray).replace("#","");return o.createElement(K,{className:(0,er.bM)(null!==(r=es.get(e))&&void 0!==r?r:ee.fr.Gray,et.K.text).strokeColor,strokeOpacity:ei||el&&el!==e?.3:1,activeDot:e=>{var t;let{cx:r,cy:i,stroke:a,strokeLinecap:l,strokeLinejoin:c,strokeWidth:s,dataKey:u}=e;return o.createElement(k.o,{className:(0,en.q)("stroke-tremor-background dark:stroke-dark-tremor-background",C?"cursor-pointer":"",(0,er.bM)(null!==(t=es.get(u))&&void 0!==t?t:ee.fr.Gray,et.K.text).fillColor),cx:r,cy:i,r:5,fill:"",stroke:a,strokeLinecap:l,strokeLinejoin:c,strokeWidth:s,onClick:(t,r)=>{r.stopPropagation(),ed&&(e.index===(null==ei?void 0:ei.index)&&e.dataKey===(null==ei?void 0:ei.dataKey)||(0,J.FB)(n,e.dataKey)&&el&&el===e.dataKey?(ec(void 0),ea(void 0),null==C||C(null)):(ec(e.dataKey),ea({index:e.index,dataKey:e.dataKey}),null==C||C(Object.assign({eventType:"dot",categoryClicked:e.dataKey},e.payload))))}})},dot:t=>{var r;let{stroke:i,strokeLinecap:a,strokeLinejoin:l,strokeWidth:c,cx:s,cy:u,dataKey:d,index:p}=t;return(0,J.FB)(n,e)&&!(ei||el&&el!==e)||(null==ei?void 0:ei.index)===p&&(null==ei?void 0:ei.dataKey)===e?o.createElement(k.o,{key:p,cx:s,cy:u,r:5,stroke:i,fill:"",strokeLinecap:a,strokeLinejoin:l,strokeWidth:c,className:(0,en.q)("stroke-tremor-background dark:stroke-dark-tremor-background",C?"cursor-pointer":"",(0,er.bM)(null!==(r=es.get(d))&&void 0!==r?r:ee.fr.Gray,et.K.text).fillColor)}):o.createElement(o.Fragment,{key:p})},key:e,name:e,type:w,dataKey:e,stroke:"",fill:"url(#".concat(i,")"),strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:y,animationDuration:v,stackId:c?"a":void 0,connectNulls:P})}),C?a.map(e=>o.createElement(X.x,{className:(0,en.q)("cursor-pointer"),strokeOpacity:0,key:e,name:e,type:w,dataKey:e,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:P,onClick:(e,t)=>{t.stopPropagation();let{name:n}=e;ep(n)}})):null):o.createElement(Q.Z,{noDataText:L})))});eo.displayName="AreaChart"},14042:function(e,t,n){"use strict";n.d(t,{Z:function(){return e_}});var r=n(5853),o=n(7084),i=n(26898),a=n(13241),l=n(1153),c=n(2265),s=n(60474),u=n(47625),d=n(93765),p=n(86757),f=n.n(p),m=n(61994),h=n(9841),y=n(81889),v=n(82944),b=["points","className","baseLinePoints","connectNulls"];function g(){return(g=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=[[]];return e.forEach(function(e){A(e)?t[t.length-1].push(e):t[t.length-1].length>0&&t.push([])}),A(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},w=function(e,t){var n=O(e);t&&(n=[n.reduce(function(e,t){return[].concat(k(e),k(t))},[])]);var r=n.map(function(e){return e.reduce(function(e,t,n){return"".concat(e).concat(0===n?"M":"L").concat(t.x,",").concat(t.y)},"")}).join("");return 1===n.length?"".concat(r,"Z"):r},j=function(e,t,n){var r=w(e,n);return"".concat("Z"===r.slice(-1)?r.slice(0,-1):r,"L").concat(w(t.reverse(),n).slice(1))},E=function(e){var t=e.points,n=e.className,r=e.baseLinePoints,o=e.connectNulls,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,b);if(!t||!t.length)return null;var a=(0,m.Z)("recharts-polygon",n);if(r&&r.length){var l=i.stroke&&"none"!==i.stroke,s=j(t,r,o);return c.createElement("g",{className:a},c.createElement("path",g({},(0,v.L6)(i,!0),{fill:"Z"===s.slice(-1)?i.fill:"none",stroke:"none",d:s})),l?c.createElement("path",g({},(0,v.L6)(i,!0),{fill:"none",d:w(t,o)})):null,l?c.createElement("path",g({},(0,v.L6)(i,!0),{fill:"none",d:w(r,o)})):null)}var u=w(t,o);return c.createElement("path",g({},(0,v.L6)(i,!0),{fill:"Z"===u.slice(-1)?i.fill:"none",className:a,d:u}))},P=n(58811),S=n(41637),L=n(39206);function N(e){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(){return(C=Object.assign?Object.assign.bind():function(e){for(var t=1;t1e-5?"outer"===t?"start":"end":n<-.00001?"outer"===t?"end":"start":"middle"}},{key:"renderAxisLine",value:function(){var e=this.props,t=e.cx,n=e.cy,r=e.radius,o=e.axisLine,i=e.axisLineType,a=R(R({},(0,v.L6)(this.props,!1)),{},{fill:"none"},(0,v.L6)(o,!1));if("circle"===i)return c.createElement(y.o,C({className:"recharts-polar-angle-axis-line"},a,{cx:t,cy:n,r:r}));var l=this.props.ticks.map(function(e){return(0,L.op)(t,n,r,e.coordinate)});return c.createElement(E,C({className:"recharts-polar-angle-axis-line"},a,{points:l}))}},{key:"renderTicks",value:function(){var e=this,t=this.props,n=t.ticks,o=t.tick,i=t.tickLine,a=t.tickFormatter,l=t.stroke,s=(0,v.L6)(this.props,!1),u=(0,v.L6)(o,!1),d=R(R({},s),{},{fill:"none"},(0,v.L6)(i,!1)),p=n.map(function(t,n){var p=e.getTickLineCoord(t),f=R(R(R({textAnchor:e.getTickTextAnchor(t)},s),{},{stroke:"none",fill:l},u),{},{index:n,payload:t,x:p.x2,y:p.y2});return c.createElement(h.m,C({className:(0,m.Z)("recharts-polar-angle-axis-tick",(0,L.$S)(o)),key:"tick-".concat(t.coordinate)},(0,S.bw)(e.props,t,n)),i&&c.createElement("line",C({className:"recharts-polar-angle-axis-tick-line"},d,p)),o&&r.renderTickItem(o,f,a?a(t.value,n):t.value))});return c.createElement(h.m,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var e=this.props,t=e.ticks,n=e.radius,r=e.axisLine;return!(n<=0)&&t&&t.length?c.createElement(h.m,{className:(0,m.Z)("recharts-polar-angle-axis",this.props.className)},r&&this.renderAxisLine(),this.renderTicks()):null}}],n=[{key:"renderTickItem",value:function(e,t,n){return c.isValidElement(e)?c.cloneElement(e,t):f()(e)?e(t):c.createElement(P.x,C({},t,{className:"recharts-polar-angle-axis-tick-value"}),n)}}],t&&D(r.prototype,t),n&&D(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}(c.PureComponent);B(_,"displayName","PolarAngleAxis"),B(_,"axisType","angleAxis"),B(_,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var H=n(35802),W=n.n(H),z=n(37891),V=n.n(z),G=n(26680),q=["cx","cy","angle","ticks","axisLine"],$=["ticks","tick","angle","tickFormatter","stroke"];function X(e){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function ee(e,t){for(var n=0;n0?es()(e,"paddingAngle",0):0;if(n){var l=(0,eb.k4)(n.endAngle-n.startAngle,e.endAngle-e.startAngle),c=ej(ej({},e),{},{startAngle:i+a,endAngle:i+l(r)+a});o.push(c),i=c.endAngle}else{var s=e.endAngle,d=e.startAngle,p=(0,eb.k4)(0,s-d)(r),f=ej(ej({},e),{},{startAngle:i+a,endAngle:i+p+a});o.push(f),i=f.endAngle}}),c.createElement(h.m,null,e.renderSectorsStatically(o))})}},{key:"attachKeyboardHandlers",value:function(e){var t=this;e.onkeydown=function(e){if(!e.altKey)switch(e.key){case"ArrowLeft":var n=++t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[n].focus(),t.setState({sectorToFocus:n});break;case"ArrowRight":var r=--t.state.sectorToFocus<0?t.sectorRefs.length-1:t.state.sectorToFocus%t.sectorRefs.length;t.sectorRefs[r].focus(),t.setState({sectorToFocus:r});break;case"Escape":t.sectorRefs[t.state.sectorToFocus].blur(),t.setState({sectorToFocus:0})}}}},{key:"renderSectors",value:function(){var e=this.props,t=e.sectors,n=e.isAnimationActive,r=this.state.prevSectors;return n&&t&&t.length&&(!r||!ed()(r,t))?this.renderSectorsWithAnimation():this.renderSectorsStatically(t)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,t=this.props,n=t.hide,r=t.sectors,o=t.className,i=t.label,a=t.cx,l=t.cy,s=t.innerRadius,u=t.outerRadius,d=t.isAnimationActive,p=this.state.isAnimationFinished;if(n||!r||!r.length||!(0,eb.hj)(a)||!(0,eb.hj)(l)||!(0,eb.hj)(s)||!(0,eb.hj)(u))return null;var f=(0,m.Z)("recharts-pie",o);return c.createElement(h.m,{tabIndex:this.props.rootTabIndex,className:f,ref:function(t){e.pieRef=t}},this.renderSectors(),i&&this.renderLabels(r),G._.renderCallByParent(this.props,null,!1),(!d||p)&&eh.e.renderCallByParent(this.props,r,!1))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return t.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:t.curSectors,isAnimationFinished:!0}:e.sectors!==t.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,t){return e>t?"start":e=360?k:k-1)*u,A=a.reduce(function(e,t){var n=(0,eg.F$)(t,g,0);return e+((0,eb.hj)(n)?n:0)},0);return A>0&&(t=a.map(function(e,t){var r,o=(0,eg.F$)(e,g,0),i=(0,eg.F$)(e,p,t),a=((0,eb.hj)(o)?o:0)/A,s=(r=t?n.endAngle+(0,eb.uY)(v)*u*(0!==o?1:0):c)+(0,eb.uY)(v)*((0!==o?h:0)+a*x),d=(r+s)/2,f=(y.innerRadius+y.outerRadius)/2,b=[{name:i,value:o,payload:e,dataKey:g,type:m}],k=(0,L.op)(y.cx,y.cy,f,d);return n=ej(ej(ej({percent:a,cornerRadius:l,name:i,tooltipPayload:b,midAngle:d,middleRadius:f,tooltipPosition:k},e),y),{},{value:(0,eg.F$)(e,g),startAngle:r,endAngle:s,payload:e,paddingAngle:(0,eb.uY)(v)*u})})),ej(ej({},y),{},{sectors:t,data:a})});var eR=(0,d.z)({chartName:"PieChart",GraphicalChild:eT,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:_},{axisType:"radiusAxis",AxisComp:ea}],formatAxisMap:L.t9,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),eD=n(8147),eM=n(92666),eI=n(98593);let eZ=e=>{let{active:t,payload:n,valueFormatter:r}=e;if(t&&(null==n?void 0:n[0])){let e=null==n?void 0:n[0];return c.createElement(eI.$B,null,c.createElement("div",{className:(0,a.q)("px-4 py-2")},c.createElement(eI.zX,{value:r(e.value),name:e.name,color:e.payload.color})))}return null},eB=(e,t)=>e.map((e,n)=>{let r=ne||t((0,l.vP)(n.map(e=>e[r]))),eK=e=>{let{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:l}=e;return c.createElement("g",null,c.createElement(s.L,{cx:t,cy:n,innerRadius:r,outerRadius:o,startAngle:i,endAngle:a,className:l,fill:"",opacity:.3,style:{outline:"none"}}))},e_=c.forwardRef((e,t)=>{let{data:n=[],category:s="value",index:d="name",colors:p=i.s,variant:f="donut",valueFormatter:m=l.Cj,label:h,showLabel:y=!0,animationDuration:v=900,showAnimation:b=!1,showTooltip:g=!0,noDataText:k,onValueChange:x,customTooltip:A,className:O}=e,w=(0,r._T)(e,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","noDataText","onValueChange","customTooltip","className"]),j="donut"==f,E=eF(h,m,n,s),[P,S]=c.useState(void 0),L=!!x;return(0,c.useEffect)(()=>{let e=document.querySelectorAll(".recharts-pie-sector");e&&e.forEach(e=>{e.setAttribute("style","outline: none")})},[P]),c.createElement("div",Object.assign({ref:t,className:(0,a.q)("w-full h-40",O)},w),c.createElement(u.h,{className:"h-full w-full"},(null==n?void 0:n.length)?c.createElement(eR,{onClick:L&&P?()=>{S(void 0),null==x||x(null)}:void 0,margin:{top:0,left:0,right:0,bottom:0}},y&&j?c.createElement("text",{className:(0,a.q)("fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis"),x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle"},E):null,c.createElement(eT,{className:(0,a.q)("stroke-tremor-background dark:stroke-dark-tremor-background",x?"cursor-pointer":"cursor-default"),data:eB(n,p),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:j?"75%":"0%",outerRadius:"100%",stroke:"",strokeLinejoin:"round",dataKey:s,nameKey:d,isAnimationActive:b,animationDuration:v,onClick:function(e,t,n){n.stopPropagation(),L&&(P===t?(S(void 0),null==x||x(null)):(S(t),null==x||x(Object.assign({eventType:"slice"},e.payload.payload))))},activeIndex:P,inactiveShape:eK,style:{outline:"none"}}),c.createElement(eD.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,content:g?e=>{var t;let{active:n,payload:r}=e;return A?c.createElement(A,{payload:null==r?void 0:r.map(e=>{var t,n,i;return Object.assign(Object.assign({},e),{color:null!==(i=null===(n=null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.payload)||void 0===n?void 0:n.color)&&void 0!==i?i:o.fr.Gray})}),active:n,label:null===(t=null==r?void 0:r[0])||void 0===t?void 0:t.name}):c.createElement(eZ,{active:n,payload:r,valueFormatter:m})}:c.createElement(c.Fragment,null)})):c.createElement(eM.Z,{noDataText:k})))});e_.displayName="DonutChart"},10968:function(e,t,n){"use strict";n.d(t,{Z:function(){return I}});var r=n(2265),o=n(36760),i=n.n(o),a=n(1119),l=n(26365),c=n(6989),s=n(11993),u=n(31686),d=n(41154),p=n(50506),f=n(18694),m=n(28791),h=n(66632),y=n(27380),v=function(e,t){if(!e)return null;var n={left:e.offsetLeft,right:e.parentElement.clientWidth-e.clientWidth-e.offsetLeft,width:e.clientWidth,top:e.offsetTop,bottom:e.parentElement.clientHeight-e.clientHeight-e.offsetTop,height:e.clientHeight};return t?{left:0,right:0,width:0,top:n.top,bottom:n.bottom,height:n.height}:{left:n.left,right:n.right,width:n.width,top:0,bottom:0,height:0}},b=function(e){return void 0!==e?"".concat(e,"px"):void 0};function g(e){var t=e.prefixCls,n=e.containerRef,o=e.value,a=e.getValueIndex,c=e.motionName,s=e.onMotionStart,d=e.onMotionEnd,p=e.direction,f=e.vertical,g=void 0!==f&&f,k=r.useRef(null),x=r.useState(o),A=(0,l.Z)(x,2),O=A[0],w=A[1],j=function(e){var r,o=a(e),i=null===(r=n.current)||void 0===r?void 0:r.querySelectorAll(".".concat(t,"-item"))[o];return(null==i?void 0:i.offsetParent)&&i},E=r.useState(null),P=(0,l.Z)(E,2),S=P[0],L=P[1],N=r.useState(null),C=(0,l.Z)(N,2),T=C[0],R=C[1];(0,y.Z)(function(){if(O!==o){var e=j(O),t=j(o),n=v(e,g),r=v(t,g);w(o),L(n),R(r),e&&t?s():d()}},[o]);var D=r.useMemo(function(){if(g){var e;return b(null!==(e=null==S?void 0:S.top)&&void 0!==e?e:0)}return"rtl"===p?b(-(null==S?void 0:S.right)):b(null==S?void 0:S.left)},[g,p,S]),M=r.useMemo(function(){if(g){var e;return b(null!==(e=null==T?void 0:T.top)&&void 0!==e?e:0)}return"rtl"===p?b(-(null==T?void 0:T.right)):b(null==T?void 0:T.left)},[g,p,T]);return S&&T?r.createElement(h.ZP,{visible:!0,motionName:c,motionAppear:!0,onAppearStart:function(){return g?{transform:"translateY(var(--thumb-start-top))",height:"var(--thumb-start-height)"}:{transform:"translateX(var(--thumb-start-left))",width:"var(--thumb-start-width)"}},onAppearActive:function(){return g?{transform:"translateY(var(--thumb-active-top))",height:"var(--thumb-active-height)"}:{transform:"translateX(var(--thumb-active-left))",width:"var(--thumb-active-width)"}},onVisibleChanged:function(){L(null),R(null),d()}},function(e,n){var o=e.className,a=e.style,l=(0,u.Z)((0,u.Z)({},a),{},{"--thumb-start-left":D,"--thumb-start-width":b(null==S?void 0:S.width),"--thumb-active-left":M,"--thumb-active-width":b(null==T?void 0:T.width),"--thumb-start-top":D,"--thumb-start-height":b(null==S?void 0:S.height),"--thumb-active-top":M,"--thumb-active-height":b(null==T?void 0:T.height)}),c={ref:(0,m.sQ)(k,n),style:l,className:i()("".concat(t,"-thumb"),o)};return r.createElement("div",c)}):null}var k=["prefixCls","direction","vertical","options","disabled","defaultValue","value","name","onChange","className","motionName"],x=function(e){var t=e.prefixCls,n=e.className,o=e.disabled,a=e.checked,l=e.label,c=e.title,u=e.value,d=e.name,p=e.onChange,f=e.onFocus,m=e.onBlur,h=e.onKeyDown,y=e.onKeyUp,v=e.onMouseDown;return r.createElement("label",{className:i()(n,(0,s.Z)({},"".concat(t,"-item-disabled"),o)),onMouseDown:v},r.createElement("input",{name:d,className:"".concat(t,"-item-input"),type:"radio",disabled:o,checked:a,onChange:function(e){o||p(e,u)},onFocus:f,onBlur:m,onKeyDown:h,onKeyUp:y}),r.createElement("div",{className:"".concat(t,"-item-label"),title:c,"aria-selected":a},l))},A=r.forwardRef(function(e,t){var n,o,h=e.prefixCls,y=void 0===h?"rc-segmented":h,v=e.direction,b=e.vertical,A=e.options,O=void 0===A?[]:A,w=e.disabled,j=e.defaultValue,E=e.value,P=e.name,S=e.onChange,L=e.className,N=e.motionName,C=(0,c.Z)(e,k),T=r.useRef(null),R=r.useMemo(function(){return(0,m.sQ)(T,t)},[T,t]),D=r.useMemo(function(){return O.map(function(e){if("object"===(0,d.Z)(e)&&null!==e){var t=function(e){if(void 0!==e.title)return e.title;if("object"!==(0,d.Z)(e.label)){var t;return null===(t=e.label)||void 0===t?void 0:t.toString()}}(e);return(0,u.Z)((0,u.Z)({},e),{},{title:t})}return{label:null==e?void 0:e.toString(),title:null==e?void 0:e.toString(),value:e}})},[O]),M=(0,p.Z)(null===(n=D[0])||void 0===n?void 0:n.value,{value:E,defaultValue:j}),I=(0,l.Z)(M,2),Z=I[0],B=I[1],F=r.useState(!1),K=(0,l.Z)(F,2),_=K[0],H=K[1],W=function(e,t){B(t),null==S||S(t)},z=(0,f.Z)(C,["children"]),V=r.useState(!1),G=(0,l.Z)(V,2),q=G[0],$=G[1],X=r.useState(!1),U=(0,l.Z)(X,2),Y=U[0],Q=U[1],J=function(){Q(!0)},ee=function(){Q(!1)},et=function(){$(!1)},en=function(e){"Tab"===e.key&&$(!0)},er=function(e){var t=D.findIndex(function(e){return e.value===Z}),n=D.length,r=D[(t+e+n)%n];r&&(B(r.value),null==S||S(r.value))},eo=function(e){switch(e.key){case"ArrowLeft":case"ArrowUp":er(-1);break;case"ArrowRight":case"ArrowDown":er(1)}};return r.createElement("div",(0,a.Z)({role:"radiogroup","aria-label":"segmented control",tabIndex:w?void 0:0},z,{className:i()(y,(o={},(0,s.Z)(o,"".concat(y,"-rtl"),"rtl"===v),(0,s.Z)(o,"".concat(y,"-disabled"),w),(0,s.Z)(o,"".concat(y,"-vertical"),b),o),void 0===L?"":L),ref:R}),r.createElement("div",{className:"".concat(y,"-group")},r.createElement(g,{vertical:b,prefixCls:y,value:Z,containerRef:T,motionName:"".concat(y,"-").concat(void 0===N?"thumb-motion":N),direction:v,getValueIndex:function(e){return D.findIndex(function(t){return t.value===e})},onMotionStart:function(){H(!0)},onMotionEnd:function(){H(!1)}}),D.map(function(e){var t;return r.createElement(x,(0,a.Z)({},e,{name:P,key:e.value,prefixCls:y,className:i()(e.className,"".concat(y,"-item"),(t={},(0,s.Z)(t,"".concat(y,"-item-selected"),e.value===Z&&!_),(0,s.Z)(t,"".concat(y,"-item-focused"),Y&&q&&e.value===Z),t)),checked:e.value===Z,onChange:W,onFocus:J,onBlur:ee,onKeyDown:eo,onKeyUp:en,onMouseDown:et,disabled:!!w||!!e.disabled}))})))}),O=n(92491),w=n(71744),j=n(33759),E=n(93463),P=n(12918),S=n(99320),L=n(71140);function N(e,t){return{["".concat(e,", ").concat(e,":hover, ").concat(e,":focus")]:{color:t.colorTextDisabled,cursor:"not-allowed"}}}function C(e){return{background:e.itemSelectedBg,boxShadow:e.boxShadowTertiary}}let T=Object.assign({overflow:"hidden"},P.vS),R=e=>{let{componentCls:t}=e,n=e.calc(e.controlHeight).sub(e.calc(e.trackPadding).mul(2)).equal(),r=e.calc(e.controlHeightLG).sub(e.calc(e.trackPadding).mul(2)).equal(),o=e.calc(e.controlHeightSM).sub(e.calc(e.trackPadding).mul(2)).equal();return{[t]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,P.Wf)(e)),{display:"inline-block",padding:e.trackPadding,color:e.itemColor,background:e.trackBg,borderRadius:e.borderRadius,transition:"all ".concat(e.motionDurationMid)}),(0,P.Qy)(e)),{["".concat(t,"-group")]:{position:"relative",display:"flex",alignItems:"stretch",justifyItems:"flex-start",flexDirection:"row",width:"100%"},["&".concat(t,"-rtl")]:{direction:"rtl"},["&".concat(t,"-vertical")]:{["".concat(t,"-group")]:{flexDirection:"column"},["".concat(t,"-thumb")]:{width:"100%",height:0,padding:"0 ".concat((0,E.bf)(e.paddingXXS))}},["&".concat(t,"-block")]:{display:"flex"},["&".concat(t,"-block ").concat(t,"-item")]:{flex:1,minWidth:0},["".concat(t,"-item")]:{position:"relative",textAlign:"center",cursor:"pointer",transition:"color ".concat(e.motionDurationMid),borderRadius:e.borderRadiusSM,transform:"translateZ(0)","&-selected":Object.assign(Object.assign({},C(e)),{color:e.itemSelectedColor}),"&-focused":(0,P.oN)(e),"&::after":{content:'""',position:"absolute",zIndex:-1,width:"100%",height:"100%",top:0,insetInlineStart:0,borderRadius:"inherit",opacity:0,transition:"opacity ".concat(e.motionDurationMid,", background-color ").concat(e.motionDurationMid),pointerEvents:"none"},["&:not(".concat(t,"-item-selected):not(").concat(t,"-item-disabled)")]:{"&:hover, &:active":{color:e.itemHoverColor},"&:hover::after":{opacity:1,backgroundColor:e.itemHoverBg},"&:active::after":{opacity:1,backgroundColor:e.itemActiveBg}},"&-label":Object.assign({minHeight:n,lineHeight:(0,E.bf)(n),padding:"0 ".concat((0,E.bf)(e.segmentedPaddingHorizontal))},T),"&-icon + *":{marginInlineStart:e.calc(e.marginSM).div(2).equal()},"&-input":{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:0,opacity:0,pointerEvents:"none"}},["".concat(t,"-thumb")]:Object.assign(Object.assign({},C(e)),{position:"absolute",insetBlockStart:0,insetInlineStart:0,width:0,height:"100%",padding:"".concat((0,E.bf)(e.paddingXXS)," 0"),borderRadius:e.borderRadiusSM,["& ~ ".concat(t,"-item:not(").concat(t,"-item-selected):not(").concat(t,"-item-disabled)::after")]:{backgroundColor:"transparent"}}),["&".concat(t,"-lg")]:{borderRadius:e.borderRadiusLG,["".concat(t,"-item-label")]:{minHeight:r,lineHeight:(0,E.bf)(r),padding:"0 ".concat((0,E.bf)(e.segmentedPaddingHorizontal)),fontSize:e.fontSizeLG},["".concat(t,"-item, ").concat(t,"-thumb")]:{borderRadius:e.borderRadius}},["&".concat(t,"-sm")]:{borderRadius:e.borderRadiusSM,["".concat(t,"-item-label")]:{minHeight:o,lineHeight:(0,E.bf)(o),padding:"0 ".concat((0,E.bf)(e.segmentedPaddingHorizontalSM))},["".concat(t,"-item, ").concat(t,"-thumb")]:{borderRadius:e.borderRadiusXS}}}),N("&-disabled ".concat(t,"-item"),e)),N("".concat(t,"-item-disabled"),e)),{["".concat(t,"-thumb-motion-appear-active")]:{transition:"transform ".concat(e.motionDurationSlow," ").concat(e.motionEaseInOut,", width ").concat(e.motionDurationSlow," ").concat(e.motionEaseInOut),willChange:"transform, width"},["&".concat(t,"-shape-round")]:{borderRadius:9999,["".concat(t,"-item, ").concat(t,"-thumb")]:{borderRadius:9999}}})}};var D=(0,S.I$)("Segmented",e=>{let{lineWidth:t,calc:n}=e;return R((0,L.IX)(e,{segmentedPaddingHorizontal:n(e.controlPaddingHorizontal).sub(t).equal(),segmentedPaddingHorizontalSM:n(e.controlPaddingHorizontalSM).sub(t).equal()}))},e=>{let{colorTextLabel:t,colorText:n,colorFillSecondary:r,colorBgElevated:o,colorFill:i,lineWidthBold:a,colorBgLayout:l}=e;return{trackPadding:a,trackBg:l,itemColor:t,itemHoverColor:n,itemHoverBg:r,itemSelectedBg:o,itemActiveBg:i,itemSelectedColor:n}}),M=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);ot.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},I=r.forwardRef((e,t)=>{let n=(0,O.Z)(),{prefixCls:o,className:a,rootClassName:l,block:c,options:s=[],size:u="middle",style:d,vertical:p,shape:f="default",name:m=n}=e,h=M(e,["prefixCls","className","rootClassName","block","options","size","style","vertical","shape","name"]),{getPrefixCls:y,direction:v,className:b,style:g}=(0,w.dj)("segmented"),k=y("segmented",o),[x,E,P]=D(k),S=(0,j.Z)(u),L=r.useMemo(()=>s.map(e=>{if("object"==typeof e&&(null==e?void 0:e.icon)){let{icon:t,label:n}=e;return Object.assign(Object.assign({},M(e,["icon","label"])),{label:r.createElement(r.Fragment,null,r.createElement("span",{className:"".concat(k,"-item-icon")},t),n&&r.createElement("span",null,n))})}return e}),[s,k]),N=i()(a,l,b,{["".concat(k,"-block")]:c,["".concat(k,"-sm")]:"small"===S,["".concat(k,"-lg")]:"large"===S,["".concat(k,"-vertical")]:p,["".concat(k,"-shape-").concat(f)]:"round"===f},E,P),C=Object.assign(Object.assign({},g),d);return x(r.createElement(A,Object.assign({},h,{name:m,className:N,style:C,options:L,ref:t,prefixCls:k,direction:v,vertical:p})))})},35802:function(e,t,n){var r=n(67646),o=n(58905),i=n(88157);e.exports=function(e,t){return e&&e.length?r(e,i(t,2),o):void 0}},37891:function(e,t,n){var r=n(67646),o=n(88157),i=n(20121);e.exports=function(e,t){return e&&e.length?r(e,o(t,2),i):void 0}},32489:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},54061:function(e,t,n){"use strict";n.d(t,{x:function(){return I}});var r=n(2265),o=n(84735),i=n(86757),a=n.n(i),l=n(77571),c=n.n(l),s=n(21652),u=n.n(s),d=n(61994),p=n(57165),f=n(81889),m=n(9841),h=n(58772),y=n(13137),v=n(16630),b=n(82944),g=n(34067),k=n(85355),x=["type","layout","connectNulls","ref"],A=["key"];function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function w(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function j(){return(j=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);na){c=[].concat(S(r.slice(0,s)),[a-u]);break}var d=c.length%2==0?[0,l]:[l];return[].concat(S(i.repeat(r,Math.floor(t/o))),S(c),d).map(function(e){return"".concat(e,"px")}).join(", ")}),D(e,"id",(0,v.EL)("recharts-line-")),D(e,"pathRef",function(t){e.mainCurve=t}),D(e,"handleAnimationEnd",function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),D(e,"handleAnimationStart",function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&R(e,t)}(i,e),t=[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:"getTotalLength",value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}},{key:"renderErrorBar",value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,o=n.points,i=n.xAxis,a=n.yAxis,l=n.layout,c=n.children,s=(0,b.NN)(c,y.W);if(!s)return null;var u=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:(0,k.F$)(e.payload,t)}};return r.createElement(m.m,{clipPath:e?"url(#clipPath-".concat(t,")"):null},s.map(function(e){return r.cloneElement(e,{key:"bar-".concat(e.props.dataKey),data:o,xAxis:i,yAxis:a,layout:l,dataPointFormatter:u})}))}},{key:"renderDots",value:function(e,t,n){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,a=o.dot,l=o.points,c=o.dataKey,s=(0,b.L6)(this.props,!1),u=(0,b.L6)(a,!0),d=l.map(function(e,t){var n=P(P(P({key:"dot-".concat(t),r:3},s),u),{},{index:t,cx:e.x,cy:e.y,value:e.value,dataKey:c,payload:e.payload,points:l});return i.renderDotItem(a,n)}),p={clipPath:e?"url(#clipPath-".concat(t?"":"dots-").concat(n,")"):null};return r.createElement(m.m,j({className:"recharts-line-dots",key:"dots"},p),d)}},{key:"renderCurveStatically",value:function(e,t,n,o){var i=this.props,a=i.type,l=i.layout,c=i.connectNulls,s=(i.ref,w(i,x)),u=P(P(P({},(0,b.L6)(s,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:t?"url(#clipPath-".concat(n,")"):null,points:e},o),{},{type:a,layout:l,connectNulls:c});return r.createElement(p.H,j({},u,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(e,t){var n=this,i=this.props,a=i.points,l=i.strokeDasharray,c=i.isAnimationActive,s=i.animationBegin,u=i.animationDuration,d=i.animationEasing,p=i.animationId,f=i.animateNewValues,m=i.width,h=i.height,y=this.state,b=y.prevPoints,g=y.totalLength;return r.createElement(o.ZP,{begin:s,duration:u,isActive:c,easing:d,from:{t:0},to:{t:1},key:"line-".concat(p),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o,i=r.t;if(b){var c=b.length/a.length,s=a.map(function(e,t){var n=Math.floor(t*c);if(b[n]){var r=b[n],o=(0,v.k4)(r.x,e.x),a=(0,v.k4)(r.y,e.y);return P(P({},e),{},{x:o(i),y:a(i)})}if(f){var l=(0,v.k4)(2*m,e.x),s=(0,v.k4)(h/2,e.y);return P(P({},e),{},{x:l(i),y:s(i)})}return P(P({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(s,e,t)}var u=(0,v.k4)(0,g)(i);if(l){var d="".concat(l).split(/[,\s]+/gim).map(function(e){return parseFloat(e)});o=n.getStrokeDasharray(u,g,d)}else o=n.generateSimpleStrokeDasharray(g,u);return n.renderCurveStatically(a,e,t,{strokeDasharray:o})})}},{key:"renderCurve",value:function(e,t){var n=this.props,r=n.points,o=n.isAnimationActive,i=this.state,a=i.prevPoints,l=i.totalLength;return o&&r&&r.length&&(!a&&l>0||!u()(a,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:"render",value:function(){var e,t=this.props,n=t.hide,o=t.dot,i=t.points,a=t.className,l=t.xAxis,s=t.yAxis,u=t.top,p=t.left,f=t.width,y=t.height,v=t.isAnimationActive,g=t.id;if(n||!i||!i.length)return null;var k=this.state.isAnimationFinished,x=1===i.length,A=(0,d.Z)("recharts-line",a),O=l&&l.allowDataOverflow,w=s&&s.allowDataOverflow,j=O||w,E=c()(g)?this.id:g,P=null!==(e=(0,b.L6)(o,!1))&&void 0!==e?e:{r:3,strokeWidth:2},S=P.r,L=P.strokeWidth,N=((0,b.jf)(o)?o:{}).clipDot,C=void 0===N||N,T=2*(void 0===S?3:S)+(void 0===L?2:L);return r.createElement(m.m,{className:A},O||w?r.createElement("defs",null,r.createElement("clipPath",{id:"clipPath-".concat(E)},r.createElement("rect",{x:O?p:p-f/2,y:w?u:u-y/2,width:O?f:2*f,height:w?y:2*y})),!C&&r.createElement("clipPath",{id:"clipPath-dots-".concat(E)},r.createElement("rect",{x:p-T/2,y:u-T/2,width:f+T,height:y+T}))):null,!x&&this.renderCurve(j,E),this.renderErrorBar(j,E),(x||o)&&this.renderDots(j,C,E),(!v||k)&&h.e.renderCallByParent(this.props,i))}}],n=[{key:"getDerivedStateFromProps",value:function(e,t){return e.animationId!==t.prevAnimationId?{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}:e.points!==t.curPoints?{curPoints:e.points}:null}},{key:"repeat",value:function(e,t){for(var n=e.length%2!=0?[].concat(S(e),[0]):e,r=[],o=0;o{B(!0),null==G||G(!L),H.nextFrame(()=>{B(!1)})}),z=(0,h.z)(e=>{if((0,b.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),J()}),X=(0,h.z)(e=>{e.key===w.R.Space?(e.preventDefault(),J()):e.key===w.R.Enter&&(0,g.g)(e.currentTarget)}),U=(0,h.z)(e=>e.preventDefault()),Y=(0,k.wp)(),$=(0,C.zH)(),{isFocusVisible:W,focusProps:ee}=(0,s.F)({autoFocus:_}),{isHovered:et,hoverProps:er}=(0,n.X)({isDisabled:N}),{pressed:ea,pressProps:es}=(0,o.x)({disabled:N}),en=(0,i.useMemo)(()=>({checked:L,disabled:N,hover:et,focus:W,active:ea,autofocus:_,changing:Z}),[L,et,W,ea,N,Z,_]),ei=(0,v.dG)({id:O,ref:K,role:"switch",type:(0,d.f)(e,R),tabIndex:-1===e.tabIndex?0:null!=(r=e.tabIndex)?r:0,"aria-checked":L,"aria-labelledby":Y,"aria-describedby":$,disabled:N||void 0,autoFocus:_,onClick:z,onKeyUp:X,onKeyPress:U},ee,er,es),eo=(0,i.useCallback)(()=>{if(void 0!==j)return null==G?void 0:G(j)},[G,j]),el=(0,v.L6)();return i.createElement(i.Fragment,null,null!=M&&i.createElement(p.Mt,{disabled:N,data:{[M]:D||"on"},overrides:{type:"checkbox",checked:L},form:Q,onReset:eo}),el({ourProps:ei,theirProps:V,slot:en,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,a]=(0,i.useState)(null),[s,n]=(0,k.bE)(),[o,l]=(0,C.fw)(),u=(0,i.useMemo)(()=>({switch:r,setSwitch:a}),[r,a]),c=(0,v.L6)();return i.createElement(l,{name:"Switch.Description",value:o},i.createElement(n,{name:"Switch.Label",value:s,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}))}}},i.createElement(E.Provider,{value:u},c({ourProps:{},theirProps:e,slot:{},defaultTag:x,name:"Switch.Group"}))))},Label:k.__,Description:C.dk});var O=r(44140),N=r(26898),P=r(13241),S=r(1153),F=r(47187);let M=(0,S.fn)("Switch"),D=i.forwardRef((e,t)=>{let{checked:r,defaultChecked:s=!1,onChange:n,color:o,name:l,error:u,errorMessage:c,disabled:h,required:d,tooltip:f,id:m}=e,p=(0,a._T)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),y={bgColor:o?(0,S.bM)(o,N.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:o?(0,S.bM)(o,N.K.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[b,g]=(0,O.Z)(s,r),[v,C]=(0,i.useState)(!1),{tooltipProps:w,getReferenceProps:k}=(0,F.l)(300);return i.createElement("div",{className:"flex flex-row items-center justify-start"},i.createElement(F.Z,Object.assign({text:f},w)),i.createElement("div",Object.assign({ref:(0,S.lq)([t,w.refs.setReference]),className:(0,P.q)(M("root"),"flex flex-row relative h-5")},p,k),i.createElement("input",{type:"checkbox",className:(0,P.q)(M("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:l,required:d,checked:b,onChange:e=>{e.preventDefault()}}),i.createElement(q,{checked:b,onChange:e=>{g(e),null==n||n(e)},disabled:h,className:(0,P.q)(M("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",h?"cursor-not-allowed":""),onFocus:()=>C(!0),onBlur:()=>C(!1),id:m},i.createElement("span",{className:(0,P.q)(M("sr-only"),"sr-only")},"Switch ",b?"on":"off"),i.createElement("span",{"aria-hidden":"true",className:(0,P.q)(M("background"),b?y.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")}),i.createElement("span",{"aria-hidden":"true",className:(0,P.q)(M("round"),b?(0,P.q)(y.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",v?(0,P.q)("ring-2",y.ringColor):"")}))),u&&c?i.createElement("p",{className:(0,P.q)(M("errorMessage"),"text-sm text-red-500 mt-1 ")},c):null)});D.displayName="Switch"},35829:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var a=r(5853),s=r(26898),n=r(13241),i=r(1153),o=r(2265);let l=o.forwardRef((e,t)=>{let{color:r,children:l,className:u}=e,c=(0,a._T)(e,["color","children","className"]);return o.createElement("p",Object.assign({ref:t,className:(0,n.q)("font-semibold text-tremor-metric",r?(0,i.bM)(r,s.K.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",u)},c),l)});l.displayName="Metric"},86669:function(e,t,r){"use strict";r.d(t,{gc:function(){return C},jF:function(){return g}});var a=r(2265);let s=e=>"boolean"==typeof e||e instanceof Boolean,n=e=>"number"==typeof e||e instanceof Number,i=e=>"bigint"==typeof e||e instanceof BigInt,o=e=>!!e&&e instanceof Date,l=e=>"string"==typeof e||e instanceof String,u=e=>Array.isArray(e),c=e=>"object"==typeof e&&null!==e,h=e=>!!e&&e instanceof Object&&"function"==typeof e;function d(e,t){return void 0===t&&(t=!1),!e||t?`"${e}"`:e}function f(e){let{field:t,value:r,data:s,lastElement:n,openBracket:i,closeBracket:o,level:l,style:u,shouldExpandNode:c,clickToExpandNode:h,outerRef:f,beforeExpandChange:m}=e,p=(0,a.useRef)(!1),[y,g]=(0,a.useState)(()=>c(l,r,t)),v=(0,a.useRef)(null);(0,a.useEffect)(()=>{p.current?g(c(l,r,t)):p.current=!0},[c]);let C=(0,a.useId)();if(0===s.length)return function(e){let{field:t,openBracket:r,closeBracket:s,lastElement:n,style:i}=e;return(0,a.createElement)("div",{className:i.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||""===t)&&(0,a.createElement)("span",{className:i.label},d(t,i.quotesForFieldNames),":"),(0,a.createElement)("span",{className:i.punctuation},r),(0,a.createElement)("span",{className:i.punctuation},s),!n&&(0,a.createElement)("span",{className:i.punctuation},","))}({field:t,openBracket:i,closeBracket:o,lastElement:n,style:u});let w=y?u.collapseIcon:u.expandIcon,k=y?u.ariaLables.collapseJson:u.ariaLables.expandJson,E=l+1,x=s.length-1,q=e=>{y!==e&&(!m||m({level:l,value:r,field:t,newExpandValue:e}))&&g(e)},O=e=>{if("ArrowRight"===e.key||"ArrowLeft"===e.key)e.preventDefault(),q("ArrowRight"===e.key);else if("ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();let t="ArrowUp"===e.key?-1:1;if(!f.current)return;let r=f.current.querySelectorAll("[role=button]"),a=-1;for(let e=0;e{var e;q(!y);let t=v.current;if(!t)return;let r=null===(e=f.current)||void 0===e?void 0:e.querySelector('[role=button][tabindex="0"]');r&&(r.tabIndex=-1),t.tabIndex=0,t.focus()};return(0,a.createElement)("div",{className:u.basicChildStyle,role:"treeitem","aria-expanded":y,"aria-selected":void 0},(0,a.createElement)("span",{className:w,onClick:N,onKeyDown:O,role:"button","aria-label":k,"aria-expanded":y,"aria-controls":y?C:void 0,ref:v,tabIndex:0===l?0:-1}),(t||""===t)&&(h?(0,a.createElement)("span",{className:u.clickableLabel,onClick:N,onKeyDown:O},d(t,u.quotesForFieldNames),":"):(0,a.createElement)("span",{className:u.label},d(t,u.quotesForFieldNames),":")),(0,a.createElement)("span",{className:u.punctuation},i),y?(0,a.createElement)("ul",{id:C,role:"group",className:u.childFieldsContainer},s.map((e,t)=>(0,a.createElement)(b,{key:e[0]||t,field:e[0],value:e[1],style:u,lastElement:t===x,level:E,shouldExpandNode:c,clickToExpandNode:h,beforeExpandChange:m,outerRef:f}))):(0,a.createElement)("span",{className:u.collapsedContent,onClick:N,onKeyDown:O}),(0,a.createElement)("span",{className:u.punctuation},o),!n&&(0,a.createElement)("span",{className:u.punctuation},","))}function m(e){let{field:t,value:r,style:a,lastElement:s,shouldExpandNode:n,clickToExpandNode:i,level:o,outerRef:l,beforeExpandChange:u}=e;return f({field:t,value:r,lastElement:s||!1,level:o,openBracket:"{",closeBracket:"}",style:a,shouldExpandNode:n,clickToExpandNode:i,data:Object.keys(r).map(e=>[e,r[e]]),outerRef:l,beforeExpandChange:u})}function p(e){let{field:t,value:r,style:a,lastElement:s,level:n,shouldExpandNode:i,clickToExpandNode:o,outerRef:l,beforeExpandChange:u}=e;return f({field:t,value:r,lastElement:s||!1,level:n,openBracket:"[",closeBracket:"]",style:a,shouldExpandNode:i,clickToExpandNode:o,data:r.map(e=>[void 0,e]),outerRef:l,beforeExpandChange:u})}function y(e){let t,{field:r,value:u,style:c,lastElement:f}=e,m=c.otherValue;if(null===u)t="null",m=c.nullValue;else if(void 0===u)t="undefined",m=c.undefinedValue;else if(l(u)){var p;p=!c.noQuotesForStringValues,t=c.stringifyStringValues?JSON.stringify(u):p?`"${u}"`:u,m=c.stringValue}else s(u)?(t=u?"true":"false",m=c.booleanValue):n(u)?(t=u.toString(),m=c.numberValue):i(u)?(t=`${u.toString()}n`,m=c.numberValue):t=o(u)?u.toISOString():h(u)?"function() { }":u.toString();return(0,a.createElement)("div",{className:c.basicChildStyle,role:"treeitem","aria-selected":void 0},(r||""===r)&&(0,a.createElement)("span",{className:c.label},d(r,c.quotesForFieldNames),":"),(0,a.createElement)("span",{className:m},t),!f&&(0,a.createElement)("span",{className:c.punctuation},","))}function b(e){let t=e.value;return u(t)?(0,a.createElement)(p,Object.assign({},e)):!c(t)||o(t)||h(t)?(0,a.createElement)(y,Object.assign({},e)):(0,a.createElement)(m,Object.assign({},e))}let g={container:"_2IvMF _GzYRV",basicChildStyle:"_2bkNM",childFieldsContainer:"_1BXBN",label:"_1MGIk",clickableLabel:"_2YKJg _1MGIk _1MFti",nullValue:"_2T6PJ",undefinedValue:"_1Gho6",stringValue:"_vGjyY",booleanValue:"_3zQKs",numberValue:"_1bQdo",otherValue:"_1xvuR",punctuation:"_3uHL6 _3eOF8",collapseIcon:"_oLqym _f10Tu _1MFti _1LId0",expandIcon:"_2AXVT _f10Tu _1MFti _1UmXx",collapsedContent:"_2KJWg _1pNG9 _1MFti",noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:{collapseJson:"collapse JSON",expandJson:"expand JSON"},stringifyStringValues:!1},v=()=>!0,C=e=>{let{data:t,style:r=g,shouldExpandNode:s=v,clickToExpandNode:n=!1,beforeExpandChange:i,compactTopLevel:o,...l}=e,u=(0,a.useRef)(null);return(0,a.createElement)("div",Object.assign({"aria-label":"JSON view"},l,{className:r.container,ref:u,role:"tree"}),o&&c(t)?Object.entries(t).map(e=>{let[t,o]=e;return(0,a.createElement)(b,{key:t,field:t,value:o,style:{...g,...r},lastElement:!0,level:1,shouldExpandNode:s,clickToExpandNode:n,beforeExpandChange:i,outerRef:u})}):(0,a.createElement)(b,{value:t,style:{...g,...r},lastElement:!0,level:0,shouldExpandNode:s,clickToExpandNode:n,outerRef:u,beforeExpandChange:i}))}},52621:function(){},2356:function(e,t,r){"use strict";var a=r(2265);let s=a.forwardRef(function(e,t){return a.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),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",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"}))});t.Z=s},2894:function(e,t,r){"use strict";r.d(t,{R:function(){return o},m:function(){return i}});var a=r(18238),s=r(7989),n=r(11255),i=class extends s.F{#e;#t;#r;#a;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||o(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#r.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#s({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=(0,n.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#s({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#s({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});let a="pending"===this.state.status,s=!this.#a.canStart();try{if(a)t();else{this.#s({type:"pending",variables:e,isPaused:s}),await this.#r.config.onMutate?.(e,this,r);let t=await this.options.onMutate?.(e,r);t!==this.state.context&&this.#s({type:"pending",context:t,variables:e,isPaused:s})}let n=await this.#a.start();return await this.#r.config.onSuccess?.(n,e,this.state.context,this,r),await this.options.onSuccess?.(n,e,this.state.context,r),await this.#r.config.onSettled?.(n,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(n,null,e,this.state.context,r),this.#s({type:"success",data:n}),n}catch(t){try{throw await this.#r.config.onError?.(t,e,this.state.context,this,r),await this.options.onError?.(t,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,t,e,this.state.context,r),t}finally{this.#s({type:"error",error:t})}}finally{this.#r.runNext(this)}}#s(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),a.Vr.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function o(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},21623:function(e,t,r){"use strict";r.d(t,{S:function(){return p}});var a=r(45345),s=r(21733),n=r(18238),i=r(24112),o=class extends i.l{constructor(e={}){super(),this.config=e,this.#n=new Map}#n;build(e,t,r){let n=t.queryKey,i=t.queryHash??(0,a.Rm)(n,t),o=this.get(i);return o||(o=new s.A({client:e,queryKey:n,queryHash:i,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){this.#n.has(e.queryHash)||(this.#n.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#n.get(e.queryHash);t&&(e.destroy(),t===e&&this.#n.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){n.Vr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#n.get(e)}getAll(){return[...this.#n.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,a._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,a._x)(e,t)):t}notify(e){n.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){n.Vr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){n.Vr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},l=r(2894),u=class extends i.l{constructor(e={}){super(),this.config=e,this.#i=new Set,this.#o=new Map,this.#l=0}#i;#o;#l;build(e,t,r){let a=new l.m({client:e,mutationCache:this,mutationId:++this.#l,options:e.defaultMutationOptions(t),state:r});return this.add(a),a}add(e){this.#i.add(e);let t=c(e);if("string"==typeof t){let r=this.#o.get(t);r?r.push(e):this.#o.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#i.delete(e)){let t=c(e);if("string"==typeof t){let r=this.#o.get(t);if(r){if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#o.delete(t)}}}this.notify({type:"removed",mutation:e})}canRun(e){let t=c(e);if("string"!=typeof t)return!0;{let r=this.#o.get(t),a=r?.find(e=>"pending"===e.state.status);return!a||a===e}}runNext(e){let t=c(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#o.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){n.Vr.batch(()=>{this.#i.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#i.clear(),this.#o.clear()})}getAll(){return Array.from(this.#i)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,a.X7)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,a.X7)(e,t))}notify(e){n.Vr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return n.Vr.batch(()=>Promise.all(e.map(e=>e.continue().catch(a.ZT))))}};function c(e){return e.options.scope?.id}var h=r(87045),d=r(57853);function f(e){return{onFetch:(t,r)=>{let s=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],o=t.state.data?.pageParams||[],l={pages:[],pageParams:[]},u=0,c=async()=>{let r=!1,c=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?r=!0:t.signal.addEventListener("abort",()=>{r=!0}),t.signal)})},h=(0,a.cG)(t.options,t.fetchOptions),d=async(e,s,n)=>{if(r)return Promise.reject();if(null==s&&e.pages.length)return Promise.resolve(e);let i=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:s,direction:n?"backward":"forward",meta:t.options.meta};return c(e),e})(),o=await h(i),{maxPages:l}=t.options,u=n?a.Ht:a.VX;return{pages:u(e.pages,o,l),pageParams:u(e.pageParams,s,l)}};if(n&&i.length){let e="backward"===n,t={pages:i,pageParams:o},r=(e?function(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}:m)(s,t);l=await d(t,r,e)}else{let t=e??i.length;do{let e=0===u?o[0]??s.initialPageParam:m(s,l);if(u>0&&null==e)break;l=await d(l,e),u++}while(ut.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=c}}}function m(e,{pages:t,pageParams:r}){let a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,r[a],r):void 0}var p=class{#u;#r;#c;#h;#d;#f;#m;#p;constructor(e={}){this.#u=e.queryCache||new o,this.#r=e.mutationCache||new u,this.#c=e.defaultOptions||{},this.#h=new Map,this.#d=new Map,this.#f=0}mount(){this.#f++,1===this.#f&&(this.#m=h.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#p=d.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#f--,0===this.#f&&(this.#m?.(),this.#m=void 0,this.#p?.(),this.#p=void 0)}isFetching(e){return this.#u.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#r.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),r=this.#u.build(this,t),s=r.state.data;return void 0===s?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime((0,a.KC)(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return this.#u.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let s=this.defaultQueryOptions({queryKey:e}),n=this.#u.get(s.queryHash),i=n?.state.data,o=(0,a.SE)(t,i);if(void 0!==o)return this.#u.build(this,s).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return n.Vr.batch(()=>this.#u.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#u.get(t.queryHash)?.state}removeQueries(e){let t=this.#u;n.Vr.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#u;return n.Vr.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let r={revert:!0,...t};return Promise.all(n.Vr.batch(()=>this.#u.findAll(e).map(e=>e.cancel(r)))).then(a.ZT).catch(a.ZT)}invalidateQueries(e,t={}){return n.Vr.batch(()=>(this.#u.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let r={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(n.Vr.batch(()=>this.#u.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(a.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(a.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#u.build(this,t);return r.isStaleByTime((0,a.KC)(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(a.ZT).catch(a.ZT)}fetchInfiniteQuery(e){return e.behavior=f(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(a.ZT).catch(a.ZT)}ensureInfiniteQueryData(e){return e.behavior=f(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return d.N.isOnline()?this.#r.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#r}getDefaultOptions(){return this.#c}setDefaultOptions(e){this.#c=e}setQueryDefaults(e,t){this.#h.set((0,a.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#h.values()],r={};return t.forEach(t=>{(0,a.to)(e,t.queryKey)&&Object.assign(r,t.defaultOptions)}),r}setMutationDefaults(e,t){this.#d.set((0,a.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#d.values()],r={};return t.forEach(t=>{(0,a.to)(e,t.mutationKey)&&Object.assign(r,t.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#c.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,a.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===a.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#c.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#u.clear(),this.#r.clear()}}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2618-e3b2304a0f9519ff.js b/litellm/proxy/_experimental/out/_next/static/chunks/2618-062177b80fc4a38e.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/2618-e3b2304a0f9519ff.js rename to litellm/proxy/_experimental/out/_next/static/chunks/2618-062177b80fc4a38e.js index 8d7d667d27..4a8e503673 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2618-e3b2304a0f9519ff.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2618-062177b80fc4a38e.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2618],{87602:function(e,r,o){function t(){for(var e,r,o=0,t="",l=arguments.length;o"boolean"==typeof e?`${e}`:0===e?"0":e,n=e=>{let r=function(){for(var r,o,l=arguments.length,n=Array(l),a=0;a{let t=Object.fromEntries(Object.entries(e||{}).filter(e=>{let[r]=e;return!["class","className"].includes(r)}));return r(o.map(e=>e(t)),null==e?void 0:e.class,null==e?void 0:e.className)}},cva:e=>o=>{var t;if((null==e?void 0:e.variants)==null)return r(null==e?void 0:e.base,null==o?void 0:o.class,null==o?void 0:o.className);let{variants:n,defaultVariants:a}=e,s=Object.keys(n).map(e=>{let r=null==o?void 0:o[e],t=null==a?void 0:a[e],s=l(r)||l(t);return n[e][s]}),i={...a,...o&&Object.entries(o).reduce((e,r)=>{let[o,t]=r;return void 0===t?e:{...e,[o]:t}},{})},d=null==e?void 0:null===(t=e.compoundVariants)||void 0===t?void 0:t.reduce((e,r)=>{let{class:o,className:t,...l}=r;return Object.entries(l).every(e=>{let[r,o]=e,t=i[r];return Array.isArray(o)?o.includes(t):t===o})?[...e,o,t]:e},[]);return r(null==e?void 0:e.base,s,d,null==o?void 0:o.class,null==o?void 0:o.className)},cx:r}},{compose:a,cva:s,cx:i}=n()},53335:function(e,r,o){o.d(r,{m6:function(){return ev}});let t=(e,r)=>{let o=Array(e.length+r.length);for(let r=0;r({classGroupId:e,validator:r}),n=(e=new Map,r=null,o)=>({nextPart:e,validators:r,classGroupId:o}),a=[],s=e=>{let r=c(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:l}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return d(e);let o=e.split("-"),t=""===o[0]&&o.length>1?1:0;return i(o,t,r)},getConflictingClassGroupIds:(e,r)=>{if(r){let r=l[e],n=o[e];return r?n?t(n,r):r:n||a}return o[e]||a}}},i=(e,r,o)=>{if(0==e.length-r)return o.classGroupId;let t=e[r],l=o.nextPart.get(t);if(l){let o=i(e,r+1,l);if(o)return o}let n=o.validators;if(null===n)return;let a=0===r?e.join("-"):e.slice(r).join("-"),s=n.length;for(let e=0;e-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{let r=e.slice(1,-1),o=r.indexOf(":"),t=r.slice(0,o);return t?"arbitrary.."+t:void 0})(),c=e=>{let{theme:r,classGroups:o}=e;return m(o,r)},m=(e,r)=>{let o=n();for(let t in e)p(e[t],o,t,r);return o},p=(e,r,o,t)=>{let l=e.length;for(let n=0;n{if("string"==typeof e){b(e,r,o);return}if("function"==typeof e){f(e,r,o,t);return}g(e,r,o,t)},b=(e,r,o)=>{(""===e?r:h(r,e)).classGroupId=o},f=(e,r,o,t)=>{if(k(e)){p(e(t),r,o,t);return}null===r.validators&&(r.validators=[]),r.validators.push(l(o,e))},g=(e,r,o,t)=>{let l=Object.entries(e),n=l.length;for(let e=0;e{let o=e,t=r.split("-"),l=t.length;for(let e=0;e"isThemeGetter"in e&&!0===e.isThemeGetter,v=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let r=0,o=Object.create(null),t=Object.create(null),l=(l,n)=>{o[l]=n,++r>e&&(r=0,t=o,o=Object.create(null))};return{get(e){let r=o[e];return void 0!==r?r:void 0!==(r=t[e])?(l(e,r),r):void 0},set(e,r){e in o?o[e]=r:l(e,r)}}},x=[],w=(e,r,o,t,l)=>({modifiers:e,hasImportantModifier:r,baseClassName:o,maybePostfixModifierPosition:t,isExternal:l}),y=e=>{let{prefix:r,experimentalParseClassName:o}=e,t=e=>{let r;let o=[],t=0,l=0,n=0,a=e.length;for(let s=0;sn?r-n:void 0)};if(r){let e=r+":",o=t;t=r=>r.startsWith(e)?o(r.slice(e.length)):w(x,!1,r,void 0,!0)}if(o){let e=t;t=r=>o({className:r,parseClassName:e})}return t},z=e=>{let r=new Map;return e.orderSensitiveModifiers.forEach((e,o)=>{r.set(e,1e6+o)}),e=>{let o=[],t=[];for(let l=0;l0&&(t.sort(),o.push(...t),t=[]),o.push(n)):t.push(n)}return t.length>0&&(t.sort(),o.push(...t)),o}},j=e=>({cache:v(e.cacheSize),parseClassName:y(e),sortModifiers:z(e),...s(e)}),N=/\s+/,O=(e,r)=>{let{parseClassName:o,getClassGroupId:t,getConflictingClassGroupIds:l,sortModifiers:n}=r,a=[],s=e.trim().split(N),i="";for(let e=s.length-1;e>=0;e-=1){let r=s[e],{isExternal:d,modifiers:c,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:u}=o(r);if(d){i=r+(i.length>0?" "+i:i);continue}let b=!!u,f=t(b?p.substring(0,u):p);if(!f){if(!b||!(f=t(p))){i=r+(i.length>0?" "+i:i);continue}b=!1}let g=0===c.length?"":1===c.length?c[0]:n(c).join(":"),h=m?g+"!":g,k=h+f;if(a.indexOf(k)>-1)continue;a.push(k);let v=l(f,b);for(let e=0;e0?" "+i:i)}return i},C=(...e)=>{let r,o,t=0,l="";for(;t{let r;if("string"==typeof e)return e;let o="";for(let t=0;t{let r=r=>r[e]||W;return r.isThemeGetter=!0,r},A=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,I=/^\((?:(\w[\w-]*):)?(.+)\)$/i,M=/^\d+\/\d+$/,_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,E=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,S=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,P=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,T=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,q=e=>M.test(e),Z=e=>!!e&&!Number.isNaN(Number(e)),D=e=>!!e&&Number.isInteger(Number(e)),V=e=>e.endsWith("%")&&Z(e.slice(0,-1)),B=e=>_.test(e),F=()=>!0,H=e=>E.test(e)&&!S.test(e),J=()=>!1,K=e=>P.test(e),L=e=>T.test(e),Q=e=>!U(e)&&!et(e),R=e=>ec(e,eb,J),U=e=>A.test(e),X=e=>ec(e,ef,H),Y=e=>ec(e,eg,Z),ee=e=>ec(e,ep,J),er=e=>ec(e,eu,L),eo=e=>ec(e,ek,K),et=e=>I.test(e),el=e=>em(e,ef),en=e=>em(e,eh),ea=e=>em(e,ep),es=e=>em(e,eb),ei=e=>em(e,eu),ed=e=>em(e,ek,!0),ec=(e,r,o)=>{let t=A.exec(e);return!!t&&(t[1]?r(t[1]):o(t[2]))},em=(e,r,o=!1)=>{let t=I.exec(e);return!!t&&(t[1]?r(t[1]):o)},ep=e=>"position"===e||"percentage"===e,eu=e=>"image"===e||"url"===e,eb=e=>"length"===e||"size"===e||"bg-size"===e,ef=e=>"length"===e,eg=e=>"number"===e,eh=e=>"family-name"===e,ek=e=>"shadow"===e,ev=((e,...r)=>{let o,t,l,n;let a=e=>{let r=t(e);if(r)return r;let n=O(e,o);return l(e,n),n};return n=s=>(t=(o=j(r.reduce((e,r)=>r(e),e()))).cache.get,l=o.cache.set,n=a,a(s)),(...e)=>n(C(...e))})(()=>{let e=$("color"),r=$("font"),o=$("text"),t=$("font-weight"),l=$("tracking"),n=$("leading"),a=$("breakpoint"),s=$("container"),i=$("spacing"),d=$("radius"),c=$("shadow"),m=$("inset-shadow"),p=$("text-shadow"),u=$("drop-shadow"),b=$("blur"),f=$("perspective"),g=$("aspect"),h=$("ease"),k=$("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...x(),et,U],y=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],j=()=>[et,U,i],N=()=>[q,"full","auto",...j()],O=()=>[D,"none","subgrid",et,U],C=()=>["auto",{span:["full",D,et,U]},D,et,U],G=()=>[D,"auto",et,U],W=()=>["auto","min","max","fr",et,U],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...j()],_=()=>[q,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],E=()=>[e,et,U],S=()=>[...x(),ea,ee,{position:[et,U]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",es,R,{size:[et,U]}],H=()=>[V,el,X],J=()=>["","none","full",d,et,U],K=()=>["",Z,el,X],L=()=>["solid","dashed","dotted","double"],ec=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],em=()=>[Z,V,ea,ee],ep=()=>["","none",b,et,U],eu=()=>["none",Z,et,U],eb=()=>["none",Z,et,U],ef=()=>[Z,et,U],eg=()=>[q,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[B],breakpoint:[B],color:[F],container:[B],"drop-shadow":[B],ease:["in","out","in-out"],font:[Q],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[B],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[B],shadow:[B],spacing:["px",Z],text:[B],"text-shadow":[B],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",q,U,et,g]}],container:["container"],columns:[{columns:[Z,U,et,s]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],overflow:[{overflow:y()}],"overflow-x":[{"overflow-x":y()}],"overflow-y":[{"overflow-y":y()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[D,"auto",et,U]}],basis:[{basis:[q,"full","auto",s,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Z,q,"auto","initial","none",U]}],grow:[{grow:["",Z,et,U]}],shrink:[{shrink:["",Z,et,U]}],order:[{order:[D,"first","last","none",et,U]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...I(),"normal"]}],"justify-self":[{"justify-self":["auto",...I()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...I(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...I(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...I(),"baseline"]}],"place-self":[{"place-self":["auto",...I()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:_()}],w:[{w:[s,"screen",..._()]}],"min-w":[{"min-w":[s,"screen","none",..._()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[a]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh",..._()]}],"font-size":[{text:["base",o,el,X]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,et,Y]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",V,U]}],"font-family":[{font:[en,U,r]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,et,U]}],"line-clamp":[{"line-clamp":[Z,"none",et,Y]}],leading:[{leading:[n,...j()]}],"list-image":[{"list-image":["none",et,U]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,U]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:[Z,"from-font","auto",et,X]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[Z,"auto",et,U]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,U]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,U]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:S()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},D,et,U],radial:["",et,U],conic:[D,et,U]},ei,er]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:J()}],"rounded-s":[{"rounded-s":J()}],"rounded-e":[{"rounded-e":J()}],"rounded-t":[{"rounded-t":J()}],"rounded-r":[{"rounded-r":J()}],"rounded-b":[{"rounded-b":J()}],"rounded-l":[{"rounded-l":J()}],"rounded-ss":[{"rounded-ss":J()}],"rounded-se":[{"rounded-se":J()}],"rounded-ee":[{"rounded-ee":J()}],"rounded-es":[{"rounded-es":J()}],"rounded-tl":[{"rounded-tl":J()}],"rounded-tr":[{"rounded-tr":J()}],"rounded-br":[{"rounded-br":J()}],"rounded-bl":[{"rounded-bl":J()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...L(),"hidden","none"]}],"divide-style":[{divide:[...L(),"hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...L(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Z,et,U]}],"outline-w":[{outline:["",Z,el,X]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",c,ed,eo]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",m,ed,eo]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[Z,X]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",p,ed,eo]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[Z,et,U]}],"mix-blend":[{"mix-blend":[...ec(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ec()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Z]}],"mask-image-linear-from-pos":[{"mask-linear-from":em()}],"mask-image-linear-to-pos":[{"mask-linear-to":em()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":em()}],"mask-image-t-to-pos":[{"mask-t-to":em()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":em()}],"mask-image-r-to-pos":[{"mask-r-to":em()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":em()}],"mask-image-b-to-pos":[{"mask-b-to":em()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":em()}],"mask-image-l-to-pos":[{"mask-l-to":em()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":em()}],"mask-image-x-to-pos":[{"mask-x-to":em()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":em()}],"mask-image-y-to-pos":[{"mask-y-to":em()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[et,U]}],"mask-image-radial-from-pos":[{"mask-radial-from":em()}],"mask-image-radial-to-pos":[{"mask-radial-to":em()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[Z]}],"mask-image-conic-from-pos":[{"mask-conic-from":em()}],"mask-image-conic-to-pos":[{"mask-conic-to":em()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:S()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,U]}],filter:[{filter:["","none",et,U]}],blur:[{blur:ep()}],brightness:[{brightness:[Z,et,U]}],contrast:[{contrast:[Z,et,U]}],"drop-shadow":[{"drop-shadow":["","none",u,ed,eo]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",Z,et,U]}],"hue-rotate":[{"hue-rotate":[Z,et,U]}],invert:[{invert:["",Z,et,U]}],saturate:[{saturate:[Z,et,U]}],sepia:[{sepia:["",Z,et,U]}],"backdrop-filter":[{"backdrop-filter":["","none",et,U]}],"backdrop-blur":[{"backdrop-blur":ep()}],"backdrop-brightness":[{"backdrop-brightness":[Z,et,U]}],"backdrop-contrast":[{"backdrop-contrast":[Z,et,U]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Z,et,U]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Z,et,U]}],"backdrop-invert":[{"backdrop-invert":["",Z,et,U]}],"backdrop-opacity":[{"backdrop-opacity":[Z,et,U]}],"backdrop-saturate":[{"backdrop-saturate":[Z,et,U]}],"backdrop-sepia":[{"backdrop-sepia":["",Z,et,U]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,U]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Z,"initial",et,U]}],ease:[{ease:["linear","initial",h,et,U]}],delay:[{delay:[Z,et,U]}],animate:[{animate:["none",k,et,U]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,et,U]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:eu()}],"rotate-x":[{"rotate-x":eu()}],"rotate-y":[{"rotate-y":eu()}],"rotate-z":[{"rotate-z":eu()}],scale:[{scale:eb()}],"scale-x":[{"scale-x":eb()}],"scale-y":[{"scale-y":eb()}],"scale-z":[{"scale-z":eb()}],"scale-3d":["scale-3d"],skew:[{skew:ef()}],"skew-x":[{"skew-x":ef()}],"skew-y":[{"skew-y":ef()}],transform:[{transform:[et,U,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:eg()}],"translate-x":[{"translate-x":eg()}],"translate-y":[{"translate-y":eg()}],"translate-z":[{"translate-z":eg()}],"translate-none":["translate-none"],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",et,U]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",et,U]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[Z,el,X,Y]}],stroke:[{stroke:["none",...E()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}})}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2618],{61994:function(e,r,o){function t(){for(var e,r,o=0,t="",l=arguments.length;o"boolean"==typeof e?`${e}`:0===e?"0":e,n=e=>{let r=function(){for(var r,o,l=arguments.length,n=Array(l),a=0;a{let t=Object.fromEntries(Object.entries(e||{}).filter(e=>{let[r]=e;return!["class","className"].includes(r)}));return r(o.map(e=>e(t)),null==e?void 0:e.class,null==e?void 0:e.className)}},cva:e=>o=>{var t;if((null==e?void 0:e.variants)==null)return r(null==e?void 0:e.base,null==o?void 0:o.class,null==o?void 0:o.className);let{variants:n,defaultVariants:a}=e,s=Object.keys(n).map(e=>{let r=null==o?void 0:o[e],t=null==a?void 0:a[e],s=l(r)||l(t);return n[e][s]}),i={...a,...o&&Object.entries(o).reduce((e,r)=>{let[o,t]=r;return void 0===t?e:{...e,[o]:t}},{})},d=null==e?void 0:null===(t=e.compoundVariants)||void 0===t?void 0:t.reduce((e,r)=>{let{class:o,className:t,...l}=r;return Object.entries(l).every(e=>{let[r,o]=e,t=i[r];return Array.isArray(o)?o.includes(t):t===o})?[...e,o,t]:e},[]);return r(null==e?void 0:e.base,s,d,null==o?void 0:o.class,null==o?void 0:o.className)},cx:r}},{compose:a,cva:s,cx:i}=n()},53335:function(e,r,o){o.d(r,{m6:function(){return ev}});let t=(e,r)=>{let o=Array(e.length+r.length);for(let r=0;r({classGroupId:e,validator:r}),n=(e=new Map,r=null,o)=>({nextPart:e,validators:r,classGroupId:o}),a=[],s=e=>{let r=c(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:l}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return d(e);let o=e.split("-"),t=""===o[0]&&o.length>1?1:0;return i(o,t,r)},getConflictingClassGroupIds:(e,r)=>{if(r){let r=l[e],n=o[e];return r?n?t(n,r):r:n||a}return o[e]||a}}},i=(e,r,o)=>{if(0==e.length-r)return o.classGroupId;let t=e[r],l=o.nextPart.get(t);if(l){let o=i(e,r+1,l);if(o)return o}let n=o.validators;if(null===n)return;let a=0===r?e.join("-"):e.slice(r).join("-"),s=n.length;for(let e=0;e-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{let r=e.slice(1,-1),o=r.indexOf(":"),t=r.slice(0,o);return t?"arbitrary.."+t:void 0})(),c=e=>{let{theme:r,classGroups:o}=e;return m(o,r)},m=(e,r)=>{let o=n();for(let t in e)p(e[t],o,t,r);return o},p=(e,r,o,t)=>{let l=e.length;for(let n=0;n{if("string"==typeof e){b(e,r,o);return}if("function"==typeof e){f(e,r,o,t);return}g(e,r,o,t)},b=(e,r,o)=>{(""===e?r:h(r,e)).classGroupId=o},f=(e,r,o,t)=>{if(k(e)){p(e(t),r,o,t);return}null===r.validators&&(r.validators=[]),r.validators.push(l(o,e))},g=(e,r,o,t)=>{let l=Object.entries(e),n=l.length;for(let e=0;e{let o=e,t=r.split("-"),l=t.length;for(let e=0;e"isThemeGetter"in e&&!0===e.isThemeGetter,v=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let r=0,o=Object.create(null),t=Object.create(null),l=(l,n)=>{o[l]=n,++r>e&&(r=0,t=o,o=Object.create(null))};return{get(e){let r=o[e];return void 0!==r?r:void 0!==(r=t[e])?(l(e,r),r):void 0},set(e,r){e in o?o[e]=r:l(e,r)}}},x=[],w=(e,r,o,t,l)=>({modifiers:e,hasImportantModifier:r,baseClassName:o,maybePostfixModifierPosition:t,isExternal:l}),y=e=>{let{prefix:r,experimentalParseClassName:o}=e,t=e=>{let r;let o=[],t=0,l=0,n=0,a=e.length;for(let s=0;sn?r-n:void 0)};if(r){let e=r+":",o=t;t=r=>r.startsWith(e)?o(r.slice(e.length)):w(x,!1,r,void 0,!0)}if(o){let e=t;t=r=>o({className:r,parseClassName:e})}return t},z=e=>{let r=new Map;return e.orderSensitiveModifiers.forEach((e,o)=>{r.set(e,1e6+o)}),e=>{let o=[],t=[];for(let l=0;l0&&(t.sort(),o.push(...t),t=[]),o.push(n)):t.push(n)}return t.length>0&&(t.sort(),o.push(...t)),o}},j=e=>({cache:v(e.cacheSize),parseClassName:y(e),sortModifiers:z(e),...s(e)}),N=/\s+/,O=(e,r)=>{let{parseClassName:o,getClassGroupId:t,getConflictingClassGroupIds:l,sortModifiers:n}=r,a=[],s=e.trim().split(N),i="";for(let e=s.length-1;e>=0;e-=1){let r=s[e],{isExternal:d,modifiers:c,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:u}=o(r);if(d){i=r+(i.length>0?" "+i:i);continue}let b=!!u,f=t(b?p.substring(0,u):p);if(!f){if(!b||!(f=t(p))){i=r+(i.length>0?" "+i:i);continue}b=!1}let g=0===c.length?"":1===c.length?c[0]:n(c).join(":"),h=m?g+"!":g,k=h+f;if(a.indexOf(k)>-1)continue;a.push(k);let v=l(f,b);for(let e=0;e0?" "+i:i)}return i},C=(...e)=>{let r,o,t=0,l="";for(;t{let r;if("string"==typeof e)return e;let o="";for(let t=0;t{let r=r=>r[e]||W;return r.isThemeGetter=!0,r},A=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,I=/^\((?:(\w[\w-]*):)?(.+)\)$/i,M=/^\d+\/\d+$/,_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,E=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,S=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,P=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,T=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,q=e=>M.test(e),Z=e=>!!e&&!Number.isNaN(Number(e)),D=e=>!!e&&Number.isInteger(Number(e)),V=e=>e.endsWith("%")&&Z(e.slice(0,-1)),B=e=>_.test(e),F=()=>!0,H=e=>E.test(e)&&!S.test(e),J=()=>!1,K=e=>P.test(e),L=e=>T.test(e),Q=e=>!U(e)&&!et(e),R=e=>ec(e,eb,J),U=e=>A.test(e),X=e=>ec(e,ef,H),Y=e=>ec(e,eg,Z),ee=e=>ec(e,ep,J),er=e=>ec(e,eu,L),eo=e=>ec(e,ek,K),et=e=>I.test(e),el=e=>em(e,ef),en=e=>em(e,eh),ea=e=>em(e,ep),es=e=>em(e,eb),ei=e=>em(e,eu),ed=e=>em(e,ek,!0),ec=(e,r,o)=>{let t=A.exec(e);return!!t&&(t[1]?r(t[1]):o(t[2]))},em=(e,r,o=!1)=>{let t=I.exec(e);return!!t&&(t[1]?r(t[1]):o)},ep=e=>"position"===e||"percentage"===e,eu=e=>"image"===e||"url"===e,eb=e=>"length"===e||"size"===e||"bg-size"===e,ef=e=>"length"===e,eg=e=>"number"===e,eh=e=>"family-name"===e,ek=e=>"shadow"===e,ev=((e,...r)=>{let o,t,l,n;let a=e=>{let r=t(e);if(r)return r;let n=O(e,o);return l(e,n),n};return n=s=>(t=(o=j(r.reduce((e,r)=>r(e),e()))).cache.get,l=o.cache.set,n=a,a(s)),(...e)=>n(C(...e))})(()=>{let e=$("color"),r=$("font"),o=$("text"),t=$("font-weight"),l=$("tracking"),n=$("leading"),a=$("breakpoint"),s=$("container"),i=$("spacing"),d=$("radius"),c=$("shadow"),m=$("inset-shadow"),p=$("text-shadow"),u=$("drop-shadow"),b=$("blur"),f=$("perspective"),g=$("aspect"),h=$("ease"),k=$("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],x=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],w=()=>[...x(),et,U],y=()=>["auto","hidden","clip","visible","scroll"],z=()=>["auto","contain","none"],j=()=>[et,U,i],N=()=>[q,"full","auto",...j()],O=()=>[D,"none","subgrid",et,U],C=()=>["auto",{span:["full",D,et,U]},D,et,U],G=()=>[D,"auto",et,U],W=()=>["auto","min","max","fr",et,U],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],I=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...j()],_=()=>[q,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],E=()=>[e,et,U],S=()=>[...x(),ea,ee,{position:[et,U]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",es,R,{size:[et,U]}],H=()=>[V,el,X],J=()=>["","none","full",d,et,U],K=()=>["",Z,el,X],L=()=>["solid","dashed","dotted","double"],ec=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],em=()=>[Z,V,ea,ee],ep=()=>["","none",b,et,U],eu=()=>["none",Z,et,U],eb=()=>["none",Z,et,U],ef=()=>[Z,et,U],eg=()=>[q,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[B],breakpoint:[B],color:[F],container:[B],"drop-shadow":[B],ease:["in","out","in-out"],font:[Q],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[B],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[B],shadow:[B],spacing:["px",Z],text:[B],"text-shadow":[B],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",q,U,et,g]}],container:["container"],columns:[{columns:[Z,U,et,s]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],overflow:[{overflow:y()}],"overflow-x":[{"overflow-x":y()}],"overflow-y":[{"overflow-y":y()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{start:N()}],end:[{end:N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[D,"auto",et,U]}],basis:[{basis:[q,"full","auto",s,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Z,q,"auto","initial","none",U]}],grow:[{grow:["",Z,et,U]}],shrink:[{shrink:["",Z,et,U]}],order:[{order:[D,"first","last","none",et,U]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...I(),"normal"]}],"justify-self":[{"justify-self":["auto",...I()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...I(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...I(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...I(),"baseline"]}],"place-self":[{"place-self":["auto",...I()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:_()}],w:[{w:[s,"screen",..._()]}],"min-w":[{"min-w":[s,"screen","none",..._()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[a]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh",..._()]}],"font-size":[{text:["base",o,el,X]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[t,et,Y]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",V,U]}],"font-family":[{font:[en,U,r]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,et,U]}],"line-clamp":[{"line-clamp":[Z,"none",et,Y]}],leading:[{leading:[n,...j()]}],"list-image":[{"list-image":["none",et,U]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",et,U]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:[Z,"from-font","auto",et,X]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[Z,"auto",et,U]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",et,U]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",et,U]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:S()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},D,et,U],radial:["",et,U],conic:[D,et,U]},ei,er]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],rounded:[{rounded:J()}],"rounded-s":[{"rounded-s":J()}],"rounded-e":[{"rounded-e":J()}],"rounded-t":[{"rounded-t":J()}],"rounded-r":[{"rounded-r":J()}],"rounded-b":[{"rounded-b":J()}],"rounded-l":[{"rounded-l":J()}],"rounded-ss":[{"rounded-ss":J()}],"rounded-se":[{"rounded-se":J()}],"rounded-ee":[{"rounded-ee":J()}],"rounded-es":[{"rounded-es":J()}],"rounded-tl":[{"rounded-tl":J()}],"rounded-tr":[{"rounded-tr":J()}],"rounded-br":[{"rounded-br":J()}],"rounded-bl":[{"rounded-bl":J()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...L(),"hidden","none"]}],"divide-style":[{divide:[...L(),"hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...L(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Z,et,U]}],"outline-w":[{outline:["",Z,el,X]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",c,ed,eo]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",m,ed,eo]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[Z,X]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",p,ed,eo]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[Z,et,U]}],"mix-blend":[{"mix-blend":[...ec(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ec()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Z]}],"mask-image-linear-from-pos":[{"mask-linear-from":em()}],"mask-image-linear-to-pos":[{"mask-linear-to":em()}],"mask-image-linear-from-color":[{"mask-linear-from":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"mask-image-t-from-pos":[{"mask-t-from":em()}],"mask-image-t-to-pos":[{"mask-t-to":em()}],"mask-image-t-from-color":[{"mask-t-from":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"mask-image-r-from-pos":[{"mask-r-from":em()}],"mask-image-r-to-pos":[{"mask-r-to":em()}],"mask-image-r-from-color":[{"mask-r-from":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"mask-image-b-from-pos":[{"mask-b-from":em()}],"mask-image-b-to-pos":[{"mask-b-to":em()}],"mask-image-b-from-color":[{"mask-b-from":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"mask-image-l-from-pos":[{"mask-l-from":em()}],"mask-image-l-to-pos":[{"mask-l-to":em()}],"mask-image-l-from-color":[{"mask-l-from":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"mask-image-x-from-pos":[{"mask-x-from":em()}],"mask-image-x-to-pos":[{"mask-x-to":em()}],"mask-image-x-from-color":[{"mask-x-from":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"mask-image-y-from-pos":[{"mask-y-from":em()}],"mask-image-y-to-pos":[{"mask-y-to":em()}],"mask-image-y-from-color":[{"mask-y-from":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[et,U]}],"mask-image-radial-from-pos":[{"mask-radial-from":em()}],"mask-image-radial-to-pos":[{"mask-radial-to":em()}],"mask-image-radial-from-color":[{"mask-radial-from":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":x()}],"mask-image-conic-pos":[{"mask-conic":[Z]}],"mask-image-conic-from-pos":[{"mask-conic-from":em()}],"mask-image-conic-to-pos":[{"mask-conic-to":em()}],"mask-image-conic-from-color":[{"mask-conic-from":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:S()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",et,U]}],filter:[{filter:["","none",et,U]}],blur:[{blur:ep()}],brightness:[{brightness:[Z,et,U]}],contrast:[{contrast:[Z,et,U]}],"drop-shadow":[{"drop-shadow":["","none",u,ed,eo]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",Z,et,U]}],"hue-rotate":[{"hue-rotate":[Z,et,U]}],invert:[{invert:["",Z,et,U]}],saturate:[{saturate:[Z,et,U]}],sepia:[{sepia:["",Z,et,U]}],"backdrop-filter":[{"backdrop-filter":["","none",et,U]}],"backdrop-blur":[{"backdrop-blur":ep()}],"backdrop-brightness":[{"backdrop-brightness":[Z,et,U]}],"backdrop-contrast":[{"backdrop-contrast":[Z,et,U]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Z,et,U]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Z,et,U]}],"backdrop-invert":[{"backdrop-invert":["",Z,et,U]}],"backdrop-opacity":[{"backdrop-opacity":[Z,et,U]}],"backdrop-saturate":[{"backdrop-saturate":[Z,et,U]}],"backdrop-sepia":[{"backdrop-sepia":["",Z,et,U]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",et,U]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Z,"initial",et,U]}],ease:[{ease:["linear","initial",h,et,U]}],delay:[{delay:[Z,et,U]}],animate:[{animate:["none",k,et,U]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,et,U]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:eu()}],"rotate-x":[{"rotate-x":eu()}],"rotate-y":[{"rotate-y":eu()}],"rotate-z":[{"rotate-z":eu()}],scale:[{scale:eb()}],"scale-x":[{"scale-x":eb()}],"scale-y":[{"scale-y":eb()}],"scale-z":[{"scale-z":eb()}],"scale-3d":["scale-3d"],skew:[{skew:ef()}],"skew-x":[{"skew-x":ef()}],"skew-y":[{"skew-y":ef()}],transform:[{transform:[et,U,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:eg()}],"translate-x":[{"translate-x":eg()}],"translate-y":[{"translate-y":eg()}],"translate-z":[{"translate-z":eg()}],"translate-none":["translate-none"],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",et,U]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",et,U]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[Z,el,X,Y]}],stroke:[{stroke:["none",...E()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2703-dd215da2f0e066a4.js b/litellm/proxy/_experimental/out/_next/static/chunks/2703-dd215da2f0e066a4.js deleted file mode 100644 index b000d4fd17..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2703-dd215da2f0e066a4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2703],{12363:function(e,s,a){a.d(s,{d:function(){return r},n:function(){return l}});var t=a(2265);let l=()=>{let[e,s]=(0,t.useState)("http://localhost:4000");return(0,t.useEffect)(()=>{{let{protocol:e,host:a}=window.location;s("".concat(e,"//").concat(a))}},[]),e},r=25},30841:function(e,s,a){a.d(s,{IE:function(){return r},LO:function(){return l},cT:function(){return n}});var t=a(19250);let l=async e=>{if(!e)return[];try{let{aliases:s}=await (0,t.keyAliasesCall)(e);return Array.from(new Set((s||[]).filter(Boolean)))}catch(e){return console.error("Error fetching all key aliases:",e),[]}},r=async(e,s)=>{if(!e)return[];try{let a=[],l=1,r=!0;for(;r;){let n=await (0,t.teamListCall)(e,s||null,null);a=[...a,...n],l{if(!e)return[];try{let s=[],a=1,l=!0;for(;l;){let r=await (0,t.organizationListCall)(e);s=[...s,...r],a{let{options:s,onApplyFilters:a,onResetFilters:o,initialValues:m={},buttonLabel:x="Filters"}=e,[u,h]=(0,l.useState)(!1),[g,p]=(0,l.useState)(m),[j,f]=(0,l.useState)({}),[v,b]=(0,l.useState)({}),[y,N]=(0,l.useState)({}),[w,_]=(0,l.useState)({}),k=(0,l.useCallback)(c()(async(e,s)=>{if(s.isSearchable&&s.searchFn){b(e=>({...e,[s.name]:!0}));try{let a=await s.searchFn(e);f(e=>({...e,[s.name]:a}))}catch(e){console.error("Error searching:",e),f(e=>({...e,[s.name]:[]}))}finally{b(e=>({...e,[s.name]:!1}))}}},300),[]),S=(0,l.useCallback)(async e=>{if(e.isSearchable&&e.searchFn&&!w[e.name]){b(s=>({...s,[e.name]:!0})),_(s=>({...s,[e.name]:!0}));try{let s=await e.searchFn("");f(a=>({...a,[e.name]:s}))}catch(s){console.error("Error loading initial options:",s),f(s=>({...s,[e.name]:[]}))}finally{b(s=>({...s,[e.name]:!1}))}}},[w]);(0,l.useEffect)(()=>{u&&s.forEach(e=>{e.isSearchable&&!w[e.name]&&S(e)})},[u,s,S,w]);let C=(e,s)=>{let t={...g,[e]:s};p(t),a(t)},L=(e,s)=>{e&&s.isSearchable&&!w[s.name]&&S(s)};return(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,t.jsx)(r.ZP,{icon:(0,t.jsx)(d.Z,{className:"h-4 w-4"}),onClick:()=>h(!u),className:"flex items-center gap-2",children:x}),(0,t.jsx)(r.ZP,{onClick:()=>{let e={};s.forEach(s=>{e[s.name]=""}),p(e),o()},children:"Reset Filters"})]}),u&&(0,t.jsx)("div",{className:"grid grid-cols-3 gap-x-6 gap-y-4 mb-6",children:["Team ID","Status","Organization ID","Key Alias","User ID","End User","Error Code","Key Hash","Model"].map(e=>{let a=s.find(s=>s.label===e||s.name===e);return a?(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("label",{className:"text-sm text-gray-600",children:a.label||a.name}),a.isSearchable?(0,t.jsx)(n.default,{showSearch:!0,className:"w-full",placeholder:"Search ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),onDropdownVisibleChange:e=>L(e,a),onSearch:e=>{N(s=>({...s,[a.name]:e})),a.searchFn&&k(e,a)},filterOption:!1,loading:v[a.name],options:j[a.name]||[],allowClear:!0,notFoundContent:v[a.name]?"Loading...":"No results found"}):a.options?(0,t.jsx)(n.default,{className:"w-full",placeholder:"Select ".concat(a.label||a.name,"..."),value:g[a.name]||void 0,onChange:e=>C(a.name,e),allowClear:!0,children:a.options.map(e=>(0,t.jsx)(n.default.Option,{value:e.value,children:e.label},e.value))}):(0,t.jsx)(i.default,{className:"w-full",placeholder:"Enter ".concat(a.label||a.name,"..."),value:g[a.name]||"",onChange:e=>C(a.name,e.target.value),allowClear:!0})]},a.name):null})})]})}},22703:function(e,s,a){a.d(s,{I:function(){return eC},Z:function(){return eS}});var t=a(57437),l=a(77398),r=a.n(l),n=a(11713),i=a(2265),d=a(29827),o=a(19250),c=a(12322),m=a(59872),x=a(41649),u=a(78489),h=a(99981),g=a(42673);let p=e=>{try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0}).replace(",","")}catch(e){return"Error converting time"}},j=e=>{let{utcTime:s}=e;return(0,t.jsx)("span",{style:{fontFamily:"monospace",width:"180px",display:"inline-block"},children:p(s)})},f=(e,s)=>{var a,t;return(null===(t=e.metadata)||void 0===t?void 0:null===(a=t.mcp_tool_call_metadata)||void 0===a?void 0:a.mcp_server_logo_url)?e.metadata.mcp_tool_call_metadata.mcp_server_logo_url:s?(0,g.dr)(s).logo:""},v=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform duration-75 ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Time",accessorKey:"startTime",cell:e=>(0,t.jsx)(j,{utcTime:e.getValue()})},{header:"Status",accessorKey:"metadata.status",cell:e=>{let s="failure"!==(e.getValue()||"Success").toLowerCase();return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat(s?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:s?"Success":"Failure"})}},{header:"Session ID",accessorKey:"session_id",cell:e=>{let s=String(e.getValue()||""),a=e.row.original.onSessionClick;return(0,t.jsx)(h.Z,{title:String(e.getValue()||""),children:(0,t.jsx)(u.Z,{size:"xs",variant:"light",className:"font-mono text-blue-500 bg-blue-50 hover:bg-blue-100 text-xs font-normal text-xs max-w-[15ch] truncate block",onClick:()=>null==a?void 0:a(s),children:String(e.getValue()||"")})})}},{header:"Request ID",accessorKey:"request_id",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||""),children:(0,t.jsx)("span",{className:"font-mono text-xs max-w-[15ch] truncate block",children:String(e.getValue()||"")})})},{header:"Cost",accessorKey:"spend",cell:e=>(0,t.jsx)(h.Z,{title:"$".concat(String(e.getValue()||0)," "),children:(0,t.jsx)("span",{children:(0,m.GS)(e.getValue()||0)})})},{header:"Duration (s)",accessorKey:"duration",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Team Name",accessorKey:"metadata.user_api_key_team_alias",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Key Hash",accessorKey:"metadata.user_api_key",cell:e=>{let s=String(e.getValue()||"-"),a=e.row.original.onKeyHashClick;return(0,t.jsx)(h.Z,{title:s,children:(0,t.jsx)("span",{className:"font-mono max-w-[15ch] truncate block cursor-pointer hover:text-blue-600",onClick:()=>null==a?void 0:a(s),children:s})})}},{header:"Key Name",accessorKey:"metadata.user_api_key_alias",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Model",accessorKey:"model",cell:e=>{let s=e.row.original,a=s.custom_llm_provider,l=String(e.getValue()||"");return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[a&&(0,t.jsx)("img",{src:f(s,a),alt:"",className:"w-4 h-4",onError:e=>{e.target.style.display="none"}}),(0,t.jsx)(h.Z,{title:l,children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:l})})]})}},{header:"Tokens",accessorKey:"total_tokens",cell:e=>{let s=e.row.original;return(0,t.jsxs)("span",{className:"text-sm",children:[String(s.total_tokens||"0"),(0,t.jsxs)("span",{className:"text-gray-400 text-xs ml-1",children:["(",String(s.prompt_tokens||"0"),"+",String(s.completion_tokens||"0"),")"]})]})}},{header:"Internal User",accessorKey:"user",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"End User",accessorKey:"end_user",cell:e=>(0,t.jsx)(h.Z,{title:String(e.getValue()||"-"),children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:String(e.getValue()||"-")})})},{header:"Tags",accessorKey:"request_tags",cell:e=>{let s=e.getValue();if(!s||0===Object.keys(s).length)return"-";let a=Object.entries(s),l=a[0],r=a.slice(1);return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:(0,t.jsx)(h.Z,{title:(0,t.jsx)("div",{className:"flex flex-col gap-1",children:a.map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{children:[s,": ",String(a)]},s)})}),children:(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[l[0],": ",String(l[1]),r.length>0&&" +".concat(r.length)]})})})}}],b=e=>(0,t.jsx)(x.Z,{color:"gray",className:"flex items-center gap-1",children:(0,t.jsx)("span",{className:"whitespace-nowrap text-xs",children:e})}),y=[{id:"expander",header:()=>null,cell:e=>{let{row:s}=e;return(0,t.jsx)(()=>{let[e,a]=i.useState(s.getIsExpanded()),l=i.useCallback(()=>{a(e=>!e),s.getToggleExpandedHandler()()},[s]);return s.getCanExpand()?(0,t.jsx)("button",{onClick:l,style:{cursor:"pointer"},"aria-label":e?"Collapse row":"Expand row",className:"w-6 h-6 flex items-center justify-center focus:outline-none",children:(0,t.jsx)("svg",{className:"w-4 h-4 transform transition-transform ".concat(e?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}):(0,t.jsx)("span",{className:"w-6 h-6 flex items-center justify-center",children:"●"})},{})}},{header:"Timestamp",accessorKey:"updated_at",cell:e=>(0,t.jsx)(j,{utcTime:e.getValue()})},{header:"Table Name",accessorKey:"table_name",cell:e=>{let s=e.getValue(),a=s;switch(s){case"LiteLLM_VerificationToken":a="Keys";break;case"LiteLLM_TeamTable":a="Teams";break;case"LiteLLM_OrganizationTable":a="Organizations";break;case"LiteLLM_UserTable":a="Users";break;case"LiteLLM_ProxyModelTable":a="Models";break;default:a=s}return(0,t.jsx)("span",{children:a})}},{header:"Action",accessorKey:"action",cell:e=>(0,t.jsx)("span",{children:b(e.getValue())})},{header:"Changed By",accessorKey:"changed_by",cell:e=>{let s=e.row.original.changed_by,a=e.row.original.changed_by_api_key;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("div",{className:"font-medium",children:s}),a&&(0,t.jsx)(h.Z,{title:a,children:(0,t.jsxs)("div",{className:"text-xs text-muted-foreground max-w-[15ch] truncate",children:[" ",a]})})]})}},{header:"Affected Item ID",accessorKey:"object_id",cell:e=>(0,t.jsx)(()=>{let s=e.getValue(),[a,l]=(0,i.useState)(!1);if(!s)return(0,t.jsx)(t.Fragment,{children:"-"});let r=async()=>{try{await navigator.clipboard.writeText(String(s)),l(!0),setTimeout(()=>l(!1),1500)}catch(e){console.error("Failed to copy object ID: ",e)}};return(0,t.jsx)(h.Z,{title:a?"Copied!":String(s),children:(0,t.jsx)("span",{className:"max-w-[20ch] truncate block cursor-pointer hover:text-blue-600",onClick:r,children:String(s)})})},{})}],N=async(e,s,a,t)=>{console.log("prefetchLogDetails called with",e.length,"logs");let l=e.map(e=>{if(e.request_id)return console.log("Prefetching details for request_id:",e.request_id),t.prefetchQuery({queryKey:["logDetails",e.request_id,s],queryFn:async()=>{console.log("Fetching details for",e.request_id);let t=await (0,o.uiSpendLogDetailsCall)(a,e.request_id,s);return console.log("Received details for",e.request_id,":",t?"success":"failed"),t},staleTime:6e5,gcTime:6e5})});try{let e=await Promise.all(l);return console.log("All prefetch promises completed:",e.length),e}catch(e){throw console.error("Error in prefetchLogDetails:",e),e}};var w=a(9114),_=a(86669);function k(e){let{row:s,hasMessages:a,hasResponse:l,hasError:r,errorInfo:n,getRawRequest:i,formattedResponse:d}=e,o=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 a=document.execCommand("copy");if(document.body.removeChild(s),!a)throw Error("execCommand failed");return!0}}catch(e){return console.error("Copy failed:",e),!1}},c=async()=>{await o(JSON.stringify(i(),null,2))?w.Z.success("Request copied to clipboard"):w.Z.fromBackend("Failed to copy request")},m=async()=>{await o(JSON.stringify(d(),null,2))?w.Z.success("Response copied to clipboard"):w.Z.fromBackend("Failed to copy response")};return(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request"}),(0,t.jsx)("button",{onClick:c,className:"p-1 hover:bg-gray-200 rounded",title:"Copy request",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",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.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:(0,t.jsx)("div",{className:"[&_[role='tree']]:bg-white [&_[role='tree']]:text-slate-900",children:(0,t.jsx)(_.gc,{data:i(),style:_.jF,clickToExpandNode:!0})})})]}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsxs)("h3",{className:"text-lg font-medium",children:["Response",r&&(0,t.jsxs)("span",{className:"ml-2 text-sm text-red-600",children:["• HTTP code ",(null==n?void 0:n.error_code)||400]})]}),(0,t.jsx)("button",{onClick:m,className:"p-1 hover:bg-gray-200 rounded",title:"Copy response",disabled:!l,children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",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.jsx)("div",{className:"p-4 overflow-auto max-h-96 w-full max-w-full box-border",children:l?(0,t.jsx)("div",{className:"[&_[role='tree']]:bg-white [&_[role='tree']]:text-slate-900",children:(0,t.jsx)(_.gc,{data:d(),style:_.jF,clickToExpandNode:!0})}):(0,t.jsx)("div",{className:"text-gray-500 text-sm italic text-center py-4",children:"Response data not available"})})]})]})}a(52621);let S=e=>{var s;let{errorInfo:a}=e,[l,r]=i.useState({}),[n,d]=i.useState(!1),o=e=>{r(s=>({...s,[e]:!s[e]}))},c=a.traceback&&(s=a.traceback)?Array.from(s.matchAll(/File "([^"]+)", line (\d+)/g)).map(e=>{let a=e[1],t=e[2],l=a.split("/").pop()||a,r=e.index||0,n=s.indexOf('File "',r+1),i=n>-1?s.substring(r,n).trim():s.substring(r).trim(),d=i.split("\n"),o="";return d.length>1&&(o=d[d.length-1].trim()),{filePath:a,fileName:l,lineNumber:t,code:o,inFunction:i.includes(" in ")?i.split(" in ")[1].split("\n")[0]:""}}):[];return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsxs)("h3",{className:"text-lg font-medium flex items-center text-red-600",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),"Error Details"]})}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"bg-red-50 rounded-md p-4 mb-4",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20",children:"Type:"}),(0,t.jsx)("span",{className:"text-red-700",children:a.error_class||"Unknown Error"})]}),(0,t.jsxs)("div",{className:"flex mt-2",children:[(0,t.jsx)("span",{className:"text-red-800 font-medium w-20 flex-shrink-0",children:"Message:"}),(0,t.jsx)("span",{className:"text-red-700 break-words whitespace-pre-wrap",children:a.error_message||"Unknown error occurred"})]})]}),a.traceback&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsx)("h4",{className:"font-medium",children:"Traceback"}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)("button",{onClick:()=>{let e=!n;if(d(e),c.length>0){let s={};c.forEach((a,t)=>{s[t]=e}),r(s)}},className:"text-gray-500 hover:text-gray-700 flex items-center text-sm",children:n?"Collapse All":"Expand All"}),(0,t.jsxs)("button",{onClick:()=>navigator.clipboard.writeText(a.traceback||""),className:"text-gray-500 hover:text-gray-700 flex items-center",title:"Copy traceback",children:[(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",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.jsx)("span",{className:"ml-1",children:"Copy"})]})]})]}),(0,t.jsx)("div",{className:"bg-white rounded-md border border-gray-200 overflow-hidden shadow-sm",children:c.map((e,s)=>(0,t.jsxs)("div",{className:"border-b border-gray-200 last:border-b-0",children:[(0,t.jsxs)("div",{className:"px-4 py-2 flex items-center justify-between cursor-pointer hover:bg-gray-50",onClick:()=>o(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"text-gray-400 mr-2 w-12 text-right",children:e.lineNumber}),(0,t.jsx)("span",{className:"text-gray-600 font-medium",children:e.fileName}),(0,t.jsx)("span",{className:"text-gray-500 mx-1",children:"in"}),(0,t.jsx)("span",{className:"text-indigo-600 font-medium",children:e.inFunction||e.fileName})]}),(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-500 transition-transform ".concat(l[s]?"transform rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),(l[s]||!1)&&e.code&&(0,t.jsx)("div",{className:"px-12 py-2 font-mono text-sm text-gray-800 bg-gray-50 overflow-x-auto border-t border-gray-100",children:e.code})]},s))})]})]})]})};var C=a(20347);let L=e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Request/Response Data Not Available"}),(0,t.jsxs)("p",{className:"text-sm text-blue-700 mt-1",children:["To view request and response details, enable prompt storage in your LiteLLM configuration by adding the following to your ",(0,t.jsx)("code",{className:"bg-blue-100 px-1 py-0.5 rounded",children:"proxy_config.yaml"})," file:"]}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"general_settings:\n store_model_in_db: true\n store_prompts_in_spend_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change."})]})]}):null};var E=a(50665),M=a(12514),D=a(35829),T=a(84264),A=a(96761),O=a(10900),R=a(5545),I=a(30401),H=a(78867);let K=e=>{let{sessionId:s,logs:a,onBack:l}=e,[r,n]=(0,i.useState)(null),[d,o]=(0,i.useState)({}),x=a.reduce((e,s)=>e+(s.spend||0),0),g=a.reduce((e,s)=>e+(s.total_tokens||0),0),p=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_read_input_tokens)||0)},0),j=a.reduce((e,s)=>{var a,t;return e+((null===(t=s.metadata)||void 0===t?void 0:null===(a=t.additional_usage_values)||void 0===a?void 0:a.cache_creation_input_tokens)||0)},0),f=g+p+j,b=a.length>0?new Date(a[0].startTime):new Date;(((a.length>0?new Date(a[a.length-1].endTime):new Date).getTime()-b.getTime())/1e3).toFixed(2),a.map(e=>({time:new Date(e.startTime).toISOString(),tokens:e.total_tokens||0,cost:e.spend||0}));let y=async(e,s)=>{await (0,m.vQ)(e)&&(o(e=>({...e,[s]:!0})),setTimeout(()=>{o(e=>({...e,[s]:!1}))},2e3))};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)(u.Z,{icon:O.Z,variant:"light",onClick:l,className:"mb-4",children:"Back to All Logs"}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("h1",{className:"text-2xl font-semibold text-gray-900",children:"Session Details"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,t.jsx)("p",{className:"text-sm text-gray-500 font-mono",children:s}),(0,t.jsx)(R.ZP,{type:"text",size:"small",icon:d["session-id"]?(0,t.jsx)(I.Z,{size:12}):(0,t.jsx)(H.Z,{size:12}),onClick:()=>y(s,"session-id"),className:"left-2 z-10 transition-all duration-200 ".concat(d["session-id"]?"text-green-600 bg-green-50 border-green-200":"text-gray-500 hover:text-gray-700 hover:bg-gray-100")})]}),(0,t.jsxs)("a",{href:"https://docs.litellm.ai/docs/proxy/ui_logs_sessions",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 flex items-center gap-1",children:["Get started with session management here",(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:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,t.jsxs)(M.Z,{children:[(0,t.jsx)(T.Z,{children:"Total Requests"}),(0,t.jsx)(D.Z,{children:a.length})]}),(0,t.jsxs)(M.Z,{children:[(0,t.jsx)(T.Z,{children:"Total Cost"}),(0,t.jsxs)(D.Z,{children:["$",(0,m.pw)(x,6)]})]}),(0,t.jsx)(h.Z,{title:(0,t.jsxs)("div",{className:"text-white min-w-[200px]",children:[(0,t.jsx)("div",{className:"text-lg font-medium mb-3",children:"Usage breakdown"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Input usage:"}),(0,t.jsxs)("div",{className:"space-y-2 text-sm text-gray-300",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(a.reduce((e,s)=>e+(s.prompt_tokens||0),0))})]}),p>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cached_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(p)})]}),j>0&&(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"input_cache_creation_tokens:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(j)})]})]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-600 pt-3",children:[(0,t.jsx)("div",{className:"text-base font-medium mb-2",children:"Output usage:"}),(0,t.jsx)("div",{className:"space-y-2 text-sm text-gray-300",children:(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"output:"}),(0,t.jsx)("span",{className:"ml-8",children:(0,m.pw)(a.reduce((e,s)=>e+(s.completion_tokens||0),0))})]})})]}),(0,t.jsx)("div",{className:"border-t border-gray-600 pt-3",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-base font-medium",children:"Total usage:"}),(0,t.jsx)("span",{className:"text-sm text-gray-300",children:(0,m.pw)(f)})]})})]})]}),placement:"top",overlayStyle:{minWidth:"300px"},children:(0,t.jsxs)(M.Z,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(T.Z,{children:"Total Tokens"}),(0,t.jsx)("span",{className:"text-gray-400 text-sm",children:"ⓘ"})]}),(0,t.jsx)(D.Z,{children:(0,m.pw)(f)})]})})]}),(0,t.jsx)(A.Z,{children:"Session Logs"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(c.w,{columns:v,data:a,renderSubComponent:eC,getRowCanExpand:()=>!0,loadingMessage:"Loading logs...",noDataMessage:"No logs found"})})]})};function F(e){let{data:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({});if(!s||0===s.length)return null;let d=e=>new Date(1e3*e).toLocaleString(),o=(e,s)=>"".concat(((s-e)*1e3).toFixed(2),"ms"),c=(e,s)=>{let a="".concat(e,"-").concat(s);n(e=>({...e,[a]:!e[a]}))};return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>l(!a),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 text-gray-600 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Vector Store Requests"})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:a?"Click to collapse":"Click to expand"})]}),a&&(0,t.jsx)("div",{className:"p-4",children:s.map((e,s)=>(0,t.jsxs)("div",{className:"mb-6 last:mb-0",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border p-4 mb-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Query:"}),(0,t.jsx)("span",{className:"font-mono",children:e.query})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Vector Store ID:"}),(0,t.jsx)("span",{className:"font-mono",children:e.vector_store_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{className:"flex items-center",children:(()=>{let{logo:s,displayName:a}=(0,g.dr)(e.custom_llm_provider);return(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)("img",{src:s,alt:"".concat(a," logo"),className:"h-5 w-5 mr-2"}),a]})})()})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:d(e.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:d(e.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsx)("span",{children:o(e.start_time,e.end_time)})]})]})]})}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Search Results"}),(0,t.jsx)("div",{className:"space-y-2",children:e.vector_store_search_response.data.map((e,a)=>{let l=r["".concat(s,"-").concat(a)]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 cursor-pointer",onClick:()=>c(s,a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("span",{className:"font-medium mr-2",children:["Result ",a+1]}),(0,t.jsxs)("span",{className:"text-gray-500 text-sm",children:["Score: ",(0,t.jsx)("span",{className:"font-mono",children:e.score.toFixed(4)})]})]})]}),l&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:e.content.map((e,s)=>(0,t.jsxs)("div",{className:"mb-2 last:mb-0",children:[(0,t.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:e.type}),(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all bg-gray-50 p-2 rounded",children:e.text})]},s))})]},a)})})]},s))})]})}let q=e=>e>=.8?"text-green-600":"text-yellow-600";var Y=e=>{let{entities:s}=e,[a,l]=(0,i.useState)(!0),[r,n]=(0,i.useState)({}),d=e=>{n(s=>({...s,[e]:!s[e]}))};return s&&0!==s.length?(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"flex items-center mb-2 cursor-pointer",onClick:()=>l(!a),children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h4",{className:"font-medium",children:["Detected Entities (",s.length,")"]})]}),a&&(0,t.jsx)("div",{className:"space-y-2",children:s.map((e,s)=>{let a=r[s]||!1;return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(s),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("span",{className:"font-medium mr-2",children:e.entity_type}),(0,t.jsxs)("span",{className:"font-mono ".concat(q(e.score)),children:["Score: ",e.score.toFixed(2)]})]}),(0,t.jsxs)("span",{className:"text-xs text-gray-500",children:["Position: ",e.start,"-",e.end]})]}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Entity Type:"}),(0,t.jsx)("span",{children:e.entity_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Position:"}),(0,t.jsxs)("span",{children:["Characters ",e.start,"-",e.end]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Confidence:"}),(0,t.jsx)("span",{className:q(e.score),children:e.score.toFixed(2)})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[e.recognition_metadata&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Recognizer:"}),(0,t.jsx)("span",{children:e.recognition_metadata.recognizer_name})]}),(0,t.jsxs)("div",{className:"flex overflow-hidden",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Identifier:"}),(0,t.jsx)("span",{className:"truncate text-xs font-mono",children:e.recognition_metadata.recognizer_identifier})]})]}),e.analysis_explanation&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Explanation:"}),(0,t.jsx)("span",{children:e.analysis_explanation})]})]})]})})]},s)})})]}):null};let P=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},Z=e=>e?P("detected","red"):P("not detected","slate"),B=e=>{let{title:s,count:a,defaultOpen:l=!0,right:r,children:n}=e,[d,o]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>o(e=>!e),children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(d?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]}),(0,t.jsx)("div",{children:r})]}),d&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:n})]})},U=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})},V=()=>(0,t.jsx)("div",{className:"my-3 border-t"});var W=e=>{var s,a,l,r,n,i,d,o,c,m;let{response:x}=e;if(!x)return null;let u=null!==(n=null!==(r=x.outputs)&&void 0!==r?r:x.output)&&void 0!==n?n:[],h="GUARDRAIL_INTERVENED"===x.action?"red":"green",g=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(s=x.guardrailCoverage)||void 0===s?void 0:s.textCharacters)&&P("text guarded ".concat(null!==(i=x.guardrailCoverage.textCharacters.guarded)&&void 0!==i?i:0,"/").concat(null!==(d=x.guardrailCoverage.textCharacters.total)&&void 0!==d?d:0),"blue"),(null===(a=x.guardrailCoverage)||void 0===a?void 0:a.images)&&P("images guarded ".concat(null!==(o=x.guardrailCoverage.images.guarded)&&void 0!==o?o:0,"/").concat(null!==(c=x.guardrailCoverage.images.total)&&void 0!==c?c:0),"blue")]}),p=x.usage&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(x.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})});return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(U,{label:"Action:",children:P(null!==(m=x.action)&&void 0!==m?m:"N/A",h)}),x.actionReason&&(0,t.jsx)(U,{label:"Action Reason:",children:x.actionReason}),x.blockedResponse&&(0,t.jsx)(U,{label:"Blocked Response:",children:(0,t.jsx)("span",{className:"italic",children:x.blockedResponse})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(U,{label:"Coverage:",children:g}),(0,t.jsx)(U,{label:"Usage:",children:p})]})]}),u.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(V,{}),(0,t.jsx)("h4",{className:"font-medium mb-2",children:"Outputs"}),(0,t.jsx)("div",{className:"space-y-2",children:u.map((e,s)=>{var a;return(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsx)("div",{className:"text-sm whitespace-pre-wrap",children:null!==(a=e.text)&&void 0!==a?a:(0,t.jsx)("em",{children:"(non-text output)"})})},s)})})]})]}),(null===(l=x.assessments)||void 0===l?void 0:l.length)?(0,t.jsx)("div",{className:"space-y-3",children:x.assessments.map((e,s)=>{var a,l,r,n,i,d,o,c,m,x,u,h,g,p,j,f,v,b,y,N,w,_,k,S;let C=(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[e.wordPolicy&&P("word","slate"),e.contentPolicy&&P("content","slate"),e.topicPolicy&&P("topic","slate"),e.sensitiveInformationPolicy&&P("sensitive-info","slate"),e.contextualGroundingPolicy&&P("contextual-grounding","slate"),e.automatedReasoningPolicy&&P("automated-reasoning","slate")]});return(0,t.jsxs)(B,{title:"Assessment #".concat(s+1),defaultOpen:!0,right:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(null===(a=e.invocationMetrics)||void 0===a?void 0:a.guardrailProcessingLatency)!=null&&P("".concat(e.invocationMetrics.guardrailProcessingLatency," ms"),"amber"),C]}),children:[e.wordPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Word Policy"}),(null!==(f=null===(l=e.wordPolicy.customWords)||void 0===l?void 0:l.length)&&void 0!==f?f:0)>0&&(0,t.jsx)(B,{title:"Custom Words",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.customWords.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match})]}),Z(e.detected)]},s)})})}),(null!==(v=null===(r=e.wordPolicy.managedWordLists)||void 0===r?void 0:r.length)&&void 0!==v?v:0)>0&&(0,t.jsx)(B,{title:"Managed Word Lists",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.wordPolicy.managedWordLists.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-mono text-sm break-all",children:e.match}),e.type&&P(e.type,"slate")]}),Z(e.detected)]},s)})})})]}),(null===(i=e.contentPolicy)||void 0===i?void 0:null===(n=i.filters)||void 0===n?void 0:n.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Content Policy"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Strength"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Confidence"})]})}),(0,t.jsx)("tbody",{children:e.contentPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:P(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:Z(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.filterStrength)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.confidence)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,(null===(o=e.contextualGroundingPolicy)||void 0===o?void 0:null===(d=o.filters)||void 0===d?void 0:d.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Contextual Grounding"}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"min-w-full text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"text-left text-gray-600",children:[(0,t.jsx)("th",{className:"py-1 pr-4",children:"Type"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Action"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Detected"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Score"}),(0,t.jsx)("th",{className:"py-1 pr-4",children:"Threshold"})]})}),(0,t.jsx)("tbody",{children:e.contextualGroundingPolicy.filters.map((e,s)=>{var a,l,r,n;return(0,t.jsxs)("tr",{className:"border-t",children:[(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(a=e.type)&&void 0!==a?a:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:P(null!==(l=e.action)&&void 0!==l?l:"—",e.detected?"red":"slate")}),(0,t.jsx)("td",{className:"py-1 pr-4",children:Z(e.detected)}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(r=e.score)&&void 0!==r?r:"—"}),(0,t.jsx)("td",{className:"py-1 pr-4",children:null!==(n=e.threshold)&&void 0!==n?n:"—"})]},s)})})]})})]}):null,e.sensitiveInformationPolicy&&(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Sensitive Information"}),(null!==(b=null===(c=e.sensitiveInformationPolicy.piiEntities)||void 0===c?void 0:c.length)&&void 0!==b?b:0)>0&&(0,t.jsx)(B,{title:"PII Entities",defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.piiEntities.map((e,s)=>{var a;return(0,t.jsxs)("div",{className:"flex justify-between items-center p-2 bg-gray-50 rounded",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),e.type&&P(e.type,"slate"),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]}),Z(e.detected)]},s)})})}),(null!==(y=null===(m=e.sensitiveInformationPolicy.regexes)||void 0===m?void 0:m.length)&&void 0!==y?y:0)>0&&(0,t.jsx)(B,{title:"Custom Regexes",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.sensitiveInformationPolicy.regexes.map((e,s)=>{var a,l;return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-2 bg-gray-50 rounded gap-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"regex"}),(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.regex})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Z(e.detected),e.match&&(0,t.jsx)("span",{className:"font-mono text-xs break-all",children:e.match})]})]},s)})})})]}),(null===(u=e.topicPolicy)||void 0===u?void 0:null===(x=u.topics)||void 0===x?void 0:x.length)?(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("h6",{className:"font-medium mb-2",children:"Topic Policy"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.topicPolicy.topics.map((e,s)=>{var a,l;return(0,t.jsx)("div",{className:"px-3 py-1.5 bg-gray-50 rounded-md text-xs",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[P(null!==(a=e.action)&&void 0!==a?a:"N/A",e.detected?"red":"slate"),(0,t.jsx)("span",{className:"font-medium",children:null!==(l=e.name)&&void 0!==l?l:"topic"}),e.type&&P(e.type,"slate"),Z(e.detected)]})},s)})})]}):null,e.invocationMetrics&&(0,t.jsx)(B,{title:"Invocation Metrics",defaultOpen:!1,children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(U,{label:"Latency (ms)",children:null!==(N=e.invocationMetrics.guardrailProcessingLatency)&&void 0!==N?N:"—"}),(0,t.jsx)(U,{label:"Coverage:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(null===(h=e.invocationMetrics.guardrailCoverage)||void 0===h?void 0:h.textCharacters)&&P("text ".concat(null!==(w=e.invocationMetrics.guardrailCoverage.textCharacters.guarded)&&void 0!==w?w:0,"/").concat(null!==(_=e.invocationMetrics.guardrailCoverage.textCharacters.total)&&void 0!==_?_:0),"blue"),(null===(g=e.invocationMetrics.guardrailCoverage)||void 0===g?void 0:g.images)&&P("images ".concat(null!==(k=e.invocationMetrics.guardrailCoverage.images.guarded)&&void 0!==k?k:0,"/").concat(null!==(S=e.invocationMetrics.guardrailCoverage.images.total)&&void 0!==S?S:0),"blue")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(U,{label:"Usage:",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.invocationMetrics.usage&&Object.entries(e.invocationMetrics.usage).map(e=>{let[s,a]=e;return"number"==typeof a?(0,t.jsxs)("span",{className:"px-2 py-1 bg-slate-100 text-slate-800 rounded-md text-xs font-medium",children:[s,": ",a]},s):null})})})})]})}),(null===(j=e.automatedReasoningPolicy)||void 0===j?void 0:null===(p=j.findings)||void 0===p?void 0:p.length)?(0,t.jsx)(B,{title:"Automated Reasoning Findings",defaultOpen:!1,children:(0,t.jsx)("div",{className:"space-y-2",children:e.automatedReasoningPolicy.findings.map((e,s)=>(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-2 text-xs overflow-x-auto",children:JSON.stringify(e,null,2)},s))})}):null]},s)})}):null,(0,t.jsx)(B,{title:"Raw Bedrock Guardrail Response",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(x,null,2)})})]})};let z=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"slate";return(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat({green:"bg-green-100 text-green-800",red:"bg-red-100 text-red-800",blue:"bg-blue-50 text-blue-700",slate:"bg-slate-100 text-slate-800",amber:"bg-amber-100 text-amber-800"}[s]),children:e})},J=e=>{let{title:s,count:a,defaultOpen:l=!0,children:r}=e,[n,d]=(0,i.useState)(l);return(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>d(e=>!e),children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(n?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsxs)("h5",{className:"font-medium",children:[s," ","number"==typeof a&&(0,t.jsxs)("span",{className:"text-gray-500 font-normal",children:["(",a,")"]})]})]})}),n&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:r})]})},G=e=>{let{label:s,children:a,mono:l}=e;return(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:s}),(0,t.jsx)("span",{className:l?"font-mono text-sm break-all":"",children:a})]})};var Q=e=>{let{response:s}=e;if(!s||"string"==typeof s)return"string"==typeof s&&s?(0,t.jsx)("div",{className:"bg-white rounded-lg border border-red-200 p-4",children:(0,t.jsxs)("div",{className:"text-red-800",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Error"}),(0,t.jsx)("p",{className:"text-sm",children:s})]})}):null;let a=Array.isArray(s)?s:[];if(0===a.length)return(0,t.jsx)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:(0,t.jsx)("div",{className:"text-gray-600 text-sm",children:"No detections found"})});let l=a.filter(e=>"pattern"===e.type),r=a.filter(e=>"blocked_word"===e.type),n=a.filter(e=>"category_keyword"===e.type),i=a.filter(e=>"BLOCK"===e.action).length,d=a.filter(e=>"MASK"===e.action).length,o=a.length;return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(G,{label:"Total Detections:",children:(0,t.jsx)("span",{className:"font-semibold",children:o})}),(0,t.jsx)(G,{label:"Actions:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[i>0&&z("".concat(i," blocked"),"red"),d>0&&z("".concat(d," masked"),"blue"),0===i&&0===d&&z("passed","green")]})})]}),(0,t.jsx)("div",{className:"space-y-2",children:(0,t.jsx)(G,{label:"By Type:",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[l.length>0&&z("".concat(l.length," patterns"),"slate"),r.length>0&&z("".concat(r.length," keywords"),"slate"),n.length>0&&z("".concat(n.length," categories"),"slate")]})})})]})}),l.length>0&&(0,t.jsx)(J,{title:"Patterns Matched",count:l.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:l.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Pattern:",children:e.pattern_name||"unknown"})}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:z(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),r.length>0&&(0,t.jsx)(J,{title:"Blocked Words Detected",count:r.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:r.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(G,{label:"Keyword:",mono:!0,children:e.keyword||"unknown"}),e.description&&(0,t.jsx)(G,{label:"Description:",children:e.description})]}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:z(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),n.length>0&&(0,t.jsx)(J,{title:"Category Keywords Detected",count:n.length,defaultOpen:!0,children:(0,t.jsx)("div",{className:"space-y-2",children:n.map((e,s)=>(0,t.jsx)("div",{className:"p-3 bg-gray-50 rounded-md",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(G,{label:"Category:",children:e.category||"unknown"}),(0,t.jsx)(G,{label:"Keyword:",mono:!0,children:e.keyword||"unknown"}),e.severity&&(0,t.jsx)(G,{label:"Severity:",children:z(e.severity,"high"===e.severity?"red":"medium"===e.severity?"amber":"slate")})]}),(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsx)(G,{label:"Action:",children:z(e.action,"BLOCK"===e.action?"red":"blue")})})]})},s))})}),(0,t.jsx)(J,{title:"Raw Detection Data",defaultOpen:!1,children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(a,null,2)})})]})};let $=e=>new Date(1e3*e).toLocaleString(),X=new Set(["presidio","bedrock","litellm_content_filter"]),ee=e=>{let{response:s}=e,[a,l]=(0,i.useState)(!1);return(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsxs)("div",{className:"border rounded-lg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex items-center justify-between p-3 bg-gray-50 cursor-pointer hover:bg-gray-100",onClick:()=>l(!a),children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("svg",{className:"w-5 h-5 mr-2 transition-transform ".concat(a?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h5",{className:"font-medium",children:"Raw Guardrail Response"})]})}),a&&(0,t.jsx)("div",{className:"p-3 border-t bg-white",children:(0,t.jsx)("pre",{className:"bg-gray-50 rounded p-3 text-xs overflow-x-auto",children:JSON.stringify(s,null,2)})})]})})},es=e=>{var s,a;let{entry:l,index:r,total:n}=e,i=null!==(s=l.guardrail_provider)&&void 0!==s?s:"presidio",d=null!==(a=l.guardrail_status)&&void 0!==a?a:"unknown",o="success"===d.toLowerCase(),c=l.masked_entity_count||{},m=Object.values(c).reduce((e,s)=>e+("number"==typeof s?s:0),0),x=l.guardrail_response,u=Array.isArray(x)?x:[],g="bedrock"!==i||null===x||"object"!=typeof x||Array.isArray(x)?void 0:x;return(0,t.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[n>1&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("h4",{className:"text-base font-semibold",children:["Guardrail #",r+1,(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:l.guardrail_name})]}),(0,t.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-600 rounded-md text-xs capitalize",children:i})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail Name:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_name})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Mode:"}),(0,t.jsx)("span",{className:"font-mono break-words",children:l.guardrail_mode})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)(h.Z,{title:o?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(o?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:d})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:$(l.start_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:$(l.end_time)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[l.duration.toFixed(4),"s"]})]})]})]}),m>0&&(0,t.jsxs)("div",{className:"mt-4 pt-4 border-t",children:[(0,t.jsx)("h5",{className:"font-medium mb-2",children:"Masked Entity Summary"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(c).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-3 py-1.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[s,": ",a]},s)})})]}),"presidio"===i&&u.length>0&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(Y,{entities:u})}),"bedrock"===i&&g&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(W,{response:g})}),"litellm_content_filter"===i&&x&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(Q,{response:x})}),i&&!X.has(i)&&x&&(0,t.jsx)(ee,{response:x})]})};var ea=e=>{let{data:s}=e,a=Array.isArray(s)?s.filter(e=>!!e):s?[s]:[],[l,r]=(0,i.useState)(!0),n=1===a.length?a[0].guardrail_name:"".concat(a.length," guardrails"),d=Array.from(new Set(a.map(e=>e.guardrail_status))).every(e=>"success"===(null!=e?e:"").toLowerCase()),o=a.reduce((e,s)=>e+Object.values(s.masked_entity_count||{}).reduce((e,s)=>e+("number"==typeof s?s:0),0),0);return 0===a.length?null:(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow mb-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b cursor-pointer hover:bg-gray-50",onClick:()=>r(!l),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("svg",{className:"w-5 h-5 text-gray-600 transition-transform ".concat(l?"transform rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Guardrail Information"}),(0,t.jsx)(h.Z,{title:d?null:"Guardrail failed to run.",placement:"top",arrow:!0,destroyTooltipOnHide:!0,children:(0,t.jsx)("span",{className:"ml-2 px-2 py-1 rounded-md text-xs font-medium inline-block ".concat(d?"bg-green-100 text-green-800":"bg-red-100 text-red-800 cursor-help"),children:d?"success":"failure"})}),(0,t.jsx)("span",{className:"ml-2 font-mono text-sm text-gray-600",children:n}),o>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-1 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[o," masked ",1===o?"entity":"entities"]})]}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:l?"Click to collapse":"Click to expand"})]}),l&&(0,t.jsx)("div",{className:"p-4 space-y-6",children:a.map((e,s)=>{var l;return(0,t.jsx)(es,{entry:e,index:s,total:a.length},"".concat(null!==(l=e.guardrail_name)&&void 0!==l?l:"guardrail","-").concat(s))})})]})},et=a(87452),el=a(88829),er=a(72208);let en=e=>null==e?"-":"$".concat((0,m.pw)(e,8)),ei=e=>null==e?"-":"".concat((100*e).toFixed(2),"%"),ed=e=>{var s;let{costBreakdown:a,totalSpend:l}=e;if(!a)return null;let r=void 0!==a.discount_percent&&0!==a.discount_percent||void 0!==a.discount_amount&&0!==a.discount_amount,n=void 0!==a.margin_percent&&0!==a.margin_percent||void 0!==a.margin_fixed_amount&&0!==a.margin_fixed_amount||void 0!==a.margin_total_amount&&0!==a.margin_total_amount;return void 0!==a.input_cost||void 0!==a.output_cost||r||n?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:(0,t.jsxs)(et.Z,{children:[(0,t.jsx)(er.Z,{className:"p-4 border-b hover:bg-gray-50 transition-colors text-left",children:(0,t.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,t.jsx)("h3",{className:"text-lg font-medium text-gray-900",children:"Cost Breakdown"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 mr-4",children:[(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Total:"}),(0,t.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:en(l)})]})]})}),(0,t.jsx)(el.Z,{className:"px-0",children:(0,t.jsxs)("div",{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2 max-w-2xl",children:[(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Input Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.input_cost)})]}),(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Output Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.output_cost)})]}),void 0!==a.tool_usage_cost&&a.tool_usage_cost>0&&(0,t.jsxs)("div",{className:"flex text-sm",children:[(0,t.jsx)("span",{className:"text-gray-600 font-medium w-1/3",children:"Tool Usage Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.tool_usage_cost)})]})]}),(0,t.jsx)("div",{className:"pt-2 border-t border-gray-100 max-w-2xl",children:(0,t.jsxs)("div",{className:"flex text-sm font-semibold",children:[(0,t.jsx)("span",{className:"text-gray-900 w-1/3",children:"Original LLM Cost:"}),(0,t.jsx)("span",{className:"text-gray-900",children:en(a.original_cost)})]})}),(r||n)&&(0,t.jsxs)("div",{className:"pt-2 space-y-2 max-w-2xl",children:[r&&(0,t.jsxs)("div",{className:"space-y-2",children:[void 0!==a.discount_percent&&0!==a.discount_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsxs)("span",{className:"font-medium w-1/3",children:["Discount (",ei(a.discount_percent),"):"]}),(0,t.jsxs)("span",{className:"text-gray-900",children:["-",en(a.discount_amount)]})]}),void 0!==a.discount_amount&&void 0===a.discount_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Discount Amount:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:["-",en(a.discount_amount)]})]})]}),n&&(0,t.jsxs)("div",{className:"space-y-2",children:[void 0!==a.margin_percent&&0!==a.margin_percent&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsxs)("span",{className:"font-medium w-1/3",children:["Margin (",ei(a.margin_percent),"):"]}),(0,t.jsxs)("span",{className:"text-gray-900",children:["+",en((a.margin_total_amount||0)-(a.margin_fixed_amount||0))]})]}),void 0!==a.margin_fixed_amount&&0!==a.margin_fixed_amount&&(0,t.jsxs)("div",{className:"flex text-sm text-gray-600",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Margin:"}),(0,t.jsxs)("span",{className:"text-gray-900",children:["+",en(a.margin_fixed_amount)]})]})]})]}),(0,t.jsx)("div",{className:"mt-4 pt-4 border-t border-gray-200 max-w-2xl",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"font-bold text-sm text-gray-900 w-1/3",children:"Final Calculated Cost:"}),(0,t.jsx)("span",{className:"text-sm font-bold text-gray-900",children:en(null!==(s=a.total_cost)&&void 0!==s?s:l)})]})})]})})]})}):null};var eo=a(23048),ec=a(30841),em=a(7310),ex=a.n(em),eu=a(12363);let eh={TEAM_ID:"Team ID",KEY_HASH:"Key Hash",REQUEST_ID:"Request ID",MODEL:"Model",USER_ID:"User ID",END_USER:"End User",STATUS:"Status",KEY_ALIAS:"Key Alias",ERROR_CODE:"Error Code"};var eg=a(59341),ep=a(12485),ej=a(18135),ef=a(35242),ev=a(29706),eb=a(77991),ey=a(92280);let eN="".concat("../ui/assets/","audit-logs-preview.png");function ew(e){let{userID:s,userRole:a,token:l,accessToken:d,isActive:x,premiumUser:u,allTeams:h}=e,[g,p]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),j=(0,i.useRef)(null),f=(0,i.useRef)(null),[v,b]=(0,i.useState)(1),[N]=(0,i.useState)(50),[w,_]=(0,i.useState)({}),[k,S]=(0,i.useState)(""),[C,L]=(0,i.useState)(""),[E,M]=(0,i.useState)(""),[D,T]=(0,i.useState)("all"),[A,O]=(0,i.useState)("all"),[R,I]=(0,i.useState)(!1),[H,K]=(0,i.useState)(!1),F=(0,n.a)({queryKey:["all_audit_logs",d,l,a,s,g],queryFn:async()=>{if(!d||!l||!a||!s)return[];let e=r()(g).utc().format("YYYY-MM-DD HH:mm:ss"),t=r()().utc().format("YYYY-MM-DD HH:mm:ss"),n=[],i=1,c=1;do{let s=await (0,o.uiAuditLogsCall)(d,e,t,i,50);n=n.concat(s.audit_logs),c=s.total_pages,i++}while(i<=c);return n},enabled:!!d&&!!l&&!!a&&!!s&&x,refetchInterval:5e3,refetchIntervalInBackground:!0}),q=(0,i.useCallback)(async e=>{if(d)try{let s=(await (0,o.keyListCall)(d,null,null,e,null,null,1,10)).keys.find(s=>s.key_alias===e);s?L(s.token):L("")}catch(e){console.error("Error fetching key hash for alias:",e),L("")}},[d]);(0,i.useEffect)(()=>{if(!d)return;let e=!1,s=!1;w["Team ID"]?k!==w["Team ID"]&&(S(w["Team ID"]),e=!0):""!==k&&(S(""),e=!0),w["Key Hash"]?C!==w["Key Hash"]&&(L(w["Key Hash"]),s=!0):w["Key Alias"]?q(w["Key Alias"]):""!==C&&(L(""),s=!0),(e||s)&&b(1)},[w,d,q,k,C]),(0,i.useEffect)(()=>{b(1)},[k,C,g,E,D,A]),(0,i.useEffect)(()=>{function e(e){j.current&&!j.current.contains(e.target)&&I(!1),f.current&&!f.current.contains(e.target)&&K(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let Y=(0,i.useMemo)(()=>F.data?F.data.filter(e=>{var s,a,t,l,r,n,i;let d=!0,o=!0,c=!0,m=!0,x=!0;if(k){let r="string"==typeof e.before_value?null===(s=JSON.parse(e.before_value))||void 0===s?void 0:s.team_id:null===(a=e.before_value)||void 0===a?void 0:a.team_id,n="string"==typeof e.updated_values?null===(t=JSON.parse(e.updated_values))||void 0===t?void 0:t.team_id:null===(l=e.updated_values)||void 0===l?void 0:l.team_id;d=r===k||n===k}if(C)try{let s="string"==typeof e.before_value?JSON.parse(e.before_value):e.before_value,a="string"==typeof e.updated_values?JSON.parse(e.updated_values):e.updated_values,t=null==s?void 0:s.token,l=null==a?void 0:a.token;o="string"==typeof t&&t.includes(C)||"string"==typeof l&&l.includes(C)}catch(e){o=!1}if(E&&(c=null===(r=e.object_id)||void 0===r?void 0:r.toLowerCase().includes(E.toLowerCase())),"all"!==D&&(m=(null===(n=e.action)||void 0===n?void 0:n.toLowerCase())===D.toLowerCase()),"all"!==A){let s="";switch(A){case"keys":s="litellm_verificationtoken";break;case"teams":s="litellm_teamtable";break;case"users":s="litellm_usertable";break;default:s=A}x=(null===(i=e.table_name)||void 0===i?void 0:i.toLowerCase())===s}return d&&o&&c&&m&&x}):[],[F.data,k,C,E,D,A]),P=Y.length,Z=Math.ceil(P/N)||1,B=(0,i.useMemo)(()=>{let e=(v-1)*N,s=e+N;return Y.slice(e,s)},[Y,v,N]),U=!F.data||0===F.data.length,V=(0,i.useCallback)(e=>{let{row:s}=e;return(0,t.jsx)(e=>{let{rowData:s}=e,{before_value:a,updated_values:l,table_name:r,action:n}=s,i=(e,s)=>{if(!e||0===Object.keys(e).length)return(0,t.jsx)(ey.x,{children:"N/A"});if(s){let s=Object.keys(e),a=["token","spend","max_budget"];if(s.every(e=>a.includes(e))&&s.length>0)return(0,t.jsxs)("div",{children:[s.includes("token")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Token:"})," ",e.token||"N/A"]}),s.includes("spend")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Spend:"})," ",void 0!==e.spend?"$".concat((0,m.pw)(e.spend,6)):"N/A"]}),s.includes("max_budget")&&(0,t.jsxs)("p",{children:[(0,t.jsx)("strong",{children:"Max Budget:"})," ",void 0!==e.max_budget?"$".concat((0,m.pw)(e.max_budget,6)):"N/A"]})]});if(e["No differing fields detected in 'before' state"]||e["No differing fields detected in 'updated' state"]||e["No fields changed"])return(0,t.jsx)(ey.x,{children:e[Object.keys(e)[0]]})}return(0,t.jsx)("pre",{className:"p-2 bg-gray-50 border rounded text-xs overflow-auto max-h-60",children:JSON.stringify(e,null,2)})},d=a,o=l;if(("updated"===n||"rotated"===n)&&a&&l&&("LiteLLM_TeamTable"===r||"LiteLLM_UserTable"===r||"LiteLLM_VerificationToken"===r)){let e={},s={};new Set([...Object.keys(a),...Object.keys(l)]).forEach(t=>{JSON.stringify(a[t])!==JSON.stringify(l[t])&&(a.hasOwnProperty(t)&&(e[t]=a[t]),l.hasOwnProperty(t)&&(s[t]=l[t]))}),Object.keys(a).forEach(t=>{l.hasOwnProperty(t)||e.hasOwnProperty(t)||(e[t]=a[t],s[t]=void 0)}),Object.keys(l).forEach(t=>{a.hasOwnProperty(t)||s.hasOwnProperty(t)||(s[t]=l[t],e[t]=void 0)}),d=Object.keys(e).length>0?e:{"No differing fields detected in 'before' state":"N/A"},o=Object.keys(s).length>0?s:{"No differing fields detected in 'updated' state":"N/A"},0===Object.keys(e).length&&0===Object.keys(s).length&&(d={"No fields changed":"N/A"},o={"No fields changed":"N/A"})}return(0,t.jsxs)("div",{className:"-mx-4 p-4 bg-slate-100 border-y border-slate-300 grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Before Value:"}),i(d,"LiteLLM_VerificationToken"===r)]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"font-semibold mb-2 text-sm text-slate-700",children:"Updated Value:"}),i(o,"LiteLLM_VerificationToken"===r)]})]})},{rowData:s.original})},[]);if(!u)return(0,t.jsxs)("div",{style:{textAlign:"center",marginTop:"20px"},children:[(0,t.jsx)("h1",{style:{display:"block",marginBottom:"10px"},children:"✨ Enterprise Feature."}),(0,t.jsx)(ey.x,{style:{display:"block",marginBottom:"10px"},children:"This is a LiteLLM Enterprise feature, and requires a valid key to use."}),(0,t.jsx)(ey.x,{style:{display:"block",marginBottom:"20px",fontStyle:"italic"},children:"Here's a preview of what Audit Logs offer:"}),(0,t.jsx)("img",{src:eN,alt:"Audit Logs Preview",style:{maxWidth:"100%",maxHeight:"700px",borderRadius:"8px",boxShadow:"0 4px 8px rgba(0,0,0,0.1)",margin:"0 auto"},onError:e=>{console.error("Failed to load audit logs preview image"),e.target.style.display="none"}})]});let W=P>0?(v-1)*N+1:0,z=Math.min(v*N,P);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4"}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"border-b px-6 py-4",children:[(0,t.jsx)("h1",{className:"text-xl font-semibold py-4",children:"Audit Logs"}),(0,t.jsx)(e=>{let{show:s}=e;return s?(0,t.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 flex items-start mb-6",children:[(0,t.jsx)("div",{className:"text-blue-500 mr-3 flex-shrink-0 mt-0.5",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,t.jsx)("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),(0,t.jsx)("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-blue-800",children:"Audit Logs Not Available"}),(0,t.jsx)("p",{className:"text-sm text-blue-700 mt-1",children:"To enable audit logging, add the following configuration to your LiteLLM proxy configuration file:"}),(0,t.jsx)("pre",{className:"mt-2 bg-white p-3 rounded border border-blue-200 text-xs font-mono overflow-auto",children:"litellm_settings:\n store_audit_logs: true"}),(0,t.jsx)("p",{className:"text-xs text-blue-700 mt-2",children:"Note: This will only affect new requests after the configuration change and proxy restart."})]})]}):null},{show:U}),(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0",children:[(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex items-center",children:(0,t.jsx)("input",{type:"text",placeholder:"Search by Object ID...",value:E,onChange:e=>M(e.target.value),className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsxs)("button",{onClick:()=>{F.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(F.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.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"})}),(0,t.jsx)("span",{children:"Refresh"})]})]})}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"relative",ref:j,children:[(0,t.jsx)("label",{htmlFor:"actionFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Action:"}),(0,t.jsxs)("button",{id:"actionFilterDisplay",onClick:()=>I(!R),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===D&&"All Actions","created"===D&&"Created","updated"===D&&"Updated","deleted"===D&&"Deleted","rotated"===D&&"Rotated"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),R&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Actions",value:"all"},{label:"Created",value:"created"},{label:"Updated",value:"updated"},{label:"Deleted",value:"deleted"},{label:"Rotated",value:"rotated"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(D===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{T(e.value),I(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("div",{className:"relative",ref:f,children:[(0,t.jsx)("label",{htmlFor:"tableFilterDisplay",className:"mr-2 text-sm font-medium text-gray-700 sr-only",children:"Table:"}),(0,t.jsxs)("button",{id:"tableFilterDisplay",onClick:()=>K(!H),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2 bg-white w-40 text-left justify-between",children:[(0,t.jsxs)("span",{children:["all"===A&&"All Tables","keys"===A&&"Keys","teams"===A&&"Teams","users"===A&&"Users"]}),(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})]}),H&&(0,t.jsx)("div",{className:"absolute left-0 mt-2 w-40 bg-white rounded-lg shadow-lg border p-1 z-50",children:(0,t.jsx)("div",{className:"space-y-1",children:[{label:"All Tables",value:"all"},{label:"Keys",value:"keys"},{label:"Teams",value:"teams"},{label:"Users",value:"users"}].map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(A===e.value?"bg-blue-50 text-blue-600 font-medium":"font-normal"),onClick:()=>{O(e.value),K(!1)},children:e.label},e.value))})})]}),(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Showing ",F.isLoading?"...":W," -"," ",F.isLoading?"...":z," of"," ",F.isLoading?"...":P," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700",children:["Page ",F.isLoading?"...":v," of"," ",F.isLoading?"...":Z]}),(0,t.jsx)("button",{onClick:()=>b(e=>Math.max(1,e-1)),disabled:F.isLoading||1===v,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>b(e=>Math.min(Z,e+1)),disabled:F.isLoading||v===Z,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})]}),(0,t.jsx)(c.w,{columns:y,data:B,renderSubComponent:V,getRowCanExpand:()=>!0})]})]})}let e_=(e,s,a)=>{if(e)return"".concat(r()(s).format("MMM D, h:mm A")," - ").concat(r()(a).format("MMM D, h:mm A"));let t=r()(),l=r()(s),n=t.diff(l,"minutes");if(n>=0&&n<2)return"Last 1 Minute";if(n>=2&&n<16)return"Last 15 Minutes";if(n>=16&&n<61)return"Last Hour";let i=t.diff(l,"hours");return i>=1&&i<5?"Last 4 Hours":i>=5&&i<25?"Last 24 Hours":i>=25&&i<169?"Last 7 Days":"".concat(l.format("MMM D")," - ").concat(t.format("MMM D"))};var ek=a(9309);function eS(e){var s,a,l;let{accessToken:m,token:x,userRole:u,userID:h,allTeams:g,premiumUser:p}=e,[j,f]=(0,i.useState)(""),[b,y]=(0,i.useState)(!1),[w,_]=(0,i.useState)(!1),[k,S]=(0,i.useState)(1),[L]=(0,i.useState)(50),M=(0,i.useRef)(null),D=(0,i.useRef)(null),T=(0,i.useRef)(null),[A,O]=(0,i.useState)(r()().subtract(24,"hours").format("YYYY-MM-DDTHH:mm")),[R,I]=(0,i.useState)(r()().format("YYYY-MM-DDTHH:mm")),[H,F]=(0,i.useState)(!1),[q,Y]=(0,i.useState)(!1),[P,Z]=(0,i.useState)(""),[B,U]=(0,i.useState)(""),[V,W]=(0,i.useState)(""),[z,J]=(0,i.useState)(""),[G,Q]=(0,i.useState)(""),[$,X]=(0,i.useState)(null),[ee,es]=(0,i.useState)(null),[ea,et]=(0,i.useState)(""),[el,er]=(0,i.useState)(""),[en,ei]=(0,i.useState)(u&&C.lo.includes(u)),[ed,em]=(0,i.useState)("request logs"),[ey,eN]=(0,i.useState)(null),[ek,eS]=(0,i.useState)(null),eL=(0,d.NL)(),[eE,eM]=(0,i.useState)(()=>{let e=sessionStorage.getItem("isLiveTail");return null===e||JSON.parse(e)});(0,i.useEffect)(()=>{sessionStorage.setItem("isLiveTail",JSON.stringify(eE))},[eE]);let[eD,eT]=(0,i.useState)({value:24,unit:"hours"});(0,i.useEffect)(()=>{(async()=>{ee&&m&&X({...(await (0,o.keyInfoV1Call)(m,ee)).info,token:ee,api_key:ee})})()},[ee,m]),(0,i.useEffect)(()=>{function e(e){M.current&&!M.current.contains(e.target)&&_(!1),D.current&&!D.current.contains(e.target)&&y(!1),T.current&&!T.current.contains(e.target)&&Y(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,i.useEffect)(()=>{u&&C.lo.includes(u)&&ei(!0)},[u]);let eA=(0,n.a)({queryKey:["logs","table",k,L,A,R,V,z,en?h:null,ea,G],queryFn:async()=>{if(!m||!x||!u||!h)return{data:[],total:0,page:1,page_size:L,total_pages:0};let e=r()(A).utc().format("YYYY-MM-DD HH:mm:ss"),s=H?r()(R).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss"),a=await (0,o.uiSpendLogsCall)(m,z||void 0,V||void 0,void 0,e,s,k,L,en?h:void 0,el,ea,G);return await N(a.data,e,m,eL),a.data=a.data.map(s=>{let a=eL.getQueryData(["logDetails",s.request_id,e]);return(null==a?void 0:a.messages)&&(null==a?void 0:a.response)&&(s.messages=a.messages,s.response=a.response),s}),a},enabled:!!m&&!!x&&!!u&&!!h&&"request logs"===ed,refetchInterval:!!eE&&1===k&&15e3,refetchIntervalInBackground:!0}),eO=eA.data||{data:[],total:0,page:1,page_size:L||10,total_pages:1},{filters:eR,filteredLogs:eI,allTeams:eH,allKeyAliases:eK,handleFilterChange:eF,handleFilterReset:eq}=function(e){let{logs:s,accessToken:a,startTime:t,endTime:l,pageSize:d=eu.d,isCustomDate:c,setCurrentPage:m,userID:x,userRole:u}=e,h=(0,i.useMemo)(()=>({[eh.TEAM_ID]:"",[eh.KEY_HASH]:"",[eh.REQUEST_ID]:"",[eh.MODEL]:"",[eh.USER_ID]:"",[eh.END_USER]:"",[eh.STATUS]:"",[eh.KEY_ALIAS]:"",[eh.ERROR_CODE]:""}),[]),[g,p]=(0,i.useState)(h),[j,f]=(0,i.useState)({data:[],total:0,page:1,page_size:50,total_pages:0}),v=(0,i.useRef)(0),b=(0,i.useCallback)(async function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!a)return;console.log("Filters being sent to API:",e);let n=Date.now();v.current=n;let i=r()(t).utc().format("YYYY-MM-DD HH:mm:ss"),m=c?r()(l).utc().format("YYYY-MM-DD HH:mm:ss"):r()().utc().format("YYYY-MM-DD HH:mm:ss");try{let t=await (0,o.uiSpendLogsCall)(a,e[eh.KEY_HASH]||void 0,e[eh.TEAM_ID]||void 0,e[eh.REQUEST_ID]||void 0,i,m,s,d,e[eh.USER_ID]||void 0,e[eh.END_USER]||void 0,e[eh.STATUS]||void 0,e[eh.MODEL]||void 0,e[eh.KEY_ALIAS]||void 0,e[eh.ERROR_CODE]||void 0);n===v.current&&t.data&&f(t)}catch(e){console.error("Error searching users:",e)}},[a,t,l,c,d]),y=(0,i.useMemo)(()=>ex()((e,s)=>b(e,s),300),[b]);(0,i.useEffect)(()=>()=>y.cancel(),[y]);let N=(0,n.a)({queryKey:["allKeys"],queryFn:async()=>{if(!a)throw Error("Access token required");return await (0,ec.LO)(a)},enabled:!!a}).data||[],w=(0,i.useMemo)(()=>!!(g[eh.KEY_ALIAS]||g[eh.KEY_HASH]||g[eh.REQUEST_ID]||g[eh.USER_ID]||g[eh.END_USER]||g[eh.ERROR_CODE]),[g]),_=(0,i.useMemo)(()=>{if(!s||!s.data)return{data:[],total:0,page:1,page_size:50,total_pages:0};if(w)return s;let e=[...s.data];return g[eh.TEAM_ID]&&(e=e.filter(e=>e.team_id===g[eh.TEAM_ID])),g[eh.STATUS]&&(e=e.filter(e=>"success"===g[eh.STATUS]?!e.status||"success"===e.status:e.status===g[eh.STATUS])),g[eh.MODEL]&&(e=e.filter(e=>e.model===g[eh.MODEL])),g[eh.KEY_HASH]&&(e=e.filter(e=>e.api_key===g[eh.KEY_HASH])),g[eh.END_USER]&&(e=e.filter(e=>e.end_user===g[eh.END_USER])),g[eh.ERROR_CODE]&&(e=e.filter(e=>{let s=(e.metadata||{}).error_information;return s&&s.error_code===g[eh.ERROR_CODE]})),{data:e,total:s.total,page:s.page,page_size:s.page_size,total_pages:s.total_pages}},[s,g,w]),k=(0,i.useMemo)(()=>w?j&&j.data&&j.data.length>0?j:s||{data:[],total:0,page:1,page_size:50,total_pages:0}:_,[w,j,_,s]),{data:S}=(0,n.a)({queryKey:["allTeamsForLogFilters",a],queryFn:async()=>a&&await (0,ec.IE)(a)||[],enabled:!!a});return{filters:g,filteredLogs:k,allKeyAliases:N,allTeams:S,handleFilterChange:e=>{p(s=>{let a={...s,...e};for(let e of Object.keys(h))e in a||(a[e]=h[e]);return JSON.stringify(a)!==JSON.stringify(s)&&(m(1),y(a,1)),a})},handleFilterReset:()=>{p(h),f({data:[],total:0,page:1,page_size:50,total_pages:0}),y(h,1)}}}({logs:eO,accessToken:m,startTime:A,endTime:R,pageSize:L,isCustomDate:H,setCurrentPage:S,userID:h,userRole:u}),eY=(0,i.useCallback)(async e=>{if(m)try{let s=(await (0,o.keyListCall)(m,null,null,e,null,null,k,L)).keys.find(s=>s.key_alias===e);s&&J(s.token)}catch(e){console.error("Error fetching key hash for alias:",e)}},[m,k,L]);(0,i.useEffect)(()=>{m&&(eR["Team ID"]?W(eR["Team ID"]):W(""),et(eR.Status||""),Q(eR.Model||""),er(eR["End User"]||""),eR["Key Hash"]?J(eR["Key Hash"]):eR["Key Alias"]?eY(eR["Key Alias"]):J(""))},[eR,m,eY]);let eP=(0,n.a)({queryKey:["sessionLogs",ek],queryFn:async()=>{if(!m||!ek)return{data:[],total:0,page:1,page_size:50,total_pages:1};let e=await (0,o.sessionSpendLogsCall)(m,ek);return{data:e.data||e||[],total:(e.data||e||[]).length,page:1,page_size:1e3,total_pages:1}},enabled:!!m&&!!ek});if((0,i.useEffect)(()=>{var e;(null===(e=eA.data)||void 0===e?void 0:e.data)&&ey&&!eA.data.data.some(e=>e.request_id===ey)&&eN(null)},[null===(s=eA.data)||void 0===s?void 0:s.data,ey]),!m||!x||!u||!h)return null;let eZ=eI.data.filter(e=>!j||e.request_id.includes(j)||e.model.includes(j)||e.user&&e.user.includes(j)).map(e=>({...e,duration:(Date.parse(e.endTime)-Date.parse(e.startTime))/1e3,onKeyHashClick:e=>es(e),onSessionClick:e=>{e&&eS(e)}}))||[],eB=(null===(l=eP.data)||void 0===l?void 0:null===(a=l.data)||void 0===a?void 0:a.map(e=>({...e,onKeyHashClick:e=>es(e),onSessionClick:e=>{}})))||[],eU=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=new Set;return e.forEach(e=>{let t=e.metadata||{};if("failure"===t.status&&t.error_information){let e=t.error_information.error_code;e&&(!s||e.toLowerCase().includes(s.toLowerCase()))&&a.add(e)}}),Array.from(a).map(e=>({label:e,value:e}))},eV=[{name:"Team ID",label:"Team ID",isSearchable:!0,searchFn:async e=>g&&0!==g.length?g.filter(s=>s.team_id.toLowerCase().includes(e.toLowerCase())||s.team_alias&&s.team_alias.toLowerCase().includes(e.toLowerCase())).map(e=>({label:"".concat(e.team_alias||e.team_id," (").concat(e.team_id,")"),value:e.team_id})):[]},{name:"Status",label:"Status",isSearchable:!1,options:[{label:"Success",value:"success"},{label:"Failure",value:"failure"}]},{name:"Model",label:"Model",isSearchable:!1},{name:"Key Alias",label:"Key Alias",isSearchable:!0,searchFn:async e=>m?(await (0,ec.LO)(m)).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e})):[]},{name:"End User",label:"End User",isSearchable:!0,searchFn:async e=>{if(!m)return[];let s=await (0,o.allEndUsersCall)(m);return((null==s?void 0:s.map(e=>e.user_id))||[]).filter(s=>s.toLowerCase().includes(e.toLowerCase())).map(e=>({label:e,value:e}))}},{name:"Error Code",label:"Error Code",isSearchable:!0,searchFn:async e=>eU(eO.data,e)},{name:"Key Hash",label:"Key Hash",isSearchable:!1}];if(ek&&eP.data)return(0,t.jsx)("div",{className:"w-full p-6",children:(0,t.jsx)(K,{sessionId:ek,logs:eP.data.data,onBack:()=>eS(null)})});let eW=[{label:"Last 15 Minutes",value:15,unit:"minutes"},{label:"Last Hour",value:1,unit:"hours"},{label:"Last 4 Hours",value:4,unit:"hours"},{label:"Last 24 Hours",value:24,unit:"hours"},{label:"Last 7 Days",value:7,unit:"days"}],ez=eW.find(e=>e.value===eD.value&&e.unit===eD.unit),eJ=H?e_(H,A,R):null==ez?void 0:ez.label;return(0,t.jsx)("div",{className:"w-full max-w-screen p-6 overflow-x-hidden box-border",children:(0,t.jsxs)(ej.Z,{defaultIndex:0,onIndexChange:e=>em(0===e?"request logs":"audit logs"),children:[(0,t.jsxs)(ef.Z,{children:[(0,t.jsx)(ep.Z,{children:"Request Logs"}),(0,t.jsx)(ep.Z,{children:"Audit Logs"})]}),(0,t.jsxs)(eb.Z,{children:[(0,t.jsxs)(ev.Z,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,t.jsx)("h1",{className:"text-xl font-semibold",children:ek?(0,t.jsxs)(t.Fragment,{children:["Session: ",(0,t.jsx)("span",{className:"font-mono",children:ek}),(0,t.jsx)("button",{className:"ml-4 px-3 py-1 text-sm border rounded hover:bg-gray-50",onClick:()=>eS(null),children:"← Back to All Logs"})]}):"Request Logs"})}),$&&ee&&$.api_key===ee?(0,t.jsx)(E.Z,{keyId:ee,keyData:$,teams:g,onClose:()=>es(null),backButtonText:"Back to Logs"}):ek?(0,t.jsx)("div",{className:"bg-white rounded-lg shadow",children:(0,t.jsx)(c.w,{columns:v,data:eB,renderSubComponent:eC,getRowCanExpand:()=>!0})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eo.Z,{options:eV,onApplyFilters:eF,onResetFilters:eq}),(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full box-border",children:[(0,t.jsx)("div",{className:"border-b px-6 py-4 w-full max-w-full box-border",children:(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between space-y-4 md:space-y-0 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 w-full max-w-full box-border",children:[(0,t.jsxs)("div",{className:"relative w-64 min-w-0 flex-shrink-0",children:[(0,t.jsx)("input",{type:"text",placeholder:"Search by Request ID",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:j,onChange:e=>f(e.target.value)}),(0,t.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,t.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,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,t.jsxs)("div",{className:"relative z-50",ref:T,children:[(0,t.jsxs)("button",{onClick:()=>Y(!q),className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",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:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),eJ]}),q&&(0,t.jsx)("div",{className:"absolute right-0 mt-2 w-64 bg-white rounded-lg shadow-lg border p-2 z-50",children:(0,t.jsxs)("div",{className:"space-y-1",children:[eW.map(e=>(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(eJ===e.label?"bg-blue-50 text-blue-600":""),onClick:()=>{I(r()().format("YYYY-MM-DDTHH:mm")),O(r()().subtract(e.value,e.unit).format("YYYY-MM-DDTHH:mm")),eT({value:e.value,unit:e.unit}),F(!1),Y(!1)},children:e.label},e.label)),(0,t.jsx)("div",{className:"border-t my-2"}),(0,t.jsx)("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-gray-50 rounded-md ".concat(H?"bg-blue-50 text-blue-600":""),onClick:()=>F(!H),children:"Custom Range"})]})})]}),(0,t.jsx)(()=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Live Tail"}),(0,t.jsx)(eg.Z,{color:"green",checked:eE,defaultChecked:!0,onChange:eM})]}),{}),(0,t.jsxs)("button",{onClick:()=>{eA.refetch()},className:"px-3 py-2 text-sm border rounded-md hover:bg-gray-50 flex items-center gap-2",title:"Refresh data",children:[(0,t.jsx)("svg",{className:"w-4 h-4 ".concat(eA.isFetching?"animate-spin":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.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"})}),(0,t.jsx)("span",{children:"Refresh"})]})]}),H&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:A,onChange:e=>{O(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})}),(0,t.jsx)("span",{className:"text-gray-500",children:"to"}),(0,t.jsx)("div",{children:(0,t.jsx)("input",{type:"datetime-local",value:R,onChange:e=>{I(e.target.value),S(1)},className:"px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 whitespace-nowrap",children:["Showing ",eA.isLoading?"...":eI?(k-1)*L+1:0," -"," ",eA.isLoading?"...":eI?Math.min(k*L,eI.total):0," ","of ",eA.isLoading?"...":eI?eI.total:0," results"]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"text-sm text-gray-700 min-w-[90px]",children:["Page ",eA.isLoading?"...":k," of"," ",eA.isLoading?"...":eI?eI.total_pages:1]}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.max(1,e-1)),disabled:eA.isLoading||1===k,className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,t.jsx)("button",{onClick:()=>S(e=>Math.min(eI.total_pages||1,e+1)),disabled:eA.isLoading||k===(eI.total_pages||1),className:"px-3 py-1 text-sm border rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]})}),eE&&1===k&&(0,t.jsxs)("div",{className:"mb-4 px-4 py-2 bg-green-50 border border-greem-200 rounded-md flex items-center justify-between",children:[(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)("span",{className:"text-sm text-green-700",children:"Auto-refreshing every 15 seconds"})}),(0,t.jsx)("button",{onClick:()=>eM(!1),className:"text-sm text-green-600 hover:text-green-800",children:"Stop"})]}),(0,t.jsx)(c.w,{columns:v,data:eZ,renderSubComponent:eC,getRowCanExpand:()=>!0})]})]})]}),(0,t.jsx)(ev.Z,{children:(0,t.jsx)(ew,{userID:h,userRole:u,token:x,accessToken:m,isActive:"audit logs"===ed,premiumUser:p,allTeams:g})})]})]})})}function eC(e){var s,a,l,r,n,i,d,o,c,x,u,g;let{row:p}=e,j=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){}return e},f=p.original.metadata||{},v="failure"===f.status,b=v?f.error_information:null,y=p.original.messages&&(Array.isArray(p.original.messages)?p.original.messages.length>0:Object.keys(p.original.messages).length>0),N=p.original.response&&Object.keys(j(p.original.response)).length>0,w=f.vector_store_request_metadata&&Array.isArray(f.vector_store_request_metadata)&&f.vector_store_request_metadata.length>0,_=null===(s=p.original.metadata)||void 0===s?void 0:s.guardrail_information,C=Array.isArray(_)?_:_?[_]:[],E=C.length>0,M=C.reduce((e,s)=>{let a=null==s?void 0:s.masked_entity_count;return a?e+Object.values(a).reduce((e,s)=>"number"==typeof s?e+s:e,0):e},0),D=1===C.length?null!==(g=null===(a=C[0])||void 0===a?void 0:a.guardrail_name)&&void 0!==g?g:"-":C.length>1?"".concat(C.length," guardrails"):"-",T=(0,ek.aS)(p.original.request_id,64);return(0,t.jsxs)("div",{className:"p-6 bg-gray-50 space-y-6 w-full max-w-full overflow-hidden box-border",children:[(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow w-full max-w-full overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Details"})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 w-full max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Request ID:"}),p.original.request_id.length>64?(0,t.jsx)(h.Z,{title:p.original.request_id,children:(0,t.jsx)("span",{className:"font-mono text-sm",children:T})}):(0,t.jsx)("span",{className:"font-mono text-sm",children:p.original.request_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model:"}),(0,t.jsx)("span",{children:p.original.model})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Model ID:"}),(0,t.jsx)("span",{children:p.original.model_id})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Call Type:"}),(0,t.jsx)("span",{children:p.original.call_type})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Provider:"}),(0,t.jsx)("span",{children:p.original.custom_llm_provider||"-"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"API Base:"}),(0,t.jsx)(h.Z,{title:p.original.api_base||"-",children:(0,t.jsx)("span",{className:"max-w-[15ch] truncate block",children:p.original.api_base||"-"})})]}),(null==p?void 0:null===(l=p.original)||void 0===l?void 0:l.requester_ip_address)&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"IP Address:"}),(0,t.jsx)("span",{children:null==p?void 0:null===(r=p.original)||void 0===r?void 0:r.requester_ip_address})]}),E&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Guardrail:"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-mono",children:D}),M>0&&(0,t.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-50 text-blue-700 rounded-md text-xs font-medium",children:[M," masked"]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Tokens:"}),(0,t.jsxs)("span",{children:[p.original.total_tokens," (",p.original.prompt_tokens," prompt tokens +"," ",p.original.completion_tokens," completion tokens)"]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Read Tokens:"}),(0,t.jsx)("span",{children:(0,m.pw)((null===(i=p.original.metadata)||void 0===i?void 0:null===(n=i.additional_usage_values)||void 0===n?void 0:n.cache_read_input_tokens)||0)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Creation Tokens:"}),(0,t.jsx)("span",{children:(0,m.pw)(null===(d=p.original.metadata)||void 0===d?void 0:d.additional_usage_values.cache_creation_input_tokens)})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cost:"}),(0,t.jsxs)("span",{children:["$",(0,m.pw)(p.original.spend||0,6)]})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Cache Hit:"}),(0,t.jsx)("span",{children:p.original.cache_hit})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Status:"}),(0,t.jsx)("span",{className:"px-2 py-1 rounded-md text-xs font-medium inline-block text-center w-16 ".concat("failure"!==((null===(o=p.original.metadata)||void 0===o?void 0:o.status)||"Success").toLowerCase()?"bg-green-100 text-green-800":"bg-red-100 text-red-800"),children:"failure"!==((null===(c=p.original.metadata)||void 0===c?void 0:c.status)||"Success").toLowerCase()?"Success":"Failure"})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Start Time:"}),(0,t.jsx)("span",{children:p.original.startTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"End Time:"}),(0,t.jsx)("span",{children:p.original.endTime})]}),(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"Duration:"}),(0,t.jsxs)("span",{children:[p.original.duration," s."]})]}),(null===(x=p.original.metadata)||void 0===x?void 0:x.litellm_overhead_time_ms)!==void 0&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("span",{className:"font-medium w-1/3",children:"LiteLLM Overhead:"}),(0,t.jsxs)("span",{children:[p.original.metadata.litellm_overhead_time_ms," ms"]})]})]})]})]}),(0,t.jsx)(ed,{costBreakdown:null===(u=p.original.metadata)||void 0===u?void 0:u.cost_breakdown,totalSpend:p.original.spend||0}),(0,t.jsx)(L,{show:!y&&!N}),(0,t.jsx)("div",{className:"w-full max-w-full overflow-hidden",children:(0,t.jsx)(k,{row:p,hasMessages:y,hasResponse:N,hasError:v,errorInfo:b,getRawRequest:()=>{var e;return(null===(e=p.original)||void 0===e?void 0:e.proxy_server_request)?j(p.original.proxy_server_request):j(p.original.messages)},formattedResponse:()=>v&&b?{error:{message:b.error_message||"An error occurred",type:b.error_class||"error",code:b.error_code||"unknown",param:null}}:j(p.original.response)})}),E&&(0,t.jsx)(ea,{data:_}),w&&(0,t.jsx)(F,{data:f.vector_store_request_metadata}),v&&b&&(0,t.jsx)(S,{errorInfo:b}),p.original.request_tags&&Object.keys(p.original.request_tags).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsx)("div",{className:"flex justify-between items-center p-4 border-b",children:(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Request Tags"})}),(0,t.jsx)("div",{className:"p-4",children:(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(p.original.request_tags).map(e=>{let[s,a]=e;return(0,t.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[s,": ",String(a)]},s)})})})]}),p.original.metadata&&Object.keys(p.original.metadata).length>0&&(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center p-4 border-b",children:[(0,t.jsx)("h3",{className:"text-lg font-medium",children:"Metadata"}),(0,t.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(JSON.stringify(p.original.metadata,null,2))},className:"p-1 hover:bg-gray-200 rounded",title:"Copy metadata",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",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.jsx)("div",{className:"p-4 overflow-auto max-h-64",children:(0,t.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap break-all",children:JSON.stringify(p.original.metadata,null,2)})})]})]})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2820-592c2b4ff874a913.js b/litellm/proxy/_experimental/out/_next/static/chunks/2820-592c2b4ff874a913.js new file mode 100644 index 0000000000..450de70f21 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/2820-592c2b4ff874a913.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2820],{5540:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},45246:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},34419:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.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:"plus-circle",theme:"outlined"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},89245:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},78355:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},8881:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});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-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},3632:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var n=r(1119),o=r(2265),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"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},35291:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},l=r(55015),i=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},58747:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(5853),o=r(2265);let a=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))}},4537:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(5853),o=r(2265);let a=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))}},41649:function(e,t,r){"use strict";r.d(t,{Z:function(){return p}});var n=r(5853),o=r(2265),a=r(47187),l=r(7084),i=r(26898),c=r(13241),s=r(1153);let u={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},d={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},m=(0,s.fn)("Badge"),p=o.forwardRef((e,t)=>{let{color:r,icon:p,size:f=l.u8.SM,tooltip:g,className:b,children:v}=e,h=(0,n._T)(e,["color","icon","size","tooltip","className","children"]),w=p||null,{tooltipProps:k,getReferenceProps:x}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,s.lq)([t,k.refs.setReference]),className:(0,c.q)(m("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",r?(0,c.q)((0,s.bM)(r,i.K.background).bgColor,(0,s.bM)(r,i.K.iconText).textColor,(0,s.bM)(r,i.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,c.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),u[f].paddingX,u[f].paddingY,u[f].fontSize,b)},x,h),o.createElement(a.Z,Object.assign({text:g},k)),w?o.createElement(w,{className:(0,c.q)(m("icon"),"shrink-0 -ml-1 mr-1.5",d[f].height,d[f].width)}):null,o.createElement("span",{className:(0,c.q)(m("text"),"whitespace-nowrap")},v))});p.displayName="Badge"},47323:function(e,t,r){"use strict";r.d(t,{Z:function(){return g}});var n=r(5853),o=r(2265),a=r(47187),l=r(7084),i=r(13241),c=r(1153),s=r(26898);let u={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"}},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:""}},p=(e,t)=>{switch(e){case"simple":return{textColor:t?(0,c.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?(0,c.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.q)((0,c.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,c.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.q)((0,c.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,c.bM)(t,s.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?(0,i.q)((0,c.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,c.bM)(t,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?(0,i.q)((0,c.bM)(t,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?(0,c.bM)(t,s.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?(0,i.q)((0,c.bM)(t,s.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},f=(0,c.fn)("Icon"),g=o.forwardRef((e,t)=>{let{icon:r,variant:s="simple",tooltip:g,size:b=l.u8.SM,color:v,className:h}=e,w=(0,n._T)(e,["icon","variant","tooltip","size","color","className"]),k=p(s,v),{tooltipProps:x,getReferenceProps:y}=(0,a.l)();return o.createElement("span",Object.assign({ref:(0,c.lq)([t,x.refs.setReference]),className:(0,i.q)(f("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,u[b].paddingX,u[b].paddingY,h)},y,w),o.createElement(a.Z,Object.assign({text:g},x)),o.createElement(r,{className:(0,i.q)(f("icon"),"shrink-0",d[b].height,d[b].width)}))});g.displayName="Icon"},30150:function(e,t,r){"use strict";r.d(t,{Z:function(){return m}});var n=r(5853),o=r(2265);let a=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M12 4v16m8-8H4"}))},l=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M20 12H4"}))};var i=r(13241),c=r(1153),s=r(69262);let u="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",m=o.forwardRef((e,t)=>{let{onSubmit:r,enableStepper:m=!0,disabled:p,onValueChange:f,onChange:g}=e,b=(0,n._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),v=(0,o.useRef)(null),[h,w]=o.useState(!1),k=o.useCallback(()=>{w(!0)},[]),x=o.useCallback(()=>{w(!1)},[]),[y,C]=o.useState(!1),E=o.useCallback(()=>{C(!0)},[]),O=o.useCallback(()=>{C(!1)},[]);return o.createElement(s.Z,Object.assign({type:"number",ref:(0,c.lq)([v,t]),disabled:p,makeInputClassName:(0,c.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=v.current)||void 0===t?void 0:t.value;null==r||r(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&E()},onKeyUp:e=>{"ArrowDown"===e.key&&x(),"ArrowUp"===e.key&&O()},onChange:e=>{p||(null==f||f(parseFloat(e.target.value)),null==g||g(e))},stepper:m?o.createElement("div",{className:(0,i.q)("flex justify-center align-middle")},o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=v.current)||void 0===e||e.stepDown(),null===(t=v.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.q)(!p&&d,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(l,{"data-testid":"step-down",className:(h?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=v.current)||void 0===e||e.stepUp(),null===(t=v.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,i.q)(!p&&d,u,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(a,{"data-testid":"step-up",className:(y?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},b))});m.displayName="NumberInput"},27281:function(e,t,r){"use strict";r.d(t,{Z:function(){return f}});var n=r(5853),o=r(58747),a=r(2265),l=r(4537),i=r(13241),c=r(1153),s=r(96398),u=r(51975),d=r(85238),m=r(44140);let p=(0,c.fn)("Select"),f=a.forwardRef((e,t)=>{let{defaultValue:r="",value:c,onValueChange:f,placeholder:g="Select...",disabled:b=!1,icon:v,enableClear:h=!1,required:w,children:k,name:x,error:y=!1,errorMessage:C,className:E,id:O}=e,j=(0,n._T)(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),S=(0,a.useRef)(null),N=a.Children.toArray(k),[Z,M]=(0,m.Z)(r,c),L=(0,a.useMemo)(()=>{let e=a.Children.toArray(k).filter(a.isValidElement);return(0,s.sl)(e)},[k]);return a.createElement("div",{className:(0,i.q)("w-full min-w-[10rem] text-tremor-default",E)},a.createElement("div",{className:"relative"},a.createElement("select",{title:"select-hidden",required:w,className:(0,i.q)("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:Z,onChange:e=>{e.preventDefault()},name:x,disabled:b,id:O,onFocus:()=>{let e=S.current;e&&e.focus()}},a.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},g),N.map(e=>{let t=e.props.value,r=e.props.children;return a.createElement("option",{className:"hidden",key:t,value:t},r)})),a.createElement(u.Ri,Object.assign({as:"div",ref:t,defaultValue:Z,value:Z,onChange:e=>{null==f||f(e),M(e)},disabled:b,id:O},j),e=>{var t;let{value:r}=e;return a.createElement(a.Fragment,null,a.createElement(u.Y4,{ref:S,className:(0,i.q)("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","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",v?"pl-10":"pl-3",(0,s.um)((0,s.Uh)(r),b,y))},v&&a.createElement("span",{className:(0,i.q)("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},a.createElement(v,{className:(0,i.q)(p("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),a.createElement("span",{className:"w-[90%] block truncate"},r&&null!==(t=L.get(r))&&void 0!==t?t:g),a.createElement("span",{className:(0,i.q)("absolute inset-y-0 right-0 flex items-center mr-3")},a.createElement(o.Z,{className:(0,i.q)(p("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),h&&Z?a.createElement("button",{type:"button",className:(0,i.q)("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:e=>{e.preventDefault(),M(""),null==f||f("")}},a.createElement(l.Z,{className:(0,i.q)(p("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,a.createElement(d.u,{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"},a.createElement(u.O_,{anchor:"bottom start",className:(0,i.q)("z-10 w-[var(--button-width)] divide-y 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")},k)))})),y&&C?a.createElement("p",{className:(0,i.q)("errorMessage","text-sm text-rose-500 mt-1")},C):null)});f.displayName="Select"},59341:function(e,t,r){"use strict";r.d(t,{Z:function(){return P}});var n=r(5853),o=r(71049),a=r(11323),l=r(2265),i=r(66797),c=r(40099),s=r(74275),u=r(59456),d=r(93980),m=r(65573),p=r(67561),f=r(87550),g=r(628),b=r(80281),v=r(31370),h=r(20131),w=r(38929),k=r(52307),x=r(52724),y=r(7935);let C=(0,l.createContext)(null);C.displayName="GroupContext";let E=l.Fragment,O=Object.assign((0,w.yV)(function(e,t){var r;let n=(0,l.useId)(),E=(0,b.Q)(),O=(0,f.B)(),{id:j=E||"headlessui-switch-".concat(n),disabled:S=O||!1,checked:N,defaultChecked:Z,onChange:M,name:L,value:P,form:T,autoFocus:z=!1,...R}=e,I=(0,l.useContext)(C),[B,q]=(0,l.useState)(null),D=(0,l.useRef)(null),V=(0,p.T)(D,t,null===I?null:I.setSwitch,q),H=(0,s.L)(Z),[F,W]=(0,c.q)(N,M,null!=H&&H),_=(0,u.G)(),[A,K]=(0,l.useState)(!1),X=(0,d.z)(()=>{K(!0),null==W||W(!F),_.nextFrame(()=>{K(!1)})}),Y=(0,d.z)(e=>{if((0,v.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),X()}),U=(0,d.z)(e=>{e.key===x.R.Space?(e.preventDefault(),X()):e.key===x.R.Enter&&(0,h.g)(e.currentTarget)}),G=(0,d.z)(e=>e.preventDefault()),J=(0,y.wp)(),$=(0,k.zH)(),{isFocusVisible:Q,focusProps:ee}=(0,o.F)({autoFocus:z}),{isHovered:et,hoverProps:er}=(0,a.X)({isDisabled:S}),{pressed:en,pressProps:eo}=(0,i.x)({disabled:S}),ea=(0,l.useMemo)(()=>({checked:F,disabled:S,hover:et,focus:Q,active:en,autofocus:z,changing:A}),[F,et,Q,en,S,A,z]),el=(0,w.dG)({id:j,ref:V,role:"switch",type:(0,m.f)(e,B),tabIndex:-1===e.tabIndex?0:null!=(r=e.tabIndex)?r:0,"aria-checked":F,"aria-labelledby":J,"aria-describedby":$,disabled:S||void 0,autoFocus:z,onClick:Y,onKeyUp:U,onKeyPress:G},ee,er,eo),ei=(0,l.useCallback)(()=>{if(void 0!==H)return null==W?void 0:W(H)},[W,H]),ec=(0,w.L6)();return l.createElement(l.Fragment,null,null!=L&&l.createElement(g.Mt,{disabled:S,data:{[L]:P||"on"},overrides:{type:"checkbox",checked:F},form:T,onReset:ei}),ec({ourProps:el,theirProps:R,slot:ea,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,l.useState)(null),[o,a]=(0,y.bE)(),[i,c]=(0,k.fw)(),s=(0,l.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),u=(0,w.L6)();return l.createElement(c,{name:"Switch.Description",value:i},l.createElement(a,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=s.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.createElement(C.Provider,{value:s},u({ourProps:{},theirProps:e,slot:{},defaultTag:E,name:"Switch.Group"}))))},Label:y.__,Description:k.dk});var j=r(44140),S=r(26898),N=r(13241),Z=r(1153),M=r(47187);let L=(0,Z.fn)("Switch"),P=l.forwardRef((e,t)=>{let{checked:r,defaultChecked:o=!1,onChange:a,color:i,name:c,error:s,errorMessage:u,disabled:d,required:m,tooltip:p,id:f}=e,g=(0,n._T)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),b={bgColor:i?(0,Z.bM)(i,S.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:i?(0,Z.bM)(i,S.K.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[v,h]=(0,j.Z)(o,r),[w,k]=(0,l.useState)(!1),{tooltipProps:x,getReferenceProps:y}=(0,M.l)(300);return l.createElement("div",{className:"flex flex-row items-center justify-start"},l.createElement(M.Z,Object.assign({text:p},x)),l.createElement("div",Object.assign({ref:(0,Z.lq)([t,x.refs.setReference]),className:(0,N.q)(L("root"),"flex flex-row relative h-5")},g,y),l.createElement("input",{type:"checkbox",className:(0,N.q)(L("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:c,required:m,checked:v,onChange:e=>{e.preventDefault()}}),l.createElement(O,{checked:v,onChange:e=>{h(e),null==a||a(e)},disabled:d,className:(0,N.q)(L("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:()=>k(!0),onBlur:()=>k(!1),id:f},l.createElement("span",{className:(0,N.q)(L("sr-only"),"sr-only")},"Switch ",v?"on":"off"),l.createElement("span",{"aria-hidden":"true",className:(0,N.q)(L("background"),v?b.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")}),l.createElement("span",{"aria-hidden":"true",className:(0,N.q)(L("round"),v?(0,N.q)(b.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",w?(0,N.q)("ring-2",b.ringColor):"")}))),s&&u?l.createElement("p",{className:(0,N.q)(L("errorMessage"),"text-sm text-red-500 mt-1 ")},u):null)});P.displayName="Switch"},87452:function(e,t,r){"use strict";r.d(t,{Z:function(){return d},r:function(){return u}});var n=r(5853),o=r(91054);r(42698),r(64016);var a=r(8710);r(33232);var l=r(13241),i=r(1153),c=r(2265);let s=(0,i.fn)("Accordion"),u=(0,c.createContext)({isOpen:!1}),d=c.forwardRef((e,t)=>{var r;let{defaultOpen:i=!1,children:d,className:m}=e,p=(0,n._T)(e,["defaultOpen","children","className"]),f=null!==(r=(0,c.useContext)(a.Z))&&void 0!==r?r:(0,l.q)("rounded-tremor-default border");return c.createElement(o.pJ,Object.assign({as:"div",ref:t,className:(0,l.q)(s("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",f,m),defaultOpen:i},p),e=>{let{open:t}=e;return c.createElement(u.Provider,{value:{isOpen:t}},d)})});d.displayName="Accordion"},88829:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(5853),o=r(2265),a=r(91054),l=r(13241);let i=(0,r(1153).fn)("AccordionBody"),c=o.forwardRef((e,t)=>{let{children:r,className:c}=e,s=(0,n._T)(e,["children","className"]);return o.createElement(a.pJ.Panel,Object.assign({ref:t,className:(0,l.q)(i("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",c)},s),r)});c.displayName="AccordionBody"},72208:function(e,t,r){"use strict";r.d(t,{Z:function(){return u}});var n=r(5853),o=r(2265),a=r(91054);let l=e=>{var t=(0,n._T)(e,[]);return o.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),o.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var i=r(87452),c=r(13241);let s=(0,r(1153).fn)("AccordionHeader"),u=o.forwardRef((e,t)=>{let{children:r,className:u}=e,d=(0,n._T)(e,["children","className"]),{isOpen:m}=(0,o.useContext)(i.r);return o.createElement(a.pJ.Button,Object.assign({ref:t,className:(0,c.q)(s("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",u)},d),o.createElement("div",{className:(0,c.q)(s("children"),"flex flex-1 text-inherit mr-4")},r),o.createElement("div",null,o.createElement(l,{className:(0,c.q)(s("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",m?"transition-all":"transition-all -rotate-180")})))});u.displayName="AccordionHeader"},49804:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(5853),o=r(13241),a=r(1153),l=r(2265),i=r(9496);let c=(0,a.fn)("Col"),s=l.forwardRef((e,t)=>{let{numColSpan:r=1,numColSpanSm:a,numColSpanMd:s,numColSpanLg:u,children:d,className:m}=e,p=(0,n._T)(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),f=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"";return l.createElement("div",Object.assign({ref:t,className:(0,o.q)(c("root"),(()=>{let e=f(r,i.PT),t=f(a,i.SP),n=f(s,i.VS),l=f(u,i._w);return(0,o.q)(e,t,n,l)})(),m)},p),d)});s.displayName="Col"},97765:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(5853),o=r(26898),a=r(13241),l=r(1153),i=r(2265);let c=i.forwardRef((e,t)=>{let{color:r,children:c,className:s}=e,u=(0,n._T)(e,["color","children","className"]);return i.createElement("p",Object.assign({ref:t,className:(0,a.q)(r?(0,l.bM)(r,o.K.lightText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",s)},u),c)});c.displayName="Subtitle"},44140:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(2265);let o=(e,t)=>{let r=void 0!==t,[o,a]=(0,n.useState)(e);return[r?t:o,e=>{r||a(e)}]}},92570:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=e=>e?"function"==typeof e?e():e:null},69410:function(e,t,r){"use strict";var n=r(54998);t.Z=n.Z},867:function(e,t,r){"use strict";r.d(t,{Z:function(){return O}});var n=r(2265),o=r(54537),a=r(36760),l=r.n(a),i=r(50506),c=r(18694),s=r(71744),u=r(79326),d=r(59367),m=r(92570),p=r(5545),f=r(51248),g=r(55274),b=r(37381),v=r(20435),h=r(99320);let w=e=>{let{componentCls:t,iconCls:r,antCls:n,zIndexPopup:o,colorText:a,colorWarning:l,marginXXS:i,marginXS:c,fontSize:s,fontWeightStrong:u,colorTextHeading:d}=e;return{[t]:{zIndex:o,["&".concat(n,"-popover")]:{fontSize:s},["".concat(t,"-message")]:{marginBottom:c,display:"flex",flexWrap:"nowrap",alignItems:"start",["> ".concat(t,"-message-icon ").concat(r)]:{color:l,fontSize:s,lineHeight:1,marginInlineEnd:c},["".concat(t,"-title")]:{fontWeight:u,color:d,"&:only-child":{fontWeight:"normal"}},["".concat(t,"-description")]:{marginTop:i,color:a}},["".concat(t,"-buttons")]:{textAlign:"end",whiteSpace:"nowrap",button:{marginInlineStart:c}}}}};var k=(0,h.I$)("Popconfirm",e=>w(e),e=>{let{zIndexPopupBase:t}=e;return{zIndexPopup:t+60}},{resetStyle:!1}),x=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 y=e=>{let{prefixCls:t,okButtonProps:r,cancelButtonProps:a,title:l,description:i,cancelText:c,okText:u,okType:v="primary",icon:h=n.createElement(o.Z,null),showCancel:w=!0,close:k,onConfirm:x,onCancel:y,onPopupClick:C}=e,{getPrefixCls:E}=n.useContext(s.E_),[O]=(0,g.Z)("Popconfirm",b.Z.Popconfirm),j=(0,m.Z)(l),S=(0,m.Z)(i);return n.createElement("div",{className:"".concat(t,"-inner-content"),onClick:C},n.createElement("div",{className:"".concat(t,"-message")},h&&n.createElement("span",{className:"".concat(t,"-message-icon")},h),n.createElement("div",{className:"".concat(t,"-message-text")},j&&n.createElement("div",{className:"".concat(t,"-title")},j),S&&n.createElement("div",{className:"".concat(t,"-description")},S))),n.createElement("div",{className:"".concat(t,"-buttons")},w&&n.createElement(p.ZP,Object.assign({onClick:y,size:"small"},a),c||(null==O?void 0:O.cancelText)),n.createElement(d.Z,{buttonProps:Object.assign(Object.assign({size:"small"},(0,f.nx)(v)),r),actionFn:x,close:k,prefixCls:E("btn"),quitOnNullishReturnValue:!0,emitEvent:!0},u||(null==O?void 0:O.okText))))};var 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 E=n.forwardRef((e,t)=>{var r,a;let{prefixCls:d,placement:m="top",trigger:p="click",okType:f="primary",icon:g=n.createElement(o.Z,null),children:b,overlayClassName:v,onOpenChange:h,onVisibleChange:w,overlayStyle:x,styles:E,classNames:O}=e,j=C(e,["prefixCls","placement","trigger","okType","icon","children","overlayClassName","onOpenChange","onVisibleChange","overlayStyle","styles","classNames"]),{getPrefixCls:S,className:N,style:Z,classNames:M,styles:L}=(0,s.dj)("popconfirm"),[P,T]=(0,i.Z)(!1,{value:null!==(r=e.open)&&void 0!==r?r:e.visible,defaultValue:null!==(a=e.defaultOpen)&&void 0!==a?a:e.defaultVisible}),z=(e,t)=>{T(e,!0),null==w||w(e),null==h||h(e,t)},R=S("popconfirm",d),I=l()(R,N,v,M.root,null==O?void 0:O.root),B=l()(M.body,null==O?void 0:O.body),[q]=k(R);return q(n.createElement(u.Z,Object.assign({},(0,c.Z)(j,["title"]),{trigger:p,placement:m,onOpenChange:(t,r)=>{let{disabled:n=!1}=e;n||z(t,r)},open:P,ref:t,classNames:{root:I,body:B},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},L.root),Z),x),null==E?void 0:E.root),body:Object.assign(Object.assign({},L.body),null==E?void 0:E.body)},content:n.createElement(y,Object.assign({okType:f,icon:g},e,{prefixCls:R,close:e=>{z(!1,e)},onConfirm:t=>{var r;return null===(r=e.onConfirm)||void 0===r?void 0:r.call(void 0,t)},onCancel:t=>{var r;z(!1,t),null===(r=e.onCancel)||void 0===r||r.call(void 0,t)}})),"data-popover-inject":!0}),b))});E._InternalPanelDoNotUseOrYouWillBeFired=e=>{let{prefixCls:t,placement:r,className:o,style:a}=e,i=x(e,["prefixCls","placement","className","style"]),{getPrefixCls:c}=n.useContext(s.E_),u=c("popconfirm",t),[d]=k(u);return d(n.createElement(v.ZP,{placement:r,className:l()(u,o),style:a,content:n.createElement(y,Object.assign({prefixCls:u},i))}))};var O=E},20435:function(e,t,r){"use strict";r.d(t,{aV:function(){return d}});var n=r(2265),o=r(36760),a=r.n(o),l=r(5769),i=r(92570),c=r(71744),s=r(72262),u=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 d=e=>{let{title:t,content:r,prefixCls:o}=e;return t||r?n.createElement(n.Fragment,null,t&&n.createElement("div",{className:"".concat(o,"-title")},t),r&&n.createElement("div",{className:"".concat(o,"-inner-content")},r)):null},m=e=>{let{hashId:t,prefixCls:r,className:o,style:c,placement:s="top",title:u,content:m,children:p}=e,f=(0,i.Z)(u),g=(0,i.Z)(m),b=a()(t,r,"".concat(r,"-pure"),"".concat(r,"-placement-").concat(s),o);return n.createElement("div",{className:b,style:c},n.createElement("div",{className:"".concat(r,"-arrow")}),n.createElement(l.G,Object.assign({},e,{className:t,prefixCls:r}),p||n.createElement(d,{prefixCls:r,title:f,content:g})))};t.ZP=e=>{let{prefixCls:t,className:r}=e,o=u(e,["prefixCls","className"]),{getPrefixCls:l}=n.useContext(c.E_),i=l("popover",t),[d,p,f]=(0,s.Z)(i);return d(n.createElement(m,Object.assign({},o,{prefixCls:i,hashId:p,className:a()(r,f)})))}},79326:function(e,t,r){"use strict";var n=r(2265),o=r(36760),a=r.n(o),l=r(50506),i=r(95814),c=r(92570),s=r(68710),u=r(19722),d=r(71744),m=r(99981),p=r(20435),f=r(72262),g=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 b=n.forwardRef((e,t)=>{var r,o;let{prefixCls:b,title:v,content:h,overlayClassName:w,placement:k="top",trigger:x="hover",children:y,mouseEnterDelay:C=.1,mouseLeaveDelay:E=.1,onOpenChange:O,overlayStyle:j={},styles:S,classNames:N}=e,Z=g(e,["prefixCls","title","content","overlayClassName","placement","trigger","children","mouseEnterDelay","mouseLeaveDelay","onOpenChange","overlayStyle","styles","classNames"]),{getPrefixCls:M,className:L,style:P,classNames:T,styles:z}=(0,d.dj)("popover"),R=M("popover",b),[I,B,q]=(0,f.Z)(R),D=M(),V=a()(w,B,q,L,T.root,null==N?void 0:N.root),H=a()(T.body,null==N?void 0:N.body),[F,W]=(0,l.Z)(!1,{value:null!==(r=e.open)&&void 0!==r?r:e.visible,defaultValue:null!==(o=e.defaultOpen)&&void 0!==o?o:e.defaultVisible}),_=(e,t)=>{W(e,!0),null==O||O(e,t)},A=e=>{e.keyCode===i.Z.ESC&&_(!1,e)},K=(0,c.Z)(v),X=(0,c.Z)(h);return I(n.createElement(m.Z,Object.assign({placement:k,trigger:x,mouseEnterDelay:C,mouseLeaveDelay:E},Z,{prefixCls:R,classNames:{root:V,body:H},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},z.root),P),j),null==S?void 0:S.root),body:Object.assign(Object.assign({},z.body),null==S?void 0:S.body)},ref:t,open:F,onOpenChange:e=>{_(e)},overlay:K||X?n.createElement(p.aV,{prefixCls:R,title:K,content:X}):null,transitionName:(0,s.m)(D,"zoom-big",Z.transitionName),"data-popover-inject":!0}),(0,u.Tm)(y,{onKeyDown:e=>{var t,r;(0,n.isValidElement)(y)&&(null===(r=null==y?void 0:(t=y.props).onKeyDown)||void 0===r||r.call(t,e)),A(e)}})))});b._InternalPanelDoNotUseOrYouWillBeFired=p.ZP,t.Z=b},72262:function(e,t,r){"use strict";var n=r(12918),o=r(691),a=r(88260),l=r(34442),i=r(53454),c=r(99320),s=r(71140);let u=e=>{let{componentCls:t,popoverColor:r,titleMinWidth:o,fontWeightStrong:l,innerPadding:i,boxShadowSecondary:c,colorTextHeading:s,borderRadiusLG:u,zIndexPopup:d,titleMarginBottom:m,colorBgElevated:p,popoverBg:f,titleBorderBottom:g,innerContentPadding:b,titlePadding:v}=e;return[{[t]:Object.assign(Object.assign({},(0,n.Wf)(e)),{position:"absolute",top:0,left:{_skip_check_:!0,value:0},zIndex:d,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"},["".concat(t,"-content")]:{position:"relative"},["".concat(t,"-inner")]:{backgroundColor:f,backgroundClip:"padding-box",borderRadius:u,boxShadow:c,padding:i},["".concat(t,"-title")]:{minWidth:o,marginBottom:m,color:s,fontWeight:l,borderBottom:g,padding:v},["".concat(t,"-inner-content")]:{color:r,padding:b}})},(0,a.ZP)(e,"var(--antd-arrow-background-color)"),{["".concat(t,"-pure")]:{position:"relative",maxWidth:"none",margin:e.sizePopupArrow,display:"inline-block",["".concat(t,"-content")]:{display:"inline-block"}}}]},d=e=>{let{componentCls:t}=e;return{[t]:i.i.map(r=>{let n=e["".concat(r,"6")];return{["&".concat(t,"-").concat(r)]:{"--antd-arrow-background-color":n,["".concat(t,"-inner")]:{backgroundColor:n},["".concat(t,"-arrow")]:{background:"transparent"}}}})}};t.Z=(0,c.I$)("Popover",e=>{let{colorBgElevated:t,colorText:r}=e,n=(0,s.IX)(e,{popoverBg:t,popoverColor:r});return[u(n),d(n),(0,o._y)(n,"zoom-big")]},e=>{let{lineWidth:t,controlHeight:r,fontHeight:n,padding:o,wireframe:i,zIndexPopupBase:c,borderRadiusLG:s,marginXS:u,lineType:d,colorSplit:m,paddingSM:p}=e,f=r-n;return Object.assign(Object.assign(Object.assign({titleMinWidth:177,zIndexPopup:c+30},(0,l.w)(e)),(0,a.wZ)({contentRadius:s,limitVerticalRadius:!0})),{innerPadding:i?0:12,titleMarginBottom:i?0:u,titlePadding:i?"".concat(f/2,"px ").concat(o,"px ").concat(f/2-t,"px"):0,titleBorderBottom:i?"".concat(t,"px ").concat(d," ").concat(m):"none",innerContentPadding:i?"".concat(p,"px ").concat(o,"px"):0})},{resetStyle:!1,deprecatedTokens:[["width","titleMinWidth"],["minWidth","titleMinWidth"]]})},47451:function(e,t,r){"use strict";var n=r(77774);t.Z=n.Z},3810:function(e,t,r){"use strict";r.d(t,{Z:function(){return M}});var n=r(2265),o=r(36760),a=r.n(o),l=r(18694),i=r(93350),c=r(53445),s=r(19722),u=r(6694),d=r(71744),m=r(93463),p=r(54558),f=r(12918),g=r(71140),b=r(99320);let v=e=>{let{paddingXXS:t,lineWidth:r,tagPaddingHorizontal:n,componentCls:o,calc:a}=e,l=a(n).sub(r).equal(),i=a(t).sub(r).equal();return{[o]:Object.assign(Object.assign({},(0,f.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:l,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:i,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:l}}),["".concat(o,"-borderless")]:{borderColor:"transparent",background:e.tagBorderlessBg}}},h=e=>{let{lineWidth:t,fontSizeIcon:r,calc:n}=e,o=e.fontSizeSM;return(0,g.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})},w=e=>({defaultBg:new p.t(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText});var k=(0,b.I$)("Tag",e=>v(h(e)),w),x=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 y=n.forwardRef((e,t)=>{let{prefixCls:r,style:o,className:l,checked:i,children:c,icon:s,onChange:u,onClick:m}=e,p=x(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:f,tag:g}=n.useContext(d.E_),b=f("tag",r),[v,h,w]=k(b),y=a()(b,"".concat(b,"-checkable"),{["".concat(b,"-checkable-checked")]:i},null==g?void 0:g.className,l,h,w);return v(n.createElement("span",Object.assign({},p,{ref:t,style:Object.assign(Object.assign({},o),null==g?void 0:g.style),className:y,onClick:e=>{null==u||u(!i),null==m||m(e)}}),s,n.createElement("span",null,c)))});var C=r(18536);let E=e=>(0,C.Z)(e,(t,r)=>{let{textColor:n,lightBorderColor:o,lightColor:a,darkColor:l}=r;return{["".concat(e.componentCls).concat(e.componentCls,"-").concat(t)]:{color:n,background:a,borderColor:o,"&-inverse":{color:e.colorTextLightSolid,background:l,borderColor:l},["&".concat(e.componentCls,"-borderless")]:{borderColor:"transparent"}}}});var O=(0,b.bk)(["Tag","preset"],e=>E(h(e)),w);let j=(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 S=(0,b.bk)(["Tag","status"],e=>{let t=h(e);return[j(t,"success","Success"),j(t,"processing","Info"),j(t,"error","Error"),j(t,"warning","Warning")]},w),N=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:p,children:f,icon:g,color:b,onClose:v,bordered:h=!0,visible:w}=e,x=N(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:y,direction:C,tag:E}=n.useContext(d.E_),[j,Z]=n.useState(!0),M=(0,l.Z)(x,["closeIcon","closable"]);n.useEffect(()=>{void 0!==w&&Z(w)},[w]);let L=(0,i.o2)(b),P=(0,i.yT)(b),T=L||P,z=Object.assign(Object.assign({backgroundColor:b&&!T?b:void 0},null==E?void 0:E.style),p),R=y("tag",r),[I,B,q]=k(R),D=a()(R,null==E?void 0:E.className,{["".concat(R,"-").concat(b)]:T,["".concat(R,"-has-color")]:b&&!T,["".concat(R,"-hidden")]:!j,["".concat(R,"-rtl")]:"rtl"===C,["".concat(R,"-borderless")]:!h},o,m,B,q),V=e=>{e.stopPropagation(),null==v||v(e),e.defaultPrevented||Z(!1)},[,H]=(0,c.b)((0,c.w)(e),(0,c.w)(E),{closable:!1,closeIconRender:e=>{let t=n.createElement("span",{className:"".concat(R,"-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(R,"-close-icon"))}))}}),F="function"==typeof x.onClick||f&&"a"===f.type,W=g||null,_=W?n.createElement(n.Fragment,null,W,f&&n.createElement("span",null,f)):f,A=n.createElement("span",Object.assign({},M,{ref:t,className:D,style:z}),_,H,L&&n.createElement(O,{key:"preset",prefixCls:R}),P&&n.createElement(S,{key:"status",prefixCls:R}));return I(F?n.createElement(u.Z,{component:"Tag"},A):A)});Z.CheckableTag=y;var M=Z},23910:function(e,t,r){var n=r(74288).Symbol;e.exports=n},54506:function(e,t,r){var n=r(23910),o=r(4479),a=r(80910),l=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":l&&l in Object(e)?o(e):a(e)}},41087:function(e,t,r){var n=r(5035),o=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(o,""):e}},17071:function(e,t,r){var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},4479:function(e,t,r){var n=r(23910),o=Object.prototype,a=o.hasOwnProperty,l=o.toString,i=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,i),r=e[i];try{e[i]=void 0;var n=!0}catch(e){}var o=l.call(e);return n&&(t?e[i]=r:delete e[i]),o}},80910:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},74288:function(e,t,r){var n=r(17071),o="object"==typeof self&&self&&self.Object===Object&&self,a=n||o||Function("return this")();e.exports=a},5035:function(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},7310:function(e,t,r){var n=r(28302),o=r(11121),a=r(6660),l=Math.max,i=Math.min;e.exports=function(e,t,r){var c,s,u,d,m,p,f=0,g=!1,b=!1,v=!0;if("function"!=typeof e)throw TypeError("Expected a function");function h(t){var r=c,n=s;return c=s=void 0,f=t,d=e.apply(n,r)}function w(e){var r=e-p,n=e-f;return void 0===p||r>=t||r<0||b&&n>=u}function k(){var e,r,n,a=o();if(w(a))return x(a);m=setTimeout(k,(e=a-p,r=a-f,n=t-e,b?i(n,u-r):n))}function x(e){return(m=void 0,v&&c)?h(e):(c=s=void 0,d)}function y(){var e,r=o(),n=w(r);if(c=arguments,s=this,p=r,n){if(void 0===m)return f=e=p,m=setTimeout(k,t),g?h(e):d;if(b)return clearTimeout(m),m=setTimeout(k,t),h(p)}return void 0===m&&(m=setTimeout(k,t)),d}return t=a(t)||0,n(r)&&(g=!!r.leading,u=(b="maxWait"in r)?l(a(r.maxWait)||0,t):u,v="trailing"in r?!!r.trailing:v),y.cancel=function(){void 0!==m&&clearTimeout(m),f=0,c=p=s=m=void 0},y.flush=function(){return void 0===m?d:x(o())},y}},28302:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},10303:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},78371:function(e,t,r){var n=r(54506),o=r(10303);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==n(e)}},11121:function(e,t,r){var n=r(74288);e.exports=function(){return n.Date.now()}},6660:function(e,t,r){var n=r(41087),o=r(28302),a=r(78371),l=0/0,i=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,s=/^0o[0-7]+$/i,u=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(a(e))return l;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=c.test(e);return r||s.test(e)?u(e.slice(2),r?2:8):i.test(e)?l:+e}},30401:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,r){"use strict";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"}]])},87769:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},42208:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},32489:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},10900:function(e,t,r){"use strict";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},91777:function(e,t,r){"use strict";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:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});t.Z=o},86462:function(e,t,r){"use strict";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 9l-7 7-7-7"}))});t.Z=o},47686:function(e,t,r){"use strict";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:"M9 5l7 7-7 7"}))});t.Z=o},44633:function(e,t,r){"use strict";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:"M5 15l7-7 7 7"}))});t.Z=o},82182:function(e,t,r){"use strict";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.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});t.Z=o},79814:function(e,t,r){"use strict";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:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});t.Z=o},3477:function(e,t,r){"use strict";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 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});t.Z=o},45589:function(e,t,r){"use strict";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 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"}))});t.Z=o},93416:function(e,t,r){"use strict";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.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"}))});t.Z=o},91126:function(e,t,r){"use strict";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:"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"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o},77355:function(e,t,r){"use strict";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:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o},22452:function(e,t,r){"use strict";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:"M12 4v16m8-8H4"}))});t.Z=o},23628:function(e,t,r){"use strict";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:"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"}))});t.Z=o},25327:function(e,t,r){"use strict";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:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});t.Z=o},49084:function(e,t,r){"use strict";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:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});t.Z=o},74998:function(e,t,r){"use strict";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},3497:function(e,t,r){"use strict";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:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))});t.Z=o},91054:function(e,t,r){"use strict";let n,o;r.d(t,{pJ:function(){return P}});var a,l=r(71049),i=r(11323),c=r(2265),s=r(66797),u=r(93980),d=r(65573),m=r(67561),p=r(98218),f=r(33443),g=r(28294),b=r(31370),v=r(72468),h=r(5664),w=r(38929);let k=null!=(a=c.startTransition)?a:function(e){e()};var x=r(52724),y=((n=y||{})[n.Open=0]="Open",n[n.Closed=1]="Closed",n),C=((o=C||{})[o.ToggleDisclosure=0]="ToggleDisclosure",o[o.CloseDisclosure=1]="CloseDisclosure",o[o.SetButtonId=2]="SetButtonId",o[o.SetPanelId=3]="SetPanelId",o[o.SetButtonElement=4]="SetButtonElement",o[o.SetPanelElement=5]="SetPanelElement",o);let E={0:e=>({...e,disclosureState:(0,v.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},O=(0,c.createContext)(null);function j(e){let t=(0,c.useContext)(O);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,j),t}return t}O.displayName="DisclosureContext";let S=(0,c.createContext)(null);S.displayName="DisclosureAPIContext";let N=(0,c.createContext)(null);function Z(e,t){return(0,v.E)(t.type,E,e,t)}N.displayName="DisclosurePanelContext";let M=c.Fragment,L=w.VN.RenderStrategy|w.VN.Static,P=Object.assign((0,w.yV)(function(e,t){let{defaultOpen:r=!1,...n}=e,o=(0,c.useRef)(null),a=(0,m.T)(t,(0,m.h)(e=>{o.current=e},void 0===e.as||e.as===c.Fragment)),l=(0,c.useReducer)(Z,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:i,buttonId:s},d]=l,p=(0,u.z)(e=>{d({type:1});let t=(0,h.r)(o);if(!t||!s)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(s):t.getElementById(s);null==r||r.focus()}),b=(0,c.useMemo)(()=>({close:p}),[p]),k=(0,c.useMemo)(()=>({open:0===i,close:p}),[i,p]),x=(0,w.L6)();return c.createElement(O.Provider,{value:l},c.createElement(S.Provider,{value:b},c.createElement(f.Z,{value:p},c.createElement(g.up,{value:(0,v.E)(i,{0:g.ZM.Open,1:g.ZM.Closed})},x({ourProps:{ref:a},theirProps:n,slot:k,defaultTag:M,name:"Disclosure"})))))}),{Button:(0,w.yV)(function(e,t){let r=(0,c.useId)(),{id:n="headlessui-disclosure-button-".concat(r),disabled:o=!1,autoFocus:a=!1,...p}=e,[f,g]=j("Disclosure.Button"),v=(0,c.useContext)(N),h=null!==v&&v===f.panelId,k=(0,c.useRef)(null),y=(0,m.T)(k,t,(0,u.z)(e=>{if(!h)return g({type:4,element:e})}));(0,c.useEffect)(()=>{if(!h)return g({type:2,buttonId:n}),()=>{g({type:2,buttonId:null})}},[n,g,h]);let C=(0,u.z)(e=>{var t;if(h){if(1===f.disclosureState)return;switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),g({type:0}),null==(t=f.buttonElement)||t.focus()}}else switch(e.key){case x.R.Space:case x.R.Enter:e.preventDefault(),e.stopPropagation(),g({type:0})}}),E=(0,u.z)(e=>{e.key===x.R.Space&&e.preventDefault()}),O=(0,u.z)(e=>{var t;(0,b.P)(e.currentTarget)||o||(h?(g({type:0}),null==(t=f.buttonElement)||t.focus()):g({type:0}))}),{isFocusVisible:S,focusProps:Z}=(0,l.F)({autoFocus:a}),{isHovered:M,hoverProps:L}=(0,i.X)({isDisabled:o}),{pressed:P,pressProps:T}=(0,s.x)({disabled:o}),z=(0,c.useMemo)(()=>({open:0===f.disclosureState,hover:M,active:P,disabled:o,focus:S,autofocus:a}),[f,M,P,S,o,a]),R=(0,d.f)(e,f.buttonElement),I=h?(0,w.dG)({ref:y,type:R,disabled:o||void 0,autoFocus:a,onKeyDown:C,onClick:O},Z,L,T):(0,w.dG)({ref:y,id:n,type:R,"aria-expanded":0===f.disclosureState,"aria-controls":f.panelElement?f.panelId:void 0,disabled:o||void 0,autoFocus:a,onKeyDown:C,onKeyUp:E,onClick:O},Z,L,T);return(0,w.L6)()({ourProps:I,theirProps:p,slot:z,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,w.yV)(function(e,t){let r=(0,c.useId)(),{id:n="headlessui-disclosure-panel-".concat(r),transition:o=!1,...a}=e,[l,i]=j("Disclosure.Panel"),{close:s}=function e(t){let r=(0,c.useContext)(S);if(null===r){let r=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[d,f]=(0,c.useState)(null),b=(0,m.T)(t,(0,u.z)(e=>{k(()=>i({type:5,element:e}))}),f);(0,c.useEffect)(()=>(i({type:3,panelId:n}),()=>{i({type:3,panelId:null})}),[n,i]);let v=(0,g.oJ)(),[h,x]=(0,p.Y)(o,d,null!==v?(v&g.ZM.Open)===g.ZM.Open:0===l.disclosureState),y=(0,c.useMemo)(()=>({open:0===l.disclosureState,close:s}),[l.disclosureState,s]),C={ref:b,id:n,...(0,p.X)(x)},E=(0,w.L6)();return c.createElement(g.uu,null,c.createElement(N.Provider,{value:l.panelId},E({ourProps:C,theirProps:a,slot:y,defaultTag:"div",features:L,visible:h,name:"Disclosure.Panel"})))})})},85238:function(e,t,r){"use strict";let n;r.d(t,{u:function(){return N}});var o=r(2265),a=r(59456),l=r(93980),i=r(25289),c=r(73389),s=r(43507),u=r(180),d=r(67561),m=r(98218),p=r(28294),f=r(95504),g=r(72468),b=r(38929);function v(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||(null!=(t=e.as)?t:C)!==o.Fragment||1===o.Children.count(e.children)}let h=(0,o.createContext)(null);h.displayName="TransitionContext";var w=((n=w||{}).Visible="visible",n.Hidden="hidden",n);let k=(0,o.createContext)(null);function x(e){return"children"in e?x(e.children):e.current.filter(e=>{let{el:t}=e;return null!==t.current}).filter(e=>{let{state:t}=e;return"visible"===t}).length>0}function y(e,t){let r=(0,s.E)(e),n=(0,o.useRef)([]),c=(0,i.t)(),u=(0,a.G)(),d=(0,l.z)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b.l4.Hidden,o=n.current.findIndex(t=>{let{el:r}=t;return r===e});-1!==o&&((0,g.E)(t,{[b.l4.Unmount](){n.current.splice(o,1)},[b.l4.Hidden](){n.current[o].state="hidden"}}),u.microTask(()=>{var e;!x(n)&&c.current&&(null==(e=r.current)||e.call(r))}))}),m=(0,l.z)(e=>{let t=n.current.find(t=>{let{el:r}=t;return r===e});return t?"visible"!==t.state&&(t.state="visible"):n.current.push({el:e,state:"visible"}),()=>d(e,b.l4.Unmount)}),p=(0,o.useRef)([]),f=(0,o.useRef)(Promise.resolve()),v=(0,o.useRef)({enter:[],leave:[]}),h=(0,l.z)((e,r,n)=>{p.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(t=>{let[r]=t;return r!==e})),null==t||t.chains.current[r].push([e,new Promise(e=>{p.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(v.current[r].map(e=>{let[t,r]=e;return r})).then(()=>e())})]),"enter"===r?f.current=f.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),w=(0,l.z)((e,t,r)=>{Promise.all(v.current[t].splice(0).map(e=>{let[t,r]=e;return r})).then(()=>{var e;null==(e=p.current.shift())||e()}).then(()=>r(t))});return(0,o.useMemo)(()=>({children:n,register:m,unregister:d,onStart:h,onStop:w,wait:f,chains:v}),[m,d,n,h,w,v,f])}k.displayName="NestingContext";let C=o.Fragment,E=b.VN.RenderStrategy,O=(0,b.yV)(function(e,t){let{show:r,appear:n=!1,unmount:a=!0,...i}=e,s=(0,o.useRef)(null),m=v(e),f=(0,d.T)(...m?[s,t]:null===t?[]:[t]);(0,u.H)();let g=(0,p.oJ)();if(void 0===r&&null!==g&&(r=(g&p.ZM.Open)===p.ZM.Open),void 0===r)throw Error("A is used but it is missing a `show={true | false}` prop.");let[w,C]=(0,o.useState)(r?"visible":"hidden"),O=y(()=>{r||C("hidden")}),[S,N]=(0,o.useState)(!0),Z=(0,o.useRef)([r]);(0,c.e)(()=>{!1!==S&&Z.current[Z.current.length-1]!==r&&(Z.current.push(r),N(!1))},[Z,r]);let M=(0,o.useMemo)(()=>({show:r,appear:n,initial:S}),[r,n,S]);(0,c.e)(()=>{r?C("visible"):x(O)||null===s.current||C("hidden")},[r,O]);let L={unmount:a},P=(0,l.z)(()=>{var t;S&&N(!1),null==(t=e.beforeEnter)||t.call(e)}),T=(0,l.z)(()=>{var t;S&&N(!1),null==(t=e.beforeLeave)||t.call(e)}),z=(0,b.L6)();return o.createElement(k.Provider,{value:O},o.createElement(h.Provider,{value:M},z({ourProps:{...L,as:o.Fragment,children:o.createElement(j,{ref:f,...L,...i,beforeEnter:P,beforeLeave:T})},theirProps:{},defaultTag:o.Fragment,features:E,visible:"visible"===w,name:"Transition"})))}),j=(0,b.yV)(function(e,t){var r,n;let{transition:a=!0,beforeEnter:i,afterEnter:s,beforeLeave:w,afterLeave:O,enter:j,enterFrom:S,enterTo:N,entered:Z,leave:M,leaveFrom:L,leaveTo:P,...T}=e,[z,R]=(0,o.useState)(null),I=(0,o.useRef)(null),B=v(e),q=(0,d.T)(...B?[I,t,R]:null===t?[]:[t]),D=null==(r=T.unmount)||r?b.l4.Unmount:b.l4.Hidden,{show:V,appear:H,initial:F}=function(){let e=(0,o.useContext)(h);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),[W,_]=(0,o.useState)(V?"visible":"hidden"),A=function(){let e=(0,o.useContext)(k);if(null===e)throw Error("A is used but it is missing a parent or .");return e}(),{register:K,unregister:X}=A;(0,c.e)(()=>K(I),[K,I]),(0,c.e)(()=>{if(D===b.l4.Hidden&&I.current){if(V&&"visible"!==W){_("visible");return}return(0,g.E)(W,{hidden:()=>X(I),visible:()=>K(I)})}},[W,I,K,X,V,D]);let Y=(0,u.H)();(0,c.e)(()=>{if(B&&Y&&"visible"===W&&null===I.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[I,W,Y,B]);let U=F&&!H,G=H&&V&&F,J=(0,o.useRef)(!1),$=y(()=>{J.current||(_("hidden"),X(I))},A),Q=(0,l.z)(e=>{J.current=!0,$.onStart(I,e?"enter":"leave",e=>{"enter"===e?null==i||i():"leave"===e&&(null==w||w())})}),ee=(0,l.z)(e=>{let t=e?"enter":"leave";J.current=!1,$.onStop(I,t,e=>{"enter"===e?null==s||s():"leave"===e&&(null==O||O())}),"leave"!==t||x($)||(_("hidden"),X(I))});(0,o.useEffect)(()=>{B&&a||(Q(V),ee(V))},[V,B,a]);let et=!(!a||!B||!Y||U),[,er]=(0,m.Y)(et,z,V,{start:Q,end:ee}),en=(0,b.oA)({ref:q,className:(null==(n=(0,f.A)(T.className,G&&j,G&&S,er.enter&&j,er.enter&&er.closed&&S,er.enter&&!er.closed&&N,er.leave&&M,er.leave&&!er.closed&&L,er.leave&&er.closed&&P,!er.transition&&V&&Z))?void 0:n.trim())||void 0,...(0,m.X)(er)}),eo=0;"visible"===W&&(eo|=p.ZM.Open),"hidden"===W&&(eo|=p.ZM.Closed),er.enter&&(eo|=p.ZM.Opening),er.leave&&(eo|=p.ZM.Closing);let ea=(0,b.L6)();return o.createElement(k.Provider,{value:$},o.createElement(p.up,{value:eo},ea({ourProps:en,theirProps:T,defaultTag:C,features:E,visible:"visible"===W,name:"Transition.Child"})))}),S=(0,b.yV)(function(e,t){let r=null!==(0,o.useContext)(h),n=null!==(0,p.oJ)();return o.createElement(o.Fragment,null,!r&&n?o.createElement(O,{ref:t,...e}):o.createElement(j,{ref:t,...e}))}),N=Object.assign(O,{Child:S,Root:O})},33443:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(2265);let o=(0,n.createContext)(()=>{});function a(e){let{value:t,children:r}=e;return n.createElement(o.Provider,{value:t},r)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/292-aaba6c4e7c8d416d.js b/litellm/proxy/_experimental/out/_next/static/chunks/292-aaba6c4e7c8d416d.js new file mode 100644 index 0000000000..988261f769 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/292-aaba6c4e7c8d416d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[292],{16312:function(e,s,t){t.d(s,{z:function(){return a.Z}});var a=t(78489)},57589:function(e,s,t){t.d(s,{Z:function(){return j}});var a=t(57437),r=t(80443),l=t(44633),n=t(86462),i=t(40278),c=t(78489),o=t(99981),d=t(10968),u=t(2265),m=t(59872);let x=e=>{let{key:s,info:t}=e;return{token:s,...t}};var h=t(19250),p=t(50665),g=t(12322),j=e=>{let{topKeys:s,teams:t,showTags:j=!1,topKeysLimit:f,setTopKeysLimit:_}=e,{accessToken:y,userRole:v,userId:k,premiumUser:b}=(0,r.Z)(),[Z,N]=(0,u.useState)(!1),[w,q]=(0,u.useState)(null),[S,C]=(0,u.useState)(void 0),[T,D]=(0,u.useState)("table"),[L,E]=(0,u.useState)(new Set),A=e=>{E(s=>{let t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},F=async e=>{if(y)try{let s=await (0,h.keyInfoV1Call)(y,e.api_key),t=x(s);C(t),q(e.api_key),N(!0)}catch(e){console.error("Error fetching key info:",e)}},O=()=>{N(!1),q(null),C(void 0)};u.useEffect(()=>{let e=e=>{"Escape"===e.key&&Z&&O()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[Z]);let M=[{header:"Key ID",accessorKey:"api_key",cell:e=>(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsx)(o.Z,{title:e.getValue(),children:(0,a.jsx)(c.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 max-w-[200px]",onClick:()=>F(e.row.original),children:e.getValue()?"".concat(e.getValue().slice(0,7),"..."):"-"})})})},{header:"Key Alias",accessorKey:"key_alias",cell:e=>e.getValue()||"-"}],U={header:"Spend (USD)",accessorKey:"spend",cell:e=>{let s=e.getValue();return s>0&&s<.01?"<$0.01":"$".concat((0,m.pw)(s,2))}},V=j?[...M,{header:"Tags",accessorKey:"tags",cell:e=>{let s=e.getValue(),t=e.row.original.api_key,r=L.has(t);if(!s||0===s.length)return"-";let i=s.sort((e,s)=>s.usage-e.usage),c=r?i:i.slice(0,2),d=s.length>2;return(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[c.map((e,s)=>(0,a.jsx)(o.Z,{title:(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Tag Name:"})," ",e.tag]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Spend:"})," ",e.usage>0&&e.usage<.01?"<$0.01":"$".concat((0,m.pw)(e.usage,2))]})]}),children:(0,a.jsxs)("span",{className:"px-2 py-1 bg-gray-100 rounded-full text-xs",children:[e.tag.slice(0,7),"..."]})},s)),d&&(0,a.jsx)("button",{onClick:()=>A(t),className:"ml-1 p-1 hover:bg-gray-200 rounded-full transition-colors",title:r?"Show fewer tags":"Show all tags",children:r?(0,a.jsx)(l.Z,{className:"h-3 w-3 text-gray-500"}):(0,a.jsx)(n.Z,{className:"h-3 w-3 text-gray-500"})})]})})}},U]:[...M,U],z=s.map(e=>({...e,display_key_alias:e.key_alias&&e.key_alias.length>10?"".concat(e.key_alias.slice(0,10),"..."):e.key_alias||"-"}));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mb-4 flex justify-between items-center",children:[(0,a.jsx)(d.Z,{options:[{label:"5",value:5},{label:"10",value:10},{label:"25",value:25},{label:"50",value:50}],value:f,onChange:e=>_(e)}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>D("table"),className:"px-3 py-1 text-sm rounded-md ".concat("table"===T?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Table View"}),(0,a.jsx)("button",{onClick:()=>D("chart"),className:"px-3 py-1 text-sm rounded-md ".concat("chart"===T?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Chart View"})]})]}),"chart"===T?(0,a.jsx)("div",{className:"relative max-h-[600px] overflow-y-auto",children:(0,a.jsx)(i.Z,{className:"mt-4 cursor-pointer hover:opacity-90",style:{height:52*Math.min(z.length,f)},data:z,index:"display_key_alias",categories:["spend"],colors:["cyan"],yAxisWidth:120,tickGap:5,layout:"vertical",showLegend:!1,valueFormatter:e=>"$".concat((0,m.pw)(e,2)),onValueChange:e=>F(e),showTooltip:!0,customTooltip:e=>{var s,t;let r=null===(t=e.payload)||void 0===t?void 0:null===(s=t[0])||void 0===s?void 0:s.payload;return(0,a.jsx)("div",{className:"relative z-50 p-3 bg-black/90 shadow-lg rounded-lg text-white max-w-xs",children:(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Key Alias: "}),(0,a.jsx)("span",{className:"font-mono text-gray-100 break-all",children:null==r?void 0:r.key_alias})]}),(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Key ID: "}),(0,a.jsx)("span",{className:"font-mono text-gray-100 break-all",children:null==r?void 0:r.api_key})]}),(0,a.jsxs)("div",{className:"text-sm",children:[(0,a.jsx)("span",{className:"text-gray-300",children:"Spend: "}),(0,a.jsxs)("span",{className:"text-white font-medium",children:["$",(0,m.pw)(null==r?void 0:r.spend,2)]})]})]})})}})}):(0,a.jsx)("div",{className:"border rounded-lg overflow-hidden max-h-[600px] overflow-y-auto",children:(0,a.jsx)(g.w,{columns:V,data:s,renderSubComponent:()=>(0,a.jsx)(a.Fragment,{}),getRowCanExpand:()=>!1,isLoading:!1})}),Z&&w&&S&&(console.log("Rendering modal with:",{isModalOpen:Z,selectedKey:w,keyData:S}),(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onClick:e=>{e.target===e.currentTarget&&O()},children:(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-xl relative w-11/12 max-w-6xl max-h-[90vh] overflow-y-auto min-h-[750px]",children:[(0,a.jsx)("button",{onClick:O,className:"absolute top-4 right-4 text-gray-500 hover:text-gray-700 focus:outline-none","aria-label":"Close",children:(0,a.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 18L18 6M6 6l12 12"})})}),(0,a.jsx)("div",{className:"p-6 h-full",children:(0,a.jsx)(p.Z,{keyId:w,onClose:O,keyData:S,teams:t})})]})}))]})}},90292:function(e,s,t){t.d(s,{Z:function(){return e9}});var a=t(57437),r=t(40278),l=t(12514),n=t(49804),i=t(14042),c=t(67101),o=t(12485),d=t(18135),u=t(35242),m=t(29706),x=t(77991),h=t(21626),p=t(97214),g=t(28241),j=t(58834),f=t(69552),_=t(71876),y=t(84264),v=t(96761),k=t(10968),b=t(51653),Z=t(2265),N=t(19250),w=t(11713),q=t(90246),S=t(20347),C=t(80443);let T=(0,q.n)("agents"),D=()=>{let{accessToken:e,userRole:s}=(0,C.Z)();return(0,w.a)({queryKey:T.list({}),queryFn:async()=>await (0,N.getAgentsList)(e),enabled:!!e&&S.ZL.includes(s||"")})},L=(0,q.n)("customers"),E=()=>{let{accessToken:e,userRole:s}=(0,C.Z)();return(0,w.a)({queryKey:L.list({}),queryFn:async()=>await (0,N.allEndUsersCall)(e),enabled:!!e&&S.ZL.includes(s)})};var A=t(76134),F=t(59872),O=t(16312),M=t(29299),U=t(75105),V=t(44851);let z={blue:"#3b82f6",cyan:"#06b6d4",indigo:"#6366f1",green:"#22c55e",red:"#ef4444",purple:"#8b5cf6",emerald:"#37bc7d"},R=e=>{let{active:s,payload:t,label:r}=e;if(s&&t&&t.length){let e=e=>e.replace("metrics.","").replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),s=(e,s)=>{let t=s.substring(s.indexOf(".")+1);if(e.metrics&&t in e.metrics)return e.metrics[t]};return(0,a.jsxs)("div",{className:"w-56 rounded-tremor-default border border-tremor-border bg-tremor-background p-2 text-tremor-default shadow-tremor-dropdown",children:[(0,a.jsx)("p",{className:"text-tremor-content-strong",children:r}),t.map(t=>{var r;let l=null===(r=t.dataKey)||void 0===r?void 0:r.toString();if(!l||!t.payload)return null;let n=s(t.payload,l),i=l.includes("spend"),c=void 0!==n?i?"$".concat(n.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})):n.toLocaleString():"N/A",o=z[t.color]||t.color;return(0,a.jsxs)("div",{className:"flex items-center justify-between space-x-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full ring-2 ring-white drop-shadow-md",style:{backgroundColor:o}}),(0,a.jsx)("p",{className:"font-medium text-tremor-content dark:text-dark-tremor-content",children:e(l)})]}),(0,a.jsx)("p",{className:"font-medium text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",children:c})]},l)})]})}return null},I=e=>{let{categories:s,colors:t}=e,r=e=>e.replace("metrics.","").replace(/_/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");return(0,a.jsx)("div",{className:"flex items-center justify-end space-x-4",children:s.map((e,s)=>{let l=z[t[s]]||t[s];return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full ring-4 ring-white",style:{backgroundColor:l}}),(0,a.jsx)("p",{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:r(e)})]},e)})})};function Y(e){return e>=1e6?(e/1e6).toFixed(2)+"M":e>=1e3?e/1e3+"k":e.toString()}function K(e){return 0===e?"$0":e>=1e6?"$"+e/1e6+"M":e>=1e3?"$"+e/1e3+"k":"$"+e}let $=e=>{var s,t;let{modelName:n,metrics:i,hidePromptCachingMetrics:o=!1}=e;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Requests"}),(0,a.jsx)(v.Z,{children:i.total_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Successful Requests"}),(0,a.jsx)(v.Z,{children:i.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Tokens"}),(0,a.jsx)(v.Z,{children:i.total_tokens.toLocaleString()}),(0,a.jsxs)(y.Z,{children:[Math.round(i.total_tokens/i.total_successful_requests)," avg per successful request"]})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Spend"}),(0,a.jsxs)(v.Z,{children:["$",(0,F.pw)(i.total_spend,2)]}),(0,a.jsxs)(y.Z,{children:["$",(0,F.pw)(i.total_spend/i.total_successful_requests,3)," per successful request"]})]})]}),i.top_api_keys&&i.top_api_keys.length>0&&(0,a.jsxs)(l.Z,{className:"mt-4",children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys by Spend"}),(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)("div",{className:"grid grid-cols-1 gap-2",children:i.top_api_keys.map((e,s)=>(0,a.jsxs)("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-lg",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"font-medium",children:e.key_alias||"".concat(e.api_key.substring(0,10),"...")}),e.team_id&&(0,a.jsxs)(y.Z,{className:"text-xs text-gray-500",children:["Team: ",e.team_id]})]}),(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsxs)(y.Z,{className:"font-medium",children:["$",(0,F.pw)(e.spend,2)]}),(0,a.jsxs)(y.Z,{className:"text-xs text-gray-500",children:[e.requests.toLocaleString()," requests | ",e.tokens.toLocaleString()," tokens"]})]})]},e.api_key))})})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(I,{categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"],valueFormatter:Y,customTooltip:R,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Requests per day"}),(0,a.jsx)(I,{categories:["metrics.api_requests"],colors:["blue"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.api_requests"],colors:["blue"],valueFormatter:Y,customTooltip:R,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Spend per day"}),(0,a.jsx)(I,{categories:["metrics.spend"],colors:["green"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.spend"],colors:["green"],valueFormatter:e=>"$".concat((0,F.pw)(e,2,!0)),yAxisWidth:72})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Success vs Failed Requests"}),(0,a.jsx)(I,{categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"],valueFormatter:Y,stack:!0,customTooltip:R,showLegend:!1})]}),!o&&(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Prompt Caching Metrics"}),(0,a.jsx)(I,{categories:["metrics.cache_read_input_tokens","metrics.cache_creation_input_tokens"],colors:["cyan","purple"]})]}),(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsxs)(y.Z,{children:["Cache Read: ",(null===(s=i.total_cache_read_input_tokens)||void 0===s?void 0:s.toLocaleString())||0," tokens"]}),(0,a.jsxs)(y.Z,{children:["Cache Creation: ",(null===(t=i.total_cache_creation_input_tokens)||void 0===t?void 0:t.toLocaleString())||0," tokens"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i.daily_data,index:"date",categories:["metrics.cache_read_input_tokens","metrics.cache_creation_input_tokens"],colors:["cyan","purple"],valueFormatter:Y,customTooltip:R,showLegend:!1})]})]})]})},P=e=>{let{modelMetrics:s,hidePromptCachingMetrics:t=!1}=e,r=Object.keys(s).sort((e,t)=>""===e?1:""===t?-1:s[t].total_spend-s[e].total_spend),n={total_requests:0,total_successful_requests:0,total_tokens:0,total_spend:0,total_cache_read_input_tokens:0,total_cache_creation_input_tokens:0,daily_data:{}};Object.values(s).forEach(e=>{n.total_requests+=e.total_requests,n.total_successful_requests+=e.total_successful_requests,n.total_tokens+=e.total_tokens,n.total_spend+=e.total_spend,n.total_cache_read_input_tokens+=e.total_cache_read_input_tokens||0,n.total_cache_creation_input_tokens+=e.total_cache_creation_input_tokens||0,e.daily_data.forEach(e=>{n.daily_data[e.date]||(n.daily_data[e.date]={prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,spend:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0}),n.daily_data[e.date].prompt_tokens+=e.metrics.prompt_tokens,n.daily_data[e.date].completion_tokens+=e.metrics.completion_tokens,n.daily_data[e.date].total_tokens+=e.metrics.total_tokens,n.daily_data[e.date].api_requests+=e.metrics.api_requests,n.daily_data[e.date].spend+=e.metrics.spend,n.daily_data[e.date].successful_requests+=e.metrics.successful_requests,n.daily_data[e.date].failed_requests+=e.metrics.failed_requests,n.daily_data[e.date].cache_read_input_tokens+=e.metrics.cache_read_input_tokens||0,n.daily_data[e.date].cache_creation_input_tokens+=e.metrics.cache_creation_input_tokens||0})});let i=Object.entries(n.daily_data).map(e=>{let[s,t]=e;return{date:s,metrics:t}}).sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime());return(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsxs)("div",{className:"border rounded-lg p-4",children:[(0,a.jsx)(v.Z,{children:"Overall Usage"}),(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4 mb-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Requests"}),(0,a.jsx)(v.Z,{children:n.total_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Successful Requests"}),(0,a.jsx)(v.Z,{children:n.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Tokens"}),(0,a.jsx)(v.Z,{children:n.total_tokens.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(y.Z,{children:"Total Spend"}),(0,a.jsxs)(v.Z,{children:["$",(0,F.pw)(n.total_spend,2)]})]})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Total Tokens Over Time"}),(0,a.jsx)(I,{categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i,index:"date",categories:["metrics.prompt_tokens","metrics.completion_tokens","metrics.total_tokens"],colors:["blue","cyan","indigo"],valueFormatter:Y,customTooltip:R,showLegend:!1})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Total Requests Over Time"}),(0,a.jsx)(I,{categories:["metrics.successful_requests","metrics.failed_requests"],colors:["emerald","red"]})]}),(0,a.jsx)(U.Z,{className:"mt-4",data:i,index:"date",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["emerald","red"],valueFormatter:e=>e.toLocaleString(),customTooltip:R,showLegend:!1})]})]})]}),(0,a.jsx)(V.default,{defaultActiveKey:r[0],children:r.map(e=>(0,a.jsx)(V.default.Panel,{header:(0,a.jsxs)("div",{className:"flex justify-between items-center w-full",children:[(0,a.jsx)(v.Z,{children:s[e].label||"Unknown Item"}),(0,a.jsxs)("div",{className:"flex space-x-4 text-sm text-gray-500",children:[(0,a.jsxs)("span",{children:["$",(0,F.pw)(s[e].total_spend,2)]}),(0,a.jsxs)("span",{children:[s[e].total_requests.toLocaleString()," requests"]})]})]}),children:(0,a.jsx)($,{modelName:e||"Unknown Model",metrics:s[e],hidePromptCachingMetrics:t})},e))})]})},W=(e,s,t)=>{let a=e.metadata.key_alias||"key-hash-".concat(s),r=e.metadata.team_id;if(r){let e=(0,M.o)(r,t);return e?"".concat(a," (team: ").concat(e,")"):"".concat(a," (team_id: ").concat(r,")")}return a},B=function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a={};return e.results.forEach(e=>{Object.entries(e.breakdown[s]||{}).forEach(r=>{let[l,n]=r;a[l]||(a[l]={label:"api_keys"===s?W(n,l,t):l,total_requests:0,total_successful_requests:0,total_failed_requests:0,total_tokens:0,prompt_tokens:0,completion_tokens:0,total_spend:0,total_cache_read_input_tokens:0,total_cache_creation_input_tokens:0,top_api_keys:[],daily_data:[]}),a[l].total_requests+=n.metrics.api_requests,a[l].prompt_tokens+=n.metrics.prompt_tokens,a[l].completion_tokens+=n.metrics.completion_tokens,a[l].total_tokens+=n.metrics.total_tokens,a[l].total_spend+=n.metrics.spend,a[l].total_successful_requests+=n.metrics.successful_requests,a[l].total_failed_requests+=n.metrics.failed_requests,a[l].total_cache_read_input_tokens+=n.metrics.cache_read_input_tokens||0,a[l].total_cache_creation_input_tokens+=n.metrics.cache_creation_input_tokens||0,a[l].daily_data.push({date:e.date,metrics:{prompt_tokens:n.metrics.prompt_tokens,completion_tokens:n.metrics.completion_tokens,total_tokens:n.metrics.total_tokens,api_requests:n.metrics.api_requests,spend:n.metrics.spend,successful_requests:n.metrics.successful_requests,failed_requests:n.metrics.failed_requests,cache_read_input_tokens:n.metrics.cache_read_input_tokens||0,cache_creation_input_tokens:n.metrics.cache_creation_input_tokens||0}})})}),"api_keys"!==s&&Object.entries(a).forEach(t=>{let[r,l]=t,n={};e.results.forEach(e=>{var t;let a=null===(t=e.breakdown[s])||void 0===t?void 0:t[r];a&&"api_key_breakdown"in a&&Object.entries(a.api_key_breakdown||{}).forEach(e=>{let[s,t]=e;n[s]||(n[s]={api_key:s,key_alias:t.metadata.key_alias,team_id:t.metadata.team_id,spend:0,requests:0,tokens:0}),n[s].spend+=t.metrics.spend,n[s].requests+=t.metrics.api_requests,n[s].tokens+=t.metrics.total_tokens})}),a[r].top_api_keys=Object.values(n).sort((e,s)=>s.spend-e.spend).slice(0,5)}),Object.values(a).forEach(e=>{e.daily_data.sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime())}),a};var H=t(78489),G=t(94789),J=t(49566),Q=t(10032),X=t(22116),ee=t(37592),es=t(10353),et=t(9114),ea=e=>{let{isOpen:s,onClose:t,accessToken:r}=e,[l]=Q.Z.useForm(),[n,i]=(0,Z.useState)(!1),[c,o]=(0,Z.useState)(null),[d,u]=(0,Z.useState)(!1),[m,x]=(0,Z.useState)("cloudzero"),[h,p]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{s&&r&&g()},[s,r]);let g=async()=>{u(!0);try{let e=await fetch("/cloudzero/settings",{method:"GET",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"}});if(e.ok){let s=await e.json();o(s),l.setFieldsValue({connection_id:s.connection_id})}else if(404!==e.status){let s=await e.json();et.Z.fromBackend("Failed to load existing settings: ".concat(s.error||"Unknown error"))}}catch(e){console.error("Error loading CloudZero settings:",e),et.Z.fromBackend("Failed to load existing settings")}finally{u(!1)}},j=async e=>{if(!r){et.Z.fromBackend("No access token available");return}i(!0);try{let s={...e,timezone:"UTC"},t=await fetch(c?"/cloudzero/settings":"/cloudzero/init",{method:c?"PUT":"POST",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"},body:JSON.stringify(s)}),a=await t.json();if(t.ok)return et.Z.success(a.message||"CloudZero settings saved successfully"),o({api_key_masked:e.api_key.substring(0,4)+"****"+e.api_key.slice(-4),connection_id:e.connection_id,status:"configured"}),!0;return et.Z.fromBackend(a.error||"Failed to save CloudZero settings"),!1}catch(e){return console.error("Error saving CloudZero settings:",e),et.Z.fromBackend("Failed to save CloudZero settings"),!1}finally{i(!1)}},f=async()=>{if(!r){et.Z.fromBackend("No access token available");return}p(!0);try{let e=await fetch("/cloudzero/export",{method:"POST",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"},body:JSON.stringify({limit:1e5,operation:"replace_hourly"})}),s=await e.json();e.ok?(et.Z.success(s.message||"Export to CloudZero completed successfully"),t()):et.Z.fromBackend(s.error||"Failed to export to CloudZero")}catch(e){console.error("Error exporting to CloudZero:",e),et.Z.fromBackend("Failed to export to CloudZero")}finally{p(!1)}},_=async()=>{p(!0);try{et.Z.info("CSV export functionality coming soon!"),t()}catch(e){console.error("Error exporting CSV:",e),et.Z.fromBackend("Failed to export CSV")}finally{p(!1)}},v=async()=>{if("cloudzero"===m){if(!c){let e=await l.validateFields();if(!await j(e))return}await f()}else await _()},k=()=>{l.resetFields(),x("cloudzero"),o(null),t()},b=[{value:"cloudzero",label:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("img",{src:"/cloudzero.png",alt:"CloudZero",className:"w-5 h-5",onError:e=>{e.target.style.display="none"}}),(0,a.jsx)("span",{children:"Export to CloudZero"})]})},{value:"csv",label:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.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,a.jsx)("span",{children:"Export to CSV"})]})}];return(0,a.jsx)(X.Z,{title:"Export Data",open:s,onCancel:k,footer:null,width:600,destroyOnClose:!0,children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"font-medium mb-2 block",children:"Export Destination"}),(0,a.jsx)(ee.default,{value:m,onChange:x,options:b,className:"w-full",size:"large"})]}),"cloudzero"===m&&(0,a.jsx)("div",{children:d?(0,a.jsx)("div",{className:"flex justify-center py-8",children:(0,a.jsx)(es.Z,{size:"large"})}):(0,a.jsxs)(a.Fragment,{children:[c&&(0,a.jsx)(G.Z,{title:"Existing CloudZero Configuration",icon:()=>(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.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"})}),color:"green",className:"mb-4",children:(0,a.jsxs)(y.Z,{children:["API Key: ",c.api_key_masked,(0,a.jsx)("br",{}),"Connection ID: ",c.connection_id]})}),!c&&(0,a.jsxs)(Q.Z,{form:l,layout:"vertical",children:[(0,a.jsx)(Q.Z.Item,{label:"CloudZero API Key",name:"api_key",rules:[{required:!0,message:"Please enter your CloudZero API key"}],children:(0,a.jsx)(J.Z,{type:"password",placeholder:"Enter your CloudZero API key"})}),(0,a.jsx)(Q.Z.Item,{label:"Connection ID",name:"connection_id",rules:[{required:!0,message:"Please enter the CloudZero connection ID"}],children:(0,a.jsx)(J.Z,{placeholder:"Enter CloudZero connection ID"})})]})]})}),"csv"===m&&(0,a.jsx)(G.Z,{title:"CSV Export",icon:()=>(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})}),color:"blue",children:(0,a.jsx)(y.Z,{children:"Export your usage data as a CSV file for analysis in spreadsheet applications."})}),(0,a.jsxs)("div",{className:"flex justify-end space-x-2 pt-4",children:[(0,a.jsx)(H.Z,{variant:"secondary",onClick:k,children:"Cancel"}),(0,a.jsx)(H.Z,{onClick:v,loading:n||h,disabled:n||h,children:"cloudzero"===m?"Export to CloudZero":"Export CSV"})]})]})})},er=t(47359),el=t(50337),en=t(5545),ei=e=>{let{value:s,onChange:t}=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 block mb-2",children:"Format"}),(0,a.jsx)(ee.default,{value:s,onChange:t,className:"w-full",options:[{value:"csv",label:"CSV (Excel, Google Sheets)"},{value:"json",label:"JSON (includes metadata)"}]})]})},ec=e=>{var s,t;let{dateRange:r,selectedFilters:l}=e;return(0,a.jsxs)("div",{className:"text-sm text-gray-500",children:[null===(s=r.from)||void 0===s?void 0:s.toLocaleDateString()," - ",null===(t=r.to)||void 0===t?void 0:t.toLocaleDateString(),l.length>0&&" \xb7 ".concat(l.length," filter").concat(l.length>1?"s":"")]})},eo=t(29967),ed=e=>{let{value:s,onChange:t,entityType:r}=e;return(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 block mb-2",children:"Export type"}),(0,a.jsx)(eo.ZP.Group,{value:s,onChange:e=>t(e.target.value),className:"w-full",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"flex items-start p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors",children:[(0,a.jsx)(eo.ZP,{value:"daily",className:"mt-0.5"}),(0,a.jsxs)("div",{className:"ml-3 flex-1",children:[(0,a.jsx)("div",{className:"font-medium text-sm",children:"Day-by-day breakdown"}),(0,a.jsxs)("div",{className:"text-xs text-gray-500 mt-0.5",children:["Daily metrics for each ",r]})]})]}),(0,a.jsxs)("label",{className:"flex items-start p-3 border border-gray-200 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors",children:[(0,a.jsx)(eo.ZP,{value:"daily_with_models",className:"mt-0.5"}),(0,a.jsxs)("div",{className:"ml-3 flex-1",children:[(0,a.jsxs)("div",{className:"font-medium text-sm",children:["Day-by-day by ",r," and model"]}),(0,a.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:"Daily metrics split by model"})]})]})]})})]})},eu=t(15452),em=t.n(eu);let ex=e=>{if(!e)return null;for(let t of Object.values(e)){var s;let e=null==t?void 0:null===(s=t.metadata)||void 0===s?void 0:s.team_id;if(e)return e}return null},eh=function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=[];return e.results.forEach(e=>{Object.entries(e.breakdown.entities||{}).forEach(r=>{let[l,n]=r,i=ex(n.api_key_breakdown),c=i&&t[i]||null;a.push({Date:e.date,[s]:c||"-",["".concat(s," ID")]:i||"-","Spend ($)":(0,F.pw)(n.metrics.spend,4),Requests:n.metrics.api_requests,"Successful Requests":n.metrics.successful_requests,"Failed Requests":n.metrics.failed_requests,"Total Tokens":n.metrics.total_tokens,"Prompt Tokens":n.metrics.prompt_tokens||0,"Completion Tokens":n.metrics.completion_tokens||0})})}),a.sort((e,s)=>new Date(e.Date).getTime()-new Date(s.Date).getTime())},ep=function(e,s){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=[];return e.results.forEach(e=>{let r={};Object.entries(e.breakdown.entities||{}).forEach(s=>{let[t,a]=s;r[t]||(r[t]={}),Object.entries(e.breakdown.models||{}).forEach(e=>{let[s,l]=e;Object.entries(a.api_key_breakdown||{}).forEach(e=>{let[a,l]=e;r[t][s]||(r[t][s]={spend:0,requests:0,successful:0,failed:0,tokens:0}),r[t][s].spend+=l.metrics.spend||0,r[t][s].requests+=l.metrics.api_requests||0,r[t][s].successful+=l.metrics.successful_requests||0,r[t][s].failed+=l.metrics.failed_requests||0,r[t][s].tokens+=l.metrics.total_tokens||0})})}),Object.entries(r).forEach(r=>{var l;let[n,i]=r,c=null===(l=e.breakdown.entities)||void 0===l?void 0:l[n],o=ex(null==c?void 0:c.api_key_breakdown),d=o&&t[o]||null;Object.entries(i).forEach(t=>{let[r,l]=t;a.push({Date:e.date,[s]:d||"-",["".concat(s," ID")]:o||"-",Model:r,"Spend ($)":(0,F.pw)(l.spend,4),Requests:l.requests,Successful:l.successful,Failed:l.failed,"Total Tokens":l.tokens})})})}),a.sort((e,s)=>new Date(e.Date).getTime()-new Date(s.Date).getTime())},eg=function(e,s,t){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};switch(s){case"daily":default:return eh(e,t,a);case"daily_with_models":return ep(e,t,a)}},ej=(e,s,t,a,r)=>{var l,n;return{export_date:new Date().toISOString(),entity_type:e,date_range:{from:null===(l=s.from)||void 0===l?void 0:l.toISOString(),to:null===(n=s.to)||void 0===n?void 0:n.toISOString()},filters_applied:t.length>0?t:"None",export_scope:a,summary:{total_spend:r.metadata.total_spend,total_requests:r.metadata.total_api_requests,successful_requests:r.metadata.total_successful_requests,failed_requests:r.metadata.total_failed_requests,total_tokens:r.metadata.total_tokens}}},ef=function(e,s,t,a){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},l=eg(e,s,t,r),n=new Blob([em().unparse(l)],{type:"text/csv;charset=utf-8;"}),i=window.URL.createObjectURL(n),c=document.createElement("a");c.href=i;let o="".concat(a,"_usage_").concat(s,"_").concat(new Date().toISOString().split("T")[0],".csv");c.download=o,document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(i)},e_=function(e,s,t,a,r,l){let n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},i=eg(e,s,t,n),c=new Blob([JSON.stringify({metadata:ej(a,r,l,s,e),data:i},null,2)],{type:"application/json"}),o=window.URL.createObjectURL(c),d=document.createElement("a");d.href=o;let u="".concat(a,"_usage_").concat(s,"_").concat(new Date().toISOString().split("T")[0],".json");d.download=u,document.body.appendChild(d),d.click(),document.body.removeChild(d),window.URL.revokeObjectURL(o)};var ey=e=>{let{isOpen:s,onClose:t,entityType:r,spendData:l,dateRange:n,selectedFilters:i,customTitle:c}=e,[o,d]=(0,Z.useState)("csv"),[u,m]=(0,Z.useState)("daily"),[x,h]=(0,Z.useState)(!1),{data:p,isLoading:g}=(0,er.y2)(),j=r.charAt(0).toUpperCase()+r.slice(1),f=c||"Export ".concat(j," Usage"),_=(0,Z.useMemo)(()=>(0,M.O)(p),[p]),y=async e=>{let s=e||o;h(!0);try{"csv"===s?(ef(l,u,j,r,_),et.Z.success("".concat(j," usage data exported successfully as CSV"))):(e_(l,u,j,r,n,i,_),et.Z.success("".concat(j," usage data exported successfully as JSON"))),t()}catch(e){console.error("Error exporting data:",e),et.Z.fromBackend("Failed to export data")}finally{h(!1)}};return(0,a.jsx)(X.Z,{title:(0,a.jsx)("span",{className:"text-base font-semibold",children:f}),open:s,onCancel:t,footer:null,width:480,children:(0,a.jsxs)("div",{className:"space-y-5 py-2",children:[g?(0,a.jsx)(el.Z,{active:!0}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ec,{dateRange:n,selectedFilters:i}),(0,a.jsx)(ed,{value:u,onChange:m,entityType:r}),(0,a.jsx)(ei,{value:o,onChange:d})]}),g?(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-4 border-t",children:[(0,a.jsx)(el.Z.Button,{active:!0}),(0,a.jsx)(el.Z.Button,{active:!0})]}):(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-4 border-t",children:[(0,a.jsx)(en.ZP,{variant:"outlined",onClick:t,disabled:x,children:"Cancel"}),(0,a.jsx)(en.ZP,{onClick:()=>y(),loading:x||g,disabled:x||g,type:"primary",children:x?"Exporting...":"Export ".concat(o.toUpperCase())})]})]})})},ev=t(19431),ek=e=>{let{dateValue:s,entityType:t,spendData:r,showFilters:l=!1,filterLabel:n,filterPlaceholder:i,selectedFilters:c=[],onFiltersChange:o,filterOptions:d=[],customTitle:u,compactLayout:m=!1,teams:x=[]}=e,[h,p]=(0,Z.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsxs)("div",{className:"grid ".concat(l&&d.length>0?"grid-cols-[1fr_auto]":"grid-cols-[auto]"," items-end gap-4"),children:[l&&d.length>0&&(0,a.jsxs)("div",{children:[n&&(0,a.jsx)(ev.x,{className:"mb-2",children:n}),(0,a.jsx)(ee.default,{mode:"multiple",style:{width:"100%"},placeholder:i,value:c,onChange:o,options:d,allowClear:!0})]}),(0,a.jsx)("div",{className:"justify-self-end",children:(0,a.jsx)(ev.z,{onClick:()=>p(!0),icon:()=>(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),children:"Export Data"})})]})}),(0,a.jsx)(ey,{isOpen:h,onClose:()=>p(!1),entityType:t,spendData:r,dateRange:s,selectedFilters:c,customTitle:u,teams:x})]})},eb=t(42673),eZ=t(5540),eN=t(49634),ew=t(77398),eq=t.n(ew);let eS=[{label:"Today",shortLabel:"today",getValue:()=>({from:eq()().startOf("day").toDate(),to:eq()().endOf("day").toDate()})},{label:"Last 7 days",shortLabel:"7d",getValue:()=>({from:eq()().subtract(7,"days").startOf("day").toDate(),to:eq()().endOf("day").toDate()})},{label:"Last 30 days",shortLabel:"30d",getValue:()=>({from:eq()().subtract(30,"days").startOf("day").toDate(),to:eq()().endOf("day").toDate()})},{label:"Month to date",shortLabel:"MTD",getValue:()=>({from:eq()().startOf("month").toDate(),to:eq()().endOf("day").toDate()})},{label:"Year to date",shortLabel:"YTD",getValue:()=>({from:eq()().startOf("year").toDate(),to:eq()().endOf("day").toDate()})}];var eC=e=>{let{value:s,onValueChange:t,label:r="Select Time Range",showTimeRange:l=!0}=e,[n,i]=(0,Z.useState)(!1),[c,o]=(0,Z.useState)(s),[d,u]=(0,Z.useState)(null),[m,x]=(0,Z.useState)(""),[h,p]=(0,Z.useState)(""),g=(0,Z.useRef)(null),j=(0,Z.useCallback)(e=>{if(!e.from||!e.to)return null;for(let s of eS){let t=s.getValue(),a=eq()(e.from).isSame(eq()(t.from),"day"),r=eq()(e.to).isSame(eq()(t.to),"day");if(a&&r)return s.shortLabel}return null},[]);(0,Z.useEffect)(()=>{u(j(s))},[s,j]);let f=(0,Z.useCallback)(()=>{if(!m||!h)return{isValid:!0,error:""};let e=eq()(m,"YYYY-MM-DD"),s=eq()(h,"YYYY-MM-DD");return e.isValid()&&s.isValid()?s.isBefore(e)?{isValid:!1,error:"End date cannot be before start date"}:{isValid:!0,error:""}:{isValid:!1,error:"Invalid date format"}},[m,h])();(0,Z.useEffect)(()=>{s.from&&x(eq()(s.from).format("YYYY-MM-DD")),s.to&&p(eq()(s.to).format("YYYY-MM-DD")),o(s)},[s]),(0,Z.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&i(!1)};return n&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[n]);let _=(0,Z.useCallback)((e,s)=>{if(!e||!s)return"Select date range";let t=e=>eq()(e).format("D MMM, HH:mm");return"".concat(t(e)," - ").concat(t(s))},[]),y=(0,Z.useCallback)(e=>{let s;if(!e.from)return e;let t={...e},a=new Date(e.from);return s=new Date(e.to?e.to:e.from),a.toDateString(),s.toDateString(),a.setHours(0,0,0,0),s.setHours(23,59,59,999),t.from=a,t.to=s,t},[]),v=e=>{let{from:s,to:t}=e.getValue();o({from:s,to:t}),u(e.shortLabel),x(eq()(s).format("YYYY-MM-DD")),p(eq()(t).format("YYYY-MM-DD"))},k=(0,Z.useCallback)(()=>{try{if(m&&h&&f.isValid){let e=eq()(m,"YYYY-MM-DD").startOf("day"),s=eq()(h,"YYYY-MM-DD").endOf("day");if(e.isValid()&&s.isValid()){let t={from:e.toDate(),to:s.toDate()};o(t);let a=j(t);u(a)}}}catch(e){console.warn("Invalid date format:",e)}},[m,h,f.isValid,j]);return(0,Z.useEffect)(()=>{k()},[k]),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[r&&(0,a.jsx)(ev.x,{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:r}),(0,a.jsxs)("div",{className:"relative",ref:g,children:[(0,a.jsx)("div",{className:"w-[300px] px-3 py-2 text-sm border border-gray-300 rounded-md bg-white cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500",onClick:()=>i(!n),children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(eZ.Z,{className:"text-gray-600"}),(0,a.jsx)("span",{className:"text-gray-900",children:_(s.from,s.to)})]}),(0,a.jsx)("svg",{className:"w-4 h-4 text-gray-400 transition-transform ".concat(n?"rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}),n&&(0,a.jsx)("div",{className:"absolute top-full right-0 z-[9999] min-w-[600px] mt-1 bg-white border border-gray-200 rounded-lg shadow-xl",children:(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsxs)("div",{className:"w-1/2 border-r border-gray-200",children:[(0,a.jsx)("div",{className:"p-3 border-b border-gray-200",children:(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:"Relative time"})}),(0,a.jsx)("div",{className:"h-[350px] overflow-y-auto",children:eS.map(e=>{let s=d===e.shortLabel;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 cursor-pointer border-b border-gray-100 transition-colors ".concat(s?"bg-blue-50 hover:bg-blue-100 border-blue-200":"hover:bg-gray-50"),onClick:()=>v(e),children:[(0,a.jsx)("span",{className:"text-sm ".concat(s?"text-blue-700 font-medium":"text-gray-700"),children:e.label}),(0,a.jsx)("span",{className:"text-xs px-2 py-1 rounded capitalize ".concat(s?"text-blue-700 bg-blue-100":"text-gray-500 bg-gray-100"),children:e.shortLabel})]},e.label)})})]}),(0,a.jsxs)("div",{className:"w-1/2 relative",children:[(0,a.jsx)("div",{className:"p-3.5 border-b border-gray-200",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(eN.Z,{className:"text-gray-600"}),(0,a.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:"Start and end dates"})]})}),(0,a.jsxs)("div",{className:"p-6 space-y-6 pb-20",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm text-gray-700 mb-1 block",children:"Start date"}),(0,a.jsx)("input",{type:"date",value:m,onChange:e=>x(e.target.value),className:"w-65 px-3 py-2 text-sm border rounded-md cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500 ".concat(f.isValid?"border-gray-300":"border-red-300 focus:border-red-500 focus:ring-red-200")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"text-sm text-gray-700 mb-1 block",children:"End date"}),(0,a.jsx)("input",{type:"date",value:h,onChange:e=>p(e.target.value),className:"w-65 px-3 py-2 text-sm border rounded-md cursor-pointer hover:border-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500 ".concat(f.isValid?"border-gray-300":"border-red-300 focus:border-red-500 focus:ring-red-200")})]}),!f.isValid&&f.error&&(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-4 h-4 text-red-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})}),(0,a.jsx)("span",{className:"text-sm text-red-700 font-medium",children:f.error})]})}),c.from&&c.to&&f.isValid&&(0,a.jsxs)("div",{className:"bg-blue-50 p-3 rounded-md space-y-1",children:[(0,a.jsxs)("div",{className:"text-xs text-blue-800",children:[(0,a.jsx)("span",{className:"font-medium",children:"From:"})," ",eq()(c.from).format("MMM D, YYYY [at] HH:mm:ss")]}),(0,a.jsxs)("div",{className:"text-xs text-blue-800",children:[(0,a.jsx)("span",{className:"font-medium",children:"To:"})," ",eq()(c.to).format("MMM D, YYYY [at] HH:mm:ss")]})]})]}),(0,a.jsx)("div",{className:"absolute bottom-4 right-4",children:(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(ev.z,{variant:"secondary",onClick:()=>{o(s),s.from&&x(eq()(s.from).format("YYYY-MM-DD")),s.to&&p(eq()(s.to).format("YYYY-MM-DD")),u(j(s)),i(!1)},children:"Cancel"}),(0,a.jsx)(ev.z,{onClick:()=>{c.from&&c.to&&f.isValid&&(t(c),requestIdleCallback(()=>{t(y(c))},{timeout:100}),i(!1))},disabled:!c.from||!c.to||!f.isValid,children:"Apply"})]})})]})]})})]})]})},eT=t(91323);let eD=e=>{let{isDateChanging:s=!1}=e;return(0,a.jsx)("div",{className:"flex items-center justify-center h-40",children:(0,a.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,a.jsx)(eT.S,{className:"size-5"}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-gray-600 text-sm font-medium",children:s?"Processing date selection...":"Loading chart data..."}),(0,a.jsx)("span",{className:"text-gray-400 text-xs mt-1",children:s?"This will only take a moment":"Fetching your data"})]})]})})};var eL=t(35829),eE=t(97765),eA=t(99981),eF=e=>{let{accessToken:s,selectedTags:t,formatAbbreviatedNumber:l}=e,[n,i]=(0,Z.useState)({results:[],total_count:0,page:1,page_size:50,total_pages:0}),[c,k]=(0,Z.useState)(!1),[b,w]=(0,Z.useState)(1),q=async()=>{if(s){k(!0);try{let e=await (0,N.perUserAnalyticsCall)(s,b,50,t.length>0?t:void 0);i(e)}catch(e){console.error("Failed to fetch per-user data:",e)}finally{k(!1)}}};return(0,Z.useEffect)(()=>{q()},[s,t,b]),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(v.Z,{children:"Per User Usage"}),(0,a.jsx)(eE.Z,{children:"Individual developer usage metrics"}),(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"User Details"}),(0,a.jsx)(o.Z,{children:"Usage Distribution"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"User ID"}),(0,a.jsx)(f.Z,{children:"User Email"}),(0,a.jsx)(f.Z,{children:"User Agent"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Success Generations"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Total Tokens"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Failed Requests"}),(0,a.jsx)(f.Z,{className:"text-right",children:"Total Cost"})]})}),(0,a.jsx)(p.Z,{children:n.results.slice(0,10).map((e,s)=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{className:"font-medium",children:e.user_id})}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{children:e.user_email||"N/A"})}),(0,a.jsx)(g.Z,{children:(0,a.jsx)(y.Z,{children:e.user_agent||"Unknown"})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.successful_requests)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.total_tokens)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsx)(y.Z,{children:l(e.failed_requests)})}),(0,a.jsx)(g.Z,{className:"text-right",children:(0,a.jsxs)(y.Z,{children:["$",l(e.spend,4)]})})]},s))})]}),n.results.length>10&&(0,a.jsxs)("div",{className:"mt-4 flex justify-between items-center",children:[(0,a.jsxs)(y.Z,{className:"text-sm text-gray-500",children:["Showing 10 of ",n.total_count," results"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(H.Z,{size:"sm",variant:"secondary",onClick:()=>{b>1&&w(b-1)},disabled:1===b,children:"Previous"}),(0,a.jsx)(H.Z,{size:"sm",variant:"secondary",onClick:()=>{b=n.total_pages,children:"Next"})]})]})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)(v.Z,{className:"text-lg",children:"User Usage Distribution"}),(0,a.jsx)(eE.Z,{children:"Number of users by successful request frequency"})]}),(0,a.jsx)(r.Z,{data:(()=>{let e=new Map;n.results.forEach(s=>{let t=s.user_agent||"Unknown";e.set(t,(e.get(t)||0)+1)});let s=Array.from(e.entries()).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).slice(0,8).map(e=>{let[s]=e;return s}),t={"1-9 requests":{range:[1,9],agents:{}},"10-99 requests":{range:[10,99],agents:{}},"100-999 requests":{range:[100,999],agents:{}},"1K-9.9K requests":{range:[1e3,9999],agents:{}},"10K-99.9K requests":{range:[1e4,99999],agents:{}},"100K+ requests":{range:[1e5,1/0],agents:{}}};return n.results.forEach(e=>{let a=e.successful_requests,r=e.user_agent||"Unknown";s.includes(r)&&Object.entries(t).forEach(e=>{let[s,t]=e;a>=t.range[0]&&a<=t.range[1]&&(t.agents[r]||(t.agents[r]=0),t.agents[r]++)})}),Object.entries(t).map(e=>{let[t,a]=e,r={category:t};return s.forEach(e=>{r[e]=a.agents[e]||0}),r})})(),index:"category",categories:(()=>{let e=new Map;return n.results.forEach(s=>{let t=s.user_agent||"Unknown";e.set(t,(e.get(t)||0)+1)}),Array.from(e.entries()).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).slice(0,8).map(e=>{let[s]=e;return s})})(),colors:["blue","green","orange","red","purple","yellow","pink","indigo"],valueFormatter:e=>"".concat(e," users"),yAxisWidth:80,showLegend:!0,stack:!0})]})]})]})]})},eO=e=>{let{accessToken:s,userRole:t,dateValue:n,onDateChange:i}=e,[h,p]=(0,Z.useState)({results:[]}),[g,j]=(0,Z.useState)({results:[]}),[f,_]=(0,Z.useState)({results:[]}),[k,b]=(0,Z.useState)({results:[]}),[w,q]=(0,Z.useState)(""),[S,C]=(0,Z.useState)([]),[T,D]=(0,Z.useState)([]),[L,E]=(0,Z.useState)(!1),[A,F]=(0,Z.useState)(!1),[O,M]=(0,Z.useState)(!1),[U,V]=(0,Z.useState)(!1),[z,R]=(0,Z.useState)(!1),I=new Date,Y=async()=>{if(s){E(!0);try{let e=await (0,N.tagDistinctCall)(s);C(e.results.map(e=>e.tag))}catch(e){console.error("Failed to fetch available tags:",e)}finally{E(!1)}}},K=async()=>{if(s){F(!0);try{let e=await (0,N.tagDauCall)(s,I,w||void 0,T.length>0?T:void 0);p(e)}catch(e){console.error("Failed to fetch DAU data:",e)}finally{F(!1)}}},$=async()=>{if(s){M(!0);try{let e=await (0,N.tagWauCall)(s,I,w||void 0,T.length>0?T:void 0);j(e)}catch(e){console.error("Failed to fetch WAU data:",e)}finally{M(!1)}}},P=async()=>{if(s){V(!0);try{let e=await (0,N.tagMauCall)(s,I,w||void 0,T.length>0?T:void 0);_(e)}catch(e){console.error("Failed to fetch MAU data:",e)}finally{V(!1)}}},W=async()=>{if(s&&n.from&&n.to){R(!0);try{let e=await (0,N.userAgentSummaryCall)(s,n.from,n.to,T.length>0?T:void 0);b(e)}catch(e){console.error("Failed to fetch user agent summary data:",e)}finally{R(!1)}}};(0,Z.useEffect)(()=>{Y()},[s]),(0,Z.useEffect)(()=>{if(!s)return;let e=setTimeout(()=>{K(),$(),P()},50);return()=>clearTimeout(e)},[s,w,T]),(0,Z.useEffect)(()=>{if(!n.from||!n.to)return;let e=setTimeout(()=>{W()},50);return()=>clearTimeout(e)},[s,n,T]);let B=e=>e.startsWith("User-Agent: ")?e.replace("User-Agent: ",""):e,H=e=>e.length>15?e.substring(0,15)+"...":e,G=e=>Object.entries(e.reduce((e,s)=>(e[s.tag]=(e[s.tag]||0)+s.active_users,e),{})).sort((e,s)=>{let[,t]=e,[,a]=s;return a-t}).map(e=>{let[s]=e;return s}),J=G(h.results).slice(0,10),Q=G(g.results).slice(0,10),X=G(f.results).slice(0,10),es=(()=>{let e=[],s=new Date;for(let t=6;t>=0;t--){let a=new Date(s);a.setDate(a.getDate()-t);let r={date:a.toISOString().split("T")[0]};J.forEach(e=>{r[B(e)]=0}),e.push(r)}return h.results.forEach(s=>{let t=B(s.tag),a=e.find(e=>e.date===s.date);a&&(a[t]=s.active_users)}),e})(),et=(()=>{let e=[];for(let s=1;s<=7;s++){let t={week:"Week ".concat(s)};Q.forEach(e=>{t[B(e)]=0}),e.push(t)}return g.results.forEach(s=>{let t=B(s.tag),a=s.date.match(/Week (\d+)/);if(a){let r="Week ".concat(a[1]),l=e.find(e=>e.week===r);l&&(l[t]=s.active_users)}}),e})(),ea=(()=>{let e=[];for(let s=1;s<=7;s++){let t={month:"Month ".concat(s)};X.forEach(e=>{t[B(e)]=0}),e.push(t)}return f.results.forEach(s=>{let t=B(s.tag),a=s.date.match(/Month (\d+)/);if(a){let r="Month ".concat(a[1]),l=e.find(e=>e.month===r);l&&(l[t]=s.active_users)}}),e})(),er=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e>=1e8||e>=1e7||e>=1e6?(e/1e6).toFixed(s)+"M":e>=1e4?(e/1e3).toFixed(s)+"K":e>=1e3?(e/1e3).toFixed(s)+"K":e.toFixed(s)};return(0,a.jsxs)("div",{className:"space-y-6 mt-6",children:[(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex justify-between items-start",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(v.Z,{children:"Summary by User Agent"}),(0,a.jsx)(eE.Z,{children:"Performance metrics for different user agents"})]}),(0,a.jsxs)("div",{className:"w-96",children:[(0,a.jsx)(y.Z,{className:"text-sm font-medium block mb-2",children:"Filter by User Agents"}),(0,a.jsx)(ee.default,{mode:"multiple",placeholder:"All User Agents",value:T,onChange:D,style:{width:"100%"},showSearch:!0,allowClear:!0,loading:L,optionFilterProp:"label",className:"rounded-md",maxTagCount:"responsive",children:S.map(e=>{let s=B(e),t=s.length>50?"".concat(s.substring(0,50),"..."):s;return(0,a.jsx)(ee.default.Option,{value:e,label:t,title:s,children:t},e)})})]})]}),z?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsxs)(c.Z,{numItems:4,className:"gap-4",children:[(k.results||[]).slice(0,4).map((e,s)=>{let t=B(e.tag),r=H(t);return(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(eA.Z,{title:t,placement:"top",children:(0,a.jsx)(v.Z,{className:"truncate",children:r})}),(0,a.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Success Requests"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:er(e.successful_requests)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Tokens"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:er(e.total_tokens)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Cost"}),(0,a.jsxs)(eL.Z,{className:"text-lg",children:["$",er(e.total_spend,4)]})]})]})]},s)}),Array.from({length:Math.max(0,4-(k.results||[]).length)}).map((e,s)=>(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"No Data"}),(0,a.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Success Requests"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Tokens"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:"-"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(y.Z,{className:"text-sm text-gray-600",children:"Total Cost"}),(0,a.jsx)(eL.Z,{className:"text-lg",children:"-"})]})]})]},"empty-".concat(s)))]})]})}),(0,a.jsx)(l.Z,{children:(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"DAU/WAU/MAU"}),(0,a.jsx)(o.Z,{children:"Per User Usage (Last 30 Days)"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)(v.Z,{children:"DAU, WAU & MAU per Agent"}),(0,a.jsx)(eE.Z,{children:"Active users across different time periods"})]}),(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{className:"mb-6",children:[(0,a.jsx)(o.Z,{children:"DAU"}),(0,a.jsx)(o.Z,{children:"WAU"}),(0,a.jsx)(o.Z,{children:"MAU"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Daily Active Users - Last 7 Days"})}),A?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:es,index:"date",categories:J.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Weekly Active Users - Last 7 Weeks"})}),O?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:et,index:"week",categories:Q.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]}),(0,a.jsxs)(m.Z,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsx)(v.Z,{className:"text-lg",children:"Monthly Active Users - Last 7 Months"})}),U?(0,a.jsx)(eD,{isDateChanging:!1}):(0,a.jsx)(r.Z,{data:ea,index:"month",categories:X.map(B),valueFormatter:e=>er(e),yAxisWidth:60,showLegend:!0,stack:!0})]})]})]})]}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eF,{accessToken:s,selectedTags:T,formatAbbreviatedNumber:er})})]})]})})]})},eM=t(47375),eU=e=>{let{endpointData:s}=e,t=s||{},n=Z.useMemo(()=>Object.entries(t).map(e=>{let[s,t]=e;return{endpoint:s,"metrics.successful_requests":t.metrics.successful_requests,"metrics.failed_requests":t.metrics.failed_requests,metrics:{successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests}}}),[t]);return(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)(v.Z,{children:"Success vs Failed Requests by Endpoint"}),(0,a.jsx)(I,{categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"]})]}),(0,a.jsx)(r.Z,{className:"mt-4",data:n,index:"endpoint",categories:["metrics.successful_requests","metrics.failed_requests"],colors:["green","red"],valueFormatter:e=>e.toLocaleString(),customTooltip:R,showLegend:!1,stack:!0,yAxisWidth:60})]})},eV=t(59664),ez=function(e){let{dailyData:s,endpointData:t}=e,r=(0,Z.useMemo)(()=>(null==s?void 0:s.results)&&0!==s.results.length?function(e){let s=[],t=new Set;return e.forEach(e=>{e.breakdown.endpoints&&Object.keys(e.breakdown.endpoints).forEach(e=>t.add(e))}),e.forEach(e=>{let a={date:new Date(e.date).toLocaleDateString("en-US",{month:"short",day:"numeric"})};t.forEach(s=>{var t;let r=null===(t=e.breakdown.endpoints)||void 0===t?void 0:t[s];a[s]=(null==r?void 0:r.metrics.api_requests)||0}),s.push(a)}),s.reverse()}(s.results):[],[s]),n=(0,Z.useMemo)(()=>0===r.length?[]:Object.keys(r[0]).filter(e=>"date"!==e),[r]);return(0,a.jsxs)(l.Z,{className:"mb-6",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsx)(v.Z,{children:"Endpoint Usage Trends"})}),(0,a.jsx)(eV.Z,{className:"h-80",data:r,index:"date",categories:n,colors:["blue","cyan","indigo","violet","purple","fuchsia","pink","rose","red","orange"].slice(0,n.length),valueFormatter:e=>e.toLocaleString(),showLegend:!0,showGridLines:!0,yAxisWidth:60,connectNulls:!0,curveType:"natural"})]})},eR=t(68565),eI=t(56609),eY=e=>{let{endpointData:s}=e,t=(e,s)=>0===s?0:e/s*100,r=Object.entries(s).map(e=>{let[s,a]=e;return{key:s,endpoint:s,successful_requests:a.metrics.successful_requests,failed_requests:a.metrics.failed_requests,api_requests:a.metrics.api_requests,total_tokens:a.metrics.total_tokens,spend:a.metrics.spend,successRate:t(a.metrics.successful_requests,a.metrics.api_requests)}}),l=[{title:"Endpoint",dataIndex:"endpoint",key:"endpoint",render:e=>(0,a.jsx)("span",{className:"font-medium",children:e})},{title:"Successful / Failed",key:"requests",render:(e,s)=>{let t=s.api_requests>0?s.successful_requests/s.api_requests*100:0,r=s.api_requests>0?s.failed_requests/s.api_requests*100:0,l={"0%":"#22c55e"};return t>0&&t<100&&(l["".concat(t,"%")]="#22c55e",l["".concat(t+.01,"%")]="#ef4444"),l["100%"]=r>0?"#ef4444":"#22c55e",(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("div",{className:"flex-1 relative",children:(0,a.jsx)(eR.Z,{percent:t+r,size:"small",strokeColor:l,showInfo:!1})}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 text-sm min-w-[100px]",children:[(0,a.jsx)("span",{className:"text-green-600 font-medium",children:s.successful_requests.toLocaleString()}),(0,a.jsx)("span",{className:"text-gray-400",children:"/"}),(0,a.jsx)("span",{className:"text-red-600 font-medium",children:s.failed_requests.toLocaleString()})]})]})}},{title:"Total Request",dataIndex:"api_requests",key:"api_requests",render:e=>e.toLocaleString()},{title:"Success Rate",dataIndex:"successRate",key:"successRate",render:e=>{let s=e.toFixed(2);return(0,a.jsxs)("span",{className:e>=95?"text-green-600 font-medium":e>=80?"text-yellow-600 font-medium":"text-red-600 font-medium",children:[s,"%"]})}},{title:"Total Tokens",dataIndex:"total_tokens",key:"total_tokens",render:e=>e.toLocaleString()},{title:"Spend",dataIndex:"spend",key:"spend",render:e=>"$".concat((0,F.pw)(e,2))}];return(0,a.jsx)(eI.Z,{columns:l,dataSource:r,pagination:!1})},eK=e=>{let{userSpendData:s}=e,t=(0,Z.useMemo)(()=>{let e={};return(null==s?void 0:s.results)&&s.results.forEach(s=>{Object.entries(s.breakdown.endpoints||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:a.metadata||{},api_key_breakdown:{}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests||0,e[t].metrics.failed_requests+=a.metrics.failed_requests||0,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),e},[s]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(eY,{endpointData:t}),(0,a.jsx)(eU,{endpointData:t}),(0,a.jsx)(ez,{dailyData:s,endpointData:t})]})},e$=t(49282),eP=t(57589),eW=t(12322);function eB(e){let{topModels:s,topModelsLimit:t,setTopModelsLimit:l}=e,[n,i]=(0,Z.useState)("table"),c=s.slice(0,t);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mb-4 flex justify-between items-center",children:[(0,a.jsx)(k.Z,{options:[{label:"5",value:5},{label:"10",value:10},{label:"25",value:25},{label:"50",value:50}],value:t,onChange:e=>l(e)}),(0,a.jsxs)("div",{className:"flex space-x-2",children:[(0,a.jsx)("button",{onClick:()=>i("table"),className:"px-3 py-1 text-sm rounded-md ".concat("table"===n?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Table View"}),(0,a.jsx)("button",{onClick:()=>i("chart"),className:"px-3 py-1 text-sm rounded-md ".concat("chart"===n?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-700"),children:"Chart View"})]})]}),"chart"===n?(0,a.jsx)("div",{className:"relative max-h-[600px] overflow-y-auto",children:(0,a.jsx)(r.Z,{className:"mt-4 cursor-pointer hover:opacity-90",style:{height:52*Math.min(c.length,t)},data:c,index:"key",categories:["spend"],colors:["cyan"],valueFormatter:e=>"$".concat((0,F.pw)(e,2)),layout:"vertical",yAxisWidth:200,tickGap:5,showLegend:!1})}):(0,a.jsx)("div",{className:"border rounded-lg overflow-hidden max-h-[600px] overflow-y-auto",children:(0,a.jsx)(eW.w,{columns:[{header:"Model",accessorKey:"key",cell:e=>e.getValue()||"-"},{header:"Spend (USD)",accessorKey:"spend",cell:e=>{let s=e.getValue();return"$".concat((0,F.pw)(s,2))}},{header:"Successful",accessorKey:"successful_requests",cell:e=>{var s;return(0,a.jsx)("span",{className:"text-green-600",children:(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0})}},{header:"Failed",accessorKey:"failed_requests",cell:e=>{var s;return(0,a.jsx)("span",{className:"text-red-600",children:(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0})}},{header:"Tokens",accessorKey:"tokens",cell:e=>{var s;return(null===(s=e.getValue())||void 0===s?void 0:s.toLocaleString())||0}}],data:c,renderSubComponent:()=>(0,a.jsx)(a.Fragment,{}),getRowCanExpand:()=>!1,isLoading:!1})})]})}var eH=e=>{let{accessToken:s,entityType:t,entityId:k,entityList:b,dateValue:w}=e,[q,S]=(0,Z.useState)({results:[],metadata:{total_spend:0,total_api_requests:0,total_successful_requests:0,total_failed_requests:0,total_tokens:0}}),{teams:C}=(0,e$.Z)(),T=B(q,"models",C||[]),D=B(q,"api_keys",C||[]),[L,E]=(0,Z.useState)([]),[A,O]=(0,Z.useState)(5),[M,U]=(0,Z.useState)(5),V=async()=>{if(!s||!w.from||!w.to)return;let e=new Date(w.from),a=new Date(w.to);if("tag"===t)S(await (0,N.tagDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("team"===t)S(await (0,N.teamDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("organization"===t)S(await (0,N.organizationDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("customer"===t)S(await (0,N.customerDailyActivityCall)(s,e,a,1,L.length>0?L:null));else if("agent"===t)S(await (0,N.agentDailyActivityCall)(s,e,a,1,L.length>0?L:null));else throw Error("Invalid entity type")};(0,Z.useEffect)(()=>{V()},[s,w,k,L]);let z=()=>{let e={};return q.results.forEach(s=>{Object.entries(s.breakdown.providers||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={provider:t,spend:0,requests:0,successful_requests:0,failed_requests:0,tokens:0});try{e[t].spend+=a.metrics.spend,e[t].requests+=a.metrics.api_requests,e[t].successful_requests+=a.metrics.successful_requests,e[t].failed_requests+=a.metrics.failed_requests,e[t].tokens+=a.metrics.total_tokens}catch(e){console.error("Error processing provider ".concat(t,": ").concat(e))}})}),Object.values(e).filter(e=>e.spend>0).sort((e,s)=>s.spend-e.spend)},R=(e,s)=>{if(b){let s=b.find(s=>s.value===e);if(s)return s.label}return(null==s?void 0:s.team_alias)?s.team_alias:e},I=e=>0===L.length?e:e.filter(e=>L.includes(e.metadata.id)),Y=()=>{let e={};return q.results.forEach(s=>{Object.entries(s.breakdown.entities||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{alias:R(t,a.metadata),id:t}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests,e[t].metrics.failed_requests+=a.metrics.failed_requests,e[t].metrics.total_tokens+=a.metrics.total_tokens})}),I(Object.values(e).sort((e,s)=>s.metrics.spend-e.metrics.spend))},$=t.charAt(0).toUpperCase()+t.slice(1);return(0,a.jsxs)("div",{style:{width:"100%"},className:"relative",children:[(0,a.jsx)(ek,{dateValue:w,entityType:t,spendData:q,showFilters:null!==b&&b.length>0,filterLabel:"Filter by ".concat(t),filterPlaceholder:"Select ".concat(t," to filter..."),selectedFilters:L,onFiltersChange:E,filterOptions:(()=>{if(b)return b})()||void 0,teams:C||[]}),(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)(u.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(o.Z,{children:"Cost"}),(0,a.jsx)(o.Z,{children:"agent"===t?"Request / Token Consumption":"Model Activity"}),(0,a.jsx)(o.Z,{children:"Key Activity"}),(0,a.jsx)(o.Z,{children:"Endpoint Activity"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsxs)(c.Z,{numItems:2,className:"gap-2 w-full",children:[(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsxs)(v.Z,{children:[$," Spend Overview"]}),(0,a.jsxs)(c.Z,{numItems:5,className:"gap-4 mt-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Spend"}),(0,a.jsxs)(y.Z,{className:"text-2xl font-bold mt-2",children:["$",(0,F.pw)(q.metadata.total_spend,2)]})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:q.metadata.total_api_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Successful Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-green-600",children:q.metadata.total_successful_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Failed Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-red-600",children:q.metadata.total_failed_requests.toLocaleString()})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:q.metadata.total_tokens.toLocaleString()})]})]})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Daily Spend"}),(0,a.jsx)(r.Z,{data:[...q.results].sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime()),index:"date",categories:["metrics.spend"],colors:["cyan"],valueFormatter:K,yAxisWidth:100,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload,l=Object.keys(r.breakdown.entities||{}).length;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.date}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Total Spend: $",(0,F.pw)(r.metrics.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Requests: ",r.metrics.api_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Successful: ",r.metrics.successful_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Failed: ",r.metrics.failed_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Tokens: ",r.metrics.total_tokens]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total ",$,"s: ",l]}),(0,a.jsxs)("div",{className:"mt-2 border-t pt-2",children:[(0,a.jsxs)("p",{className:"font-semibold",children:["Spend by ",$,":"]}),Object.entries(r.breakdown.entities||{}).sort((e,s)=>{let[,t]=e,[,a]=s,r=t.metrics.spend;return a.metrics.spend-r}).slice(0,5).map(e=>{let[s,t]=e;return(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:[R(s,t.metadata),": $",(0,F.pw)(t.metrics.spend,2)]},s)}),l>5&&(0,a.jsxs)("p",{className:"text-sm text-gray-500 italic",children:["...and ",l-5," more"]})]})]})}})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-col space-y-2",children:[(0,a.jsxs)(v.Z,{children:["Spend Per ",$]}),(0,a.jsx)(eE.Z,{className:"text-xs",children:"Showing Top 5 by Spend"}),(0,a.jsxs)("div",{className:"flex items-center text-sm text-gray-500",children:[(0,a.jsxs)("span",{children:["Get Started by Tracking cost per ",$," "]}),(0,a.jsx)("a",{href:"https://docs.litellm.ai/docs/proxy/enterprise#spend-tracking",className:"text-blue-500 hover:text-blue-700 ml-1",children:"here"})]})]}),(0,a.jsxs)(c.Z,{numItems:2,className:"gap-6",children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(r.Z,{className:"mt-4 h-52",data:Y().slice(0,5).map(e=>({...e,metadata:{...e.metadata,alias_display:e.metadata.alias&&e.metadata.alias.length>15?"".concat(e.metadata.alias.slice(0,15),"..."):e.metadata.alias}})),index:"metadata.alias_display",categories:["metrics.spend"],colors:["cyan"],valueFormatter:K,layout:"vertical",showLegend:!1,yAxisWidth:150,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.metadata.alias}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,F.pw)(r.metrics.spend,4)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Requests: ",r.metrics.api_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-green-600",children:["Successful: ",r.metrics.successful_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-red-600",children:["Failed: ",r.metrics.failed_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.metrics.total_tokens.toLocaleString()]})]})}})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)("div",{className:"h-52 overflow-y-auto",children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:$}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:Y().filter(e=>e.metrics.spend>0).map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:e.metadata.alias}),(0,a.jsxs)(g.Z,{children:["$",(0,F.pw)(e.metrics.spend,4)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.metrics.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.metrics.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.metrics.total_tokens.toLocaleString()})]},e.metadata.id))})]})})})]})]})})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys"}),(0,a.jsx)(eP.Z,{topKeys:(()=>{console.log("debugTags",{spendData:q});let e={};return q.results.forEach(s=>{let{breakdown:t}=s,{entities:a}=t;console.log("debugTags",{entities:a});let r=Object.keys(a).reduce((e,s)=>{let{api_key_breakdown:t}=a[s];return Object.keys(t).forEach(a=>{let r={tag:s,usage:t[a].metrics.spend};e[a]?e[a].push(r):e[a]=[r]}),e},{});console.log("debugTags",{tagDictionary:r}),Object.entries(s.breakdown.api_keys||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{key_alias:a.metadata.key_alias,team_id:a.metadata.team_id||null,tags:r[t]||[]}},console.log("debugTags",{keySpend:e})),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests,e[t].metrics.failed_requests+=a.metrics.failed_requests,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(e).map(e=>{let[s,t]=e;return{api_key:s,key_alias:t.metadata.key_alias||"-",tags:t.metadata.tags||"-",spend:t.metrics.spend}}).sort((e,s)=>s.spend-e.spend).slice(0,A)})(),teams:null,showTags:"tag"===t,topKeysLimit:A,setTopKeysLimit:O})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"agent"===t?"Top Agents":"Top Models"}),(0,a.jsx)(eB,{topModels:(()=>{let e={};return q.results.forEach(s=>{Object.entries(s.breakdown.models||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={spend:0,requests:0,successful_requests:0,failed_requests:0,tokens:0});try{e[t].spend+=a.metrics.spend}catch(e){console.error("Error adding spend for ".concat(t,": ").concat(e,", got metrics: ").concat(JSON.stringify(a)))}e[t].requests+=a.metrics.api_requests,e[t].successful_requests+=a.metrics.successful_requests,e[t].failed_requests+=a.metrics.failed_requests,e[t].tokens+=a.metrics.total_tokens})}),Object.entries(e).map(e=>{let[s,t]=e;return{key:s,...t}}).sort((e,s)=>s.spend-e.spend).slice(0,M)})(),topModelsLimit:M,setTopModelsLimit:U})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,a.jsx)(v.Z,{children:"Provider Usage"}),(0,a.jsxs)(c.Z,{numItems:2,children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(i.Z,{className:"mt-4 h-40",data:z(),index:"provider",category:"spend",valueFormatter:e=>"$".concat((0,F.pw)(e,2)),colors:["cyan","blue","indigo","violet","purple"]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"Provider"}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:z().map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[e.provider&&(0,a.jsx)("img",{src:(0,eb.dr)(e.provider).logo,alt:"".concat(e.provider," logo"),className:"w-4 h-4",onError:s=>{let t=s.target,a=t.parentElement;if(a){var r;let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=(null===(r=e.provider)||void 0===r?void 0:r.charAt(0))||"-",a.replaceChild(s,t)}}}),(0,a.jsx)("span",{children:e.provider})]})}),(0,a.jsxs)(g.Z,{children:["$",(0,F.pw)(e.spend,2)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.tokens.toLocaleString()})]},e.provider))})]})})]})]})})})]})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:T,hidePromptCachingMetrics:"agent"===t})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:D,hidePromptCachingMetrics:"agent"===t})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eK,{userSpendData:q})})]})]})]})},eG=t(64739),eJ=t(37527),eQ=t(41361),eX=t(40312),e0=t(71891),e1=t(69993),e2=t(48231),e4=t(9775),e5=t(33866);let e6=[{value:"global",label:"Global Usage",showForAdmin:"Global Usage",showForNonAdmin:"Your Usage",description:"View usage across all resources",descriptionForAdmin:"View usage across all resources",descriptionForNonAdmin:"View your usage",icon:(0,a.jsx)(eG.Z,{style:{fontSize:"16px"}})},{value:"organization",label:"Organization Usage",showForAdmin:"Organization Usage",showForNonAdmin:"Your Organization Usage",description:"View organization-level usage",descriptionForAdmin:"View usage across all organizations",descriptionForNonAdmin:"View your organization's usage",icon:(0,a.jsx)(eJ.Z,{style:{fontSize:"16px"}})},{value:"team",label:"Team Usage",description:"View usage by team",icon:(0,a.jsx)(eQ.Z,{style:{fontSize:"16px"}})},{value:"customer",label:"Customer Usage",description:"View usage by customer accounts",icon:(0,a.jsx)(eX.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"tag",label:"Tag Usage",description:"View usage grouped by tags",icon:(0,a.jsx)(e0.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"agent",label:"Agent Usage (A2A)",description:"View usage by AI agents",icon:(0,a.jsx)(e1.Z,{style:{fontSize:"16px"}}),adminOnly:!0},{value:"user-agent-activity",label:"User Agent Activity",description:"View detailed user agent activity logs",icon:(0,a.jsx)(e2.Z,{style:{fontSize:"16px"}}),adminOnly:!0}],e3=e=>{let{value:s,onChange:t,isAdmin:r,title:l="Usage View",description:n="Select the usage data you want to view","data-id":i}=e,c=e6.filter(e=>!e.adminOnly||!!r).map(e=>{let s=e.label,t=e.description;return e.showForAdmin&&e.showForNonAdmin&&(s=r?e.showForAdmin:e.showForNonAdmin),e.descriptionForAdmin&&e.descriptionForNonAdmin&&(t=r?e.descriptionForAdmin:e.descriptionForNonAdmin),{value:e.value,label:s,description:t,icon:e.icon,badgeText:e.badgeText}});return(0,a.jsx)("div",{className:"w-full","data-id":i,children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-start gap-4",children:[(0,a.jsxs)("div",{className:"flex items-stretch gap-2 min-w-0",children:[(0,a.jsx)("div",{className:"flex-shrink-0 flex items-center",children:(0,a.jsx)(e4.Z,{style:{fontSize:"32px"}})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-gray-900 mb-0.5 leading-tight",children:l}),(0,a.jsx)("p",{className:"text-xs text-gray-600 leading-tight",children:n})]})]}),(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)(ee.default,{value:s,onChange:t,className:"w-54 sm:w-64 md:w-72",size:"large",options:c.map(e=>({value:e.value,label:e.label})),optionRender:e=>{let s=c.find(s=>s.value===e.value);return s?(0,a.jsxs)("div",{className:"flex items-center gap-2 py-1",children:[(0,a.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:s.icon}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"text-sm font-medium text-gray-900",children:s.label}),(0,a.jsx)("div",{className:"text-xs text-gray-600 mt-0.5",children:s.description})]}),s.badgeText&&(0,a.jsx)("div",{className:"items-center",children:(0,a.jsx)(e5.Z,{color:"blue",count:s.badgeText})})]}):e.label},labelRender:e=>{let s=c.find(s=>s.value===e.value);return s?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{children:s.icon}),(0,a.jsx)("span",{className:"text-sm",children:s.label})]}):e.label}})})]})})};var e9=e=>{var s,t,w,q,T,L,M,U,V,z,R;let{teams:I,organizations:Y}=e,{accessToken:$,userRole:W,userId:H,premiumUser:G}=(0,C.Z)(),[J,Q]=(0,Z.useState)({results:[],metadata:{}}),[X,ee]=(0,Z.useState)(!1),[es,et]=(0,Z.useState)(!1),er=(0,Z.useMemo)(()=>new Date(Date.now()-6048e5),[]),el=(0,Z.useMemo)(()=>new Date,[]),[en,ei]=(0,Z.useState)({from:er,to:el}),[ec,eo]=(0,Z.useState)([]),{data:ed=[]}=E(),{data:eu}=D(),{data:em}=(0,A.x)();console.log("currentUser: ".concat(JSON.stringify(em))),console.log("currentUser max budget: ".concat(null==em?void 0:em.max_budget));let[ex,eh]=(0,Z.useState)("groups"),[ep,eg]=(0,Z.useState)(!1),[ej,ef]=(0,Z.useState)(!1),[e_,ev]=(0,Z.useState)(!0),[ek,eZ]=(0,Z.useState)(!0),[eN,ew]=(0,Z.useState)("global"),[eq,eS]=(0,Z.useState)(!0),[eT,eL]=(0,Z.useState)(5),[eE,eA]=(0,Z.useState)(5),eF=async()=>{$&&eo(Object.values(await (0,N.tagListCall)($)).map(e=>({label:e.name,value:e.name})))};(0,Z.useEffect)(()=>{eF()},[$]);let eU=(null===(s=J.metadata)||void 0===s?void 0:s.total_spend)||0,eV=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,s={};return J.results.forEach(e=>{Object.entries(e.breakdown.models||{}).forEach(e=>{let[t,a]=e;s[t]||(s[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),s[t].metrics.spend+=a.metrics.spend,s[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,s[t].metrics.completion_tokens+=a.metrics.completion_tokens,s[t].metrics.total_tokens+=a.metrics.total_tokens,s[t].metrics.api_requests+=a.metrics.api_requests,s[t].metrics.successful_requests+=a.metrics.successful_requests||0,s[t].metrics.failed_requests+=a.metrics.failed_requests||0,s[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,s[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(s).map(e=>{let[s,t]=e;return{key:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}}).sort((e,s)=>s.spend-e.spend).slice(0,e)},ez=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,s={};return J.results.forEach(e=>{Object.entries(e.breakdown.model_groups||{}).forEach(e=>{let[t,a]=e;s[t]||(s[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),s[t].metrics.spend+=a.metrics.spend,s[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,s[t].metrics.completion_tokens+=a.metrics.completion_tokens,s[t].metrics.total_tokens+=a.metrics.total_tokens,s[t].metrics.api_requests+=a.metrics.api_requests,s[t].metrics.successful_requests+=a.metrics.successful_requests||0,s[t].metrics.failed_requests+=a.metrics.failed_requests||0,s[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,s[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(s).map(e=>{let[s,t]=e;return{key:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}}).sort((e,s)=>s.spend-e.spend).slice(0,e)},eR=()=>{let e={};return J.results.forEach(s=>{Object.entries(s.breakdown.providers||{}).forEach(s=>{let[t,a]=s;e[t]||(e[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{},api_key_breakdown:{}}),e[t].metrics.spend+=a.metrics.spend,e[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,e[t].metrics.completion_tokens+=a.metrics.completion_tokens,e[t].metrics.total_tokens+=a.metrics.total_tokens,e[t].metrics.api_requests+=a.metrics.api_requests,e[t].metrics.successful_requests+=a.metrics.successful_requests||0,e[t].metrics.failed_requests+=a.metrics.failed_requests||0,e[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,e[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),Object.entries(e).map(e=>{let[s,t]=e;return{provider:s,spend:t.metrics.spend,requests:t.metrics.api_requests,successful_requests:t.metrics.successful_requests,failed_requests:t.metrics.failed_requests,tokens:t.metrics.total_tokens}})},eI=(0,Z.useCallback)(async()=>{if(!$||!en.from||!en.to)return;ee(!0);let e=new Date(en.from),s=new Date(en.to);try{try{let t=await (0,N.userDailyActivityAggregatedCall)($,e,s);Q(t);return}catch(e){}let t=await (0,N.userDailyActivityCall)($,e,s);if(t.metadata.total_pages<=1){Q(t);return}let a=[...t.results],r={...t.metadata};for(let l=2;l<=t.metadata.total_pages;l++){let t=await (0,N.userDailyActivityCall)($,e,s,l);a.push(...t.results),t.metadata&&(r.total_spend+=t.metadata.total_spend||0,r.total_api_requests+=t.metadata.total_api_requests||0,r.total_successful_requests+=t.metadata.total_successful_requests||0,r.total_failed_requests+=t.metadata.total_failed_requests||0,r.total_tokens+=t.metadata.total_tokens||0)}Q({results:a,metadata:r})}catch(e){console.error("Error fetching user spend data:",e)}finally{ee(!1),et(!1)}},[$,en.from,en.to]),eY=(0,Z.useCallback)(e=>{et(!0),ee(!0),ei(e)},[]);(0,Z.useEffect)(()=>{if(!en.from||!en.to)return;let e=setTimeout(()=>{eI()},50);return()=>clearTimeout(e)},[eI]);let e$=B(J,"models",I),eW=B(J,"api_keys",I),eB=B(J,"mcp_servers",I);return(0,a.jsxs)("div",{style:{width:"100%"},className:"p-8 relative",children:[(0,a.jsx)("div",{className:"flex items-end justify-between gap-6 mb-6",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-end justify-between gap-6 mb-4 w-full",children:[(0,a.jsx)(e3,{value:eN,onChange:e=>ew(e),isAdmin:S.ZL.includes(W||"")}),(0,a.jsx)(eC,{value:en,onValueChange:eY})]}),"global"===eN&&(0,a.jsxs)(d.Z,{children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsxs)(u.Z,{variant:"solid",className:"mt-1",children:[(0,a.jsx)(o.Z,{children:"Cost"}),(0,a.jsx)(o.Z,{children:"Model Activity"}),(0,a.jsx)(o.Z,{children:"Key Activity"}),(0,a.jsx)(o.Z,{children:"MCP Server Activity"}),(0,a.jsx)(o.Z,{children:"Endpoint Activity"})]}),(0,a.jsx)(O.z,{onClick:()=>ef(!0),icon:()=>(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),children:"Export Data"})]}),(0,a.jsxs)(x.Z,{children:[(0,a.jsx)(m.Z,{children:(0,a.jsxs)(c.Z,{numItems:2,className:"gap-2 w-full",children:[(0,a.jsxs)(n.Z,{numColSpan:2,children:[(0,a.jsxs)(y.Z,{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content mb-2 mt-2 text-lg",children:["Project Spend"," ",en.from&&en.to&&(0,a.jsxs)(a.Fragment,{children:[en.from.toLocaleDateString("en-US",{month:"short",day:"numeric",year:en.from.getFullYear()!==en.to.getFullYear()?"numeric":void 0})," - ",en.to.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]}),(0,a.jsx)(eM.Z,{userSpend:eU,selectedTeam:null,userMaxBudget:(null==em?void 0:em.max_budget)||null})]}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Usage Metrics"}),(0,a.jsxs)(c.Z,{numItems:5,className:"gap-4 mt-4",children:[(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:(null===(w=J.metadata)||void 0===w?void 0:null===(t=w.total_api_requests)||void 0===t?void 0:t.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Successful Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-green-600",children:(null===(T=J.metadata)||void 0===T?void 0:null===(q=T.total_successful_requests)||void 0===q?void 0:q.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Failed Requests"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2 text-red-600",children:(null===(M=J.metadata)||void 0===M?void 0:null===(L=M.total_failed_requests)||void 0===L?void 0:L.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Total Tokens"}),(0,a.jsx)(y.Z,{className:"text-2xl font-bold mt-2",children:(null===(V=J.metadata)||void 0===V?void 0:null===(U=V.total_tokens)||void 0===U?void 0:U.toLocaleString())||0})]}),(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Average Cost per Request"}),(0,a.jsxs)(y.Z,{className:"text-2xl font-bold mt-2",children:["$",(0,F.pw)((eU||0)/((null===(z=J.metadata)||void 0===z?void 0:z.total_api_requests)||1),4)]})]})]})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{children:[(0,a.jsx)(v.Z,{children:"Daily Spend"}),X?(0,a.jsx)(eD,{isDateChanging:es}):(0,a.jsx)(r.Z,{data:[...J.results].sort((e,s)=>new Date(e.date).getTime()-new Date(s.date).getTime()),index:"date",categories:["metrics.spend"],colors:["cyan"],valueFormatter:K,yAxisWidth:100,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.date}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,F.pw)(r.metrics.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Requests: ",r.metrics.api_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Successful: ",r.metrics.successful_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Failed: ",r.metrics.failed_requests]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.metrics.total_tokens]})]})}})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsx)(v.Z,{children:"Top Virtual Keys"}),(0,a.jsx)(eP.Z,{topKeys:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,s={};return J.results.forEach(e=>{Object.entries(e.breakdown.api_keys||{}).forEach(e=>{let[t,a]=e;s[t]||(s[t]={metrics:{spend:0,prompt_tokens:0,completion_tokens:0,total_tokens:0,api_requests:0,successful_requests:0,failed_requests:0,cache_read_input_tokens:0,cache_creation_input_tokens:0},metadata:{key_alias:a.metadata.key_alias,team_id:null,tags:a.metadata.tags||[]}}),s[t].metrics.spend+=a.metrics.spend,s[t].metrics.prompt_tokens+=a.metrics.prompt_tokens,s[t].metrics.completion_tokens+=a.metrics.completion_tokens,s[t].metrics.total_tokens+=a.metrics.total_tokens,s[t].metrics.api_requests+=a.metrics.api_requests,s[t].metrics.successful_requests+=a.metrics.successful_requests,s[t].metrics.failed_requests+=a.metrics.failed_requests,s[t].metrics.cache_read_input_tokens+=a.metrics.cache_read_input_tokens||0,s[t].metrics.cache_creation_input_tokens+=a.metrics.cache_creation_input_tokens||0})}),console.log("debugTags",{keySpend:s,userSpendData:J}),Object.entries(s).map(e=>{let[s,t]=e;return{api_key:s,key_alias:t.metadata.key_alias||"-",tags:t.metadata.tags||[],spend:t.metrics.spend}}).sort((e,s)=>s.spend-e.spend).slice(0,e)}(eT),teams:null,topKeysLimit:eT,setTopKeysLimit:eL})]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsx)(v.Z,{children:"groups"===ex?"Top Public Model Names":"Top Litellm Models"}),(0,a.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,a.jsx)(k.Z,{options:[{label:"5",value:5},{label:"10",value:10},{label:"25",value:25},{label:"50",value:50}],value:eE,onChange:e=>eA(e)}),(0,a.jsxs)("div",{className:"flex bg-gray-100 rounded-lg p-1",children:[(0,a.jsx)("button",{className:"px-3 py-1 text-sm rounded-md transition-colors ".concat("groups"===ex?"bg-white shadow-sm text-gray-900":"text-gray-600 hover:text-gray-900"),onClick:()=>eh("groups"),children:"Public Model Name"}),(0,a.jsx)("button",{className:"px-3 py-1 text-sm rounded-md transition-colors ".concat("individual"===ex?"bg-white shadow-sm text-gray-900":"text-gray-600 hover:text-gray-900"),onClick:()=>eh("individual"),children:"Litellm Model Name"})]})]}),X?(0,a.jsx)(eD,{isDateChanging:es}):(0,a.jsx)("div",{className:"relative max-h-[600px] overflow-y-auto",children:(()=>{let e="groups"===ex?ez(eE):eV(eE);return(0,a.jsx)(r.Z,{className:"mt-4",style:{height:52*Math.min(e.length,eE)},data:e,index:"key",categories:["spend"],colors:["cyan"],valueFormatter:K,layout:"vertical",yAxisWidth:200,showLegend:!1,customTooltip:e=>{let{payload:s,active:t}=e;if(!t||!(null==s?void 0:s[0]))return null;let r=s[0].payload;return(0,a.jsxs)("div",{className:"bg-white p-4 shadow-lg rounded-lg border",children:[(0,a.jsx)("p",{className:"font-bold",children:r.key}),(0,a.jsxs)("p",{className:"text-cyan-500",children:["Spend: $",(0,F.pw)(r.spend,2)]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Total Requests: ",r.requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-green-600",children:["Successful: ",r.successful_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-red-600",children:["Failed: ",r.failed_requests.toLocaleString()]}),(0,a.jsxs)("p",{className:"text-gray-600",children:["Tokens: ",r.tokens.toLocaleString()]})]})}})})()})]})}),(0,a.jsx)(n.Z,{numColSpan:2,children:(0,a.jsxs)(l.Z,{className:"h-full",children:[(0,a.jsx)("div",{className:"flex justify-between items-center mb-4",children:(0,a.jsx)(v.Z,{children:"Spend by Provider"})}),X?(0,a.jsx)(eD,{isDateChanging:es}):(0,a.jsxs)(c.Z,{numItems:2,children:[(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsx)(i.Z,{className:"mt-4 h-40",data:eR(),index:"provider",category:"spend",valueFormatter:e=>"$".concat((0,F.pw)(e,2)),colors:["cyan"]})}),(0,a.jsx)(n.Z,{numColSpan:1,children:(0,a.jsxs)(h.Z,{children:[(0,a.jsx)(j.Z,{children:(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(f.Z,{children:"Provider"}),(0,a.jsx)(f.Z,{children:"Spend"}),(0,a.jsx)(f.Z,{className:"text-green-600",children:"Successful"}),(0,a.jsx)(f.Z,{className:"text-red-600",children:"Failed"}),(0,a.jsx)(f.Z,{children:"Tokens"})]})}),(0,a.jsx)(p.Z,{children:eR().filter(e=>e.spend>0).map(e=>(0,a.jsxs)(_.Z,{children:[(0,a.jsx)(g.Z,{children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[e.provider&&(0,a.jsx)("img",{src:(0,eb.dr)(e.provider).logo,alt:"".concat(e.provider," logo"),className:"w-4 h-4",onError:s=>{let t=s.target,a=t.parentElement;if(a){var r;let s=document.createElement("div");s.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",s.textContent=(null===(r=e.provider)||void 0===r?void 0:r.charAt(0))||"-",a.replaceChild(s,t)}}}),(0,a.jsx)("span",{children:e.provider})]})}),(0,a.jsxs)(g.Z,{children:["$",(0,F.pw)(e.spend,2)]}),(0,a.jsx)(g.Z,{className:"text-green-600",children:e.successful_requests.toLocaleString()}),(0,a.jsx)(g.Z,{className:"text-red-600",children:e.failed_requests.toLocaleString()}),(0,a.jsx)(g.Z,{children:e.tokens.toLocaleString()})]},e.provider))})]})})]})]})})]})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:e$})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:eW})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(P,{modelMetrics:eB})}),(0,a.jsx)(m.Z,{children:(0,a.jsx)(eK,{userSpendData:J})})]})]}),"organization"===eN&&(0,a.jsxs)(a.Fragment,{children:[e_&&(0,a.jsx)(b.Z,{banner:!0,type:"info",message:"Organization usage is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>ev(!1),className:"mb-5"}),(0,a.jsx)(eH,{accessToken:$,entityType:"organization",userID:H,userRole:W,dateValue:en,entityList:(null==Y?void 0:Y.map(e=>({label:e.organization_alias,value:e.organization_id})))||null,premiumUser:G})]}),"team"===eN&&(0,a.jsx)(eH,{accessToken:$,entityType:"team",userID:H,userRole:W,entityList:(null==I?void 0:I.map(e=>({label:e.team_alias,value:e.team_id})))||null,premiumUser:G,dateValue:en}),"customer"===eN&&(0,a.jsxs)(a.Fragment,{children:[ek&&(0,a.jsx)(b.Z,{banner:!0,type:"info",message:"Customer usage is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>eZ(!1),className:"mb-5"}),(0,a.jsx)(eH,{accessToken:$,entityType:"customer",userID:H,userRole:W,entityList:(null==ed?void 0:ed.map(e=>({label:e.alias||e.user_id,value:e.user_id})))||null,premiumUser:G,dateValue:en})]}),"tag"===eN&&(0,a.jsx)(eH,{accessToken:$,entityType:"tag",userID:H,userRole:W,entityList:ec,premiumUser:G,dateValue:en}),"agent"===eN&&(0,a.jsxs)(a.Fragment,{children:[eq&&(0,a.jsx)(b.Z,{banner:!0,type:"info",message:"Agent usage (A2A) is a new feature.",description:"Spend is tracked from feature launch and previous data isn't backfilled, so only future usage appears here.",closable:!0,onClose:()=>eS(!1),className:"mb-5"}),(0,a.jsx)(eH,{accessToken:$,entityType:"agent",userID:H,userRole:W,entityList:(null==eu?void 0:null===(R=eu.agents)||void 0===R?void 0:R.map(e=>({label:e.agent_name,value:e.agent_id})))||null,premiumUser:G,dateValue:en})," "]}),"user-agent-activity"===eN&&(0,a.jsx)(eO,{accessToken:$,userRole:W,dateValue:en})]})}),(0,a.jsx)(ea,{isOpen:ep,onClose:()=>eg(!1),accessToken:$}),(0,a.jsx)(ey,{isOpen:ej,onClose:()=>ef(!1),entityType:"team",spendData:{results:J.results,metadata:J.metadata},dateRange:en,selectedFilters:[],customTitle:"Export Usage Data"})]})}},91323:function(e,s,t){t.d(s,{S:function(){return n}});var a=t(57437),r=t(2265),l=t(10012);function n(e){var s,t;let{className:n="",...i}=e,c=(0,r.useId)();return s=()=>{let e=document.getAnimations().filter(e=>e instanceof CSSAnimation&&"spin"===e.animationName),s=e.find(e=>{var s;return(null===(s=e.effect.target)||void 0===s?void 0:s.getAttribute("data-spinner-id"))===c}),t=e.find(e=>{var s;return e.effect instanceof KeyframeEffect&&(null===(s=e.effect.target)||void 0===s?void 0:s.getAttribute("data-spinner-id"))!==c});s&&t&&(s.currentTime=t.currentTime)},t=[c],(0,r.useLayoutEffect)(s,t),(0,a.jsxs)("svg",{"data-spinner-id":c,className:(0,l.cx)("pointer-events-none size-12 animate-spin text-current",n),fill:"none",viewBox:"0 0 24 24",...i,children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.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"})]})}},47375:function(e,s,t){var a=t(57437),r=t(2265),l=t(19250),n=t(59872),i=t(80443);s.Z=e=>{let{userSpend:s,userMaxBudget:t,selectedTeam:c}=e,{accessToken:o,userRole:d,userId:u}=(0,i.Z)(),[m,x]=(0,r.useState)(null!==s?s:0),[h,p]=(0,r.useState)(c?Number((0,n.pw)(c.max_budget,4)):null);(0,r.useEffect)(()=>{if(c){if("Default Team"===c.team_alias)p(t);else{let e=!1;if(c.team_memberships)for(let s of c.team_memberships)s.user_id===u&&"max_budget"in s.litellm_budget_table&&null!==s.litellm_budget_table.max_budget&&(p(s.litellm_budget_table.max_budget),e=!0);e||p(c.max_budget)}}else p(t)},[c,t]);let[g,j]=(0,r.useState)([]);(0,r.useEffect)(()=>{let e=async()=>{if(!o||!u||!d)return};(async()=>{try{if(null===u||null===d)return;if(null!==o){let e=(await (0,l.modelAvailableCall)(o,u,d)).data.map(e=>e.id);console.log("available_model_names:",e),j(e)}}catch(e){console.error("Error fetching user models:",e)}})(),e()},[d,o,u]),(0,r.useEffect)(()=>{null!==s&&x(s)},[s]);let f=[];c&&c.models&&(f=c.models),f&&f.includes("all-proxy-models")?(console.log("user models:",g),f=g):f&&f.includes("all-team-models")?f=c.models:f&&0===f.length&&(f=g);let _=null!==h?"$".concat((0,n.pw)(Number(h),4)," limit"):"No limit",y=void 0!==m?(0,n.pw)(m,4):null;return console.log("spend in view user spend: ".concat(m)),(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsxs)("div",{className:"flex justify-between gap-x-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total Spend"}),(0,a.jsxs)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:["$",y]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Max Budget"}),(0,a.jsx)("p",{className:"text-2xl text-tremor-content-strong dark:text-dark-tremor-content-strong font-semibold",children:_})]})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3367-33bb84b3d3d247b2.js b/litellm/proxy/_experimental/out/_next/static/chunks/3367-58830187e9e5b9fa.js similarity index 98% rename from litellm/proxy/_experimental/out/_next/static/chunks/3367-33bb84b3d3d247b2.js rename to litellm/proxy/_experimental/out/_next/static/chunks/3367-58830187e9e5b9fa.js index 23daac359d..ab13c388e3 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/3367-33bb84b3d3d247b2.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3367-58830187e9e5b9fa.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3367],{60440:function(e,n,t){t.d(n,{Z:function(){return u}});var r=t(1119),o=t(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},l=t(55015),u=o.forwardRef(function(e,n){return o.createElement(l.Z,(0,r.Z)({},e,{ref:n,icon:i}))})},71030:function(e,n,t){t.d(n,{Z:function(){return C}});var r=t(1119),o=t(11993),i=t(26365),l=t(6989),u=t(97821),a=t(36760),c=t.n(a),s=t(28791),f=t(2265),d=t(95814),p=t(53346),v=d.Z.ESC,m=d.Z.TAB,b=(0,f.forwardRef)(function(e,n){var t=e.overlay,r=e.arrow,o=e.prefixCls,i=(0,f.useMemo)(function(){return"function"==typeof t?t():t},[t]),l=(0,s.sQ)(n,(0,s.C4)(i));return f.createElement(f.Fragment,null,r&&f.createElement("div",{className:"".concat(o,"-arrow")}),f.cloneElement(i,{ref:(0,s.Yr)(i)?l:void 0}))}),y={adjustX:1,adjustY:1},h=[0,0],g={topLeft:{points:["bl","tl"],overflow:y,offset:[0,-4],targetOffset:h},top:{points:["bc","tc"],overflow:y,offset:[0,-4],targetOffset:h},topRight:{points:["br","tr"],overflow:y,offset:[0,-4],targetOffset:h},bottomLeft:{points:["tl","bl"],overflow:y,offset:[0,4],targetOffset:h},bottom:{points:["tc","bc"],overflow:y,offset:[0,4],targetOffset:h},bottomRight:{points:["tr","br"],overflow:y,offset:[0,4],targetOffset:h}},Z=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"],C=f.forwardRef(function(e,n){var t,a,d,y,h,C,E,w,k,M,R,x,N,P,S=e.arrow,I=void 0!==S&&S,K=e.prefixCls,O=void 0===K?"rc-dropdown":K,A=e.transitionName,T=e.animation,L=e.align,D=e.placement,_=e.placements,V=e.getPopupContainer,z=e.showAction,F=e.hideAction,j=e.overlayClassName,B=e.overlayStyle,W=e.visible,H=e.trigger,Y=void 0===H?["hover"]:H,q=e.autoFocus,X=e.overlay,G=e.children,Q=e.onVisibleChange,U=(0,l.Z)(e,Z),J=f.useState(),$=(0,i.Z)(J,2),ee=$[0],en=$[1],et="visible"in e?W:ee,er=f.useRef(null),eo=f.useRef(null),ei=f.useRef(null);f.useImperativeHandle(n,function(){return er.current});var el=function(e){en(e),null==Q||Q(e)};a=(t={visible:et,triggerRef:ei,onVisibleChange:el,autoFocus:q,overlayRef:eo}).visible,d=t.triggerRef,y=t.onVisibleChange,h=t.autoFocus,C=t.overlayRef,E=f.useRef(!1),w=function(){if(a){var e,n;null===(e=d.current)||void 0===e||null===(n=e.focus)||void 0===n||n.call(e),null==y||y(!1)}},k=function(){var e;return null!==(e=C.current)&&void 0!==e&&!!e.focus&&(C.current.focus(),E.current=!0,!0)},M=function(e){switch(e.keyCode){case v:w();break;case m:var n=!1;E.current||(n=k()),n?e.preventDefault():w()}},f.useEffect(function(){return a?(window.addEventListener("keydown",M),h&&(0,p.Z)(k,3),function(){window.removeEventListener("keydown",M),E.current=!1}):function(){E.current=!1}},[a]);var eu=function(){return f.createElement(b,{ref:eo,overlay:X,prefixCls:O,arrow:I})},ea=f.cloneElement(G,{className:c()(null===(P=G.props)||void 0===P?void 0:P.className,et&&(void 0!==(R=e.openClassName)?R:"".concat(O,"-open"))),ref:(0,s.Yr)(G)?(0,s.sQ)(ei,(0,s.C4)(G)):void 0}),ec=F;return ec||-1===Y.indexOf("contextMenu")||(ec=["click"]),f.createElement(u.Z,(0,r.Z)({builtinPlacements:void 0===_?g:_},U,{prefixCls:O,ref:er,popupClassName:c()(j,(0,o.Z)({},"".concat(O,"-show-arrow"),I)),popupStyle:B,action:Y,showAction:z,hideAction:ec,popupPlacement:void 0===D?"bottomLeft":D,popupAlign:L,popupTransitionName:A,popupAnimation:T,popupVisible:et,stretch:(x=e.minOverlayWidthMatchTrigger,N=e.alignPoint,"minOverlayWidthMatchTrigger"in e?x:!N)?"minWidth":"",popup:"function"==typeof X?eu:eu(),onPopupVisibleChange:el,onPopupClick:function(n){var t=e.onOverlayClick;en(!1),t&&t(n)},getPopupContainer:V}),ea)})},33082:function(e,n,t){t.d(n,{iz:function(){return eO},ck:function(){return ev},BW:function(){return eL},sN:function(){return ev},Wd:function(){return eI},ZP:function(){return ej},Xl:function(){return x}});var r=t(1119),o=t(11993),i=t(31686),l=t(83145),u=t(26365),a=t(6989),c=t(36760),s=t.n(c),f=t(1699),d=t(50506),p=t(16671),v=t(32559),m=t(2265),b=t(54887),y=m.createContext(null);function h(e,n){return void 0===e?null:"".concat(e,"-").concat(n)}function g(e){return h(m.useContext(y),e)}var Z=t(6397),C=["children","locked"],E=m.createContext(null);function w(e){var n=e.children,t=e.locked,r=(0,a.Z)(e,C),o=m.useContext(E),l=(0,Z.Z)(function(){var e;return e=(0,i.Z)({},o),Object.keys(r).forEach(function(n){var t=r[n];void 0!==t&&(e[n]=t)}),e},[o,r],function(e,n){return!t&&(e[0]!==n[0]||!(0,p.Z)(e[1],n[1],!0))});return m.createElement(E.Provider,{value:l},n)}var k=m.createContext(null);function M(){return m.useContext(k)}var R=m.createContext([]);function x(e){var n=m.useContext(R);return m.useMemo(function(){return void 0!==e?[].concat((0,l.Z)(n),[e]):n},[n,e])}var N=m.createContext(null),P=m.createContext({}),S=t(2857);function I(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,S.Z)(e)){var t=e.nodeName.toLowerCase(),r=["input","select","textarea","button"].includes(t)||e.isContentEditable||"a"===t&&!!e.getAttribute("href"),o=e.getAttribute("tabindex"),i=Number(o),l=null;return o&&!Number.isNaN(i)?l=i:r&&null===l&&(l=0),r&&e.disabled&&(l=null),null!==l&&(l>=0||n&&l<0)}return!1}var K=t(95814),O=t(53346),A=K.Z.LEFT,T=K.Z.RIGHT,L=K.Z.UP,D=K.Z.DOWN,_=K.Z.ENTER,V=K.Z.ESC,z=K.Z.HOME,F=K.Z.END,j=[L,D,A,T];function B(e,n){return(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=(0,l.Z)(e.querySelectorAll("*")).filter(function(e){return I(e,n)});return I(e,n)&&t.unshift(e),t})(e,!0).filter(function(e){return n.has(e)})}function W(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(!e)return null;var o=B(e,n),i=o.length,l=o.findIndex(function(e){return t===e});return r<0?-1===l?l=i-1:l-=1:r>0&&(l+=1),o[l=(l+i)%i]}var H=function(e,n){var t=new Set,r=new Map,o=new Map;return e.forEach(function(e){var i=document.querySelector("[data-menu-id='".concat(h(n,e),"']"));i&&(t.add(i),o.set(i,e),r.set(e,i))}),{elements:t,key2element:r,element2key:o}},Y="__RC_UTIL_PATH_SPLIT__",q=function(e){return e.join(Y)},X="rc-menu-more";function G(e){var n=m.useRef(e);n.current=e;var t=m.useCallback(function(){for(var e,t=arguments.length,r=Array(t),o=0;o1&&(k.motionAppear=!1);var M=k.onVisibleChanged;return(k.onVisibleChanged=function(e){return b.current||e||Z(!0),null==M?void 0:M(e)},g)?null:m.createElement(w,{mode:a,locked:!b.current},m.createElement(eR.ZP,(0,r.Z)({visible:C},k,{forceRender:f,removeOnLeave:!1,leavedClassName:"".concat(s,"-hidden")}),function(e){var t=e.className,r=e.style;return m.createElement(eb,{id:n,className:t,style:r},l)}))}var eN=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],eP=["active"],eS=m.forwardRef(function(e,n){var t=e.style,l=e.className,c=e.title,d=e.eventKey,p=(e.warnKey,e.disabled),v=e.internalPopupClose,b=e.children,y=e.itemIcon,h=e.expandIcon,Z=e.popupClassName,C=e.popupOffset,k=e.popupStyle,M=e.onClick,R=e.onMouseEnter,S=e.onMouseLeave,I=e.onTitleClick,K=e.onTitleMouseEnter,O=e.onTitleMouseLeave,A=(0,a.Z)(e,eN),T=g(d),L=m.useContext(E),D=L.prefixCls,_=L.mode,V=L.openKeys,z=L.disabled,F=L.overflowDisabled,j=L.activeKey,B=L.selectedKeys,W=L.itemIcon,H=L.expandIcon,Y=L.onItemClick,q=L.onOpenChange,X=L.onActive,Q=m.useContext(P)._internalRenderSubMenuItem,U=m.useContext(N).isSubPathKey,J=x(),$="".concat(D,"-submenu"),ee=z||p,en=m.useRef(),et=m.useRef(),er=null!=h?h:H,eu=V.includes(d),ec=!F&&eu,es=U(B,d),ef=eo(d,ee,K,O),ed=ef.active,ep=(0,a.Z)(ef,eP),ev=m.useState(!1),em=(0,u.Z)(ev,2),ey=em[0],eh=em[1],eg=function(e){ee||eh(e)},eZ=m.useMemo(function(){return ed||"inline"!==_&&(ey||U([j],d))},[_,ed,j,ey,d,U]),eC=ei(J.length),eE=G(function(e){null==M||M(ea(e)),Y(e)}),ew=T&&"".concat(T,"-popup"),ek=m.useMemo(function(){return m.createElement(el,{icon:"horizontal"!==_?er:void 0,props:(0,i.Z)((0,i.Z)({},e),{},{isOpen:ec,isSubMenu:!0})},m.createElement("i",{className:"".concat($,"-arrow")}))},[_,er,e,ec,$]),eR=m.createElement("div",(0,r.Z)({role:"menuitem",style:eC,className:"".concat($,"-title"),tabIndex:ee?null:-1,ref:en,title:"string"==typeof c?c:null,"data-menu-id":F&&T?null:T,"aria-expanded":ec,"aria-haspopup":!0,"aria-controls":ew,"aria-disabled":ee,onClick:function(e){ee||(null==I||I({key:d,domEvent:e}),"inline"===_&&q(d,!eu))},onFocus:function(){X(d)}},ep),c,ek),eS=m.useRef(_);if("inline"!==_&&J.length>1?eS.current="vertical":eS.current=_,!F){var eI=eS.current;eR=m.createElement(eM,{mode:eI,prefixCls:$,visible:!v&&ec&&"inline"!==_,popupClassName:Z,popupOffset:C,popupStyle:k,popup:m.createElement(w,{mode:"horizontal"===eI?"vertical":eI},m.createElement(eb,{id:ew,ref:et},b)),disabled:ee,onVisibleChange:function(e){"inline"!==_&&q(d,e)}},eR)}var eK=m.createElement(f.Z.Item,(0,r.Z)({ref:n,role:"none"},A,{component:"li",style:t,className:s()($,"".concat($,"-").concat(_),l,(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},"".concat($,"-open"),ec),"".concat($,"-active"),eZ),"".concat($,"-selected"),es),"".concat($,"-disabled"),ee)),onMouseEnter:function(e){eg(!0),null==R||R({key:d,domEvent:e})},onMouseLeave:function(e){eg(!1),null==S||S({key:d,domEvent:e})}}),eR,!F&&m.createElement(ex,{id:ew,open:ec,keyPath:J},b));return Q&&(eK=Q(eK,e,{selected:es,active:eZ,open:ec,disabled:ee})),m.createElement(w,{onItemClick:eE,mode:"horizontal"===_?"vertical":_,itemIcon:null!=y?y:W,expandIcon:er},eK)}),eI=m.forwardRef(function(e,n){var t,o=e.eventKey,i=e.children,l=x(o),u=eh(i,l),a=M();return m.useEffect(function(){if(a)return a.registerPath(o,l),function(){a.unregisterPath(o,l)}},[l]),t=a?u:m.createElement(eS,(0,r.Z)({ref:n},e),u),m.createElement(R.Provider,{value:l},t)}),eK=t(41154);function eO(e){var n=e.className,t=e.style,r=m.useContext(E).prefixCls;return M()?null:m.createElement("li",{role:"separator",className:s()("".concat(r,"-item-divider"),n),style:t})}var eA=["className","title","eventKey","children"],eT=m.forwardRef(function(e,n){var t=e.className,o=e.title,i=(e.eventKey,e.children),l=(0,a.Z)(e,eA),u=m.useContext(E).prefixCls,c="".concat(u,"-item-group");return m.createElement("li",(0,r.Z)({ref:n,role:"presentation"},l,{onClick:function(e){return e.stopPropagation()},className:s()(c,t)}),m.createElement("div",{role:"presentation",className:"".concat(c,"-title"),title:"string"==typeof o?o:void 0},o),m.createElement("ul",{role:"group",className:"".concat(c,"-list")},i))}),eL=m.forwardRef(function(e,n){var t=e.eventKey,o=eh(e.children,x(t));return M()?o:m.createElement(eT,(0,r.Z)({ref:n},(0,et.Z)(e,["warnKey"])),o)}),eD=["label","children","key","type","extra"];function e_(e,n,t,o,l){var u=e,c=(0,i.Z)({divider:eO,item:ev,group:eL,submenu:eI},o);return n&&(u=function e(n,t,o){var i=t.item,l=t.group,u=t.submenu,c=t.divider;return(n||[]).map(function(n,s){if(n&&"object"===(0,eK.Z)(n)){var f=n.label,d=n.children,p=n.key,v=n.type,b=n.extra,y=(0,a.Z)(n,eD),h=null!=p?p:"tmp-".concat(s);return d||"group"===v?"group"===v?m.createElement(l,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):m.createElement(u,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):"divider"===v?m.createElement(c,(0,r.Z)({key:h},y)):m.createElement(i,(0,r.Z)({key:h},y,{extra:b}),f,(!!b||0===b)&&m.createElement("span",{className:"".concat(o,"-item-extra")},b))}return null}).filter(function(e){return e})}(n,c,l)),eh(u,t)}var eV=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],ez=[],eF=m.forwardRef(function(e,n){var t,c,v,h,g,Z,C,E,M,R,x,S,I,K,J,$,ee,en,et,er,eo,ei,el,eu,ec,es,ef=e.prefixCls,ed=void 0===ef?"rc-menu":ef,ep=e.rootClassName,em=e.style,eb=e.className,ey=e.tabIndex,eh=e.items,eg=e.children,eZ=e.direction,eC=e.id,eE=e.mode,ew=void 0===eE?"vertical":eE,ek=e.inlineCollapsed,eM=e.disabled,eR=e.disabledOverflow,ex=e.subMenuOpenDelay,eN=e.subMenuCloseDelay,eP=e.forceSubMenuRender,eS=e.defaultOpenKeys,eK=e.openKeys,eO=e.activeKey,eA=e.defaultActiveFirst,eT=e.selectable,eL=void 0===eT||eT,eD=e.multiple,eF=void 0!==eD&&eD,ej=e.defaultSelectedKeys,eB=e.selectedKeys,eW=e.onSelect,eH=e.onDeselect,eY=e.inlineIndent,eq=e.motion,eX=e.defaultMotions,eG=e.triggerSubMenuAction,eQ=e.builtinPlacements,eU=e.itemIcon,eJ=e.expandIcon,e$=e.overflowedIndicator,e0=void 0===e$?"...":e$,e1=e.overflowedIndicatorPopupClassName,e2=e.getPopupContainer,e6=e.onClick,e5=e.onOpenChange,e9=e.onKeyDown,e4=(e.openAnimation,e.openTransitionName,e._internalRenderMenuItem),e3=e._internalRenderSubMenuItem,e8=e._internalComponents,e7=(0,a.Z)(e,eV),ne=m.useMemo(function(){return[e_(eg,eh,ez,e8,ed),e_(eg,eh,ez,{},ed)]},[eg,eh,e8]),nn=(0,u.Z)(ne,2),nt=nn[0],nr=nn[1],no=m.useState(!1),ni=(0,u.Z)(no,2),nl=ni[0],nu=ni[1],na=m.useRef(),nc=(t=(0,d.Z)(eC,{value:eC}),v=(c=(0,u.Z)(t,2))[0],h=c[1],m.useEffect(function(){U+=1;var e="".concat(Q,"-").concat(U);h("rc-menu-uuid-".concat(e))},[]),v),ns="rtl"===eZ,nf=(0,d.Z)(eS,{value:eK,postState:function(e){return e||ez}}),nd=(0,u.Z)(nf,2),np=nd[0],nv=nd[1],nm=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function t(){nv(e),null==e5||e5(e)}n?(0,b.flushSync)(t):t()},nb=m.useState(np),ny=(0,u.Z)(nb,2),nh=ny[0],ng=ny[1],nZ=m.useRef(!1),nC=m.useMemo(function(){return("inline"===ew||"vertical"===ew)&&ek?["vertical",ek]:[ew,!1]},[ew,ek]),nE=(0,u.Z)(nC,2),nw=nE[0],nk=nE[1],nM="inline"===nw,nR=m.useState(nw),nx=(0,u.Z)(nR,2),nN=nx[0],nP=nx[1],nS=m.useState(nk),nI=(0,u.Z)(nS,2),nK=nI[0],nO=nI[1];m.useEffect(function(){nP(nw),nO(nk),nZ.current&&(nM?nv(nh):nm(ez))},[nw,nk]);var nA=m.useState(0),nT=(0,u.Z)(nA,2),nL=nT[0],nD=nT[1],n_=nL>=nt.length-1||"horizontal"!==nN||eR;m.useEffect(function(){nM&&ng(np)},[np]),m.useEffect(function(){return nZ.current=!0,function(){nZ.current=!1}},[]);var nV=(g=m.useState({}),Z=(0,u.Z)(g,2)[1],C=(0,m.useRef)(new Map),E=(0,m.useRef)(new Map),M=m.useState([]),x=(R=(0,u.Z)(M,2))[0],S=R[1],I=(0,m.useRef)(0),K=(0,m.useRef)(!1),J=function(){K.current||Z({})},$=(0,m.useCallback)(function(e,n){var t,r=q(n);E.current.set(r,e),C.current.set(e,r),I.current+=1;var o=I.current;t=function(){o===I.current&&J()},Promise.resolve().then(t)},[]),ee=(0,m.useCallback)(function(e,n){var t=q(n);E.current.delete(t),C.current.delete(e)},[]),en=(0,m.useCallback)(function(e){S(e)},[]),et=(0,m.useCallback)(function(e,n){var t=(C.current.get(e)||"").split(Y);return n&&x.includes(t[0])&&t.unshift(X),t},[x]),er=(0,m.useCallback)(function(e,n){return e.filter(function(e){return void 0!==e}).some(function(e){return et(e,!0).includes(n)})},[et]),eo=(0,m.useCallback)(function(e){var n="".concat(C.current.get(e)).concat(Y),t=new Set;return(0,l.Z)(E.current.keys()).forEach(function(e){e.startsWith(n)&&t.add(E.current.get(e))}),t},[]),m.useEffect(function(){return function(){K.current=!0}},[]),{registerPath:$,unregisterPath:ee,refreshOverflowKeys:en,isSubPathKey:er,getKeyPath:et,getKeys:function(){var e=(0,l.Z)(C.current.keys());return x.length&&e.push(X),e},getSubPathKeys:eo}),nz=nV.registerPath,nF=nV.unregisterPath,nj=nV.refreshOverflowKeys,nB=nV.isSubPathKey,nW=nV.getKeyPath,nH=nV.getKeys,nY=nV.getSubPathKeys,nq=m.useMemo(function(){return{registerPath:nz,unregisterPath:nF}},[nz,nF]),nX=m.useMemo(function(){return{isSubPathKey:nB}},[nB]);m.useEffect(function(){nj(n_?ez:nt.slice(nL+1).map(function(e){return e.key}))},[nL,n_]);var nG=(0,d.Z)(eO||eA&&(null===(es=nt[0])||void 0===es?void 0:es.key),{value:eO}),nQ=(0,u.Z)(nG,2),nU=nQ[0],nJ=nQ[1],n$=G(function(e){nJ(e)}),n0=G(function(){nJ(void 0)});(0,m.useImperativeHandle)(n,function(){return{list:na.current,focus:function(e){var n,t,r=H(nH(),nc),o=r.elements,i=r.key2element,l=r.element2key,u=B(na.current,o),a=null!=nU?nU:u[0]?l.get(u[0]):null===(n=nt.find(function(e){return!e.props.disabled}))||void 0===n?void 0:n.key,c=i.get(a);a&&c&&(null==c||null===(t=c.focus)||void 0===t||t.call(c,e))}}});var n1=(0,d.Z)(ej||[],{value:eB,postState:function(e){return Array.isArray(e)?e:null==e?ez:[e]}}),n2=(0,u.Z)(n1,2),n6=n2[0],n5=n2[1],n9=function(e){if(eL){var n,t=e.key,r=n6.includes(t);n5(n=eF?r?n6.filter(function(e){return e!==t}):[].concat((0,l.Z)(n6),[t]):[t]);var o=(0,i.Z)((0,i.Z)({},e),{},{selectedKeys:n});r?null==eH||eH(o):null==eW||eW(o)}!eF&&np.length&&"inline"!==nN&&nm(ez)},n4=G(function(e){null==e6||e6(ea(e)),n9(e)}),n3=G(function(e,n){var t=np.filter(function(n){return n!==e});if(n)t.push(e);else if("inline"!==nN){var r=nY(e);t=t.filter(function(e){return!r.has(e)})}(0,p.Z)(np,t,!0)||nm(t,!0)}),n8=(ei=function(e,n){var t=null!=n?n:!np.includes(e);n3(e,t)},el=m.useRef(),(eu=m.useRef()).current=nU,ec=function(){O.Z.cancel(el.current)},m.useEffect(function(){return function(){ec()}},[]),function(e){var n=e.which;if([].concat(j,[_,V,z,F]).includes(n)){var t=nH(),r=H(t,nc),i=r,l=i.elements,u=i.key2element,a=i.element2key,c=function(e,n){for(var t=e||document.activeElement;t;){if(n.has(t))return t;t=t.parentElement}return null}(u.get(nU),l),s=a.get(c),f=function(e,n,t,r){var i,l="prev",u="next",a="children",c="parent";if("inline"===e&&r===_)return{inlineTrigger:!0};var s=(0,o.Z)((0,o.Z)({},L,l),D,u),f=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},A,t?u:l),T,t?l:u),D,a),_,a),d=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},L,l),D,u),_,a),V,c),A,t?a:c),T,t?c:a);switch(null===(i=({inline:s,horizontal:f,vertical:d,inlineSub:s,horizontalSub:d,verticalSub:d})["".concat(e).concat(n?"":"Sub")])||void 0===i?void 0:i[r]){case l:return{offset:-1,sibling:!0};case u:return{offset:1,sibling:!0};case c:return{offset:-1,sibling:!1};case a:return{offset:1,sibling:!1};default:return null}}(nN,1===nW(s,!0).length,ns,n);if(!f&&n!==z&&n!==F)return;(j.includes(n)||[z,F].includes(n))&&e.preventDefault();var d=function(e){if(e){var n=e,t=e.querySelector("a");null!=t&&t.getAttribute("href")&&(n=t);var r=a.get(e);nJ(r),ec(),el.current=(0,O.Z)(function(){eu.current===r&&n.focus()})}};if([z,F].includes(n)||f.sibling||!c){var p,v=B(p=c&&"inline"!==nN?function(e){for(var n=e;n;){if(n.getAttribute("data-menu-list"))return n;n=n.parentElement}return null}(c):na.current,l);d(n===z?v[0]:n===F?v[v.length-1]:W(p,l,c,f.offset))}else if(f.inlineTrigger)ei(s);else if(f.offset>0)ei(s,!0),ec(),el.current=(0,O.Z)(function(){r=H(t,nc);var e=c.getAttribute("aria-controls");d(W(document.getElementById(e),r.elements))},5);else if(f.offset<0){var m=nW(s,!0),b=m[m.length-2],y=u.get(b);ei(b,!1),d(y)}}null==e9||e9(e)});m.useEffect(function(){nu(!0)},[]);var n7=m.useMemo(function(){return{_internalRenderMenuItem:e4,_internalRenderSubMenuItem:e3}},[e4,e3]),te="horizontal"!==nN||eR?nt:nt.map(function(e,n){return m.createElement(w,{key:e.key,overflowDisabled:n>nL},e)}),tn=m.createElement(f.Z,(0,r.Z)({id:eC,ref:na,prefixCls:"".concat(ed,"-overflow"),component:"ul",itemComponent:ev,className:s()(ed,"".concat(ed,"-root"),"".concat(ed,"-").concat(nN),eb,(0,o.Z)((0,o.Z)({},"".concat(ed,"-inline-collapsed"),nK),"".concat(ed,"-rtl"),ns),ep),dir:eZ,style:em,role:"menu",tabIndex:void 0===ey?0:ey,data:te,renderRawItem:function(e){return e},renderRawRest:function(e){var n=e.length,t=n?nt.slice(-n):null;return m.createElement(eI,{eventKey:X,title:e0,disabled:n_,internalPopupClose:0===n,popupClassName:e1},t)},maxCount:"horizontal"!==nN||eR?f.Z.INVALIDATE:f.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(e){nD(e)},onKeyDown:n8},e7));return m.createElement(P.Provider,{value:n7},m.createElement(y.Provider,{value:nc},m.createElement(w,{prefixCls:ed,rootClassName:ep,mode:nN,openKeys:np,rtl:ns,disabled:eM,motion:nl?eq:null,defaultMotions:nl?eX:null,activeKey:nU,onActive:n$,onInactive:n0,selectedKeys:n6,inlineIndent:void 0===eY?24:eY,subMenuOpenDelay:void 0===ex?.1:ex,subMenuCloseDelay:void 0===eN?.1:eN,forceSubMenuRender:eP,builtinPlacements:eQ,triggerSubMenuAction:void 0===eG?"hover":eG,getPopupContainer:e2,itemIcon:eU,expandIcon:eJ,onItemClick:n4,onOpenChange:n3},m.createElement(N.Provider,{value:nX},tn),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(k.Provider,{value:nq},nr)))))});eF.Item=ev,eF.SubMenu=eI,eF.ItemGroup=eL,eF.Divider=eO;var ej=eF}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3367],{39760:function(e,n,t){t.d(n,{Z:function(){return u}});var r=t(1119),o=t(2265),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},l=t(55015),u=o.forwardRef(function(e,n){return o.createElement(l.Z,(0,r.Z)({},e,{ref:n,icon:i}))})},71030:function(e,n,t){t.d(n,{Z:function(){return C}});var r=t(1119),o=t(11993),i=t(26365),l=t(6989),u=t(97821),a=t(36760),c=t.n(a),s=t(28791),f=t(2265),d=t(95814),p=t(53346),v=d.Z.ESC,m=d.Z.TAB,b=(0,f.forwardRef)(function(e,n){var t=e.overlay,r=e.arrow,o=e.prefixCls,i=(0,f.useMemo)(function(){return"function"==typeof t?t():t},[t]),l=(0,s.sQ)(n,(0,s.C4)(i));return f.createElement(f.Fragment,null,r&&f.createElement("div",{className:"".concat(o,"-arrow")}),f.cloneElement(i,{ref:(0,s.Yr)(i)?l:void 0}))}),y={adjustX:1,adjustY:1},h=[0,0],g={topLeft:{points:["bl","tl"],overflow:y,offset:[0,-4],targetOffset:h},top:{points:["bc","tc"],overflow:y,offset:[0,-4],targetOffset:h},topRight:{points:["br","tr"],overflow:y,offset:[0,-4],targetOffset:h},bottomLeft:{points:["tl","bl"],overflow:y,offset:[0,4],targetOffset:h},bottom:{points:["tc","bc"],overflow:y,offset:[0,4],targetOffset:h},bottomRight:{points:["tr","br"],overflow:y,offset:[0,4],targetOffset:h}},Z=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"],C=f.forwardRef(function(e,n){var t,a,d,y,h,C,E,w,k,M,R,x,N,P,S=e.arrow,I=void 0!==S&&S,K=e.prefixCls,O=void 0===K?"rc-dropdown":K,A=e.transitionName,T=e.animation,L=e.align,D=e.placement,_=e.placements,V=e.getPopupContainer,z=e.showAction,F=e.hideAction,j=e.overlayClassName,B=e.overlayStyle,W=e.visible,H=e.trigger,Y=void 0===H?["hover"]:H,q=e.autoFocus,X=e.overlay,G=e.children,Q=e.onVisibleChange,U=(0,l.Z)(e,Z),J=f.useState(),$=(0,i.Z)(J,2),ee=$[0],en=$[1],et="visible"in e?W:ee,er=f.useRef(null),eo=f.useRef(null),ei=f.useRef(null);f.useImperativeHandle(n,function(){return er.current});var el=function(e){en(e),null==Q||Q(e)};a=(t={visible:et,triggerRef:ei,onVisibleChange:el,autoFocus:q,overlayRef:eo}).visible,d=t.triggerRef,y=t.onVisibleChange,h=t.autoFocus,C=t.overlayRef,E=f.useRef(!1),w=function(){if(a){var e,n;null===(e=d.current)||void 0===e||null===(n=e.focus)||void 0===n||n.call(e),null==y||y(!1)}},k=function(){var e;return null!==(e=C.current)&&void 0!==e&&!!e.focus&&(C.current.focus(),E.current=!0,!0)},M=function(e){switch(e.keyCode){case v:w();break;case m:var n=!1;E.current||(n=k()),n?e.preventDefault():w()}},f.useEffect(function(){return a?(window.addEventListener("keydown",M),h&&(0,p.Z)(k,3),function(){window.removeEventListener("keydown",M),E.current=!1}):function(){E.current=!1}},[a]);var eu=function(){return f.createElement(b,{ref:eo,overlay:X,prefixCls:O,arrow:I})},ea=f.cloneElement(G,{className:c()(null===(P=G.props)||void 0===P?void 0:P.className,et&&(void 0!==(R=e.openClassName)?R:"".concat(O,"-open"))),ref:(0,s.Yr)(G)?(0,s.sQ)(ei,(0,s.C4)(G)):void 0}),ec=F;return ec||-1===Y.indexOf("contextMenu")||(ec=["click"]),f.createElement(u.Z,(0,r.Z)({builtinPlacements:void 0===_?g:_},U,{prefixCls:O,ref:er,popupClassName:c()(j,(0,o.Z)({},"".concat(O,"-show-arrow"),I)),popupStyle:B,action:Y,showAction:z,hideAction:ec,popupPlacement:void 0===D?"bottomLeft":D,popupAlign:L,popupTransitionName:A,popupAnimation:T,popupVisible:et,stretch:(x=e.minOverlayWidthMatchTrigger,N=e.alignPoint,"minOverlayWidthMatchTrigger"in e?x:!N)?"minWidth":"",popup:"function"==typeof X?eu:eu(),onPopupVisibleChange:el,onPopupClick:function(n){var t=e.onOverlayClick;en(!1),t&&t(n)},getPopupContainer:V}),ea)})},33082:function(e,n,t){t.d(n,{iz:function(){return eO},ck:function(){return ev},BW:function(){return eL},sN:function(){return ev},Wd:function(){return eI},ZP:function(){return ej},Xl:function(){return x}});var r=t(1119),o=t(11993),i=t(31686),l=t(83145),u=t(26365),a=t(6989),c=t(36760),s=t.n(c),f=t(1699),d=t(50506),p=t(16671),v=t(32559),m=t(2265),b=t(54887),y=m.createContext(null);function h(e,n){return void 0===e?null:"".concat(e,"-").concat(n)}function g(e){return h(m.useContext(y),e)}var Z=t(6397),C=["children","locked"],E=m.createContext(null);function w(e){var n=e.children,t=e.locked,r=(0,a.Z)(e,C),o=m.useContext(E),l=(0,Z.Z)(function(){var e;return e=(0,i.Z)({},o),Object.keys(r).forEach(function(n){var t=r[n];void 0!==t&&(e[n]=t)}),e},[o,r],function(e,n){return!t&&(e[0]!==n[0]||!(0,p.Z)(e[1],n[1],!0))});return m.createElement(E.Provider,{value:l},n)}var k=m.createContext(null);function M(){return m.useContext(k)}var R=m.createContext([]);function x(e){var n=m.useContext(R);return m.useMemo(function(){return void 0!==e?[].concat((0,l.Z)(n),[e]):n},[n,e])}var N=m.createContext(null),P=m.createContext({}),S=t(2857);function I(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if((0,S.Z)(e)){var t=e.nodeName.toLowerCase(),r=["input","select","textarea","button"].includes(t)||e.isContentEditable||"a"===t&&!!e.getAttribute("href"),o=e.getAttribute("tabindex"),i=Number(o),l=null;return o&&!Number.isNaN(i)?l=i:r&&null===l&&(l=0),r&&e.disabled&&(l=null),null!==l&&(l>=0||n&&l<0)}return!1}var K=t(95814),O=t(53346),A=K.Z.LEFT,T=K.Z.RIGHT,L=K.Z.UP,D=K.Z.DOWN,_=K.Z.ENTER,V=K.Z.ESC,z=K.Z.HOME,F=K.Z.END,j=[L,D,A,T];function B(e,n){return(function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],t=(0,l.Z)(e.querySelectorAll("*")).filter(function(e){return I(e,n)});return I(e,n)&&t.unshift(e),t})(e,!0).filter(function(e){return n.has(e)})}function W(e,n,t){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;if(!e)return null;var o=B(e,n),i=o.length,l=o.findIndex(function(e){return t===e});return r<0?-1===l?l=i-1:l-=1:r>0&&(l+=1),o[l=(l+i)%i]}var H=function(e,n){var t=new Set,r=new Map,o=new Map;return e.forEach(function(e){var i=document.querySelector("[data-menu-id='".concat(h(n,e),"']"));i&&(t.add(i),o.set(i,e),r.set(e,i))}),{elements:t,key2element:r,element2key:o}},Y="__RC_UTIL_PATH_SPLIT__",q=function(e){return e.join(Y)},X="rc-menu-more";function G(e){var n=m.useRef(e);n.current=e;var t=m.useCallback(function(){for(var e,t=arguments.length,r=Array(t),o=0;o1&&(k.motionAppear=!1);var M=k.onVisibleChanged;return(k.onVisibleChanged=function(e){return b.current||e||Z(!0),null==M?void 0:M(e)},g)?null:m.createElement(w,{mode:a,locked:!b.current},m.createElement(eR.ZP,(0,r.Z)({visible:C},k,{forceRender:f,removeOnLeave:!1,leavedClassName:"".concat(s,"-hidden")}),function(e){var t=e.className,r=e.style;return m.createElement(eb,{id:n,className:t,style:r},l)}))}var eN=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],eP=["active"],eS=m.forwardRef(function(e,n){var t=e.style,l=e.className,c=e.title,d=e.eventKey,p=(e.warnKey,e.disabled),v=e.internalPopupClose,b=e.children,y=e.itemIcon,h=e.expandIcon,Z=e.popupClassName,C=e.popupOffset,k=e.popupStyle,M=e.onClick,R=e.onMouseEnter,S=e.onMouseLeave,I=e.onTitleClick,K=e.onTitleMouseEnter,O=e.onTitleMouseLeave,A=(0,a.Z)(e,eN),T=g(d),L=m.useContext(E),D=L.prefixCls,_=L.mode,V=L.openKeys,z=L.disabled,F=L.overflowDisabled,j=L.activeKey,B=L.selectedKeys,W=L.itemIcon,H=L.expandIcon,Y=L.onItemClick,q=L.onOpenChange,X=L.onActive,Q=m.useContext(P)._internalRenderSubMenuItem,U=m.useContext(N).isSubPathKey,J=x(),$="".concat(D,"-submenu"),ee=z||p,en=m.useRef(),et=m.useRef(),er=null!=h?h:H,eu=V.includes(d),ec=!F&&eu,es=U(B,d),ef=eo(d,ee,K,O),ed=ef.active,ep=(0,a.Z)(ef,eP),ev=m.useState(!1),em=(0,u.Z)(ev,2),ey=em[0],eh=em[1],eg=function(e){ee||eh(e)},eZ=m.useMemo(function(){return ed||"inline"!==_&&(ey||U([j],d))},[_,ed,j,ey,d,U]),eC=ei(J.length),eE=G(function(e){null==M||M(ea(e)),Y(e)}),ew=T&&"".concat(T,"-popup"),ek=m.useMemo(function(){return m.createElement(el,{icon:"horizontal"!==_?er:void 0,props:(0,i.Z)((0,i.Z)({},e),{},{isOpen:ec,isSubMenu:!0})},m.createElement("i",{className:"".concat($,"-arrow")}))},[_,er,e,ec,$]),eR=m.createElement("div",(0,r.Z)({role:"menuitem",style:eC,className:"".concat($,"-title"),tabIndex:ee?null:-1,ref:en,title:"string"==typeof c?c:null,"data-menu-id":F&&T?null:T,"aria-expanded":ec,"aria-haspopup":!0,"aria-controls":ew,"aria-disabled":ee,onClick:function(e){ee||(null==I||I({key:d,domEvent:e}),"inline"===_&&q(d,!eu))},onFocus:function(){X(d)}},ep),c,ek),eS=m.useRef(_);if("inline"!==_&&J.length>1?eS.current="vertical":eS.current=_,!F){var eI=eS.current;eR=m.createElement(eM,{mode:eI,prefixCls:$,visible:!v&&ec&&"inline"!==_,popupClassName:Z,popupOffset:C,popupStyle:k,popup:m.createElement(w,{mode:"horizontal"===eI?"vertical":eI},m.createElement(eb,{id:ew,ref:et},b)),disabled:ee,onVisibleChange:function(e){"inline"!==_&&q(d,e)}},eR)}var eK=m.createElement(f.Z.Item,(0,r.Z)({ref:n,role:"none"},A,{component:"li",style:t,className:s()($,"".concat($,"-").concat(_),l,(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},"".concat($,"-open"),ec),"".concat($,"-active"),eZ),"".concat($,"-selected"),es),"".concat($,"-disabled"),ee)),onMouseEnter:function(e){eg(!0),null==R||R({key:d,domEvent:e})},onMouseLeave:function(e){eg(!1),null==S||S({key:d,domEvent:e})}}),eR,!F&&m.createElement(ex,{id:ew,open:ec,keyPath:J},b));return Q&&(eK=Q(eK,e,{selected:es,active:eZ,open:ec,disabled:ee})),m.createElement(w,{onItemClick:eE,mode:"horizontal"===_?"vertical":_,itemIcon:null!=y?y:W,expandIcon:er},eK)}),eI=m.forwardRef(function(e,n){var t,o=e.eventKey,i=e.children,l=x(o),u=eh(i,l),a=M();return m.useEffect(function(){if(a)return a.registerPath(o,l),function(){a.unregisterPath(o,l)}},[l]),t=a?u:m.createElement(eS,(0,r.Z)({ref:n},e),u),m.createElement(R.Provider,{value:l},t)}),eK=t(41154);function eO(e){var n=e.className,t=e.style,r=m.useContext(E).prefixCls;return M()?null:m.createElement("li",{role:"separator",className:s()("".concat(r,"-item-divider"),n),style:t})}var eA=["className","title","eventKey","children"],eT=m.forwardRef(function(e,n){var t=e.className,o=e.title,i=(e.eventKey,e.children),l=(0,a.Z)(e,eA),u=m.useContext(E).prefixCls,c="".concat(u,"-item-group");return m.createElement("li",(0,r.Z)({ref:n,role:"presentation"},l,{onClick:function(e){return e.stopPropagation()},className:s()(c,t)}),m.createElement("div",{role:"presentation",className:"".concat(c,"-title"),title:"string"==typeof o?o:void 0},o),m.createElement("ul",{role:"group",className:"".concat(c,"-list")},i))}),eL=m.forwardRef(function(e,n){var t=e.eventKey,o=eh(e.children,x(t));return M()?o:m.createElement(eT,(0,r.Z)({ref:n},(0,et.Z)(e,["warnKey"])),o)}),eD=["label","children","key","type","extra"];function e_(e,n,t,o,l){var u=e,c=(0,i.Z)({divider:eO,item:ev,group:eL,submenu:eI},o);return n&&(u=function e(n,t,o){var i=t.item,l=t.group,u=t.submenu,c=t.divider;return(n||[]).map(function(n,s){if(n&&"object"===(0,eK.Z)(n)){var f=n.label,d=n.children,p=n.key,v=n.type,b=n.extra,y=(0,a.Z)(n,eD),h=null!=p?p:"tmp-".concat(s);return d||"group"===v?"group"===v?m.createElement(l,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):m.createElement(u,(0,r.Z)({key:h},y,{title:f}),e(d,t,o)):"divider"===v?m.createElement(c,(0,r.Z)({key:h},y)):m.createElement(i,(0,r.Z)({key:h},y,{extra:b}),f,(!!b||0===b)&&m.createElement("span",{className:"".concat(o,"-item-extra")},b))}return null}).filter(function(e){return e})}(n,c,l)),eh(u,t)}var eV=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem","_internalComponents"],ez=[],eF=m.forwardRef(function(e,n){var t,c,v,h,g,Z,C,E,M,R,x,S,I,K,J,$,ee,en,et,er,eo,ei,el,eu,ec,es,ef=e.prefixCls,ed=void 0===ef?"rc-menu":ef,ep=e.rootClassName,em=e.style,eb=e.className,ey=e.tabIndex,eh=e.items,eg=e.children,eZ=e.direction,eC=e.id,eE=e.mode,ew=void 0===eE?"vertical":eE,ek=e.inlineCollapsed,eM=e.disabled,eR=e.disabledOverflow,ex=e.subMenuOpenDelay,eN=e.subMenuCloseDelay,eP=e.forceSubMenuRender,eS=e.defaultOpenKeys,eK=e.openKeys,eO=e.activeKey,eA=e.defaultActiveFirst,eT=e.selectable,eL=void 0===eT||eT,eD=e.multiple,eF=void 0!==eD&&eD,ej=e.defaultSelectedKeys,eB=e.selectedKeys,eW=e.onSelect,eH=e.onDeselect,eY=e.inlineIndent,eq=e.motion,eX=e.defaultMotions,eG=e.triggerSubMenuAction,eQ=e.builtinPlacements,eU=e.itemIcon,eJ=e.expandIcon,e$=e.overflowedIndicator,e0=void 0===e$?"...":e$,e1=e.overflowedIndicatorPopupClassName,e2=e.getPopupContainer,e6=e.onClick,e5=e.onOpenChange,e9=e.onKeyDown,e3=(e.openAnimation,e.openTransitionName,e._internalRenderMenuItem),e4=e._internalRenderSubMenuItem,e8=e._internalComponents,e7=(0,a.Z)(e,eV),ne=m.useMemo(function(){return[e_(eg,eh,ez,e8,ed),e_(eg,eh,ez,{},ed)]},[eg,eh,e8]),nn=(0,u.Z)(ne,2),nt=nn[0],nr=nn[1],no=m.useState(!1),ni=(0,u.Z)(no,2),nl=ni[0],nu=ni[1],na=m.useRef(),nc=(t=(0,d.Z)(eC,{value:eC}),v=(c=(0,u.Z)(t,2))[0],h=c[1],m.useEffect(function(){U+=1;var e="".concat(Q,"-").concat(U);h("rc-menu-uuid-".concat(e))},[]),v),ns="rtl"===eZ,nf=(0,d.Z)(eS,{value:eK,postState:function(e){return e||ez}}),nd=(0,u.Z)(nf,2),np=nd[0],nv=nd[1],nm=function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function t(){nv(e),null==e5||e5(e)}n?(0,b.flushSync)(t):t()},nb=m.useState(np),ny=(0,u.Z)(nb,2),nh=ny[0],ng=ny[1],nZ=m.useRef(!1),nC=m.useMemo(function(){return("inline"===ew||"vertical"===ew)&&ek?["vertical",ek]:[ew,!1]},[ew,ek]),nE=(0,u.Z)(nC,2),nw=nE[0],nk=nE[1],nM="inline"===nw,nR=m.useState(nw),nx=(0,u.Z)(nR,2),nN=nx[0],nP=nx[1],nS=m.useState(nk),nI=(0,u.Z)(nS,2),nK=nI[0],nO=nI[1];m.useEffect(function(){nP(nw),nO(nk),nZ.current&&(nM?nv(nh):nm(ez))},[nw,nk]);var nA=m.useState(0),nT=(0,u.Z)(nA,2),nL=nT[0],nD=nT[1],n_=nL>=nt.length-1||"horizontal"!==nN||eR;m.useEffect(function(){nM&&ng(np)},[np]),m.useEffect(function(){return nZ.current=!0,function(){nZ.current=!1}},[]);var nV=(g=m.useState({}),Z=(0,u.Z)(g,2)[1],C=(0,m.useRef)(new Map),E=(0,m.useRef)(new Map),M=m.useState([]),x=(R=(0,u.Z)(M,2))[0],S=R[1],I=(0,m.useRef)(0),K=(0,m.useRef)(!1),J=function(){K.current||Z({})},$=(0,m.useCallback)(function(e,n){var t,r=q(n);E.current.set(r,e),C.current.set(e,r),I.current+=1;var o=I.current;t=function(){o===I.current&&J()},Promise.resolve().then(t)},[]),ee=(0,m.useCallback)(function(e,n){var t=q(n);E.current.delete(t),C.current.delete(e)},[]),en=(0,m.useCallback)(function(e){S(e)},[]),et=(0,m.useCallback)(function(e,n){var t=(C.current.get(e)||"").split(Y);return n&&x.includes(t[0])&&t.unshift(X),t},[x]),er=(0,m.useCallback)(function(e,n){return e.filter(function(e){return void 0!==e}).some(function(e){return et(e,!0).includes(n)})},[et]),eo=(0,m.useCallback)(function(e){var n="".concat(C.current.get(e)).concat(Y),t=new Set;return(0,l.Z)(E.current.keys()).forEach(function(e){e.startsWith(n)&&t.add(E.current.get(e))}),t},[]),m.useEffect(function(){return function(){K.current=!0}},[]),{registerPath:$,unregisterPath:ee,refreshOverflowKeys:en,isSubPathKey:er,getKeyPath:et,getKeys:function(){var e=(0,l.Z)(C.current.keys());return x.length&&e.push(X),e},getSubPathKeys:eo}),nz=nV.registerPath,nF=nV.unregisterPath,nj=nV.refreshOverflowKeys,nB=nV.isSubPathKey,nW=nV.getKeyPath,nH=nV.getKeys,nY=nV.getSubPathKeys,nq=m.useMemo(function(){return{registerPath:nz,unregisterPath:nF}},[nz,nF]),nX=m.useMemo(function(){return{isSubPathKey:nB}},[nB]);m.useEffect(function(){nj(n_?ez:nt.slice(nL+1).map(function(e){return e.key}))},[nL,n_]);var nG=(0,d.Z)(eO||eA&&(null===(es=nt[0])||void 0===es?void 0:es.key),{value:eO}),nQ=(0,u.Z)(nG,2),nU=nQ[0],nJ=nQ[1],n$=G(function(e){nJ(e)}),n0=G(function(){nJ(void 0)});(0,m.useImperativeHandle)(n,function(){return{list:na.current,focus:function(e){var n,t,r=H(nH(),nc),o=r.elements,i=r.key2element,l=r.element2key,u=B(na.current,o),a=null!=nU?nU:u[0]?l.get(u[0]):null===(n=nt.find(function(e){return!e.props.disabled}))||void 0===n?void 0:n.key,c=i.get(a);a&&c&&(null==c||null===(t=c.focus)||void 0===t||t.call(c,e))}}});var n1=(0,d.Z)(ej||[],{value:eB,postState:function(e){return Array.isArray(e)?e:null==e?ez:[e]}}),n2=(0,u.Z)(n1,2),n6=n2[0],n5=n2[1],n9=function(e){if(eL){var n,t=e.key,r=n6.includes(t);n5(n=eF?r?n6.filter(function(e){return e!==t}):[].concat((0,l.Z)(n6),[t]):[t]);var o=(0,i.Z)((0,i.Z)({},e),{},{selectedKeys:n});r?null==eH||eH(o):null==eW||eW(o)}!eF&&np.length&&"inline"!==nN&&nm(ez)},n3=G(function(e){null==e6||e6(ea(e)),n9(e)}),n4=G(function(e,n){var t=np.filter(function(n){return n!==e});if(n)t.push(e);else if("inline"!==nN){var r=nY(e);t=t.filter(function(e){return!r.has(e)})}(0,p.Z)(np,t,!0)||nm(t,!0)}),n8=(ei=function(e,n){var t=null!=n?n:!np.includes(e);n4(e,t)},el=m.useRef(),(eu=m.useRef()).current=nU,ec=function(){O.Z.cancel(el.current)},m.useEffect(function(){return function(){ec()}},[]),function(e){var n=e.which;if([].concat(j,[_,V,z,F]).includes(n)){var t=nH(),r=H(t,nc),i=r,l=i.elements,u=i.key2element,a=i.element2key,c=function(e,n){for(var t=e||document.activeElement;t;){if(n.has(t))return t;t=t.parentElement}return null}(u.get(nU),l),s=a.get(c),f=function(e,n,t,r){var i,l="prev",u="next",a="children",c="parent";if("inline"===e&&r===_)return{inlineTrigger:!0};var s=(0,o.Z)((0,o.Z)({},L,l),D,u),f=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},A,t?u:l),T,t?l:u),D,a),_,a),d=(0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)((0,o.Z)({},L,l),D,u),_,a),V,c),A,t?a:c),T,t?c:a);switch(null===(i=({inline:s,horizontal:f,vertical:d,inlineSub:s,horizontalSub:d,verticalSub:d})["".concat(e).concat(n?"":"Sub")])||void 0===i?void 0:i[r]){case l:return{offset:-1,sibling:!0};case u:return{offset:1,sibling:!0};case c:return{offset:-1,sibling:!1};case a:return{offset:1,sibling:!1};default:return null}}(nN,1===nW(s,!0).length,ns,n);if(!f&&n!==z&&n!==F)return;(j.includes(n)||[z,F].includes(n))&&e.preventDefault();var d=function(e){if(e){var n=e,t=e.querySelector("a");null!=t&&t.getAttribute("href")&&(n=t);var r=a.get(e);nJ(r),ec(),el.current=(0,O.Z)(function(){eu.current===r&&n.focus()})}};if([z,F].includes(n)||f.sibling||!c){var p,v=B(p=c&&"inline"!==nN?function(e){for(var n=e;n;){if(n.getAttribute("data-menu-list"))return n;n=n.parentElement}return null}(c):na.current,l);d(n===z?v[0]:n===F?v[v.length-1]:W(p,l,c,f.offset))}else if(f.inlineTrigger)ei(s);else if(f.offset>0)ei(s,!0),ec(),el.current=(0,O.Z)(function(){r=H(t,nc);var e=c.getAttribute("aria-controls");d(W(document.getElementById(e),r.elements))},5);else if(f.offset<0){var m=nW(s,!0),b=m[m.length-2],y=u.get(b);ei(b,!1),d(y)}}null==e9||e9(e)});m.useEffect(function(){nu(!0)},[]);var n7=m.useMemo(function(){return{_internalRenderMenuItem:e3,_internalRenderSubMenuItem:e4}},[e3,e4]),te="horizontal"!==nN||eR?nt:nt.map(function(e,n){return m.createElement(w,{key:e.key,overflowDisabled:n>nL},e)}),tn=m.createElement(f.Z,(0,r.Z)({id:eC,ref:na,prefixCls:"".concat(ed,"-overflow"),component:"ul",itemComponent:ev,className:s()(ed,"".concat(ed,"-root"),"".concat(ed,"-").concat(nN),eb,(0,o.Z)((0,o.Z)({},"".concat(ed,"-inline-collapsed"),nK),"".concat(ed,"-rtl"),ns),ep),dir:eZ,style:em,role:"menu",tabIndex:void 0===ey?0:ey,data:te,renderRawItem:function(e){return e},renderRawRest:function(e){var n=e.length,t=n?nt.slice(-n):null;return m.createElement(eI,{eventKey:X,title:e0,disabled:n_,internalPopupClose:0===n,popupClassName:e1},t)},maxCount:"horizontal"!==nN||eR?f.Z.INVALIDATE:f.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(e){nD(e)},onKeyDown:n8},e7));return m.createElement(P.Provider,{value:n7},m.createElement(y.Provider,{value:nc},m.createElement(w,{prefixCls:ed,rootClassName:ep,mode:nN,openKeys:np,rtl:ns,disabled:eM,motion:nl?eq:null,defaultMotions:nl?eX:null,activeKey:nU,onActive:n$,onInactive:n0,selectedKeys:n6,inlineIndent:void 0===eY?24:eY,subMenuOpenDelay:void 0===ex?.1:ex,subMenuCloseDelay:void 0===eN?.1:eN,forceSubMenuRender:eP,builtinPlacements:eQ,triggerSubMenuAction:void 0===eG?"hover":eG,getPopupContainer:e2,itemIcon:eU,expandIcon:eJ,onItemClick:n3,onOpenChange:n4},m.createElement(N.Provider,{value:nX},tn),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(k.Provider,{value:nq},nr)))))});eF.Item=ev,eF.SubMenu=eI,eF.ItemGroup=eL,eF.Divider=eO;var ej=eF}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3492-e51306a03d83393c.js b/litellm/proxy/_experimental/out/_next/static/chunks/3492-e51306a03d83393c.js deleted file mode 100644 index 3945f65e2b..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/3492-e51306a03d83393c.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3492],{88009:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(1119),o=r(2265),a={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"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},11429:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M766.4 744.3c43.7 0 79.4-36.2 79.4-80.5 0-53.5-79.4-140.8-79.4-140.8S687 610.3 687 663.8c0 44.3 35.7 80.5 79.4 80.5zm-377.1-44.1c7.1 7.1 18.6 7.1 25.6 0l256.1-256c7.1-7.1 7.1-18.6 0-25.6l-256-256c-.6-.6-1.3-1.2-2-1.7l-78.2-78.2a9.11 9.11 0 00-12.8 0l-48 48a9.11 9.11 0 000 12.8l67.2 67.2-207.8 207.9c-7.1 7.1-7.1 18.6 0 25.6l255.9 256zm12.9-448.6l178.9 178.9H223.4l178.8-178.9zM904 816H120c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8z"}}]},name:"bg-colors",theme:"outlined"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},68208:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(1119),o=r(2265),a={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"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},99458:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-792 72h752v120H136V232zm752 560H136V440h752v352zm-237-64h165c4.4 0 8-3.6 8-8v-72c0-4.4-3.6-8-8-8H651c-4.4 0-8 3.6-8 8v72c0 4.4 3.6 8 8 8z"}}]},name:"credit-card",theme:"outlined"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},41169:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});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 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"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},60216:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0010.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 00-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z"}}]},name:"file-excel",theme:"outlined"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},10798:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(1119),o=r(2265),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"}}]},name:"filter",theme:"outlined"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},45246:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});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"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},28595:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});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"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},34419:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});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 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.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:"plus-circle",theme:"outlined"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},89245:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});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"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},78355:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});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"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},23907:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(1119),o=r(2265),a={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"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},8881:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});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-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},l=r(55015),c=o.forwardRef(function(e,t){return o.createElement(l.Z,(0,n.Z)({},e,{ref:t,icon:a}))})},59341:function(e,t,r){"use strict";r.d(t,{Z:function(){return L}});var n=r(5853),o=r(71049),a=r(11323),l=r(2265),c=r(66797),i=r(40099),s=r(74275),u=r(59456),d=r(93980),h=r(65573),m=r(67561),p=r(87550),f=r(628),g=r(80281),b=r(31370),k=r(20131),v=r(38929),y=r(52307),w=r(52724),x=r(7935);let E=(0,l.createContext)(null);E.displayName="GroupContext";let Z=l.Fragment,M=Object.assign((0,v.yV)(function(e,t){var r;let n=(0,l.useId)(),Z=(0,g.Q)(),M=(0,p.B)(),{id:C=Z||"headlessui-switch-".concat(n),disabled:O=M||!1,checked:z,defaultChecked:N,onChange:j,name:S,value:L,form:R,autoFocus:V=!1,...H}=e,q=(0,l.useContext)(E),[F,B]=(0,l.useState)(null),_=(0,l.useRef)(null),I=(0,m.T)(_,t,null===q?null:q.setSwitch,B),P=(0,s.L)(N),[T,A]=(0,i.q)(z,j,null!=P&&P),D=(0,u.G)(),[W,K]=(0,l.useState)(!1),G=(0,d.z)(()=>{K(!0),null==A||A(!T),D.nextFrame(()=>{K(!1)})}),J=(0,d.z)(e=>{if((0,b.P)(e.currentTarget))return e.preventDefault();e.preventDefault(),G()}),U=(0,d.z)(e=>{e.key===w.R.Space?(e.preventDefault(),G()):e.key===w.R.Enter&&(0,k.g)(e.currentTarget)}),Y=(0,d.z)(e=>e.preventDefault()),X=(0,x.wp)(),$=(0,y.zH)(),{isFocusVisible:Q,focusProps:ee}=(0,o.F)({autoFocus:V}),{isHovered:et,hoverProps:er}=(0,a.X)({isDisabled:O}),{pressed:en,pressProps:eo}=(0,c.x)({disabled:O}),ea=(0,l.useMemo)(()=>({checked:T,disabled:O,hover:et,focus:Q,active:en,autofocus:V,changing:W}),[T,et,Q,en,O,W,V]),el=(0,v.dG)({id:C,ref:I,role:"switch",type:(0,h.f)(e,F),tabIndex:-1===e.tabIndex?0:null!=(r=e.tabIndex)?r:0,"aria-checked":T,"aria-labelledby":X,"aria-describedby":$,disabled:O||void 0,autoFocus:V,onClick:J,onKeyUp:U,onKeyPress:Y},ee,er,eo),ec=(0,l.useCallback)(()=>{if(void 0!==P)return null==A?void 0:A(P)},[A,P]),ei=(0,v.L6)();return l.createElement(l.Fragment,null,null!=S&&l.createElement(f.Mt,{disabled:O,data:{[S]:L||"on"},overrides:{type:"checkbox",checked:T},form:R,onReset:ec}),ei({ourProps:el,theirProps:H,slot:ea,defaultTag:"button",name:"Switch"}))}),{Group:function(e){var t;let[r,n]=(0,l.useState)(null),[o,a]=(0,x.bE)(),[c,i]=(0,y.fw)(),s=(0,l.useMemo)(()=>({switch:r,setSwitch:n}),[r,n]),u=(0,v.L6)();return l.createElement(i,{name:"Switch.Description",value:c},l.createElement(a,{name:"Switch.Label",value:o,props:{htmlFor:null==(t=s.switch)?void 0:t.id,onClick(e){r&&(e.currentTarget instanceof HTMLLabelElement&&e.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},l.createElement(E.Provider,{value:s},u({ourProps:{},theirProps:e,slot:{},defaultTag:Z,name:"Switch.Group"}))))},Label:x.__,Description:y.dk});var C=r(44140),O=r(26898),z=r(13241),N=r(1153),j=r(47187);let S=(0,N.fn)("Switch"),L=l.forwardRef((e,t)=>{let{checked:r,defaultChecked:o=!1,onChange:a,color:c,name:i,error:s,errorMessage:u,disabled:d,required:h,tooltip:m,id:p}=e,f=(0,n._T)(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g={bgColor:c?(0,N.bM)(c,O.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:c?(0,N.bM)(c,O.K.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"},[b,k]=(0,C.Z)(o,r),[v,y]=(0,l.useState)(!1),{tooltipProps:w,getReferenceProps:x}=(0,j.l)(300);return l.createElement("div",{className:"flex flex-row items-center justify-start"},l.createElement(j.Z,Object.assign({text:m},w)),l.createElement("div",Object.assign({ref:(0,N.lq)([t,w.refs.setReference]),className:(0,z.q)(S("root"),"flex flex-row relative h-5")},f,x),l.createElement("input",{type:"checkbox",className:(0,z.q)(S("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:h,checked:b,onChange:e=>{e.preventDefault()}}),l.createElement(M,{checked:b,onChange:e=>{k(e),null==a||a(e)},disabled:d,className:(0,z.q)(S("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:()=>y(!0),onBlur:()=>y(!1),id:p},l.createElement("span",{className:(0,z.q)(S("sr-only"),"sr-only")},"Switch ",b?"on":"off"),l.createElement("span",{"aria-hidden":"true",className:(0,z.q)(S("background"),b?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")}),l.createElement("span",{"aria-hidden":"true",className:(0,z.q)(S("round"),b?(0,z.q)(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",v?(0,z.q)("ring-2",g.ringColor):"")}))),s&&u?l.createElement("p",{className:(0,z.q)(S("errorMessage"),"text-sm text-red-500 mt-1 ")},u):null)});L.displayName="Switch"},96889:function(e,t,r){"use strict";r.d(t,{Z:function(){return u}});var n=r(5853),o=r(2265),a=r(26898),l=r(13241),c=r(1153);let i=(0,c.fn)("BarList");function s(e,t){let{data:r=[],color:s,valueFormatter:u=c.Cj,showAnimation:d=!1,onValueChange:h,sortOrder:m="descending",className:p}=e,f=(0,n._T)(e,["data","color","valueFormatter","showAnimation","onValueChange","sortOrder","className"]),g=h?"button":"div",b=o.useMemo(()=>"none"===m?r:[...r].sort((e,t)=>"ascending"===m?e.value-t.value:t.value-e.value),[r,m]),k=o.useMemo(()=>{let e=Math.max(...b.map(e=>e.value),0);return b.map(t=>0===t.value?0:Math.max(t.value/e*100,2))},[b]);return o.createElement("div",Object.assign({ref:t,className:(0,l.q)(i("root"),"flex justify-between space-x-6",p),"aria-sort":m},f),o.createElement("div",{className:(0,l.q)(i("bars"),"relative w-full space-y-1.5")},b.map((e,t)=>{var r,n,u;let m=e.icon;return o.createElement(g,{key:null!==(r=e.key)&&void 0!==r?r:t,onClick:()=>{null==h||h(e)},className:(0,l.q)(i("bar"),"group w-full flex items-center rounded-tremor-small",h?["cursor-pointer","hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-subtle/40"]:"")},o.createElement("div",{className:(0,l.q)("flex items-center rounded transition-all bg-opacity-40","h-8",e.color||s?[(0,c.bM)(null!==(n=e.color)&&void 0!==n?n:s,a.K.background).bgColor,h?"group-hover:bg-opacity-30":""]:"bg-tremor-brand-subtle dark:bg-dark-tremor-brand-subtle/60",!h||e.color||s?"":"group-hover:bg-tremor-brand-subtle/30 group-hover:dark:bg-dark-tremor-brand-subtle/70",t===b.length-1?"mb-0":"",d?"duration-500":""),style:{width:"".concat(k[t],"%"),transition:d?"all 1s":""}},o.createElement("div",{className:(0,l.q)("absolute left-2 pr-4 flex max-w-full")},m?o.createElement(m,{className:(0,l.q)(i("barIcon"),"flex-none h-5 w-5 mr-2","text-tremor-content","dark:text-dark-tremor-content")}):null,e.href?o.createElement("a",{href:e.href,target:null!==(u=e.target)&&void 0!==u?u:"_blank",rel:"noreferrer",className:(0,l.q)(i("barLink"),"whitespace-nowrap hover:underline truncate text-tremor-default",h?"cursor-pointer":"","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis"),onClick:e=>e.stopPropagation()},e.name):o.createElement("p",{className:(0,l.q)(i("barText"),"whitespace-nowrap truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e.name))))})),o.createElement("div",{className:i("labels")},b.map((e,t)=>{var r;return o.createElement("div",{key:null!==(r=e.key)&&void 0!==r?r:t,className:(0,l.q)(i("labelWrapper"),"flex justify-end items-center","h-8",t===b.length-1?"mb-0":"mb-1.5")},o.createElement("p",{className:(0,l.q)(i("labelText"),"whitespace-nowrap leading-none truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},u(e.value)))})))}s.displayName="BarList";let u=o.forwardRef(s)},69410:function(e,t,r){"use strict";var n=r(54998);t.Z=n.Z},13817:function(e,t,r){"use strict";r.d(t,{default:function(){return w}});var n=r(83145),o=r(2265),a=r(36760),l=r.n(a),c=r(18694),i=r(71744),s=r(80856),u=r(45287),d=r(32186),h=r(25437),m=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};function p(e){let{suffixCls:t,tagName:r,displayName:n}=e;return e=>o.forwardRef((n,a)=>o.createElement(e,Object.assign({ref:a,suffixCls:t,tagName:r},n)))}let f=o.forwardRef((e,t)=>{let{prefixCls:r,suffixCls:n,className:a,tagName:c}=e,s=m(e,["prefixCls","suffixCls","className","tagName"]),{getPrefixCls:u}=o.useContext(i.E_),d=u("layout",r),[p,f,g]=(0,h.ZP)(d),b=n?"".concat(d,"-").concat(n):d;return p(o.createElement(c,Object.assign({className:l()(r||b,a,f,g),ref:t},s)))}),g=o.forwardRef((e,t)=>{let{direction:r}=o.useContext(i.E_),[a,p]=o.useState([]),{prefixCls:f,className:g,rootClassName:b,children:k,hasSider:v,tagName:y,style:w}=e,x=m(e,["prefixCls","className","rootClassName","children","hasSider","tagName","style"]),E=(0,c.Z)(x,["suffixCls"]),{getPrefixCls:Z,className:M,style:C}=(0,i.dj)("layout"),O=Z("layout",f),z="boolean"==typeof v?v:!!a.length||(0,u.Z)(k).some(e=>e.type===d.Z),[N,j,S]=(0,h.ZP)(O),L=l()(O,{["".concat(O,"-has-sider")]:z,["".concat(O,"-rtl")]:"rtl"===r},M,g,b,j,S),R=o.useMemo(()=>({siderHook:{addSider:e=>{p(t=>[].concat((0,n.Z)(t),[e]))},removeSider:e=>{p(t=>t.filter(t=>t!==e))}}}),[]);return N(o.createElement(s.V.Provider,{value:R},o.createElement(y,Object.assign({ref:t,className:L,style:Object.assign(Object.assign({},C),w)},E),k)))}),b=p({tagName:"div",displayName:"Layout"})(g),k=p({suffixCls:"header",tagName:"header",displayName:"Header"})(f),v=p({suffixCls:"footer",tagName:"footer",displayName:"Footer"})(f),y=p({suffixCls:"content",tagName:"main",displayName:"Content"})(f);b.Header=k,b.Footer=v,b.Content=y,b.Sider=d.Z,b._InternalSiderContext=d.D;var w=b},867:function(e,t,r){"use strict";r.d(t,{Z:function(){return M}});var n=r(2265),o=r(54537),a=r(36760),l=r.n(a),c=r(50506),i=r(18694),s=r(71744),u=r(79326),d=r(59367),h=r(92570),m=r(5545),p=r(51248),f=r(55274),g=r(37381),b=r(20435),k=r(99320);let v=e=>{let{componentCls:t,iconCls:r,antCls:n,zIndexPopup:o,colorText:a,colorWarning:l,marginXXS:c,marginXS:i,fontSize:s,fontWeightStrong:u,colorTextHeading:d}=e;return{[t]:{zIndex:o,["&".concat(n,"-popover")]:{fontSize:s},["".concat(t,"-message")]:{marginBottom:i,display:"flex",flexWrap:"nowrap",alignItems:"start",["> ".concat(t,"-message-icon ").concat(r)]:{color:l,fontSize:s,lineHeight:1,marginInlineEnd:i},["".concat(t,"-title")]:{fontWeight:u,color:d,"&:only-child":{fontWeight:"normal"}},["".concat(t,"-description")]:{marginTop:c,color:a}},["".concat(t,"-buttons")]:{textAlign:"end",whiteSpace:"nowrap",button:{marginInlineStart:i}}}}};var y=(0,k.I$)("Popconfirm",e=>v(e),e=>{let{zIndexPopupBase:t}=e;return{zIndexPopup:t+60}},{resetStyle:!1}),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=e=>{let{prefixCls:t,okButtonProps:r,cancelButtonProps:a,title:l,description:c,cancelText:i,okText:u,okType:b="primary",icon:k=n.createElement(o.Z,null),showCancel:v=!0,close:y,onConfirm:w,onCancel:x,onPopupClick:E}=e,{getPrefixCls:Z}=n.useContext(s.E_),[M]=(0,f.Z)("Popconfirm",g.Z.Popconfirm),C=(0,h.Z)(l),O=(0,h.Z)(c);return n.createElement("div",{className:"".concat(t,"-inner-content"),onClick:E},n.createElement("div",{className:"".concat(t,"-message")},k&&n.createElement("span",{className:"".concat(t,"-message-icon")},k),n.createElement("div",{className:"".concat(t,"-message-text")},C&&n.createElement("div",{className:"".concat(t,"-title")},C),O&&n.createElement("div",{className:"".concat(t,"-description")},O))),n.createElement("div",{className:"".concat(t,"-buttons")},v&&n.createElement(m.ZP,Object.assign({onClick:x,size:"small"},a),i||(null==M?void 0:M.cancelText)),n.createElement(d.Z,{buttonProps:Object.assign(Object.assign({size:"small"},(0,p.nx)(b)),r),actionFn:w,close:y,prefixCls:Z("btn"),quitOnNullishReturnValue:!0,emitEvent:!0},u||(null==M?void 0:M.okText))))};var E=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)=>{var r,a;let{prefixCls:d,placement:h="top",trigger:m="click",okType:p="primary",icon:f=n.createElement(o.Z,null),children:g,overlayClassName:b,onOpenChange:k,onVisibleChange:v,overlayStyle:w,styles:Z,classNames:M}=e,C=E(e,["prefixCls","placement","trigger","okType","icon","children","overlayClassName","onOpenChange","onVisibleChange","overlayStyle","styles","classNames"]),{getPrefixCls:O,className:z,style:N,classNames:j,styles:S}=(0,s.dj)("popconfirm"),[L,R]=(0,c.Z)(!1,{value:null!==(r=e.open)&&void 0!==r?r:e.visible,defaultValue:null!==(a=e.defaultOpen)&&void 0!==a?a:e.defaultVisible}),V=(e,t)=>{R(e,!0),null==v||v(e),null==k||k(e,t)},H=O("popconfirm",d),q=l()(H,z,b,j.root,null==M?void 0:M.root),F=l()(j.body,null==M?void 0:M.body),[B]=y(H);return B(n.createElement(u.Z,Object.assign({},(0,i.Z)(C,["title"]),{trigger:m,placement:h,onOpenChange:(t,r)=>{let{disabled:n=!1}=e;n||V(t,r)},open:L,ref:t,classNames:{root:q,body:F},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},S.root),N),w),null==Z?void 0:Z.root),body:Object.assign(Object.assign({},S.body),null==Z?void 0:Z.body)},content:n.createElement(x,Object.assign({okType:p,icon:f},e,{prefixCls:H,close:e=>{V(!1,e)},onConfirm:t=>{var r;return null===(r=e.onConfirm)||void 0===r?void 0:r.call(void 0,t)},onCancel:t=>{var r;V(!1,t),null===(r=e.onCancel)||void 0===r||r.call(void 0,t)}})),"data-popover-inject":!0}),g))});Z._InternalPanelDoNotUseOrYouWillBeFired=e=>{let{prefixCls:t,placement:r,className:o,style:a}=e,c=w(e,["prefixCls","placement","className","style"]),{getPrefixCls:i}=n.useContext(s.E_),u=i("popconfirm",t),[d]=y(u);return d(n.createElement(b.ZP,{placement:r,className:l()(u,o),style:a,content:n.createElement(x,Object.assign({prefixCls:u},c))}))};var M=Z},47451:function(e,t,r){"use strict";var n=r(77774);t.Z=n.Z},45235:function(e,t,r){"use strict";r.d(t,{Z:function(){return Z}});var n=r(2265),o=r(74126),a=r(53346),l=r(19722),c=r(36760),i=r.n(c),s=r(18242),u=r(71744),d=r(50337),h=e=>{let t;let{value:r,formatter:o,precision:a,decimalSeparator:l,groupSeparator:c="",prefixCls:i}=e;if("function"==typeof o)t=o(r);else{let e=String(r),o=e.match(/^(-?)(\d*)(\.(\d+))?$/);if(o&&"-"!==e){let e=o[1],r=o[2]||"0",s=o[4]||"";r=r.replace(/\B(?=(\d{3})+(?!\d))/g,c),"number"==typeof a&&(s=s.padEnd(a,"0").slice(0,a>0?a:0)),s&&(s="".concat(l).concat(s)),t=[n.createElement("span",{key:"int",className:"".concat(i,"-content-value-int")},e,r),s&&n.createElement("span",{key:"decimal",className:"".concat(i,"-content-value-decimal")},s)]}else t=e}return n.createElement("span",{className:"".concat(i,"-content-value")},t)},m=r(12918),p=r(99320),f=r(71140);let g=e=>{let{componentCls:t,marginXXS:r,padding:n,colorTextDescription:o,titleFontSize:a,colorTextHeading:l,contentFontSize:c,fontFamily:i}=e;return{[t]:Object.assign(Object.assign({},(0,m.Wf)(e)),{["".concat(t,"-title")]:{marginBottom:r,color:o,fontSize:a},["".concat(t,"-skeleton")]:{paddingTop:n},["".concat(t,"-content")]:{color:l,fontSize:c,fontFamily:i,["".concat(t,"-content-value")]:{display:"inline-block",direction:"ltr"},["".concat(t,"-content-prefix, ").concat(t,"-content-suffix")]:{display:"inline-block"},["".concat(t,"-content-prefix")]:{marginInlineEnd:r},["".concat(t,"-content-suffix")]:{marginInlineStart:r}}})}};var b=(0,p.I$)("Statistic",e=>g((0,f.IX)(e,{})),e=>{let{fontSizeHeading3:t,fontSize:r}=e;return{titleFontSize:r,contentFontSize:t}}),k=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 v=n.forwardRef((e,t)=>{let{prefixCls:r,className:o,rootClassName:a,style:l,valueStyle:c,value:m=0,title:p,valueRender:f,prefix:g,suffix:v,loading:y=!1,formatter:w,precision:x,decimalSeparator:E=".",groupSeparator:Z=",",onMouseEnter:M,onMouseLeave:C}=e,O=k(e,["prefixCls","className","rootClassName","style","valueStyle","value","title","valueRender","prefix","suffix","loading","formatter","precision","decimalSeparator","groupSeparator","onMouseEnter","onMouseLeave"]),{getPrefixCls:z,direction:N,className:j,style:S}=(0,u.dj)("statistic"),L=z("statistic",r),[R,V,H]=b(L),q=n.createElement(h,{decimalSeparator:E,groupSeparator:Z,prefixCls:L,formatter:w,precision:x,value:m}),F=i()(L,{["".concat(L,"-rtl")]:"rtl"===N},j,o,a,V,H),B=n.useRef(null);n.useImperativeHandle(t,()=>({nativeElement:B.current}));let _=(0,s.Z)(O,{aria:!0,data:!0});return R(n.createElement("div",Object.assign({},_,{ref:B,className:F,style:Object.assign(Object.assign({},S),l),onMouseEnter:M,onMouseLeave:C}),p&&n.createElement("div",{className:"".concat(L,"-title")},p),n.createElement(d.Z,{paragraph:!1,loading:y,className:"".concat(L,"-skeleton"),active:!0},n.createElement("div",{style:c,className:"".concat(L,"-content")},g&&n.createElement("span",{className:"".concat(L,"-content-prefix")},g),f?f(q):q,v&&n.createElement("span",{className:"".concat(L,"-content-suffix")},v)))))}),y=[["Y",31536e6],["M",2592e6],["D",864e5],["H",36e5],["m",6e4],["s",1e3],["S",1]];var 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},x=e=>{let{value:t,format:r="HH:mm:ss",onChange:c,onFinish:i,type:s}=e,u=w(e,["value","format","onChange","onFinish","type"]),d="countdown"===s,[h,m]=n.useState(null),p=(0,o.zX)(()=>{let e=Date.now(),r=new Date(t).getTime();return m({}),null==c||c(d?r-e:e-r),!d||!(r{let e;let t=()=>{e=(0,a.Z)(()=>{p()&&t()})};return t(),()=>a.Z.cancel(e)},[t,d]),n.useEffect(()=>{m({})},[]),n.createElement(v,Object.assign({},u,{value:t,valueRender:e=>(0,l.Tm)(e,{title:void 0}),formatter:(e,t)=>h?function(e,t,r){let{format:n=""}=t,o=new Date(e).getTime(),a=Date.now();return function(e,t){let r=e,n=/\[[^\]]*]/g,o=(t.match(n)||[]).map(e=>e.slice(1,-1)),a=t.replace(n,"[]"),l=y.reduce((e,t)=>{let[n,o]=t;if(e.includes(n)){let t=Math.floor(r/o);return r-=t*o,e.replace(RegExp("".concat(n,"+"),"g"),e=>{let r=e.length;return t.toString().padStart(r,"0")})}return e},a),c=0;return l.replace(n,()=>{let e=o[c];return c+=1,e})}(r?Math.max(o-a,0):Math.max(a-o,0),n)}(e,Object.assign(Object.assign({},t),{format:r}),d):"-"}))},E=n.memo(e=>n.createElement(x,Object.assign({},e,{type:"countdown"})));v.Timer=x,v.Countdown=E;var Z=v},76858:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},82222:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},40875:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},22135:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},41671:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},5136:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]])},64935:function(e,t,r){"use strict";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"}]])},96362:function(e,t,r){"use strict";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"}]])},87769:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]])},42208:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},3577:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]])},29202:function(e,t,r){"use strict";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"}]])},33245:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},54001:function(e,t,r){"use strict";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"}]])},51817:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},11:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("message-square",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},21047:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},33276:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},69076:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},73247:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},96137:function(e,t,r){"use strict";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"}]])},88906:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},15868:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]])},80221:function(e,t,r){"use strict";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"}]])},18930:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},70525:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]])},76865:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},17689:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]])},49663:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("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"}]])},79862:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]])},92369:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},95805:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("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"}]])},11239:function(e,t,r){"use strict";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"}]])},86669:function(e,t,r){"use strict";r.d(t,{gc:function(){return y},jF:function(){return k}});var n=r(2265);let o=e=>"boolean"==typeof e||e instanceof Boolean,a=e=>"number"==typeof e||e instanceof Number,l=e=>"bigint"==typeof e||e instanceof BigInt,c=e=>!!e&&e instanceof Date,i=e=>"string"==typeof e||e instanceof String,s=e=>Array.isArray(e),u=e=>"object"==typeof e&&null!==e,d=e=>!!e&&e instanceof Object&&"function"==typeof e;function h(e,t){return void 0===t&&(t=!1),!e||t?`"${e}"`:e}function m(e){let{field:t,value:r,data:o,lastElement:a,openBracket:l,closeBracket:c,level:i,style:s,shouldExpandNode:u,clickToExpandNode:d,outerRef:m,beforeExpandChange:p}=e,f=(0,n.useRef)(!1),[g,k]=(0,n.useState)(()=>u(i,r,t)),v=(0,n.useRef)(null);(0,n.useEffect)(()=>{f.current?k(u(i,r,t)):f.current=!0},[u]);let y=(0,n.useId)();if(0===o.length)return function(e){let{field:t,openBracket:r,closeBracket:o,lastElement:a,style:l}=e;return(0,n.createElement)("div",{className:l.basicChildStyle,role:"treeitem","aria-selected":void 0},(t||""===t)&&(0,n.createElement)("span",{className:l.label},h(t,l.quotesForFieldNames),":"),(0,n.createElement)("span",{className:l.punctuation},r),(0,n.createElement)("span",{className:l.punctuation},o),!a&&(0,n.createElement)("span",{className:l.punctuation},","))}({field:t,openBracket:l,closeBracket:c,lastElement:a,style:s});let w=g?s.collapseIcon:s.expandIcon,x=g?s.ariaLables.collapseJson:s.ariaLables.expandJson,E=i+1,Z=o.length-1,M=e=>{g!==e&&(!p||p({level:i,value:r,field:t,newExpandValue:e}))&&k(e)},C=e=>{if("ArrowRight"===e.key||"ArrowLeft"===e.key)e.preventDefault(),M("ArrowRight"===e.key);else if("ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();let t="ArrowUp"===e.key?-1:1;if(!m.current)return;let r=m.current.querySelectorAll("[role=button]"),n=-1;for(let e=0;e{var e;M(!g);let t=v.current;if(!t)return;let r=null===(e=m.current)||void 0===e?void 0:e.querySelector('[role=button][tabindex="0"]');r&&(r.tabIndex=-1),t.tabIndex=0,t.focus()};return(0,n.createElement)("div",{className:s.basicChildStyle,role:"treeitem","aria-expanded":g,"aria-selected":void 0},(0,n.createElement)("span",{className:w,onClick:O,onKeyDown:C,role:"button","aria-label":x,"aria-expanded":g,"aria-controls":g?y:void 0,ref:v,tabIndex:0===i?0:-1}),(t||""===t)&&(d?(0,n.createElement)("span",{className:s.clickableLabel,onClick:O,onKeyDown:C},h(t,s.quotesForFieldNames),":"):(0,n.createElement)("span",{className:s.label},h(t,s.quotesForFieldNames),":")),(0,n.createElement)("span",{className:s.punctuation},l),g?(0,n.createElement)("ul",{id:y,role:"group",className:s.childFieldsContainer},o.map((e,t)=>(0,n.createElement)(b,{key:e[0]||t,field:e[0],value:e[1],style:s,lastElement:t===Z,level:E,shouldExpandNode:u,clickToExpandNode:d,beforeExpandChange:p,outerRef:m}))):(0,n.createElement)("span",{className:s.collapsedContent,onClick:O,onKeyDown:C}),(0,n.createElement)("span",{className:s.punctuation},c),!a&&(0,n.createElement)("span",{className:s.punctuation},","))}function p(e){let{field:t,value:r,style:n,lastElement:o,shouldExpandNode:a,clickToExpandNode:l,level:c,outerRef:i,beforeExpandChange:s}=e;return m({field:t,value:r,lastElement:o||!1,level:c,openBracket:"{",closeBracket:"}",style:n,shouldExpandNode:a,clickToExpandNode:l,data:Object.keys(r).map(e=>[e,r[e]]),outerRef:i,beforeExpandChange:s})}function f(e){let{field:t,value:r,style:n,lastElement:o,level:a,shouldExpandNode:l,clickToExpandNode:c,outerRef:i,beforeExpandChange:s}=e;return m({field:t,value:r,lastElement:o||!1,level:a,openBracket:"[",closeBracket:"]",style:n,shouldExpandNode:l,clickToExpandNode:c,data:r.map(e=>[void 0,e]),outerRef:i,beforeExpandChange:s})}function g(e){let t,{field:r,value:s,style:u,lastElement:m}=e,p=u.otherValue;if(null===s)t="null",p=u.nullValue;else if(void 0===s)t="undefined",p=u.undefinedValue;else if(i(s)){var f;f=!u.noQuotesForStringValues,t=u.stringifyStringValues?JSON.stringify(s):f?`"${s}"`:s,p=u.stringValue}else o(s)?(t=s?"true":"false",p=u.booleanValue):a(s)?(t=s.toString(),p=u.numberValue):l(s)?(t=`${s.toString()}n`,p=u.numberValue):t=c(s)?s.toISOString():d(s)?"function() { }":s.toString();return(0,n.createElement)("div",{className:u.basicChildStyle,role:"treeitem","aria-selected":void 0},(r||""===r)&&(0,n.createElement)("span",{className:u.label},h(r,u.quotesForFieldNames),":"),(0,n.createElement)("span",{className:p},t),!m&&(0,n.createElement)("span",{className:u.punctuation},","))}function b(e){let t=e.value;return s(t)?(0,n.createElement)(f,Object.assign({},e)):!u(t)||c(t)||d(t)?(0,n.createElement)(g,Object.assign({},e)):(0,n.createElement)(p,Object.assign({},e))}let k={container:"_2IvMF _GzYRV",basicChildStyle:"_2bkNM",childFieldsContainer:"_1BXBN",label:"_1MGIk",clickableLabel:"_2YKJg _1MGIk _1MFti",nullValue:"_2T6PJ",undefinedValue:"_1Gho6",stringValue:"_vGjyY",booleanValue:"_3zQKs",numberValue:"_1bQdo",otherValue:"_1xvuR",punctuation:"_3uHL6 _3eOF8",collapseIcon:"_oLqym _f10Tu _1MFti _1LId0",expandIcon:"_2AXVT _f10Tu _1MFti _1UmXx",collapsedContent:"_2KJWg _1pNG9 _1MFti",noQuotesForStringValues:!1,quotesForFieldNames:!1,ariaLables:{collapseJson:"collapse JSON",expandJson:"expand JSON"},stringifyStringValues:!1},v=()=>!0,y=e=>{let{data:t,style:r=k,shouldExpandNode:o=v,clickToExpandNode:a=!1,beforeExpandChange:l,compactTopLevel:c,...i}=e,s=(0,n.useRef)(null);return(0,n.createElement)("div",Object.assign({"aria-label":"JSON view"},i,{className:r.container,ref:s,role:"tree"}),c&&u(t)?Object.entries(t).map(e=>{let[t,c]=e;return(0,n.createElement)(b,{key:t,field:t,value:c,style:{...k,...r},lastElement:!0,level:1,shouldExpandNode:o,clickToExpandNode:a,beforeExpandChange:l,outerRef:s})}):(0,n.createElement)(b,{value:t,style:{...k,...r},lastElement:!0,level:0,shouldExpandNode:o,clickToExpandNode:a,outerRef:s,beforeExpandChange:l}))}},1479:function(e,t){"use strict";t.Z={'code[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{background:"hsl(230, 1%, 98%)",color:"hsl(230, 8%, 24%)",fontFamily:'"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace',direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"2",OTabSize:"2",tabSize:"2",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:"0.5em 0",overflow:"auto",borderRadius:"0.3em"},'code[class*="language-"]::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::-moz-selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"]::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'code[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},'pre[class*="language-"] *::selection':{background:"hsl(230, 1%, 90%)",color:"inherit"},':not(pre) > code[class*="language-"]':{padding:"0.2em 0.3em",borderRadius:"0.3em",whiteSpace:"normal"},comment:{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},prolog:{color:"hsl(230, 4%, 64%)"},cdata:{color:"hsl(230, 4%, 64%)"},doctype:{color:"hsl(230, 8%, 24%)"},punctuation:{color:"hsl(230, 8%, 24%)"},entity:{color:"hsl(230, 8%, 24%)",cursor:"help"},"attr-name":{color:"hsl(35, 99%, 36%)"},"class-name":{color:"hsl(35, 99%, 36%)"},boolean:{color:"hsl(35, 99%, 36%)"},constant:{color:"hsl(35, 99%, 36%)"},number:{color:"hsl(35, 99%, 36%)"},atrule:{color:"hsl(35, 99%, 36%)"},keyword:{color:"hsl(301, 63%, 40%)"},property:{color:"hsl(5, 74%, 59%)"},tag:{color:"hsl(5, 74%, 59%)"},symbol:{color:"hsl(5, 74%, 59%)"},deleted:{color:"hsl(5, 74%, 59%)"},important:{color:"hsl(5, 74%, 59%)"},selector:{color:"hsl(119, 34%, 47%)"},string:{color:"hsl(119, 34%, 47%)"},char:{color:"hsl(119, 34%, 47%)"},builtin:{color:"hsl(119, 34%, 47%)"},inserted:{color:"hsl(119, 34%, 47%)"},regex:{color:"hsl(119, 34%, 47%)"},"attr-value":{color:"hsl(119, 34%, 47%)"},"attr-value > .token.punctuation":{color:"hsl(119, 34%, 47%)"},variable:{color:"hsl(221, 87%, 60%)"},operator:{color:"hsl(221, 87%, 60%)"},function:{color:"hsl(221, 87%, 60%)"},url:{color:"hsl(198, 99%, 37%)"},"attr-value > .token.punctuation.attr-equals":{color:"hsl(230, 8%, 24%)"},"special-attr > .token.attr-value > .token.value.css":{color:"hsl(230, 8%, 24%)"},".language-css .token.selector":{color:"hsl(5, 74%, 59%)"},".language-css .token.property":{color:"hsl(230, 8%, 24%)"},".language-css .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.function":{color:"hsl(198, 99%, 37%)"},".language-css .token.url > .token.string.url":{color:"hsl(119, 34%, 47%)"},".language-css .token.important":{color:"hsl(301, 63%, 40%)"},".language-css .token.atrule .token.rule":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.operator":{color:"hsl(301, 63%, 40%)"},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:"hsl(344, 84%, 43%)"},".language-json .token.operator":{color:"hsl(230, 8%, 24%)"},".language-json .token.null.keyword":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.url":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.operator":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url-reference.url > .token.string":{color:"hsl(230, 8%, 24%)"},".language-markdown .token.url > .token.content":{color:"hsl(221, 87%, 60%)"},".language-markdown .token.url > .token.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.url-reference.url":{color:"hsl(198, 99%, 37%)"},".language-markdown .token.blockquote.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.hr.punctuation":{color:"hsl(230, 4%, 64%)",fontStyle:"italic"},".language-markdown .token.code-snippet":{color:"hsl(119, 34%, 47%)"},".language-markdown .token.bold .token.content":{color:"hsl(35, 99%, 36%)"},".language-markdown .token.italic .token.content":{color:"hsl(301, 63%, 40%)"},".language-markdown .token.strike .token.content":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.strike .token.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.list.punctuation":{color:"hsl(5, 74%, 59%)"},".language-markdown .token.title.important > .token.punctuation":{color:"hsl(5, 74%, 59%)"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},namespace:{Opacity:"0.8"},"token.tab:not(:empty):before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.cr:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.lf:before":{color:"hsla(230, 8%, 24%, 0.2)"},"token.space:before":{color:"hsla(230, 8%, 24%, 0.2)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:"0.4em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 6%, 44%)",padding:"0.1em 0.4em",borderRadius:"0.3em"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:"hsl(230, 1%, 78%)",color:"hsl(230, 8%, 24%)"},".line-highlight.line-highlight":{background:"hsla(230, 8%, 24%, 0.05)"},".line-highlight.line-highlight:before":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},".line-highlight.line-highlight[data-end]:after":{background:"hsl(230, 1%, 90%)",color:"hsl(230, 8%, 24%)",padding:"0.1em 0.6em",borderRadius:"0.3em",boxShadow:"0 2px 0 0 rgba(0, 0, 0, 0.2)"},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:"hsla(230, 8%, 24%, 0.05)"},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".command-line .command-line-prompt":{borderRightColor:"hsla(230, 8%, 24%, 0.2)"},".line-numbers .line-numbers-rows > span:before":{color:"hsl(230, 1%, 62%)"},".command-line .command-line-prompt > span:before":{color:"hsl(230, 1%, 62%)"},".rainbow-braces .token.token.punctuation.brace-level-1":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-5":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-9":{color:"hsl(5, 74%, 59%)"},".rainbow-braces .token.token.punctuation.brace-level-2":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-6":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-10":{color:"hsl(119, 34%, 47%)"},".rainbow-braces .token.token.punctuation.brace-level-3":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-7":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-11":{color:"hsl(221, 87%, 60%)"},".rainbow-braces .token.token.punctuation.brace-level-4":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-8":{color:"hsl(301, 63%, 40%)"},".rainbow-braces .token.token.punctuation.brace-level-12":{color:"hsl(301, 63%, 40%)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:"hsla(353, 100%, 66%, 0.15)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:"hsla(353, 95%, 66%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:"hsla(137, 100%, 55%, 0.15)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:"hsla(135, 73%, 55%, 0.25)"},".prism-previewer.prism-previewer:before":{borderColor:"hsl(0, 0, 95%)"},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:"hsl(0, 0, 95%)",borderRadius:"0.3em"},".prism-previewer-color.prism-previewer-color:before":{borderRadius:"0.3em"},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:"0.3em"},".prism-previewer.prism-previewer:after":{borderTopColor:"hsl(0, 0, 95%)"},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:"hsl(0, 0, 95%)"},".prism-previewer-angle.prism-previewer-angle:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-time.prism-previewer-time:before":{background:"hsl(0, 0%, 100%)"},".prism-previewer-easing.prism-previewer-easing":{background:"hsl(0, 0%, 100%)"},".prism-previewer-angle.prism-previewer-angle circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-time.prism-previewer-time circle":{stroke:"hsl(230, 8%, 24%)",strokeOpacity:"1"},".prism-previewer-easing.prism-previewer-easing circle":{stroke:"hsl(230, 8%, 24%)",fill:"transparent"},".prism-previewer-easing.prism-previewer-easing path":{stroke:"hsl(230, 8%, 24%)"},".prism-previewer-easing.prism-previewer-easing line":{stroke:"hsl(230, 8%, 24%)"}}},52621:function(){},82422:function(e,t,r){"use strict";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:"M5 13l4 4L19 7"}))});t.Z=o},51853:function(e,t,r){"use strict";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:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"}))});t.Z=o},3477:function(e,t,r){"use strict";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 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});t.Z=o},71437:function(e,t,r){"use strict";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){"use strict";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},2356:function(e,t,r){"use strict";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:"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"}))});t.Z=o},45589:function(e,t,r){"use strict";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 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"}))});t.Z=o},91126:function(e,t,r){"use strict";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:"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"}),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});t.Z=o},17732:function(e,t,r){"use strict";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:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"}))});t.Z=o},3837:function(e,t,r){"use strict";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:"M6 18L18 6M6 6l12 12"}))});t.Z=o},21770:function(e,t,r){"use strict";r.d(t,{D:function(){return u}});var n=r(2265),o=r(2894),a=r(18238),l=r(24112),c=r(45345),i=class extends l.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,c.VS)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,c.Ym)(t.mutationKey)!==(0,c.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 u(e,t){let r=(0,s.NL)(t),[o]=n.useState(()=>new i(r,e));n.useEffect(()=>{o.setOptions(e)},[o,e]);let l=n.useSyncExternalStore(n.useCallback(e=>o.subscribe(a.Vr.batchCalls(e)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),u=n.useCallback((e,t)=>{o.mutate(e,t).catch(c.ZT)},[o]);if(l.error&&(0,c.L3)(o.options.throwOnError,[l.error]))throw l.error;return{...l,mutate:u,mutateAsync:l.mutate}}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3862-064a3fb795c75b62.js b/litellm/proxy/_experimental/out/_next/static/chunks/3862-064a3fb795c75b62.js new file mode 100644 index 0000000000..33827473c4 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/3862-064a3fb795c75b62.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3862],{64748:function(e,s,l){l.d(s,{Ct:function(){return t.Z},Dx:function(){return m.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return o.Z},td:function(){return c.Z},v0:function(){return i.Z},x4:function(){return d.Z},xv:function(){return x.Z},zx:function(){return a.Z}});var t=l(41649),a=l(78489),r=l(12514),n=l(12485),i=l(18135),c=l(35242),d=l(29706),o=l(77991),x=l(84264),m=l(96761)},78801:function(e,s,l){l.d(s,{Z:function(){return t.Z},x:function(){return a.Z}});var t=l(12514),a=l(84264)},58927:function(e,s,l){l.d(s,{J:function(){return t.Z}});var t=l(47323)},53862:function(e,s,l){l.d(s,{Z:function(){return J}});var t=l(57437),a=l(41649),r=l(78489),n=l(84264),i=l(99981),c=l(3810),d=l(23639),o=l(15424),x=l(2265),m=l(15690),u=l(10032),h=l(4156),p=l(5545),g=l(22116),j=l(96761),v=l(19250),b=l(9114);let{Step:N}=m.default;var f=e=>{let{visible:s,onClose:l,accessToken:r,agentHubData:i,onSuccess:c}=e,[d,o]=(0,x.useState)(0),[f,y]=(0,x.useState)(new Set),[_,k]=(0,x.useState)(!1),[Z]=u.Z.useForm(),w=()=>{o(0),y(new Set),Z.resetFields(),l()},C=(e,s)=>{let l=new Set(f);s?l.add(e):l.delete(e),y(l)},S=e=>{e?y(new Set(i.map(e=>e.agent_id||e.name))):y(new Set)};(0,x.useEffect)(()=>{s&&i.length>0&&y(new Set(i.filter(e=>!0===e.is_public).map(e=>e.agent_id||e.name)))},[s,i]);let M=async()=>{if(0===f.size){b.Z.fromBackend("Please select at least one agent to make public");return}k(!0);try{let e=Array.from(f);await (0,v.makeAgentsPublicCall)(r,e),b.Z.success("Successfully made ".concat(e.length," agent(s) public!")),w(),c()}catch(e){console.error("Error making agents public:",e),b.Z.fromBackend("Failed to make agents public. Please try again.")}finally{k(!1)}},P=()=>{let e=i.length>0&&i.every(e=>f.has(e.agent_id||e.name)),s=f.size>0&&!e;return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(j.Z,{children:"Select Agents to Make Public"}),(0,t.jsx)("div",{className:"flex items-center space-x-2",children:(0,t.jsxs)(h.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===i.length,children:["Select All ",i.length>0&&"(".concat(i.length,")")]})})]}),(0,t.jsx)(n.Z,{className:"text-sm text-gray-600",children:"Select the agents you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these agents."}),(0,t.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,t.jsx)("div",{className:"space-y-3",children:0===i.length?(0,t.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,t.jsx)(n.Z,{children:"No agents available."})}):i.map(e=>{let s=e.agent_id||e.name;return(0,t.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,t.jsx)(h.Z,{checked:f.has(s),onChange:e=>C(s,e.target.checked)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:e.name}),(0,t.jsxs)(a.Z,{color:"blue",size:"sm",children:["v",e.version]})]}),(0,t.jsx)(n.Z,{className:"text-xs text-gray-600 mt-1",children:e.description}),e.skills&&e.skills.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.skills.slice(0,3).map(e=>(0,t.jsx)(a.Z,{color:"purple",size:"xs",children:e.name},e.id)),e.skills.length>3&&(0,t.jsxs)(n.Z,{className:"text-xs text-gray-500",children:["+",e.skills.length-3," more"]})]})]})]},s)})})}),f.size>0&&(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:[(0,t.jsx)("strong",{children:f.size})," agent",1!==f.size?"s":""," selected"]})})]})},z=()=>(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(j.Z,{children:"Confirm Making Agents Public"}),(0,t.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,t.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:[(0,t.jsx)("strong",{children:"Warning:"})," Once you make these agents public, anyone who can go to the"," ",(0,t.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:"Agents to be made public:"}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,t.jsx)("div",{className:"space-y-2",children:Array.from(f).map(e=>{let s=i.find(s=>(s.agent_id||s.name)===e);return(0,t.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:(null==s?void 0:s.name)||e}),s&&(0,t.jsxs)(a.Z,{color:"blue",size:"xs",children:["v",s.version]})]}),(null==s?void 0:s.description)&&(0,t.jsx)(n.Z,{className:"text-xs text-gray-600 mt-1",children:s.description})]})},e)})})})]}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,t.jsx)("strong",{children:f.size})," agent",1!==f.size?"s":""," will be made public"]})})]});return(0,t.jsx)(g.Z,{title:"Make Agents Public",open:s,onCancel:w,footer:null,width:1200,maskClosable:!1,children:(0,t.jsxs)(u.Z,{form:Z,layout:"vertical",children:[(0,t.jsxs)(m.default,{current:d,className:"mb-6",children:[(0,t.jsx)(N,{title:"Select Agents"}),(0,t.jsx)(N,{title:"Confirm"})]}),(()=>{switch(d){case 0:return P();case 1:return z();default:return null}})(),(0,t.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,t.jsx)(p.ZP,{onClick:0===d?w:()=>{1===d&&o(0)},children:0===d?"Cancel":"Previous"}),(0,t.jsxs)("div",{className:"flex space-x-2",children:[0===d&&(0,t.jsx)(p.ZP,{onClick:()=>{if(0===d){if(0===f.size){b.Z.fromBackend("Please select at least one agent to make public");return}o(1)}},disabled:0===f.size,children:"Next"}),1===d&&(0,t.jsx)(p.ZP,{onClick:M,loading:_,children:"Make Public"})]})]})]})})};let{Step:y}=m.default;var _=e=>{let{visible:s,onClose:l,accessToken:r,mcpHubData:i,onSuccess:c}=e,[d,o]=(0,x.useState)(0),[N,f]=(0,x.useState)(new Set),[_,k]=(0,x.useState)(!1),[Z]=u.Z.useForm(),w=()=>{o(0),f(new Set),Z.resetFields(),l()},C=(e,s)=>{let l=new Set(N);s?l.add(e):l.delete(e),f(l)},S=e=>{e?f(new Set(i.map(e=>e.server_id))):f(new Set)};(0,x.useEffect)(()=>{s&&i.length>0&&f(new Set(i.filter(e=>{var s;return(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0}).map(e=>e.server_id)))},[s]);let M=async()=>{if(0===N.size){b.Z.fromBackend("Please select at least one MCP server to make public");return}k(!0);try{let e=Array.from(N);await (0,v.makeMCPPublicCall)(r,e),b.Z.success("Successfully made ".concat(e.length," MCP server(s) public!")),w(),c()}catch(e){console.error("Error making MCP servers public:",e),b.Z.fromBackend("Failed to make MCP servers public. Please try again.")}finally{k(!1)}},P=()=>{let e=i.length>0&&i.every(e=>N.has(e.server_id)),s=N.size>0&&!e;return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(j.Z,{children:"Select MCP Servers to Make Public"}),(0,t.jsx)("div",{className:"flex items-center space-x-2",children:(0,t.jsxs)(h.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===i.length,children:["Select All ",i.length>0&&"(".concat(i.length,")")]})})]}),(0,t.jsx)(n.Z,{className:"text-sm text-gray-600",children:"Select the MCP servers you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these servers."}),(0,t.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,t.jsx)("div",{className:"space-y-3",children:0===i.length?(0,t.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,t.jsx)(n.Z,{children:"No MCP servers available."})}):i.map(e=>{var s;let l=(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0;return(0,t.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,t.jsx)(h.Z,{checked:N.has(e.server_id),onChange:s=>C(e.server_id,s.target.checked)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:e.server_name}),l&&(0,t.jsx)(a.Z,{color:"emerald",size:"sm",children:"Public"}),(0,t.jsx)(a.Z,{color:"blue",size:"sm",children:e.transport}),(0,t.jsx)(a.Z,{color:"active"===e.status||"healthy"===e.status?"green":"inactive"===e.status||"unhealthy"===e.status?"red":"gray",size:"sm",children:e.status||"unknown"})]}),(0,t.jsx)(n.Z,{className:"text-xs text-gray-600 mt-1",children:e.description||e.url}),e.allowed_tools&&e.allowed_tools.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowed_tools.slice(0,3).map((e,s)=>(0,t.jsx)(a.Z,{color:"purple",size:"xs",children:e},s)),e.allowed_tools.length>3&&(0,t.jsxs)(n.Z,{className:"text-xs text-gray-500",children:["+",e.allowed_tools.length-3," more"]})]})]})]},e.server_id)})})}),N.size>0&&(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:[(0,t.jsx)("strong",{children:N.size})," MCP server",1!==N.size?"s":""," selected"]})})]})},z=()=>(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(j.Z,{children:"Confirm Making MCP Servers Public"}),(0,t.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,t.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:[(0,t.jsx)("strong",{children:"Warning:"})," Once you make these MCP servers public, anyone who can go to the"," ",(0,t.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:"MCP Servers to be made public:"}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,t.jsx)("div",{className:"space-y-2",children:Array.from(N).map(e=>{let s=i.find(s=>s.server_id===e);return(0,t.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:(null==s?void 0:s.server_name)||e}),s&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.Z,{color:"blue",size:"xs",children:s.transport}),(0,t.jsx)(a.Z,{color:"active"===s.status||"healthy"===s.status?"green":"inactive"===s.status||"unhealthy"===s.status?"red":"gray",size:"xs",children:s.status||"unknown"})]})]}),(null==s?void 0:s.description)&&(0,t.jsx)(n.Z,{className:"text-xs text-gray-600 mt-1",children:s.description}),(null==s?void 0:s.url)&&(0,t.jsx)(n.Z,{className:"text-xs text-gray-500 mt-1",children:s.url})]})},e)})})})]}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,t.jsx)("strong",{children:N.size})," MCP server",1!==N.size?"s":""," will be made public"]})})]});return(0,t.jsx)(g.Z,{title:"Make MCP Servers Public",open:s,onCancel:w,footer:null,width:1200,maskClosable:!1,children:(0,t.jsxs)(u.Z,{form:Z,layout:"vertical",children:[(0,t.jsxs)(m.default,{current:d,className:"mb-6",children:[(0,t.jsx)(y,{title:"Select Servers"}),(0,t.jsx)(y,{title:"Confirm"})]}),(()=>{switch(d){case 0:return P();case 1:return z();default:return null}})(),(0,t.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,t.jsx)(p.ZP,{onClick:0===d?w:()=>{1===d&&o(0)},children:0===d?"Cancel":"Previous"}),(0,t.jsxs)("div",{className:"flex space-x-2",children:[0===d&&(0,t.jsx)(p.ZP,{onClick:()=>{if(0===d){if(0===N.size){b.Z.fromBackend("Please select at least one MCP server to make public");return}o(1)}},disabled:0===N.size,children:"Next"}),1===d&&(0,t.jsx)(p.ZP,{onClick:M,loading:_,children:"Make Public"})]})]})]})})},k=l(78801),Z=e=>{let{modelHubData:s,onFilteredDataChange:l,showFiltersCard:a=!0,className:r=""}=e,[n,i]=(0,x.useState)(""),[c,d]=(0,x.useState)(""),[o,m]=(0,x.useState)(""),[u,h]=(0,x.useState)(""),p=(0,x.useRef)([]),g=(0,x.useMemo)(()=>(null==s?void 0:s.filter(e=>{let s=e.model_group.toLowerCase().includes(n.toLowerCase()),l=""===c||e.providers.includes(c),t=""===o||e.mode===o,a=""===u||Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).some(e=>{let[s]=e;return s.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")===u});return s&&l&&t&&a}))||[],[s,n,c,o,u]);(0,x.useEffect)(()=>{(g.length!==p.current.length||g.some((e,s)=>{var l;return e.model_group!==(null===(l=p.current[s])||void 0===l?void 0:l.model_group)}))&&(p.current=g,l(g))},[g,l]);let j=(0,t.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(k.x,{className:"text-sm font-medium mb-2",children:"Search Models:"}),(0,t.jsx)("input",{type:"text",placeholder:"Search model names...",value:n,onChange:e=>i(e.target.value),className:"border rounded px-3 py-2 w-64 h-10 text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(k.x,{className:"text-sm font-medium mb-2",children:"Provider:"}),(0,t.jsxs)("select",{value:c,onChange:e=>d(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-40 h-10",children:[(0,t.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Providers"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.providers.forEach(e=>s.add(e))}),Array.from(s)})(s).map(e=>(0,t.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(k.x,{className:"text-sm font-medium mb-2",children:"Mode:"}),(0,t.jsxs)("select",{value:o,onChange:e=>m(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-32 h-10",children:[(0,t.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Modes"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.mode&&s.add(e.mode)}),Array.from(s)})(s).map(e=>(0,t.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(k.x,{className:"text-sm font-medium mb-2",children:"Features:"}),(0,t.jsxs)("select",{value:u,onChange:e=>h(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-48 h-10",children:[(0,t.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Features"}),s&&(e=>{let s=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).forEach(e=>{let[l]=e,t=l.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");s.add(t)})}),Array.from(s).sort()})(s).map(e=>(0,t.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(n||c||o||u)&&(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsx)("button",{onClick:()=>{i(""),d(""),m(""),h("")},className:"text-blue-600 hover:text-blue-800 text-sm underline h-10 flex items-center",children:"Clear Filters"})})]});return a?(0,t.jsx)(k.Z,{className:"mb-6 ".concat(r),children:j}):(0,t.jsx)("div",{className:r,children:j})};let{Step:w}=m.default;var C=e=>{let{visible:s,onClose:l,accessToken:r,modelHubData:i,onSuccess:c}=e,[d,o]=(0,x.useState)(0),[N,f]=(0,x.useState)(new Set),[y,_]=(0,x.useState)([]),[k,C]=(0,x.useState)(!1),[S]=u.Z.useForm(),M=()=>{o(0),f(new Set),_([]),S.resetFields(),l()},P=(e,s)=>{let l=new Set(N);s?l.add(e):l.delete(e),f(l)},z=e=>{e?f(new Set(y.map(e=>e.model_group))):f(new Set)},A=(0,x.useCallback)(e=>{_(e)},[]);(0,x.useEffect)(()=>{s&&i.length>0&&(_(i),f(new Set(i.filter(e=>!0===e.is_public_model_group).map(e=>e.model_group))))},[s,i]);let F=async()=>{if(0===N.size){b.Z.fromBackend("Please select at least one model to make public");return}C(!0);try{let e=Array.from(N);await (0,v.makeModelGroupPublic)(r,e),b.Z.success("Successfully made ".concat(e.length," model group(s) public!")),M(),c()}catch(e){console.error("Error making model groups public:",e),b.Z.fromBackend("Failed to make model groups public. Please try again.")}finally{C(!1)}},L=()=>{let e=y.length>0&&y.every(e=>N.has(e.model_group)),s=N.size>0&&!e;return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(j.Z,{children:"Select Models to Make Public"}),(0,t.jsx)("div",{className:"flex items-center space-x-2",children:(0,t.jsxs)(h.Z,{checked:e,indeterminate:s,onChange:e=>z(e.target.checked),disabled:0===y.length,children:["Select All ",y.length>0&&"(".concat(y.length,")")]})})]}),(0,t.jsx)(n.Z,{className:"text-sm text-gray-600",children:"Select the models you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these models."}),(0,t.jsx)(Z,{modelHubData:i,onFilteredDataChange:A,showFiltersCard:!1,className:"border rounded-lg p-4 bg-gray-50"}),(0,t.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,t.jsx)("div",{className:"space-y-3",children:0===y.length?(0,t.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,t.jsx)(n.Z,{children:"No models match the current filters."})}):y.map(e=>(0,t.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,t.jsx)(h.Z,{checked:N.has(e.model_group),onChange:s=>P(e.model_group,s.target.checked)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:e.model_group}),e.mode&&(0,t.jsx)(a.Z,{color:"green",size:"sm",children:e.mode})]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.providers.map(e=>(0,t.jsx)(a.Z,{color:"blue",size:"xs",children:e},e))})]})]},e.model_group))})}),N.size>0&&(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:[(0,t.jsx)("strong",{children:N.size})," model",1!==N.size?"s":""," selected"]})})]})},T=()=>(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(j.Z,{children:"Confirm Making Models Public"}),(0,t.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,t.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:[(0,t.jsx)("strong",{children:"Warning:"})," Once you make these models public, anyone who can go to the"," ",(0,t.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:"Models to be made public:"}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,t.jsx)("div",{className:"space-y-2",children:Array.from(N).map(e=>{let s=i.find(s=>s.model_group===e);return(0,t.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(n.Z,{className:"font-medium",children:e}),s&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:s.providers.map(e=>(0,t.jsx)(a.Z,{color:"blue",size:"xs",children:e},e))})]})},e)})})})]}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,t.jsx)("strong",{children:N.size})," model",1!==N.size?"s":""," will be made public"]})})]});return(0,t.jsx)(g.Z,{title:"Make Models Public",open:s,onCancel:M,footer:null,width:1200,maskClosable:!1,children:(0,t.jsxs)(u.Z,{form:S,layout:"vertical",children:[(0,t.jsxs)(m.default,{current:d,className:"mb-6",children:[(0,t.jsx)(w,{title:"Select Models"}),(0,t.jsx)(w,{title:"Confirm"})]}),(()=>{switch(d){case 0:return L();case 1:return T();default:return null}})(),(0,t.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,t.jsx)(p.ZP,{onClick:0===d?M:()=>{1===d&&o(0)},children:0===d?"Cancel":"Previous"}),(0,t.jsxs)("div",{className:"flex space-x-2",children:[0===d&&(0,t.jsx)(p.ZP,{onClick:()=>{if(0===d){if(0===N.size){b.Z.fromBackend("Please select at least one model to make public");return}o(1)}},disabled:0===N.size,children:"Next"}),1===d&&(0,t.jsx)(p.ZP,{onClick:F,loading:k,children:"Make Public"})]})]})]})})};let S=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),M=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),P=e=>"$".concat((1e6*e).toFixed(2)),z=e=>e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString(),A=function(e,s){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],x=[{header:"Public Model Name",accessorKey:"model_group",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium text-sm",children:a.model_group}),(0,t.jsx)(i.Z,{title:"Copy model name",children:(0,t.jsx)(d.Z,{onClick:()=>s(a.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsx)(n.Z,{className:"text-xs text-gray-600",children:a.providers.join(", ")})})]})}},{header:"Provider",accessorKey:"providers",enableSorting:!0,sortingFn:(e,s)=>{let l=e.original.providers.join(", "),t=s.original.providers.join(", ");return l.localeCompare(t)},cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.providers.slice(0,2).map(e=>(0,t.jsx)(c.Z,{color:"blue",className:"text-xs",children:e},e)),l.providers.length>2&&(0,t.jsxs)(n.Z,{className:"text-xs text-gray-500",children:["+",l.providers.length-2]})]})},meta:{className:"hidden md:table-cell"}},{header:"Mode",accessorKey:"mode",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return l.mode?(0,t.jsx)(a.Z,{color:"green",size:"sm",children:l.mode}):(0,t.jsx)(n.Z,{className:"text-gray-500",children:"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Tokens",accessorKey:"max_input_tokens",enableSorting:!0,sortingFn:(e,s)=>(e.original.max_input_tokens||0)+(e.original.max_output_tokens||0)-((s.original.max_input_tokens||0)+(s.original.max_output_tokens||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsxs)(n.Z,{className:"text-xs",children:[l.max_input_tokens?z(l.max_input_tokens):"-"," /"," ",l.max_output_tokens?z(l.max_output_tokens):"-"]})})},meta:{className:"hidden lg:table-cell"}},{header:"Cost/1M",accessorKey:"input_cost_per_token",enableSorting:!0,sortingFn:(e,s)=>(e.original.input_cost_per_token||0)+(e.original.output_cost_per_token||0)-((s.original.input_cost_per_token||0)+(s.original.output_cost_per_token||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(n.Z,{className:"text-xs",children:l.input_cost_per_token?P(l.input_cost_per_token):"-"}),(0,t.jsx)(n.Z,{className:"text-xs text-gray-500",children:l.output_cost_per_token?P(l.output_cost_per_token):"-"})]})}},{header:"Features",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=M(s.original),r=["green","blue","purple","orange","red","yellow"];return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,t.jsx)(n.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map((e,s)=>(0,t.jsx)(a.Z,{color:r[s%r.length],size:"xs",children:S(e)},e))})}},{header:"Public",accessorKey:"is_public_model_group",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public_model_group?1:0)-(!0===s.original.is_public_model_group?1:0),cell:e=>{let{row:s}=e;return!0===s.original.is_public_model_group?(0,t.jsx)(a.Z,{color:"green",size:"xs",children:"Yes"}):(0,t.jsx)(a.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,a=l.original;return(0,t.jsxs)(r.Z,{size:"xs",variant:"secondary",onClick:()=>e(a),icon:o.Z,children:[(0,t.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,t.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}];return l?x.filter(e=>!("accessorKey"in e)||"is_public_model_group"!==e.accessorKey):x};var F=l(39957),L=l(20347),T=l(86462),D=l(47686),O=l(77355),E=l(3477),K=l(95704),U=l(27648),I=e=>{let{accessToken:s,userRole:l}=e,[a,r]=(0,x.useState)([]),[n,i]=(0,x.useState)({url:"",displayName:""}),[c,d]=(0,x.useState)(null),[o,m]=(0,x.useState)(!1),[u,h]=(0,x.useState)(!0),[p,g]=(0,x.useState)(!1),[j,N]=(0,x.useState)([]),f=async()=>{if(s)try{m(!0);let e=await (0,v.getPublicModelHubInfo)();if(e&&e.useful_links){let s=e.useful_links||{},l=Object.entries(s).map(e=>{var s,l;let[t,a]=e;return"object"==typeof a&&null!==a&&"url"in a?{id:"".concat(null!==(s=a.index)&&void 0!==s?s:0,"-").concat(t),displayName:t,url:a.url,index:null!==(l=a.index)&&void 0!==l?l:0}:{id:"0-".concat(t),displayName:t,url:a,index:0}}).sort((e,s)=>{var l,t;return(null!==(l=e.index)&&void 0!==l?l:0)-(null!==(t=s.index)&&void 0!==t?t:0)}).map((e,s)=>({...e,id:"".concat(s,"-").concat(e.displayName)}));r(l)}else r([])}catch(e){console.error("Error fetching useful links:",e),r([])}finally{m(!1)}};if((0,x.useEffect)(()=>{f()},[s]),!(0,L.tY)(l||""))return null;let y=async e=>{if(!s)return!1;try{let l={};return e.forEach((e,s)=>{l[e.displayName]={url:e.url,index:s}}),await (0,v.updateUsefulLinksCall)(s,l),!0}catch(e){return console.error("Error saving links:",e),b.Z.fromBackend("Failed to save links - ".concat(e)),!1}},_=async()=>{if(!n.url||!n.displayName)return;try{new URL(n.url)}catch(e){b.Z.fromBackend("Please enter a valid URL");return}if(a.some(e=>e.displayName===n.displayName)){b.Z.fromBackend("A link with this display name already exists");return}let e=[...a,{id:"".concat(Date.now(),"-").concat(n.displayName),displayName:n.displayName,url:n.url}];await y(e)&&(r(e),i({url:"",displayName:""}),b.Z.success("Link added successfully"))},k=e=>{d({...e})},Z=async()=>{if(!c)return;try{new URL(c.url)}catch(e){b.Z.fromBackend("Please enter a valid URL");return}if(a.some(e=>e.id!==c.id&&e.displayName===c.displayName)){b.Z.fromBackend("A link with this display name already exists");return}let e=a.map(e=>e.id===c.id?c:e);await y(e)&&(r(e),d(null),b.Z.success("Link updated successfully"))},w=()=>{d(null)},C=async e=>{let s=a.filter(s=>s.id!==e);await y(s)&&(r(s),b.Z.success("Link deleted successfully"))},S=e=>{window.open(e,"_blank")},M=async()=>{await y(a)&&(g(!1),N([]),b.Z.success("Link order saved successfully"))},P=e=>{if(0===e)return;let s=[...a];[s[e-1],s[e]]=[s[e],s[e-1]],r(s)},z=e=>{if(e===a.length-1)return;let s=[...a];[s[e],s[e+1]]=[s[e+1],s[e]],r(s)};return(0,t.jsxs)(K.Zb,{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>h(!u),children:[(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)(K.Dx,{className:"mb-0",children:"Link Management"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Manage the links that are displayed under 'Useful Links' on the public model hub."})]}),(0,t.jsx)("div",{className:"flex items-center",children:u?(0,t.jsx)(T.Z,{className:"w-5 h-5 text-gray-500"}):(0,t.jsx)(D.Z,{className:"w-5 h-5 text-gray-500"})})]}),u&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(K.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Link"}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Display Name"}),(0,t.jsx)("input",{type:"text",value:n.displayName,onChange:e=>i({...n,displayName:e.target.value}),placeholder:"Friendly name",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"URL"}),(0,t.jsx)("input",{type:"text",value:n.url,onChange:e=>i({...n,url:e.target.value}),placeholder:"https://example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)("button",{onClick:_,disabled:!n.url||!n.displayName,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(n.url&&n.displayName?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,t.jsx)(O.Z,{className:"w-4 h-4 mr-1"}),"Add Link"]})})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)(K.xv,{className:"text-sm font-medium text-gray-700",children:"Manage Existing Links"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)(U.default,{href:"".concat((0,v.getProxyBaseUrl)(),"/ui/model_hub_table"),target:"_blank",rel:"noopener noreferrer",className:"text-xs bg-blue-50 text-blue-600 px-3 py-1.5 rounded hover:bg-blue-100 flex items-center",title:"Open Public Model Hub",children:["Public Model Hub",(0,t.jsx)(E.Z,{className:"w-4 h-4 ml-1"})]}),p?(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:M,className:"text-xs bg-green-600 text-white px-3 py-1.5 rounded hover:bg-green-700",children:"Save Order"}),(0,t.jsx)("button",{onClick:()=>{r([...j]),g(!1),N([])},className:"text-xs bg-gray-50 text-gray-600 px-3 py-1.5 rounded hover:bg-gray-100",children:"Cancel"})]}):(0,t.jsx)("button",{onClick:()=>{c&&d(null),N([...a]),g(!0)},className:"text-xs bg-purple-50 text-purple-600 px-3 py-1.5 rounded hover:bg-purple-100 flex items-center",children:"Rearrange Order"})]})]}),(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(K.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(K.ss,{children:(0,t.jsxs)(K.SC,{children:[(0,t.jsx)(K.xs,{className:"py-1 h-8",children:"Display Name"}),(0,t.jsx)(K.xs,{className:"py-1 h-8",children:"URL"}),(0,t.jsx)(K.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,t.jsxs)(K.RM,{children:[a.map((e,s)=>(0,t.jsx)(K.SC,{className:"h-8",children:c&&c.id===e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(K.pj,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:c.displayName,onChange:e=>d({...c,displayName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(K.pj,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:c.url,onChange:e=>d({...c,url:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(K.pj,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:Z,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,t.jsx)("button",{onClick:w,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(K.pj,{className:"py-0.5 text-sm text-gray-900",children:e.displayName}),(0,t.jsx)(K.pj,{className:"py-0.5 text-sm text-gray-500",children:e.url}),(0,t.jsx)(K.pj,{className:"py-0.5 whitespace-nowrap",children:p?(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)(F.Z,{variant:"Up",onClick:()=>P(s),tooltipText:"Move up",disabled:0===s,disabledTooltipText:"Already at the top",dataTestId:"move-up-".concat(e.id)}),(0,t.jsx)(F.Z,{variant:"Down",onClick:()=>z(s),tooltipText:"Move down",disabled:s===a.length-1,disabledTooltipText:"Already at the bottom",dataTestId:"move-down-".concat(e.id)})]}):(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)(F.Z,{variant:"Open",onClick:()=>S(e.url),tooltipText:"Open link",dataTestId:"open-link-".concat(e.id)}),(0,t.jsx)(F.Z,{variant:"Edit",onClick:()=>k(e),tooltipText:"Edit link",dataTestId:"edit-link-".concat(e.id)}),(0,t.jsx)(F.Z,{variant:"Delete",onClick:()=>C(e.id),tooltipText:"Delete link",dataTestId:"delete-link-".concat(e.id)})]})})]})},e.id)),0===a.length&&(0,t.jsx)(K.SC,{children:(0,t.jsx)(K.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No links added yet. Add a new link above."})})]})]})})})]})]})},H=l(8048),B=l(87526),R=l(64748),Y=l(78867),V=l(99376),W=l(17906),J=e=>{var s,l,m,u;let{accessToken:h,publicPage:p,premiumUser:j,userRole:N}=e,[y,k]=(0,x.useState)(!1),[w,S]=(0,x.useState)(null),[M,P]=(0,x.useState)(!0),[z,F]=(0,x.useState)(!1),[T,D]=(0,x.useState)(!1),[O,E]=(0,x.useState)(null),[K,U]=(0,x.useState)([]),[J,q]=(0,x.useState)(!1),[G,$]=(0,x.useState)(null),[Q,X]=(0,x.useState)(!1),[ee,es]=(0,x.useState)(!0),[el,et]=(0,x.useState)(null),[ea,er]=(0,x.useState)(!1),[en,ei]=(0,x.useState)(null),[ec,ed]=(0,x.useState)(!0),[eo,ex]=(0,x.useState)(null),[em,eu]=(0,x.useState)(!1),[eh,ep]=(0,x.useState)(!1),eg=(0,V.useRouter)();(0,x.useEffect)(()=>{let e=async e=>{try{P(!0);let s=await (0,v.modelHubCall)(e);console.log("ModelHubData:",s),S(s.data),(0,v.getConfigFieldSetting)(e,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&k(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}finally{P(!1)}},s=async()=>{try{var e,s;P(!0),await (0,v.getUiConfig)();let l=await (0,v.modelHubPublicModelsCall)();console.log("ModelHubData:",l),console.log("First model structure:",l[0]),console.log("Model has model_group?",null===(e=l[0])||void 0===e?void 0:e.model_group),console.log("Model has providers?",null===(s=l[0])||void 0===s?void 0:s.providers),S(l),k(!0)}catch(e){console.error("There was an error fetching the public model data",e)}finally{P(!1)}};h?e(h):p&&s()},[h,p]),(0,x.useEffect)(()=>{let e=async()=>{if(h)try{es(!0);let e=await (0,v.getAgentsList)(h);console.log("AgentHubData:",e);let s=e.agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.litellm_params.is_public}));$(s)}catch(e){console.error("There was an error fetching the agent data",e)}finally{es(!1)}};p||e()},[p,h]),(0,x.useEffect)(()=>{let e=async()=>{if(h)try{ed(!0);let e=await (0,v.fetchMCPServers)(h);console.log("MCPHubData:",e),ei(e)}catch(e){console.error("There was an error fetching the MCP server data",e)}finally{ed(!1)}};p||e()},[p,h]);let ej=()=>{h&&q(!0)},ev=()=>{h&&X(!0)},eb=()=>{h&&ep(!0)},eN=()=>{F(!1),D(!1),E(null),er(!1),et(null),eu(!1),ex(null)},ef=()=>{F(!1),D(!1),E(null),er(!1),et(null),eu(!1),ex(null)},ey=e=>{navigator.clipboard.writeText(e),b.Z.success("Copied to clipboard!")},e_=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),ek=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),eZ=e=>"$".concat((1e6*e).toFixed(2)),ew=(0,x.useCallback)(e=>{U(e)},[]);return(console.log("publicPage: ",p),console.log("publicPageAllowed: ",y),p&&y)?(0,t.jsx)(B.Z,{accessToken:h}):(0,t.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[!1==p?(0,t.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{className:"flex flex-col items-start",children:[(0,t.jsx)(R.Dx,{className:"text-center",children:"AI Hub"}),(0,L.tY)(N||"")?(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Make models, agents, and MCP servers public for developers to know what's available."}):(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"A list of all public model names personally available to you."})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)(R.xv,{children:"Model Hub URL:"}),(0,t.jsxs)("div",{className:"flex items-center bg-gray-200 px-2 py-1 rounded",children:[(0,t.jsx)(R.xv,{className:"mr-2",children:"".concat((0,v.getProxyBaseUrl)(),"/ui/model_hub_table")}),(0,t.jsx)("button",{onClick:()=>ey("".concat((0,v.getProxyBaseUrl)(),"/ui/model_hub_table")),className:"p-1 hover:bg-gray-300 rounded transition-colors",title:"Copy URL",children:(0,t.jsx)(Y.Z,{size:16,className:"text-gray-600"})})]})]})]}),(0,L.tY)(N||"")&&(0,t.jsx)("div",{className:"mt-8 mb-2",children:(0,t.jsx)(I,{accessToken:h,userRole:N})}),(0,t.jsxs)(R.v0,{children:[(0,t.jsxs)(R.td,{className:"mb-4",children:[(0,t.jsx)(R.OK,{children:"Model Hub"}),(0,t.jsx)(R.OK,{children:"Agent Hub"}),(0,t.jsx)(R.OK,{children:"MCP Hub"})]}),(0,t.jsxs)(R.nP,{children:[(0,t.jsxs)(R.x4,{children:[(0,t.jsxs)(R.Zb,{children:[!1==p&&(0,L.tY)(N||"")&&(0,t.jsx)("div",{className:"flex justify-end mb-4",children:(0,t.jsx)(R.zx,{onClick:()=>ej(),children:"Select Models to Make Public"})}),(0,t.jsx)(Z,{modelHubData:w||[],onFilteredDataChange:ew}),(0,t.jsx)(H.C,{columns:A(e=>{E(e),F(!0)},ey,p),data:K,isLoading:M,defaultSorting:[{id:"model_group",desc:!1}]})]}),(0,t.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,t.jsxs)(R.xv,{className:"text-sm text-gray-600",children:["Showing ",K.length," of ",(null==w?void 0:w.length)||0," models"]})})]}),(0,t.jsxs)(R.x4,{children:[(0,t.jsxs)(R.Zb,{children:[!1==p&&(0,L.tY)(N||"")&&(0,t.jsx)("div",{className:"flex justify-end mb-4",children:(0,t.jsx)(R.zx,{onClick:()=>ev(),children:"Select Agents to Make Public"})}),(0,t.jsx)(H.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Agent Name",accessorKey:"name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium text-sm",children:a.name}),(0,t.jsx)(i.Z,{title:"Copy agent name",children:(0,t.jsx)(d.Z,{onClick:()=>s(a.name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsx)(n.Z,{className:"text-xs text-gray-600",children:a.description})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)(n.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"Version",accessorKey:"version",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsxs)(a.Z,{color:"blue",size:"sm",children:["v",l.version]})},meta:{className:"hidden lg:table-cell"}},{header:"Protocol",accessorKey:"protocolVersion",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)(n.Z,{className:"text-xs",children:l.protocolVersion||"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Skills",accessorKey:"skills",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.skills||[];return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(n.Z,{className:"text-xs font-medium",children:[l.length," skill",1!==l.length?"s":""]}),l.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map(e=>(0,t.jsx)(c.Z,{color:"purple",className:"text-xs",children:e.name},e.id)),l.length>2&&(0,t.jsxs)(n.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})}},{header:"Capabilities",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=Object.entries(s.original.capabilities||{}).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return s});return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,t.jsx)(n.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map(e=>(0,t.jsx)(a.Z,{color:"green",size:"xs",children:e},e))})}},{header:"I/O Modes",accessorKey:"defaultInputModes",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original,a=l.defaultInputModes||[],r=l.defaultOutputModes||[];return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(n.Z,{className:"text-xs",children:[(0,t.jsx)("span",{className:"font-medium",children:"In:"})," ",a.join(", ")||"-"]}),(0,t.jsxs)(n.Z,{className:"text-xs",children:[(0,t.jsx)("span",{className:"font-medium",children:"Out:"})," ",r.join(", ")||"-"]})]})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"is_public",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public?1:0)-(!0===s.original.is_public?1:0),cell:e=>{let{row:s}=e;return console.log("CHECKPOINT 1: ".concat(JSON.stringify(s.original))),!0===s.original.is_public?(0,t.jsx)(a.Z,{color:"green",size:"xs",children:"Yes"}):(0,t.jsx)(a.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,a=l.original;return(0,t.jsxs)(r.Z,{size:"xs",variant:"secondary",onClick:()=>e(a),icon:o.Z,children:[(0,t.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,t.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{et(e),er(!0)},ey,p),data:G||[],isLoading:ee,defaultSorting:[{id:"name",desc:!1}]})]}),(0,t.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,t.jsxs)(R.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==G?void 0:G.length)||0," agent",(null==G?void 0:G.length)!==1?"s":""]})})]}),(0,t.jsxs)(R.x4,{children:[(0,t.jsxs)(R.Zb,{children:[!1==p&&(0,L.tY)(N||"")&&(0,t.jsx)("div",{className:"flex justify-end mb-4",children:(0,t.jsx)(R.zx,{onClick:()=>eb(),children:"Select MCP Servers to Make Public"})}),(0,t.jsx)(H.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Server Name",accessorKey:"server_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium text-sm",children:a.server_name}),(0,t.jsx)(i.Z,{title:"Copy server name",children:(0,t.jsx)(d.Z,{onClick:()=>s(a.server_name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsx)(n.Z,{className:"text-xs text-gray-600",children:a.description||"-"})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)(n.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"URL",accessorKey:"url",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"text-xs truncate max-w-xs",children:a.url}),(0,t.jsx)(i.Z,{title:"Copy URL",children:(0,t.jsx)(d.Z,{onClick:()=>s(a.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs flex-shrink-0"})})]})},meta:{className:"hidden lg:table-cell"}},{header:"Transport",accessorKey:"transport",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)(a.Z,{color:"blue",size:"sm",children:l.transport})},meta:{className:"hidden md:table-cell"}},{header:"Auth Type",accessorKey:"auth_type",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,r="none"===l.auth_type?"gray":"green";return(0,t.jsx)(a.Z,{color:r,size:"sm",children:l.auth_type})},meta:{className:"hidden md:table-cell"}},{header:"Status",accessorKey:"status",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,r={active:"green",inactive:"red",unknown:"gray",healthy:"green",unhealthy:"red"}[l.status]||"gray";return(0,t.jsx)(a.Z,{color:r,size:"sm",children:l.status||"unknown"})}},{header:"Tools",accessorKey:"allowed_tools",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.allowed_tools||[];return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(n.Z,{className:"text-xs font-medium",children:l.length>0?"".concat(l.length," tool").concat(1!==l.length?"s":""):"All tools"}),l.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map((e,s)=>(0,t.jsx)(c.Z,{color:"purple",className:"text-xs",children:e},s)),l.length>2&&(0,t.jsxs)(n.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})},meta:{className:"hidden lg:table-cell"}},{header:"Created By",accessorKey:"created_by",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)(n.Z,{className:"text-xs",children:l.created_by||"-"})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"mcp_info.is_public",enableSorting:!0,sortingFn:(e,s)=>{var l,t;return((null===(l=e.original.mcp_info)||void 0===l?void 0:l.is_public)===!0?1:0)-((null===(t=s.original.mcp_info)||void 0===t?void 0:t.is_public)===!0?1:0)},cell:e=>{var s;let{row:l}=e;return(null===(s=l.original.mcp_info)||void 0===s?void 0:s.is_public)===!0?(0,t.jsx)(a.Z,{color:"green",size:"xs",children:"Yes"}):(0,t.jsx)(a.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,a=l.original;return(0,t.jsxs)(r.Z,{size:"xs",variant:"secondary",onClick:()=>e(a),icon:o.Z,children:[(0,t.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,t.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ex(e),eu(!0)},ey,p),data:en||[],isLoading:ec,defaultSorting:[{id:"server_name",desc:!1}]})]}),(0,t.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,t.jsxs)(R.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==en?void 0:en.length)||0," MCP server",(null==en?void 0:en.length)!==1?"s":""]})})]})]})]})]}):(0,t.jsxs)(R.Zb,{className:"mx-auto max-w-xl mt-10",children:[(0,t.jsx)(R.xv,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,t.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,t.jsx)(g.Z,{title:"Public Model Hub",width:600,visible:T,footer:null,onOk:eN,onCancel:ef,children:(0,t.jsxs)("div",{className:"pt-5 pb-5",children:[(0,t.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,t.jsx)(R.xv,{className:"text-base mr-2",children:"Shareable Link:"}),(0,t.jsx)(R.xv,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"".concat((0,v.getProxyBaseUrl)(),"/ui/model_hub_table")})]}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(R.zx,{onClick:()=>{eg.replace("/model_hub_table?key=".concat(h))},children:"See Page"})})]})}),(0,t.jsx)(g.Z,{title:(null==O?void 0:O.model_group)||"Model Details",width:1e3,visible:z,footer:null,onOk:eN,onCancel:ef,children:O&&(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Model Group:"}),(0,t.jsx)(R.xv,{children:O.model_group})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Mode:"}),(0,t.jsx)(R.xv,{children:O.mode||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Providers:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:O.providers.map(e=>(0,t.jsx)(R.Ct,{color:"blue",children:e},e))})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Max Input Tokens:"}),(0,t.jsx)(R.xv,{children:(null===(s=O.max_input_tokens)||void 0===s?void 0:s.toLocaleString())||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Max Output Tokens:"}),(0,t.jsx)(R.xv,{children:(null===(l=O.max_output_tokens)||void 0===l?void 0:l.toLocaleString())||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,t.jsx)(R.xv,{children:O.input_cost_per_token?eZ(O.input_cost_per_token):"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,t.jsx)(R.xv,{children:O.output_cost_per_token?eZ(O.output_cost_per_token):"Not specified"})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=ek(O),s=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,t.jsx)(R.xv,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,l)=>(0,t.jsx)(R.Ct,{color:s[l%s.length],children:e_(e)},e))})()})]}),(O.tpm||O.rpm)&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[O.tpm&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Tokens per Minute:"}),(0,t.jsx)(R.xv,{children:O.tpm.toLocaleString()})]}),O.rpm&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Requests per Minute:"}),(0,t.jsx)(R.xv,{children:O.rpm.toLocaleString()})]})]})]}),O.supported_openai_params&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:O.supported_openai_params.map(e=>(0,t.jsx)(R.Ct,{color:"green",children:e},e))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,t.jsx)(W.Z,{language:"python",className:"text-sm",children:'import openai\n\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # Your LiteLLM Proxy URL\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(O.model_group,'",\n messages=[\n {\n "role": "user",\n "content": "Hello, how are you?"\n }\n ]\n)\n\nprint(response.choices[0].message.content)')})]})]})}),(0,t.jsx)(g.Z,{title:(null==el?void 0:el.name)||"Agent Details",width:1e3,visible:ea,footer:null,onOk:eN,onCancel:ef,children:el&&(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Agent Overview"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Name:"}),(0,t.jsx)(R.xv,{children:el.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Version:"}),(0,t.jsxs)(R.Ct,{color:"blue",children:["v",el.version]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Protocol Version:"}),(0,t.jsx)(R.xv,{children:el.protocolVersion})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"URL:"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(R.xv,{className:"truncate",children:el.url}),(0,t.jsx)(d.Z,{onClick:()=>ey(el.url),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Description:"}),(0,t.jsx)(R.xv,{className:"mt-1",children:el.description})]})]}),el.capabilities&&Object.keys(el.capabilities).length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(el.capabilities).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return(0,t.jsx)(R.Ct,{color:"green",children:s},s)})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Input/Output Modes"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Input Modes:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(m=el.defaultInputModes)||void 0===m?void 0:m.map(e=>(0,t.jsx)(R.Ct,{color:"blue",children:e},e)))||(0,t.jsx)(R.xv,{children:"Not specified"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Output Modes:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(u=el.defaultOutputModes)||void 0===u?void 0:u.map(e=>(0,t.jsx)(R.Ct,{color:"purple",children:e},e)))||(0,t.jsx)(R.xv,{children:"Not specified"})})]})]})]}),el.skills&&el.skills.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Skills"}),(0,t.jsx)("div",{className:"space-y-4",children:el.skills.map(e=>(0,t.jsxs)("div",{className:"border border-gray-200 rounded p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium text-base",children:e.name}),(0,t.jsxs)(R.xv,{className:"text-xs text-gray-500",children:["ID: ",e.id]})]}),e.tags&&e.tags.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map(e=>(0,t.jsx)(R.Ct,{color:"purple",size:"xs",children:e},e))})]}),(0,t.jsx)(R.xv,{className:"text-sm mb-2",children:e.description}),e.examples&&e.examples.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-xs font-medium text-gray-700",children:"Examples:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.examples.map((e,s)=>(0,t.jsx)(R.Ct,{color:"gray",size:"xs",children:e},s))})]})]},e.id))})]}),el.supportsAuthenticatedExtendedCard&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Additional Features"}),(0,t.jsx)(R.Ct,{color:"green",children:"Supports Authenticated Extended Card"})]})]})}),(0,t.jsx)(g.Z,{title:(null==eo?void 0:eo.server_name)||"MCP Server Details",width:1e3,visible:em,footer:null,onOk:eN,onCancel:ef,children:eo&&(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Server Overview"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Server Name:"}),(0,t.jsx)(R.xv,{children:eo.server_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Server ID:"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(R.xv,{className:"text-xs truncate",children:eo.server_id}),(0,t.jsx)(d.Z,{onClick:()=>ey(eo.server_id),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]}),eo.alias&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Alias:"}),(0,t.jsx)(R.xv,{children:eo.alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Transport:"}),(0,t.jsx)(R.Ct,{color:"blue",children:eo.transport})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Auth Type:"}),(0,t.jsx)(R.Ct,{color:"none"===eo.auth_type?"gray":"green",children:eo.auth_type})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Status:"}),(0,t.jsx)(R.Ct,{color:"active"===eo.status||"healthy"===eo.status?"green":"inactive"===eo.status||"unhealthy"===eo.status?"red":"gray",children:eo.status||"unknown"})]})]}),eo.description&&(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Description:"}),(0,t.jsx)(R.xv,{className:"mt-1",children:eo.description})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Connection Details"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"URL:"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 mt-1",children:[(0,t.jsx)(R.xv,{className:"text-sm break-all bg-gray-100 p-2 rounded flex-1",children:eo.url}),(0,t.jsx)(d.Z,{onClick:()=>ey(eo.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 flex-shrink-0"})]})]}),eo.command&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Command:"}),(0,t.jsx)(R.xv,{className:"text-sm bg-gray-100 p-2 rounded mt-1 font-mono",children:eo.command})]})]})]}),eo.allowed_tools&&eo.allowed_tools.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Allowed Tools"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.allowed_tools.map((e,s)=>(0,t.jsx)(R.Ct,{color:"purple",children:e},s))})]}),eo.teams&&eo.teams.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Teams"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.teams.map((e,s)=>(0,t.jsx)(R.Ct,{color:"blue",children:e},s))})]}),eo.mcp_access_groups&&eo.mcp_access_groups.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Access Groups"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.mcp_access_groups.map((e,s)=>(0,t.jsx)(R.Ct,{color:"green",children:e},s))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Metadata"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Created By:"}),(0,t.jsx)(R.xv,{children:eo.created_by})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Updated By:"}),(0,t.jsx)(R.xv,{children:eo.updated_by})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Created At:"}),(0,t.jsx)(R.xv,{className:"text-sm",children:new Date(eo.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Updated At:"}),(0,t.jsx)(R.xv,{className:"text-sm",children:new Date(eo.updated_at).toLocaleString()})]}),eo.last_health_check&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Last Health Check:"}),(0,t.jsx)(R.xv,{className:"text-sm",children:new Date(eo.last_health_check).toLocaleString()})]})]}),eo.health_check_error&&(0,t.jsxs)("div",{className:"mt-2 p-2 bg-red-50 rounded",children:[(0,t.jsx)(R.xv,{className:"font-medium text-red-700",children:"Health Check Error:"}),(0,t.jsx)(R.xv,{className:"text-sm text-red-600 mt-1",children:eo.health_check_error})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,t.jsx)(W.Z,{language:"python",className:"text-sm",children:'from fastmcp import Client\nimport asyncio\n\n# Standard MCP configuration\nconfig = {\n "mcpServers": {\n "'.concat(eo.server_name,'": {\n "url": "http://localhost:4000/').concat(eo.server_name,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer sk-1234"\n }\n }\n }\n}\n\n# Create a client that connects to the server\nclient = Client(config)\n\nasync def main():\n async with client:\n # List available tools\n tools = await client.list_tools()\n print(f"Available tools: {[tool.name for tool in tools]}")\n\n # Call a tool\n response = await client.call_tool(\n name="tool_name", \n arguments={"arg": "value"}\n )\n print(f"Response: {response}")\n\nif __name__ == "__main__":\n asyncio.run(main())')})]})]})}),(0,t.jsx)(C,{visible:J,onClose:()=>q(!1),accessToken:h||"",modelHubData:w||[],onSuccess:()=>{h&&(async()=>{try{let e=await (0,v.modelHubCall)(h);S(e.data)}catch(e){console.error("Error refreshing model data:",e)}})()}}),(0,t.jsx)(f,{visible:Q,onClose:()=>X(!1),accessToken:h||"",agentHubData:G||[],onSuccess:()=>{h&&(async()=>{try{let e=(await (0,v.getAgentsList)(h)).agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.is_public}));$(e)}catch(e){console.error("Error refreshing agent data:",e)}})()}}),(0,t.jsx)(_,{visible:eh,onClose:()=>ep(!1),accessToken:h||"",mcpHubData:en||[],onSuccess:()=>{h&&(async()=>{try{let e=await (0,v.fetchMCPServers)(h);ei(e)}catch(e){console.error("Error refreshing MCP server data:",e)}})()}})]})}},39957:function(e,s,l){l.d(s,{Z:function(){return g}});var t=l(57437),a=l(53410),r=l(74998),n=l(91126),i=l(23628),c=l(44633),d=l(86462),o=l(3477),x=l(99981),m=l(10012),u=l(58927);function h(e){let{icon:s,onClick:l,className:a,disabled:r,dataTestId:n}=e;return r?(0,t.jsx)(u.J,{icon:s,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":n}):(0,t.jsx)(u.J,{icon:s,size:"sm",onClick:l,className:(0,m.cx)("cursor-pointer",a),"data-testid":n})}l(2265);let p={Edit:{icon:a.Z,className:"hover:text-blue-600"},Delete:{icon:r.Z,className:"hover:text-red-600"},Test:{icon:n.Z,className:"hover:text-blue-600"},Regenerate:{icon:i.Z,className:"hover:text-green-600"},Up:{icon:c.Z,className:"hover:text-blue-600"},Down:{icon:d.Z,className:"hover:text-blue-600"},Open:{icon:o.Z,className:"hover:text-green-600"}};function g(e){let{onClick:s,tooltipText:l,disabled:a=!1,disabledTooltipText:r,dataTestId:n,variant:i}=e,{icon:c,className:d}=p[i];return(0,t.jsx)(x.Z,{title:a?r:l,children:(0,t.jsx)("span",{children:(0,t.jsx)(h,{icon:c,onClick:s,className:d,disabled:a,dataTestId:n})})})}},10012:function(e,s,l){l.d(s,{cx:function(){return n}});var t=l(49096),a=l(53335);let{cva:r,cx:n,compose:i}=(0,t.ZD)({hooks:{onComplete:e=>(0,a.m6)(e)}})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/3862-d5d4e83b9e0293bc.js b/litellm/proxy/_experimental/out/_next/static/chunks/3862-d5d4e83b9e0293bc.js deleted file mode 100644 index 5a13dc7740..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/3862-d5d4e83b9e0293bc.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3862],{64748:function(e,s,l){l.d(s,{Ct:function(){return t.Z},Dx:function(){return m.Z},OK:function(){return n.Z},Zb:function(){return r.Z},nP:function(){return o.Z},td:function(){return c.Z},v0:function(){return i.Z},x4:function(){return d.Z},xv:function(){return x.Z},zx:function(){return a.Z}});var t=l(41649),a=l(78489),r=l(12514),n=l(12485),i=l(18135),c=l(35242),d=l(29706),o=l(77991),x=l(84264),m=l(96761)},78801:function(e,s,l){l.d(s,{Z:function(){return t.Z},x:function(){return a.Z}});var t=l(12514),a=l(84264)},58927:function(e,s,l){l.d(s,{J:function(){return t.Z}});var t=l(47323)},53862:function(e,s,l){l.d(s,{Z:function(){return J}});var t=l(57437),a=l(41649),r=l(78489),n=l(84264),i=l(99981),c=l(3810),d=l(23639),o=l(15424),x=l(2265),m=l(15690),u=l(10032),h=l(61994),p=l(5545),g=l(22116),j=l(96761),v=l(19250),b=l(9114);let{Step:N}=m.default;var f=e=>{let{visible:s,onClose:l,accessToken:r,agentHubData:i,onSuccess:c}=e,[d,o]=(0,x.useState)(0),[f,y]=(0,x.useState)(new Set),[_,k]=(0,x.useState)(!1),[Z]=u.Z.useForm(),w=()=>{o(0),y(new Set),Z.resetFields(),l()},C=(e,s)=>{let l=new Set(f);s?l.add(e):l.delete(e),y(l)},S=e=>{e?y(new Set(i.map(e=>e.agent_id||e.name))):y(new Set)};(0,x.useEffect)(()=>{s&&i.length>0&&y(new Set(i.filter(e=>!0===e.is_public).map(e=>e.agent_id||e.name)))},[s,i]);let M=async()=>{if(0===f.size){b.Z.fromBackend("Please select at least one agent to make public");return}k(!0);try{let e=Array.from(f);await (0,v.makeAgentsPublicCall)(r,e),b.Z.success("Successfully made ".concat(e.length," agent(s) public!")),w(),c()}catch(e){console.error("Error making agents public:",e),b.Z.fromBackend("Failed to make agents public. Please try again.")}finally{k(!1)}},P=()=>{let e=i.length>0&&i.every(e=>f.has(e.agent_id||e.name)),s=f.size>0&&!e;return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(j.Z,{children:"Select Agents to Make Public"}),(0,t.jsx)("div",{className:"flex items-center space-x-2",children:(0,t.jsxs)(h.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===i.length,children:["Select All ",i.length>0&&"(".concat(i.length,")")]})})]}),(0,t.jsx)(n.Z,{className:"text-sm text-gray-600",children:"Select the agents you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these agents."}),(0,t.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,t.jsx)("div",{className:"space-y-3",children:0===i.length?(0,t.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,t.jsx)(n.Z,{children:"No agents available."})}):i.map(e=>{let s=e.agent_id||e.name;return(0,t.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,t.jsx)(h.Z,{checked:f.has(s),onChange:e=>C(s,e.target.checked)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:e.name}),(0,t.jsxs)(a.Z,{color:"blue",size:"sm",children:["v",e.version]})]}),(0,t.jsx)(n.Z,{className:"text-xs text-gray-600 mt-1",children:e.description}),e.skills&&e.skills.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.skills.slice(0,3).map(e=>(0,t.jsx)(a.Z,{color:"purple",size:"xs",children:e.name},e.id)),e.skills.length>3&&(0,t.jsxs)(n.Z,{className:"text-xs text-gray-500",children:["+",e.skills.length-3," more"]})]})]})]},s)})})}),f.size>0&&(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:[(0,t.jsx)("strong",{children:f.size})," agent",1!==f.size?"s":""," selected"]})})]})},z=()=>(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(j.Z,{children:"Confirm Making Agents Public"}),(0,t.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,t.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:[(0,t.jsx)("strong",{children:"Warning:"})," Once you make these agents public, anyone who can go to the"," ",(0,t.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:"Agents to be made public:"}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,t.jsx)("div",{className:"space-y-2",children:Array.from(f).map(e=>{let s=i.find(s=>(s.agent_id||s.name)===e);return(0,t.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:(null==s?void 0:s.name)||e}),s&&(0,t.jsxs)(a.Z,{color:"blue",size:"xs",children:["v",s.version]})]}),(null==s?void 0:s.description)&&(0,t.jsx)(n.Z,{className:"text-xs text-gray-600 mt-1",children:s.description})]})},e)})})})]}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,t.jsx)("strong",{children:f.size})," agent",1!==f.size?"s":""," will be made public"]})})]});return(0,t.jsx)(g.Z,{title:"Make Agents Public",open:s,onCancel:w,footer:null,width:1200,maskClosable:!1,children:(0,t.jsxs)(u.Z,{form:Z,layout:"vertical",children:[(0,t.jsxs)(m.default,{current:d,className:"mb-6",children:[(0,t.jsx)(N,{title:"Select Agents"}),(0,t.jsx)(N,{title:"Confirm"})]}),(()=>{switch(d){case 0:return P();case 1:return z();default:return null}})(),(0,t.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,t.jsx)(p.ZP,{onClick:0===d?w:()=>{1===d&&o(0)},children:0===d?"Cancel":"Previous"}),(0,t.jsxs)("div",{className:"flex space-x-2",children:[0===d&&(0,t.jsx)(p.ZP,{onClick:()=>{if(0===d){if(0===f.size){b.Z.fromBackend("Please select at least one agent to make public");return}o(1)}},disabled:0===f.size,children:"Next"}),1===d&&(0,t.jsx)(p.ZP,{onClick:M,loading:_,children:"Make Public"})]})]})]})})};let{Step:y}=m.default;var _=e=>{let{visible:s,onClose:l,accessToken:r,mcpHubData:i,onSuccess:c}=e,[d,o]=(0,x.useState)(0),[N,f]=(0,x.useState)(new Set),[_,k]=(0,x.useState)(!1),[Z]=u.Z.useForm(),w=()=>{o(0),f(new Set),Z.resetFields(),l()},C=(e,s)=>{let l=new Set(N);s?l.add(e):l.delete(e),f(l)},S=e=>{e?f(new Set(i.map(e=>e.server_id))):f(new Set)};(0,x.useEffect)(()=>{s&&i.length>0&&f(new Set(i.filter(e=>{var s;return(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0}).map(e=>e.server_id)))},[s]);let M=async()=>{if(0===N.size){b.Z.fromBackend("Please select at least one MCP server to make public");return}k(!0);try{let e=Array.from(N);await (0,v.makeMCPPublicCall)(r,e),b.Z.success("Successfully made ".concat(e.length," MCP server(s) public!")),w(),c()}catch(e){console.error("Error making MCP servers public:",e),b.Z.fromBackend("Failed to make MCP servers public. Please try again.")}finally{k(!1)}},P=()=>{let e=i.length>0&&i.every(e=>N.has(e.server_id)),s=N.size>0&&!e;return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(j.Z,{children:"Select MCP Servers to Make Public"}),(0,t.jsx)("div",{className:"flex items-center space-x-2",children:(0,t.jsxs)(h.Z,{checked:e,indeterminate:s,onChange:e=>S(e.target.checked),disabled:0===i.length,children:["Select All ",i.length>0&&"(".concat(i.length,")")]})})]}),(0,t.jsx)(n.Z,{className:"text-sm text-gray-600",children:"Select the MCP servers you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these servers."}),(0,t.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,t.jsx)("div",{className:"space-y-3",children:0===i.length?(0,t.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,t.jsx)(n.Z,{children:"No MCP servers available."})}):i.map(e=>{var s;let l=(null===(s=e.mcp_info)||void 0===s?void 0:s.is_public)===!0;return(0,t.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,t.jsx)(h.Z,{checked:N.has(e.server_id),onChange:s=>C(e.server_id,s.target.checked)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:e.server_name}),l&&(0,t.jsx)(a.Z,{color:"emerald",size:"sm",children:"Public"}),(0,t.jsx)(a.Z,{color:"blue",size:"sm",children:e.transport}),(0,t.jsx)(a.Z,{color:"active"===e.status||"healthy"===e.status?"green":"inactive"===e.status||"unhealthy"===e.status?"red":"gray",size:"sm",children:e.status||"unknown"})]}),(0,t.jsx)(n.Z,{className:"text-xs text-gray-600 mt-1",children:e.description||e.url}),e.allowed_tools&&e.allowed_tools.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[e.allowed_tools.slice(0,3).map((e,s)=>(0,t.jsx)(a.Z,{color:"purple",size:"xs",children:e},s)),e.allowed_tools.length>3&&(0,t.jsxs)(n.Z,{className:"text-xs text-gray-500",children:["+",e.allowed_tools.length-3," more"]})]})]})]},e.server_id)})})}),N.size>0&&(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:[(0,t.jsx)("strong",{children:N.size})," MCP server",1!==N.size?"s":""," selected"]})})]})},z=()=>(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(j.Z,{children:"Confirm Making MCP Servers Public"}),(0,t.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,t.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:[(0,t.jsx)("strong",{children:"Warning:"})," Once you make these MCP servers public, anyone who can go to the"," ",(0,t.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:"MCP Servers to be made public:"}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,t.jsx)("div",{className:"space-y-2",children:Array.from(N).map(e=>{let s=i.find(s=>s.server_id===e);return(0,t.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:(null==s?void 0:s.server_name)||e}),s&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.Z,{color:"blue",size:"xs",children:s.transport}),(0,t.jsx)(a.Z,{color:"active"===s.status||"healthy"===s.status?"green":"inactive"===s.status||"unhealthy"===s.status?"red":"gray",size:"xs",children:s.status||"unknown"})]})]}),(null==s?void 0:s.description)&&(0,t.jsx)(n.Z,{className:"text-xs text-gray-600 mt-1",children:s.description}),(null==s?void 0:s.url)&&(0,t.jsx)(n.Z,{className:"text-xs text-gray-500 mt-1",children:s.url})]})},e)})})})]}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,t.jsx)("strong",{children:N.size})," MCP server",1!==N.size?"s":""," will be made public"]})})]});return(0,t.jsx)(g.Z,{title:"Make MCP Servers Public",open:s,onCancel:w,footer:null,width:1200,maskClosable:!1,children:(0,t.jsxs)(u.Z,{form:Z,layout:"vertical",children:[(0,t.jsxs)(m.default,{current:d,className:"mb-6",children:[(0,t.jsx)(y,{title:"Select Servers"}),(0,t.jsx)(y,{title:"Confirm"})]}),(()=>{switch(d){case 0:return P();case 1:return z();default:return null}})(),(0,t.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,t.jsx)(p.ZP,{onClick:0===d?w:()=>{1===d&&o(0)},children:0===d?"Cancel":"Previous"}),(0,t.jsxs)("div",{className:"flex space-x-2",children:[0===d&&(0,t.jsx)(p.ZP,{onClick:()=>{if(0===d){if(0===N.size){b.Z.fromBackend("Please select at least one MCP server to make public");return}o(1)}},disabled:0===N.size,children:"Next"}),1===d&&(0,t.jsx)(p.ZP,{onClick:M,loading:_,children:"Make Public"})]})]})]})})},k=l(78801),Z=e=>{let{modelHubData:s,onFilteredDataChange:l,showFiltersCard:a=!0,className:r=""}=e,[n,i]=(0,x.useState)(""),[c,d]=(0,x.useState)(""),[o,m]=(0,x.useState)(""),[u,h]=(0,x.useState)(""),p=(0,x.useRef)([]),g=(0,x.useMemo)(()=>(null==s?void 0:s.filter(e=>{let s=e.model_group.toLowerCase().includes(n.toLowerCase()),l=""===c||e.providers.includes(c),t=""===o||e.mode===o,a=""===u||Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).some(e=>{let[s]=e;return s.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")===u});return s&&l&&t&&a}))||[],[s,n,c,o,u]);(0,x.useEffect)(()=>{(g.length!==p.current.length||g.some((e,s)=>{var l;return e.model_group!==(null===(l=p.current[s])||void 0===l?void 0:l.model_group)}))&&(p.current=g,l(g))},[g,l]);let j=(0,t.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(k.x,{className:"text-sm font-medium mb-2",children:"Search Models:"}),(0,t.jsx)("input",{type:"text",placeholder:"Search model names...",value:n,onChange:e=>i(e.target.value),className:"border rounded px-3 py-2 w-64 h-10 text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(k.x,{className:"text-sm font-medium mb-2",children:"Provider:"}),(0,t.jsxs)("select",{value:c,onChange:e=>d(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-40 h-10",children:[(0,t.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Providers"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.providers.forEach(e=>s.add(e))}),Array.from(s)})(s).map(e=>(0,t.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(k.x,{className:"text-sm font-medium mb-2",children:"Mode:"}),(0,t.jsxs)("select",{value:o,onChange:e=>m(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-32 h-10",children:[(0,t.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Modes"}),s&&(e=>{let s=new Set;return e.forEach(e=>{e.mode&&s.add(e.mode)}),Array.from(s)})(s).map(e=>(0,t.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(k.x,{className:"text-sm font-medium mb-2",children:"Features:"}),(0,t.jsxs)("select",{value:u,onChange:e=>h(e.target.value),className:"border rounded px-3 py-2 text-sm text-gray-600 w-48 h-10",children:[(0,t.jsx)("option",{value:"",className:"text-sm text-gray-600",children:"All Features"}),s&&(e=>{let s=new Set;return e.forEach(e=>{Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).forEach(e=>{let[l]=e,t=l.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");s.add(t)})}),Array.from(s).sort()})(s).map(e=>(0,t.jsx)("option",{value:e,className:"text-sm text-gray-800",children:e},e))]})]}),(n||c||o||u)&&(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsx)("button",{onClick:()=>{i(""),d(""),m(""),h("")},className:"text-blue-600 hover:text-blue-800 text-sm underline h-10 flex items-center",children:"Clear Filters"})})]});return a?(0,t.jsx)(k.Z,{className:"mb-6 ".concat(r),children:j}):(0,t.jsx)("div",{className:r,children:j})};let{Step:w}=m.default;var C=e=>{let{visible:s,onClose:l,accessToken:r,modelHubData:i,onSuccess:c}=e,[d,o]=(0,x.useState)(0),[N,f]=(0,x.useState)(new Set),[y,_]=(0,x.useState)([]),[k,C]=(0,x.useState)(!1),[S]=u.Z.useForm(),M=()=>{o(0),f(new Set),_([]),S.resetFields(),l()},P=(e,s)=>{let l=new Set(N);s?l.add(e):l.delete(e),f(l)},z=e=>{e?f(new Set(y.map(e=>e.model_group))):f(new Set)},A=(0,x.useCallback)(e=>{_(e)},[]);(0,x.useEffect)(()=>{s&&i.length>0&&(_(i),f(new Set(i.filter(e=>!0===e.is_public_model_group).map(e=>e.model_group))))},[s,i]);let F=async()=>{if(0===N.size){b.Z.fromBackend("Please select at least one model to make public");return}C(!0);try{let e=Array.from(N);await (0,v.makeModelGroupPublic)(r,e),b.Z.success("Successfully made ".concat(e.length," model group(s) public!")),M(),c()}catch(e){console.error("Error making model groups public:",e),b.Z.fromBackend("Failed to make model groups public. Please try again.")}finally{C(!1)}},L=()=>{let e=y.length>0&&y.every(e=>N.has(e.model_group)),s=N.size>0&&!e;return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(j.Z,{children:"Select Models to Make Public"}),(0,t.jsx)("div",{className:"flex items-center space-x-2",children:(0,t.jsxs)(h.Z,{checked:e,indeterminate:s,onChange:e=>z(e.target.checked),disabled:0===y.length,children:["Select All ",y.length>0&&"(".concat(y.length,")")]})})]}),(0,t.jsx)(n.Z,{className:"text-sm text-gray-600",children:"Select the models you want to be visible on the public model hub. Users will still require a valid Virtual Key to use these models."}),(0,t.jsx)(Z,{modelHubData:i,onFilteredDataChange:A,showFiltersCard:!1,className:"border rounded-lg p-4 bg-gray-50"}),(0,t.jsx)("div",{className:"max-h-96 overflow-y-auto border rounded-lg p-4",children:(0,t.jsx)("div",{className:"space-y-3",children:0===y.length?(0,t.jsx)("div",{className:"text-center py-8 text-gray-500",children:(0,t.jsx)(n.Z,{children:"No models match the current filters."})}):y.map(e=>(0,t.jsxs)("div",{className:"flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-50",children:[(0,t.jsx)(h.Z,{checked:N.has(e.model_group),onChange:s=>P(e.model_group,s.target.checked)}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:e.model_group}),e.mode&&(0,t.jsx)(a.Z,{color:"green",size:"sm",children:e.mode})]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.providers.map(e=>(0,t.jsx)(a.Z,{color:"blue",size:"xs",children:e},e))})]})]},e.model_group))})}),N.size>0&&(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:[(0,t.jsx)("strong",{children:N.size})," model",1!==N.size?"s":""," selected"]})})]})},T=()=>(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(j.Z,{children:"Confirm Making Models Public"}),(0,t.jsx)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:(0,t.jsxs)(n.Z,{className:"text-sm text-yellow-800",children:[(0,t.jsx)("strong",{children:"Warning:"})," Once you make these models public, anyone who can go to the"," ",(0,t.jsx)("code",{children:"/ui/model_hub_table"})," will be able to know they exist on the proxy."]})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(n.Z,{className:"font-medium",children:"Models to be made public:"}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto border rounded-lg p-3",children:(0,t.jsx)("div",{className:"space-y-2",children:Array.from(N).map(e=>{let s=i.find(s=>s.model_group===e);return(0,t.jsx)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:(0,t.jsxs)("div",{children:[(0,t.jsx)(n.Z,{className:"font-medium",children:e}),s&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:s.providers.map(e=>(0,t.jsx)(a.Z,{color:"blue",size:"xs",children:e},e))})]})},e)})})})]}),(0,t.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:(0,t.jsxs)(n.Z,{className:"text-sm text-blue-800",children:["Total: ",(0,t.jsx)("strong",{children:N.size})," model",1!==N.size?"s":""," will be made public"]})})]});return(0,t.jsx)(g.Z,{title:"Make Models Public",open:s,onCancel:M,footer:null,width:1200,maskClosable:!1,children:(0,t.jsxs)(u.Z,{form:S,layout:"vertical",children:[(0,t.jsxs)(m.default,{current:d,className:"mb-6",children:[(0,t.jsx)(w,{title:"Select Models"}),(0,t.jsx)(w,{title:"Confirm"})]}),(()=>{switch(d){case 0:return L();case 1:return T();default:return null}})(),(0,t.jsxs)("div",{className:"flex justify-between mt-6",children:[(0,t.jsx)(p.ZP,{onClick:0===d?M:()=>{1===d&&o(0)},children:0===d?"Cancel":"Previous"}),(0,t.jsxs)("div",{className:"flex space-x-2",children:[0===d&&(0,t.jsx)(p.ZP,{onClick:()=>{if(0===d){if(0===N.size){b.Z.fromBackend("Please select at least one model to make public");return}o(1)}},disabled:0===N.size,children:"Next"}),1===d&&(0,t.jsx)(p.ZP,{onClick:F,loading:k,children:"Make Public"})]})]})]})})};let S=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),M=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),P=e=>"$".concat((1e6*e).toFixed(2)),z=e=>e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString(),A=function(e,s){let l=arguments.length>2&&void 0!==arguments[2]&&arguments[2],x=[{header:"Public Model Name",accessorKey:"model_group",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium text-sm",children:a.model_group}),(0,t.jsx)(i.Z,{title:"Copy model name",children:(0,t.jsx)(d.Z,{onClick:()=>s(a.model_group),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsx)(n.Z,{className:"text-xs text-gray-600",children:a.providers.join(", ")})})]})}},{header:"Provider",accessorKey:"providers",enableSorting:!0,sortingFn:(e,s)=>{let l=e.original.providers.join(", "),t=s.original.providers.join(", ");return l.localeCompare(t)},cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.providers.slice(0,2).map(e=>(0,t.jsx)(c.Z,{color:"blue",className:"text-xs",children:e},e)),l.providers.length>2&&(0,t.jsxs)(n.Z,{className:"text-xs text-gray-500",children:["+",l.providers.length-2]})]})},meta:{className:"hidden md:table-cell"}},{header:"Mode",accessorKey:"mode",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return l.mode?(0,t.jsx)(a.Z,{color:"green",size:"sm",children:l.mode}):(0,t.jsx)(n.Z,{className:"text-gray-500",children:"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Tokens",accessorKey:"max_input_tokens",enableSorting:!0,sortingFn:(e,s)=>(e.original.max_input_tokens||0)+(e.original.max_output_tokens||0)-((s.original.max_input_tokens||0)+(s.original.max_output_tokens||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsxs)(n.Z,{className:"text-xs",children:[l.max_input_tokens?z(l.max_input_tokens):"-"," /"," ",l.max_output_tokens?z(l.max_output_tokens):"-"]})})},meta:{className:"hidden lg:table-cell"}},{header:"Cost/1M",accessorKey:"input_cost_per_token",enableSorting:!0,sortingFn:(e,s)=>(e.original.input_cost_per_token||0)+(e.original.output_cost_per_token||0)-((s.original.input_cost_per_token||0)+(s.original.output_cost_per_token||0)),cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(n.Z,{className:"text-xs",children:l.input_cost_per_token?P(l.input_cost_per_token):"-"}),(0,t.jsx)(n.Z,{className:"text-xs text-gray-500",children:l.output_cost_per_token?P(l.output_cost_per_token):"-"})]})}},{header:"Features",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=M(s.original),r=["green","blue","purple","orange","red","yellow"];return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,t.jsx)(n.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map((e,s)=>(0,t.jsx)(a.Z,{color:r[s%r.length],size:"xs",children:S(e)},e))})}},{header:"Public",accessorKey:"is_public_model_group",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public_model_group?1:0)-(!0===s.original.is_public_model_group?1:0),cell:e=>{let{row:s}=e;return!0===s.original.is_public_model_group?(0,t.jsx)(a.Z,{color:"green",size:"xs",children:"Yes"}):(0,t.jsx)(a.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,a=l.original;return(0,t.jsxs)(r.Z,{size:"xs",variant:"secondary",onClick:()=>e(a),icon:o.Z,children:[(0,t.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,t.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}];return l?x.filter(e=>!("accessorKey"in e)||"is_public_model_group"!==e.accessorKey):x};var F=l(39957),L=l(20347),T=l(86462),D=l(47686),O=l(77355),E=l(3477),K=l(95704),U=l(27648),I=e=>{let{accessToken:s,userRole:l}=e,[a,r]=(0,x.useState)([]),[n,i]=(0,x.useState)({url:"",displayName:""}),[c,d]=(0,x.useState)(null),[o,m]=(0,x.useState)(!1),[u,h]=(0,x.useState)(!0),[p,g]=(0,x.useState)(!1),[j,N]=(0,x.useState)([]),f=async()=>{if(s)try{m(!0);let e=await (0,v.getPublicModelHubInfo)();if(e&&e.useful_links){let s=e.useful_links||{},l=Object.entries(s).map(e=>{var s,l;let[t,a]=e;return"object"==typeof a&&null!==a&&"url"in a?{id:"".concat(null!==(s=a.index)&&void 0!==s?s:0,"-").concat(t),displayName:t,url:a.url,index:null!==(l=a.index)&&void 0!==l?l:0}:{id:"0-".concat(t),displayName:t,url:a,index:0}}).sort((e,s)=>{var l,t;return(null!==(l=e.index)&&void 0!==l?l:0)-(null!==(t=s.index)&&void 0!==t?t:0)}).map((e,s)=>({...e,id:"".concat(s,"-").concat(e.displayName)}));r(l)}else r([])}catch(e){console.error("Error fetching useful links:",e),r([])}finally{m(!1)}};if((0,x.useEffect)(()=>{f()},[s]),!(0,L.tY)(l||""))return null;let y=async e=>{if(!s)return!1;try{let l={};return e.forEach((e,s)=>{l[e.displayName]={url:e.url,index:s}}),await (0,v.updateUsefulLinksCall)(s,l),!0}catch(e){return console.error("Error saving links:",e),b.Z.fromBackend("Failed to save links - ".concat(e)),!1}},_=async()=>{if(!n.url||!n.displayName)return;try{new URL(n.url)}catch(e){b.Z.fromBackend("Please enter a valid URL");return}if(a.some(e=>e.displayName===n.displayName)){b.Z.fromBackend("A link with this display name already exists");return}let e=[...a,{id:"".concat(Date.now(),"-").concat(n.displayName),displayName:n.displayName,url:n.url}];await y(e)&&(r(e),i({url:"",displayName:""}),b.Z.success("Link added successfully"))},k=e=>{d({...e})},Z=async()=>{if(!c)return;try{new URL(c.url)}catch(e){b.Z.fromBackend("Please enter a valid URL");return}if(a.some(e=>e.id!==c.id&&e.displayName===c.displayName)){b.Z.fromBackend("A link with this display name already exists");return}let e=a.map(e=>e.id===c.id?c:e);await y(e)&&(r(e),d(null),b.Z.success("Link updated successfully"))},w=()=>{d(null)},C=async e=>{let s=a.filter(s=>s.id!==e);await y(s)&&(r(s),b.Z.success("Link deleted successfully"))},S=e=>{window.open(e,"_blank")},M=async()=>{await y(a)&&(g(!1),N([]),b.Z.success("Link order saved successfully"))},P=e=>{if(0===e)return;let s=[...a];[s[e-1],s[e]]=[s[e],s[e-1]],r(s)},z=e=>{if(e===a.length-1)return;let s=[...a];[s[e],s[e+1]]=[s[e+1],s[e]],r(s)};return(0,t.jsxs)(K.Zb,{className:"mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between cursor-pointer",onClick:()=>h(!u),children:[(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)(K.Dx,{className:"mb-0",children:"Link Management"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Manage the links that are displayed under 'Useful Links' on the public model hub."})]}),(0,t.jsx)("div",{className:"flex items-center",children:u?(0,t.jsx)(T.Z,{className:"w-5 h-5 text-gray-500"}):(0,t.jsx)(D.Z,{className:"w-5 h-5 text-gray-500"})})]}),u&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)(K.xv,{className:"text-sm font-medium text-gray-700 mb-2",children:"Add New Link"}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Display Name"}),(0,t.jsx)("input",{type:"text",value:n.displayName,onChange:e=>i({...n,displayName:e.target.value}),placeholder:"Friendly name",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"URL"}),(0,t.jsx)("input",{type:"text",value:n.url,onChange:e=>i({...n,url:e.target.value}),placeholder:"https://example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm"})]}),(0,t.jsx)("div",{className:"flex items-end",children:(0,t.jsxs)("button",{onClick:_,disabled:!n.url||!n.displayName,className:"flex items-center px-4 py-2 rounded-md text-sm ".concat(n.url&&n.displayName?"bg-green-600 text-white hover:bg-green-700":"bg-gray-300 text-gray-500 cursor-not-allowed"),children:[(0,t.jsx)(O.Z,{className:"w-4 h-4 mr-1"}),"Add Link"]})})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsx)(K.xv,{className:"text-sm font-medium text-gray-700",children:"Manage Existing Links"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)(U.default,{href:"".concat((0,v.getProxyBaseUrl)(),"/ui/model_hub_table"),target:"_blank",rel:"noopener noreferrer",className:"text-xs bg-blue-50 text-blue-600 px-3 py-1.5 rounded hover:bg-blue-100 flex items-center",title:"Open Public Model Hub",children:["Public Model Hub",(0,t.jsx)(E.Z,{className:"w-4 h-4 ml-1"})]}),p?(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:M,className:"text-xs bg-green-600 text-white px-3 py-1.5 rounded hover:bg-green-700",children:"Save Order"}),(0,t.jsx)("button",{onClick:()=>{r([...j]),g(!1),N([])},className:"text-xs bg-gray-50 text-gray-600 px-3 py-1.5 rounded hover:bg-gray-100",children:"Cancel"})]}):(0,t.jsx)("button",{onClick:()=>{c&&d(null),N([...a]),g(!0)},className:"text-xs bg-purple-50 text-purple-600 px-3 py-1.5 rounded hover:bg-purple-100 flex items-center",children:"Rearrange Order"})]})]}),(0,t.jsx)("div",{className:"rounded-lg custom-border relative",children:(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)(K.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,t.jsx)(K.ss,{children:(0,t.jsxs)(K.SC,{children:[(0,t.jsx)(K.xs,{className:"py-1 h-8",children:"Display Name"}),(0,t.jsx)(K.xs,{className:"py-1 h-8",children:"URL"}),(0,t.jsx)(K.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,t.jsxs)(K.RM,{children:[a.map((e,s)=>(0,t.jsx)(K.SC,{className:"h-8",children:c&&c.id===e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(K.pj,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:c.displayName,onChange:e=>d({...c,displayName:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(K.pj,{className:"py-0.5",children:(0,t.jsx)("input",{type:"text",value:c.url,onChange:e=>d({...c,url:e.target.value}),className:"w-full px-2 py-1 border border-gray-300 rounded-md text-sm"})}),(0,t.jsx)(K.pj,{className:"py-0.5 whitespace-nowrap",children:(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)("button",{onClick:Z,className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:"Save"}),(0,t.jsx)("button",{onClick:w,className:"text-xs bg-gray-50 text-gray-600 px-2 py-1 rounded hover:bg-gray-100",children:"Cancel"})]})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(K.pj,{className:"py-0.5 text-sm text-gray-900",children:e.displayName}),(0,t.jsx)(K.pj,{className:"py-0.5 text-sm text-gray-500",children:e.url}),(0,t.jsx)(K.pj,{className:"py-0.5 whitespace-nowrap",children:p?(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)(F.Z,{variant:"Up",onClick:()=>P(s),tooltipText:"Move up",disabled:0===s,disabledTooltipText:"Already at the top",dataTestId:"move-up-".concat(e.id)}),(0,t.jsx)(F.Z,{variant:"Down",onClick:()=>z(s),tooltipText:"Move down",disabled:s===a.length-1,disabledTooltipText:"Already at the bottom",dataTestId:"move-down-".concat(e.id)})]}):(0,t.jsxs)("div",{className:"flex space-x-2",children:[(0,t.jsx)(F.Z,{variant:"Open",onClick:()=>S(e.url),tooltipText:"Open link",dataTestId:"open-link-".concat(e.id)}),(0,t.jsx)(F.Z,{variant:"Edit",onClick:()=>k(e),tooltipText:"Edit link",dataTestId:"edit-link-".concat(e.id)}),(0,t.jsx)(F.Z,{variant:"Delete",onClick:()=>C(e.id),tooltipText:"Delete link",dataTestId:"delete-link-".concat(e.id)})]})})]})},e.id)),0===a.length&&(0,t.jsx)(K.SC,{children:(0,t.jsx)(K.pj,{colSpan:3,className:"py-0.5 text-sm text-gray-500 text-center",children:"No links added yet. Add a new link above."})})]})]})})})]})]})},H=l(8048),B=l(87526),R=l(64748),Y=l(78867),V=l(99376),W=l(17906),J=e=>{var s,l,m,u;let{accessToken:h,publicPage:p,premiumUser:j,userRole:N}=e,[y,k]=(0,x.useState)(!1),[w,S]=(0,x.useState)(null),[M,P]=(0,x.useState)(!0),[z,F]=(0,x.useState)(!1),[T,D]=(0,x.useState)(!1),[O,E]=(0,x.useState)(null),[K,U]=(0,x.useState)([]),[J,q]=(0,x.useState)(!1),[G,$]=(0,x.useState)(null),[Q,X]=(0,x.useState)(!1),[ee,es]=(0,x.useState)(!0),[el,et]=(0,x.useState)(null),[ea,er]=(0,x.useState)(!1),[en,ei]=(0,x.useState)(null),[ec,ed]=(0,x.useState)(!0),[eo,ex]=(0,x.useState)(null),[em,eu]=(0,x.useState)(!1),[eh,ep]=(0,x.useState)(!1),eg=(0,V.useRouter)();(0,x.useEffect)(()=>{let e=async e=>{try{P(!0);let s=await (0,v.modelHubCall)(e);console.log("ModelHubData:",s),S(s.data),(0,v.getConfigFieldSetting)(e,"enable_public_model_hub").then(e=>{console.log("data: ".concat(JSON.stringify(e))),!0==e.field_value&&k(!0)}).catch(e=>{})}catch(e){console.error("There was an error fetching the model data",e)}finally{P(!1)}},s=async()=>{try{var e,s;P(!0),await (0,v.getUiConfig)();let l=await (0,v.modelHubPublicModelsCall)();console.log("ModelHubData:",l),console.log("First model structure:",l[0]),console.log("Model has model_group?",null===(e=l[0])||void 0===e?void 0:e.model_group),console.log("Model has providers?",null===(s=l[0])||void 0===s?void 0:s.providers),S(l),k(!0)}catch(e){console.error("There was an error fetching the public model data",e)}finally{P(!1)}};h?e(h):p&&s()},[h,p]),(0,x.useEffect)(()=>{let e=async()=>{if(h)try{es(!0);let e=await (0,v.getAgentsList)(h);console.log("AgentHubData:",e);let s=e.agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.litellm_params.is_public}));$(s)}catch(e){console.error("There was an error fetching the agent data",e)}finally{es(!1)}};p||e()},[p,h]),(0,x.useEffect)(()=>{let e=async()=>{if(h)try{ed(!0);let e=await (0,v.fetchMCPServers)(h);console.log("MCPHubData:",e),ei(e)}catch(e){console.error("There was an error fetching the MCP server data",e)}finally{ed(!1)}};p||e()},[p,h]);let ej=()=>{h&&q(!0)},ev=()=>{h&&X(!0)},eb=()=>{h&&ep(!0)},eN=()=>{F(!1),D(!1),E(null),er(!1),et(null),eu(!1),ex(null)},ef=()=>{F(!1),D(!1),E(null),er(!1),et(null),eu(!1),ex(null)},ey=e=>{navigator.clipboard.writeText(e),b.Z.success("Copied to clipboard!")},e_=e=>e.replace(/^supports_/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),ek=e=>Object.entries(e).filter(e=>{let[s,l]=e;return s.startsWith("supports_")&&!0===l}).map(e=>{let[s]=e;return s}),eZ=e=>"$".concat((1e6*e).toFixed(2)),ew=(0,x.useCallback)(e=>{U(e)},[]);return(console.log("publicPage: ",p),console.log("publicPageAllowed: ",y),p&&y)?(0,t.jsx)(B.Z,{accessToken:h}):(0,t.jsxs)("div",{className:"w-full mx-4 h-[75vh]",children:[!1==p?(0,t.jsxs)("div",{className:"w-full m-2 mt-2 p-8",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("div",{className:"flex flex-col items-start",children:[(0,t.jsx)(R.Dx,{className:"text-center",children:"AI Hub"}),(0,L.tY)(N||"")?(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"Make models, agents, and MCP servers public for developers to know what's available."}):(0,t.jsx)("p",{className:"text-sm text-gray-600",children:"A list of all public model names personally available to you."})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)(R.xv,{children:"Model Hub URL:"}),(0,t.jsxs)("div",{className:"flex items-center bg-gray-200 px-2 py-1 rounded",children:[(0,t.jsx)(R.xv,{className:"mr-2",children:"".concat((0,v.getProxyBaseUrl)(),"/ui/model_hub_table")}),(0,t.jsx)("button",{onClick:()=>ey("".concat((0,v.getProxyBaseUrl)(),"/ui/model_hub_table")),className:"p-1 hover:bg-gray-300 rounded transition-colors",title:"Copy URL",children:(0,t.jsx)(Y.Z,{size:16,className:"text-gray-600"})})]})]})]}),(0,L.tY)(N||"")&&(0,t.jsx)("div",{className:"mt-8 mb-2",children:(0,t.jsx)(I,{accessToken:h,userRole:N})}),(0,t.jsxs)(R.v0,{children:[(0,t.jsxs)(R.td,{className:"mb-4",children:[(0,t.jsx)(R.OK,{children:"Model Hub"}),(0,t.jsx)(R.OK,{children:"Agent Hub"}),(0,t.jsx)(R.OK,{children:"MCP Hub"})]}),(0,t.jsxs)(R.nP,{children:[(0,t.jsxs)(R.x4,{children:[(0,t.jsxs)(R.Zb,{children:[!1==p&&(0,L.tY)(N||"")&&(0,t.jsx)("div",{className:"flex justify-end mb-4",children:(0,t.jsx)(R.zx,{onClick:()=>ej(),children:"Select Models to Make Public"})}),(0,t.jsx)(Z,{modelHubData:w||[],onFilteredDataChange:ew}),(0,t.jsx)(H.C,{columns:A(e=>{E(e),F(!0)},ey,p),data:K,isLoading:M,defaultSorting:[{id:"model_group",desc:!1}]})]}),(0,t.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,t.jsxs)(R.xv,{className:"text-sm text-gray-600",children:["Showing ",K.length," of ",(null==w?void 0:w.length)||0," models"]})})]}),(0,t.jsxs)(R.x4,{children:[(0,t.jsxs)(R.Zb,{children:[!1==p&&(0,L.tY)(N||"")&&(0,t.jsx)("div",{className:"flex justify-end mb-4",children:(0,t.jsx)(R.zx,{onClick:()=>ev(),children:"Select Agents to Make Public"})}),(0,t.jsx)(H.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Agent Name",accessorKey:"name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium text-sm",children:a.name}),(0,t.jsx)(i.Z,{title:"Copy agent name",children:(0,t.jsx)(d.Z,{onClick:()=>s(a.name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsx)(n.Z,{className:"text-xs text-gray-600",children:a.description})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)(n.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"Version",accessorKey:"version",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsxs)(a.Z,{color:"blue",size:"sm",children:["v",l.version]})},meta:{className:"hidden lg:table-cell"}},{header:"Protocol",accessorKey:"protocolVersion",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)(n.Z,{className:"text-xs",children:l.protocolVersion||"-"})},meta:{className:"hidden lg:table-cell"}},{header:"Skills",accessorKey:"skills",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.skills||[];return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(n.Z,{className:"text-xs font-medium",children:[l.length," skill",1!==l.length?"s":""]}),l.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map(e=>(0,t.jsx)(c.Z,{color:"purple",className:"text-xs",children:e.name},e.id)),l.length>2&&(0,t.jsxs)(n.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})}},{header:"Capabilities",accessorKey:"capabilities",enableSorting:!1,cell:e=>{let{row:s}=e,l=Object.entries(s.original.capabilities||{}).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return s});return(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:0===l.length?(0,t.jsx)(n.Z,{className:"text-gray-500 text-xs",children:"-"}):l.map(e=>(0,t.jsx)(a.Z,{color:"green",size:"xs",children:e},e))})}},{header:"I/O Modes",accessorKey:"defaultInputModes",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original,a=l.defaultInputModes||[],r=l.defaultOutputModes||[];return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(n.Z,{className:"text-xs",children:[(0,t.jsx)("span",{className:"font-medium",children:"In:"})," ",a.join(", ")||"-"]}),(0,t.jsxs)(n.Z,{className:"text-xs",children:[(0,t.jsx)("span",{className:"font-medium",children:"Out:"})," ",r.join(", ")||"-"]})]})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"is_public",enableSorting:!0,sortingFn:(e,s)=>(!0===e.original.is_public?1:0)-(!0===s.original.is_public?1:0),cell:e=>{let{row:s}=e;return console.log("CHECKPOINT 1: ".concat(JSON.stringify(s.original))),!0===s.original.is_public?(0,t.jsx)(a.Z,{color:"green",size:"xs",children:"Yes"}):(0,t.jsx)(a.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,a=l.original;return(0,t.jsxs)(r.Z,{size:"xs",variant:"secondary",onClick:()=>e(a),icon:o.Z,children:[(0,t.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,t.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{et(e),er(!0)},ey,p),data:G||[],isLoading:ee,defaultSorting:[{id:"name",desc:!1}]})]}),(0,t.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,t.jsxs)(R.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==G?void 0:G.length)||0," agent",(null==G?void 0:G.length)!==1?"s":""]})})]}),(0,t.jsxs)(R.x4,{children:[(0,t.jsxs)(R.Zb,{children:[!1==p&&(0,L.tY)(N||"")&&(0,t.jsx)("div",{className:"flex justify-end mb-4",children:(0,t.jsx)(R.zx,{onClick:()=>eb(),children:"Select MCP Servers to Make Public"})}),(0,t.jsx)(H.C,{columns:function(e,s){return arguments.length>2&&void 0!==arguments[2]&&arguments[2],[{header:"Server Name",accessorKey:"server_name",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"font-medium text-sm",children:a.server_name}),(0,t.jsx)(i.Z,{title:"Copy server name",children:(0,t.jsx)(d.Z,{onClick:()=>s(a.server_name),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs"})})]}),(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsx)(n.Z,{className:"text-xs text-gray-600",children:a.description||"-"})})]})}},{header:"Description",accessorKey:"description",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)(n.Z,{className:"text-xs line-clamp-2",children:l.description||"-"})},meta:{className:"hidden md:table-cell"}},{header:"URL",accessorKey:"url",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:l}=e,a=l.original;return(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.Z,{className:"text-xs truncate max-w-xs",children:a.url}),(0,t.jsx)(i.Z,{title:"Copy URL",children:(0,t.jsx)(d.Z,{onClick:()=>s(a.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 text-xs flex-shrink-0"})})]})},meta:{className:"hidden lg:table-cell"}},{header:"Transport",accessorKey:"transport",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)(a.Z,{color:"blue",size:"sm",children:l.transport})},meta:{className:"hidden md:table-cell"}},{header:"Auth Type",accessorKey:"auth_type",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,r="none"===l.auth_type?"gray":"green";return(0,t.jsx)(a.Z,{color:r,size:"sm",children:l.auth_type})},meta:{className:"hidden md:table-cell"}},{header:"Status",accessorKey:"status",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original,r={active:"green",inactive:"red",unknown:"gray",healthy:"green",unhealthy:"red"}[l.status]||"gray";return(0,t.jsx)(a.Z,{color:r,size:"sm",children:l.status||"unknown"})}},{header:"Tools",accessorKey:"allowed_tools",enableSorting:!1,cell:e=>{let{row:s}=e,l=s.original.allowed_tools||[];return(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(n.Z,{className:"text-xs font-medium",children:l.length>0?"".concat(l.length," tool").concat(1!==l.length?"s":""):"All tools"}),l.length>0&&(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l.slice(0,2).map((e,s)=>(0,t.jsx)(c.Z,{color:"purple",className:"text-xs",children:e},s)),l.length>2&&(0,t.jsxs)(n.Z,{className:"text-xs text-gray-500",children:["+",l.length-2]})]})]})},meta:{className:"hidden lg:table-cell"}},{header:"Created By",accessorKey:"created_by",enableSorting:!0,sortingFn:"alphanumeric",cell:e=>{let{row:s}=e,l=s.original;return(0,t.jsx)(n.Z,{className:"text-xs",children:l.created_by||"-"})},meta:{className:"hidden xl:table-cell"}},{header:"Public",accessorKey:"mcp_info.is_public",enableSorting:!0,sortingFn:(e,s)=>{var l,t;return((null===(l=e.original.mcp_info)||void 0===l?void 0:l.is_public)===!0?1:0)-((null===(t=s.original.mcp_info)||void 0===t?void 0:t.is_public)===!0?1:0)},cell:e=>{var s;let{row:l}=e;return(null===(s=l.original.mcp_info)||void 0===s?void 0:s.is_public)===!0?(0,t.jsx)(a.Z,{color:"green",size:"xs",children:"Yes"}):(0,t.jsx)(a.Z,{color:"gray",size:"xs",children:"No"})},meta:{className:"hidden md:table-cell"}},{header:"Details",id:"details",enableSorting:!1,cell:s=>{let{row:l}=s,a=l.original;return(0,t.jsxs)(r.Z,{size:"xs",variant:"secondary",onClick:()=>e(a),icon:o.Z,children:[(0,t.jsx)("span",{className:"hidden lg:inline",children:"Details"}),(0,t.jsx)("span",{className:"lg:hidden",children:"Info"})]})}}]}(e=>{ex(e),eu(!0)},ey,p),data:en||[],isLoading:ec,defaultSorting:[{id:"server_name",desc:!1}]})]}),(0,t.jsx)("div",{className:"mt-4 text-center space-y-2",children:(0,t.jsxs)(R.xv,{className:"text-sm text-gray-600",children:["Showing ",(null==en?void 0:en.length)||0," MCP server",(null==en?void 0:en.length)!==1?"s":""]})})]})]})]})]}):(0,t.jsxs)(R.Zb,{className:"mx-auto max-w-xl mt-10",children:[(0,t.jsx)(R.xv,{className:"text-xl text-center mb-2 text-black",children:"Public Model Hub not enabled."}),(0,t.jsx)("p",{className:"text-base text-center text-slate-800",children:"Ask your proxy admin to enable this on their Admin UI."})]}),(0,t.jsx)(g.Z,{title:"Public Model Hub",width:600,visible:T,footer:null,onOk:eN,onCancel:ef,children:(0,t.jsxs)("div",{className:"pt-5 pb-5",children:[(0,t.jsxs)("div",{className:"flex justify-between mb-4",children:[(0,t.jsx)(R.xv,{className:"text-base mr-2",children:"Shareable Link:"}),(0,t.jsx)(R.xv,{className:"max-w-sm ml-2 bg-gray-200 pr-2 pl-2 pt-1 pb-1 text-center rounded",children:"".concat((0,v.getProxyBaseUrl)(),"/ui/model_hub_table")})]}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(R.zx,{onClick:()=>{eg.replace("/model_hub_table?key=".concat(h))},children:"See Page"})})]})}),(0,t.jsx)(g.Z,{title:(null==O?void 0:O.model_group)||"Model Details",width:1e3,visible:z,footer:null,onOk:eN,onCancel:ef,children:O&&(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Model Overview"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Model Group:"}),(0,t.jsx)(R.xv,{children:O.model_group})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Mode:"}),(0,t.jsx)(R.xv,{children:O.mode||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Providers:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:O.providers.map(e=>(0,t.jsx)(R.Ct,{color:"blue",children:e},e))})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Token & Cost Information"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Max Input Tokens:"}),(0,t.jsx)(R.xv,{children:(null===(s=O.max_input_tokens)||void 0===s?void 0:s.toLocaleString())||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Max Output Tokens:"}),(0,t.jsx)(R.xv,{children:(null===(l=O.max_output_tokens)||void 0===l?void 0:l.toLocaleString())||"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Input Cost per 1M Tokens:"}),(0,t.jsx)(R.xv,{children:O.input_cost_per_token?eZ(O.input_cost_per_token):"Not specified"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Output Cost per 1M Tokens:"}),(0,t.jsx)(R.xv,{children:O.output_cost_per_token?eZ(O.output_cost_per_token):"Not specified"})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:(()=>{let e=ek(O),s=["green","blue","purple","orange","red","yellow"];return 0===e.length?(0,t.jsx)(R.xv,{className:"text-gray-500",children:"No special capabilities listed"}):e.map((e,l)=>(0,t.jsx)(R.Ct,{color:s[l%s.length],children:e_(e)},e))})()})]}),(O.tpm||O.rpm)&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Rate Limits"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[O.tpm&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Tokens per Minute:"}),(0,t.jsx)(R.xv,{children:O.tpm.toLocaleString()})]}),O.rpm&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Requests per Minute:"}),(0,t.jsx)(R.xv,{children:O.rpm.toLocaleString()})]})]})]}),O.supported_openai_params&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Supported OpenAI Parameters"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:O.supported_openai_params.map(e=>(0,t.jsx)(R.Ct,{color:"green",children:e},e))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,t.jsx)(W.Z,{language:"python",className:"text-sm",children:'import openai\n\nclient = openai.OpenAI(\n api_key="your_api_key",\n base_url="http://0.0.0.0:4000" # Your LiteLLM Proxy URL\n)\n\nresponse = client.chat.completions.create(\n model="'.concat(O.model_group,'",\n messages=[\n {\n "role": "user",\n "content": "Hello, how are you?"\n }\n ]\n)\n\nprint(response.choices[0].message.content)')})]})]})}),(0,t.jsx)(g.Z,{title:(null==el?void 0:el.name)||"Agent Details",width:1e3,visible:ea,footer:null,onOk:eN,onCancel:ef,children:el&&(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Agent Overview"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Name:"}),(0,t.jsx)(R.xv,{children:el.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Version:"}),(0,t.jsxs)(R.Ct,{color:"blue",children:["v",el.version]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Protocol Version:"}),(0,t.jsx)(R.xv,{children:el.protocolVersion})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"URL:"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(R.xv,{className:"truncate",children:el.url}),(0,t.jsx)(d.Z,{onClick:()=>ey(el.url),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Description:"}),(0,t.jsx)(R.xv,{className:"mt-1",children:el.description})]})]}),el.capabilities&&Object.keys(el.capabilities).length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Capabilities"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.entries(el.capabilities).filter(e=>{let[s,l]=e;return!0===l}).map(e=>{let[s]=e;return(0,t.jsx)(R.Ct,{color:"green",children:s},s)})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Input/Output Modes"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Input Modes:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(m=el.defaultInputModes)||void 0===m?void 0:m.map(e=>(0,t.jsx)(R.Ct,{color:"blue",children:e},e)))||(0,t.jsx)(R.xv,{children:"Not specified"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Output Modes:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:(null===(u=el.defaultOutputModes)||void 0===u?void 0:u.map(e=>(0,t.jsx)(R.Ct,{color:"purple",children:e},e)))||(0,t.jsx)(R.xv,{children:"Not specified"})})]})]})]}),el.skills&&el.skills.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Skills"}),(0,t.jsx)("div",{className:"space-y-4",children:el.skills.map(e=>(0,t.jsxs)("div",{className:"border border-gray-200 rounded p-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium text-base",children:e.name}),(0,t.jsxs)(R.xv,{className:"text-xs text-gray-500",children:["ID: ",e.id]})]}),e.tags&&e.tags.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tags.map(e=>(0,t.jsx)(R.Ct,{color:"purple",size:"xs",children:e},e))})]}),(0,t.jsx)(R.xv,{className:"text-sm mb-2",children:e.description}),e.examples&&e.examples.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-xs font-medium text-gray-700",children:"Examples:"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.examples.map((e,s)=>(0,t.jsx)(R.Ct,{color:"gray",size:"xs",children:e},s))})]})]},e.id))})]}),el.supportsAuthenticatedExtendedCard&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Additional Features"}),(0,t.jsx)(R.Ct,{color:"green",children:"Supports Authenticated Extended Card"})]})]})}),(0,t.jsx)(g.Z,{title:(null==eo?void 0:eo.server_name)||"MCP Server Details",width:1e3,visible:em,footer:null,onOk:eN,onCancel:ef,children:eo&&(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Server Overview"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Server Name:"}),(0,t.jsx)(R.xv,{children:eo.server_name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Server ID:"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(R.xv,{className:"text-xs truncate",children:eo.server_id}),(0,t.jsx)(d.Z,{onClick:()=>ey(eo.server_id),className:"cursor-pointer text-gray-500 hover:text-blue-500"})]})]}),eo.alias&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Alias:"}),(0,t.jsx)(R.xv,{children:eo.alias})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Transport:"}),(0,t.jsx)(R.Ct,{color:"blue",children:eo.transport})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Auth Type:"}),(0,t.jsx)(R.Ct,{color:"none"===eo.auth_type?"gray":"green",children:eo.auth_type})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Status:"}),(0,t.jsx)(R.Ct,{color:"active"===eo.status||"healthy"===eo.status?"green":"inactive"===eo.status||"unhealthy"===eo.status?"red":"gray",children:eo.status||"unknown"})]})]}),eo.description&&(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Description:"}),(0,t.jsx)(R.xv,{className:"mt-1",children:eo.description})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Connection Details"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"URL:"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 mt-1",children:[(0,t.jsx)(R.xv,{className:"text-sm break-all bg-gray-100 p-2 rounded flex-1",children:eo.url}),(0,t.jsx)(d.Z,{onClick:()=>ey(eo.url),className:"cursor-pointer text-gray-500 hover:text-blue-500 flex-shrink-0"})]})]}),eo.command&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Command:"}),(0,t.jsx)(R.xv,{className:"text-sm bg-gray-100 p-2 rounded mt-1 font-mono",children:eo.command})]})]})]}),eo.allowed_tools&&eo.allowed_tools.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Allowed Tools"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.allowed_tools.map((e,s)=>(0,t.jsx)(R.Ct,{color:"purple",children:e},s))})]}),eo.teams&&eo.teams.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Teams"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.teams.map((e,s)=>(0,t.jsx)(R.Ct,{color:"blue",children:e},s))})]}),eo.mcp_access_groups&&eo.mcp_access_groups.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Access Groups"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:eo.mcp_access_groups.map((e,s)=>(0,t.jsx)(R.Ct,{color:"green",children:e},s))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Metadata"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Created By:"}),(0,t.jsx)(R.xv,{children:eo.created_by})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Updated By:"}),(0,t.jsx)(R.xv,{children:eo.updated_by})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Created At:"}),(0,t.jsx)(R.xv,{className:"text-sm",children:new Date(eo.created_at).toLocaleString()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Updated At:"}),(0,t.jsx)(R.xv,{className:"text-sm",children:new Date(eo.updated_at).toLocaleString()})]}),eo.last_health_check&&(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"font-medium",children:"Last Health Check:"}),(0,t.jsx)(R.xv,{className:"text-sm",children:new Date(eo.last_health_check).toLocaleString()})]})]}),eo.health_check_error&&(0,t.jsxs)("div",{className:"mt-2 p-2 bg-red-50 rounded",children:[(0,t.jsx)(R.xv,{className:"font-medium text-red-700",children:"Health Check Error:"}),(0,t.jsx)(R.xv,{className:"text-sm text-red-600 mt-1",children:eo.health_check_error})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(R.xv,{className:"text-lg font-semibold mb-4",children:"Usage Example"}),(0,t.jsx)(W.Z,{language:"python",className:"text-sm",children:'from fastmcp import Client\nimport asyncio\n\n# Standard MCP configuration\nconfig = {\n "mcpServers": {\n "'.concat(eo.server_name,'": {\n "url": "http://localhost:4000/').concat(eo.server_name,'/mcp",\n "headers": {\n "x-litellm-api-key": "Bearer sk-1234"\n }\n }\n }\n}\n\n# Create a client that connects to the server\nclient = Client(config)\n\nasync def main():\n async with client:\n # List available tools\n tools = await client.list_tools()\n print(f"Available tools: {[tool.name for tool in tools]}")\n\n # Call a tool\n response = await client.call_tool(\n name="tool_name", \n arguments={"arg": "value"}\n )\n print(f"Response: {response}")\n\nif __name__ == "__main__":\n asyncio.run(main())')})]})]})}),(0,t.jsx)(C,{visible:J,onClose:()=>q(!1),accessToken:h||"",modelHubData:w||[],onSuccess:()=>{h&&(async()=>{try{let e=await (0,v.modelHubCall)(h);S(e.data)}catch(e){console.error("Error refreshing model data:",e)}})()}}),(0,t.jsx)(f,{visible:Q,onClose:()=>X(!1),accessToken:h||"",agentHubData:G||[],onSuccess:()=>{h&&(async()=>{try{let e=(await (0,v.getAgentsList)(h)).agents.map(e=>({agent_id:e.agent_id,...e.agent_card_params,is_public:e.is_public}));$(e)}catch(e){console.error("Error refreshing agent data:",e)}})()}}),(0,t.jsx)(_,{visible:eh,onClose:()=>ep(!1),accessToken:h||"",mcpHubData:en||[],onSuccess:()=>{h&&(async()=>{try{let e=await (0,v.fetchMCPServers)(h);ei(e)}catch(e){console.error("Error refreshing MCP server data:",e)}})()}})]})}},39957:function(e,s,l){l.d(s,{Z:function(){return g}});var t=l(57437),a=l(53410),r=l(74998),n=l(91126),i=l(23628),c=l(44633),d=l(86462),o=l(3477),x=l(99981),m=l(10012),u=l(58927);function h(e){let{icon:s,onClick:l,className:a,disabled:r,dataTestId:n}=e;return r?(0,t.jsx)(u.J,{icon:s,size:"sm",className:"opacity-50 cursor-not-allowed","data-testid":n}):(0,t.jsx)(u.J,{icon:s,size:"sm",onClick:l,className:(0,m.cx)("cursor-pointer",a),"data-testid":n})}l(2265);let p={Edit:{icon:a.Z,className:"hover:text-blue-600"},Delete:{icon:r.Z,className:"hover:text-red-600"},Test:{icon:n.Z,className:"hover:text-blue-600"},Regenerate:{icon:i.Z,className:"hover:text-green-600"},Up:{icon:c.Z,className:"hover:text-blue-600"},Down:{icon:d.Z,className:"hover:text-blue-600"},Open:{icon:o.Z,className:"hover:text-green-600"}};function g(e){let{onClick:s,tooltipText:l,disabled:a=!1,disabledTooltipText:r,dataTestId:n,variant:i}=e,{icon:c,className:d}=p[i];return(0,t.jsx)(x.Z,{title:a?r:l,children:(0,t.jsx)("span",{children:(0,t.jsx)(h,{icon:c,onClick:s,className:d,disabled:a,dataTestId:n})})})}},10012:function(e,s,l){l.d(s,{cx:function(){return n}});var t=l(49096),a=l(53335);let{cva:r,cx:n,compose:i}=(0,t.ZD)({hooks:{onComplete:e=>(0,a.m6)(e)}})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/2512-088e26ac9d573932.js b/litellm/proxy/_experimental/out/_next/static/chunks/4077-50cf2a28a79fdcd4.js similarity index 98% rename from litellm/proxy/_experimental/out/_next/static/chunks/2512-088e26ac9d573932.js rename to litellm/proxy/_experimental/out/_next/static/chunks/4077-50cf2a28a79fdcd4.js index e4988d21b7..32b7beb9fa 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/2512-088e26ac9d573932.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4077-50cf2a28a79fdcd4.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2512],{47323:function(t,o,e){e.d(o,{Z:function(){return b}});var n=e(5853),c=e(2265),i=e(47187),a=e(7084),r=e(13241),l=e(1153),s=e(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"}},m={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"}},g={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:""}},p=(t,o)=>{switch(t){case"simple":return{textColor:o?(0,l.bM)(o,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:o?(0,l.bM)(o,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:o?(0,r.q)((0,l.bM)(o,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:o?(0,l.bM)(o,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:o?(0,r.q)((0,l.bM)(o,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:o?(0,l.bM)(o,s.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:o?(0,r.q)((0,l.bM)(o,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:o?(0,l.bM)(o,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:o?(0,r.q)((0,l.bM)(o,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:o?(0,l.bM)(o,s.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:o?(0,r.q)((0,l.bM)(o,s.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},u=(0,l.fn)("Icon"),b=c.forwardRef((t,o)=>{let{icon:e,variant:s="simple",tooltip:b,size:h=a.u8.SM,color:f,className:v}=t,C=(0,n._T)(t,["icon","variant","tooltip","size","color","className"]),S=p(s,f),{tooltipProps:k,getReferenceProps:y}=(0,i.l)();return c.createElement("span",Object.assign({ref:(0,l.lq)([o,k.refs.setReference]),className:(0,r.q)(u("root"),"inline-flex shrink-0 items-center justify-center",S.bgColor,S.textColor,S.borderColor,S.ringColor,g[s].rounded,g[s].border,g[s].shadow,g[s].ring,d[h].paddingX,d[h].paddingY,v)},y,C),c.createElement(i.Z,Object.assign({text:b},k)),c.createElement(e,{className:(0,r.q)(u("icon"),"shrink-0",m[h].height,m[h].width)}))});b.displayName="Icon"},15690:function(t,o,e){e.d(o,{default:function(){return F}});var n=e(2265),c=e(9738),i=e(49638),a=e(36760),r=e.n(a),l=e(1119),s=e(31686),d=e(11993),m=e(6989),g=e(95814),p=["className","prefixCls","style","active","status","iconPrefix","icon","wrapperStyle","stepNumber","disabled","description","title","subTitle","progressDot","stepIcon","tailContent","icons","stepIndex","onStepClick","onClick","render"];function u(t){return"string"==typeof t}var b=function(t){var o,e,c,i,a,b=t.className,h=t.prefixCls,f=t.style,v=t.active,C=t.status,S=t.iconPrefix,k=t.icon,y=(t.wrapperStyle,t.stepNumber),w=t.disabled,x=t.description,I=t.title,q=t.subTitle,O=t.progressDot,E=t.stepIcon,z=t.tailContent,T=t.icons,j=t.stepIndex,N=t.onStepClick,H=t.onClick,M=t.render,B=(0,m.Z)(t,p),W={};N&&!w&&(W.role="button",W.tabIndex=0,W.onClick=function(t){null==H||H(t),N(j)},W.onKeyDown=function(t){var o=t.which;(o===g.Z.ENTER||o===g.Z.SPACE)&&N(j)});var X=r()("".concat(h,"-item"),"".concat(h,"-item-").concat(C||"wait"),b,(a={},(0,d.Z)(a,"".concat(h,"-item-custom"),k),(0,d.Z)(a,"".concat(h,"-item-active"),v),(0,d.Z)(a,"".concat(h,"-item-disabled"),!0===w),a)),Z=(0,s.Z)({},f),P=n.createElement("div",(0,l.Z)({},B,{className:X,style:Z}),n.createElement("div",(0,l.Z)({onClick:H},W,{className:"".concat(h,"-item-container")}),n.createElement("div",{className:"".concat(h,"-item-tail")},z),n.createElement("div",{className:"".concat(h,"-item-icon")},(c=r()("".concat(h,"-icon"),"".concat(S,"icon"),(o={},(0,d.Z)(o,"".concat(S,"icon-").concat(k),k&&u(k)),(0,d.Z)(o,"".concat(S,"icon-check"),!k&&"finish"===C&&(T&&!T.finish||!T)),(0,d.Z)(o,"".concat(S,"icon-cross"),!k&&"error"===C&&(T&&!T.error||!T)),o)),i=n.createElement("span",{className:"".concat(h,"-icon-dot")}),e=O?"function"==typeof O?n.createElement("span",{className:"".concat(h,"-icon")},O(i,{index:y-1,status:C,title:I,description:x})):n.createElement("span",{className:"".concat(h,"-icon")},i):k&&!u(k)?n.createElement("span",{className:"".concat(h,"-icon")},k):T&&T.finish&&"finish"===C?n.createElement("span",{className:"".concat(h,"-icon")},T.finish):T&&T.error&&"error"===C?n.createElement("span",{className:"".concat(h,"-icon")},T.error):k||"finish"===C||"error"===C?n.createElement("span",{className:c}):n.createElement("span",{className:"".concat(h,"-icon")},y),E&&(e=E({index:y-1,status:C,title:I,description:x,node:e})),e)),n.createElement("div",{className:"".concat(h,"-item-content")},n.createElement("div",{className:"".concat(h,"-item-title")},I,q&&n.createElement("div",{title:"string"==typeof q?q:void 0,className:"".concat(h,"-item-subtitle")},q)),x&&n.createElement("div",{className:"".concat(h,"-item-description")},x))));return M&&(P=M(P)||null),P},h=["prefixCls","style","className","children","direction","type","labelPlacement","iconPrefix","status","size","current","progressDot","stepIcon","initial","icons","onChange","itemRender","items"];function f(t){var o,e=t.prefixCls,c=void 0===e?"rc-steps":e,i=t.style,a=void 0===i?{}:i,g=t.className,p=(t.children,t.direction),u=t.type,f=void 0===u?"default":u,v=t.labelPlacement,C=t.iconPrefix,S=void 0===C?"rc":C,k=t.status,y=void 0===k?"process":k,w=t.size,x=t.current,I=void 0===x?0:x,q=t.progressDot,O=t.stepIcon,E=t.initial,z=void 0===E?0:E,T=t.icons,j=t.onChange,N=t.itemRender,H=t.items,M=(0,m.Z)(t,h),B="inline"===f,W=B||void 0!==q&&q,X=B?"horizontal":void 0===p?"horizontal":p,Z=B?void 0:w,P=r()(c,"".concat(c,"-").concat(X),g,(o={},(0,d.Z)(o,"".concat(c,"-").concat(Z),Z),(0,d.Z)(o,"".concat(c,"-label-").concat(W?"vertical":void 0===v?"horizontal":v),"horizontal"===X),(0,d.Z)(o,"".concat(c,"-dot"),!!W),(0,d.Z)(o,"".concat(c,"-navigation"),"navigation"===f),(0,d.Z)(o,"".concat(c,"-inline"),B),o)),D=function(t){j&&I!==t&&j(t)};return n.createElement("div",(0,l.Z)({className:P,style:a},M),(void 0===H?[]:H).filter(function(t){return t}).map(function(t,o){var e=(0,s.Z)({},t),i=z+o;return"error"===y&&o===I-1&&(e.className="".concat(c,"-next-error")),e.status||(i===I?e.status=y:i{let{componentCls:o,customIconTop:e,customIconSize:n,customIconFontSize:c}=t;return{["".concat(o,"-item-custom")]:{["> ".concat(o,"-item-container > ").concat(o,"-item-icon")]:{height:"auto",background:"none",border:0,["> ".concat(o,"-icon")]:{top:e,width:n,height:n,fontSize:c,lineHeight:(0,w.bf)(n)}}},["&:not(".concat(o,"-vertical)")]:{["".concat(o,"-item-custom")]:{["".concat(o,"-item-icon")]:{width:"auto",background:"none"}}}}},E=t=>{let{componentCls:o}=t;return{["".concat(o,"-horizontal")]:{["".concat("".concat(o,"-item"),"-tail")]:{transform:"translateY(-50%)"}}}},z=t=>{let{componentCls:o,inlineDotSize:e,inlineTitleColor:n,inlineTailColor:c}=t,i=t.calc(t.paddingXS).add(t.lineWidth).equal(),a={["".concat(o,"-item-container ").concat(o,"-item-content ").concat(o,"-item-title")]:{color:n}};return{["&".concat(o,"-inline")]:{width:"auto",display:"inline-flex",["".concat(o,"-item")]:{flex:"none","&-container":{padding:"".concat((0,w.bf)(i)," ").concat((0,w.bf)(t.paddingXXS)," 0"),margin:"0 ".concat((0,w.bf)(t.calc(t.marginXXS).div(2).equal())),borderRadius:t.borderRadiusSM,cursor:"pointer",transition:"background-color ".concat(t.motionDurationMid),"&:hover":{background:t.controlItemBgHover},"&[role='button']:hover":{opacity:1}},"&-icon":{width:e,height:e,marginInlineStart:"calc(50% - ".concat((0,w.bf)(t.calc(e).div(2).equal()),")"),["> ".concat(o,"-icon")]:{top:0},["".concat(o,"-icon-dot")]:{borderRadius:t.calc(t.fontSizeSM).div(4).equal(),"&::after":{display:"none"}}},"&-content":{width:"auto",marginTop:t.calc(t.marginXS).sub(t.lineWidth).equal()},"&-title":{color:n,fontSize:t.fontSizeSM,lineHeight:t.lineHeightSM,fontWeight:"normal",marginBottom:t.calc(t.marginXXS).div(2).equal()},"&-description":{display:"none"},"&-tail":{marginInlineStart:0,top:t.calc(e).div(2).add(i).equal(),transform:"translateY(-50%)","&:after":{width:"100%",height:t.lineWidth,borderRadius:0,marginInlineStart:0,background:c}},["&:first-child ".concat(o,"-item-tail")]:{width:"50%",marginInlineStart:"50%"},["&:last-child ".concat(o,"-item-tail")]:{display:"block",width:"50%"},"&-wait":Object.assign({["".concat(o,"-item-icon ").concat(o,"-icon ").concat(o,"-icon-dot")]:{backgroundColor:t.colorBorderBg,border:"".concat((0,w.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(c)}},a),"&-finish":Object.assign({["".concat(o,"-item-tail::after")]:{backgroundColor:c},["".concat(o,"-item-icon ").concat(o,"-icon ").concat(o,"-icon-dot")]:{backgroundColor:c,border:"".concat((0,w.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(c)}},a),"&-error":a,"&-active, &-process":Object.assign({["".concat(o,"-item-icon")]:{width:e,height:e,marginInlineStart:"calc(50% - ".concat((0,w.bf)(t.calc(e).div(2).equal()),")"),top:0}},a),["&:not(".concat(o,"-item-active) > ").concat(o,"-item-container[role='button']:hover")]:{["".concat(o,"-item-title")]:{color:n}}}}}},T=t=>{let{componentCls:o,iconSize:e,lineHeight:n,iconSizeSM:c}=t;return{["&".concat(o,"-label-vertical")]:{["".concat(o,"-item")]:{overflow:"visible","&-tail":{marginInlineStart:t.calc(e).div(2).add(t.controlHeightLG).equal(),padding:"0 ".concat((0,w.bf)(t.paddingLG))},"&-content":{display:"block",width:t.calc(e).div(2).add(t.controlHeightLG).mul(2).equal(),marginTop:t.marginSM,textAlign:"center"},"&-icon":{display:"inline-block",marginInlineStart:t.controlHeightLG},"&-title":{paddingInlineEnd:0,paddingInlineStart:0,"&::after":{display:"none"}},"&-subtitle":{display:"block",marginBottom:t.marginXXS,marginInlineStart:0,lineHeight:n}},["&".concat(o,"-small:not(").concat(o,"-dot)")]:{["".concat(o,"-item")]:{"&-icon":{marginInlineStart:t.calc(e).sub(c).div(2).add(t.controlHeightLG).equal()}}}}}},j=t=>{let{componentCls:o,navContentMaxWidth:e,navArrowColor:n,stepsNavActiveColor:c,motionDurationSlow:i}=t;return{["&".concat(o,"-navigation")]:{paddingTop:t.paddingSM,["&".concat(o,"-small")]:{["".concat(o,"-item")]:{"&-container":{marginInlineStart:t.calc(t.marginSM).mul(-1).equal()}}},["".concat(o,"-item")]:{overflow:"visible",textAlign:"center","&-container":{display:"inline-block",height:"100%",marginInlineStart:t.calc(t.margin).mul(-1).equal(),paddingBottom:t.paddingSM,textAlign:"start",transition:"opacity ".concat(i),["".concat(o,"-item-content")]:{maxWidth:e},["".concat(o,"-item-title")]:Object.assign(Object.assign({maxWidth:"100%",paddingInlineEnd:0},x.vS),{"&::after":{display:"none"}})},["&:not(".concat(o,"-item-active)")]:{["".concat(o,"-item-container[role='button']")]:{cursor:"pointer","&:hover":{opacity:.85}}},"&:last-child":{flex:1,"&::after":{display:"none"}},"&::after":{position:"absolute",top:"calc(50% - ".concat((0,w.bf)(t.calc(t.paddingSM).div(2).equal()),")"),insetInlineStart:"100%",display:"inline-block",width:t.fontSizeIcon,height:t.fontSizeIcon,borderTop:"".concat((0,w.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(n),borderBottom:"none",borderInlineStart:"none",borderInlineEnd:"".concat((0,w.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(n),transform:"translateY(-50%) translateX(-50%) rotate(45deg)",content:'""'},"&::before":{position:"absolute",bottom:0,insetInlineStart:"50%",display:"inline-block",width:0,height:t.lineWidthBold,backgroundColor:c,transition:"width ".concat(i,", inset-inline-start ").concat(i),transitionTimingFunction:"ease-out",content:'""'}},["".concat(o,"-item").concat(o,"-item-active::before")]:{insetInlineStart:0,width:"100%"}},["&".concat(o,"-navigation").concat(o,"-vertical")]:{["> ".concat(o,"-item")]:{marginInlineEnd:0,"&::before":{display:"none"},["&".concat(o,"-item-active::before")]:{top:0,insetInlineEnd:0,insetInlineStart:"unset",display:"block",width:t.calc(t.lineWidth).mul(3).equal(),height:"calc(100% - ".concat((0,w.bf)(t.marginLG),")")},"&::after":{position:"relative",insetInlineStart:"50%",display:"block",width:t.calc(t.controlHeight).mul(.25).equal(),height:t.calc(t.controlHeight).mul(.25).equal(),marginBottom:t.marginXS,textAlign:"center",transform:"translateY(-50%) translateX(-50%) rotate(135deg)"},"&:last-child":{"&::after":{display:"none"}},["> ".concat(o,"-item-container > ").concat(o,"-item-tail")]:{visibility:"hidden"}}},["&".concat(o,"-navigation").concat(o,"-horizontal")]:{["> ".concat(o,"-item > ").concat(o,"-item-container > ").concat(o,"-item-tail")]:{visibility:"hidden"}}}},N=t=>{let{antCls:o,componentCls:e,iconSize:n,iconSizeSM:c,processIconColor:i,marginXXS:a,lineWidthBold:r,lineWidth:l,paddingXXS:s}=t,d=t.calc(n).add(t.calc(r).mul(4).equal()).equal(),m=t.calc(c).add(t.calc(t.lineWidth).mul(4).equal()).equal();return{["&".concat(e,"-with-progress")]:{["".concat(e,"-item")]:{paddingTop:s,["&-process ".concat(e,"-item-container ").concat(e,"-item-icon ").concat(e,"-icon")]:{color:i}},["&".concat(e,"-vertical > ").concat(e,"-item ")]:{paddingInlineStart:s,["> ".concat(e,"-item-container > ").concat(e,"-item-tail")]:{top:a,insetInlineStart:t.calc(n).div(2).sub(l).add(s).equal()}},["&, &".concat(e,"-small")]:{["&".concat(e,"-horizontal ").concat(e,"-item:first-child")]:{paddingBottom:s,paddingInlineStart:s}},["&".concat(e,"-small").concat(e,"-vertical > ").concat(e,"-item > ").concat(e,"-item-container > ").concat(e,"-item-tail")]:{insetInlineStart:t.calc(c).div(2).sub(l).add(s).equal()},["&".concat(e,"-label-vertical ").concat(e,"-item ").concat(e,"-item-tail")]:{top:t.calc(n).div(2).add(s).equal()},["".concat(e,"-item-icon")]:{position:"relative",["".concat(o,"-progress")]:{position:"absolute",insetInlineStart:"50%",top:"50%",transform:"translate(-50%, -50%)","&-inner":{width:"".concat((0,w.bf)(d)," !important"),height:"".concat((0,w.bf)(d)," !important")}}},["&".concat(e,"-small")]:{["&".concat(e,"-label-vertical ").concat(e,"-item ").concat(e,"-item-tail")]:{top:t.calc(c).div(2).add(s).equal()},["".concat(e,"-item-icon ").concat(o,"-progress-inner")]:{width:"".concat((0,w.bf)(m)," !important"),height:"".concat((0,w.bf)(m)," !important")}}}}},H=t=>{let{componentCls:o,descriptionMaxWidth:e,lineHeight:n,dotCurrentSize:c,dotSize:i,motionDurationSlow:a}=t;return{["&".concat(o,"-dot, &").concat(o,"-dot").concat(o,"-small")]:{["".concat(o,"-item")]:{"&-title":{lineHeight:n},"&-tail":{top:t.calc(t.dotSize).sub(t.calc(t.lineWidth).mul(3).equal()).div(2).equal(),width:"100%",marginTop:0,marginBottom:0,marginInline:"".concat((0,w.bf)(t.calc(e).div(2).equal())," 0"),padding:0,"&::after":{width:"calc(100% - ".concat((0,w.bf)(t.calc(t.marginSM).mul(2).equal()),")"),height:t.calc(t.lineWidth).mul(3).equal(),marginInlineStart:t.marginSM}},"&-icon":{width:i,height:i,marginInlineStart:t.calc(t.descriptionMaxWidth).sub(i).div(2).equal(),paddingInlineEnd:0,lineHeight:(0,w.bf)(i),background:"transparent",border:0,["".concat(o,"-icon-dot")]:{position:"relative",float:"left",width:"100%",height:"100%",borderRadius:100,transition:"all ".concat(a),"&::after":{position:"absolute",top:t.calc(t.marginSM).mul(-1).equal(),insetInlineStart:t.calc(i).sub(t.calc(t.controlHeightLG).mul(1.5).equal()).div(2).equal(),width:t.calc(t.controlHeightLG).mul(1.5).equal(),height:t.controlHeight,background:"transparent",content:'""'}}},"&-content":{width:e},["&-process ".concat(o,"-item-icon")]:{position:"relative",top:t.calc(i).sub(c).div(2).equal(),width:c,height:c,lineHeight:(0,w.bf)(c),background:"none",marginInlineStart:t.calc(t.descriptionMaxWidth).sub(c).div(2).equal()},["&-process ".concat(o,"-icon")]:{["&:first-child ".concat(o,"-icon-dot")]:{insetInlineStart:0}}}},["&".concat(o,"-vertical").concat(o,"-dot")]:{["".concat(o,"-item-icon")]:{marginTop:t.calc(t.controlHeight).sub(i).div(2).equal(),marginInlineStart:0,background:"none"},["".concat(o,"-item-process ").concat(o,"-item-icon")]:{marginTop:t.calc(t.controlHeight).sub(c).div(2).equal(),top:0,insetInlineStart:t.calc(i).sub(c).div(2).equal(),marginInlineStart:0},["".concat(o,"-item > ").concat(o,"-item-container > ").concat(o,"-item-tail")]:{top:t.calc(t.controlHeight).sub(i).div(2).equal(),insetInlineStart:0,margin:0,padding:"".concat((0,w.bf)(t.calc(i).add(t.paddingXS).equal())," 0 ").concat((0,w.bf)(t.paddingXS)),"&::after":{marginInlineStart:t.calc(i).sub(t.lineWidth).div(2).equal()}},["&".concat(o,"-small")]:{["".concat(o,"-item-icon")]:{marginTop:t.calc(t.controlHeightSM).sub(i).div(2).equal()},["".concat(o,"-item-process ").concat(o,"-item-icon")]:{marginTop:t.calc(t.controlHeightSM).sub(c).div(2).equal()},["".concat(o,"-item > ").concat(o,"-item-container > ").concat(o,"-item-tail")]:{top:t.calc(t.controlHeightSM).sub(i).div(2).equal()}},["".concat(o,"-item:first-child ").concat(o,"-icon-dot")]:{insetInlineStart:0},["".concat(o,"-item-content")]:{width:"inherit"}}}},M=t=>{let{componentCls:o}=t;return{["&".concat(o,"-rtl")]:{direction:"rtl",["".concat(o,"-item")]:{"&-subtitle":{float:"left"}},["&".concat(o,"-navigation")]:{["".concat(o,"-item::after")]:{transform:"rotate(-45deg)"}},["&".concat(o,"-vertical")]:{["> ".concat(o,"-item")]:{"&::after":{transform:"rotate(225deg)"},["".concat(o,"-item-icon")]:{float:"right"}}},["&".concat(o,"-dot")]:{["".concat(o,"-item-icon ").concat(o,"-icon-dot, &").concat(o,"-small ").concat(o,"-item-icon ").concat(o,"-icon-dot")]:{float:"right"}}}}},B=t=>{let{componentCls:o,iconSizeSM:e,fontSizeSM:n,fontSize:c,colorTextDescription:i}=t;return{["&".concat(o,"-small")]:{["&".concat(o,"-horizontal:not(").concat(o,"-label-vertical) ").concat(o,"-item")]:{paddingInlineStart:t.paddingSM,"&:first-child":{paddingInlineStart:0}},["".concat(o,"-item-icon")]:{width:e,height:e,marginTop:0,marginBottom:0,marginInline:"0 ".concat((0,w.bf)(t.marginXS)),fontSize:n,lineHeight:(0,w.bf)(e),textAlign:"center",borderRadius:e},["".concat(o,"-item-title")]:{paddingInlineEnd:t.paddingSM,fontSize:c,lineHeight:(0,w.bf)(e),"&::after":{top:t.calc(e).div(2).equal()}},["".concat(o,"-item-description")]:{color:i,fontSize:c},["".concat(o,"-item-tail")]:{top:t.calc(e).div(2).sub(t.paddingXXS).equal()},["".concat(o,"-item-custom ").concat(o,"-item-icon")]:{width:"inherit",height:"inherit",lineHeight:"inherit",background:"none",border:0,borderRadius:0,["> ".concat(o,"-icon")]:{fontSize:e,lineHeight:(0,w.bf)(e),transform:"none"}}}}},W=t=>{let{componentCls:o,iconSizeSM:e,iconSize:n}=t;return{["&".concat(o,"-vertical")]:{display:"flex",flexDirection:"column",["> ".concat(o,"-item")]:{display:"block",flex:"1 0 auto",paddingInlineStart:0,overflow:"visible",["".concat(o,"-item-icon")]:{float:"left",marginInlineEnd:t.margin},["".concat(o,"-item-content")]:{display:"block",minHeight:t.calc(t.controlHeight).mul(1.5).equal(),overflow:"hidden"},["".concat(o,"-item-title")]:{lineHeight:(0,w.bf)(n)},["".concat(o,"-item-description")]:{paddingBottom:t.paddingSM}},["> ".concat(o,"-item > ").concat(o,"-item-container > ").concat(o,"-item-tail")]:{position:"absolute",top:0,insetInlineStart:t.calc(n).div(2).sub(t.lineWidth).equal(),width:t.lineWidth,height:"100%",padding:"".concat((0,w.bf)(t.calc(t.marginXXS).mul(1.5).add(n).equal())," 0 ").concat((0,w.bf)(t.calc(t.marginXXS).mul(1.5).equal())),"&::after":{width:t.lineWidth,height:"100%"}},["> ".concat(o,"-item:not(:last-child) > ").concat(o,"-item-container > ").concat(o,"-item-tail")]:{display:"block"},[" > ".concat(o,"-item > ").concat(o,"-item-container > ").concat(o,"-item-content > ").concat(o,"-item-title")]:{"&::after":{display:"none"}},["&".concat(o,"-small ").concat(o,"-item-container")]:{["".concat(o,"-item-tail")]:{position:"absolute",top:0,insetInlineStart:t.calc(e).div(2).sub(t.lineWidth).equal(),padding:"".concat((0,w.bf)(t.calc(t.marginXXS).mul(1.5).add(e).equal())," 0 ").concat((0,w.bf)(t.calc(t.marginXXS).mul(1.5).equal()))},["".concat(o,"-item-title")]:{lineHeight:(0,w.bf)(e)}}}}};let X=(t,o)=>{let e="".concat(o.componentCls,"-item"),n="".concat(t,"IconColor"),c="".concat(t,"TitleColor"),i="".concat(t,"DescriptionColor"),a="".concat(t,"TailColor"),r="".concat(t,"IconBgColor"),l="".concat(t,"IconBorderColor"),s="".concat(t,"DotColor");return{["".concat(e,"-").concat(t," ").concat(e,"-icon")]:{backgroundColor:o[r],borderColor:o[l],["> ".concat(o.componentCls,"-icon")]:{color:o[n],["".concat(o.componentCls,"-icon-dot")]:{background:o[s]}}},["".concat(e,"-").concat(t).concat(e,"-custom ").concat(e,"-icon")]:{["> ".concat(o.componentCls,"-icon")]:{color:o[s]}},["".concat(e,"-").concat(t," > ").concat(e,"-container > ").concat(e,"-content > ").concat(e,"-title")]:{color:o[c],"&::after":{backgroundColor:o[a]}},["".concat(e,"-").concat(t," > ").concat(e,"-container > ").concat(e,"-content > ").concat(e,"-description")]:{color:o[i]},["".concat(e,"-").concat(t," > ").concat(e,"-container > ").concat(e,"-tail::after")]:{backgroundColor:o[a]}}},Z=t=>{let{componentCls:o,motionDurationSlow:e}=t,n="".concat(o,"-item"),c="".concat(n,"-icon");return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[n]:{position:"relative",display:"inline-block",flex:1,overflow:"hidden",verticalAlign:"top","&:last-child":{flex:"none",["> ".concat(n,"-container > ").concat(n,"-tail, > ").concat(n,"-container > ").concat(n,"-content > ").concat(n,"-title::after")]:{display:"none"}}},["".concat(n,"-container")]:{outline:"none",["&:focus-visible ".concat(c)]:(0,x.oN)(t)},["".concat(c,", ").concat(n,"-content")]:{display:"inline-block",verticalAlign:"top"},[c]:{width:t.iconSize,height:t.iconSize,marginTop:0,marginBottom:0,marginInlineStart:0,marginInlineEnd:t.marginXS,fontSize:t.iconFontSize,fontFamily:t.fontFamily,lineHeight:(0,w.bf)(t.iconSize),textAlign:"center",borderRadius:t.iconSize,border:"".concat((0,w.bf)(t.lineWidth)," ").concat(t.lineType," transparent"),transition:"background-color ".concat(e,", border-color ").concat(e),["".concat(o,"-icon")]:{position:"relative",top:t.iconTop,color:t.colorPrimary,lineHeight:1}},["".concat(n,"-tail")]:{position:"absolute",top:t.calc(t.iconSize).div(2).equal(),insetInlineStart:0,width:"100%","&::after":{display:"inline-block",width:"100%",height:t.lineWidth,background:t.colorSplit,borderRadius:t.lineWidth,transition:"background ".concat(e),content:'""'}},["".concat(n,"-title")]:{position:"relative",display:"inline-block",paddingInlineEnd:t.padding,color:t.colorText,fontSize:t.fontSizeLG,lineHeight:(0,w.bf)(t.titleLineHeight),"&::after":{position:"absolute",top:t.calc(t.titleLineHeight).div(2).equal(),insetInlineStart:"100%",display:"block",width:9999,height:t.lineWidth,background:t.processTailColor,content:'""'}},["".concat(n,"-subtitle")]:{display:"inline",marginInlineStart:t.marginXS,color:t.colorTextDescription,fontWeight:"normal",fontSize:t.fontSize},["".concat(n,"-description")]:{color:t.colorTextDescription,fontSize:t.fontSize}},X("wait",t)),X("process",t)),{["".concat(n,"-process > ").concat(n,"-container > ").concat(n,"-title")]:{fontWeight:t.fontWeightStrong}}),X("finish",t)),X("error",t)),{["".concat(n).concat(o,"-next-error > ").concat(o,"-item-title::after")]:{background:t.colorError},["".concat(n,"-disabled")]:{cursor:"not-allowed"}})},P=t=>{let{componentCls:o,motionDurationSlow:e}=t;return{["& ".concat(o,"-item")]:{["&:not(".concat(o,"-item-active)")]:{["& > ".concat(o,"-item-container[role='button']")]:{cursor:"pointer",["".concat(o,"-item")]:{["&-title, &-subtitle, &-description, &-icon ".concat(o,"-icon")]:{transition:"color ".concat(e)}},"&:hover":{["".concat(o,"-item")]:{"&-title, &-subtitle, &-description":{color:t.colorPrimary}}}},["&:not(".concat(o,"-item-process)")]:{["& > ".concat(o,"-item-container[role='button']:hover")]:{["".concat(o,"-item")]:{"&-icon":{borderColor:t.colorPrimary,["".concat(o,"-icon")]:{color:t.colorPrimary}}}}}}},["&".concat(o,"-horizontal:not(").concat(o,"-label-vertical)")]:{["".concat(o,"-item")]:{paddingInlineStart:t.padding,whiteSpace:"nowrap","&:first-child":{paddingInlineStart:0},["&:last-child ".concat(o,"-item-title")]:{paddingInlineEnd:0},"&-tail":{display:"none"},"&-description":{maxWidth:t.descriptionMaxWidth,whiteSpace:"normal"}}}}},D=t=>{let{componentCls:o}=t;return{[o]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,x.Wf)(t)),{display:"flex",width:"100%",fontSize:0,textAlign:"initial"}),Z(t)),P(t)),O(t)),B(t)),W(t)),E(t)),T(t)),H(t)),j(t)),M(t)),N(t)),z(t))}};var L=(0,I.I$)("Steps",t=>{let{colorTextDisabled:o,controlHeightLG:e,colorTextLightSolid:n,colorText:c,colorPrimary:i,colorTextDescription:a,colorTextQuaternary:r,colorError:l,colorBorderSecondary:s,colorSplit:d}=t;return D((0,q.IX)(t,{processIconColor:n,processTitleColor:c,processDescriptionColor:c,processIconBgColor:i,processIconBorderColor:i,processDotColor:i,processTailColor:d,waitTitleColor:a,waitDescriptionColor:a,waitTailColor:d,waitDotColor:o,finishIconColor:i,finishTitleColor:c,finishDescriptionColor:a,finishTailColor:i,finishDotColor:i,errorIconColor:n,errorTitleColor:l,errorDescriptionColor:l,errorTailColor:d,errorIconBgColor:l,errorIconBorderColor:l,errorDotColor:l,stepsNavActiveColor:i,stepsProgressSize:e,inlineDotSize:6,inlineTitleColor:r,inlineTailColor:s}))},t=>({titleLineHeight:t.controlHeight,customIconSize:t.controlHeight,customIconTop:0,customIconFontSize:t.controlHeightSM,iconSize:t.controlHeight,iconTop:-.5,iconFontSize:t.fontSize,iconSizeSM:t.fontSizeHeading3,dotSize:t.controlHeight/4,dotCurrentSize:t.controlHeightLG/4,navArrowColor:t.colorTextDisabled,navContentMaxWidth:"unset",descriptionMaxWidth:140,waitIconColor:t.wireframe?t.colorTextDisabled:t.colorTextLabel,waitIconBgColor:t.wireframe?t.colorBgContainer:t.colorFillContent,waitIconBorderColor:t.wireframe?t.colorTextDisabled:"transparent",finishIconBgColor:t.wireframe?t.colorBgContainer:t.controlItemBgActive,finishIconBorderColor:t.wireframe?t.colorPrimary:t.controlItemBgActive})),R=e(45287),A=function(t,o){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&0>o.indexOf(n)&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var c=0,n=Object.getOwnPropertySymbols(t);co.indexOf(n[c])&&Object.prototype.propertyIsEnumerable.call(t,n[c])&&(e[n[c]]=t[n[c]]);return e};let K=t=>{let{percent:o,size:e,className:a,rootClassName:l,direction:s,items:d,responsive:m=!0,current:g=0,children:p,style:u}=t,b=A(t,["percent","size","className","rootClassName","direction","items","responsive","current","children","style"]),{xs:h}=(0,S.Z)(m),{getPrefixCls:w,direction:x,className:I,style:q}=(0,v.dj)("steps"),O=n.useMemo(()=>m&&h?"vertical":s,[m,h,s]),E=(0,C.Z)(e),z=w("steps",t.prefixCls),[T,j,N]=L(z),H="inline"===t.type,M=w("",t.iconPrefix),B=d||(0,R.Z)(p).map(t=>{if(n.isValidElement(t)){let{props:o}=t;return Object.assign({},o)}return null}).filter(t=>t),W=H?void 0:o,X=Object.assign(Object.assign({},q),u),Z=r()(I,{["".concat(z,"-rtl")]:"rtl"===x,["".concat(z,"-with-progress")]:void 0!==W},a,l,j,N),P={finish:n.createElement(c.Z,{className:"".concat(z,"-finish-icon")}),error:n.createElement(i.Z,{className:"".concat(z,"-error-icon")})};return T(n.createElement(f,Object.assign({icons:P},b,{style:X,current:g,size:E,items:B,itemRender:H?(t,o)=>t.description?n.createElement(y.Z,{title:t.description},o):o:void 0,stepIcon:t=>{let{node:o,status:e}=t;return"process"===e&&void 0!==W?n.createElement("div",{className:"".concat(z,"-progress-icon")},n.createElement(k.Z,{type:"circle",percent:W,size:"small"===E?32:40,strokeWidth:4,format:()=>null}),o):o},direction:O,prefixCls:z,iconPrefix:M,className:Z})))};K.Step=f.Step;var F=K},3810:function(t,o,e){e.d(o,{Z:function(){return T}});var n=e(2265),c=e(36760),i=e.n(c),a=e(18694),r=e(93350),l=e(53445),s=e(19722),d=e(6694),m=e(71744),g=e(93463),p=e(54558),u=e(12918),b=e(71140),h=e(99320);let f=t=>{let{paddingXXS:o,lineWidth:e,tagPaddingHorizontal:n,componentCls:c,calc:i}=t,a=i(n).sub(e).equal(),r=i(o).sub(e).equal();return{[c]:Object.assign(Object.assign({},(0,u.Wf)(t)),{display:"inline-block",height:"auto",marginInlineEnd:t.marginXS,paddingInline:a,fontSize:t.tagFontSize,lineHeight:t.tagLineHeight,whiteSpace:"nowrap",background:t.defaultBg,border:"".concat((0,g.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(t.colorBorder),borderRadius:t.borderRadiusSM,opacity:1,transition:"all ".concat(t.motionDurationMid),textAlign:"start",position:"relative",["&".concat(c,"-rtl")]:{direction:"rtl"},"&, a, a:hover":{color:t.defaultColor},["".concat(c,"-close-icon")]:{marginInlineStart:r,fontSize:t.tagIconSize,color:t.colorIcon,cursor:"pointer",transition:"all ".concat(t.motionDurationMid),"&:hover":{color:t.colorTextHeading}},["&".concat(c,"-has-color")]:{borderColor:"transparent",["&, a, a:hover, ".concat(t.iconCls,"-close, ").concat(t.iconCls,"-close:hover")]:{color:t.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",["&:not(".concat(c,"-checkable-checked):hover")]:{color:t.colorPrimary,backgroundColor:t.colorFillSecondary},"&:active, &-checked":{color:t.colorTextLightSolid},"&-checked":{backgroundColor:t.colorPrimary,"&:hover":{backgroundColor:t.colorPrimaryHover}},"&:active":{backgroundColor:t.colorPrimaryActive}},"&-hidden":{display:"none"},["> ".concat(t.iconCls," + span, > span + ").concat(t.iconCls)]:{marginInlineStart:a}}),["".concat(c,"-borderless")]:{borderColor:"transparent",background:t.tagBorderlessBg}}},v=t=>{let{lineWidth:o,fontSizeIcon:e,calc:n}=t,c=t.fontSizeSM;return(0,b.IX)(t,{tagFontSize:c,tagLineHeight:(0,g.bf)(n(t.lineHeightSM).mul(c).equal()),tagIconSize:n(e).sub(n(o).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:t.defaultBg})},C=t=>({defaultBg:new p.t(t.colorFillQuaternary).onBackground(t.colorBgContainer).toHexString(),defaultColor:t.colorText});var S=(0,h.I$)("Tag",t=>f(v(t)),C),k=function(t,o){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&0>o.indexOf(n)&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var c=0,n=Object.getOwnPropertySymbols(t);co.indexOf(n[c])&&Object.prototype.propertyIsEnumerable.call(t,n[c])&&(e[n[c]]=t[n[c]]);return e};let y=n.forwardRef((t,o)=>{let{prefixCls:e,style:c,className:a,checked:r,children:l,icon:s,onChange:d,onClick:g}=t,p=k(t,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:u,tag:b}=n.useContext(m.E_),h=u("tag",e),[f,v,C]=S(h),y=i()(h,"".concat(h,"-checkable"),{["".concat(h,"-checkable-checked")]:r},null==b?void 0:b.className,a,v,C);return f(n.createElement("span",Object.assign({},p,{ref:o,style:Object.assign(Object.assign({},c),null==b?void 0:b.style),className:y,onClick:t=>{null==d||d(!r),null==g||g(t)}}),s,n.createElement("span",null,l)))});var w=e(18536);let x=t=>(0,w.Z)(t,(o,e)=>{let{textColor:n,lightBorderColor:c,lightColor:i,darkColor:a}=e;return{["".concat(t.componentCls).concat(t.componentCls,"-").concat(o)]:{color:n,background:i,borderColor:c,"&-inverse":{color:t.colorTextLightSolid,background:a,borderColor:a},["&".concat(t.componentCls,"-borderless")]:{borderColor:"transparent"}}}});var I=(0,h.bk)(["Tag","preset"],t=>x(v(t)),C);let q=(t,o,e)=>{let n="string"!=typeof e?e:e.charAt(0).toUpperCase()+e.slice(1);return{["".concat(t.componentCls).concat(t.componentCls,"-").concat(o)]:{color:t["color".concat(e)],background:t["color".concat(n,"Bg")],borderColor:t["color".concat(n,"Border")],["&".concat(t.componentCls,"-borderless")]:{borderColor:"transparent"}}}};var O=(0,h.bk)(["Tag","status"],t=>{let o=v(t);return[q(o,"success","Success"),q(o,"processing","Info"),q(o,"error","Error"),q(o,"warning","Warning")]},C),E=function(t,o){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&0>o.indexOf(n)&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var c=0,n=Object.getOwnPropertySymbols(t);co.indexOf(n[c])&&Object.prototype.propertyIsEnumerable.call(t,n[c])&&(e[n[c]]=t[n[c]]);return e};let z=n.forwardRef((t,o)=>{let{prefixCls:e,className:c,rootClassName:g,style:p,children:u,icon:b,color:h,onClose:f,bordered:v=!0,visible:C}=t,k=E(t,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:y,direction:w,tag:x}=n.useContext(m.E_),[q,z]=n.useState(!0),T=(0,a.Z)(k,["closeIcon","closable"]);n.useEffect(()=>{void 0!==C&&z(C)},[C]);let j=(0,r.o2)(h),N=(0,r.yT)(h),H=j||N,M=Object.assign(Object.assign({backgroundColor:h&&!H?h:void 0},null==x?void 0:x.style),p),B=y("tag",e),[W,X,Z]=S(B),P=i()(B,null==x?void 0:x.className,{["".concat(B,"-").concat(h)]:H,["".concat(B,"-has-color")]:h&&!H,["".concat(B,"-hidden")]:!q,["".concat(B,"-rtl")]:"rtl"===w,["".concat(B,"-borderless")]:!v},c,g,X,Z),D=t=>{t.stopPropagation(),null==f||f(t),t.defaultPrevented||z(!1)},[,L]=(0,l.b)((0,l.w)(t),(0,l.w)(x),{closable:!1,closeIconRender:t=>{let o=n.createElement("span",{className:"".concat(B,"-close-icon"),onClick:D},t);return(0,s.wm)(t,o,t=>({onClick:o=>{var e;null===(e=null==t?void 0:t.onClick)||void 0===e||e.call(t,o),D(o)},className:i()(null==t?void 0:t.className,"".concat(B,"-close-icon"))}))}}),R="function"==typeof k.onClick||u&&"a"===u.type,A=b||null,K=A?n.createElement(n.Fragment,null,A,u&&n.createElement("span",null,u)):u,F=n.createElement("span",Object.assign({},T,{ref:o,className:P,style:M}),K,L,j&&n.createElement(I,{key:"preset",prefixCls:B}),N&&n.createElement(O,{key:"status",prefixCls:B}));return W(R?n.createElement(d.Z,{component:"Tag"},F):F)});z.CheckableTag=y;var T=z},44633:function(t,o,e){var n=e(2265);let c=n.forwardRef(function(t,o){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:o},t),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});o.Z=c},49084:function(t,o,e){var n=e(2265);let c=n.forwardRef(function(t,o){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:o},t),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});o.Z=c}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4077],{47323:function(t,o,e){e.d(o,{Z:function(){return b}});var n=e(5853),c=e(2265),i=e(47187),a=e(7084),r=e(13241),l=e(1153),s=e(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"}},m={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"}},g={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:""}},p=(t,o)=>{switch(t){case"simple":return{textColor:o?(0,l.bM)(o,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:o?(0,l.bM)(o,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:o?(0,r.q)((0,l.bM)(o,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:o?(0,l.bM)(o,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:o?(0,r.q)((0,l.bM)(o,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:o?(0,l.bM)(o,s.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:o?(0,r.q)((0,l.bM)(o,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:o?(0,l.bM)(o,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:o?(0,r.q)((0,l.bM)(o,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:o?(0,l.bM)(o,s.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:o?(0,r.q)((0,l.bM)(o,s.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},u=(0,l.fn)("Icon"),b=c.forwardRef((t,o)=>{let{icon:e,variant:s="simple",tooltip:b,size:h=a.u8.SM,color:f,className:v}=t,C=(0,n._T)(t,["icon","variant","tooltip","size","color","className"]),S=p(s,f),{tooltipProps:k,getReferenceProps:y}=(0,i.l)();return c.createElement("span",Object.assign({ref:(0,l.lq)([o,k.refs.setReference]),className:(0,r.q)(u("root"),"inline-flex shrink-0 items-center justify-center",S.bgColor,S.textColor,S.borderColor,S.ringColor,g[s].rounded,g[s].border,g[s].shadow,g[s].ring,d[h].paddingX,d[h].paddingY,v)},y,C),c.createElement(i.Z,Object.assign({text:b},k)),c.createElement(e,{className:(0,r.q)(u("icon"),"shrink-0",m[h].height,m[h].width)}))});b.displayName="Icon"},15690:function(t,o,e){e.d(o,{default:function(){return F}});var n=e(2265),c=e(9738),i=e(49638),a=e(36760),r=e.n(a),l=e(1119),s=e(31686),d=e(11993),m=e(6989),g=e(95814),p=["className","prefixCls","style","active","status","iconPrefix","icon","wrapperStyle","stepNumber","disabled","description","title","subTitle","progressDot","stepIcon","tailContent","icons","stepIndex","onStepClick","onClick","render"];function u(t){return"string"==typeof t}var b=function(t){var o,e,c,i,a,b=t.className,h=t.prefixCls,f=t.style,v=t.active,C=t.status,S=t.iconPrefix,k=t.icon,y=(t.wrapperStyle,t.stepNumber),w=t.disabled,x=t.description,I=t.title,q=t.subTitle,O=t.progressDot,E=t.stepIcon,z=t.tailContent,T=t.icons,j=t.stepIndex,N=t.onStepClick,H=t.onClick,M=t.render,B=(0,m.Z)(t,p),W={};N&&!w&&(W.role="button",W.tabIndex=0,W.onClick=function(t){null==H||H(t),N(j)},W.onKeyDown=function(t){var o=t.which;(o===g.Z.ENTER||o===g.Z.SPACE)&&N(j)});var X=r()("".concat(h,"-item"),"".concat(h,"-item-").concat(C||"wait"),b,(a={},(0,d.Z)(a,"".concat(h,"-item-custom"),k),(0,d.Z)(a,"".concat(h,"-item-active"),v),(0,d.Z)(a,"".concat(h,"-item-disabled"),!0===w),a)),Z=(0,s.Z)({},f),P=n.createElement("div",(0,l.Z)({},B,{className:X,style:Z}),n.createElement("div",(0,l.Z)({onClick:H},W,{className:"".concat(h,"-item-container")}),n.createElement("div",{className:"".concat(h,"-item-tail")},z),n.createElement("div",{className:"".concat(h,"-item-icon")},(c=r()("".concat(h,"-icon"),"".concat(S,"icon"),(o={},(0,d.Z)(o,"".concat(S,"icon-").concat(k),k&&u(k)),(0,d.Z)(o,"".concat(S,"icon-check"),!k&&"finish"===C&&(T&&!T.finish||!T)),(0,d.Z)(o,"".concat(S,"icon-cross"),!k&&"error"===C&&(T&&!T.error||!T)),o)),i=n.createElement("span",{className:"".concat(h,"-icon-dot")}),e=O?"function"==typeof O?n.createElement("span",{className:"".concat(h,"-icon")},O(i,{index:y-1,status:C,title:I,description:x})):n.createElement("span",{className:"".concat(h,"-icon")},i):k&&!u(k)?n.createElement("span",{className:"".concat(h,"-icon")},k):T&&T.finish&&"finish"===C?n.createElement("span",{className:"".concat(h,"-icon")},T.finish):T&&T.error&&"error"===C?n.createElement("span",{className:"".concat(h,"-icon")},T.error):k||"finish"===C||"error"===C?n.createElement("span",{className:c}):n.createElement("span",{className:"".concat(h,"-icon")},y),E&&(e=E({index:y-1,status:C,title:I,description:x,node:e})),e)),n.createElement("div",{className:"".concat(h,"-item-content")},n.createElement("div",{className:"".concat(h,"-item-title")},I,q&&n.createElement("div",{title:"string"==typeof q?q:void 0,className:"".concat(h,"-item-subtitle")},q)),x&&n.createElement("div",{className:"".concat(h,"-item-description")},x))));return M&&(P=M(P)||null),P},h=["prefixCls","style","className","children","direction","type","labelPlacement","iconPrefix","status","size","current","progressDot","stepIcon","initial","icons","onChange","itemRender","items"];function f(t){var o,e=t.prefixCls,c=void 0===e?"rc-steps":e,i=t.style,a=void 0===i?{}:i,g=t.className,p=(t.children,t.direction),u=t.type,f=void 0===u?"default":u,v=t.labelPlacement,C=t.iconPrefix,S=void 0===C?"rc":C,k=t.status,y=void 0===k?"process":k,w=t.size,x=t.current,I=void 0===x?0:x,q=t.progressDot,O=t.stepIcon,E=t.initial,z=void 0===E?0:E,T=t.icons,j=t.onChange,N=t.itemRender,H=t.items,M=(0,m.Z)(t,h),B="inline"===f,W=B||void 0!==q&&q,X=B?"horizontal":void 0===p?"horizontal":p,Z=B?void 0:w,P=r()(c,"".concat(c,"-").concat(X),g,(o={},(0,d.Z)(o,"".concat(c,"-").concat(Z),Z),(0,d.Z)(o,"".concat(c,"-label-").concat(W?"vertical":void 0===v?"horizontal":v),"horizontal"===X),(0,d.Z)(o,"".concat(c,"-dot"),!!W),(0,d.Z)(o,"".concat(c,"-navigation"),"navigation"===f),(0,d.Z)(o,"".concat(c,"-inline"),B),o)),D=function(t){j&&I!==t&&j(t)};return n.createElement("div",(0,l.Z)({className:P,style:a},M),(void 0===H?[]:H).filter(function(t){return t}).map(function(t,o){var e=(0,s.Z)({},t),i=z+o;return"error"===y&&o===I-1&&(e.className="".concat(c,"-next-error")),e.status||(i===I?e.status=y:i{let{componentCls:o,customIconTop:e,customIconSize:n,customIconFontSize:c}=t;return{["".concat(o,"-item-custom")]:{["> ".concat(o,"-item-container > ").concat(o,"-item-icon")]:{height:"auto",background:"none",border:0,["> ".concat(o,"-icon")]:{top:e,width:n,height:n,fontSize:c,lineHeight:(0,w.bf)(n)}}},["&:not(".concat(o,"-vertical)")]:{["".concat(o,"-item-custom")]:{["".concat(o,"-item-icon")]:{width:"auto",background:"none"}}}}},E=t=>{let{componentCls:o}=t;return{["".concat(o,"-horizontal")]:{["".concat("".concat(o,"-item"),"-tail")]:{transform:"translateY(-50%)"}}}},z=t=>{let{componentCls:o,inlineDotSize:e,inlineTitleColor:n,inlineTailColor:c}=t,i=t.calc(t.paddingXS).add(t.lineWidth).equal(),a={["".concat(o,"-item-container ").concat(o,"-item-content ").concat(o,"-item-title")]:{color:n}};return{["&".concat(o,"-inline")]:{width:"auto",display:"inline-flex",["".concat(o,"-item")]:{flex:"none","&-container":{padding:"".concat((0,w.bf)(i)," ").concat((0,w.bf)(t.paddingXXS)," 0"),margin:"0 ".concat((0,w.bf)(t.calc(t.marginXXS).div(2).equal())),borderRadius:t.borderRadiusSM,cursor:"pointer",transition:"background-color ".concat(t.motionDurationMid),"&:hover":{background:t.controlItemBgHover},"&[role='button']:hover":{opacity:1}},"&-icon":{width:e,height:e,marginInlineStart:"calc(50% - ".concat((0,w.bf)(t.calc(e).div(2).equal()),")"),["> ".concat(o,"-icon")]:{top:0},["".concat(o,"-icon-dot")]:{borderRadius:t.calc(t.fontSizeSM).div(4).equal(),"&::after":{display:"none"}}},"&-content":{width:"auto",marginTop:t.calc(t.marginXS).sub(t.lineWidth).equal()},"&-title":{color:n,fontSize:t.fontSizeSM,lineHeight:t.lineHeightSM,fontWeight:"normal",marginBottom:t.calc(t.marginXXS).div(2).equal()},"&-description":{display:"none"},"&-tail":{marginInlineStart:0,top:t.calc(e).div(2).add(i).equal(),transform:"translateY(-50%)","&:after":{width:"100%",height:t.lineWidth,borderRadius:0,marginInlineStart:0,background:c}},["&:first-child ".concat(o,"-item-tail")]:{width:"50%",marginInlineStart:"50%"},["&:last-child ".concat(o,"-item-tail")]:{display:"block",width:"50%"},"&-wait":Object.assign({["".concat(o,"-item-icon ").concat(o,"-icon ").concat(o,"-icon-dot")]:{backgroundColor:t.colorBorderBg,border:"".concat((0,w.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(c)}},a),"&-finish":Object.assign({["".concat(o,"-item-tail::after")]:{backgroundColor:c},["".concat(o,"-item-icon ").concat(o,"-icon ").concat(o,"-icon-dot")]:{backgroundColor:c,border:"".concat((0,w.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(c)}},a),"&-error":a,"&-active, &-process":Object.assign({["".concat(o,"-item-icon")]:{width:e,height:e,marginInlineStart:"calc(50% - ".concat((0,w.bf)(t.calc(e).div(2).equal()),")"),top:0}},a),["&:not(".concat(o,"-item-active) > ").concat(o,"-item-container[role='button']:hover")]:{["".concat(o,"-item-title")]:{color:n}}}}}},T=t=>{let{componentCls:o,iconSize:e,lineHeight:n,iconSizeSM:c}=t;return{["&".concat(o,"-label-vertical")]:{["".concat(o,"-item")]:{overflow:"visible","&-tail":{marginInlineStart:t.calc(e).div(2).add(t.controlHeightLG).equal(),padding:"0 ".concat((0,w.bf)(t.paddingLG))},"&-content":{display:"block",width:t.calc(e).div(2).add(t.controlHeightLG).mul(2).equal(),marginTop:t.marginSM,textAlign:"center"},"&-icon":{display:"inline-block",marginInlineStart:t.controlHeightLG},"&-title":{paddingInlineEnd:0,paddingInlineStart:0,"&::after":{display:"none"}},"&-subtitle":{display:"block",marginBottom:t.marginXXS,marginInlineStart:0,lineHeight:n}},["&".concat(o,"-small:not(").concat(o,"-dot)")]:{["".concat(o,"-item")]:{"&-icon":{marginInlineStart:t.calc(e).sub(c).div(2).add(t.controlHeightLG).equal()}}}}}},j=t=>{let{componentCls:o,navContentMaxWidth:e,navArrowColor:n,stepsNavActiveColor:c,motionDurationSlow:i}=t;return{["&".concat(o,"-navigation")]:{paddingTop:t.paddingSM,["&".concat(o,"-small")]:{["".concat(o,"-item")]:{"&-container":{marginInlineStart:t.calc(t.marginSM).mul(-1).equal()}}},["".concat(o,"-item")]:{overflow:"visible",textAlign:"center","&-container":{display:"inline-block",height:"100%",marginInlineStart:t.calc(t.margin).mul(-1).equal(),paddingBottom:t.paddingSM,textAlign:"start",transition:"opacity ".concat(i),["".concat(o,"-item-content")]:{maxWidth:e},["".concat(o,"-item-title")]:Object.assign(Object.assign({maxWidth:"100%",paddingInlineEnd:0},x.vS),{"&::after":{display:"none"}})},["&:not(".concat(o,"-item-active)")]:{["".concat(o,"-item-container[role='button']")]:{cursor:"pointer","&:hover":{opacity:.85}}},"&:last-child":{flex:1,"&::after":{display:"none"}},"&::after":{position:"absolute",top:"calc(50% - ".concat((0,w.bf)(t.calc(t.paddingSM).div(2).equal()),")"),insetInlineStart:"100%",display:"inline-block",width:t.fontSizeIcon,height:t.fontSizeIcon,borderTop:"".concat((0,w.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(n),borderBottom:"none",borderInlineStart:"none",borderInlineEnd:"".concat((0,w.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(n),transform:"translateY(-50%) translateX(-50%) rotate(45deg)",content:'""'},"&::before":{position:"absolute",bottom:0,insetInlineStart:"50%",display:"inline-block",width:0,height:t.lineWidthBold,backgroundColor:c,transition:"width ".concat(i,", inset-inline-start ").concat(i),transitionTimingFunction:"ease-out",content:'""'}},["".concat(o,"-item").concat(o,"-item-active::before")]:{insetInlineStart:0,width:"100%"}},["&".concat(o,"-navigation").concat(o,"-vertical")]:{["> ".concat(o,"-item")]:{marginInlineEnd:0,"&::before":{display:"none"},["&".concat(o,"-item-active::before")]:{top:0,insetInlineEnd:0,insetInlineStart:"unset",display:"block",width:t.calc(t.lineWidth).mul(3).equal(),height:"calc(100% - ".concat((0,w.bf)(t.marginLG),")")},"&::after":{position:"relative",insetInlineStart:"50%",display:"block",width:t.calc(t.controlHeight).mul(.25).equal(),height:t.calc(t.controlHeight).mul(.25).equal(),marginBottom:t.marginXS,textAlign:"center",transform:"translateY(-50%) translateX(-50%) rotate(135deg)"},"&:last-child":{"&::after":{display:"none"}},["> ".concat(o,"-item-container > ").concat(o,"-item-tail")]:{visibility:"hidden"}}},["&".concat(o,"-navigation").concat(o,"-horizontal")]:{["> ".concat(o,"-item > ").concat(o,"-item-container > ").concat(o,"-item-tail")]:{visibility:"hidden"}}}},N=t=>{let{antCls:o,componentCls:e,iconSize:n,iconSizeSM:c,processIconColor:i,marginXXS:a,lineWidthBold:r,lineWidth:l,paddingXXS:s}=t,d=t.calc(n).add(t.calc(r).mul(4).equal()).equal(),m=t.calc(c).add(t.calc(t.lineWidth).mul(4).equal()).equal();return{["&".concat(e,"-with-progress")]:{["".concat(e,"-item")]:{paddingTop:s,["&-process ".concat(e,"-item-container ").concat(e,"-item-icon ").concat(e,"-icon")]:{color:i}},["&".concat(e,"-vertical > ").concat(e,"-item ")]:{paddingInlineStart:s,["> ".concat(e,"-item-container > ").concat(e,"-item-tail")]:{top:a,insetInlineStart:t.calc(n).div(2).sub(l).add(s).equal()}},["&, &".concat(e,"-small")]:{["&".concat(e,"-horizontal ").concat(e,"-item:first-child")]:{paddingBottom:s,paddingInlineStart:s}},["&".concat(e,"-small").concat(e,"-vertical > ").concat(e,"-item > ").concat(e,"-item-container > ").concat(e,"-item-tail")]:{insetInlineStart:t.calc(c).div(2).sub(l).add(s).equal()},["&".concat(e,"-label-vertical ").concat(e,"-item ").concat(e,"-item-tail")]:{top:t.calc(n).div(2).add(s).equal()},["".concat(e,"-item-icon")]:{position:"relative",["".concat(o,"-progress")]:{position:"absolute",insetInlineStart:"50%",top:"50%",transform:"translate(-50%, -50%)","&-inner":{width:"".concat((0,w.bf)(d)," !important"),height:"".concat((0,w.bf)(d)," !important")}}},["&".concat(e,"-small")]:{["&".concat(e,"-label-vertical ").concat(e,"-item ").concat(e,"-item-tail")]:{top:t.calc(c).div(2).add(s).equal()},["".concat(e,"-item-icon ").concat(o,"-progress-inner")]:{width:"".concat((0,w.bf)(m)," !important"),height:"".concat((0,w.bf)(m)," !important")}}}}},H=t=>{let{componentCls:o,descriptionMaxWidth:e,lineHeight:n,dotCurrentSize:c,dotSize:i,motionDurationSlow:a}=t;return{["&".concat(o,"-dot, &").concat(o,"-dot").concat(o,"-small")]:{["".concat(o,"-item")]:{"&-title":{lineHeight:n},"&-tail":{top:t.calc(t.dotSize).sub(t.calc(t.lineWidth).mul(3).equal()).div(2).equal(),width:"100%",marginTop:0,marginBottom:0,marginInline:"".concat((0,w.bf)(t.calc(e).div(2).equal())," 0"),padding:0,"&::after":{width:"calc(100% - ".concat((0,w.bf)(t.calc(t.marginSM).mul(2).equal()),")"),height:t.calc(t.lineWidth).mul(3).equal(),marginInlineStart:t.marginSM}},"&-icon":{width:i,height:i,marginInlineStart:t.calc(t.descriptionMaxWidth).sub(i).div(2).equal(),paddingInlineEnd:0,lineHeight:(0,w.bf)(i),background:"transparent",border:0,["".concat(o,"-icon-dot")]:{position:"relative",float:"left",width:"100%",height:"100%",borderRadius:100,transition:"all ".concat(a),"&::after":{position:"absolute",top:t.calc(t.marginSM).mul(-1).equal(),insetInlineStart:t.calc(i).sub(t.calc(t.controlHeightLG).mul(1.5).equal()).div(2).equal(),width:t.calc(t.controlHeightLG).mul(1.5).equal(),height:t.controlHeight,background:"transparent",content:'""'}}},"&-content":{width:e},["&-process ".concat(o,"-item-icon")]:{position:"relative",top:t.calc(i).sub(c).div(2).equal(),width:c,height:c,lineHeight:(0,w.bf)(c),background:"none",marginInlineStart:t.calc(t.descriptionMaxWidth).sub(c).div(2).equal()},["&-process ".concat(o,"-icon")]:{["&:first-child ".concat(o,"-icon-dot")]:{insetInlineStart:0}}}},["&".concat(o,"-vertical").concat(o,"-dot")]:{["".concat(o,"-item-icon")]:{marginTop:t.calc(t.controlHeight).sub(i).div(2).equal(),marginInlineStart:0,background:"none"},["".concat(o,"-item-process ").concat(o,"-item-icon")]:{marginTop:t.calc(t.controlHeight).sub(c).div(2).equal(),top:0,insetInlineStart:t.calc(i).sub(c).div(2).equal(),marginInlineStart:0},["".concat(o,"-item > ").concat(o,"-item-container > ").concat(o,"-item-tail")]:{top:t.calc(t.controlHeight).sub(i).div(2).equal(),insetInlineStart:0,margin:0,padding:"".concat((0,w.bf)(t.calc(i).add(t.paddingXS).equal())," 0 ").concat((0,w.bf)(t.paddingXS)),"&::after":{marginInlineStart:t.calc(i).sub(t.lineWidth).div(2).equal()}},["&".concat(o,"-small")]:{["".concat(o,"-item-icon")]:{marginTop:t.calc(t.controlHeightSM).sub(i).div(2).equal()},["".concat(o,"-item-process ").concat(o,"-item-icon")]:{marginTop:t.calc(t.controlHeightSM).sub(c).div(2).equal()},["".concat(o,"-item > ").concat(o,"-item-container > ").concat(o,"-item-tail")]:{top:t.calc(t.controlHeightSM).sub(i).div(2).equal()}},["".concat(o,"-item:first-child ").concat(o,"-icon-dot")]:{insetInlineStart:0},["".concat(o,"-item-content")]:{width:"inherit"}}}},M=t=>{let{componentCls:o}=t;return{["&".concat(o,"-rtl")]:{direction:"rtl",["".concat(o,"-item")]:{"&-subtitle":{float:"left"}},["&".concat(o,"-navigation")]:{["".concat(o,"-item::after")]:{transform:"rotate(-45deg)"}},["&".concat(o,"-vertical")]:{["> ".concat(o,"-item")]:{"&::after":{transform:"rotate(225deg)"},["".concat(o,"-item-icon")]:{float:"right"}}},["&".concat(o,"-dot")]:{["".concat(o,"-item-icon ").concat(o,"-icon-dot, &").concat(o,"-small ").concat(o,"-item-icon ").concat(o,"-icon-dot")]:{float:"right"}}}}},B=t=>{let{componentCls:o,iconSizeSM:e,fontSizeSM:n,fontSize:c,colorTextDescription:i}=t;return{["&".concat(o,"-small")]:{["&".concat(o,"-horizontal:not(").concat(o,"-label-vertical) ").concat(o,"-item")]:{paddingInlineStart:t.paddingSM,"&:first-child":{paddingInlineStart:0}},["".concat(o,"-item-icon")]:{width:e,height:e,marginTop:0,marginBottom:0,marginInline:"0 ".concat((0,w.bf)(t.marginXS)),fontSize:n,lineHeight:(0,w.bf)(e),textAlign:"center",borderRadius:e},["".concat(o,"-item-title")]:{paddingInlineEnd:t.paddingSM,fontSize:c,lineHeight:(0,w.bf)(e),"&::after":{top:t.calc(e).div(2).equal()}},["".concat(o,"-item-description")]:{color:i,fontSize:c},["".concat(o,"-item-tail")]:{top:t.calc(e).div(2).sub(t.paddingXXS).equal()},["".concat(o,"-item-custom ").concat(o,"-item-icon")]:{width:"inherit",height:"inherit",lineHeight:"inherit",background:"none",border:0,borderRadius:0,["> ".concat(o,"-icon")]:{fontSize:e,lineHeight:(0,w.bf)(e),transform:"none"}}}}},W=t=>{let{componentCls:o,iconSizeSM:e,iconSize:n}=t;return{["&".concat(o,"-vertical")]:{display:"flex",flexDirection:"column",["> ".concat(o,"-item")]:{display:"block",flex:"1 0 auto",paddingInlineStart:0,overflow:"visible",["".concat(o,"-item-icon")]:{float:"left",marginInlineEnd:t.margin},["".concat(o,"-item-content")]:{display:"block",minHeight:t.calc(t.controlHeight).mul(1.5).equal(),overflow:"hidden"},["".concat(o,"-item-title")]:{lineHeight:(0,w.bf)(n)},["".concat(o,"-item-description")]:{paddingBottom:t.paddingSM}},["> ".concat(o,"-item > ").concat(o,"-item-container > ").concat(o,"-item-tail")]:{position:"absolute",top:0,insetInlineStart:t.calc(n).div(2).sub(t.lineWidth).equal(),width:t.lineWidth,height:"100%",padding:"".concat((0,w.bf)(t.calc(t.marginXXS).mul(1.5).add(n).equal())," 0 ").concat((0,w.bf)(t.calc(t.marginXXS).mul(1.5).equal())),"&::after":{width:t.lineWidth,height:"100%"}},["> ".concat(o,"-item:not(:last-child) > ").concat(o,"-item-container > ").concat(o,"-item-tail")]:{display:"block"},[" > ".concat(o,"-item > ").concat(o,"-item-container > ").concat(o,"-item-content > ").concat(o,"-item-title")]:{"&::after":{display:"none"}},["&".concat(o,"-small ").concat(o,"-item-container")]:{["".concat(o,"-item-tail")]:{position:"absolute",top:0,insetInlineStart:t.calc(e).div(2).sub(t.lineWidth).equal(),padding:"".concat((0,w.bf)(t.calc(t.marginXXS).mul(1.5).add(e).equal())," 0 ").concat((0,w.bf)(t.calc(t.marginXXS).mul(1.5).equal()))},["".concat(o,"-item-title")]:{lineHeight:(0,w.bf)(e)}}}}};let X=(t,o)=>{let e="".concat(o.componentCls,"-item"),n="".concat(t,"IconColor"),c="".concat(t,"TitleColor"),i="".concat(t,"DescriptionColor"),a="".concat(t,"TailColor"),r="".concat(t,"IconBgColor"),l="".concat(t,"IconBorderColor"),s="".concat(t,"DotColor");return{["".concat(e,"-").concat(t," ").concat(e,"-icon")]:{backgroundColor:o[r],borderColor:o[l],["> ".concat(o.componentCls,"-icon")]:{color:o[n],["".concat(o.componentCls,"-icon-dot")]:{background:o[s]}}},["".concat(e,"-").concat(t).concat(e,"-custom ").concat(e,"-icon")]:{["> ".concat(o.componentCls,"-icon")]:{color:o[s]}},["".concat(e,"-").concat(t," > ").concat(e,"-container > ").concat(e,"-content > ").concat(e,"-title")]:{color:o[c],"&::after":{backgroundColor:o[a]}},["".concat(e,"-").concat(t," > ").concat(e,"-container > ").concat(e,"-content > ").concat(e,"-description")]:{color:o[i]},["".concat(e,"-").concat(t," > ").concat(e,"-container > ").concat(e,"-tail::after")]:{backgroundColor:o[a]}}},Z=t=>{let{componentCls:o,motionDurationSlow:e}=t,n="".concat(o,"-item"),c="".concat(n,"-icon");return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[n]:{position:"relative",display:"inline-block",flex:1,overflow:"hidden",verticalAlign:"top","&:last-child":{flex:"none",["> ".concat(n,"-container > ").concat(n,"-tail, > ").concat(n,"-container > ").concat(n,"-content > ").concat(n,"-title::after")]:{display:"none"}}},["".concat(n,"-container")]:{outline:"none",["&:focus-visible ".concat(c)]:(0,x.oN)(t)},["".concat(c,", ").concat(n,"-content")]:{display:"inline-block",verticalAlign:"top"},[c]:{width:t.iconSize,height:t.iconSize,marginTop:0,marginBottom:0,marginInlineStart:0,marginInlineEnd:t.marginXS,fontSize:t.iconFontSize,fontFamily:t.fontFamily,lineHeight:(0,w.bf)(t.iconSize),textAlign:"center",borderRadius:t.iconSize,border:"".concat((0,w.bf)(t.lineWidth)," ").concat(t.lineType," transparent"),transition:"background-color ".concat(e,", border-color ").concat(e),["".concat(o,"-icon")]:{position:"relative",top:t.iconTop,color:t.colorPrimary,lineHeight:1}},["".concat(n,"-tail")]:{position:"absolute",top:t.calc(t.iconSize).div(2).equal(),insetInlineStart:0,width:"100%","&::after":{display:"inline-block",width:"100%",height:t.lineWidth,background:t.colorSplit,borderRadius:t.lineWidth,transition:"background ".concat(e),content:'""'}},["".concat(n,"-title")]:{position:"relative",display:"inline-block",paddingInlineEnd:t.padding,color:t.colorText,fontSize:t.fontSizeLG,lineHeight:(0,w.bf)(t.titleLineHeight),"&::after":{position:"absolute",top:t.calc(t.titleLineHeight).div(2).equal(),insetInlineStart:"100%",display:"block",width:9999,height:t.lineWidth,background:t.processTailColor,content:'""'}},["".concat(n,"-subtitle")]:{display:"inline",marginInlineStart:t.marginXS,color:t.colorTextDescription,fontWeight:"normal",fontSize:t.fontSize},["".concat(n,"-description")]:{color:t.colorTextDescription,fontSize:t.fontSize}},X("wait",t)),X("process",t)),{["".concat(n,"-process > ").concat(n,"-container > ").concat(n,"-title")]:{fontWeight:t.fontWeightStrong}}),X("finish",t)),X("error",t)),{["".concat(n).concat(o,"-next-error > ").concat(o,"-item-title::after")]:{background:t.colorError},["".concat(n,"-disabled")]:{cursor:"not-allowed"}})},P=t=>{let{componentCls:o,motionDurationSlow:e}=t;return{["& ".concat(o,"-item")]:{["&:not(".concat(o,"-item-active)")]:{["& > ".concat(o,"-item-container[role='button']")]:{cursor:"pointer",["".concat(o,"-item")]:{["&-title, &-subtitle, &-description, &-icon ".concat(o,"-icon")]:{transition:"color ".concat(e)}},"&:hover":{["".concat(o,"-item")]:{"&-title, &-subtitle, &-description":{color:t.colorPrimary}}}},["&:not(".concat(o,"-item-process)")]:{["& > ".concat(o,"-item-container[role='button']:hover")]:{["".concat(o,"-item")]:{"&-icon":{borderColor:t.colorPrimary,["".concat(o,"-icon")]:{color:t.colorPrimary}}}}}}},["&".concat(o,"-horizontal:not(").concat(o,"-label-vertical)")]:{["".concat(o,"-item")]:{paddingInlineStart:t.padding,whiteSpace:"nowrap","&:first-child":{paddingInlineStart:0},["&:last-child ".concat(o,"-item-title")]:{paddingInlineEnd:0},"&-tail":{display:"none"},"&-description":{maxWidth:t.descriptionMaxWidth,whiteSpace:"normal"}}}}},D=t=>{let{componentCls:o}=t;return{[o]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,x.Wf)(t)),{display:"flex",width:"100%",fontSize:0,textAlign:"initial"}),Z(t)),P(t)),O(t)),B(t)),W(t)),E(t)),T(t)),H(t)),j(t)),M(t)),N(t)),z(t))}};var L=(0,I.I$)("Steps",t=>{let{colorTextDisabled:o,controlHeightLG:e,colorTextLightSolid:n,colorText:c,colorPrimary:i,colorTextDescription:a,colorTextQuaternary:r,colorError:l,colorBorderSecondary:s,colorSplit:d}=t;return D((0,q.IX)(t,{processIconColor:n,processTitleColor:c,processDescriptionColor:c,processIconBgColor:i,processIconBorderColor:i,processDotColor:i,processTailColor:d,waitTitleColor:a,waitDescriptionColor:a,waitTailColor:d,waitDotColor:o,finishIconColor:i,finishTitleColor:c,finishDescriptionColor:a,finishTailColor:i,finishDotColor:i,errorIconColor:n,errorTitleColor:l,errorDescriptionColor:l,errorTailColor:d,errorIconBgColor:l,errorIconBorderColor:l,errorDotColor:l,stepsNavActiveColor:i,stepsProgressSize:e,inlineDotSize:6,inlineTitleColor:r,inlineTailColor:s}))},t=>({titleLineHeight:t.controlHeight,customIconSize:t.controlHeight,customIconTop:0,customIconFontSize:t.controlHeightSM,iconSize:t.controlHeight,iconTop:-.5,iconFontSize:t.fontSize,iconSizeSM:t.fontSizeHeading3,dotSize:t.controlHeight/4,dotCurrentSize:t.controlHeightLG/4,navArrowColor:t.colorTextDisabled,navContentMaxWidth:"unset",descriptionMaxWidth:140,waitIconColor:t.wireframe?t.colorTextDisabled:t.colorTextLabel,waitIconBgColor:t.wireframe?t.colorBgContainer:t.colorFillContent,waitIconBorderColor:t.wireframe?t.colorTextDisabled:"transparent",finishIconBgColor:t.wireframe?t.colorBgContainer:t.controlItemBgActive,finishIconBorderColor:t.wireframe?t.colorPrimary:t.controlItemBgActive})),R=e(45287),A=function(t,o){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&0>o.indexOf(n)&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var c=0,n=Object.getOwnPropertySymbols(t);co.indexOf(n[c])&&Object.prototype.propertyIsEnumerable.call(t,n[c])&&(e[n[c]]=t[n[c]]);return e};let K=t=>{let{percent:o,size:e,className:a,rootClassName:l,direction:s,items:d,responsive:m=!0,current:g=0,children:p,style:u}=t,b=A(t,["percent","size","className","rootClassName","direction","items","responsive","current","children","style"]),{xs:h}=(0,S.Z)(m),{getPrefixCls:w,direction:x,className:I,style:q}=(0,v.dj)("steps"),O=n.useMemo(()=>m&&h?"vertical":s,[m,h,s]),E=(0,C.Z)(e),z=w("steps",t.prefixCls),[T,j,N]=L(z),H="inline"===t.type,M=w("",t.iconPrefix),B=d||(0,R.Z)(p).map(t=>{if(n.isValidElement(t)){let{props:o}=t;return Object.assign({},o)}return null}).filter(t=>t),W=H?void 0:o,X=Object.assign(Object.assign({},q),u),Z=r()(I,{["".concat(z,"-rtl")]:"rtl"===x,["".concat(z,"-with-progress")]:void 0!==W},a,l,j,N),P={finish:n.createElement(c.Z,{className:"".concat(z,"-finish-icon")}),error:n.createElement(i.Z,{className:"".concat(z,"-error-icon")})};return T(n.createElement(f,Object.assign({icons:P},b,{style:X,current:g,size:E,items:B,itemRender:H?(t,o)=>t.description?n.createElement(y.Z,{title:t.description},o):o:void 0,stepIcon:t=>{let{node:o,status:e}=t;return"process"===e&&void 0!==W?n.createElement("div",{className:"".concat(z,"-progress-icon")},n.createElement(k.Z,{type:"circle",percent:W,size:"small"===E?32:40,strokeWidth:4,format:()=>null}),o):o},direction:O,prefixCls:z,iconPrefix:M,className:Z})))};K.Step=f.Step;var F=K},3810:function(t,o,e){e.d(o,{Z:function(){return T}});var n=e(2265),c=e(36760),i=e.n(c),a=e(18694),r=e(93350),l=e(53445),s=e(19722),d=e(6694),m=e(71744),g=e(93463),p=e(54558),u=e(12918),b=e(71140),h=e(99320);let f=t=>{let{paddingXXS:o,lineWidth:e,tagPaddingHorizontal:n,componentCls:c,calc:i}=t,a=i(n).sub(e).equal(),r=i(o).sub(e).equal();return{[c]:Object.assign(Object.assign({},(0,u.Wf)(t)),{display:"inline-block",height:"auto",marginInlineEnd:t.marginXS,paddingInline:a,fontSize:t.tagFontSize,lineHeight:t.tagLineHeight,whiteSpace:"nowrap",background:t.defaultBg,border:"".concat((0,g.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(t.colorBorder),borderRadius:t.borderRadiusSM,opacity:1,transition:"all ".concat(t.motionDurationMid),textAlign:"start",position:"relative",["&".concat(c,"-rtl")]:{direction:"rtl"},"&, a, a:hover":{color:t.defaultColor},["".concat(c,"-close-icon")]:{marginInlineStart:r,fontSize:t.tagIconSize,color:t.colorIcon,cursor:"pointer",transition:"all ".concat(t.motionDurationMid),"&:hover":{color:t.colorTextHeading}},["&".concat(c,"-has-color")]:{borderColor:"transparent",["&, a, a:hover, ".concat(t.iconCls,"-close, ").concat(t.iconCls,"-close:hover")]:{color:t.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",["&:not(".concat(c,"-checkable-checked):hover")]:{color:t.colorPrimary,backgroundColor:t.colorFillSecondary},"&:active, &-checked":{color:t.colorTextLightSolid},"&-checked":{backgroundColor:t.colorPrimary,"&:hover":{backgroundColor:t.colorPrimaryHover}},"&:active":{backgroundColor:t.colorPrimaryActive}},"&-hidden":{display:"none"},["> ".concat(t.iconCls," + span, > span + ").concat(t.iconCls)]:{marginInlineStart:a}}),["".concat(c,"-borderless")]:{borderColor:"transparent",background:t.tagBorderlessBg}}},v=t=>{let{lineWidth:o,fontSizeIcon:e,calc:n}=t,c=t.fontSizeSM;return(0,b.IX)(t,{tagFontSize:c,tagLineHeight:(0,g.bf)(n(t.lineHeightSM).mul(c).equal()),tagIconSize:n(e).sub(n(o).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:t.defaultBg})},C=t=>({defaultBg:new p.t(t.colorFillQuaternary).onBackground(t.colorBgContainer).toHexString(),defaultColor:t.colorText});var S=(0,h.I$)("Tag",t=>f(v(t)),C),k=function(t,o){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&0>o.indexOf(n)&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var c=0,n=Object.getOwnPropertySymbols(t);co.indexOf(n[c])&&Object.prototype.propertyIsEnumerable.call(t,n[c])&&(e[n[c]]=t[n[c]]);return e};let y=n.forwardRef((t,o)=>{let{prefixCls:e,style:c,className:a,checked:r,children:l,icon:s,onChange:d,onClick:g}=t,p=k(t,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:u,tag:b}=n.useContext(m.E_),h=u("tag",e),[f,v,C]=S(h),y=i()(h,"".concat(h,"-checkable"),{["".concat(h,"-checkable-checked")]:r},null==b?void 0:b.className,a,v,C);return f(n.createElement("span",Object.assign({},p,{ref:o,style:Object.assign(Object.assign({},c),null==b?void 0:b.style),className:y,onClick:t=>{null==d||d(!r),null==g||g(t)}}),s,n.createElement("span",null,l)))});var w=e(18536);let x=t=>(0,w.Z)(t,(o,e)=>{let{textColor:n,lightBorderColor:c,lightColor:i,darkColor:a}=e;return{["".concat(t.componentCls).concat(t.componentCls,"-").concat(o)]:{color:n,background:i,borderColor:c,"&-inverse":{color:t.colorTextLightSolid,background:a,borderColor:a},["&".concat(t.componentCls,"-borderless")]:{borderColor:"transparent"}}}});var I=(0,h.bk)(["Tag","preset"],t=>x(v(t)),C);let q=(t,o,e)=>{let n="string"!=typeof e?e:e.charAt(0).toUpperCase()+e.slice(1);return{["".concat(t.componentCls).concat(t.componentCls,"-").concat(o)]:{color:t["color".concat(e)],background:t["color".concat(n,"Bg")],borderColor:t["color".concat(n,"Border")],["&".concat(t.componentCls,"-borderless")]:{borderColor:"transparent"}}}};var O=(0,h.bk)(["Tag","status"],t=>{let o=v(t);return[q(o,"success","Success"),q(o,"processing","Info"),q(o,"error","Error"),q(o,"warning","Warning")]},C),E=function(t,o){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&0>o.indexOf(n)&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var c=0,n=Object.getOwnPropertySymbols(t);co.indexOf(n[c])&&Object.prototype.propertyIsEnumerable.call(t,n[c])&&(e[n[c]]=t[n[c]]);return e};let z=n.forwardRef((t,o)=>{let{prefixCls:e,className:c,rootClassName:g,style:p,children:u,icon:b,color:h,onClose:f,bordered:v=!0,visible:C}=t,k=E(t,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:y,direction:w,tag:x}=n.useContext(m.E_),[q,z]=n.useState(!0),T=(0,a.Z)(k,["closeIcon","closable"]);n.useEffect(()=>{void 0!==C&&z(C)},[C]);let j=(0,r.o2)(h),N=(0,r.yT)(h),H=j||N,M=Object.assign(Object.assign({backgroundColor:h&&!H?h:void 0},null==x?void 0:x.style),p),B=y("tag",e),[W,X,Z]=S(B),P=i()(B,null==x?void 0:x.className,{["".concat(B,"-").concat(h)]:H,["".concat(B,"-has-color")]:h&&!H,["".concat(B,"-hidden")]:!q,["".concat(B,"-rtl")]:"rtl"===w,["".concat(B,"-borderless")]:!v},c,g,X,Z),D=t=>{t.stopPropagation(),null==f||f(t),t.defaultPrevented||z(!1)},[,L]=(0,l.b)((0,l.w)(t),(0,l.w)(x),{closable:!1,closeIconRender:t=>{let o=n.createElement("span",{className:"".concat(B,"-close-icon"),onClick:D},t);return(0,s.wm)(t,o,t=>({onClick:o=>{var e;null===(e=null==t?void 0:t.onClick)||void 0===e||e.call(t,o),D(o)},className:i()(null==t?void 0:t.className,"".concat(B,"-close-icon"))}))}}),R="function"==typeof k.onClick||u&&"a"===u.type,A=b||null,K=A?n.createElement(n.Fragment,null,A,u&&n.createElement("span",null,u)):u,F=n.createElement("span",Object.assign({},T,{ref:o,className:P,style:M}),K,L,j&&n.createElement(I,{key:"preset",prefixCls:B}),N&&n.createElement(O,{key:"status",prefixCls:B}));return W(R?n.createElement(d.Z,{component:"Tag"},F):F)});z.CheckableTag=y;var T=z},49084:function(t,o,e){var n=e(2265);let c=n.forwardRef(function(t,o){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:o},t),n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});o.Z=c}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4105-9c3c0ee7c494102f.js b/litellm/proxy/_experimental/out/_next/static/chunks/4105-9c3c0ee7c494102f.js new file mode 100644 index 0000000000..0ef5cfc7c3 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4105-9c3c0ee7c494102f.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4105],{34310:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM472 744a40 40 0 1080 0 40 40 0 10-80 0zm16-104h48c4.4 0 8-3.6 8-8V448c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8z"}}]},name:"file-exclamation",theme:"outlined"},s=r(55015),a=i.forwardRef(function(e,t){return i.createElement(s.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},38434:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-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-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},s=r(55015),a=i.forwardRef(function(e,t){return i.createElement(s.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},3632:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),o={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"},s=r(55015),a=i.forwardRef(function(e,t){return i.createElement(s.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},35291:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},s=r(55015),a=i.forwardRef(function(e,t){return i.createElement(s.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},41649:function(e,t,r){"use strict";r.d(t,{Z:function(){return h}});var n=r(5853),i=r(2265),o=r(47187),s=r(7084),a=r(26898),u=r(13241),l=r(1153);let c={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},d={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},f=(0,l.fn)("Badge"),h=i.forwardRef((e,t)=>{let{color:r,icon:h,size:p=s.u8.SM,tooltip:m,className:g,children:v}=e,y=(0,n._T)(e,["color","icon","size","tooltip","className","children"]),b=h||null,{tooltipProps:_,getReferenceProps:w}=(0,o.l)();return i.createElement("span",Object.assign({ref:(0,l.lq)([t,_.refs.setReference]),className:(0,u.q)(f("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",r?(0,u.q)((0,l.bM)(r,a.K.background).bgColor,(0,l.bM)(r,a.K.iconText).textColor,(0,l.bM)(r,a.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,u.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),c[p].paddingX,c[p].paddingY,c[p].fontSize,g)},w,y),i.createElement(o.Z,Object.assign({text:m},_)),b?i.createElement(b,{className:(0,u.q)(f("icon"),"shrink-0 -ml-1 mr-1.5",d[p].height,d[p].width)}):null,i.createElement("span",{className:(0,u.q)(f("text"),"whitespace-nowrap")},v))});h.displayName="Badge"},30150:function(e,t,r){"use strict";r.d(t,{Z:function(){return f}});var n=r(5853),i=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return i.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),i.createElement("path",{d:"M12 4v16m8-8H4"}))},s=e=>{var t=(0,n._T)(e,[]);return i.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),i.createElement("path",{d:"M20 12H4"}))};var a=r(13241),u=r(1153),l=r(69262);let c="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",f=i.forwardRef((e,t)=>{let{onSubmit:r,enableStepper:f=!0,disabled:h,onValueChange:p,onChange:m}=e,g=(0,n._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),v=(0,i.useRef)(null),[y,b]=i.useState(!1),_=i.useCallback(()=>{b(!0)},[]),w=i.useCallback(()=>{b(!1)},[]),[k,E]=i.useState(!1),x=i.useCallback(()=>{E(!0)},[]),C=i.useCallback(()=>{E(!1)},[]);return i.createElement(l.Z,Object.assign({type:"number",ref:(0,u.lq)([v,t]),disabled:h,makeInputClassName:(0,u.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=v.current)||void 0===t?void 0:t.value;null==r||r(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&_(),"ArrowUp"===e.key&&x()},onKeyUp:e=>{"ArrowDown"===e.key&&w(),"ArrowUp"===e.key&&C()},onChange:e=>{h||(null==p||p(parseFloat(e.target.value)),null==m||m(e))},stepper:f?i.createElement("div",{className:(0,a.q)("flex justify-center align-middle")},i.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;h||(null===(e=v.current)||void 0===e||e.stepDown(),null===(t=v.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,a.q)(!h&&d,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},i.createElement(s,{"data-testid":"step-down",className:(y?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),i.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;h||(null===(e=v.current)||void 0===e||e.stepUp(),null===(t=v.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,a.q)(!h&&d,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},i.createElement(o,{"data-testid":"step-up",className:(k?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},g))});f.displayName="NumberInput"},87452:function(e,t,r){"use strict";r.d(t,{Z:function(){return d},r:function(){return c}});var n=r(5853),i=r(91054);r(42698),r(64016);var o=r(8710);r(33232);var s=r(13241),a=r(1153),u=r(2265);let l=(0,a.fn)("Accordion"),c=(0,u.createContext)({isOpen:!1}),d=u.forwardRef((e,t)=>{var r;let{defaultOpen:a=!1,children:d,className:f}=e,h=(0,n._T)(e,["defaultOpen","children","className"]),p=null!==(r=(0,u.useContext)(o.Z))&&void 0!==r?r:(0,s.q)("rounded-tremor-default border");return u.createElement(i.pJ,Object.assign({as:"div",ref:t,className:(0,s.q)(l("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",p,f),defaultOpen:a},h),e=>{let{open:t}=e;return u.createElement(c.Provider,{value:{isOpen:t}},d)})});d.displayName="Accordion"},88829:function(e,t,r){"use strict";r.d(t,{Z:function(){return u}});var n=r(5853),i=r(2265),o=r(91054),s=r(13241);let a=(0,r(1153).fn)("AccordionBody"),u=i.forwardRef((e,t)=>{let{children:r,className:u}=e,l=(0,n._T)(e,["children","className"]);return i.createElement(o.pJ.Panel,Object.assign({ref:t,className:(0,s.q)(a("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",u)},l),r)});u.displayName="AccordionBody"},72208:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(5853),i=r(2265),o=r(91054);let s=e=>{var t=(0,n._T)(e,[]);return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),i.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var a=r(87452),u=r(13241);let l=(0,r(1153).fn)("AccordionHeader"),c=i.forwardRef((e,t)=>{let{children:r,className:c}=e,d=(0,n._T)(e,["children","className"]),{isOpen:f}=(0,i.useContext)(a.r);return i.createElement(o.pJ.Button,Object.assign({ref:t,className:(0,u.q)(l("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",c)},d),i.createElement("div",{className:(0,u.q)(l("children"),"flex flex-1 text-inherit mr-4")},r),i.createElement("div",null,i.createElement(s,{className:(0,u.q)(l("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",f?"transition-all":"transition-all -rotate-180")})))});c.displayName="AccordionHeader"},23910:function(e,t,r){var n=r(74288).Symbol;e.exports=n},54506:function(e,t,r){var n=r(23910),i=r(4479),o=r(80910),s=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?i(e):o(e)}},41087:function(e,t,r){var n=r(5035),i=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(i,""):e}},17071:function(e,t,r){var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},4479:function(e,t,r){var n=r(23910),i=Object.prototype,o=i.hasOwnProperty,s=i.toString,a=n?n.toStringTag:void 0;e.exports=function(e){var t=o.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var i=s.call(e);return n&&(t?e[a]=r:delete e[a]),i}},80910:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},74288:function(e,t,r){var n=r(17071),i="object"==typeof self&&self&&self.Object===Object&&self,o=n||i||Function("return this")();e.exports=o},5035:function(e){var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},7310:function(e,t,r){var n=r(28302),i=r(11121),o=r(6660),s=Math.max,a=Math.min;e.exports=function(e,t,r){var u,l,c,d,f,h,p=0,m=!1,g=!1,v=!0;if("function"!=typeof e)throw TypeError("Expected a function");function y(t){var r=u,n=l;return u=l=void 0,p=t,d=e.apply(n,r)}function b(e){var r=e-h,n=e-p;return void 0===h||r>=t||r<0||g&&n>=c}function _(){var e,r,n,o=i();if(b(o))return w(o);f=setTimeout(_,(e=o-h,r=o-p,n=t-e,g?a(n,c-r):n))}function w(e){return(f=void 0,v&&u)?y(e):(u=l=void 0,d)}function k(){var e,r=i(),n=b(r);if(u=arguments,l=this,h=r,n){if(void 0===f)return p=e=h,f=setTimeout(_,t),m?y(e):d;if(g)return clearTimeout(f),f=setTimeout(_,t),y(h)}return void 0===f&&(f=setTimeout(_,t)),d}return t=o(t)||0,n(r)&&(m=!!r.leading,c=(g="maxWait"in r)?s(o(r.maxWait)||0,t):c,v="trailing"in r?!!r.trailing:v),k.cancel=function(){void 0!==f&&clearTimeout(f),p=0,u=h=l=f=void 0},k.flush=function(){return void 0===f?d:w(i())},k}},28302:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},10303:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},78371:function(e,t,r){var n=r(54506),i=r(10303);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==n(e)}},11121:function(e,t,r){var n=r(74288);e.exports=function(){return n.Date.now()}},6660:function(e,t,r){var n=r(41087),i=r(28302),o=r(78371),s=0/0,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(o(e))return s;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=u.test(e);return r||l.test(e)?c(e.slice(2),r?2:8):a.test(e)?s:+e}},30401:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,r){"use strict";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"}]])},15452:function(e,t){var r,n,i;n=[],void 0!==(i="function"==typeof(r=function e(){var t,r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,o={},s=0,a={};function u(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new h(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:o,workerId:a.WORKER_ID,finished:n});else if(w(this._config.chunk)&&!t){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=o=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!n||!w(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(e){w(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:a.WORKER_ID,error:e,finished:!1})}}function l(e){var t;(e=e||{}).chunkSize||(e.chunkSize=a.RemoteChunkSize),u.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function c(e){(e=e||{}).chunkSize||(e.chunkSize=a.LocalChunkSize),u.call(this,e);var t,r,n="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function d(e){var t;u.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function f(e){u.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=_(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=_(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=_(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=_(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function h(e){var t,r,n,i,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,s=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,u=this,l=0,c=0,d=!1,f=!1,h=[],g={data:[],errors:[],meta:{}};function v(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function y(){if(g&&n&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(g.data=g.data.filter(function(e){return!v(e)})),_()){if(g){if(Array.isArray(g.data[0])){for(var t,r=0;_()&&r=h.length?"__parsed_extra":h[i]:a,l=u=e.transform?e.transform(u,a):u,(e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping))?"true"===l||"TRUE"===l||"false"!==l&&"FALSE"!==l&&((e=>{if(o.test(e)&&-9007199254740992<(e=parseFloat(e))&&e<9007199254740992)return 1})(l)?parseFloat(l):s.test(l)?new Date(l):""===l?null:l):l);"__parsed_extra"===a?(n[a]=n[a]||[],n[a].push(u)):n[a]=u}return e.header&&(i>h.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+h.length+" fields but parsed "+i,c+r):ie.preview?r.abort():(g.data=g.data[0],i(g,u))))}),this.parse=function(i,o,s){var u=e.quoteChar||'"',u=(e.newline||(e.newline=this.guessLineEndings(i,u)),n=!1,e.delimiter?w(e.delimiter)&&(e.delimiter=e.delimiter(i),g.meta.delimiter=e.delimiter):((u=((t,r,n,i,o)=>{var s,u,l,c;o=o||[","," ","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var d=0;d=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,o=e.preview,s=e.fastMode,u=null,l=!1,c=null==e.quoteChar?'"':e.quoteChar,d=c;if(void 0!==e.escapeChar&&(d=e.escapeChar),("string"!=typeof t||-1=o)return N(!0);break}x.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:E.length,index:f}),D++}}else if(n&&0===C.length&&a.substring(f,f+_)===n){if(-1===T)return N();f=T+b,T=a.indexOf(r,f),j=a.indexOf(t,f)}else if(-1!==j&&(j=o)return N(!0)}return A();function P(e){E.push(e),O=f}function M(e){return -1!==e&&(e=a.substring(D+1,e))&&""===e.trim()?e.length:0}function A(e){return g||(void 0===e&&(e=a.substring(f)),C.push(e),f=v,P(C),k&&F()),N()}function z(e){f=e,P(C),C=[],T=a.indexOf(r,f)}function N(n){if(e.header&&!m&&E.length&&!l){var i=E[0],o=Object.create(null),s=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||a.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(l=t.skipEmptyLines),"string"==typeof t.newline&&(o=t.newline),"string"==typeof t.quoteChar&&(s=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(u=t.escapeChar+s),t.escapeFormulae instanceof RegExp?d=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(d=/^[=+\-@\t\r].*$/)}})(),RegExp(p(s),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return h(null,e,l);if("object"==typeof e[0])return h(c||Object.keys(e[0]),e,l)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||c),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),h(e.fields||[],e.data||[],l);throw Error("Unable to serialize unrecognized input");function h(e,t,r){var s="",a=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,s),n=i.default.Children.only(t);return i.default.cloneElement(n,l(l({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r({...e,disclosureState:(0,v.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},C=(0,u.createContext)(null);function O(e){let t=(0,u.useContext)(C);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,O),t}return t}C.displayName="DisclosureContext";let S=(0,u.createContext)(null);S.displayName="DisclosureAPIContext";let R=(0,u.createContext)(null);function j(e,t){return(0,v.E)(t.type,x,e,t)}R.displayName="DisclosurePanelContext";let T=u.Fragment,I=b.VN.RenderStrategy|b.VN.Static,D=Object.assign((0,b.yV)(function(e,t){let{defaultOpen:r=!1,...n}=e,i=(0,u.useRef)(null),o=(0,f.T)(t,(0,f.h)(e=>{i.current=e},void 0===e.as||e.as===u.Fragment)),s=(0,u.useReducer)(j,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:a,buttonId:l},d]=s,h=(0,c.z)(e=>{d({type:1});let t=(0,y.r)(i);if(!t||!l)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(l):t.getElementById(l);null==r||r.focus()}),g=(0,u.useMemo)(()=>({close:h}),[h]),_=(0,u.useMemo)(()=>({open:0===a,close:h}),[a,h]),w=(0,b.L6)();return u.createElement(C.Provider,{value:s},u.createElement(S.Provider,{value:g},u.createElement(p.Z,{value:h},u.createElement(m.up,{value:(0,v.E)(a,{0:m.ZM.Open,1:m.ZM.Closed})},w({ourProps:{ref:o},theirProps:n,slot:_,defaultTag:T,name:"Disclosure"})))))}),{Button:(0,b.yV)(function(e,t){let r=(0,u.useId)(),{id:n="headlessui-disclosure-button-".concat(r),disabled:i=!1,autoFocus:o=!1,...h}=e,[p,m]=O("Disclosure.Button"),v=(0,u.useContext)(R),y=null!==v&&v===p.panelId,_=(0,u.useRef)(null),k=(0,f.T)(_,t,(0,c.z)(e=>{if(!y)return m({type:4,element:e})}));(0,u.useEffect)(()=>{if(!y)return m({type:2,buttonId:n}),()=>{m({type:2,buttonId:null})}},[n,m,y]);let E=(0,c.z)(e=>{var t;if(y){if(1===p.disclosureState)return;switch(e.key){case w.R.Space:case w.R.Enter:e.preventDefault(),e.stopPropagation(),m({type:0}),null==(t=p.buttonElement)||t.focus()}}else switch(e.key){case w.R.Space:case w.R.Enter:e.preventDefault(),e.stopPropagation(),m({type:0})}}),x=(0,c.z)(e=>{e.key===w.R.Space&&e.preventDefault()}),C=(0,c.z)(e=>{var t;(0,g.P)(e.currentTarget)||i||(y?(m({type:0}),null==(t=p.buttonElement)||t.focus()):m({type:0}))}),{isFocusVisible:S,focusProps:j}=(0,s.F)({autoFocus:o}),{isHovered:T,hoverProps:I}=(0,a.X)({isDisabled:i}),{pressed:D,pressProps:L}=(0,l.x)({disabled:i}),P=(0,u.useMemo)(()=>({open:0===p.disclosureState,hover:T,active:D,disabled:i,focus:S,autofocus:o}),[p,T,D,S,i,o]),M=(0,d.f)(e,p.buttonElement),A=y?(0,b.dG)({ref:k,type:M,disabled:i||void 0,autoFocus:o,onKeyDown:E,onClick:C},j,I,L):(0,b.dG)({ref:k,id:n,type:M,"aria-expanded":0===p.disclosureState,"aria-controls":p.panelElement?p.panelId:void 0,disabled:i||void 0,autoFocus:o,onKeyDown:E,onKeyUp:x,onClick:C},j,I,L);return(0,b.L6)()({ourProps:A,theirProps:h,slot:P,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,b.yV)(function(e,t){let r=(0,u.useId)(),{id:n="headlessui-disclosure-panel-".concat(r),transition:i=!1,...o}=e,[s,a]=O("Disclosure.Panel"),{close:l}=function e(t){let r=(0,u.useContext)(S);if(null===r){let r=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[d,p]=(0,u.useState)(null),g=(0,f.T)(t,(0,c.z)(e=>{_(()=>a({type:5,element:e}))}),p);(0,u.useEffect)(()=>(a({type:3,panelId:n}),()=>{a({type:3,panelId:null})}),[n,a]);let v=(0,m.oJ)(),[y,w]=(0,h.Y)(i,d,null!==v?(v&m.ZM.Open)===m.ZM.Open:0===s.disclosureState),k=(0,u.useMemo)(()=>({open:0===s.disclosureState,close:l}),[s.disclosureState,l]),E={ref:g,id:n,...(0,h.X)(w)},x=(0,b.L6)();return u.createElement(m.uu,null,u.createElement(R.Provider,{value:s.panelId},x({ourProps:E,theirProps:o,slot:k,defaultTag:"div",features:I,visible:y,name:"Disclosure.Panel"})))})})},33443:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(2265);let i=(0,n.createContext)(()=>{});function o(e){let{value:t,children:r}=e;return n.createElement(i.Provider,{value:t},r)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4242-1670159d75c167a5.js b/litellm/proxy/_experimental/out/_next/static/chunks/4242-1670159d75c167a5.js deleted file mode 100644 index 2ea5928e26..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/4242-1670159d75c167a5.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4242],{34310:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM472 744a40 40 0 1080 0 40 40 0 10-80 0zm16-104h48c4.4 0 8-3.6 8-8V448c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v184c0 4.4 3.6 8 8 8z"}}]},name:"file-exclamation",theme:"outlined"},s=r(55015),a=i.forwardRef(function(e,t){return i.createElement(s.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},38434:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-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-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},s=r(55015),a=i.forwardRef(function(e,t){return i.createElement(s.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},3632:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),o={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"},s=r(55015),a=i.forwardRef(function(e,t){return i.createElement(s.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},35291:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});var n=r(1119),i=r(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"}}]},name:"warning",theme:"outlined"},s=r(55015),a=i.forwardRef(function(e,t){return i.createElement(s.Z,(0,n.Z)({},e,{ref:t,icon:o}))})},41649:function(e,t,r){"use strict";r.d(t,{Z:function(){return h}});var n=r(5853),i=r(2265),o=r(47187),s=r(7084),a=r(26898),l=r(13241),u=r(1153);let c={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},d={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},f=(0,u.fn)("Badge"),h=i.forwardRef((e,t)=>{let{color:r,icon:h,size:p=s.u8.SM,tooltip:m,className:g,children:y}=e,v=(0,n._T)(e,["color","icon","size","tooltip","className","children"]),b=h||null,{tooltipProps:_,getReferenceProps:k}=(0,o.l)();return i.createElement("span",Object.assign({ref:(0,u.lq)([t,_.refs.setReference]),className:(0,l.q)(f("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",r?(0,l.q)((0,u.bM)(r,a.K.background).bgColor,(0,u.bM)(r,a.K.iconText).textColor,(0,u.bM)(r,a.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,l.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),c[p].paddingX,c[p].paddingY,c[p].fontSize,g)},k,v),i.createElement(o.Z,Object.assign({text:m},_)),b?i.createElement(b,{className:(0,l.q)(f("icon"),"shrink-0 -ml-1 mr-1.5",d[p].height,d[p].width)}):null,i.createElement("span",{className:(0,l.q)(f("text"),"whitespace-nowrap")},y))});h.displayName="Badge"},30150:function(e,t,r){"use strict";r.d(t,{Z:function(){return f}});var n=r(5853),i=r(2265);let o=e=>{var t=(0,n._T)(e,[]);return i.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),i.createElement("path",{d:"M12 4v16m8-8H4"}))},s=e=>{var t=(0,n._T)(e,[]);return i.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),i.createElement("path",{d:"M20 12H4"}))};var a=r(13241),l=r(1153),u=r(69262);let c="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",d="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",f=i.forwardRef((e,t)=>{let{onSubmit:r,enableStepper:f=!0,disabled:h,onValueChange:p,onChange:m}=e,g=(0,n._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),y=(0,i.useRef)(null),[v,b]=i.useState(!1),_=i.useCallback(()=>{b(!0)},[]),k=i.useCallback(()=>{b(!1)},[]),[w,E]=i.useState(!1),x=i.useCallback(()=>{E(!0)},[]),C=i.useCallback(()=>{E(!1)},[]);return i.createElement(u.Z,Object.assign({type:"number",ref:(0,l.lq)([y,t]),disabled:h,makeInputClassName:(0,l.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=y.current)||void 0===t?void 0:t.value;null==r||r(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&_(),"ArrowUp"===e.key&&x()},onKeyUp:e=>{"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&C()},onChange:e=>{h||(null==p||p(parseFloat(e.target.value)),null==m||m(e))},stepper:f?i.createElement("div",{className:(0,a.q)("flex justify-center align-middle")},i.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;h||(null===(e=y.current)||void 0===e||e.stepDown(),null===(t=y.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,a.q)(!h&&d,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},i.createElement(s,{"data-testid":"step-down",className:(v?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),i.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;h||(null===(e=y.current)||void 0===e||e.stepUp(),null===(t=y.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,a.q)(!h&&d,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},i.createElement(o,{"data-testid":"step-up",className:(w?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},g))});f.displayName="NumberInput"},87452:function(e,t,r){"use strict";r.d(t,{Z:function(){return d},r:function(){return c}});var n=r(5853),i=r(91054);r(42698),r(64016);var o=r(8710);r(33232);var s=r(13241),a=r(1153),l=r(2265);let u=(0,a.fn)("Accordion"),c=(0,l.createContext)({isOpen:!1}),d=l.forwardRef((e,t)=>{var r;let{defaultOpen:a=!1,children:d,className:f}=e,h=(0,n._T)(e,["defaultOpen","children","className"]),p=null!==(r=(0,l.useContext)(o.Z))&&void 0!==r?r:(0,s.q)("rounded-tremor-default border");return l.createElement(i.pJ,Object.assign({as:"div",ref:t,className:(0,s.q)(u("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",p,f),defaultOpen:a},h),e=>{let{open:t}=e;return l.createElement(c.Provider,{value:{isOpen:t}},d)})});d.displayName="Accordion"},88829:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(5853),i=r(2265),o=r(91054),s=r(13241);let a=(0,r(1153).fn)("AccordionBody"),l=i.forwardRef((e,t)=>{let{children:r,className:l}=e,u=(0,n._T)(e,["children","className"]);return i.createElement(o.pJ.Panel,Object.assign({ref:t,className:(0,s.q)(a("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",l)},u),r)});l.displayName="AccordionBody"},72208:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(5853),i=r(2265),o=r(91054);let s=e=>{var t=(0,n._T)(e,[]);return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),i.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var a=r(87452),l=r(13241);let u=(0,r(1153).fn)("AccordionHeader"),c=i.forwardRef((e,t)=>{let{children:r,className:c}=e,d=(0,n._T)(e,["children","className"]),{isOpen:f}=(0,i.useContext)(a.r);return i.createElement(o.pJ.Button,Object.assign({ref:t,className:(0,l.q)(u("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",c)},d),i.createElement("div",{className:(0,l.q)(u("children"),"flex flex-1 text-inherit mr-4")},r),i.createElement("div",null,i.createElement(s,{className:(0,l.q)(u("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",f?"transition-all":"transition-all -rotate-180")})))});c.displayName="AccordionHeader"},30401:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,r){"use strict";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"}]])},15452:function(e,t){var r,n,i;n=[],void 0!==(i="function"==typeof(r=function e(){var t,r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:{},n=!r.document&&!!r.postMessage,i=r.IS_PAPA_WORKER||!1,o={},s=0,a={};function l(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new h(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var n=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview,i)r.postMessage({results:o,workerId:a.WORKER_ID,finished:n});else if(k(this._config.chunk)&&!t){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=o=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!n||!k(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),n||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(e){k(this._config.error)?this._config.error(e):i&&this._config.error&&r.postMessage({workerId:a.WORKER_ID,error:e,finished:!1})}}function u(e){var t;(e=e||{}).chunkSize||(e.chunkSize=a.RemoteChunkSize),l.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e,r,i=this._config.downloadRequestHeaders;for(r in i)t.setRequestHeader(r,i[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function c(e){(e=e||{}).chunkSize||(e.chunkSize=a.LocalChunkSize),l.call(this,e);var t,r,n="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,n?((t=new FileReader).onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function d(e){var t;l.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function f(e){l.call(this,e=e||{});var t=[],r=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=_(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=_(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=_(function(){this._streamCleanUp(),n=!0,this._streamData("")},this),this._streamCleanUp=_(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function h(e){var t,r,n,i,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,s=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,u=0,c=0,d=!1,f=!1,h=[],g={data:[],errors:[],meta:{}};function y(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function v(){if(g&&n&&(w("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+a.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines&&(g.data=g.data.filter(function(e){return!y(e)})),_()){if(g){if(Array.isArray(g.data[0])){for(var t,r=0;_()&&r=h.length?"__parsed_extra":h[i]:a,u=l=e.transform?e.transform(l,a):l,(e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping))?"true"===u||"TRUE"===u||"false"!==u&&"FALSE"!==u&&((e=>{if(o.test(e)&&-9007199254740992<(e=parseFloat(e))&&e<9007199254740992)return 1})(u)?parseFloat(u):s.test(u)?new Date(u):""===u?null:u):u);"__parsed_extra"===a?(n[a]=n[a]||[],n[a].push(l)):n[a]=l}return e.header&&(i>h.length?w("FieldMismatch","TooManyFields","Too many fields: expected "+h.length+" fields but parsed "+i,c+r):ie.preview?r.abort():(g.data=g.data[0],i(g,l))))}),this.parse=function(i,o,s){var l=e.quoteChar||'"',l=(e.newline||(e.newline=this.guessLineEndings(i,l)),n=!1,e.delimiter?k(e.delimiter)&&(e.delimiter=e.delimiter(i),g.meta.delimiter=e.delimiter):((l=((t,r,n,i,o)=>{var s,l,u,c;o=o||[","," ","|",";",a.RECORD_SEP,a.UNIT_SEP];for(var d=0;d=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){var t=(e=e||{}).delimiter,r=e.newline,n=e.comments,i=e.step,o=e.preview,s=e.fastMode,l=null,u=!1,c=null==e.quoteChar?'"':e.quoteChar,d=c;if(void 0!==e.escapeChar&&(d=e.escapeChar),("string"!=typeof t||-1=o)return N(!0);break}x.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:E.length,index:f}),T++}}else if(n&&0===C.length&&a.substring(f,f+_)===n){if(-1===D)return N();f=D+b,D=a.indexOf(r,f),I=a.indexOf(t,f)}else if(-1!==I&&(I=o)return N(!0)}return z();function P(e){E.push(e),O=f}function M(e){return -1!==e&&(e=a.substring(T+1,e))&&""===e.trim()?e.length:0}function z(e){return g||(void 0===e&&(e=a.substring(f)),C.push(e),f=y,P(C),w&&F()),N()}function A(e){f=e,P(C),C=[],D=a.indexOf(r,f)}function N(n){if(e.header&&!m&&E.length&&!u){var i=E[0],o=Object.create(null),s=new Set(i);let t=!1;for(let r=0;r{if("object"==typeof t){if("string"!=typeof t.delimiter||a.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(u=t.skipEmptyLines),"string"==typeof t.newline&&(o=t.newline),"string"==typeof t.quoteChar&&(s=t.quoteChar),"boolean"==typeof t.header&&(n=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+s),t.escapeFormulae instanceof RegExp?d=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(d=/^[=+\-@\t\r].*$/)}})(),RegExp(p(s),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return h(null,e,u);if("object"==typeof e[0])return h(c||Object.keys(e[0]),e,u)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||c),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),h(e.fields||[],e.data||[],u);throw Error("Unable to serialize unrecognized input");function h(e,t,r){var s="",a=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0{for(var r=0;r=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,s),n=i.default.Children.only(t);return i.default.cloneElement(n,u(u({},r),{},{onClick:this.onClick}))}}],function(e,t){for(var r=0;r({...e,disclosureState:(0,y.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,t)=>e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId},3:(e,t)=>e.panelId===t.panelId?e:{...e,panelId:t.panelId},4:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},5:(e,t)=>e.panelElement===t.element?e:{...e,panelElement:t.element}},C=(0,l.createContext)(null);function O(e){let t=(0,l.useContext)(C);if(null===t){let t=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,O),t}return t}C.displayName="DisclosureContext";let S=(0,l.createContext)(null);S.displayName="DisclosureAPIContext";let R=(0,l.createContext)(null);function I(e,t){return(0,y.E)(t.type,x,e,t)}R.displayName="DisclosurePanelContext";let D=l.Fragment,j=b.VN.RenderStrategy|b.VN.Static,T=Object.assign((0,b.yV)(function(e,t){let{defaultOpen:r=!1,...n}=e,i=(0,l.useRef)(null),o=(0,f.T)(t,(0,f.h)(e=>{i.current=e},void 0===e.as||e.as===l.Fragment)),s=(0,l.useReducer)(I,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:a,buttonId:u},d]=s,h=(0,c.z)(e=>{d({type:1});let t=(0,v.r)(i);if(!t||!u)return;let r=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:t.getElementById(u):t.getElementById(u);null==r||r.focus()}),g=(0,l.useMemo)(()=>({close:h}),[h]),_=(0,l.useMemo)(()=>({open:0===a,close:h}),[a,h]),k=(0,b.L6)();return l.createElement(C.Provider,{value:s},l.createElement(S.Provider,{value:g},l.createElement(p.Z,{value:h},l.createElement(m.up,{value:(0,y.E)(a,{0:m.ZM.Open,1:m.ZM.Closed})},k({ourProps:{ref:o},theirProps:n,slot:_,defaultTag:D,name:"Disclosure"})))))}),{Button:(0,b.yV)(function(e,t){let r=(0,l.useId)(),{id:n="headlessui-disclosure-button-".concat(r),disabled:i=!1,autoFocus:o=!1,...h}=e,[p,m]=O("Disclosure.Button"),y=(0,l.useContext)(R),v=null!==y&&y===p.panelId,_=(0,l.useRef)(null),w=(0,f.T)(_,t,(0,c.z)(e=>{if(!v)return m({type:4,element:e})}));(0,l.useEffect)(()=>{if(!v)return m({type:2,buttonId:n}),()=>{m({type:2,buttonId:null})}},[n,m,v]);let E=(0,c.z)(e=>{var t;if(v){if(1===p.disclosureState)return;switch(e.key){case k.R.Space:case k.R.Enter:e.preventDefault(),e.stopPropagation(),m({type:0}),null==(t=p.buttonElement)||t.focus()}}else switch(e.key){case k.R.Space:case k.R.Enter:e.preventDefault(),e.stopPropagation(),m({type:0})}}),x=(0,c.z)(e=>{e.key===k.R.Space&&e.preventDefault()}),C=(0,c.z)(e=>{var t;(0,g.P)(e.currentTarget)||i||(v?(m({type:0}),null==(t=p.buttonElement)||t.focus()):m({type:0}))}),{isFocusVisible:S,focusProps:I}=(0,s.F)({autoFocus:o}),{isHovered:D,hoverProps:j}=(0,a.X)({isDisabled:i}),{pressed:T,pressProps:L}=(0,u.x)({disabled:i}),P=(0,l.useMemo)(()=>({open:0===p.disclosureState,hover:D,active:T,disabled:i,focus:S,autofocus:o}),[p,D,T,S,i,o]),M=(0,d.f)(e,p.buttonElement),z=v?(0,b.dG)({ref:w,type:M,disabled:i||void 0,autoFocus:o,onKeyDown:E,onClick:C},I,j,L):(0,b.dG)({ref:w,id:n,type:M,"aria-expanded":0===p.disclosureState,"aria-controls":p.panelElement?p.panelId:void 0,disabled:i||void 0,autoFocus:o,onKeyDown:E,onKeyUp:x,onClick:C},I,j,L);return(0,b.L6)()({ourProps:z,theirProps:h,slot:P,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,b.yV)(function(e,t){let r=(0,l.useId)(),{id:n="headlessui-disclosure-panel-".concat(r),transition:i=!1,...o}=e,[s,a]=O("Disclosure.Panel"),{close:u}=function e(t){let r=(0,l.useContext)(S);if(null===r){let r=Error("<".concat(t," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return r}("Disclosure.Panel"),[d,p]=(0,l.useState)(null),g=(0,f.T)(t,(0,c.z)(e=>{_(()=>a({type:5,element:e}))}),p);(0,l.useEffect)(()=>(a({type:3,panelId:n}),()=>{a({type:3,panelId:null})}),[n,a]);let y=(0,m.oJ)(),[v,k]=(0,h.Y)(i,d,null!==y?(y&m.ZM.Open)===m.ZM.Open:0===s.disclosureState),w=(0,l.useMemo)(()=>({open:0===s.disclosureState,close:u}),[s.disclosureState,u]),E={ref:g,id:n,...(0,h.X)(k)},x=(0,b.L6)();return l.createElement(m.uu,null,l.createElement(R.Provider,{value:s.panelId},x({ourProps:E,theirProps:o,slot:w,defaultTag:"div",features:j,visible:v,name:"Disclosure.Panel"})))})})},33443:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(2265);let i=(0,n.createContext)(()=>{});function o(e){let{value:t,children:r}=e;return n.createElement(i.Provider,{value:t},r)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4306-f891b96cf0ee333b.js b/litellm/proxy/_experimental/out/_next/static/chunks/4306-f891b96cf0ee333b.js new file mode 100644 index 0000000000..d0aef1a1db --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4306-f891b96cf0ee333b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4306,5945],{33866:function(t,e,n){n.d(e,{Z:function(){return B}});var o=n(2265),a=n(36760),r=n.n(a),c=n(66632),i=n(93350),l=n(19722),s=n(71744),d=n(93463),u=n(12918),b=n(18536),m=n(71140),g=n(99320);let p=new d.E4("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),f=new d.E4("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),h=new d.E4("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),v=new d.E4("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),y=new d.E4("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),O=new d.E4("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),S=t=>{let{componentCls:e,iconCls:n,antCls:o,badgeShadowSize:a,textFontSize:r,textFontSizeSM:c,statusSize:i,dotSize:l,textFontWeight:s,indicatorHeight:m,indicatorHeightSM:g,marginXS:S,calc:x}=t,w="".concat(o,"-scroll-number"),j=(0,b.Z)(t,(t,n)=>{let{darkColor:o}=n;return{["&".concat(e," ").concat(e,"-color-").concat(t)]:{background:o,["&:not(".concat(e,"-count)")]:{color:o},"a:hover &":{background:o}}}});return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,u.Wf)(t)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,["".concat(e,"-count")]:{display:"inline-flex",justifyContent:"center",zIndex:t.indicatorZIndex,minWidth:m,height:m,color:t.badgeTextColor,fontWeight:s,fontSize:r,lineHeight:(0,d.bf)(m),whiteSpace:"nowrap",textAlign:"center",background:t.badgeColor,borderRadius:x(m).div(2).equal(),boxShadow:"0 0 0 ".concat((0,d.bf)(a)," ").concat(t.badgeShadowColor),transition:"background ".concat(t.motionDurationMid),a:{color:t.badgeTextColor},"a:hover":{color:t.badgeTextColor},"a:hover &":{background:t.badgeColorHover}},["".concat(e,"-count-sm")]:{minWidth:g,height:g,fontSize:c,lineHeight:(0,d.bf)(g),borderRadius:x(g).div(2).equal()},["".concat(e,"-multiple-words")]:{padding:"0 ".concat((0,d.bf)(t.paddingXS)),bdi:{unicodeBidi:"plaintext"}},["".concat(e,"-dot")]:{zIndex:t.indicatorZIndex,width:l,minWidth:l,height:l,background:t.badgeColor,borderRadius:"100%",boxShadow:"0 0 0 ".concat((0,d.bf)(a)," ").concat(t.badgeShadowColor)},["".concat(e,"-count, ").concat(e,"-dot, ").concat(w,"-custom-component")]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",["&".concat(n,"-spin")]:{animationName:O,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},["&".concat(e,"-status")]:{lineHeight:"inherit",verticalAlign:"baseline",["".concat(e,"-status-dot")]:{position:"relative",top:-1,display:"inline-block",width:i,height:i,verticalAlign:"middle",borderRadius:"50%"},["".concat(e,"-status-success")]:{backgroundColor:t.colorSuccess},["".concat(e,"-status-processing")]:{overflow:"visible",color:t.colorInfo,backgroundColor:t.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:a,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:p,animationDuration:t.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},["".concat(e,"-status-default")]:{backgroundColor:t.colorTextPlaceholder},["".concat(e,"-status-error")]:{backgroundColor:t.colorError},["".concat(e,"-status-warning")]:{backgroundColor:t.colorWarning},["".concat(e,"-status-text")]:{marginInlineStart:S,color:t.colorText,fontSize:t.fontSize}}}),j),{["".concat(e,"-zoom-appear, ").concat(e,"-zoom-enter")]:{animationName:f,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},["".concat(e,"-zoom-leave")]:{animationName:h,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},["&".concat(e,"-not-a-wrapper")]:{["".concat(e,"-zoom-appear, ").concat(e,"-zoom-enter")]:{animationName:v,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},["".concat(e,"-zoom-leave")]:{animationName:y,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},["&:not(".concat(e,"-status)")]:{verticalAlign:"middle"},["".concat(w,"-custom-component, ").concat(e,"-count")]:{transform:"none"},["".concat(w,"-custom-component, ").concat(w)]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[w]:{overflow:"hidden",transition:"all ".concat(t.motionDurationMid," ").concat(t.motionEaseOutBack),["".concat(w,"-only")]:{position:"relative",display:"inline-block",height:m,transition:"all ".concat(t.motionDurationSlow," ").concat(t.motionEaseOutBack),WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",["> p".concat(w,"-only-unit")]:{height:m,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},["".concat(w,"-symbol")]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",["".concat(e,"-count, ").concat(e,"-dot, ").concat(w,"-custom-component")]:{transform:"translate(-50%, -50%)"}}})}},x=t=>{let{fontHeight:e,lineWidth:n,marginXS:o,colorBorderBg:a}=t,r=t.colorTextLightSolid,c=t.colorError,i=t.colorErrorHover;return(0,m.IX)(t,{badgeFontHeight:e,badgeShadowSize:n,badgeTextColor:r,badgeColor:c,badgeColorHover:i,badgeShadowColor:a,badgeProcessingDuration:"1.2s",badgeRibbonOffset:o,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},w=t=>{let{fontSize:e,lineHeight:n,fontSizeSM:o,lineWidth:a}=t;return{indicatorZIndex:"auto",indicatorHeight:Math.round(e*n)-2*a,indicatorHeightSM:e,dotSize:o/2,textFontSize:o,textFontSizeSM:o,textFontWeight:"normal",statusSize:o/2}};var j=(0,g.I$)("Badge",t=>S(x(t)),w);let E=t=>{let{antCls:e,badgeFontHeight:n,marginXS:o,badgeRibbonOffset:a,calc:r}=t,c="".concat(e,"-ribbon"),i=(0,b.Z)(t,(t,e)=>{let{darkColor:n}=e;return{["&".concat(c,"-color-").concat(t)]:{background:n,color:n}}});return{["".concat(e,"-ribbon-wrapper")]:{position:"relative"},[c]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,u.Wf)(t)),{position:"absolute",top:o,padding:"0 ".concat((0,d.bf)(t.paddingXS)),color:t.colorPrimary,lineHeight:(0,d.bf)(n),whiteSpace:"nowrap",backgroundColor:t.colorPrimary,borderRadius:t.borderRadiusSM,["".concat(c,"-text")]:{color:t.badgeTextColor},["".concat(c,"-corner")]:{position:"absolute",top:"100%",width:a,height:a,color:"currentcolor",border:"".concat((0,d.bf)(r(a).div(2).equal())," solid"),transform:t.badgeRibbonCornerTransform,transformOrigin:"top",filter:t.badgeRibbonCornerFilter}}),i),{["&".concat(c,"-placement-end")]:{insetInlineEnd:r(a).mul(-1).equal(),borderEndEndRadius:0,["".concat(c,"-corner")]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},["&".concat(c,"-placement-start")]:{insetInlineStart:r(a).mul(-1).equal(),borderEndStartRadius:0,["".concat(c,"-corner")]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}};var C=(0,g.I$)(["Badge","Ribbon"],t=>E(x(t)),w);let N=t=>{let e;let{prefixCls:n,value:a,current:c,offset:i=0}=t;return i&&(e={position:"absolute",top:"".concat(i,"00%"),left:0}),o.createElement("span",{style:e,className:r()("".concat(n,"-only-unit"),{current:c})},a)};var k=t=>{let e,n;let{prefixCls:a,count:r,value:c}=t,i=Number(c),l=Math.abs(r),[s,d]=o.useState(i),[u,b]=o.useState(l),m=()=>{d(i),b(l)};if(o.useEffect(()=>{let t=setTimeout(m,1e3);return()=>clearTimeout(t)},[i]),s===i||Number.isNaN(i)||Number.isNaN(s))e=[o.createElement(N,Object.assign({},t,{key:i,current:!0}))],n={transition:"none"};else{e=[];let a=i+10,r=[];for(let t=i;t<=a;t+=1)r.push(t);let c=ut%10===s);e=(c<0?r.slice(0,d+1):r.slice(d)).map((e,n)=>o.createElement(N,Object.assign({},t,{key:e,value:e%10,offset:c<0?n-d:n,current:n===d}))),n={transform:"translateY(".concat(-function(t,e,n){let o=t,a=0;for(;(o+10)%10!==e;)o+=n,a+=n;return a}(s,i,c),"00%)")}}return o.createElement("span",{className:"".concat(a,"-only"),style:n,onTransitionEnd:m},e)},z=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(t);ae.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(t,o[a])&&(n[o[a]]=t[o[a]]);return n};let I=o.forwardRef((t,e)=>{let{prefixCls:n,count:a,className:c,motionClassName:i,style:d,title:u,show:b,component:m="sup",children:g}=t,p=z(t,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:f}=o.useContext(s.E_),h=f("scroll-number",n),v=Object.assign(Object.assign({},p),{"data-show":b,style:d,className:r()(h,c,i),title:u}),y=a;if(a&&Number(a)%1==0){let t=String(a).split("");y=o.createElement("bdi",null,t.map((e,n)=>o.createElement(k,{prefixCls:h,count:Number(a),value:e,key:t.length-n})))}return((null==d?void 0:d.borderColor)&&(v.style=Object.assign(Object.assign({},d),{boxShadow:"0 0 0 1px ".concat(d.borderColor," inset")})),g)?(0,l.Tm)(g,t=>({className:r()("".concat(h,"-custom-component"),null==t?void 0:t.className,i)})):o.createElement(m,Object.assign({},v,{ref:e}),y)});var T=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(t);ae.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(t,o[a])&&(n[o[a]]=t[o[a]]);return n};let R=o.forwardRef((t,e)=>{var n,a,d,u,b;let{prefixCls:m,scrollNumberPrefixCls:g,children:p,status:f,text:h,color:v,count:y=null,overflowCount:O=99,dot:S=!1,size:x="default",title:w,offset:E,style:C,className:N,rootClassName:k,classNames:z,styles:R,showZero:B=!1}=t,P=T(t,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:W,direction:H,badge:M}=o.useContext(s.E_),L=W("badge",m),[D,F,G]=j(L),Z=y>O?"".concat(O,"+"):y,A="0"===Z||0===Z||"0"===h||0===h,q=null===y||A&&!B,_=(null!=f||null!=v)&&q,X=null!=f||!A,K=S&&!A,$=K?"":Z,V=(0,o.useMemo)(()=>((null==$||""===$)&&(null==h||""===h)||A&&!B)&&!K,[$,A,B,K,h]),Y=(0,o.useRef)(y);V||(Y.current=y);let J=Y.current,Q=(0,o.useRef)($);V||(Q.current=$);let U=Q.current,tt=(0,o.useRef)(K);V||(tt.current=K);let te=(0,o.useMemo)(()=>{if(!E)return Object.assign(Object.assign({},null==M?void 0:M.style),C);let t={marginTop:E[1]};return"rtl"===H?t.left=Number.parseInt(E[0],10):t.right=-Number.parseInt(E[0],10),Object.assign(Object.assign(Object.assign({},t),null==M?void 0:M.style),C)},[H,E,C,null==M?void 0:M.style]),tn=null!=w?w:"string"==typeof J||"number"==typeof J?J:void 0,to=!V&&(0===h?B:!!h&&!0!==h),ta=to?o.createElement("span",{className:"".concat(L,"-status-text")},h):null,tr=J&&"object"==typeof J?(0,l.Tm)(J,t=>({style:Object.assign(Object.assign({},te),t.style)})):void 0,tc=(0,i.o2)(v,!1),ti=r()(null==z?void 0:z.indicator,null===(n=null==M?void 0:M.classNames)||void 0===n?void 0:n.indicator,{["".concat(L,"-status-dot")]:_,["".concat(L,"-status-").concat(f)]:!!f,["".concat(L,"-color-").concat(v)]:tc}),tl={};v&&!tc&&(tl.color=v,tl.background=v);let ts=r()(L,{["".concat(L,"-status")]:_,["".concat(L,"-not-a-wrapper")]:!p,["".concat(L,"-rtl")]:"rtl"===H},N,k,null==M?void 0:M.className,null===(a=null==M?void 0:M.classNames)||void 0===a?void 0:a.root,null==z?void 0:z.root,F,G);if(!p&&_&&(h||X||!q)){let t=te.color;return D(o.createElement("span",Object.assign({},P,{className:ts,style:Object.assign(Object.assign(Object.assign({},null==R?void 0:R.root),null===(d=null==M?void 0:M.styles)||void 0===d?void 0:d.root),te)}),o.createElement("span",{className:ti,style:Object.assign(Object.assign(Object.assign({},null==R?void 0:R.indicator),null===(u=null==M?void 0:M.styles)||void 0===u?void 0:u.indicator),tl)}),to&&o.createElement("span",{style:{color:t},className:"".concat(L,"-status-text")},h)))}return D(o.createElement("span",Object.assign({ref:e},P,{className:ts,style:Object.assign(Object.assign({},null===(b=null==M?void 0:M.styles)||void 0===b?void 0:b.root),null==R?void 0:R.root)}),p,o.createElement(c.ZP,{visible:!V,motionName:"".concat(L,"-zoom"),motionAppear:!1,motionDeadline:1e3},t=>{var e,n;let{className:a}=t,c=W("scroll-number",g),i=tt.current,l=r()(null==z?void 0:z.indicator,null===(e=null==M?void 0:M.classNames)||void 0===e?void 0:e.indicator,{["".concat(L,"-dot")]:i,["".concat(L,"-count")]:!i,["".concat(L,"-count-sm")]:"small"===x,["".concat(L,"-multiple-words")]:!i&&U&&U.toString().length>1,["".concat(L,"-status-").concat(f)]:!!f,["".concat(L,"-color-").concat(v)]:tc}),s=Object.assign(Object.assign(Object.assign({},null==R?void 0:R.indicator),null===(n=null==M?void 0:M.styles)||void 0===n?void 0:n.indicator),te);return v&&!tc&&((s=s||{}).background=v),o.createElement(I,{prefixCls:c,show:!V,motionClassName:a,className:l,count:U,title:tn,style:s,key:"scrollNumber"},tr)}),ta))});R.Ribbon=t=>{let{className:e,prefixCls:n,style:a,color:c,children:l,text:d,placement:u="end",rootClassName:b}=t,{getPrefixCls:m,direction:g}=o.useContext(s.E_),p=m("ribbon",n),f="".concat(p,"-wrapper"),[h,v,y]=C(p,f),O=(0,i.o2)(c,!1),S=r()(p,"".concat(p,"-placement-").concat(u),{["".concat(p,"-rtl")]:"rtl"===g,["".concat(p,"-color-").concat(c)]:O},e),x={},w={};return c&&!O&&(x.background=c,w.color=c),h(o.createElement("div",{className:r()(f,b,v,y)},l,o.createElement("div",{className:r()(S,v),style:Object.assign(Object.assign({},x),a)},o.createElement("span",{className:"".concat(p,"-text")},d),o.createElement("div",{className:"".concat(p,"-corner"),style:w}))))};var B=R},5945:function(t,e,n){n.d(e,{Z:function(){return T}});var o=n(2265),a=n(36760),r=n.n(a),c=n(18694),i=n(71744),l=n(33759),s=n(50337),d=n(65869),u=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(t);ae.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(t,o[a])&&(n[o[a]]=t[o[a]]);return n},b=t=>{var{prefixCls:e,className:n,hoverable:a=!0}=t,c=u(t,["prefixCls","className","hoverable"]);let{getPrefixCls:l}=o.useContext(i.E_),s=l("card",e),d=r()("".concat(s,"-grid"),n,{["".concat(s,"-grid-hoverable")]:a});return o.createElement("div",Object.assign({},c,{className:d}))},m=n(93463),g=n(12918),p=n(99320),f=n(71140);let h=t=>{let{antCls:e,componentCls:n,headerHeight:o,headerPadding:a,tabsMarginBottom:r}=t;return Object.assign(Object.assign({display:"flex",justifyContent:"center",flexDirection:"column",minHeight:o,marginBottom:-1,padding:"0 ".concat((0,m.bf)(a)),color:t.colorTextHeading,fontWeight:t.fontWeightStrong,fontSize:t.headerFontSize,background:t.headerBg,borderBottom:"".concat((0,m.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(t.colorBorderSecondary),borderRadius:"".concat((0,m.bf)(t.borderRadiusLG)," ").concat((0,m.bf)(t.borderRadiusLG)," 0 0")},(0,g.dF)()),{"&-wrapper":{width:"100%",display:"flex",alignItems:"center"},"&-title":Object.assign(Object.assign({display:"inline-block",flex:1},g.vS),{["\n > ".concat(n,"-typography,\n > ").concat(n,"-typography-edit-content\n ")]:{insetInlineStart:0,marginTop:0,marginBottom:0}}),["".concat(e,"-tabs-top")]:{clear:"both",marginBottom:r,color:t.colorText,fontWeight:"normal",fontSize:t.fontSize,"&-bar":{borderBottom:"".concat((0,m.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(t.colorBorderSecondary)}}})},v=t=>{let{cardPaddingBase:e,colorBorderSecondary:n,cardShadow:o,lineWidth:a}=t;return{width:"33.33%",padding:e,border:0,borderRadius:0,boxShadow:"\n ".concat((0,m.bf)(a)," 0 0 0 ").concat(n,",\n 0 ").concat((0,m.bf)(a)," 0 0 ").concat(n,",\n ").concat((0,m.bf)(a)," ").concat((0,m.bf)(a)," 0 0 ").concat(n,",\n ").concat((0,m.bf)(a)," 0 0 0 ").concat(n," inset,\n 0 ").concat((0,m.bf)(a)," 0 0 ").concat(n," inset;\n "),transition:"all ".concat(t.motionDurationMid),"&-hoverable:hover":{position:"relative",zIndex:1,boxShadow:o}}},y=t=>{let{componentCls:e,iconCls:n,actionsLiMargin:o,cardActionsIconSize:a,colorBorderSecondary:r,actionsBg:c}=t;return Object.assign(Object.assign({margin:0,padding:0,listStyle:"none",background:c,borderTop:"".concat((0,m.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(r),display:"flex",borderRadius:"0 0 ".concat((0,m.bf)(t.borderRadiusLG)," ").concat((0,m.bf)(t.borderRadiusLG))},(0,g.dF)()),{"& > li":{margin:o,color:t.colorTextDescription,textAlign:"center","> span":{position:"relative",display:"block",minWidth:t.calc(t.cardActionsIconSize).mul(2).equal(),fontSize:t.fontSize,lineHeight:t.lineHeight,cursor:"pointer","&:hover":{color:t.colorPrimary,transition:"color ".concat(t.motionDurationMid)},["a:not(".concat(e,"-btn), > ").concat(n)]:{display:"inline-block",width:"100%",color:t.colorIcon,lineHeight:(0,m.bf)(t.fontHeight),transition:"color ".concat(t.motionDurationMid),"&:hover":{color:t.colorPrimary}},["> ".concat(n)]:{fontSize:a,lineHeight:(0,m.bf)(t.calc(a).mul(t.lineHeight).equal())}},"&:not(:last-child)":{borderInlineEnd:"".concat((0,m.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(r)}}})},O=t=>Object.assign(Object.assign({margin:"".concat((0,m.bf)(t.calc(t.marginXXS).mul(-1).equal())," 0"),display:"flex"},(0,g.dF)()),{"&-avatar":{paddingInlineEnd:t.padding},"&-detail":{overflow:"hidden",flex:1,"> div:not(:last-child)":{marginBottom:t.marginXS}},"&-title":Object.assign({color:t.colorTextHeading,fontWeight:t.fontWeightStrong,fontSize:t.fontSizeLG},g.vS),"&-description":{color:t.colorTextDescription}}),S=t=>{let{componentCls:e,colorFillAlter:n,headerPadding:o,bodyPadding:a}=t;return{["".concat(e,"-head")]:{padding:"0 ".concat((0,m.bf)(o)),background:n,"&-title":{fontSize:t.fontSize}},["".concat(e,"-body")]:{padding:"".concat((0,m.bf)(t.padding)," ").concat((0,m.bf)(a))}}},x=t=>{let{componentCls:e}=t;return{overflow:"hidden",["".concat(e,"-body")]:{userSelect:"none"}}},w=t=>{let{componentCls:e,cardShadow:n,cardHeadPadding:o,colorBorderSecondary:a,boxShadowTertiary:r,bodyPadding:c,extraColor:i}=t;return{[e]:Object.assign(Object.assign({},(0,g.Wf)(t)),{position:"relative",background:t.colorBgContainer,borderRadius:t.borderRadiusLG,["&:not(".concat(e,"-bordered)")]:{boxShadow:r},["".concat(e,"-head")]:h(t),["".concat(e,"-extra")]:{marginInlineStart:"auto",color:i,fontWeight:"normal",fontSize:t.fontSize},["".concat(e,"-body")]:{padding:c,borderRadius:"0 0 ".concat((0,m.bf)(t.borderRadiusLG)," ").concat((0,m.bf)(t.borderRadiusLG))},["".concat(e,"-grid")]:v(t),["".concat(e,"-cover")]:{"> *":{display:"block",width:"100%",borderRadius:"".concat((0,m.bf)(t.borderRadiusLG)," ").concat((0,m.bf)(t.borderRadiusLG)," 0 0")}},["".concat(e,"-actions")]:y(t),["".concat(e,"-meta")]:O(t)}),["".concat(e,"-bordered")]:{border:"".concat((0,m.bf)(t.lineWidth)," ").concat(t.lineType," ").concat(a),["".concat(e,"-cover")]:{marginTop:-1,marginInlineStart:-1,marginInlineEnd:-1}},["".concat(e,"-hoverable")]:{cursor:"pointer",transition:"box-shadow ".concat(t.motionDurationMid,", border-color ").concat(t.motionDurationMid),"&:hover":{borderColor:"transparent",boxShadow:n}},["".concat(e,"-contain-grid")]:{borderRadius:"".concat((0,m.bf)(t.borderRadiusLG)," ").concat((0,m.bf)(t.borderRadiusLG)," 0 0 "),["".concat(e,"-body")]:{display:"flex",flexWrap:"wrap"},["&:not(".concat(e,"-loading) ").concat(e,"-body")]:{marginBlockStart:t.calc(t.lineWidth).mul(-1).equal(),marginInlineStart:t.calc(t.lineWidth).mul(-1).equal(),padding:0}},["".concat(e,"-contain-tabs")]:{["> div".concat(e,"-head")]:{minHeight:0,["".concat(e,"-head-title, ").concat(e,"-extra")]:{paddingTop:o}}},["".concat(e,"-type-inner")]:S(t),["".concat(e,"-loading")]:x(t),["".concat(e,"-rtl")]:{direction:"rtl"}}},j=t=>{let{componentCls:e,bodyPaddingSM:n,headerPaddingSM:o,headerHeightSM:a,headerFontSizeSM:r}=t;return{["".concat(e,"-small")]:{["> ".concat(e,"-head")]:{minHeight:a,padding:"0 ".concat((0,m.bf)(o)),fontSize:r,["> ".concat(e,"-head-wrapper")]:{["> ".concat(e,"-extra")]:{fontSize:t.fontSize}}},["> ".concat(e,"-body")]:{padding:n}},["".concat(e,"-small").concat(e,"-contain-tabs")]:{["> ".concat(e,"-head")]:{["".concat(e,"-head-title, ").concat(e,"-extra")]:{paddingTop:0,display:"flex",alignItems:"center"}}}}};var E=(0,p.I$)("Card",t=>{let e=(0,f.IX)(t,{cardShadow:t.boxShadowCard,cardHeadPadding:t.padding,cardPaddingBase:t.paddingLG,cardActionsIconSize:t.fontSize});return[w(e),j(e)]},t=>{var e,n;return{headerBg:"transparent",headerFontSize:t.fontSizeLG,headerFontSizeSM:t.fontSize,headerHeight:t.fontSizeLG*t.lineHeightLG+2*t.padding,headerHeightSM:t.fontSize*t.lineHeight+2*t.paddingXS,actionsBg:t.colorBgContainer,actionsLiMargin:"".concat(t.paddingSM,"px 0"),tabsMarginBottom:-t.padding-t.lineWidth,extraColor:t.colorText,bodyPaddingSM:12,headerPaddingSM:12,bodyPadding:null!==(e=t.bodyPadding)&&void 0!==e?e:t.paddingLG,headerPadding:null!==(n=t.headerPadding)&&void 0!==n?n:t.paddingLG}}),C=n(56250),N=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(t);ae.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(t,o[a])&&(n[o[a]]=t[o[a]]);return n};let k=t=>{let{actionClasses:e,actions:n=[],actionStyle:a}=t;return o.createElement("ul",{className:e,style:a},n.map((t,e)=>o.createElement("li",{style:{width:"".concat(100/n.length,"%")},key:"action-".concat(e)},o.createElement("span",null,t))))},z=o.forwardRef((t,e)=>{let n;let{prefixCls:a,className:u,rootClassName:m,style:g,extra:p,headStyle:f={},bodyStyle:h={},title:v,loading:y,bordered:O,variant:S,size:x,type:w,cover:j,actions:z,tabList:I,children:T,activeTabKey:R,defaultActiveTabKey:B,tabBarExtraContent:P,hoverable:W,tabProps:H={},classNames:M,styles:L}=t,D=N(t,["prefixCls","className","rootClassName","style","extra","headStyle","bodyStyle","title","loading","bordered","variant","size","type","cover","actions","tabList","children","activeTabKey","defaultActiveTabKey","tabBarExtraContent","hoverable","tabProps","classNames","styles"]),{getPrefixCls:F,direction:G,card:Z}=o.useContext(i.E_),[A]=(0,C.Z)("card",S,O),q=t=>{var e;return r()(null===(e=null==Z?void 0:Z.classNames)||void 0===e?void 0:e[t],null==M?void 0:M[t])},_=t=>{var e;return Object.assign(Object.assign({},null===(e=null==Z?void 0:Z.styles)||void 0===e?void 0:e[t]),null==L?void 0:L[t])},X=o.useMemo(()=>{let t=!1;return o.Children.forEach(T,e=>{(null==e?void 0:e.type)===b&&(t=!0)}),t},[T]),K=F("card",a),[$,V,Y]=E(K),J=o.createElement(s.Z,{loading:!0,active:!0,paragraph:{rows:4},title:!1},T),Q=void 0!==R,U=Object.assign(Object.assign({},H),{[Q?"activeKey":"defaultActiveKey"]:Q?R:B,tabBarExtraContent:P}),tt=(0,l.Z)(x),te=tt&&"default"!==tt?tt:"large",tn=I?o.createElement(d.default,Object.assign({size:te},U,{className:"".concat(K,"-head-tabs"),onChange:e=>{var n;null===(n=t.onTabChange)||void 0===n||n.call(t,e)},items:I.map(t=>{var{tab:e}=t;return Object.assign({label:e},N(t,["tab"]))})})):null;if(v||p||tn){let t=r()("".concat(K,"-head"),q("header")),e=r()("".concat(K,"-head-title"),q("title")),a=r()("".concat(K,"-extra"),q("extra")),c=Object.assign(Object.assign({},f),_("header"));n=o.createElement("div",{className:t,style:c},o.createElement("div",{className:"".concat(K,"-head-wrapper")},v&&o.createElement("div",{className:e,style:_("title")},v),p&&o.createElement("div",{className:a,style:_("extra")},p)),tn)}let to=r()("".concat(K,"-cover"),q("cover")),ta=j?o.createElement("div",{className:to,style:_("cover")},j):null,tr=r()("".concat(K,"-body"),q("body")),tc=Object.assign(Object.assign({},h),_("body")),ti=o.createElement("div",{className:tr,style:tc},y?J:T),tl=r()("".concat(K,"-actions"),q("actions")),ts=(null==z?void 0:z.length)?o.createElement(k,{actionClasses:tl,actionStyle:_("actions"),actions:z}):null,td=(0,c.Z)(D,["onTabChange"]),tu=r()(K,null==Z?void 0:Z.className,{["".concat(K,"-loading")]:y,["".concat(K,"-bordered")]:"borderless"!==A,["".concat(K,"-hoverable")]:W,["".concat(K,"-contain-grid")]:X,["".concat(K,"-contain-tabs")]:null==I?void 0:I.length,["".concat(K,"-").concat(tt)]:tt,["".concat(K,"-type-").concat(w)]:!!w,["".concat(K,"-rtl")]:"rtl"===G},u,m,V,Y),tb=Object.assign(Object.assign({},null==Z?void 0:Z.style),g);return $(o.createElement("div",Object.assign({ref:e},td,{className:tu,style:tb}),n,ta,ti,ts))});var I=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,o=Object.getOwnPropertySymbols(t);ae.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(t,o[a])&&(n[o[a]]=t[o[a]]);return n};z.Grid=b,z.Meta=t=>{let{prefixCls:e,className:n,avatar:a,title:c,description:l}=t,s=I(t,["prefixCls","className","avatar","title","description"]),{getPrefixCls:d}=o.useContext(i.E_),u=d("card",e),b=r()("".concat(u,"-meta"),n),m=a?o.createElement("div",{className:"".concat(u,"-meta-avatar")},a):null,g=c?o.createElement("div",{className:"".concat(u,"-meta-title")},c):null,p=l?o.createElement("div",{className:"".concat(u,"-meta-description")},l):null,f=g||p?o.createElement("div",{className:"".concat(u,"-meta-detail")},g,p):null;return o.createElement("div",Object.assign({},s,{className:b}),m,f)};var T=z},15731:function(t,e,n){var o=n(2265);let a=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.Z=a},53410:function(t,e,n){var o=n(2265);let a=o.forwardRef(function(t,e){return o.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:e},t),o.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.Z=a}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4375-5cfcda7839272f23.js b/litellm/proxy/_experimental/out/_next/static/chunks/4375-5cfcda7839272f23.js deleted file mode 100644 index ad1a2542b3..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/4375-5cfcda7839272f23.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4375],{58643:function(e,l,t){t.d(l,{OK:function(){return s.Z},nP:function(){return n.Z},td:function(){return r.Z},v0:function(){return a.Z},x4:function(){return i.Z}});var s=t(12485),a=t(18135),r=t(35242),i=t(29706),n=t(77991)},55584:function(e,l,t){t.d(l,{L:function(){return o}});var s=t(19250),a=t(11713),r=t(90246),i=t(39760);let n=(0,r.n)("uiSettings"),o=()=>{let{accessToken:e}=(0,i.Z)();return(0,a.a)({queryKey:n.list({}),queryFn:async()=>await (0,s.getUiSettings)(e),enabled:!!e,staleTime:36e5,gcTime:36e5})}},64375:function(e,l,t){t.d(l,{Z:function(){return lU}});var s=t(57437),a=t(19250),r=t(11713),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})},c=(0,i.n)("modelCostMap"),m=()=>(0,r.a)({queryKey:c.list({}),queryFn:async()=>await (0,a.modelCostMap)(),staleTime:6e4,gcTime:6e4}),u=(0,i.n)("models");(0,i.n)("modelHub");let h=()=>{let{accessToken:e,userId:l,userRole:t}=(0,n.Z)();return(0,r.a)({queryKey:u.list({filters:{...l&&{userId:l},...t&&{userRole:t}}}),queryFn:async()=>await (0,a.modelInfoCall)(e,l,t),enabled:!!(e&&l&&t)})};var x=t(55584),p=t(47359),g=t(8048),f=t(45589),j=t(74998),v=t(41649),_=t(78489),y=t(47323),b=t(99981),N=t(2265),w=t(42673);let Z=e=>{let{provider:l,className:t="w-4 h-4"}=e,[a,r]=(0,N.useState)(!1),{logo:i}=(0,w.dr)(l);return a||!i?(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:i,alt:"".concat(l," logo"),className:t,onError:()=>r(!0)})},C=(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",cell:e=>{let{row:l}=e,t=l.original;return(0,s.jsx)(b.Z,{title:t.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:()=>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,cell:e=>{let{row:l}=e,t=l.original,a=i(l.original)||"-",r=(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Provider:"})," ",t.provider||"-"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"Public Model Name:"})," ",a]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:"LiteLLM Model Name:"})," ",t.litellm_model_name||"-"]})]});return(0,s.jsx)(b.Z,{title:r,children:(0,s.jsxs)("div",{className:"flex items-start space-x-2 min-w-0 w-full max-w-[250px]",children:[(0,s.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:t.provider?(0,s.jsx)(Z,{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)("div",{className:"text-xs font-medium text-gray-900 truncate max-w-[210px]",children:a}),(0,s.jsx)("div",{className:"text-xs text-gray-500 truncate mt-0.5 max-w-[210px]",children:t.litellm_model_name||"-"})]})]})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Credentials"}),accessorKey:"litellm_credential_name",size:180,cell:e=>{var l;let{row:t}=e,a=null===(l=t.original.litellm_params)||void 0===l?void 0:l.litellm_credential_name;return a?(0,s.jsx)(b.Z,{title:"Credential: ".concat(a),children:(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(f.Z,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs truncate",title:a,children:a})]})}):(0,s.jsxs)("div",{className:"flex items-center space-x-2 max-w-[180px]",children:[(0,s.jsx)(f.Z,{className:"w-4 h-4 text-gray-300 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"No credentials"})]})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Created By"}),accessorKey:"model_info.created_by",sortingFn:"datetime",size:160,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 max-w-[160px]",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",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,cell:e=>{let{row:l}=e,t=l.original,a=t.input_cost,r=t.output_cost;return a||r?(0,s.jsx)(b.Z,{title:"Cost per 1M tokens",children:(0,s.jsxs)("div",{className:"flex flex-col min-w-0 max-w-[120px]",children:[a&&(0,s.jsxs)("div",{className:"text-xs font-medium text-gray-900 truncate",children:["In: $",a]}),r&&(0,s.jsxs)("div",{className:"text-xs text-gray-500 truncate mt-0.5",children:["Out: $",r]})]})}):(0,s.jsx)("div",{className:"max-w-[120px]",children:(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"-"})})}},{header:()=>(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Team ID"}),accessorKey:"model_info.team_id",cell:e=>{let{row:l}=e,t=l.original;return t.model_info.team_id?(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)(b.Z,{title:t.model_info.team_id,children:(0,s.jsxs)(_.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 max-w-[200px]",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,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",children:[(0,s.jsx)(v.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)(v.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",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"}),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)(b.Z,{title:"Config model cannot be deleted on the dashboard. Please delete it from the config file.",children:(0,s.jsx)(y.Z,{icon:j.Z,size:"sm",className:"opacity-50 cursor-not-allowed"})}):(0,s.jsx)(b.Z,{title:"Delete model",children:(0,s.jsx)(y.Z,{icon:j.Z,size:"sm",onClick:()=>{d&&a(o.model_info.id)},className:d?"cursor-pointer hover:text-red-600":"opacity-50 cursor-not-allowed"})})})}}],k=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 S=t(15424),A=t(67101),E=t(27281),P=t(57365),F=t(29706),L=t(84264);let M=(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,t[e].input_cost&&(t[e].input_cost=(1e6*Number(t[e].input_cost)).toFixed(2)),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}};var I=t(50337),T=e=>{let{selectedModelGroup:l,setSelectedModelGroup:t,availableModelGroups:a,availableModelAccessGroups:r,setSelectedModelId:i,setSelectedTeamId:o}=e,{data:d,isLoading:c}=h(),{data:u,isLoading:x}=m(),{userId:f,userRole:j,premiumUser:v}=(0,n.Z)(),{data:_}=(0,p.y)(),y=e=>null!=u&&"object"==typeof u&&e in u?u[e].litellm_provider:"openai",b=(0,N.useMemo)(()=>d?M(d,y):{data:[]},[d,u]),[w,Z]=(0,N.useState)(""),[T,R]=(0,N.useState)("current_team"),[O,q]=(0,N.useState)("personal"),[V,D]=(0,N.useState)(!1),[z,B]=(0,N.useState)(null),[U,G]=(0,N.useState)(new Set),[H,K]=(0,N.useState)({pageIndex:0,pageSize:50}),J=c||x,W=(0,N.useMemo)(()=>b&&b.data&&0!==b.data.length?b.data.filter(e=>{var t,s,a,r,i,n;let o=""===w||e.model_name.toLowerCase().includes(w.toLowerCase()),d="all"===l||e.model_name===l||!l||"wildcard"===l&&(null===(t=e.model_name)||void 0===t?void 0:t.includes("*")),c="all"===z||(null===(s=e.model_info.access_groups)||void 0===s?void 0:s.includes(z))||!z,m=!0;if("current_team"===T){if("personal"===O)m=(null===(a=e.model_info)||void 0===a?void 0:a.direct_access)===!0;else{let l=(null===(i=e.model_info)||void 0===i?void 0:null===(r=i.access_via_team_ids)||void 0===r?void 0:r.includes(O.team_id))===!0,t=(null===(n=O.models)||void 0===n?void 0:n.some(l=>{var t,s;return null===(s=e.model_info)||void 0===s?void 0:null===(t=s.access_groups)||void 0===t?void 0:t.includes(l)}))===!0;m=l||t}}return o&&d&&c&&m}):[],[b,w,l,z,O,T]);return(0,N.useEffect)(()=>{K(e=>({...e,pageIndex:0}))},[w,l,z,O,T]),(0,s.jsx)(F.Z,{children:(0,s.jsx)(A.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)(L.Z,{className:"text-lg font-semibold text-gray-900",children:"Current Team:"}),J?(0,s.jsx)(I.Z.Input,{active:!0,style:{width:320,height:36}}):(0,s.jsxs)(E.Z,{className:"w-80",defaultValue:"personal",value:"personal"===O?"personal":O.team_id,onValueChange:e=>{if("personal"===e)q("personal");else{let l=null==_?void 0:_.find(l=>l.team_id===e);l&&q(l)}},children:[(0,s.jsx)(P.Z,{value:"personal",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Personal"})]})}),null==_?void 0:_.filter(e=>e.team_id).map(e=>(0,s.jsx)(P.Z,{value:e.team_id,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:e.team_alias?"".concat(e.team_alias.slice(0,30),"..."):"Team ".concat(e.team_id.slice(0,30),"...")})]})},e.team_id))]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(L.Z,{className:"text-lg font-semibold text-gray-900",children:"View:"}),J?(0,s.jsx)(I.Z.Input,{active:!0,style:{width:256,height:36}}):(0,s.jsxs)(E.Z,{className:"w-64",defaultValue:"current_team",value:T,onValueChange:e=>R(e),children:[(0,s.jsx)(P.Z,{value:"current_team",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"Current Team Models"})]})}),(0,s.jsx)(P.Z,{value:"all",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-gray-500 rounded-full"}),(0,s.jsx)("span",{className:"font-medium",children:"All Available Models"})]})})]})]})]}),"current_team"===T&&(0,s.jsxs)("div",{className:"flex items-start gap-2 mt-3",children:[(0,s.jsx)(S.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"===O?(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 O?O.team_alias||O.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:w,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(V?"bg-gray-100":""),onClick:()=>D(!V),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(""),t("all"),B(null),q("personal"),R("current_team"),K({pageIndex:0,pageSize:50})},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"]})]}),V&&(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.jsxs)(E.Z,{value:null!=l?l:"all",onValueChange:e=>t("all"===e?"all":e),placeholder:"Filter by Public Model Name",children:[(0,s.jsx)(P.Z,{value:"all",children:"All Models"}),(0,s.jsx)(P.Z,{value:"wildcard",children:"Wildcard Models (*)"}),a.map((e,l)=>(0,s.jsx)(P.Z,{value:e,children:e},l))]})}),(0,s.jsx)("div",{className:"w-64",children:(0,s.jsxs)(E.Z,{value:null!=z?z:"all",onValueChange:e=>B("all"===e?null:e),placeholder:"Filter by Model Access Group",children:[(0,s.jsx)(P.Z,{value:"all",children:"All Model Access Groups"}),r.map((e,l)=>(0,s.jsx)(P.Z,{value:e,children:e},l))]})})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[J?(0,s.jsx)(I.Z.Input,{active:!0,style:{width:184,height:20}}):(0,s.jsx)("span",{className:"text-sm text-gray-700",children:W.length>0?"Showing ".concat(H.pageIndex*H.pageSize+1," - ").concat(Math.min((H.pageIndex+1)*H.pageSize,W.length)," of ").concat(W.length," results"):"Showing 0 results"}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[J?(0,s.jsx)(I.Z.Button,{active:!0,style:{width:84,height:30}}):(0,s.jsx)("button",{onClick:()=>K(e=>({...e,pageIndex:e.pageIndex-1})),disabled:0===H.pageIndex,className:"px-3 py-1 text-sm border rounded-md ".concat(0===H.pageIndex?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Previous"}),J?(0,s.jsx)(I.Z.Button,{active:!0,style:{width:56,height:30}}):(0,s.jsx)("button",{onClick:()=>K(e=>({...e,pageIndex:e.pageIndex+1})),disabled:H.pageIndex>=Math.ceil(W.length/H.pageSize)-1,className:"px-3 py-1 text-sm border rounded-md ".concat(H.pageIndex>=Math.ceil(W.length/H.pageSize)-1?"bg-gray-100 text-gray-400 cursor-not-allowed":"hover:bg-gray-50"),children:"Next"})]})]})]})}),(0,s.jsx)(g.C,{columns:C(j,f,v,i,o,k,()=>{},()=>{},U,G),data:W,isLoading:!1,pagination:H,onPaginationChange:K,enablePagination:!0})]})})})})},R=t(96761),O=t(19015);let q={"BadRequestError (400)":"BadRequestErrorRetries","AuthenticationError (401)":"AuthenticationErrorRetries","TimeoutError (408)":"TimeoutErrorRetries","RateLimitError (429)":"RateLimitErrorRetries","ContentPolicyViolationError (400)":"ContentPolicyViolationErrorRetries","InternalServerError (500)":"InternalServerErrorRetries"};var V=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)(F.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)(L.Z,{children:"Retry Policy Scope:"}),(0,s.jsxs)(E.Z,{className:"ml-2 w-48",defaultValue:"global",value:"global"===l?"global":l||a[0],onValueChange:e=>t(e),children:[(0,s.jsx)(P.Z,{value:"global",children:"Global Default"}),a.map((e,l)=>(0,s.jsx)(P.Z,{value:e,onClick:()=>t(e),children:e},l))]})]})}),"global"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(R.Z,{children:"Global Retry Policy"}),(0,s.jsx)(L.Z,{className:"mb-6",children:"Default retry settings applied to all model groups unless overridden"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(R.Z,{children:["Retry Policy for ",l]}),(0,s.jsx)(L.Z,{className:"mb-6",children:"Model-specific retry settings. Falls back to global defaults if not set."})]}),q&&(0,s.jsx)("table",{children:(0,s.jsx)("tbody",{children:Object.entries(q).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)(L.Z,{children:x}),"global"!==l&&(0,s.jsxs)(L.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)(O.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)(_.Z,{className:"mt-6 mr-8",onClick:c,children:"Save"})]})},D=t(57840),z=t(58760),B=t(867),U=t(5545),G=t(5945),H=t(3810),K=t(22116),J=t(89245),W=t(5540),Y=t(8881),$=t(9114);let{Text:Q}=D.default;var X=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,N.useState)(!1),[u,h]=(0,N.useState)(!1),[x,p]=(0,N.useState)(!1),[g,f]=(0,N.useState)(!1),[j,v]=(0,N.useState)(6),[_,y]=(0,N.useState)(null),[b,w]=(0,N.useState)(!1);(0,N.useEffect)(()=>{Z();let e=setInterval(()=>{Z()},3e4);return()=>clearInterval(e)},[l]);let Z=async()=>{if(l){w(!0);try{console.log("Fetching reload status...");let e=await (0,a.getModelCostMapReloadStatus)(l);console.log("Received status:",e),y(e)}catch(e){console.error("Failed to fetch reload status:",e),y({scheduled:!1,interval_hours:null,last_run:null,next_run:null})}finally{w(!1)}}},C=async()=>{if(!l){$.Z.fromBackend("No access token available");return}m(!0);try{let e=await (0,a.reloadModelCostMap)(l);"success"===e.status?($.Z.success("Price data reloaded successfully! ".concat(e.models_count||0," models updated.")),null==t||t(),await Z()):$.Z.fromBackend("Failed to reload price data")}catch(e){console.error("Error reloading price data:",e),$.Z.fromBackend("Failed to reload price data. Please try again.")}finally{m(!1)}},k=async()=>{if(!l){$.Z.fromBackend("No access token available");return}if(j<=0){$.Z.fromBackend("Hours must be greater than 0");return}h(!0);try{let e=await (0,a.scheduleModelCostMapReload)(l,j);"success"===e.status?($.Z.success("Periodic reload scheduled for every ".concat(j," hours")),f(!1),await Z()):$.Z.fromBackend("Failed to schedule periodic reload")}catch(e){console.error("Error scheduling reload:",e),$.Z.fromBackend("Failed to schedule periodic reload. Please try again.")}finally{h(!1)}},S=async()=>{if(!l){$.Z.fromBackend("No access token available");return}p(!0);try{let e=await (0,a.cancelModelCostMapReload)(l);"success"===e.status?($.Z.success("Periodic reload cancelled successfully"),await Z()):$.Z.fromBackend("Failed to cancel periodic reload")}catch(e){console.error("Error cancelling reload:",e),$.Z.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)(z.Z,{direction:"horizontal",size:"middle",style:{marginBottom:16},children:[(0,s.jsx)(B.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)(U.ZP,{type:o,size:n,loading:c,icon:i?(0,s.jsx)(J.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==_?void 0:_.scheduled)?(0,s.jsx)(U.ZP,{type:"default",size:n,danger:!0,icon:(0,s.jsx)(Y.Z,{}),loading:x,onClick:S,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)(U.ZP,{type:"default",size:n,icon:(0,s.jsx)(W.Z,{}),onClick:()=>f(!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"})]}),_&&(0,s.jsx)(G.Z,{size:"small",style:{backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:8},children:(0,s.jsxs)(z.Z,{direction:"vertical",size:"small",style:{width:"100%"},children:[_.scheduled?(0,s.jsx)("div",{children:(0,s.jsxs)(H.Z,{color:"green",icon:(0,s.jsx)(W.Z,{}),children:["Scheduled every ",_.interval_hours," hours"]})}):(0,s.jsx)(Q,{type:"secondary",children:"No periodic reload scheduled"}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(Q,{type:"secondary",style:{fontSize:"12px"},children:"Last run:"}),(0,s.jsx)(Q,{style:{fontSize:"12px"},children:A(_.last_run)})]}),_.scheduled&&(0,s.jsxs)(s.Fragment,{children:[_.next_run&&(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(Q,{type:"secondary",style:{fontSize:"12px"},children:"Next run:"}),(0,s.jsx)(Q,{style:{fontSize:"12px"},children:A(_.next_run)})]}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsx)(Q,{type:"secondary",style:{fontSize:"12px"},children:"Status:"}),(0,s.jsx)(H.Z,{color:(null==_?void 0:_.scheduled)?_.last_run?"success":"processing":"default",children:(null==_?void 0:_.scheduled)?_.last_run?"Active":"Ready":"Not scheduled"})]})]})]})}),(0,s.jsxs)(K.Z,{title:"Set Up Periodic Reload",open:g,onOk:k,onCancel:()=>f(!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)(Q,{children:"Set up automatic reload of price data every:"})}),(0,s.jsx)("div",{style:{marginBottom:16},children:(0,s.jsx)(O.Z,{min:1,max:168,value:j,onChange:e=>v(e||6),addonAfter:"hours",style:{width:"100%"}})}),(0,s.jsx)("div",{children:(0,s.jsxs)(Q,{type:"secondary",children:["This will automatically fetch the latest pricing data from the remote source every ",j," hours."]})})]})]})},ee=()=>{let{accessToken:e}=(0,n.Z)(),{refetch:l}=m();return(0,s.jsx)(F.Z,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)(R.Z,{children:"Price Data Management"}),(0,s.jsx)(L.Z,{className:"text-tremor-content",children:"Manage model pricing data and configure automatic reload schedules"})]}),(0,s.jsx)(X,{accessToken:e,onReloadSuccess:()=>{l()},buttonText:"Reload Price Data",size:"middle",type:"primary",className:"w-full"})]})})};let el=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=w.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=w.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 $.Z.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 $.Z.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){$.Z.fromBackend("Failed to create model: "+e)}},et=async(e,l,t,s)=>{try{let r=await el(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){$.Z.fromBackend("Failed to add model: "+e)}};var es=t(53410),ea=t(62490),er=t(10032),ei=t(21609),en=t(31283),eo=t(37592);let ed=(0,i.n)("providerFields"),ec=()=>(0,r.a)({queryKey:ed.list({}),queryFn:async()=>await (0,a.getProviderCreateMetadata)(),staleTime:864e5,gcTime:864e5});var em=t(3632),eu=t(56522),eh=t(47451),ex=t(69410),ep=t(65319),eg=t(4260);let{Link:ef}=D.default,ej=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}},ev={};var e_=e=>{let{selectedProvider:l,uploadProps:t}=e,a=w.Cl[l],r=er.Z.useFormInstance(),{data:i,isLoading:n,error:o}=ec(),d=N.useMemo(()=>{if(!i)return null;let e={};return i.forEach(l=>{let t=l.provider_display_name,s=l.credential_fields.map(ej);e[t]=s,l.provider&&(e[l.provider]=s),l.litellm_provider&&(e[l.litellm_provider]=s)}),e},[i]);N.useEffect(()=>{d&&Object.assign(ev,d)},[d]);let c=N.useMemo(()=>{var e;let t=null!==(e=ev[a])&&void 0!==e?e:ev[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(ej);return ev[s.provider_display_name]=r,s.provider&&(ev[s.provider]=r),s.litellm_provider&&(ev[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)(eh.Z,{children:(0,s.jsx)(ex.Z,{span:24,children:(0,s.jsx)(eu.x,{className:"mb-2",children:"Loading provider fields..."})})}),o&&0===c.length&&(0,s.jsx)(eh.Z,{children:(0,s.jsx)(ex.Z,{span:24,children:(0,s.jsx)(eu.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)(N.Fragment,{children:[(0,s.jsx)(er.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)(eo.default,{placeholder:e.placeholder,defaultValue:e.defaultValue,children:null===(l=e.options)||void 0===l?void 0:l.map(e=>(0,s.jsx)(eo.default.Option,{value:e,children:e},e))}):"upload"===e.type?(0,s.jsx)(ep.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)(U.ZP,{icon:(0,s.jsx)(em.Z,{}),children:"Click to Upload"})}):"textarea"===e.type?(0,s.jsx)(eg.default.TextArea,{placeholder:e.placeholder,defaultValue:e.defaultValue,rows:6,style:{fontFamily:"monospace",fontSize:"12px"}}):(0,s.jsx)(eu.o,{placeholder:e.placeholder,type:"password"===e.type?"password":"text",defaultValue:e.defaultValue})}),"vertex_credentials"===e.key&&(0,s.jsx)(eh.Z,{children:(0,s.jsx)(ex.Z,{children:(0,s.jsx)(eu.x,{className:"mb-3 mt-1",children:"Give a gcp service account(.json file)"})})}),"base_model"===e.key&&(0,s.jsxs)(eh.Z,{children:[(0,s.jsx)(ex.Z,{span:10}),(0,s.jsx)(ex.Z,{span:10,children:(0,s.jsxs)(eu.x,{className:"mb-2",children:["The actual model your azure deployment uses. Used for accurate cost tracking. Select name from"," ",(0,s.jsx)(ef,{href:"https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json",target:"_blank",children:"here"})]})})]})]},e.key)})]})};let{Link:ey}=D.default;var eb=e=>{let{open:l,onCancel:t,onAddCredential:a,uploadProps:r}=e,[i]=er.Z.useForm(),[n,o]=(0,N.useState)(w.Cl.OpenAI);return(0,s.jsx)(K.Z,{title:"Add New Credential",open:l,onCancel:()=>{t(),i.resetFields()},footer:null,width:600,children:(0,s.jsxs)(er.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)(er.Z.Item,{label:"Credential Name:",name:"credential_name",rules:[{required:!0,message:"Credential name is required"}],children:(0,s.jsx)(en.o,{placeholder:"Enter a friendly name for these credentials"})}),(0,s.jsx)(er.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)(eo.default,{showSearch:!0,onChange:e=>{o(e),i.setFieldValue("custom_llm_provider",e)},children:Object.entries(w.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(eo.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:w.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)(e_,{selectedProvider:n,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(b.Z,{title:"Get help on our github",children:(0,s.jsx)(ey,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(U.ZP,{onClick:()=>{t(),i.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(U.ZP,{htmlType:"submit",children:"Add Credential"})]})]})]})})};let{Link:eN}=D.default;function ew(e){let{open:l,onCancel:t,onUpdateCredential:a,uploadProps:r,existingCredential:i}=e,[n]=er.Z.useForm(),[o,d]=(0,N.useState)(w.Cl.Anthropic);return(0,N.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)(K.Z,{title:"Edit Credential",open:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,destroyOnHidden:!0,children:(0,s.jsxs)(er.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)(er.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)(en.o,{placeholder:"Enter a friendly name for these credentials",disabled:null!=i&&!!i.credential_name})}),(0,s.jsx)(er.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)(eo.default,{showSearch:!0,onChange:e=>{d(e),n.setFieldValue("custom_llm_provider",e)},children:Object.entries(w.Cl).map(e=>{let[l,t]=e;return(0,s.jsx)(eo.default.Option,{value:l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("img",{src:w.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)(e_,{selectedProvider:o,uploadProps:r}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(b.Z,{title:"Get help on our github",children:(0,s.jsx)(eN,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(U.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(U.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,N.useState)(!1),[h,x]=(0,N.useState)(!1),[p,g]=(0,N.useState)(null),[f,v]=(0,N.useState)(null),[_,y]=(0,N.useState)(!1),[b,w]=(0,N.useState)(!1),[Z]=er.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),$.Z.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),$.Z.success("Credential added successfully"),u(!1),await o()},A=e=>{let l={openai:"blue",azure:"indigo",anthropic:"purple",default:"gray"},t=l[e.toLowerCase()]||l.default;return(0,s.jsx)(ea.Ct,{color:t,size:"xs",children:e})},E=async()=>{if(r&&f){w(!0);try{await (0,a.credentialDeleteCall)(r,f.credential_name),$.Z.success("Credential deleted successfully"),await o()}catch(e){$.Z.error("Failed to delete credential")}finally{v(null),y(!1),w(!1)}}},P=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)(ea.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)(ea.xv,{children:"Configured credentials for different AI providers. Add and manage your API credentials."})}),(0,s.jsx)(ea.Zb,{children:(0,s.jsxs)(ea.iA,{children:[(0,s.jsx)(ea.ss,{children:(0,s.jsxs)(ea.SC,{children:[(0,s.jsx)(ea.xs,{children:"Credential Name"}),(0,s.jsx)(ea.xs,{children:"Provider"}),(0,s.jsx)(ea.xs,{children:"Actions"})]})}),(0,s.jsx)(ea.RM,{children:c&&0!==c.length?c.map((e,l)=>{var t;return(0,s.jsxs)(ea.SC,{children:[(0,s.jsx)(ea.pj,{children:e.credential_name}),(0,s.jsx)(ea.pj,{children:A((null===(t=e.credential_info)||void 0===t?void 0:t.custom_llm_provider)||"-")}),(0,s.jsxs)(ea.pj,{children:[(0,s.jsx)(ea.zx,{icon:es.Z,variant:"light",size:"sm",onClick:()=>{g(e),x(!0)}}),(0,s.jsx)(ea.zx,{icon:j.Z,variant:"light",size:"sm",onClick:()=>P(e),className:"ml-2"})]})]},l)}):(0,s.jsx)(ea.SC,{children:(0,s.jsx)(ea.pj,{colSpan:4,className:"text-center py-4 text-gray-500",children:"No credentials configured"})})})]})}),m&&(0,s.jsx)(eb,{onAddCredential:S,open:m,onCancel:()=>u(!1),uploadProps:t}),h&&(0,s.jsx)(ew,{open:h,existingCredential:p,onUpdateCredential:k,uploadProps:t,onCancel:()=>x(!1)}),(0,s.jsx)(ei.Z,{isOpen:_,onCancel:()=>{v(null),y(!1)},onOk:E,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==f?void 0:f.credential_name},{label:"Provider",value:(null==f?void 0:null===(l=f.credential_info)||void 0===l?void 0:l.custom_llm_provider)||"-"}],confirmLoading:b,requiredConfirmation:null==f?void 0:f.credential_name})]})},eC=t(20347),ek=t(23628),eS=t(29827),eA=t(49804),eE=t(12485),eP=t(18135),eF=t(35242),eL=t(77991),eM=t(34419),eI=t(58643),eT=t(29),eR=t.n(eT),eO=t(23496),eq=t(35291),eV=t(23639);let{Text:eD}=D.default;var ez=e=>{let{formValues:l,accessToken:t,testMode:r,modelName:i="this model",onClose:n,onTestComplete:o}=e,[d,c]=N.useState(null),[m,u]=N.useState(null),[h,x]=N.useState(null),[p,g]=N.useState(!0),[f,j]=N.useState(!1),[v,_]=N.useState(!1),y=async()=>{g(!0),_(!1),c(null),u(null),x(null),j(!1),await new Promise(e=>setTimeout(e,100));try{console.log("Testing connection with form values:",l);let r=await el(l,t,null);if(!r){console.log("No result from prepareModelAddRequest"),c("Failed to prepare model data. Please check your form inputs."),j(!1),g(!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)$.Z.success("Connection test successful!"),c(null),j(!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),j(!1)}}catch(e){console.error("Test connection error:",e),c(e instanceof Error?e.message:String(e)),j(!1)}finally{g(!1),o&&o()}};N.useEffect(()=>{let e=setTimeout(()=>{y()},200);return()=>clearTimeout(e)},[]);let b=e=>e?e.split("stack trace:")[0].trim().replace(/^litellm\.(.*?)Error: /,""):"Unknown error",w="string"==typeof d?b(d):(null==d?void 0:d.message)?b(d.message):"Unknown error",Z=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)(eD,{style:{fontSize:"16px"},children:["Testing connection to ",i,"..."]}),(0,s.jsx)(eR(),{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)}}"})]}):f?(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)(eD,{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)(eq.Z,{style:{color:"#ff4d4f",fontSize:"24px",marginRight:"12px"}}),(0,s.jsxs)(eD,{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)(eD,{strong:!0,style:{display:"block",marginBottom:"8px"},children:["Error:"," "]}),(0,s.jsx)(eD,{type:"danger",style:{fontSize:"14px",lineHeight:"1.5"},children:w}),d&&(0,s.jsx)("div",{style:{marginTop:"12px"},children:(0,s.jsx)(U.ZP,{type:"link",onClick:()=>_(!v),style:{paddingLeft:0,height:"auto"},children:v?"Hide Details":"Show Details"})})]}),v&&(0,s.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,s.jsx)(eD,{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)(eD,{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:Z||"No request data available"}),(0,s.jsx)(U.ZP,{style:{marginTop:"8px"},icon:(0,s.jsx)(eV.Z,{}),onClick:()=>{navigator.clipboard.writeText(Z||""),$.Z.success("Copied to clipboard")},children:"Copy to Clipboard"})]})]})}),(0,s.jsx)(eO.Z,{style:{margin:"24px 0 16px"}}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:(0,s.jsx)(U.ZP,{type:"link",href:"https://docs.litellm.ai/docs/providers",target:"_blank",icon:(0,s.jsx)(S.Z,{}),children:"View Documentation"})})]})};let eB=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),$.Z.fromBackend("Failed to add auto router: "+e)}};var eU=t(10703),eG=t(44851),eH=t(96473),eK=t(70464),eJ=t(26349),eW=t(92280);let{TextArea:eY}=eg.default,{Panel:e$}=eG.default;var eQ=e=>{let{modelInfo:l,value:t,onChange:a}=e,[r,i]=(0,N.useState)([]),[n,o]=(0,N.useState)(!1),[d,c]=(0,N.useState)([]);(0,N.useEffect)(()=>{if(null==t?void 0:t.routes){let e=t.routes.map((e,l)=>({id:e.id||"route-".concat(l,"-").concat(Date.now()),model:e.name||e.model||"",utterances:e.utterances||[],description:e.description||"",score_threshold:e.score_threshold||.5}));i(e),c(e.map(e=>e.id))}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)("div",{className:"flex justify-between items-center mb-6 w-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(eW.x,{className:"text-lg font-semibold",children:"Routes Configuration"}),(0,s.jsx)(b.Z,{title:"Configure routing logic to automatically select the best model based on user input patterns",children:(0,s.jsx)(S.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(U.ZP,{type:"primary",icon:(0,s.jsx)(eH.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)("div",{className:"text-center py-12 text-gray-500 bg-gray-50 rounded-lg border-2 border-dashed border-gray-200 mb-6",children:(0,s.jsx)(eW.x,{children:"No routes configured. Click “Add Route” to get started."})}):(0,s.jsx)("div",{className:"space-y-3 mb-6 w-full",children:r.map((e,l)=>(0,s.jsx)(G.Z,{className:"border border-gray-200 shadow-sm w-full",bodyStyle:{padding:0},children:(0,s.jsx)(eG.default,{ghost:!0,expandIcon:e=>{let{isActive:l}=e;return(0,s.jsx)(eK.Z,{rotate:l?180:0})},activeKey:d,onChange:e=>c(Array.isArray(e)?e:[e].filter(Boolean)),items:[{key:e.id,label:(0,s.jsxs)("div",{className:"flex justify-between items-center py-2",children:[(0,s.jsxs)(eW.x,{className:"font-medium text-base",children:["Route ",l+1,": ",e.model||"Unnamed"]}),(0,s.jsx)(U.ZP,{type:"text",danger:!0,icon:(0,s.jsx)(eJ.Z,{}),onClick:l=>{l.stopPropagation(),m(e.id)},className:"mr-2"})]}),children:(0,s.jsxs)("div",{className:"px-6 pb-6 w-full",children:[(0,s.jsxs)("div",{className:"mb-4 w-full",children:[(0,s.jsx)(eW.x,{className:"text-sm font-medium mb-2 block",children:"Model"}),(0,s.jsx)(eo.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)(eW.x,{className:"text-sm font-medium mb-2 block",children:"Description"}),(0,s.jsx)(eY,{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)(eW.x,{className:"text-sm font-medium",children:"Score Threshold"}),(0,s.jsx)(b.Z,{title:"Minimum similarity score to route to this model (0-1)",children:(0,s.jsx)(S.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(O.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)(eW.x,{className:"text-sm font-medium",children:"Example Utterances"}),(0,s.jsx)(b.Z,{title:"Training examples for this route. Type an utterance and press Enter to add it.",children:(0,s.jsx)(S.Z,{className:"text-gray-400"})})]}),(0,s.jsx)(eW.x,{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)(eo.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.jsxs)("div",{className:"border-t pt-6 w-full",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4 w-full",children:[(0,s.jsx)(eW.x,{className:"text-lg font-semibold",children:"JSON Preview"}),(0,s.jsx)(U.ZP,{type:"link",onClick:()=>o(!n),className:"text-blue-600 p-0",children:n?"Hide":"Show"})]}),n&&(0,s.jsx)(G.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:eX,Link:e0}=D.default;var e1=e=>{let{form:l,handleOk:t,accessToken:r,userRole:i}=e,[n,o]=(0,N.useState)(!1),[d,c]=(0,N.useState)(!1),[m,u]=(0,N.useState)(""),[h,x]=(0,N.useState)([]),[p,g]=(0,N.useState)([]),[f,j]=(0,N.useState)(!1),[v,_]=(0,N.useState)(!1),[y,w]=(0,N.useState)(null);(0,N.useEffect)(()=>{(async()=>{x((await (0,a.modelAvailableCall)(r,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[r]),(0,N.useEffect)(()=>{(async()=>{try{let e=await (0,eU.p)(r);console.log("Fetched models for auto router:",e),g(e)}catch(e){console.error("Error fetching model info for auto router:",e)}})()},[r]);let Z=eC.ZL.includes(i),C=async()=>{c(!0),u("test-".concat(Date.now())),o(!0)},k=()=>{console.log("Auto router submit triggered!"),console.log("Router config:",y);let e=l.getFieldsValue();if(console.log("Form values:",e),!e.auto_router_name){$.Z.fromBackend("Please enter an Auto Router Name");return}if(!e.auto_router_default_model){$.Z.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"}),!y||!y.routes||0===y.routes.length){$.Z.fromBackend("Please configure at least one route for the auto router");return}if(y.routes.filter(e=>!e.name||!e.description||0===e.utterances.length).length>0){$.Z.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:y};console.log("Final submit values:",s),eB(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});$.Z.fromBackend("Please fill in the following required fields: ".concat(e.join(", ")))}else $.Z.fromBackend("Please fill in all required fields")})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eX,{level:2,children:"Add Auto Router"}),(0,s.jsx)(eu.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)(G.Z,{children:(0,s.jsxs)(er.Z,{form:l,onFinish:k,labelCol:{span:10},wrapperCol:{span:16},labelAlign:"left",children:[(0,s.jsx)(er.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)(eu.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full mb-4",children:(0,s.jsx)(eQ,{modelInfo:p,value:y,onChange:e=>{w(e),l.setFieldValue("auto_router_config",e)}})}),(0,s.jsx)(er.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)(eo.default,{placeholder:"Select a default model",onChange:e=>{j("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)(er.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)(eo.default,{value:l.getFieldValue("auto_router_embedding_model"),placeholder:"Select an embedding model (optional)",onChange:e=>{_("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)(er.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)(eo.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)(b.Z,{title:"Get help on our github",children:(0,s.jsx)(D.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(U.ZP,{onClick:C,loading:d,children:"Test Connect"}),(0,s.jsx)(U.ZP,{onClick:()=>{console.log("Add Auto Router button clicked!"),console.log("Current router config:",y),console.log("Current form values:",l.getFieldsValue()),k()},children:"Add Auto Router"})]})]})]})}),(0,s.jsx)(K.Z,{title:"Connection Test Results",open:n,onCancel:()=>{o(!1),c(!1)},footer:[(0,s.jsx)(U.ZP,{onClick:()=>{o(!1),c(!1)},children:"Close"},"close")],width:700,children:n&&(0,s.jsx)(ez,{formValues:l.getFieldsValue(),accessToken:r,testMode:"chat",modelName:l.getFieldValue("auto_router_name"),onClose:()=>{o(!1),c(!1)},onTestComplete:()=>c(!1)},m)})]})};let e2=(0,i.n)("guardrails"),e4=()=>{let{accessToken:e,userId:l,userRole:t}=(0,n.Z)();return(0,r.a)({queryKey:e2.list({}),queryFn:async()=>(await (0,a.getGuardrailsList)(e)).guardrails.map(e=>e.guardrail_name),enabled:!!(e&&l&&t)})},e5=(0,i.n)("tags"),e6=()=>{let{accessToken:e,userId:l,userRole:t}=(0,n.Z)();return(0,r.a)({queryKey:e5.list({}),queryFn:async()=>await (0,a.tagListCall)(e),enabled:!!(e&&l&&t)})};var e3=t(59341),e8=t(51653),e9=t(84376),e7=t(63709),le=t(26210),ll=t(34766),lt=t(45246),ls=t(24199);let{Text:la}=D.default;var lr=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)(er.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)(e7.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)(la,{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)(er.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)(er.Z.Item,{...t,label:"Type",name:[t.name,"location"],initialValue:"message",className:"mb-0",style:{width:"180px"},children:(0,s.jsx)(eo.default,{disabled:!0,options:[{value:"message",label:"Message"}]})}),(0,s.jsx)(er.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)(eo.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)(er.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)(ls.Z,{type:"number",placeholder:"Optional",step:1,onChange:()=>{r(l.getFieldValue("cache_control_points"))}})}),e.length>1&&(0,s.jsx)(lt.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)(er.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)(eH.Z,{className:"mr-2"}),"Add Injection Point"]})})]})}})]})]})},li=t(9309);let{Link:ln}=D.default;var lo=e=>{let{showAdvancedSettings:l,setShowAdvancedSettings:t,teams:a,guardrailsList:r,tagsList:i}=e,[n]=er.Z.useForm(),[o,d]=N.useState(!1),[c,m]=N.useState("per_token"),[u,h]=N.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)(le.UQ,{className:"mt-2 mb-4",children:[(0,s.jsx)(le._m,{children:(0,s.jsx)("b",{children:"Advanced Settings"})}),(0,s.jsx)(le.X1,{children:(0,s.jsxs)("div",{className:"bg-white rounded-lg",children:[(0,s.jsx)(er.Z.Item,{label:"Custom Pricing",name:"custom_pricing",valuePropName:"checked",className:"mb-4",children:(0,s.jsx)(e7.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)(er.Z.Item,{label:(0,s.jsxs)("span",{children:["Guardrails"," ",(0,s.jsx)(b.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)(S.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)(eo.default,{mode:"tags",style:{width:"100%"},placeholder:"Select or enter guardrails",options:r.map(e=>({value:e,label:e}))})}),(0,s.jsx)(er.Z.Item,{label:"Tags",name:"tags",className:"mb-4",children:(0,s.jsx)(eo.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)(er.Z.Item,{label:"Pricing Model",name:"pricing_model",className:"mb-4",children:(0,s.jsx)(eo.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)(er.Z.Item,{label:"Input Cost (per 1M tokens)",name:"input_cost_per_token",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(le.oi,{})}),(0,s.jsx)(er.Z.Item,{label:"Output Cost (per 1M tokens)",name:"output_cost_per_token",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(le.oi,{})})]}):(0,s.jsx)(er.Z.Item,{label:"Cost Per Second",name:"input_cost_per_second",rules:[{validator:x}],className:"mb-4",children:(0,s.jsx)(le.oi,{})})]}),(0,s.jsx)(er.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)(ln,{href:"https://docs.litellm.ai/docs/pass_through/vertex_ai",target:"_blank",children:"Learn more"})]}),children:(0,s.jsx)(e7.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)(lr,{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)(er.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:li.Ac}],children:(0,s.jsx)(ll.Z,{rows:4,placeholder:'{ "rpm": 100, "timeout": 0, "stream_timeout": 0 }'})}),(0,s.jsxs)(eh.Z,{className:"mb-4",children:[(0,s.jsx)(ex.Z,{span:10}),(0,s.jsx)(ex.Z,{span:10,children:(0,s.jsxs)(le.xv,{className:"text-gray-600 text-sm",children:["Pass JSON of litellm supported params"," ",(0,s.jsx)(ln,{href:"https://docs.litellm.ai/docs/completion/input",target:"_blank",children:"litellm.completion() call"})]})})]}),(0,s.jsx)(er.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:li.Ac}],children:(0,s.jsx)(ll.Z,{rows:4,placeholder:'{ "mode": "chat" }'})})]})})]})})},ld=t(56609),lc=t(67187);let lm=e=>{let{content:l,children:t,width:a="auto",className:r=""}=e,[i,n]=(0,N.useState)(!1),[o,d]=(0,N.useState)("top"),c=(0,N.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)(lc.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 lu=()=>{let e=er.Z.useFormInstance(),[l,t]=(0,N.useState)(0),a=er.Z.useWatch("model",e)||[],r=Array.isArray(a)?a:[a],i=er.Z.useWatch("custom_model_name",e),n=!r.includes("all-wildcard"),o=er.Z.useWatch("custom_llm_provider",e);if((0,N.useEffect)(()=>{if(i&&r.includes("custom")){let l=(e.getFieldValue("model_mappings")||[]).map(e=>"custom"===e.public_name||"custom"===e.litellm_model?o===w.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,N.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===w.Cl.Azure?l.litellm_model==="azure/".concat(e):l.litellm_model===e))){let l=r.map(e=>"custom"===e&&i?o===w.Cl.Azure?{public_name:i,litellm_model:"azure/".concat(i)}:{public_name:i,litellm_model:i}:o===w.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)(lm,{content:d,width:"500px"})]}),dataIndex:"public_name",key:"public_name",render:(l,t,a)=>(0,s.jsx)(en.o,{value:l,onChange:l=>{let t=[...e.getFieldValue("model_mappings")];t[a].public_name=l.target.value,e.setFieldValue("model_mappings",t)}})},{title:(0,s.jsxs)("span",{className:"flex items-center",children:["LiteLLM Model Name",(0,s.jsx)(lm,{content:c,width:"360px"})]}),dataIndex:"litellm_model",key:"litellm_model"}];return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(er.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)(ld.Z,{dataSource:e.getFieldValue("model_mappings"),columns:m,pagination:!1,size:"small"},l)})})},lh=e=>{let{selectedProvider:l,providerModels:t,getPlaceholder:a}=e,r=er.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===w.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)(er.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)(er.Z.Item,{name:"model",rules:[{required:!0,message:"Please enter ".concat(l===w.Cl.Azure?"a deployment name":"at least one model",".")}],noStyle:!0,children:l===w.Cl.Azure||l===w.Cl.OpenAI_Compatible||l===w.Cl.Ollama?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(eu.o,{placeholder:a(l),onChange:l===w.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)(eo.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===w.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)(eu.o,{placeholder:a(l)})}),(0,s.jsx)(er.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)(er.Z.Item,{name:"custom_model_name",rules:[{required:!0,message:"Please enter a custom model name."}],className:"mt-2",children:(0,s.jsx)(eu.o,{placeholder:l===w.Cl.Azure?"Enter Azure deployment name":"Enter custom model name",onChange:i})})}})]}),(0,s.jsxs)(eh.Z,{children:[(0,s.jsx)(ex.Z,{span:10}),(0,s.jsx)(ex.Z,{span:14,children:(0,s.jsx)(eu.x,{className:"mb-3 mt-1",children:l===w.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 lx=[{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:lp,Link:lg}=D.default;var lf=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,[g,f]=(0,N.useState)("chat"),[j,v]=(0,N.useState)(!1),[_,y]=(0,N.useState)(!1),[C,k]=(0,N.useState)(""),{accessToken:S,userRole:A,premiumUser:E,userId:P}=(0,n.Z)(),{data:F,isLoading:M,error:I}=ec(),{data:T,isLoading:R,error:O}=e4(),{data:q,isLoading:V,error:z}=e6(),B=async()=>{y(!0),k("test-".concat(Date.now())),v(!0)},[H,J]=(0,N.useState)(!1),[W,Y]=(0,N.useState)([]),[$,Q]=(0,N.useState)(null);(0,N.useEffect)(()=>{(async()=>{Y((await (0,a.modelAvailableCall)(S,"","",!1,null,!0,!0)).data.map(e=>e.id))})()},[S]);let X=(0,N.useMemo)(()=>F?[...F].sort((e,l)=>e.provider_display_name.localeCompare(l.provider_display_name)):[],[F]),ee=I?I instanceof Error?I.message:"Failed to load providers":null,el=eC.ZL.includes(A),et=(0,eC.yV)(x,P);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lp,{level:2,children:"Add Model"}),(0,s.jsx)(G.Z,{children:(0,s.jsx)(er.Z,{form:l,onFinish:async e=>{console.log("\uD83D\uDD25 Form onFinish triggered with values:",e),await t().then(()=>{Q(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:[et&&!el&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(er.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)(e9.Z,{teams:x,onChange:e=>{Q(e)}})}),!$&&(0,s.jsx)(e8.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"})]}),(el||et&&$)&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(er.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)(eo.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:[ee&&0===X.length&&(0,s.jsx)(eo.default.Option,{value:"",children:ee},"__error"),X.map(e=>{let l=e.provider_display_name,t=e.provider;return w.cd[l],(0,s.jsx)(eo.default.Option,{value:t,"data-label":l,children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(Z,{provider:t,className:"w-5 h-5"}),(0,s.jsx)("span",{children:l})]})},t)})]})}),(0,s.jsx)(lh,{selectedProvider:r,providerModels:o,getPlaceholder:c}),(0,s.jsx)(lu,{}),(0,s.jsx)(er.Z.Item,{label:"Mode",name:"mode",className:"mb-1",children:(0,s.jsx)(eo.default,{style:{width:"100%"},value:g,onChange:e=>f(e),options:lx})}),(0,s.jsxs)(eh.Z,{children:[(0,s.jsx)(ex.Z,{span:10}),(0,s.jsx)(ex.Z,{span:10,children:(0,s.jsxs)(L.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)(lg,{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)(D.default.Text,{className:"text-sm text-gray-500 mb-2",children:"Either select existing credentials OR enter new provider credentials below"})}),(0,s.jsx)(er.Z.Item,{label:"Existing Credentials",name:"litellm_credential_name",initialValue:null,children:(0,s.jsx)(eo.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)(er.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)(e_,{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"})]}),(el||!et)&&(0,s.jsx)(er.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)(b.Z,{title:E?"":"This is an enterprise-only feature. Upgrade to premium to restrict model+credential combinations to a specific team.",placement:"top",children:(0,s.jsx)(e3.Z,{checked:H,onChange:e=>{J(e),e||l.setFieldValue("team_id",void 0)},disabled:!E})})}),H&&(el||!et)&&(0,s.jsx)(er.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:H&&!el,message:"Please select a team."}],children:(0,s.jsx)(e9.Z,{teams:x,disabled:!E})}),el&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(er.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)(eo.default,{mode:"tags",showSearch:!0,placeholder:"Select existing groups or type to create new ones",optionFilterProp:"children",tokenSeparators:[","],options:W.map(e=>({value:e,label:e})),maxTagCount:"responsive",allowClear:!0})})}),(0,s.jsx)(lo,{showAdvancedSettings:u,setShowAdvancedSettings:h,teams:x,guardrailsList:T||[],tagsList:q||{}})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(b.Z,{title:"Get help on our github",children:(0,s.jsx)(D.default.Link,{href:"https://github.com/BerriAI/litellm/issues",children:"Need Help?"})}),(0,s.jsxs)("div",{className:"space-x-2",children:[(0,s.jsx)(U.ZP,{onClick:B,loading:_,children:"Test Connect"}),(0,s.jsx)(U.ZP,{htmlType:"submit",children:"Add Model"})]})]})]})})}),(0,s.jsx)(K.Z,{title:"Connection Test Results",open:j,onCancel:()=>{v(!1),y(!1)},footer:[(0,s.jsx)(U.ZP,{onClick:()=>{v(!1),y(!1)},children:"Close"},"close")],width:700,children:j&&(0,s.jsx)(ez,{formValues:l.getFieldsValue(),accessToken:S,testMode:g,modelName:l.getFieldValue("model_name")||l.getFieldValue("model"),onClose:()=>{v(!1),y(!1)},onTestComplete:()=>y(!1)},C)})]})},lj=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]=er.Z.useForm();return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)(eI.v0,{className:"w-full",children:[(0,s.jsxs)(eI.td,{className:"mb-4",children:[(0,s.jsx)(eI.OK,{children:"Add Model"}),(0,s.jsx)(eI.OK,{children:"Add Auto Router"})]}),(0,s.jsxs)(eI.nP,{children:[(0,s.jsx)(eI.x4,{children:(0,s.jsx)(lf,{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)(eI.x4,{children:(0,s.jsx)(e1,{form:g,handleOk:()=>{g.validateFields().then(e=>{eB(e,x,g,t)}).catch(e=>{console.error("Validation failed:",e)})},accessToken:x,userRole:p})})]})]})})},lv=t(61994),l_=t(15731),ly=t(91126);let lb=(e,l,t,a,r,i,n,o,d,c,m)=>[{header:()=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(lv.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)(lv.Z,{checked:n,onChange:e=>a(i,e.target.checked),onClick:e=>e.stopPropagation()}),(0,s.jsx)(b.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)(b.Z,{title:a,children:(0,s.jsx)("div",{className:"truncate max-w-[200px]",children:a})})})}},{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)(eW.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)(b.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)(l_.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)(eW.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)(b.Z,{title:i,placement:"top",children:(0,s.jsx)(eW.x,{className:"text-red-600 text-sm truncate",children:i})})}),d&&n!==i&&(0,s.jsx)(b.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)(l_.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)(eW.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)(eW.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)(b.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)(ek.Z,{className:"h-4 w-4"}):(0,s.jsx)(ly.Z,{className:"h-4 w-4"})})})},enableSorting:!1}],lN=[{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 lw=e=>{let{accessToken:l,modelData:t,all_models_on_proxy:r,getDisplayModelName:i,setSelectedModelId:n}=e,[o,d]=(0,N.useState)({}),[c,m]=(0,N.useState)([]),[u,h]=(0,N.useState)(!1),[x,p]=(0,N.useState)(!1),[f,j]=(0,N.useState)(null),[y,b]=(0,N.useState)(!1),[w,Z]=(0,N.useState)(null);(0,N.useRef)(null),(0,N.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)}d(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 lN)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){d(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);d(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 d(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;d(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);d(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=c.length>0?c:r,s=e.reduce((e,l)=>(e[l]={...o[l],loading:!0,status:"checking"},e),{});d(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);d(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 d(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);d(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;d(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)}},A=e=>{h(e),e?m(r):m([])},E=()=>{p(!1),j(null)},P=()=>{b(!1),Z(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)(R.Z,{children:"Model Health Status"}),(0,s.jsx)(L.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:[c.length>0&&(0,s.jsx)(_.Z,{size:"sm",variant:"light",onClick:()=>A(!1),className:"px-3 py-1 text-sm",children:"Clear Selection"}),(0,s.jsx)(_.Z,{size:"sm",variant:"secondary",onClick:S,disabled:Object.values(o).some(e=>e.loading),className:"px-3 py-1 text-sm",children:c.length>0&&c.length{l?m(l=>[...l,e]):(m(l=>l.filter(l=>l!==e)),h(!1))},A,k,e=>{switch(e){case"healthy":return(0,s.jsx)(v.Z,{color:"emerald",children:"healthy"});case"unhealthy":return(0,s.jsx)(v.Z,{color:"red",children:"unhealthy"});case"checking":return(0,s.jsx)(v.Z,{color:"blue",children:"checking"});case"none":return(0,s.jsx)(v.Z,{color:"gray",children:"none"});default:return(0,s.jsx)(v.Z,{color:"gray",children:"unknown"})}},i,(e,l,t)=>{j({modelName:e,cleanedError:l,fullError:t}),p(!0)},(e,l)=>{Z({modelName:e,response:l}),b(!0)},n),data:t.data.map(e=>{let l=o[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)(K.Z,{title:f?"Health Check Error - ".concat(f.modelName):"Error Details",open:x,onCancel:E,footer:[(0,s.jsx)(U.ZP,{onClick:E,children:"Close"},"close")],width:800,children:f&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(L.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)(L.Z,{className:"text-red-800",children:f.cleanedError})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.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:f.fullError})})]})]})}),(0,s.jsx)(K.Z,{title:w?"Health Check Response - ".concat(w.modelName):"Response Details",open:y,onCancel:P,footer:[(0,s.jsx)(U.ZP,{onClick:P,children:"Close"},"close")],width:800,children:w&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(L.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)(L.Z,{className:"text-green-800",children:"Health check passed successfully"})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.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(w.response,null,2)})})]})]})})]})},lZ=t(86462),lC=t(47686),lk=t(77355),lS=t(93416),lA=t(95704),lE=e=>{let{accessToken:l,initialModelGroupAlias:t={},onAliasUpdate:r}=e,[i,n]=(0,N.useState)([]),[o,d]=(0,N.useState)({aliasName:"",targetModelGroup:""}),[c,m]=(0,N.useState)(null),[u,h]=(0,N.useState)(!0);(0,N.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),$.Z.fromBackend("Failed to save model group alias settings"),!1}},p=async()=>{if(!o.aliasName||!o.targetModelGroup){$.Z.fromBackend("Please provide both alias name and target model group");return}if(i.some(e=>e.aliasName===o.aliasName)){$.Z.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:""}),$.Z.success("Alias added successfully"))},g=e=>{m({...e})},f=async()=>{if(!c)return;if(!c.aliasName||!c.targetModelGroup){$.Z.fromBackend("Please provide both alias name and target model group");return}if(i.some(e=>e.id!==c.id&&e.aliasName===c.aliasName)){$.Z.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),$.Z.success("Alias updated successfully"))},v=()=>{m(null)},_=async e=>{let l=i.filter(l=>l.id!==e);await x(l)&&(n(l),$.Z.success("Alias deleted successfully"))},y=i.reduce((e,l)=>(e[l.aliasName]=l.targetModelGroup,e),{});return(0,s.jsxs)(lA.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)(lA.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)(lC.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)(lA.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)(lk.Z,{className:"w-4 h-4 mr-1"}),"Add Alias"]})})]})]}),(0,s.jsx)(lA.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)(lA.iA,{className:"[&_td]:py-0.5 [&_th]:py-1",children:[(0,s.jsx)(lA.ss,{children:(0,s.jsxs)(lA.SC,{children:[(0,s.jsx)(lA.xs,{className:"py-1 h-8",children:"Alias Name"}),(0,s.jsx)(lA.xs,{className:"py-1 h-8",children:"Target Model Group"}),(0,s.jsx)(lA.xs,{className:"py-1 h-8",children:"Actions"})]})}),(0,s.jsxs)(lA.RM,{children:[i.map(e=>(0,s.jsx)(lA.SC,{className:"h-8",children:c&&c.id===e.id?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(lA.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)(lA.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)(lA.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:f,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)(lA.pj,{className:"py-0.5 text-sm text-gray-900",children:e.aliasName}),(0,s.jsx)(lA.pj,{className:"py-0.5 text-sm text-gray-500",children:e.targetModelGroup}),(0,s.jsx)(lA.pj,{className:"py-0.5 whitespace-nowrap",children:(0,s.jsxs)("div",{className:"flex space-x-2",children:[(0,s.jsx)("button",{onClick:()=>g(e),className:"text-xs bg-blue-50 text-blue-600 px-2 py-1 rounded hover:bg-blue-100",children:(0,s.jsx)(lS.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)(j.Z,{className:"w-3 h-3"})})]})})]})},e.id)),0===i.length&&(0,s.jsx)(lA.SC,{children:(0,s.jsx)(lA.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)(lA.Zb,{children:[(0,s.jsx)(lA.Dx,{className:"mb-4",children:"Configuration Example"}),(0,s.jsx)(lA.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)})]})})]})]})]})},lP=t(10900),lF=t(12514),lL=t(49566),lM=t(30401),lI=t(78867),lT=t(59872),lR=e=>{let{isVisible:l,onCancel:t,onSuccess:r,modelData:i,accessToken:n,userRole:o}=e,[d]=er.Z.useForm(),[c,m]=(0,N.useState)(!1),[u,h]=(0,N.useState)([]),[x,p]=(0,N.useState)([]),[g,f]=(0,N.useState)(!1),[j,v]=(0,N.useState)(!1),[_,y]=(0,N.useState)(null);(0,N.useEffect)(()=>{l&&i&&b()},[l,i]),(0,N.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,eU.p)(n);p(e)}catch(e){console.error("Error fetching model info:",e)}};l&&(e(),t())},[l,n]);let b=()=>{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),y(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));f(!o.has(null===(a=i.litellm_params)||void 0===a?void 0:a.auto_router_default_model)),v(!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),$.Z.fromBackend("Error loading auto router configuration")}},w=async()=>{try{m(!0);let e=await d.validateFields(),l={...i.litellm_params,auto_router_config:JSON.stringify(_),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};$.Z.success("Auto router configuration updated successfully"),r(c),t()}catch(e){console.error("Error updating auto router:",e),$.Z.fromBackend("Failed to update auto router configuration")}finally{m(!1)}},Z=x.map(e=>({value:e.model_group,label:e.model_group}));return(0,s.jsx)(K.Z,{title:"Edit Auto Router Configuration",open:l,onCancel:t,footer:[(0,s.jsx)(U.ZP,{onClick:t,children:"Cancel"},"cancel"),(0,s.jsx)(U.ZP,{loading:c,onClick:w,children:"Save Changes"},"submit")],width:1e3,destroyOnClose:!0,children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(eu.x,{className:"text-gray-600",children:"Edit the auto router configuration including routing logic, default models, and access settings."}),(0,s.jsxs)(er.Z,{form:d,layout:"vertical",className:"space-y-4",children:[(0,s.jsx)(er.Z.Item,{label:"Auto Router Name",name:"auto_router_name",rules:[{required:!0,message:"Auto router name is required"}],children:(0,s.jsx)(eu.o,{placeholder:"e.g., auto_router_1, smart_routing"})}),(0,s.jsx)("div",{className:"w-full",children:(0,s.jsx)(eQ,{modelInfo:x,value:_,onChange:e=>{y(e)}})}),(0,s.jsx)(er.Z.Item,{label:"Default Model",name:"auto_router_default_model",rules:[{required:!0,message:"Default model is required"}],children:(0,s.jsx)(eo.default,{placeholder:"Select a default model",onChange:e=>{f("custom"===e)},options:[...Z,{value:"custom",label:"Enter custom model name"}],showSearch:!0})}),(0,s.jsx)(er.Z.Item,{label:"Embedding Model",name:"auto_router_embedding_model",children:(0,s.jsx)(eo.default,{placeholder:"Select an embedding model (optional)",onChange:e=>{v("custom"===e)},options:[...Z,{value:"custom",label:"Enter custom model name"}],showSearch:!0,allowClear:!0})}),"Admin"===o&&(0,s.jsx)(er.Z.Item,{label:"Model Access Groups",name:"model_access_group",tooltip:"Control who can access this auto router",children:(0,s.jsx)(eo.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:lO,Link:lq}=D.default;var lV=e=>{let{isVisible:l,onCancel:t,onAddCredential:a,existingCredential:r,setIsCredentialModalOpen:i}=e,[n]=er.Z.useForm();return console.log("existingCredential in add credentials tab: ".concat(JSON.stringify(r))),(0,s.jsx)(K.Z,{title:"Reuse Credentials",visible:l,onCancel:()=>{t(),n.resetFields()},footer:null,width:600,children:(0,s.jsxs)(er.Z,{form:n,onFinish:e=>{a(e),n.resetFields(),i(!1)},layout:"vertical",children:[(0,s.jsx)(er.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)(en.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)(er.Z.Item,{label:l,name:l,initialValue:t,children:(0,s.jsx)(en.o,{placeholder:"Enter ".concat(l),disabled:!0})},l)}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(b.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)(U.ZP,{onClick:()=>{t(),n.resetFields()},style:{marginRight:10},children:"Cancel"}),(0,s.jsx)(U.ZP,{htmlType:"submit",children:"Reuse Credentials"})]})]})]})})};function lD(e){var l,t,r,i,n,o,d,c,m,u,x,p,g,v,y,Z,C,E,P,M,I,T,O,q,V,D,z,B,G,H,J,W,Y,Q,X;let{modelId:ee,onClose:el,modelData:et,accessToken:es,userID:ea,userRole:en,onModelUpdate:ed,modelAccessGroups:ec}=e,[em]=er.Z.useForm(),[eu,eh]=(0,N.useState)(null),[ex,ep]=(0,N.useState)(!1),[ef,ej]=(0,N.useState)(!1),[ev,e_]=(0,N.useState)(!1),[ey,eb]=(0,N.useState)(!1),[eN,ew]=(0,N.useState)(!1),[eZ,eC]=(0,N.useState)(!1),[eS,eA]=(0,N.useState)(null),[eM,eI]=(0,N.useState)(!1),[eT,eR]=(0,N.useState)({}),[eO,eq]=(0,N.useState)(!1),[eV,eD]=(0,N.useState)([]),[ez,eB]=(0,N.useState)({}),eU=("Admin"===en||(null==et?void 0:null===(l=et.model_info)||void 0===l?void 0:l.created_by)===ea)&&(null==et?void 0:null===(t=et.model_info)||void 0===t?void 0:t.db_model),eG="Admin"===en,eH=(null==et?void 0:null===(r=et.litellm_params)||void 0===r?void 0:r.auto_router_config)!=null,{data:eK}=h();console.log("modelsInfoData, ",eK);let eJ=(null==et?void 0:null===(i=et.litellm_params)||void 0===i?void 0:i.litellm_credential_name)!=null&&(null==et?void 0:null===(n=et.litellm_params)||void 0===n?void 0:n.litellm_credential_name)!=void 0;console.log("usingExistingCredential, ",eJ),console.log("modelData.litellm_params.litellm_credential_name, ",null==et?void 0:null===(o=et.litellm_params)||void 0===o?void 0:o.litellm_credential_name),console.log("tagsList, ",null===(d=et.litellm_params)||void 0===d?void 0:d.tags),(0,N.useEffect)(()=>{let e=async()=>{var e,l,t,s,r,i,n;if(!es)return;let o=await (0,a.modelInfoV1Call)(es,ee);console.log("modelInfoResponse, ",o);let d=o.data[0];d&&!d.litellm_model_name&&(d={...d,litellm_model_name:null!==(n=null!==(i=null!==(r=null==d?void 0:null===(l=d.litellm_params)||void 0===l?void 0:l.litellm_model_name)&&void 0!==r?r:null==d?void 0:null===(t=d.litellm_params)||void 0===t?void 0:t.model)&&void 0!==i?i:null==d?void 0:null===(s=d.model_info)||void 0===s?void 0:s.key)&&void 0!==n?n:null}),eh(d),(null==d?void 0:null===(e=d.litellm_params)||void 0===e?void 0:e.cache_control_injection_points)&&eI(!0)},l=async()=>{if(es)try{let e=(await (0,a.getGuardrailsList)(es)).guardrails.map(e=>e.guardrail_name);eD(e)}catch(e){console.error("Failed to fetch guardrails:",e)}},t=async()=>{if(es)try{let e=await (0,a.tagListCall)(es);eB(e)}catch(e){console.error("Failed to fetch tags:",e)}};(async()=>{if(console.log("accessToken, ",es),!es||eJ)return;let e=await (0,a.credentialGetCall)(es,null,ee);console.log("existingCredentialResponse, ",e),eA({credential_name:e.credential_name,credential_values:e.credential_values,credential_info:e.credential_info})})(),e(),l(),t()},[es,ee]);let eW=async e=>{var l;if(console.log("values, ",e),!es)return;let t={credential_name:e.credential_name,model_id:ee,credential_info:{custom_llm_provider:null===(l=eu.litellm_params)||void 0===l?void 0:l.custom_llm_provider}};$.Z.info("Storing credential.."),console.log("credentialResponse, ",await (0,a.credentialCreateCall)(es,t)),$.Z.success("Credential stored successfully")},eY=async e=>{try{var l;let t;if(!es)return;ew(!0),console.log("values.model_name, ",e.model_name);let s={};try{s=e.litellm_extra_params?JSON.parse(e.litellm_extra_params):{}}catch(e){$.Z.fromBackend("Invalid JSON in LiteLLM Params"),ew(!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):et.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){$.Z.fromBackend("Invalid JSON in Model Info");return}let i={model_name:e.model_name,litellm_params:r,model_info:t};await (0,a.modelPatchUpdateCall)(es,i,ee);let n={...eu,model_name:e.model_name,litellm_model_name:e.litellm_model_name,litellm_params:r,model_info:t};eh(n),ed&&ed(n),$.Z.success("Model settings updated successfully"),eb(!1),eC(!1)}catch(e){console.error("Error updating model:",e),$.Z.fromBackend("Failed to update model settings")}finally{ew(!1)}};if(!et)return(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(_.Z,{icon:lP.Z,variant:"light",onClick:el,className:"mb-4",children:"Back to Models"}),(0,s.jsx)(L.Z,{children:"Model not found"})]});let e$=async()=>{if(es)try{var e,l,t;$.Z.info("Testing connection...");let s=await (0,a.testConnectionRequest)(es,{custom_llm_provider:eu.litellm_params.custom_llm_provider,litellm_credential_name:eu.litellm_params.litellm_credential_name,model:eu.litellm_model_name},{mode:null===(e=eu.model_info)||void 0===e?void 0:e.mode},null===(l=eu.model_info)||void 0===l?void 0:l.mode);if("success"===s.status)$.Z.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?$.Z.error("Error testing connection: "+(0,li.aS)(e.message,100)):$.Z.error("Error testing connection: "+String(e))}},eQ=async()=>{try{if(ej(!0),!es)return;await (0,a.modelDeleteCall)(es,ee),$.Z.success("Model deleted successfully"),ed&&ed({deleted:!0,model_info:{id:ee}}),el()}catch(e){console.error("Error deleting the model:",e),$.Z.fromBackend("Failed to delete model")}finally{ej(!1),ep(!1)}},eX=async(e,l)=>{await (0,lT.vQ)(e)&&(eR(e=>({...e,[l]:!0})),setTimeout(()=>{eR(e=>({...e,[l]:!1}))},2e3))},e0=et.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)(_.Z,{icon:lP.Z,variant:"light",onClick:el,className:"mb-4",children:"Back to Models"}),(0,s.jsxs)(R.Z,{children:["Public Model Name: ",k(et)]}),(0,s.jsxs)("div",{className:"flex items-center cursor-pointer",children:[(0,s.jsx)(L.Z,{className:"text-gray-500 font-mono",children:et.model_info.id}),(0,s.jsx)(U.ZP,{type:"text",size:"small",icon:eT["model-id"]?(0,s.jsx)(lM.Z,{size:12}):(0,s.jsx)(lI.Z,{size:12}),onClick:()=>eX(et.model_info.id,"model-id"),className:"left-2 z-10 transition-all duration-200 ".concat(eT["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)(_.Z,{variant:"secondary",icon:ek.Z,onClick:e$,className:"flex items-center gap-2","data-testid":"test-connection-button",children:"Test Connection"}),(0,s.jsx)(_.Z,{icon:f.Z,variant:"secondary",onClick:()=>e_(!0),className:"flex items-center",disabled:!eG,"data-testid":"reuse-credentials-button",children:"Re-use Credentials"}),(0,s.jsx)(_.Z,{icon:j.Z,variant:"secondary",onClick:()=>ep(!0),className:"flex items-center text-red-500 border-red-500 hover:text-red-700",disabled:!eU,"data-testid":"delete-model-button",children:"Delete Model"})]})]}),(0,s.jsxs)(eP.Z,{children:[(0,s.jsxs)(eF.Z,{className:"mb-6",children:[(0,s.jsx)(eE.Z,{children:"Overview"}),(0,s.jsx)(eE.Z,{children:"Raw JSON"})]}),(0,s.jsxs)(eL.Z,{children:[(0,s.jsxs)(F.Z,{children:[(0,s.jsxs)(A.Z,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6 mb-6",children:[(0,s.jsxs)(lF.Z,{children:[(0,s.jsx)(L.Z,{children:"Provider"}),(0,s.jsxs)("div",{className:"mt-2 flex items-center space-x-2",children:[et.provider&&(0,s.jsx)("img",{src:(0,w.dr)(et.provider).logo,alt:"".concat(et.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=et.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)(R.Z,{children:et.provider||"Not Set"})]})]}),(0,s.jsxs)(lF.Z,{children:[(0,s.jsx)(L.Z,{children:"LiteLLM Model"}),(0,s.jsx)("div",{className:"mt-2 overflow-hidden",children:(0,s.jsx)(b.Z,{title:et.litellm_model_name||"Not Set",children:(0,s.jsx)("div",{className:"break-all text-sm font-medium leading-relaxed cursor-pointer",children:et.litellm_model_name||"Not Set"})})})]}),(0,s.jsxs)(lF.Z,{children:[(0,s.jsx)(L.Z,{children:"Pricing"}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsxs)(L.Z,{children:["Input: $",et.input_cost,"/1M tokens"]}),(0,s.jsxs)(L.Z,{children:["Output: $",et.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"," ",et.model_info.created_at?new Date(et.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 ",et.model_info.created_by||"Not Set"]})]}),(0,s.jsxs)(lF.Z,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(R.Z,{children:"Model Settings"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[eH&&eU&&!eZ&&(0,s.jsx)(_.Z,{onClick:()=>eq(!0),className:"flex items-center",children:"Edit Auto Router"}),eU?!eZ&&(0,s.jsx)(_.Z,{onClick:()=>eC(!0),className:"flex items-center",children:"Edit Settings"}):(0,s.jsx)(b.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)(S.Z,{})})]})]}),eu?(0,s.jsx)(er.Z,{form:em,onFinish:eY,initialValues:{model_name:eu.model_name,litellm_model_name:eu.litellm_model_name,api_base:eu.litellm_params.api_base,custom_llm_provider:eu.litellm_params.custom_llm_provider,organization:eu.litellm_params.organization,tpm:eu.litellm_params.tpm,rpm:eu.litellm_params.rpm,max_retries:eu.litellm_params.max_retries,timeout:eu.litellm_params.timeout,stream_timeout:eu.litellm_params.stream_timeout,input_cost:eu.litellm_params.input_cost_per_token?1e6*eu.litellm_params.input_cost_per_token:(null===(c=eu.model_info)||void 0===c?void 0:c.input_cost_per_token)*1e6||null,output_cost:(null===(m=eu.litellm_params)||void 0===m?void 0:m.output_cost_per_token)?1e6*eu.litellm_params.output_cost_per_token:(null===(u=eu.model_info)||void 0===u?void 0:u.output_cost_per_token)*1e6||null,cache_control:null!==(x=eu.litellm_params)&&void 0!==x&&!!x.cache_control_injection_points,cache_control_injection_points:(null===(p=eu.litellm_params)||void 0===p?void 0:p.cache_control_injection_points)||[],model_access_group:Array.isArray(null===(g=eu.model_info)||void 0===g?void 0:g.access_groups)?eu.model_info.access_groups:[],guardrails:Array.isArray(null===(v=eu.litellm_params)||void 0===v?void 0:v.guardrails)?eu.litellm_params.guardrails:[],tags:Array.isArray(null===(y=eu.litellm_params)||void 0===y?void 0:y.tags)?eu.litellm_params.tags:[],health_check_model:e0?null===(Z=eu.model_info)||void 0===Z?void 0:Z.health_check_model:null,litellm_extra_params:JSON.stringify(eu.litellm_params||{},null,2)},layout:"vertical",onValuesChange:()=>eb(!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)(L.Z,{className:"font-medium",children:"Model Name"}),eZ?(0,s.jsx)(er.Z.Item,{name:"model_name",className:"mb-0",children:(0,s.jsx)(lL.Z,{placeholder:"Enter model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eu.model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"LiteLLM Model Name"}),eZ?(0,s.jsx)(er.Z.Item,{name:"litellm_model_name",className:"mb-0",children:(0,s.jsx)(lL.Z,{placeholder:"Enter LiteLLM model name"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:eu.litellm_model_name})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Input Cost (per 1M tokens)"}),eZ?(0,s.jsx)(er.Z.Item,{name:"input_cost",className:"mb-0",children:(0,s.jsx)(ls.Z,{placeholder:"Enter input cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eu?void 0:null===(C=eu.litellm_params)||void 0===C?void 0:C.input_cost_per_token)?((null===(E=eu.litellm_params)||void 0===E?void 0:E.input_cost_per_token)*1e6).toFixed(4):(null==eu?void 0:null===(P=eu.model_info)||void 0===P?void 0:P.input_cost_per_token)?(1e6*eu.model_info.input_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Output Cost (per 1M tokens)"}),eZ?(0,s.jsx)(er.Z.Item,{name:"output_cost",className:"mb-0",children:(0,s.jsx)(ls.Z,{placeholder:"Enter output cost"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null==eu?void 0:null===(M=eu.litellm_params)||void 0===M?void 0:M.output_cost_per_token)?(1e6*eu.litellm_params.output_cost_per_token).toFixed(4):(null==eu?void 0:null===(I=eu.model_info)||void 0===I?void 0:I.output_cost_per_token)?(1e6*eu.model_info.output_cost_per_token).toFixed(4):null})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"API Base"}),eZ?(0,s.jsx)(er.Z.Item,{name:"api_base",className:"mb-0",children:(0,s.jsx)(lL.Z,{placeholder:"Enter API base"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(T=eu.litellm_params)||void 0===T?void 0:T.api_base)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Custom LLM Provider"}),eZ?(0,s.jsx)(er.Z.Item,{name:"custom_llm_provider",className:"mb-0",children:(0,s.jsx)(lL.Z,{placeholder:"Enter custom LLM provider"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(O=eu.litellm_params)||void 0===O?void 0:O.custom_llm_provider)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Organization"}),eZ?(0,s.jsx)(er.Z.Item,{name:"organization",className:"mb-0",children:(0,s.jsx)(lL.Z,{placeholder:"Enter organization"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(q=eu.litellm_params)||void 0===q?void 0:q.organization)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"TPM (Tokens per Minute)"}),eZ?(0,s.jsx)(er.Z.Item,{name:"tpm",className:"mb-0",children:(0,s.jsx)(ls.Z,{placeholder:"Enter TPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(V=eu.litellm_params)||void 0===V?void 0:V.tpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"RPM (Requests per Minute)"}),eZ?(0,s.jsx)(er.Z.Item,{name:"rpm",className:"mb-0",children:(0,s.jsx)(ls.Z,{placeholder:"Enter RPM"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(D=eu.litellm_params)||void 0===D?void 0:D.rpm)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Max Retries"}),eZ?(0,s.jsx)(er.Z.Item,{name:"max_retries",className:"mb-0",children:(0,s.jsx)(ls.Z,{placeholder:"Enter max retries"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(z=eu.litellm_params)||void 0===z?void 0:z.max_retries)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Timeout (seconds)"}),eZ?(0,s.jsx)(er.Z.Item,{name:"timeout",className:"mb-0",children:(0,s.jsx)(ls.Z,{placeholder:"Enter timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(B=eu.litellm_params)||void 0===B?void 0:B.timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Stream Timeout (seconds)"}),eZ?(0,s.jsx)(er.Z.Item,{name:"stream_timeout",className:"mb-0",children:(0,s.jsx)(ls.Z,{placeholder:"Enter stream timeout"})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(G=eu.litellm_params)||void 0===G?void 0:G.stream_timeout)||"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Model Access Groups"}),eZ?(0,s.jsx)(er.Z.Item,{name:"model_access_group",className:"mb-0",children:(0,s.jsx)(eo.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==ec?void 0:ec.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(H=eu.model_info)||void 0===H?void 0:H.access_groups)?Array.isArray(eu.model_info.access_groups)?eu.model_info.access_groups.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eu.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":eu.model_info.access_groups:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(L.Z,{className:"font-medium",children:["Guardrails",(0,s.jsx)(b.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)(S.Z,{style:{marginLeft:"4px"}})})})]}),eZ?(0,s.jsx)(er.Z.Item,{name:"guardrails",className:"mb-0",children:(0,s.jsx)(eo.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:eV.map(e=>({value:e,label:e}))})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(J=eu.litellm_params)||void 0===J?void 0:J.guardrails)?Array.isArray(eu.litellm_params.guardrails)?eu.litellm_params.guardrails.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eu.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":eu.litellm_params.guardrails:"Not Set"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Tags"}),eZ?(0,s.jsx)(er.Z.Item,{name:"tags",className:"mb-0",children:(0,s.jsx)(eo.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(ez).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===(W=eu.litellm_params)||void 0===W?void 0:W.tags)?Array.isArray(eu.litellm_params.tags)?eu.litellm_params.tags.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:eu.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":eu.litellm_params.tags:"Not Set"})]}),e0&&(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Health Check Model"}),eZ?(0,s.jsx)(er.Z.Item,{name:"health_check_model",className:"mb-0",children:(0,s.jsx)(eo.default,{showSearch:!0,placeholder:"Select existing health check model",optionFilterProp:"children",allowClear:!0,options:(()=>{var e;let l=new Set;return null==eK?void 0:null===(e=eK.data)||void 0===e?void 0:e.filter(e=>e.provider===et.litellm_model_name.split("/")[0]&&e.model_name!==et.litellm_model_name).filter(e=>!l.has(e.model_name)&&(l.add(e.model_name),!0)).map(e=>({value:e.model_name,label:e.model_name}))})()})}):(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(Y=eu.model_info)||void 0===Y?void 0:Y.health_check_model)||"Not Set"})]}),eZ?(0,s.jsx)(lr,{form:em,showCacheControl:eM,onCacheControlChange:e=>eI(e)}):(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Cache Control"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:(null===(Q=eu.litellm_params)||void 0===Q?void 0:Q.cache_control_injection_points)?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"Enabled"}),(0,s.jsx)("div",{className:"mt-2",children:eu.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)(L.Z,{className:"font-medium",children:"Model Info"}),eZ?(0,s.jsx)(er.Z.Item,{name:"model_info",className:"mb-0",children:(0,s.jsx)(eg.default.TextArea,{rows:4,placeholder:'{"gpt-4": 100, "claude-v1": 200}',defaultValue:JSON.stringify(et.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(eu.model_info,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(L.Z,{className:"font-medium",children:["LiteLLM Params",(0,s.jsx)(b.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)(S.Z,{style:{marginLeft:"4px"}})})})]}),eZ?(0,s.jsx)(er.Z.Item,{name:"litellm_extra_params",rules:[{validator:li.Ac}],children:(0,s.jsx)(eg.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(eu.litellm_params,null,2)})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(L.Z,{className:"font-medium",children:"Team ID"}),(0,s.jsx)("div",{className:"mt-1 p-2 bg-gray-50 rounded",children:et.model_info.team_id||"Not Set"})]})]}),eZ&&(0,s.jsxs)("div",{className:"mt-6 flex justify-end gap-2",children:[(0,s.jsx)(_.Z,{variant:"secondary",onClick:()=>{em.resetFields(),eb(!1),eC(!1)},disabled:eN,children:"Cancel"}),(0,s.jsx)(_.Z,{variant:"primary",onClick:()=>em.submit(),loading:eN,children:"Save Changes"})]})]})}):(0,s.jsx)(L.Z,{children:"Loading..."})]})]}),(0,s.jsx)(F.Z,{children:(0,s.jsx)(lF.Z,{children:(0,s.jsx)("pre",{className:"bg-gray-100 p-4 rounded text-xs overflow-auto",children:JSON.stringify(et,null,2)})})})]})]}),(0,s.jsx)(ei.Z,{isOpen:ex,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==et?void 0:et.model_name)||"Not Set"},{label:"LiteLLM Model Name",value:(null==et?void 0:et.litellm_model_name)||"Not Set"},{label:"Provider",value:(null==et?void 0:et.provider)||"Not Set"},{label:"Created By",value:(null==et?void 0:null===(X=et.model_info)||void 0===X?void 0:X.created_by)||"Not Set"}],onCancel:()=>ep(!1),onOk:eQ,confirmLoading:ef}),ev&&!eJ?(0,s.jsx)(lV,{isVisible:ev,onCancel:()=>e_(!1),onAddCredential:eW,existingCredential:eS,setIsCredentialModalOpen:e_}):(0,s.jsx)(K.Z,{open:ev,onCancel:()=>e_(!1),title:"Using Existing Credential",children:(0,s.jsx)(L.Z,{children:et.litellm_params.litellm_credential_name})}),(0,s.jsx)(lR,{isVisible:eO,onCancel:()=>eq(!1),onSuccess:e=>{eh(e),ed&&ed(e)},modelData:eu||et,accessToken:es||"",userRole:en||""})]})}var lz=t(27593),lB=t(93542),lU=e=>{var l;let{premiumUser:t,teams:r}=e,{accessToken:i,token:o,userRole:c,userId:u}=(0,n.Z)(),[p]=er.Z.useForm(),[g,f]=(0,N.useState)(""),[j,v]=(0,N.useState)([]),[_,b]=(0,N.useState)(w.Cl.Anthropic),[Z,C]=(0,N.useState)(null),[S,E]=(0,N.useState)(null),[P,I]=(0,N.useState)(null),[R,O]=(0,N.useState)(0),[q,z]=(0,N.useState)({}),[B,U]=(0,N.useState)(!1),[G,H]=(0,N.useState)(null),[K,J]=(0,N.useState)(null),[W,Y]=(0,N.useState)(0),Q=(0,eS.NL)(),{data:X,isLoading:el,refetch:es}=h(),{data:ea,isLoading:ei}=m(),{data:en,isLoading:eo}=d(),ed=(null==en?void 0:en.credentials)||[],{data:ec,isLoading:em}=(0,x.L)(),eu=(0,N.useMemo)(()=>{if(!(null==X?void 0:X.data))return[];let e=new Set;for(let l of X.data)e.add(l.model_name);return Array.from(e).sort()},[null==X?void 0:X.data]),eh=(0,N.useMemo)(()=>{if(!(null==X?void 0:X.data))return[];let e=new Set;for(let l of X.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==X?void 0:X.data]),ex=(0,N.useMemo)(()=>{var e;return null==X?void 0:null===(e=X.data)||void 0===e?void 0:e.map(e=>e.model_name)},[null==X?void 0:X.data]),ep=e=>null!=ea&&"object"==typeof ea&&e in ea?ea[e].litellm_provider:"openai",eg=(0,N.useMemo)(()=>(null==X?void 0:X.data)?M(X,ep):{data:[]},[null==X?void 0:X.data,ep]),ef=c&&(0,eC.P4)(c),ej=c&&eC.lo.includes(c),ev=u&&(0,eC.yV)(r,u),e_=ej&&(null==ec?void 0:null===(l=ec.values)||void 0===l?void 0:l.disable_model_add_for_internal_users)===!0,ey=!ef&&(e_||!ev),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?$.Z.success("".concat(e.file.name," file uploaded successfully")):"error"===e.file.status&&$.Z.fromBackend("".concat(e.file.name," file upload failed."))}},eN=()=>{f(new Date().toLocaleString()),Q.invalidateQueries({queryKey:["models","list"]}),es()},ew=async()=>{if(i)try{let e={router_settings:{}};"global"===Z?(P&&(e.router_settings.retry_policy=P),$.Z.success("Global retry settings saved successfully")):(S&&(e.router_settings.model_group_retry_policy=S),$.Z.success("Retry settings saved successfully for ".concat(Z))),await (0,a.setCallbacksCall)(i,e)}catch(e){$.Z.fromBackend("Failed to save retry settings")}};if((0,N.useEffect)(()=>{if(!i||!o||!c||!u||!X)return;let e=async()=>{try{let e=(await (0,a.getCallbacksCall)(i,u,c)).router_settings,l=e.model_group_retry_policy,t=e.num_retries;E(l),I(e.retry_policy),O(t);let s=e.model_group_alias||{};z(s)}catch(e){console.error("Error fetching model data:",e)}};i&&o&&c&&u&&X&&e()},[i,o,c,u,X]),c&&"Admin Viewer"==c){let{Title:e,Paragraph:l}=D.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 eI=async()=>{try{let e=await p.validateFields();await et(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";$.Z.fromBackend("Please fill in the following required fields: ".concat(l))}};return(Object.keys(w.Cl).find(e=>w.Cl[e]===_),K)?(0,s.jsx)("div",{className:"w-full h-full",children:(0,s.jsx)(lB.Z,{teamId:K,onClose:()=>J(null),accessToken:i,is_team_admin:"Admin"===c,is_proxy_admin:"Proxy Admin"===c,userModels:ex,editTeam:!1,onUpdate:eN,premiumUser:t})}):(0,s.jsx)("div",{className:"w-full mx-4 h-[75vh]",children:(0,s.jsx)(A.Z,{numItems:1,className:"gap-2 p-8 w-full mt-2",children:(0,s.jsxs)(eA.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"}),eC.ZL.includes(c)?(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)(eM.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"})})]})]}),G&&!(el||ei||eo||em)?(0,s.jsx)(lD,{modelId:G,onClose:()=>{H(null)},modelData:eg.data.find(e=>e.model_info.id===G),accessToken:i,userID:u,userRole:c,onModelUpdate:e=>{Q.invalidateQueries({queryKey:["models","list"]}),eN()},modelAccessGroups:eh}):(0,s.jsxs)(eP.Z,{index:W,onIndexChange:Y,className:"gap-2 h-[75vh] w-full ",children:[(0,s.jsxs)(eF.Z,{className:"flex justify-between mt-2 w-full items-center",children:[(0,s.jsxs)("div",{className:"flex",children:[eC.ZL.includes(c)?(0,s.jsx)(eE.Z,{children:"All Models"}):(0,s.jsx)(eE.Z,{children:"Your Models"}),!ey&&(0,s.jsx)(eE.Z,{children:"Add Model"}),eC.ZL.includes(c)&&(0,s.jsx)(eE.Z,{children:"LLM Credentials"}),eC.ZL.includes(c)&&(0,s.jsx)(eE.Z,{children:"Pass-Through Endpoints"}),eC.ZL.includes(c)&&(0,s.jsx)(eE.Z,{children:"Health Status"}),eC.ZL.includes(c)&&(0,s.jsx)(eE.Z,{children:"Model Retry Settings"}),eC.ZL.includes(c)&&(0,s.jsx)(eE.Z,{children:"Model Group Alias"}),eC.ZL.includes(c)&&(0,s.jsx)(eE.Z,{children:"Price Data Reload"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[g&&(0,s.jsxs)(L.Z,{children:["Last Refreshed: ",g]}),(0,s.jsx)(y.Z,{icon:ek.Z,variant:"shadow",size:"xs",className:"self-center",onClick:eN})]})]}),(0,s.jsxs)(eL.Z,{children:[(0,s.jsx)(T,{selectedModelGroup:Z,setSelectedModelGroup:C,availableModelGroups:eu,availableModelAccessGroups:eh,setSelectedModelId:H,setSelectedTeamId:J}),!ey&&(0,s.jsx)(F.Z,{className:"h-full",children:(0,s.jsx)(lj,{form:p,handleOk:eI,selectedProvider:_,setSelectedProvider:b,providerModels:j,setProviderModelsFn:e=>{v((0,w.bK)(e,ea))},getPlaceholder:w.ph,uploadProps:eb,showAdvancedSettings:B,setShowAdvancedSettings:U,teams:r,credentials:ed,accessToken:i,userRole:c})}),(0,s.jsx)(F.Z,{children:(0,s.jsx)(eZ,{uploadProps:eb})}),(0,s.jsx)(F.Z,{children:(0,s.jsx)(lz.Z,{accessToken:i,userRole:c,userID:u,modelData:eg,premiumUser:t})}),(0,s.jsx)(F.Z,{children:(0,s.jsx)(lw,{accessToken:i,modelData:eg,all_models_on_proxy:ex,getDisplayModelName:k,setSelectedModelId:H})}),(0,s.jsx)(V,{selectedModelGroup:Z,setSelectedModelGroup:C,availableModelGroups:eu,globalRetryPolicy:P,setGlobalRetryPolicy:I,defaultRetry:R,modelGroupRetryPolicy:S,setModelGroupRetryPolicy:E,handleSaveRetrySettings:ew}),(0,s.jsx)(F.Z,{children:(0,s.jsx)(lE,{accessToken:i,initialModelGroupAlias:q,onAliasUpdate:z})}),(0,s.jsx)(ee,{})]})]})]})})})}},27593:function(e,l,t){t.d(l,{Z:function(){return Y}});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),w=t(12660),Z=t(15424),C=t(58760),k=t(5545),S=t(45246),A=t(96473),E=t(31283),P=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)(E.o,{placeholder:"Header Name",value:t,onChange:e=>o(l,e.target.value,a)}),(0,s.jsx)(E.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)(A.Z,{}),children:"Add Header"})]})},F=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)(F.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)(F.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)(Z.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},M=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),O=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)(Z.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)(Z.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)(Z.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:q}=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,A]=(0,a.useState)(""),[E,F]=(0,a.useState)(""),[I,R]=(0,a.useState)(!0),[q,V]=(0,a.useState)(!1),[D,z]=(0,a.useState)({}),B=()=>{m.resetFields(),A(""),F(""),R(!0),z({}),h(!1)},U=e=>{let l=e;e&&!e.startsWith("/")&&(l="/"+e),A(l),m.setFieldsValue({path:l})},G=async e=>{console.log("addPassThrough called with:",e),v(!0);try{!n&&"auth"in e&&delete e.auth,D&&Object.keys(D).length>0&&(e.guardrails=D),console.log("formValues: ".concat(JSON.stringify(e)));let s=(await (0,d.createPassThroughEndpoint)(l,e)).endpoints[0],a=[...i,s];t(a),M.Z.success("Pass-through endpoint created successfully"),m.resetFields(),A(""),F(""),R(!0),z({}),h(!1)}catch(e){M.Z.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)(w.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:G,layout:"vertical",className:"space-y-6",initialValues:{include_subpath:!0,path:S,target:E},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=>U(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:E,onChange:e=>{F(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:E,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)(Z.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)(P,{})})]}),(0,s.jsx)(T,{premiumUser:n,authEnabled:q,onAuthChange:e=>{V(e),m.setFieldsValue({auth:e})}}),(0,s.jsx)(O,{accessToken:l,value:D,onChange:z}),(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)(Z.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"})]})]})]})})]})},D=t(30078),z=t(4260),B=t(19015),U=t(87769),G=t(42208);let H=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)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var K=e=>{let{endpointData:l,onClose:t,accessToken:r,isAdmin:i,premiumUser:n=!1,onEndpointUpdated:o}=e,[c,m]=(0,a.useState)(l),[u,h]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),[g,f]=(0,a.useState)((null==l?void 0:l.auth)||!1),[j,v]=(0,a.useState)((null==l?void 0:l.guardrails)||{}),[y]=_.Z.useForm(),b=async e=>{try{if(!r||!(null==c?void 0:c.id))return;let l={};if(e.headers)try{l="string"==typeof e.headers?JSON.parse(e.headers):e.headers}catch(e){M.Z.fromBackend("Invalid JSON format for headers");return}let t={path:c.path,target:e.target,headers:l,include_subpath:e.include_subpath,cost_per_request:e.cost_per_request,auth:n?e.auth:void 0,guardrails:j&&Object.keys(j).length>0?j:void 0};await (0,d.updatePassThroughEndpoint)(r,c.id,t),m({...c,...t}),p(!1),o&&o()}catch(e){console.error("Error updating endpoint:",e),M.Z.fromBackend("Failed to update pass through endpoint")}},N=async()=>{try{if(!r||!(null==c?void 0:c.id))return;await (0,d.deletePassThroughEndpointsCall)(r,c.id),M.Z.success("Pass through endpoint deleted successfully"),t(),o&&o()}catch(e){console.error("Error deleting endpoint:",e),M.Z.fromBackend("Failed to delete pass through endpoint")}};return u?(0,s.jsx)("div",{className:"p-4",children:"Loading..."}):c?(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)(D.Dx,{children:["Pass Through Endpoint: ",c.path]}),(0,s.jsx)(D.xv,{className:"text-gray-500 font-mono",children:c.id})]})}),(0,s.jsxs)(D.v0,{children:[(0,s.jsxs)(D.td,{className:"mb-4",children:[(0,s.jsx)(D.OK,{children:"Overview"},"overview"),i?(0,s.jsx)(D.OK,{children:"Settings"},"settings"):(0,s.jsx)(s.Fragment,{})]}),(0,s.jsxs)(D.nP,{children:[(0,s.jsxs)(D.x4,{children:[(0,s.jsxs)(D.rj,{numItems:1,numItemsSm:2,numItemsLg:3,className:"gap-6",children:[(0,s.jsxs)(D.Zb,{children:[(0,s.jsx)(D.xv,{children:"Path"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(D.Dx,{className:"font-mono",children:c.path})})]}),(0,s.jsxs)(D.Zb,{children:[(0,s.jsx)(D.xv,{children:"Target"}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(D.Dx,{children:c.target})})]}),(0,s.jsxs)(D.Zb,{children:[(0,s.jsx)(D.xv,{children:"Configuration"}),(0,s.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(D.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Include Subpath":"Exact Path"})}),(0,s.jsx)("div",{children:(0,s.jsx)(D.Ct,{color:c.auth?"blue":"gray",children:c.auth?"Auth Required":"No Auth"})}),void 0!==c.cost_per_request&&(0,s.jsx)("div",{children:(0,s.jsxs)(D.xv,{children:["Cost per request: $",c.cost_per_request]})})]})]})]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(L,{pathValue:c.path,targetValue:c.target,includeSubpath:c.include_subpath||!1})}),c.headers&&Object.keys(c.headers).length>0&&(0,s.jsxs)(D.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Headers"}),(0,s.jsxs)(D.Ct,{color:"blue",children:[Object.keys(c.headers).length," headers configured"]})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(H,{value:c.headers})})]}),c.guardrails&&Object.keys(c.guardrails).length>0&&(0,s.jsxs)(D.Zb,{className:"mt-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Guardrails"}),(0,s.jsxs)(D.Ct,{color:"purple",children:[Object.keys(c.guardrails).length," guardrails configured"]})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:Object.entries(c.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)})})]})]}),i&&(0,s.jsx)(D.x4,{children:(0,s.jsxs)(D.Zb,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,s.jsx)(D.Dx,{children:"Pass Through Endpoint Settings"}),(0,s.jsx)("div",{className:"space-x-2",children:!x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(D.zx,{onClick:()=>p(!0),children:"Edit Settings"}),(0,s.jsx)(D.zx,{onClick:N,variant:"secondary",color:"red",children:"Delete Endpoint"})]})})]}),x?(0,s.jsxs)(_.Z,{form:y,onFinish:b,initialValues:{target:c.target,headers:c.headers?JSON.stringify(c.headers,null,2):"",include_subpath:c.include_subpath||!1,cost_per_request:c.cost_per_request,auth:c.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)(D.oi,{placeholder:"https://api.example.com"})}),(0,s.jsx)(_.Z.Item,{label:"Headers (JSON)",name:"headers",children:(0,s.jsx)(z.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)(B.Z,{min:0,step:.01,precision:2,placeholder:"0.00",addonBefore:"$"})}),(0,s.jsx)(T,{premiumUser:n,authEnabled:g,onAuthChange:e=>{f(e),y.setFieldsValue({auth:e})}}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(O,{accessToken:r||"",value:j,onChange:v})}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 mt-6",children:[(0,s.jsx)(k.ZP,{onClick:()=>p(!1),children:"Cancel"}),(0,s.jsx)(D.zx,{children:"Save Changes"})]})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Path"}),(0,s.jsx)("div",{className:"font-mono",children:c.path})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Target URL"}),(0,s.jsx)("div",{children:c.target})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Include Subpath"}),(0,s.jsx)(D.Ct,{color:c.include_subpath?"green":"gray",children:c.include_subpath?"Yes":"No"})]}),void 0!==c.cost_per_request&&(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Cost per Request"}),(0,s.jsxs)("div",{children:["$",c.cost_per_request]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Authentication Required"}),(0,s.jsx)(D.Ct,{color:c.auth?"green":"gray",children:c.auth?"Yes":"No"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)(D.xv,{className:"font-medium",children:"Headers"}),c.headers&&Object.keys(c.headers).length>0?(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(H,{value:c.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"})},J=t(12322);let W=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)(U.Z,{className:"w-4 h-4 text-gray-500"}):(0,s.jsx)(G.Z,{className:"w-4 h-4 text-gray-500"})})]})};var Y=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),[w,Z]=(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=>{Z(e),N(!0)},k=async()=>{if(null!=w&&l){try{await (0,d.deletePassThroughEndpointsCall)(l,w);let e=j.filter(e=>e.id!==w);v(e),M.Z.success("Endpoint deleted successfully.")}catch(e){console.error("Error deleting the endpoint:",e),M.Z.fromBackend("Error deleting the endpoint: "+e)}N(!1),Z(null)}},S=(e,l)=>{C(e)},A=[{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)(W,{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)(K,{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)(J.w,{data:j,columns:A,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),Z(null)},children:"Cancel"})]})]})]})})]})}},12322: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,getRowCanExpand:o,renderSubComponent:d,isLoading:c=!1,loadingMessage:m="\uD83D\uDE85 Loading logs...",noDataMessage:u="No logs found"}=e,h=(0,r.b7)({data:l,columns:t,getRowCanExpand:o,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)(),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:h.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:c?(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:m})})})}):h.getRowModel().rows.length>0?h.getRowModel().rows.map(e=>(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(n.SC,{className:"h-8",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))}),e.getIsExpanded()&&(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:u})})})})})]})})}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/7038-d0da4f296b52ff2c.js b/litellm/proxy/_experimental/out/_next/static/chunks/4470-3ef8ade20eaf2875.js similarity index 67% rename from litellm/proxy/_experimental/out/_next/static/chunks/7038-d0da4f296b52ff2c.js rename to litellm/proxy/_experimental/out/_next/static/chunks/4470-3ef8ade20eaf2875.js index a7b068b1e7..5b0b3033d0 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/7038-d0da4f296b52ff2c.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4470-3ef8ade20eaf2875.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7038],{83669:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{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:"check-circle",theme:"outlined"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},5540:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={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:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},41169:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={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"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},38434:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-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-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},10798:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"}}]},name:"filter",theme:"outlined"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},8881:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={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-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},3632:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),c=n(2265),o={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"},r=n(55015),l=c.forwardRef(function(e,t){return c.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:o}))})},41649:function(e,t,n){n.d(t,{Z:function(){return p}});var a=n(5853),c=n(2265),o=n(47187),r=n(7084),l=n(26898),i=n(13241),s=n(1153);let d={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},m={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},u=(0,s.fn)("Badge"),p=c.forwardRef((e,t)=>{let{color:n,icon:p,size:g=r.u8.SM,tooltip:f,className:h,children:b}=e,v=(0,a._T)(e,["color","icon","size","tooltip","className","children"]),x=p||null,{tooltipProps:y,getReferenceProps:k}=(0,o.l)();return c.createElement("span",Object.assign({ref:(0,s.lq)([t,y.refs.setReference]),className:(0,i.q)(u("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",n?(0,i.q)((0,s.bM)(n,l.K.background).bgColor,(0,s.bM)(n,l.K.iconText).textColor,(0,s.bM)(n,l.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,i.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),d[g].paddingX,d[g].paddingY,d[g].fontSize,h)},k,v),c.createElement(o.Z,Object.assign({text:f},y)),x?c.createElement(x,{className:(0,i.q)(u("icon"),"shrink-0 -ml-1 mr-1.5",m[g].height,m[g].width)}):null,c.createElement("span",{className:(0,i.q)(u("text"),"whitespace-nowrap")},b))});p.displayName="Badge"},30150:function(e,t,n){n.d(t,{Z:function(){return u}});var a=n(5853),c=n(2265);let o=e=>{var t=(0,a._T)(e,[]);return c.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),c.createElement("path",{d:"M12 4v16m8-8H4"}))},r=e=>{var t=(0,a._T)(e,[]);return c.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),c.createElement("path",{d:"M20 12H4"}))};var l=n(13241),i=n(1153),s=n(69262);let d="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",m="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",u=c.forwardRef((e,t)=>{let{onSubmit:n,enableStepper:u=!0,disabled:p,onValueChange:g,onChange:f}=e,h=(0,a._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),b=(0,c.useRef)(null),[v,x]=c.useState(!1),y=c.useCallback(()=>{x(!0)},[]),k=c.useCallback(()=>{x(!1)},[]),[w,C]=c.useState(!1),E=c.useCallback(()=>{C(!0)},[]),S=c.useCallback(()=>{C(!1)},[]);return c.createElement(s.Z,Object.assign({type:"number",ref:(0,i.lq)([b,t]),disabled:p,makeInputClassName:(0,i.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=b.current)||void 0===t?void 0:t.value;null==n||n(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&y(),"ArrowUp"===e.key&&E()},onKeyUp:e=>{"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&S()},onChange:e=>{p||(null==g||g(parseFloat(e.target.value)),null==f||f(e))},stepper:u?c.createElement("div",{className:(0,l.q)("flex justify-center align-middle")},c.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=b.current)||void 0===e||e.stepDown(),null===(t=b.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!p&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},c.createElement(r,{"data-testid":"step-down",className:(v?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),c.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=b.current)||void 0===e||e.stepUp(),null===(t=b.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!p&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},c.createElement(o,{"data-testid":"step-up",className:(w?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},h))});u.displayName="NumberInput"},16853:function(e,t,n){n.d(t,{Z:function(){return d}});var a=n(5853),c=n(96398),o=n(44140),r=n(2265),l=n(13241),i=n(1153);let s=(0,i.fn)("Textarea"),d=r.forwardRef((e,t)=>{let{value:n,defaultValue:d="",placeholder:m="Type...",error:u=!1,errorMessage:p,disabled:g=!1,className:f,onChange:h,onValueChange:b,autoHeight:v=!1}=e,x=(0,a._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[y,k]=(0,o.Z)(d,n),w=(0,r.useRef)(null),C=(0,c.Uh)(y);return(0,r.useEffect)(()=>{let e=w.current;if(v&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[v,w,y]),r.createElement(r.Fragment,null,r.createElement("textarea",Object.assign({ref:(0,i.lq)([w,t]),value:y,placeholder:m,disabled:g,className:(0,l.q)(s("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,c.um)(C,g,u),g?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",f),"data-testid":"text-area",onChange:e=>{null==h||h(e),k(e.target.value),null==b||b(e.target.value)}},x)),u&&p?r.createElement("p",{className:(0,l.q)(s("errorMessage"),"text-sm text-red-500 mt-1")},p):null)});d.displayName="Textarea"},67101:function(e,t,n){n.d(t,{Z:function(){return d}});var a=n(5853),c=n(13241),o=n(1153),r=n(2265),l=n(9496);let i=(0,o.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",d=r.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:o,numItemsMd:d,numItemsLg:m,children:u,className:p}=e,g=(0,a._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=s(n,l._m),h=s(o,l.LH),b=s(d,l.l5),v=s(m,l.N4),x=(0,c.q)(f,h,b,v);return r.createElement("div",Object.assign({ref:t,className:(0,c.q)(i("root"),"grid",x,p)},g),u)});d.displayName="Grid"},9496:function(e,t,n){n.d(t,{LH:function(){return c},N4:function(){return r},PT:function(){return l},SP:function(){return i},VS:function(){return s},_m:function(){return a},_w:function(){return d},l5:function(){return o}});let a={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"},c={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"},o={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"},r={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"}},44140:function(e,t,n){n.d(t,{Z:function(){return c}});var a=n(2265);let c=(e,t)=>{let n=void 0!==t,[c,o]=(0,a.useState)(e);return[n?t:c,e=>{n||o(e)}]}},44851:function(e,t,n){n.d(t,{default:function(){return X}});var a=n(2265),c=n(77565),o=n(36760),r=n.n(o),l=n(1119),i=n(83145),s=n(26365),d=n(41154),m=n(50506),u=n(32559),p=n(6989),g=n(45287),f=n(31686),h=n(11993),b=n(66632),v=n(95814),x=a.forwardRef(function(e,t){var n=e.prefixCls,c=e.forceRender,o=e.className,l=e.style,i=e.children,d=e.isActive,m=e.role,u=e.classNames,p=e.styles,g=a.useState(d||c),f=(0,s.Z)(g,2),b=f[0],v=f[1];return(a.useEffect(function(){(c||d)&&v(!0)},[c,d]),b)?a.createElement("div",{ref:t,className:r()("".concat(n,"-content"),(0,h.Z)((0,h.Z)({},"".concat(n,"-content-active"),d),"".concat(n,"-content-inactive"),!d),o),style:l,role:m},a.createElement("div",{className:r()("".concat(n,"-content-box"),null==u?void 0:u.body),style:null==p?void 0:p.body},i)):null});x.displayName="PanelContent";var y=["showArrow","headerClass","isActive","onItemClick","forceRender","className","classNames","styles","prefixCls","collapsible","accordion","panelKey","extra","header","expandIcon","openMotion","destroyInactivePanel","children"],k=a.forwardRef(function(e,t){var n=e.showArrow,c=e.headerClass,o=e.isActive,i=e.onItemClick,s=e.forceRender,d=e.className,m=e.classNames,u=void 0===m?{}:m,g=e.styles,k=void 0===g?{}:g,w=e.prefixCls,C=e.collapsible,E=e.accordion,S=e.panelKey,N=e.extra,Z=e.header,I=e.expandIcon,M=e.openMotion,O=e.destroyInactivePanel,z=e.children,j=(0,p.Z)(e,y),B="disabled"===C,R=(0,h.Z)((0,h.Z)((0,h.Z)({onClick:function(){null==i||i(S)},onKeyDown:function(e){("Enter"===e.key||e.keyCode===v.Z.ENTER||e.which===v.Z.ENTER)&&(null==i||i(S))},role:E?"tab":"button"},"aria-expanded",o),"aria-disabled",B),"tabIndex",B?-1:0),P="function"==typeof I?I(e):a.createElement("i",{className:"arrow"}),L=P&&a.createElement("div",(0,l.Z)({className:"".concat(w,"-expand-icon")},["header","icon"].includes(C)?R:{}),P),H=r()("".concat(w,"-item"),(0,h.Z)((0,h.Z)({},"".concat(w,"-item-active"),o),"".concat(w,"-item-disabled"),B),d),T=r()(c,"".concat(w,"-header"),(0,h.Z)({},"".concat(w,"-collapsible-").concat(C),!!C),u.header),A=(0,f.Z)({className:T,style:k.header},["header","icon"].includes(C)?{}:R);return a.createElement("div",(0,l.Z)({},j,{ref:t,className:H}),a.createElement("div",A,(void 0===n||n)&&L,a.createElement("span",(0,l.Z)({className:"".concat(w,"-header-text")},"header"===C?R:{}),Z),null!=N&&"boolean"!=typeof N&&a.createElement("div",{className:"".concat(w,"-extra")},N)),a.createElement(b.ZP,(0,l.Z)({visible:o,leavedClassName:"".concat(w,"-content-hidden")},M,{forceRender:s,removeOnLeave:O}),function(e,t){var n=e.className,c=e.style;return a.createElement(x,{ref:t,prefixCls:w,className:n,classNames:u,style:c,styles:k,isActive:o,forceRender:s,role:E?"tabpanel":void 0},z)}))}),w=["children","label","key","collapsible","onItemClick","destroyInactivePanel"],C=function(e,t){var n=t.prefixCls,c=t.accordion,o=t.collapsible,r=t.destroyInactivePanel,i=t.onItemClick,s=t.activeKey,d=t.openMotion,m=t.expandIcon;return e.map(function(e,t){var u=e.children,g=e.label,f=e.key,h=e.collapsible,b=e.onItemClick,v=e.destroyInactivePanel,x=(0,p.Z)(e,w),y=String(null!=f?f:t),C=null!=h?h:o,E=!1;return E=c?s[0]===y:s.indexOf(y)>-1,a.createElement(k,(0,l.Z)({},x,{prefixCls:n,key:y,panelKey:y,isActive:E,accordion:c,openMotion:d,expandIcon:m,header:g,collapsible:C,onItemClick:function(e){"disabled"!==C&&(i(e),null==b||b(e))},destroyInactivePanel:null!=v?v:r}),u)})},E=function(e,t,n){if(!e)return null;var c=n.prefixCls,o=n.accordion,r=n.collapsible,l=n.destroyInactivePanel,i=n.onItemClick,s=n.activeKey,d=n.openMotion,m=n.expandIcon,u=e.key||String(t),p=e.props,g=p.header,f=p.headerClass,h=p.destroyInactivePanel,b=p.collapsible,v=p.onItemClick,x=!1;x=o?s[0]===u:s.indexOf(u)>-1;var y=null!=b?b:r,k={key:u,panelKey:u,header:g,headerClass:f,isActive:x,prefixCls:c,destroyInactivePanel:null!=h?h:l,openMotion:d,accordion:o,children:e.props.children,onItemClick:function(e){"disabled"!==y&&(i(e),null==v||v(e))},expandIcon:m,collapsible:y};return"string"==typeof e.type?e:(Object.keys(k).forEach(function(e){void 0===k[e]&&delete k[e]}),a.cloneElement(e,k))},S=n(18242);function N(e){var t=e;if(!Array.isArray(t)){var n=(0,d.Z)(t);t="number"===n||"string"===n?[t]:[]}return t.map(function(e){return String(e)})}var Z=Object.assign(a.forwardRef(function(e,t){var n,c=e.prefixCls,o=void 0===c?"rc-collapse":c,d=e.destroyInactivePanel,p=e.style,f=e.accordion,h=e.className,b=e.children,v=e.collapsible,x=e.openMotion,y=e.expandIcon,k=e.activeKey,w=e.defaultActiveKey,Z=e.onChange,I=e.items,M=r()(o,h),O=(0,m.Z)([],{value:k,onChange:function(e){return null==Z?void 0:Z(e)},defaultValue:w,postState:N}),z=(0,s.Z)(O,2),j=z[0],B=z[1];(0,u.ZP)(!b,"[rc-collapse] `children` will be removed in next major version. Please use `items` instead.");var R=(n={prefixCls:o,accordion:f,openMotion:x,expandIcon:y,collapsible:v,destroyInactivePanel:void 0!==d&&d,onItemClick:function(e){return B(function(){return f?j[0]===e?[]:[e]:j.indexOf(e)>-1?j.filter(function(t){return t!==e}):[].concat((0,i.Z)(j),[e])})},activeKey:j},Array.isArray(I)?C(I,n):(0,g.Z)(b).map(function(e,t){return E(e,t,n)}));return a.createElement("div",(0,l.Z)({ref:t,className:M,style:p,role:f?"tablist":void 0},(0,S.Z)(e,{aria:!0,data:!0})),R)}),{Panel:k});Z.Panel;var I=n(18694),M=n(68710),O=n(19722),z=n(71744),j=n(33759);let B=a.forwardRef((e,t)=>{let{getPrefixCls:n}=a.useContext(z.E_),{prefixCls:c,className:o,showArrow:l=!0}=e,i=n("collapse",c),s=r()({["".concat(i,"-no-arrow")]:!l},o);return a.createElement(Z.Panel,Object.assign({ref:t},e,{prefixCls:i,className:s}))});var R=n(93463),P=n(12918),L=n(63074),H=n(99320),T=n(71140);let A=e=>{let{componentCls:t,contentBg:n,padding:a,headerBg:c,headerPadding:o,collapseHeaderPaddingSM:r,collapseHeaderPaddingLG:l,collapsePanelBorderRadius:i,lineWidth:s,lineType:d,colorBorder:m,colorText:u,colorTextHeading:p,colorTextDisabled:g,fontSizeLG:f,lineHeight:h,lineHeightLG:b,marginSM:v,paddingSM:x,paddingLG:y,paddingXS:k,motionDurationSlow:w,fontSizeIcon:C,contentPadding:E,fontHeight:S,fontHeightLG:N}=e,Z="".concat((0,R.bf)(s)," ").concat(d," ").concat(m);return{[t]:Object.assign(Object.assign({},(0,P.Wf)(e)),{backgroundColor:c,border:Z,borderRadius:i,"&-rtl":{direction:"rtl"},["& > ".concat(t,"-item")]:{borderBottom:Z,"&:first-child":{["\n &,\n & > ".concat(t,"-header")]:{borderRadius:"".concat((0,R.bf)(i)," ").concat((0,R.bf)(i)," 0 0")}},"&:last-child":{["\n &,\n & > ".concat(t,"-header")]:{borderRadius:"0 0 ".concat((0,R.bf)(i)," ").concat((0,R.bf)(i))}},["> ".concat(t,"-header")]:Object.assign(Object.assign({position:"relative",display:"flex",flexWrap:"nowrap",alignItems:"flex-start",padding:o,color:p,lineHeight:h,cursor:"pointer",transition:"all ".concat(w,", visibility 0s")},(0,P.Qy)(e)),{["> ".concat(t,"-header-text")]:{flex:"auto"},["".concat(t,"-expand-icon")]:{height:S,display:"flex",alignItems:"center",paddingInlineEnd:v},["".concat(t,"-arrow")]:Object.assign(Object.assign({},(0,P.Ro)()),{fontSize:C,transition:"transform ".concat(w),svg:{transition:"transform ".concat(w)}}),["".concat(t,"-header-text")]:{marginInlineEnd:"auto"}}),["".concat(t,"-collapsible-header")]:{cursor:"default",["".concat(t,"-header-text")]:{flex:"none",cursor:"pointer"},["".concat(t,"-expand-icon")]:{cursor:"pointer"}},["".concat(t,"-collapsible-icon")]:{cursor:"unset",["".concat(t,"-expand-icon")]:{cursor:"pointer"}}},["".concat(t,"-content")]:{color:u,backgroundColor:n,borderTop:Z,["& > ".concat(t,"-content-box")]:{padding:E},"&-hidden":{display:"none"}},"&-small":{["> ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{padding:r,paddingInlineStart:k,["> ".concat(t,"-expand-icon")]:{marginInlineStart:e.calc(x).sub(k).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:x}}},"&-large":{["> ".concat(t,"-item")]:{fontSize:f,lineHeight:b,["> ".concat(t,"-header")]:{padding:l,paddingInlineStart:a,["> ".concat(t,"-expand-icon")]:{height:N,marginInlineStart:e.calc(y).sub(a).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:y}}},["".concat(t,"-item:last-child")]:{borderBottom:0,["> ".concat(t,"-content")]:{borderRadius:"0 0 ".concat((0,R.bf)(i)," ").concat((0,R.bf)(i))}},["& ".concat(t,"-item-disabled > ").concat(t,"-header")]:{"\n &,\n & > .arrow\n ":{color:g,cursor:"not-allowed"}},["&".concat(t,"-icon-position-end")]:{["& > ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{["".concat(t,"-expand-icon")]:{order:1,paddingInlineEnd:0,paddingInlineStart:v}}}}})}},V=e=>{let{componentCls:t}=e,n="> ".concat(t,"-item > ").concat(t,"-header ").concat(t,"-arrow");return{["".concat(t,"-rtl")]:{[n]:{transform:"rotate(180deg)"}}}},W=e=>{let{componentCls:t,headerBg:n,borderlessContentPadding:a,borderlessContentBg:c,colorBorder:o}=e;return{["".concat(t,"-borderless")]:{backgroundColor:n,border:0,["> ".concat(t,"-item")]:{borderBottom:"1px solid ".concat(o)},["\n > ".concat(t,"-item:last-child,\n > ").concat(t,"-item:last-child ").concat(t,"-header\n ")]:{borderRadius:0},["> ".concat(t,"-item:last-child")]:{borderBottom:0},["> ".concat(t,"-item > ").concat(t,"-content")]:{backgroundColor:c,borderTop:0},["> ".concat(t,"-item > ").concat(t,"-content > ").concat(t,"-content-box")]:{padding:a}}}},q=e=>{let{componentCls:t,paddingSM:n}=e;return{["".concat(t,"-ghost")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-item")]:{borderBottom:0,["> ".concat(t,"-content")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-content-box")]:{paddingBlock:n}}}}}};var K=(0,H.I$)("Collapse",e=>{let t=(0,T.IX)(e,{collapseHeaderPaddingSM:"".concat((0,R.bf)(e.paddingXS)," ").concat((0,R.bf)(e.paddingSM)),collapseHeaderPaddingLG:"".concat((0,R.bf)(e.padding)," ").concat((0,R.bf)(e.paddingLG)),collapsePanelBorderRadius:e.borderRadiusLG});return[A(t),W(t),q(t),V(t),(0,L.Z)(t)]},e=>({headerPadding:"".concat(e.paddingSM,"px ").concat(e.padding,"px"),headerBg:e.colorFillAlter,contentPadding:"".concat(e.padding,"px 16px"),contentBg:e.colorBgContainer,borderlessContentPadding:"".concat(e.paddingXXS,"px 16px ").concat(e.padding,"px"),borderlessContentBg:"transparent"})),X=Object.assign(a.forwardRef((e,t)=>{let{getPrefixCls:n,direction:o,expandIcon:l,className:i,style:s}=(0,z.dj)("collapse"),{prefixCls:d,className:m,rootClassName:u,style:p,bordered:f=!0,ghost:h,size:b,expandIconPosition:v="start",children:x,destroyInactivePanel:y,destroyOnHidden:k,expandIcon:w}=e,C=(0,j.Z)(e=>{var t;return null!==(t=null!=b?b:e)&&void 0!==t?t:"middle"}),E=n("collapse",d),S=n(),[N,B,R]=K(E),P=a.useMemo(()=>"left"===v?"start":"right"===v?"end":v,[v]),L=null!=w?w:l,H=a.useCallback(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="function"==typeof L?L(e):a.createElement(c.Z,{rotate:e.isActive?"rtl"===o?-90:90:void 0,"aria-label":e.isActive?"expanded":"collapsed"});return(0,O.Tm)(t,()=>{var e;return{className:r()(null===(e=t.props)||void 0===e?void 0:e.className,"".concat(E,"-arrow"))}})},[L,E,o]),T=r()("".concat(E,"-icon-position-").concat(P),{["".concat(E,"-borderless")]:!f,["".concat(E,"-rtl")]:"rtl"===o,["".concat(E,"-ghost")]:!!h,["".concat(E,"-").concat(C)]:"middle"!==C},i,m,u,B,R),A=a.useMemo(()=>Object.assign(Object.assign({},(0,M.Z)(S)),{motionAppear:!1,leavedClassName:"".concat(E,"-content-hidden")}),[S,E]),V=a.useMemo(()=>x?(0,g.Z)(x).map((e,t)=>{var n,a;let c=e.props;if(null==c?void 0:c.disabled){let o=null!==(n=e.key)&&void 0!==n?n:String(t),r=Object.assign(Object.assign({},(0,I.Z)(e.props,["disabled"])),{key:o,collapsible:null!==(a=c.collapsible)&&void 0!==a?a:"disabled"});return(0,O.Tm)(e,r)}return e}):null,[x]);return N(a.createElement(Z,Object.assign({ref:t,openMotion:A},(0,I.Z)(e,["rootClassName"]),{expandIcon:H,prefixCls:E,className:T,style:Object.assign(Object.assign({},s),p),destroyInactivePanel:null!=k?k:y}),V))}),{Panel:B})},35631:function(e,t,n){n.d(t,{Z:function(){return z}});var a=n(83145),c=n(2265),o=n(36760),r=n.n(o),l=n(53253),i=n(6543),s=n(71744),d=n(91086),m=n(33759),u=n(77774),p=n(28617),g=n(40049),f=n(10353);let h=c.createContext({});h.Consumer;var b=n(19722),v=n(54998),x=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var c=0,a=Object.getOwnPropertySymbols(e);ct.indexOf(a[c])&&Object.prototype.propertyIsEnumerable.call(e,a[c])&&(n[a[c]]=e[a[c]]);return n};let y=c.forwardRef((e,t)=>{let n;let{prefixCls:a,children:o,actions:l,extra:i,styles:d,className:m,classNames:u,colStyle:p}=e,g=x(e,["prefixCls","children","actions","extra","styles","className","classNames","colStyle"]),{grid:f,itemLayout:y}=(0,c.useContext)(h),{getPrefixCls:k,list:w}=(0,c.useContext)(s.E_),C=e=>{var t,n;return r()(null===(n=null===(t=null==w?void 0:w.item)||void 0===t?void 0:t.classNames)||void 0===n?void 0:n[e],null==u?void 0:u[e])},E=e=>{var t,n;return Object.assign(Object.assign({},null===(n=null===(t=null==w?void 0:w.item)||void 0===t?void 0:t.styles)||void 0===n?void 0:n[e]),null==d?void 0:d[e])},S=k("list",a),N=l&&l.length>0&&c.createElement("ul",{className:r()("".concat(S,"-item-action"),C("actions")),key:"actions",style:E("actions")},l.map((e,t)=>c.createElement("li",{key:"".concat(S,"-item-action-").concat(t)},e,t!==l.length-1&&c.createElement("em",{className:"".concat(S,"-item-action-split")})))),Z=c.createElement(f?"div":"li",Object.assign({},g,f?{}:{ref:t},{className:r()("".concat(S,"-item"),{["".concat(S,"-item-no-flex")]:!("vertical"===y?!!i:(n=!1,c.Children.forEach(o,e=>{"string"==typeof e&&(n=!0)}),!(n&&c.Children.count(o)>1)))},m)}),"vertical"===y&&i?[c.createElement("div",{className:"".concat(S,"-item-main"),key:"content"},o,N),c.createElement("div",{className:r()("".concat(S,"-item-extra"),C("extra")),key:"extra",style:E("extra")},i)]:[o,N,(0,b.Tm)(i,{key:"extra"})]);return f?c.createElement(v.Z,{ref:t,flex:1,style:p},Z):Z});y.Meta=e=>{var{prefixCls:t,className:n,avatar:a,title:o,description:l}=e,i=x(e,["prefixCls","className","avatar","title","description"]);let{getPrefixCls:d}=(0,c.useContext)(s.E_),m=d("list",t),u=r()("".concat(m,"-item-meta"),n),p=c.createElement("div",{className:"".concat(m,"-item-meta-content")},o&&c.createElement("h4",{className:"".concat(m,"-item-meta-title")},o),l&&c.createElement("div",{className:"".concat(m,"-item-meta-description")},l));return c.createElement("div",Object.assign({},i,{className:u}),a&&c.createElement("div",{className:"".concat(m,"-item-meta-avatar")},a),(o||l)&&p)};var k=n(93463),w=n(12918),C=n(99320),E=n(71140);let S=e=>{let{listBorderedCls:t,componentCls:n,paddingLG:a,margin:c,itemPaddingSM:o,itemPaddingLG:r,marginLG:l,borderRadiusLG:i}=e,s=(0,k.bf)(e.calc(i).sub(e.lineWidth).equal());return{[t]:{border:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:i,["".concat(n,"-header")]:{borderRadius:"".concat(s," ").concat(s," 0 0")},["".concat(n,"-footer")]:{borderRadius:"0 0 ".concat(s," ").concat(s)},["".concat(n,"-header,").concat(n,"-footer,").concat(n,"-item")]:{paddingInline:a},["".concat(n,"-pagination")]:{margin:"".concat((0,k.bf)(c)," ").concat((0,k.bf)(l))}},["".concat(t).concat(n,"-sm")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:o}},["".concat(t).concat(n,"-lg")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:r}}}},N=e=>{let{componentCls:t,screenSM:n,screenMD:a,marginLG:c,marginSM:o,margin:r}=e;return{["@media screen and (max-width:".concat(a,"px)")]:{[t]:{["".concat(t,"-item")]:{["".concat(t,"-item-action")]:{marginInlineStart:c}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{["".concat(t,"-item-extra")]:{marginInlineStart:c}}}},["@media screen and (max-width: ".concat(n,"px)")]:{[t]:{["".concat(t,"-item")]:{flexWrap:"wrap",["".concat(t,"-action")]:{marginInlineStart:o}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{flexWrap:"wrap-reverse",["".concat(t,"-item-main")]:{minWidth:e.contentWidth},["".concat(t,"-item-extra")]:{margin:"auto auto ".concat((0,k.bf)(r))}}}}}},Z=e=>{let{componentCls:t,antCls:n,controlHeight:a,minHeight:c,paddingSM:o,marginLG:r,padding:l,itemPadding:i,colorPrimary:s,itemPaddingSM:d,itemPaddingLG:m,paddingXS:u,margin:p,colorText:g,colorTextDescription:f,motionDurationSlow:h,lineWidth:b,headerBg:v,footerBg:x,emptyTextPadding:y,metaMarginBottom:C,avatarMarginRight:E,titleMarginBottom:S,descriptionFontSize:N}=e;return{[t]:Object.assign(Object.assign({},(0,w.Wf)(e)),{position:"relative","--rc-virtual-list-scrollbar-bg":e.colorSplit,"*":{outline:"none"},["".concat(t,"-header")]:{background:v},["".concat(t,"-footer")]:{background:x},["".concat(t,"-header, ").concat(t,"-footer")]:{paddingBlock:o},["".concat(t,"-pagination")]:{marginBlockStart:r,["".concat(n,"-pagination-options")]:{textAlign:"start"}},["".concat(t,"-spin")]:{minHeight:c,textAlign:"center"},["".concat(t,"-items")]:{margin:0,padding:0,listStyle:"none"},["".concat(t,"-item")]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:i,color:g,["".concat(t,"-item-meta")]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",["".concat(t,"-item-meta-avatar")]:{marginInlineEnd:E},["".concat(t,"-item-meta-content")]:{flex:"1 0",width:0,color:g},["".concat(t,"-item-meta-title")]:{margin:"0 0 ".concat((0,k.bf)(e.marginXXS)," 0"),color:g,fontSize:e.fontSize,lineHeight:e.lineHeight,"> a":{color:g,transition:"all ".concat(h),"&:hover":{color:s}}},["".concat(t,"-item-meta-description")]:{color:f,fontSize:N,lineHeight:e.lineHeight}},["".concat(t,"-item-action")]:{flex:"0 0 auto",marginInlineStart:e.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:"0 ".concat((0,k.bf)(u)),color:f,fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},["".concat(t,"-item-action-split")]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:b,height:e.calc(e.fontHeight).sub(e.calc(e.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:e.colorSplit}}},["".concat(t,"-empty")]:{padding:"".concat((0,k.bf)(l)," 0"),color:f,fontSize:e.fontSizeSM,textAlign:"center"},["".concat(t,"-empty-text")]:{padding:y,color:e.colorTextDisabled,fontSize:e.fontSize,textAlign:"center"},["".concat(t,"-item-no-flex")]:{display:"block"}}),["".concat(t,"-grid ").concat(n,"-col > ").concat(t,"-item")]:{display:"block",maxWidth:"100%",marginBlockEnd:p,paddingBlock:0,borderBlockEnd:"none"},["".concat(t,"-vertical ").concat(t,"-item")]:{alignItems:"initial",["".concat(t,"-item-main")]:{display:"block",flex:1},["".concat(t,"-item-extra")]:{marginInlineStart:r},["".concat(t,"-item-meta")]:{marginBlockEnd:C,["".concat(t,"-item-meta-title")]:{marginBlockStart:0,marginBlockEnd:S,color:g,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}},["".concat(t,"-item-action")]:{marginBlockStart:l,marginInlineStart:"auto","> li":{padding:"0 ".concat((0,k.bf)(l)),"&:first-child":{paddingInlineStart:0}}}},["".concat(t,"-split ").concat(t,"-item")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit),"&:last-child":{borderBlockEnd:"none"}},["".concat(t,"-split ").concat(t,"-header")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-split").concat(t,"-empty ").concat(t,"-footer")]:{borderTop:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-loading ").concat(t,"-spin-nested-loading")]:{minHeight:a},["".concat(t,"-split").concat(t,"-something-after-last-item ").concat(n,"-spin-container > ").concat(t,"-items > ").concat(t,"-item:last-child")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-lg ").concat(t,"-item")]:{padding:m},["".concat(t,"-sm ").concat(t,"-item")]:{padding:d},["".concat(t,":not(").concat(t,"-vertical)")]:{["".concat(t,"-item-no-flex")]:{["".concat(t,"-item-action")]:{float:"right"}}}}};var I=(0,C.I$)("List",e=>{let t=(0,E.IX)(e,{listBorderedCls:"".concat(e.componentCls,"-bordered"),minHeight:e.controlHeightLG});return[Z(t),S(t),N(t)]},e=>({contentWidth:220,itemPadding:"".concat((0,k.bf)(e.paddingContentVertical)," 0"),itemPaddingSM:"".concat((0,k.bf)(e.paddingContentVerticalSM)," ").concat((0,k.bf)(e.paddingContentHorizontal)),itemPaddingLG:"".concat((0,k.bf)(e.paddingContentVerticalLG)," ").concat((0,k.bf)(e.paddingContentHorizontalLG)),headerBg:"transparent",footerBg:"transparent",emptyTextPadding:e.padding,metaMarginBottom:e.padding,avatarMarginRight:e.padding,titleMarginBottom:e.paddingSM,descriptionFontSize:e.fontSize})),M=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var c=0,a=Object.getOwnPropertySymbols(e);ct.indexOf(a[c])&&Object.prototype.propertyIsEnumerable.call(e,a[c])&&(n[a[c]]=e[a[c]]);return n};let O=c.forwardRef(function(e,t){let{pagination:n=!1,prefixCls:o,bordered:b=!1,split:v=!0,className:x,rootClassName:y,style:k,children:w,itemLayout:C,loadMore:E,grid:S,dataSource:N=[],size:Z,header:O,footer:z,loading:j=!1,rowKey:B,renderItem:R,locale:P}=e,L=M(e,["pagination","prefixCls","bordered","split","className","rootClassName","style","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]),H=n&&"object"==typeof n?n:{},[T,A]=c.useState(H.defaultCurrent||1),[V,W]=c.useState(H.defaultPageSize||10),{getPrefixCls:q,direction:K,className:X,style:_}=(0,s.dj)("list"),{renderEmpty:D}=c.useContext(s.E_),G=e=>(t,a)=>{var c;A(t),W(a),n&&(null===(c=null==n?void 0:n[e])||void 0===c||c.call(n,t,a))},U=G("onChange"),Y=G("onShowSizeChange"),F=!!(E||n||z),J=q("list",o),[$,Q,ee]=I(J),et=j;"boolean"==typeof et&&(et={spinning:et});let en=!!(null==et?void 0:et.spinning),ea=(0,m.Z)(Z),ec="";switch(ea){case"large":ec="lg";break;case"small":ec="sm"}let eo=r()(J,{["".concat(J,"-vertical")]:"vertical"===C,["".concat(J,"-").concat(ec)]:ec,["".concat(J,"-split")]:v,["".concat(J,"-bordered")]:b,["".concat(J,"-loading")]:en,["".concat(J,"-grid")]:!!S,["".concat(J,"-something-after-last-item")]:F,["".concat(J,"-rtl")]:"rtl"===K},X,x,y,Q,ee),er=(0,l.Z)({current:1,total:0,position:"bottom"},{total:N.length,current:T,pageSize:V},n||{}),el=Math.ceil(er.total/er.pageSize);er.current=Math.min(er.current,el);let ei=n&&c.createElement("div",{className:r()("".concat(J,"-pagination"))},c.createElement(g.Z,Object.assign({align:"end"},er,{onChange:U,onShowSizeChange:Y}))),es=(0,a.Z)(N);n&&N.length>(er.current-1)*er.pageSize&&(es=(0,a.Z)(N).splice((er.current-1)*er.pageSize,er.pageSize));let ed=Object.keys(S||{}).some(e=>["xs","sm","md","lg","xl","xxl"].includes(e)),em=(0,p.Z)(ed),eu=c.useMemo(()=>{for(let e=0;e{if(!S)return;let e=eu&&S[eu]?S[eu]:S.column;if(e)return{width:"".concat(100/e,"%"),maxWidth:"".concat(100/e,"%")}},[JSON.stringify(S),eu]),eg=en&&c.createElement("div",{style:{minHeight:53}});if(es.length>0){let e=es.map((e,t)=>{let n;return R?((n="function"==typeof B?B(e):B?e[B]:e.key)||(n="list-item-".concat(t)),c.createElement(c.Fragment,{key:n},R(e,t))):null});eg=S?c.createElement(u.Z,{gutter:S.gutter},c.Children.map(e,e=>c.createElement("div",{key:null==e?void 0:e.key,style:ep},e))):c.createElement("ul",{className:"".concat(J,"-items")},e)}else w||en||(eg=c.createElement("div",{className:"".concat(J,"-empty-text")},(null==P?void 0:P.emptyText)||(null==D?void 0:D("List"))||c.createElement(d.Z,{componentName:"List"})));let ef=er.position,eh=c.useMemo(()=>({grid:S,itemLayout:C}),[JSON.stringify(S),C]);return $(c.createElement(h.Provider,{value:eh},c.createElement("div",Object.assign({ref:t,style:Object.assign(Object.assign({},_),k),className:eo},L),("top"===ef||"both"===ef)&&ei,O&&c.createElement("div",{className:"".concat(J,"-header")},O),c.createElement(f.Z,Object.assign({},et),eg,w),z&&c.createElement("div",{className:"".concat(J,"-footer")},z),E||("bottom"===ef||"both"===ef)&&ei)))});O.Item=y;var z=O},30401:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(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"}]])},10900:function(e,t,n){var a=n(2265);let c=a.forwardRef(function(e,t){return a.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),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=c},86462:function(e,t,n){var a=n(2265);let c=a.forwardRef(function(e,t){return a.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),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});t.Z=c},74998:function(e,t,n){var a=n(2265);let c=a.forwardRef(function(e,t){return a.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),a.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=c}}]); \ No newline at end of file +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4470],{83669:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"}},{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:"check-circle",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},5540:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={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:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},41169:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={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"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},38434:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-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-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z"}}]},name:"file-text",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},10798:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z"}}]},name:"filter",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},8881:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={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-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z"}}]},name:"stop",theme:"outlined"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},3632:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),c={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"},r=n(55015),l=o.forwardRef(function(e,t){return o.createElement(r.Z,(0,a.Z)({},e,{ref:t,icon:c}))})},41649:function(e,t,n){n.d(t,{Z:function(){return p}});var a=n(5853),o=n(2265),c=n(47187),r=n(7084),l=n(26898),i=n(13241),s=n(1153);let d={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},m={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},u=(0,s.fn)("Badge"),p=o.forwardRef((e,t)=>{let{color:n,icon:p,size:g=r.u8.SM,tooltip:f,className:h,children:b}=e,v=(0,a._T)(e,["color","icon","size","tooltip","className","children"]),x=p||null,{tooltipProps:y,getReferenceProps:k}=(0,c.l)();return o.createElement("span",Object.assign({ref:(0,s.lq)([t,y.refs.setReference]),className:(0,i.q)(u("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",n?(0,i.q)((0,s.bM)(n,l.K.background).bgColor,(0,s.bM)(n,l.K.iconText).textColor,(0,s.bM)(n,l.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,i.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),d[g].paddingX,d[g].paddingY,d[g].fontSize,h)},k,v),o.createElement(c.Z,Object.assign({text:f},y)),x?o.createElement(x,{className:(0,i.q)(u("icon"),"shrink-0 -ml-1 mr-1.5",m[g].height,m[g].width)}):null,o.createElement("span",{className:(0,i.q)(u("text"),"whitespace-nowrap")},b))});p.displayName="Badge"},30150:function(e,t,n){n.d(t,{Z:function(){return u}});var a=n(5853),o=n(2265);let c=e=>{var t=(0,a._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M12 4v16m8-8H4"}))},r=e=>{var t=(0,a._T)(e,[]);return o.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),o.createElement("path",{d:"M20 12H4"}))};var l=n(13241),i=n(1153),s=n(69262);let d="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",m="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",u=o.forwardRef((e,t)=>{let{onSubmit:n,enableStepper:u=!0,disabled:p,onValueChange:g,onChange:f}=e,h=(0,a._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),b=(0,o.useRef)(null),[v,x]=o.useState(!1),y=o.useCallback(()=>{x(!0)},[]),k=o.useCallback(()=>{x(!1)},[]),[w,C]=o.useState(!1),E=o.useCallback(()=>{C(!0)},[]),S=o.useCallback(()=>{C(!1)},[]);return o.createElement(s.Z,Object.assign({type:"number",ref:(0,i.lq)([b,t]),disabled:p,makeInputClassName:(0,i.fn)("NumberInput"),onKeyDown:e=>{var t;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(t=b.current)||void 0===t?void 0:t.value;null==n||n(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&y(),"ArrowUp"===e.key&&E()},onKeyUp:e=>{"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&S()},onChange:e=>{p||(null==g||g(parseFloat(e.target.value)),null==f||f(e))},stepper:u?o.createElement("div",{className:(0,l.q)("flex justify-center align-middle")},o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=b.current)||void 0===e||e.stepDown(),null===(t=b.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!p&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(r,{"data-testid":"step-down",className:(v?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),o.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,t;p||(null===(e=b.current)||void 0===e||e.stepUp(),null===(t=b.current)||void 0===t||t.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!p&&m,d,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},o.createElement(c,{"data-testid":"step-up",className:(w?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},h))});u.displayName="NumberInput"},16853:function(e,t,n){n.d(t,{Z:function(){return d}});var a=n(5853),o=n(96398),c=n(44140),r=n(2265),l=n(13241),i=n(1153);let s=(0,i.fn)("Textarea"),d=r.forwardRef((e,t)=>{let{value:n,defaultValue:d="",placeholder:m="Type...",error:u=!1,errorMessage:p,disabled:g=!1,className:f,onChange:h,onValueChange:b,autoHeight:v=!1}=e,x=(0,a._T)(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[y,k]=(0,c.Z)(d,n),w=(0,r.useRef)(null),C=(0,o.Uh)(y);return(0,r.useEffect)(()=>{let e=w.current;if(v&&e){e.style.height="60px";let t=e.scrollHeight;e.style.height=t+"px"}},[v,w,y]),r.createElement(r.Fragment,null,r.createElement("textarea",Object.assign({ref:(0,i.lq)([w,t]),value:y,placeholder:m,disabled:g,className:(0,l.q)(s("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",(0,o.um)(C,g,u),g?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",f),"data-testid":"text-area",onChange:e=>{null==h||h(e),k(e.target.value),null==b||b(e.target.value)}},x)),u&&p?r.createElement("p",{className:(0,l.q)(s("errorMessage"),"text-sm text-red-500 mt-1")},p):null)});d.displayName="Textarea"},67101:function(e,t,n){n.d(t,{Z:function(){return d}});var a=n(5853),o=n(13241),c=n(1153),r=n(2265),l=n(9496);let i=(0,c.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",d=r.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:c,numItemsMd:d,numItemsLg:m,children:u,className:p}=e,g=(0,a._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),f=s(n,l._m),h=s(c,l.LH),b=s(d,l.l5),v=s(m,l.N4),x=(0,o.q)(f,h,b,v);return r.createElement("div",Object.assign({ref:t,className:(0,o.q)(i("root"),"grid",x,p)},g),u)});d.displayName="Grid"},9496:function(e,t,n){n.d(t,{LH:function(){return o},N4:function(){return r},PT:function(){return l},SP:function(){return i},VS:function(){return s},_m:function(){return a},_w:function(){return d},l5:function(){return c}});let a={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"},c={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"},r={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"}},44140:function(e,t,n){n.d(t,{Z:function(){return o}});var a=n(2265);let o=(e,t)=>{let n=void 0!==t,[o,c]=(0,a.useState)(e);return[n?t:o,e=>{n||c(e)}]}},44851:function(e,t,n){n.d(t,{default:function(){return X}});var a=n(2265),o=n(77565),c=n(36760),r=n.n(c),l=n(1119),i=n(83145),s=n(26365),d=n(41154),m=n(50506),u=n(32559),p=n(6989),g=n(45287),f=n(31686),h=n(11993),b=n(66632),v=n(95814),x=a.forwardRef(function(e,t){var n=e.prefixCls,o=e.forceRender,c=e.className,l=e.style,i=e.children,d=e.isActive,m=e.role,u=e.classNames,p=e.styles,g=a.useState(d||o),f=(0,s.Z)(g,2),b=f[0],v=f[1];return(a.useEffect(function(){(o||d)&&v(!0)},[o,d]),b)?a.createElement("div",{ref:t,className:r()("".concat(n,"-content"),(0,h.Z)((0,h.Z)({},"".concat(n,"-content-active"),d),"".concat(n,"-content-inactive"),!d),c),style:l,role:m},a.createElement("div",{className:r()("".concat(n,"-content-box"),null==u?void 0:u.body),style:null==p?void 0:p.body},i)):null});x.displayName="PanelContent";var y=["showArrow","headerClass","isActive","onItemClick","forceRender","className","classNames","styles","prefixCls","collapsible","accordion","panelKey","extra","header","expandIcon","openMotion","destroyInactivePanel","children"],k=a.forwardRef(function(e,t){var n=e.showArrow,o=e.headerClass,c=e.isActive,i=e.onItemClick,s=e.forceRender,d=e.className,m=e.classNames,u=void 0===m?{}:m,g=e.styles,k=void 0===g?{}:g,w=e.prefixCls,C=e.collapsible,E=e.accordion,S=e.panelKey,N=e.extra,Z=e.header,I=e.expandIcon,M=e.openMotion,O=e.destroyInactivePanel,j=e.children,z=(0,p.Z)(e,y),B="disabled"===C,R=(0,h.Z)((0,h.Z)((0,h.Z)({onClick:function(){null==i||i(S)},onKeyDown:function(e){("Enter"===e.key||e.keyCode===v.Z.ENTER||e.which===v.Z.ENTER)&&(null==i||i(S))},role:E?"tab":"button"},"aria-expanded",c),"aria-disabled",B),"tabIndex",B?-1:0),L="function"==typeof I?I(e):a.createElement("i",{className:"arrow"}),P=L&&a.createElement("div",(0,l.Z)({className:"".concat(w,"-expand-icon")},["header","icon"].includes(C)?R:{}),L),H=r()("".concat(w,"-item"),(0,h.Z)((0,h.Z)({},"".concat(w,"-item-active"),c),"".concat(w,"-item-disabled"),B),d),T=r()(o,"".concat(w,"-header"),(0,h.Z)({},"".concat(w,"-collapsible-").concat(C),!!C),u.header),A=(0,f.Z)({className:T,style:k.header},["header","icon"].includes(C)?{}:R);return a.createElement("div",(0,l.Z)({},z,{ref:t,className:H}),a.createElement("div",A,(void 0===n||n)&&P,a.createElement("span",(0,l.Z)({className:"".concat(w,"-header-text")},"header"===C?R:{}),Z),null!=N&&"boolean"!=typeof N&&a.createElement("div",{className:"".concat(w,"-extra")},N)),a.createElement(b.ZP,(0,l.Z)({visible:c,leavedClassName:"".concat(w,"-content-hidden")},M,{forceRender:s,removeOnLeave:O}),function(e,t){var n=e.className,o=e.style;return a.createElement(x,{ref:t,prefixCls:w,className:n,classNames:u,style:o,styles:k,isActive:c,forceRender:s,role:E?"tabpanel":void 0},j)}))}),w=["children","label","key","collapsible","onItemClick","destroyInactivePanel"],C=function(e,t){var n=t.prefixCls,o=t.accordion,c=t.collapsible,r=t.destroyInactivePanel,i=t.onItemClick,s=t.activeKey,d=t.openMotion,m=t.expandIcon;return e.map(function(e,t){var u=e.children,g=e.label,f=e.key,h=e.collapsible,b=e.onItemClick,v=e.destroyInactivePanel,x=(0,p.Z)(e,w),y=String(null!=f?f:t),C=null!=h?h:c,E=!1;return E=o?s[0]===y:s.indexOf(y)>-1,a.createElement(k,(0,l.Z)({},x,{prefixCls:n,key:y,panelKey:y,isActive:E,accordion:o,openMotion:d,expandIcon:m,header:g,collapsible:C,onItemClick:function(e){"disabled"!==C&&(i(e),null==b||b(e))},destroyInactivePanel:null!=v?v:r}),u)})},E=function(e,t,n){if(!e)return null;var o=n.prefixCls,c=n.accordion,r=n.collapsible,l=n.destroyInactivePanel,i=n.onItemClick,s=n.activeKey,d=n.openMotion,m=n.expandIcon,u=e.key||String(t),p=e.props,g=p.header,f=p.headerClass,h=p.destroyInactivePanel,b=p.collapsible,v=p.onItemClick,x=!1;x=c?s[0]===u:s.indexOf(u)>-1;var y=null!=b?b:r,k={key:u,panelKey:u,header:g,headerClass:f,isActive:x,prefixCls:o,destroyInactivePanel:null!=h?h:l,openMotion:d,accordion:c,children:e.props.children,onItemClick:function(e){"disabled"!==y&&(i(e),null==v||v(e))},expandIcon:m,collapsible:y};return"string"==typeof e.type?e:(Object.keys(k).forEach(function(e){void 0===k[e]&&delete k[e]}),a.cloneElement(e,k))},S=n(18242);function N(e){var t=e;if(!Array.isArray(t)){var n=(0,d.Z)(t);t="number"===n||"string"===n?[t]:[]}return t.map(function(e){return String(e)})}var Z=Object.assign(a.forwardRef(function(e,t){var n,o=e.prefixCls,c=void 0===o?"rc-collapse":o,d=e.destroyInactivePanel,p=e.style,f=e.accordion,h=e.className,b=e.children,v=e.collapsible,x=e.openMotion,y=e.expandIcon,k=e.activeKey,w=e.defaultActiveKey,Z=e.onChange,I=e.items,M=r()(c,h),O=(0,m.Z)([],{value:k,onChange:function(e){return null==Z?void 0:Z(e)},defaultValue:w,postState:N}),j=(0,s.Z)(O,2),z=j[0],B=j[1];(0,u.ZP)(!b,"[rc-collapse] `children` will be removed in next major version. Please use `items` instead.");var R=(n={prefixCls:c,accordion:f,openMotion:x,expandIcon:y,collapsible:v,destroyInactivePanel:void 0!==d&&d,onItemClick:function(e){return B(function(){return f?z[0]===e?[]:[e]:z.indexOf(e)>-1?z.filter(function(t){return t!==e}):[].concat((0,i.Z)(z),[e])})},activeKey:z},Array.isArray(I)?C(I,n):(0,g.Z)(b).map(function(e,t){return E(e,t,n)}));return a.createElement("div",(0,l.Z)({ref:t,className:M,style:p,role:f?"tablist":void 0},(0,S.Z)(e,{aria:!0,data:!0})),R)}),{Panel:k});Z.Panel;var I=n(18694),M=n(68710),O=n(19722),j=n(71744),z=n(33759);let B=a.forwardRef((e,t)=>{let{getPrefixCls:n}=a.useContext(j.E_),{prefixCls:o,className:c,showArrow:l=!0}=e,i=n("collapse",o),s=r()({["".concat(i,"-no-arrow")]:!l},c);return a.createElement(Z.Panel,Object.assign({ref:t},e,{prefixCls:i,className:s}))});var R=n(93463),L=n(12918),P=n(63074),H=n(99320),T=n(71140);let A=e=>{let{componentCls:t,contentBg:n,padding:a,headerBg:o,headerPadding:c,collapseHeaderPaddingSM:r,collapseHeaderPaddingLG:l,collapsePanelBorderRadius:i,lineWidth:s,lineType:d,colorBorder:m,colorText:u,colorTextHeading:p,colorTextDisabled:g,fontSizeLG:f,lineHeight:h,lineHeightLG:b,marginSM:v,paddingSM:x,paddingLG:y,paddingXS:k,motionDurationSlow:w,fontSizeIcon:C,contentPadding:E,fontHeight:S,fontHeightLG:N}=e,Z="".concat((0,R.bf)(s)," ").concat(d," ").concat(m);return{[t]:Object.assign(Object.assign({},(0,L.Wf)(e)),{backgroundColor:o,border:Z,borderRadius:i,"&-rtl":{direction:"rtl"},["& > ".concat(t,"-item")]:{borderBottom:Z,"&:first-child":{["\n &,\n & > ".concat(t,"-header")]:{borderRadius:"".concat((0,R.bf)(i)," ").concat((0,R.bf)(i)," 0 0")}},"&:last-child":{["\n &,\n & > ".concat(t,"-header")]:{borderRadius:"0 0 ".concat((0,R.bf)(i)," ").concat((0,R.bf)(i))}},["> ".concat(t,"-header")]:Object.assign(Object.assign({position:"relative",display:"flex",flexWrap:"nowrap",alignItems:"flex-start",padding:c,color:p,lineHeight:h,cursor:"pointer",transition:"all ".concat(w,", visibility 0s")},(0,L.Qy)(e)),{["> ".concat(t,"-header-text")]:{flex:"auto"},["".concat(t,"-expand-icon")]:{height:S,display:"flex",alignItems:"center",paddingInlineEnd:v},["".concat(t,"-arrow")]:Object.assign(Object.assign({},(0,L.Ro)()),{fontSize:C,transition:"transform ".concat(w),svg:{transition:"transform ".concat(w)}}),["".concat(t,"-header-text")]:{marginInlineEnd:"auto"}}),["".concat(t,"-collapsible-header")]:{cursor:"default",["".concat(t,"-header-text")]:{flex:"none",cursor:"pointer"},["".concat(t,"-expand-icon")]:{cursor:"pointer"}},["".concat(t,"-collapsible-icon")]:{cursor:"unset",["".concat(t,"-expand-icon")]:{cursor:"pointer"}}},["".concat(t,"-content")]:{color:u,backgroundColor:n,borderTop:Z,["& > ".concat(t,"-content-box")]:{padding:E},"&-hidden":{display:"none"}},"&-small":{["> ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{padding:r,paddingInlineStart:k,["> ".concat(t,"-expand-icon")]:{marginInlineStart:e.calc(x).sub(k).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:x}}},"&-large":{["> ".concat(t,"-item")]:{fontSize:f,lineHeight:b,["> ".concat(t,"-header")]:{padding:l,paddingInlineStart:a,["> ".concat(t,"-expand-icon")]:{height:N,marginInlineStart:e.calc(y).sub(a).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:y}}},["".concat(t,"-item:last-child")]:{borderBottom:0,["> ".concat(t,"-content")]:{borderRadius:"0 0 ".concat((0,R.bf)(i)," ").concat((0,R.bf)(i))}},["& ".concat(t,"-item-disabled > ").concat(t,"-header")]:{"\n &,\n & > .arrow\n ":{color:g,cursor:"not-allowed"}},["&".concat(t,"-icon-position-end")]:{["& > ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{["".concat(t,"-expand-icon")]:{order:1,paddingInlineEnd:0,paddingInlineStart:v}}}}})}},V=e=>{let{componentCls:t}=e,n="> ".concat(t,"-item > ").concat(t,"-header ").concat(t,"-arrow");return{["".concat(t,"-rtl")]:{[n]:{transform:"rotate(180deg)"}}}},W=e=>{let{componentCls:t,headerBg:n,borderlessContentPadding:a,borderlessContentBg:o,colorBorder:c}=e;return{["".concat(t,"-borderless")]:{backgroundColor:n,border:0,["> ".concat(t,"-item")]:{borderBottom:"1px solid ".concat(c)},["\n > ".concat(t,"-item:last-child,\n > ").concat(t,"-item:last-child ").concat(t,"-header\n ")]:{borderRadius:0},["> ".concat(t,"-item:last-child")]:{borderBottom:0},["> ".concat(t,"-item > ").concat(t,"-content")]:{backgroundColor:o,borderTop:0},["> ".concat(t,"-item > ").concat(t,"-content > ").concat(t,"-content-box")]:{padding:a}}}},q=e=>{let{componentCls:t,paddingSM:n}=e;return{["".concat(t,"-ghost")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-item")]:{borderBottom:0,["> ".concat(t,"-content")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-content-box")]:{paddingBlock:n}}}}}};var K=(0,H.I$)("Collapse",e=>{let t=(0,T.IX)(e,{collapseHeaderPaddingSM:"".concat((0,R.bf)(e.paddingXS)," ").concat((0,R.bf)(e.paddingSM)),collapseHeaderPaddingLG:"".concat((0,R.bf)(e.padding)," ").concat((0,R.bf)(e.paddingLG)),collapsePanelBorderRadius:e.borderRadiusLG});return[A(t),W(t),q(t),V(t),(0,P.Z)(t)]},e=>({headerPadding:"".concat(e.paddingSM,"px ").concat(e.padding,"px"),headerBg:e.colorFillAlter,contentPadding:"".concat(e.padding,"px 16px"),contentBg:e.colorBgContainer,borderlessContentPadding:"".concat(e.paddingXXS,"px 16px ").concat(e.padding,"px"),borderlessContentBg:"transparent"})),X=Object.assign(a.forwardRef((e,t)=>{let{getPrefixCls:n,direction:c,expandIcon:l,className:i,style:s}=(0,j.dj)("collapse"),{prefixCls:d,className:m,rootClassName:u,style:p,bordered:f=!0,ghost:h,size:b,expandIconPosition:v="start",children:x,destroyInactivePanel:y,destroyOnHidden:k,expandIcon:w}=e,C=(0,z.Z)(e=>{var t;return null!==(t=null!=b?b:e)&&void 0!==t?t:"middle"}),E=n("collapse",d),S=n(),[N,B,R]=K(E),L=a.useMemo(()=>"left"===v?"start":"right"===v?"end":v,[v]),P=null!=w?w:l,H=a.useCallback(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="function"==typeof P?P(e):a.createElement(o.Z,{rotate:e.isActive?"rtl"===c?-90:90:void 0,"aria-label":e.isActive?"expanded":"collapsed"});return(0,O.Tm)(t,()=>{var e;return{className:r()(null===(e=t.props)||void 0===e?void 0:e.className,"".concat(E,"-arrow"))}})},[P,E,c]),T=r()("".concat(E,"-icon-position-").concat(L),{["".concat(E,"-borderless")]:!f,["".concat(E,"-rtl")]:"rtl"===c,["".concat(E,"-ghost")]:!!h,["".concat(E,"-").concat(C)]:"middle"!==C},i,m,u,B,R),A=a.useMemo(()=>Object.assign(Object.assign({},(0,M.Z)(S)),{motionAppear:!1,leavedClassName:"".concat(E,"-content-hidden")}),[S,E]),V=a.useMemo(()=>x?(0,g.Z)(x).map((e,t)=>{var n,a;let o=e.props;if(null==o?void 0:o.disabled){let c=null!==(n=e.key)&&void 0!==n?n:String(t),r=Object.assign(Object.assign({},(0,I.Z)(e.props,["disabled"])),{key:c,collapsible:null!==(a=o.collapsible)&&void 0!==a?a:"disabled"});return(0,O.Tm)(e,r)}return e}):null,[x]);return N(a.createElement(Z,Object.assign({ref:t,openMotion:A},(0,I.Z)(e,["rootClassName"]),{expandIcon:H,prefixCls:E,className:T,style:Object.assign(Object.assign({},s),p),destroyInactivePanel:null!=k?k:y}),V))}),{Panel:B})},35631:function(e,t,n){n.d(t,{Z:function(){return j}});var a=n(83145),o=n(2265),c=n(36760),r=n.n(c),l=n(53253),i=n(6543),s=n(71744),d=n(91086),m=n(33759),u=n(77774),p=n(28617),g=n(40049),f=n(10353);let h=o.createContext({});h.Consumer;var b=n(19722),v=n(54998),x=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[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])&&(n[a[o]]=e[a[o]]);return n};let y=o.forwardRef((e,t)=>{let n;let{prefixCls:a,children:c,actions:l,extra:i,styles:d,className:m,classNames:u,colStyle:p}=e,g=x(e,["prefixCls","children","actions","extra","styles","className","classNames","colStyle"]),{grid:f,itemLayout:y}=(0,o.useContext)(h),{getPrefixCls:k,list:w}=(0,o.useContext)(s.E_),C=e=>{var t,n;return r()(null===(n=null===(t=null==w?void 0:w.item)||void 0===t?void 0:t.classNames)||void 0===n?void 0:n[e],null==u?void 0:u[e])},E=e=>{var t,n;return Object.assign(Object.assign({},null===(n=null===(t=null==w?void 0:w.item)||void 0===t?void 0:t.styles)||void 0===n?void 0:n[e]),null==d?void 0:d[e])},S=k("list",a),N=l&&l.length>0&&o.createElement("ul",{className:r()("".concat(S,"-item-action"),C("actions")),key:"actions",style:E("actions")},l.map((e,t)=>o.createElement("li",{key:"".concat(S,"-item-action-").concat(t)},e,t!==l.length-1&&o.createElement("em",{className:"".concat(S,"-item-action-split")})))),Z=o.createElement(f?"div":"li",Object.assign({},g,f?{}:{ref:t},{className:r()("".concat(S,"-item"),{["".concat(S,"-item-no-flex")]:!("vertical"===y?!!i:(n=!1,o.Children.forEach(c,e=>{"string"==typeof e&&(n=!0)}),!(n&&o.Children.count(c)>1)))},m)}),"vertical"===y&&i?[o.createElement("div",{className:"".concat(S,"-item-main"),key:"content"},c,N),o.createElement("div",{className:r()("".concat(S,"-item-extra"),C("extra")),key:"extra",style:E("extra")},i)]:[c,N,(0,b.Tm)(i,{key:"extra"})]);return f?o.createElement(v.Z,{ref:t,flex:1,style:p},Z):Z});y.Meta=e=>{var{prefixCls:t,className:n,avatar:a,title:c,description:l}=e,i=x(e,["prefixCls","className","avatar","title","description"]);let{getPrefixCls:d}=(0,o.useContext)(s.E_),m=d("list",t),u=r()("".concat(m,"-item-meta"),n),p=o.createElement("div",{className:"".concat(m,"-item-meta-content")},c&&o.createElement("h4",{className:"".concat(m,"-item-meta-title")},c),l&&o.createElement("div",{className:"".concat(m,"-item-meta-description")},l));return o.createElement("div",Object.assign({},i,{className:u}),a&&o.createElement("div",{className:"".concat(m,"-item-meta-avatar")},a),(c||l)&&p)};var k=n(93463),w=n(12918),C=n(99320),E=n(71140);let S=e=>{let{listBorderedCls:t,componentCls:n,paddingLG:a,margin:o,itemPaddingSM:c,itemPaddingLG:r,marginLG:l,borderRadiusLG:i}=e,s=(0,k.bf)(e.calc(i).sub(e.lineWidth).equal());return{[t]:{border:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorBorder),borderRadius:i,["".concat(n,"-header")]:{borderRadius:"".concat(s," ").concat(s," 0 0")},["".concat(n,"-footer")]:{borderRadius:"0 0 ".concat(s," ").concat(s)},["".concat(n,"-header,").concat(n,"-footer,").concat(n,"-item")]:{paddingInline:a},["".concat(n,"-pagination")]:{margin:"".concat((0,k.bf)(o)," ").concat((0,k.bf)(l))}},["".concat(t).concat(n,"-sm")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:c}},["".concat(t).concat(n,"-lg")]:{["".concat(n,"-item,").concat(n,"-header,").concat(n,"-footer")]:{padding:r}}}},N=e=>{let{componentCls:t,screenSM:n,screenMD:a,marginLG:o,marginSM:c,margin:r}=e;return{["@media screen and (max-width:".concat(a,"px)")]:{[t]:{["".concat(t,"-item")]:{["".concat(t,"-item-action")]:{marginInlineStart:o}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{["".concat(t,"-item-extra")]:{marginInlineStart:o}}}},["@media screen and (max-width: ".concat(n,"px)")]:{[t]:{["".concat(t,"-item")]:{flexWrap:"wrap",["".concat(t,"-action")]:{marginInlineStart:c}}},["".concat(t,"-vertical")]:{["".concat(t,"-item")]:{flexWrap:"wrap-reverse",["".concat(t,"-item-main")]:{minWidth:e.contentWidth},["".concat(t,"-item-extra")]:{margin:"auto auto ".concat((0,k.bf)(r))}}}}}},Z=e=>{let{componentCls:t,antCls:n,controlHeight:a,minHeight:o,paddingSM:c,marginLG:r,padding:l,itemPadding:i,colorPrimary:s,itemPaddingSM:d,itemPaddingLG:m,paddingXS:u,margin:p,colorText:g,colorTextDescription:f,motionDurationSlow:h,lineWidth:b,headerBg:v,footerBg:x,emptyTextPadding:y,metaMarginBottom:C,avatarMarginRight:E,titleMarginBottom:S,descriptionFontSize:N}=e;return{[t]:Object.assign(Object.assign({},(0,w.Wf)(e)),{position:"relative","--rc-virtual-list-scrollbar-bg":e.colorSplit,"*":{outline:"none"},["".concat(t,"-header")]:{background:v},["".concat(t,"-footer")]:{background:x},["".concat(t,"-header, ").concat(t,"-footer")]:{paddingBlock:c},["".concat(t,"-pagination")]:{marginBlockStart:r,["".concat(n,"-pagination-options")]:{textAlign:"start"}},["".concat(t,"-spin")]:{minHeight:o,textAlign:"center"},["".concat(t,"-items")]:{margin:0,padding:0,listStyle:"none"},["".concat(t,"-item")]:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:i,color:g,["".concat(t,"-item-meta")]:{display:"flex",flex:1,alignItems:"flex-start",maxWidth:"100%",["".concat(t,"-item-meta-avatar")]:{marginInlineEnd:E},["".concat(t,"-item-meta-content")]:{flex:"1 0",width:0,color:g},["".concat(t,"-item-meta-title")]:{margin:"0 0 ".concat((0,k.bf)(e.marginXXS)," 0"),color:g,fontSize:e.fontSize,lineHeight:e.lineHeight,"> a":{color:g,transition:"all ".concat(h),"&:hover":{color:s}}},["".concat(t,"-item-meta-description")]:{color:f,fontSize:N,lineHeight:e.lineHeight}},["".concat(t,"-item-action")]:{flex:"0 0 auto",marginInlineStart:e.marginXXL,padding:0,fontSize:0,listStyle:"none","& > li":{position:"relative",display:"inline-block",padding:"0 ".concat((0,k.bf)(u)),color:f,fontSize:e.fontSize,lineHeight:e.lineHeight,textAlign:"center","&:first-child":{paddingInlineStart:0}},["".concat(t,"-item-action-split")]:{position:"absolute",insetBlockStart:"50%",insetInlineEnd:0,width:b,height:e.calc(e.fontHeight).sub(e.calc(e.marginXXS).mul(2)).equal(),transform:"translateY(-50%)",backgroundColor:e.colorSplit}}},["".concat(t,"-empty")]:{padding:"".concat((0,k.bf)(l)," 0"),color:f,fontSize:e.fontSizeSM,textAlign:"center"},["".concat(t,"-empty-text")]:{padding:y,color:e.colorTextDisabled,fontSize:e.fontSize,textAlign:"center"},["".concat(t,"-item-no-flex")]:{display:"block"}}),["".concat(t,"-grid ").concat(n,"-col > ").concat(t,"-item")]:{display:"block",maxWidth:"100%",marginBlockEnd:p,paddingBlock:0,borderBlockEnd:"none"},["".concat(t,"-vertical ").concat(t,"-item")]:{alignItems:"initial",["".concat(t,"-item-main")]:{display:"block",flex:1},["".concat(t,"-item-extra")]:{marginInlineStart:r},["".concat(t,"-item-meta")]:{marginBlockEnd:C,["".concat(t,"-item-meta-title")]:{marginBlockStart:0,marginBlockEnd:S,color:g,fontSize:e.fontSizeLG,lineHeight:e.lineHeightLG}},["".concat(t,"-item-action")]:{marginBlockStart:l,marginInlineStart:"auto","> li":{padding:"0 ".concat((0,k.bf)(l)),"&:first-child":{paddingInlineStart:0}}}},["".concat(t,"-split ").concat(t,"-item")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit),"&:last-child":{borderBlockEnd:"none"}},["".concat(t,"-split ").concat(t,"-header")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-split").concat(t,"-empty ").concat(t,"-footer")]:{borderTop:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-loading ").concat(t,"-spin-nested-loading")]:{minHeight:a},["".concat(t,"-split").concat(t,"-something-after-last-item ").concat(n,"-spin-container > ").concat(t,"-items > ").concat(t,"-item:last-child")]:{borderBlockEnd:"".concat((0,k.bf)(e.lineWidth)," ").concat(e.lineType," ").concat(e.colorSplit)},["".concat(t,"-lg ").concat(t,"-item")]:{padding:m},["".concat(t,"-sm ").concat(t,"-item")]:{padding:d},["".concat(t,":not(").concat(t,"-vertical)")]:{["".concat(t,"-item-no-flex")]:{["".concat(t,"-item-action")]:{float:"right"}}}}};var I=(0,C.I$)("List",e=>{let t=(0,E.IX)(e,{listBorderedCls:"".concat(e.componentCls,"-bordered"),minHeight:e.controlHeightLG});return[Z(t),S(t),N(t)]},e=>({contentWidth:220,itemPadding:"".concat((0,k.bf)(e.paddingContentVertical)," 0"),itemPaddingSM:"".concat((0,k.bf)(e.paddingContentVerticalSM)," ").concat((0,k.bf)(e.paddingContentHorizontal)),itemPaddingLG:"".concat((0,k.bf)(e.paddingContentVerticalLG)," ").concat((0,k.bf)(e.paddingContentHorizontalLG)),headerBg:"transparent",footerBg:"transparent",emptyTextPadding:e.padding,metaMarginBottom:e.padding,avatarMarginRight:e.padding,titleMarginBottom:e.paddingSM,descriptionFontSize:e.fontSize})),M=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[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])&&(n[a[o]]=e[a[o]]);return n};let O=o.forwardRef(function(e,t){let{pagination:n=!1,prefixCls:c,bordered:b=!1,split:v=!0,className:x,rootClassName:y,style:k,children:w,itemLayout:C,loadMore:E,grid:S,dataSource:N=[],size:Z,header:O,footer:j,loading:z=!1,rowKey:B,renderItem:R,locale:L}=e,P=M(e,["pagination","prefixCls","bordered","split","className","rootClassName","style","children","itemLayout","loadMore","grid","dataSource","size","header","footer","loading","rowKey","renderItem","locale"]),H=n&&"object"==typeof n?n:{},[T,A]=o.useState(H.defaultCurrent||1),[V,W]=o.useState(H.defaultPageSize||10),{getPrefixCls:q,direction:K,className:X,style:_}=(0,s.dj)("list"),{renderEmpty:D}=o.useContext(s.E_),G=e=>(t,a)=>{var o;A(t),W(a),n&&(null===(o=null==n?void 0:n[e])||void 0===o||o.call(n,t,a))},U=G("onChange"),Y=G("onShowSizeChange"),F=!!(E||n||j),J=q("list",c),[$,Q,ee]=I(J),et=z;"boolean"==typeof et&&(et={spinning:et});let en=!!(null==et?void 0:et.spinning),ea=(0,m.Z)(Z),eo="";switch(ea){case"large":eo="lg";break;case"small":eo="sm"}let ec=r()(J,{["".concat(J,"-vertical")]:"vertical"===C,["".concat(J,"-").concat(eo)]:eo,["".concat(J,"-split")]:v,["".concat(J,"-bordered")]:b,["".concat(J,"-loading")]:en,["".concat(J,"-grid")]:!!S,["".concat(J,"-something-after-last-item")]:F,["".concat(J,"-rtl")]:"rtl"===K},X,x,y,Q,ee),er=(0,l.Z)({current:1,total:0,position:"bottom"},{total:N.length,current:T,pageSize:V},n||{}),el=Math.ceil(er.total/er.pageSize);er.current=Math.min(er.current,el);let ei=n&&o.createElement("div",{className:r()("".concat(J,"-pagination"))},o.createElement(g.Z,Object.assign({align:"end"},er,{onChange:U,onShowSizeChange:Y}))),es=(0,a.Z)(N);n&&N.length>(er.current-1)*er.pageSize&&(es=(0,a.Z)(N).splice((er.current-1)*er.pageSize,er.pageSize));let ed=Object.keys(S||{}).some(e=>["xs","sm","md","lg","xl","xxl"].includes(e)),em=(0,p.Z)(ed),eu=o.useMemo(()=>{for(let e=0;e{if(!S)return;let e=eu&&S[eu]?S[eu]:S.column;if(e)return{width:"".concat(100/e,"%"),maxWidth:"".concat(100/e,"%")}},[JSON.stringify(S),eu]),eg=en&&o.createElement("div",{style:{minHeight:53}});if(es.length>0){let e=es.map((e,t)=>{let n;return R?((n="function"==typeof B?B(e):B?e[B]:e.key)||(n="list-item-".concat(t)),o.createElement(o.Fragment,{key:n},R(e,t))):null});eg=S?o.createElement(u.Z,{gutter:S.gutter},o.Children.map(e,e=>o.createElement("div",{key:null==e?void 0:e.key,style:ep},e))):o.createElement("ul",{className:"".concat(J,"-items")},e)}else w||en||(eg=o.createElement("div",{className:"".concat(J,"-empty-text")},(null==L?void 0:L.emptyText)||(null==D?void 0:D("List"))||o.createElement(d.Z,{componentName:"List"})));let ef=er.position,eh=o.useMemo(()=>({grid:S,itemLayout:C}),[JSON.stringify(S),C]);return $(o.createElement(h.Provider,{value:eh},o.createElement("div",Object.assign({ref:t,style:Object.assign(Object.assign({},_),k),className:ec},P),("top"===ef||"both"===ef)&&ei,O&&o.createElement("div",{className:"".concat(J,"-header")},O),o.createElement(f.Z,Object.assign({},et),eg,w),j&&o.createElement("div",{className:"".concat(J,"-footer")},j),E||("bottom"===ef||"both"===ef)&&ei)))});O.Item=y;var j=O},30401:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(79205).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},78867:function(e,t,n){n.d(t,{Z:function(){return a}});let a=(0,n(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"}]])},10900:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.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),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});t.Z=o},86462:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.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),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"}))});t.Z=o},44633:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.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),a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"}))});t.Z=o},74998:function(e,t,n){var a=n(2265);let o=a.forwardRef(function(e,t){return a.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),a.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}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/4817-59d642defb0e86f2.js b/litellm/proxy/_experimental/out/_next/static/chunks/4817-59d642defb0e86f2.js new file mode 100644 index 0000000000..c7a16d38cd --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/4817-59d642defb0e86f2.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4817],{41649:function(e,r,t){"use strict";t.d(r,{Z:function(){return m}});var o=t(5853),n=t(2265),a=t(47187),i=t(7084),l=t(26898),d=t(13241),s=t(1153);let c={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},u={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},p=(0,s.fn)("Badge"),m=n.forwardRef((e,r)=>{let{color:t,icon:m,size:b=i.u8.SM,tooltip:g,className:f,children:h}=e,v=(0,o._T)(e,["color","icon","size","tooltip","className","children"]),x=m||null,{tooltipProps:k,getReferenceProps:w}=(0,a.l)();return n.createElement("span",Object.assign({ref:(0,s.lq)([r,k.refs.setReference]),className:(0,d.q)(p("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",t?(0,d.q)((0,s.bM)(t,l.K.background).bgColor,(0,s.bM)(t,l.K.iconText).textColor,(0,s.bM)(t,l.K.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):(0,d.q)("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),c[b].paddingX,c[b].paddingY,c[b].fontSize,f)},w,v),n.createElement(a.Z,Object.assign({text:g},k)),x?n.createElement(x,{className:(0,d.q)(p("icon"),"shrink-0 -ml-1 mr-1.5",u[b].height,u[b].width)}):null,n.createElement("span",{className:(0,d.q)(p("text"),"whitespace-nowrap")},h))});m.displayName="Badge"},47323:function(e,r,t){"use strict";t.d(r,{Z:function(){return g}});var o=t(5853),n=t(2265),a=t(47187),i=t(7084),l=t(13241),d=t(1153),s=t(26898);let c={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"}},p={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:""}},m=(e,r)=>{switch(e){case"simple":return{textColor:r?(0,d.bM)(r,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:r?(0,d.bM)(r,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,l.q)((0,d.bM)(r,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:r?(0,d.bM)(r,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,l.q)((0,d.bM)(r,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:r?(0,d.bM)(r,s.K.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:r?(0,l.q)((0,d.bM)(r,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:r?(0,d.bM)(r,s.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:r?(0,l.q)((0,d.bM)(r,s.K.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:r?(0,d.bM)(r,s.K.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:r?(0,l.q)((0,d.bM)(r,s.K.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},b=(0,d.fn)("Icon"),g=n.forwardRef((e,r)=>{let{icon:t,variant:s="simple",tooltip:g,size:f=i.u8.SM,color:h,className:v}=e,x=(0,o._T)(e,["icon","variant","tooltip","size","color","className"]),k=m(s,h),{tooltipProps:w,getReferenceProps:C}=(0,a.l)();return n.createElement("span",Object.assign({ref:(0,d.lq)([r,w.refs.setReference]),className:(0,l.q)(b("root"),"inline-flex shrink-0 items-center justify-center",k.bgColor,k.textColor,k.borderColor,k.ringColor,p[s].rounded,p[s].border,p[s].shadow,p[s].ring,c[f].paddingX,c[f].paddingY,v)},C,x),n.createElement(a.Z,Object.assign({text:g},w)),n.createElement(t,{className:(0,l.q)(b("icon"),"shrink-0",u[f].height,u[f].width)}))});g.displayName="Icon"},78489:function(e,r,t){"use strict";t.d(r,{Z:function(){return E}});var o=t(5853),n=t(47187),a=t(2265);let i=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],l=e=>({_s:e,status:i[e],isEnter:e<3,isMounted:6!==e,isResolved:2===e||e>4}),d=e=>e?6:5,s=(e,r)=>{switch(e){case 1:case 0:return 2;case 4:case 3:return d(r)}},c=e=>"object"==typeof e?[e.enter,e.exit]:[e,e],u=(e,r)=>setTimeout(()=>{isNaN(document.body.offsetTop)||e(r+1)},0),p=(e,r,t,o,n)=>{clearTimeout(o.current);let a=l(e);r(a),t.current=a,n&&n({current:a})},m=({enter:e=!0,exit:r=!0,preEnter:t,preExit:o,timeout:n,initialEntered:i,mountOnEnter:m,unmountOnExit:b,onStateChange:g}={})=>{let[f,h]=(0,a.useState)(()=>l(i?2:d(m))),v=(0,a.useRef)(f),x=(0,a.useRef)(),[k,w]=c(n),C=(0,a.useCallback)(()=>{let e=s(v.current._s,b);e&&p(e,h,v,x,g)},[g,b]);return[f,(0,a.useCallback)(n=>{let a=e=>{switch(p(e,h,v,x,g),e){case 1:k>=0&&(x.current=setTimeout(C,k));break;case 4:w>=0&&(x.current=setTimeout(C,w));break;case 0:case 3:x.current=u(a,e)}},i=v.current.isEnter;"boolean"!=typeof n&&(n=!i),n?i||a(e?t?0:1:2):i&&a(r?o?3:4:d(b))},[C,g,e,r,t,o,k,w,b]),C]};var b=t(7084),g=t(13241),f=t(1153);let h=e=>{var r=(0,o._T)(e,[]);return a.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),a.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),a.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 v=t(26898);let x={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"}},k=e=>"light"!==e?{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"}},w=(e,r)=>{switch(e){case"primary":return{textColor:r?(0,f.bM)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:r?(0,f.bM)("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:r?(0,f.bM)(r,v.K.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:r?(0,f.bM)(r,v.K.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:r?(0,f.bM)(r,v.K.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:r?(0,f.bM)(r,v.K.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:r?(0,f.bM)(r,v.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:r?(0,f.bM)(r,v.K.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,f.bM)("transparent").bgColor,hoverBgColor:r?(0,g.q)((0,f.bM)(r,v.K.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:r?(0,f.bM)(r,v.K.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:r?(0,f.bM)(r,v.K.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:r?(0,f.bM)(r,v.K.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:(0,f.bM)("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},C=(0,f.fn)("Button"),y=e=>{let{loading:r,iconSize:t,iconPosition:o,Icon:n,needMargin:i,transitionStatus:l}=e,d=i?o===b.zS.Left?(0,g.q)("-ml-1","mr-1.5"):(0,g.q)("-mr-1","ml-1.5"):"",s=(0,g.q)("w-0 h-0"),c={default:s,entering:s,entered:t,exiting:t,exited:s};return r?a.createElement(h,{className:(0,g.q)(C("icon"),"animate-spin shrink-0",d,c.default,c[l]),style:{transition:"width 150ms"}}):a.createElement(n,{className:(0,g.q)(C("icon"),"shrink-0",t,d)})},E=a.forwardRef((e,r)=>{let{icon:t,iconPosition:i=b.zS.Left,size:l=b.u8.SM,color:d,variant:s="primary",disabled:c,loading:u=!1,loadingText:p,children:h,tooltip:v,className:E}=e,S=(0,o._T)(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),M=u||c,N=void 0!==t||u,T=u&&p,j=!(!h&&!T),I=(0,g.q)(x[l].height,x[l].width),O="light"!==s?(0,g.q)("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",z=w(s,d),P=k(s)[l],{tooltipProps:q,getReferenceProps:B}=(0,n.l)(300),[R,D]=m({timeout:50});return(0,a.useEffect)(()=>{D(u)},[u]),a.createElement("button",Object.assign({ref:(0,f.lq)([r,q.refs.setReference]),className:(0,g.q)(C("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",O,P.paddingX,P.paddingY,P.fontSize,z.textColor,z.bgColor,z.borderColor,z.hoverBorderColor,M?"opacity-50 cursor-not-allowed":(0,g.q)(w(s,d).hoverTextColor,w(s,d).hoverBgColor,w(s,d).hoverBorderColor),E),disabled:M},B,S),a.createElement(n.Z,Object.assign({text:v},q)),N&&i!==b.zS.Right?a.createElement(y,{loading:u,iconSize:I,iconPosition:i,Icon:t,transitionStatus:R.status,needMargin:j}):null,T||h?a.createElement("span",{className:(0,g.q)(C("text"),"text-tremor-default whitespace-nowrap")},T?p:h):null,N&&i===b.zS.Right?a.createElement(y,{loading:u,iconSize:I,iconPosition:i,Icon:t,transitionStatus:R.status,needMargin:j}):null)});E.displayName="Button"},30150:function(e,r,t){"use strict";t.d(r,{Z:function(){return p}});var o=t(5853),n=t(2265);let a=e=>{var r=(0,o._T)(e,[]);return n.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),n.createElement("path",{d:"M12 4v16m8-8H4"}))},i=e=>{var r=(0,o._T)(e,[]);return n.createElement("svg",Object.assign({},r,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),n.createElement("path",{d:"M20 12H4"}))};var l=t(13241),d=t(1153),s=t(69262);let c="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",u="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",p=n.forwardRef((e,r)=>{let{onSubmit:t,enableStepper:p=!0,disabled:m,onValueChange:b,onChange:g}=e,f=(0,o._T)(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),h=(0,n.useRef)(null),[v,x]=n.useState(!1),k=n.useCallback(()=>{x(!0)},[]),w=n.useCallback(()=>{x(!1)},[]),[C,y]=n.useState(!1),E=n.useCallback(()=>{y(!0)},[]),S=n.useCallback(()=>{y(!1)},[]);return n.createElement(s.Z,Object.assign({type:"number",ref:(0,d.lq)([h,r]),disabled:m,makeInputClassName:(0,d.fn)("NumberInput"),onKeyDown:e=>{var r;if("Enter"===e.key&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){let e=null===(r=h.current)||void 0===r?void 0:r.value;null==t||t(parseFloat(null!=e?e:""))}"ArrowDown"===e.key&&k(),"ArrowUp"===e.key&&E()},onKeyUp:e=>{"ArrowDown"===e.key&&w(),"ArrowUp"===e.key&&S()},onChange:e=>{m||(null==b||b(parseFloat(e.target.value)),null==g||g(e))},stepper:p?n.createElement("div",{className:(0,l.q)("flex justify-center align-middle")},n.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,r;m||(null===(e=h.current)||void 0===e||e.stepDown(),null===(r=h.current)||void 0===r||r.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!m&&u,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},n.createElement(i,{"data-testid":"step-down",className:(v?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),n.createElement("div",{tabIndex:-1,onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault(),onTouchStart:e=>{e.cancelable&&e.preventDefault()},onMouseUp:()=>{var e,r;m||(null===(e=h.current)||void 0===e||e.stepUp(),null===(r=h.current)||void 0===r||r.dispatchEvent(new Event("input",{bubbles:!0})))},className:(0,l.q)(!m&&u,c,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},n.createElement(a,{"data-testid":"step-up",className:(C?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},f))});p.displayName="NumberInput"},87452:function(e,r,t){"use strict";t.d(r,{Z:function(){return u},r:function(){return c}});var o=t(5853),n=t(91054);t(42698),t(64016);var a=t(8710);t(33232);var i=t(13241),l=t(1153),d=t(2265);let s=(0,l.fn)("Accordion"),c=(0,d.createContext)({isOpen:!1}),u=d.forwardRef((e,r)=>{var t;let{defaultOpen:l=!1,children:u,className:p}=e,m=(0,o._T)(e,["defaultOpen","children","className"]),b=null!==(t=(0,d.useContext)(a.Z))&&void 0!==t?t:(0,i.q)("rounded-tremor-default border");return d.createElement(n.pJ,Object.assign({as:"div",ref:r,className:(0,i.q)(s("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",b,p),defaultOpen:l},m),e=>{let{open:r}=e;return d.createElement(c.Provider,{value:{isOpen:r}},u)})});u.displayName="Accordion"},88829:function(e,r,t){"use strict";t.d(r,{Z:function(){return d}});var o=t(5853),n=t(2265),a=t(91054),i=t(13241);let l=(0,t(1153).fn)("AccordionBody"),d=n.forwardRef((e,r)=>{let{children:t,className:d}=e,s=(0,o._T)(e,["children","className"]);return n.createElement(a.pJ.Panel,Object.assign({ref:r,className:(0,i.q)(l("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",d)},s),t)});d.displayName="AccordionBody"},72208:function(e,r,t){"use strict";t.d(r,{Z:function(){return c}});var o=t(5853),n=t(2265),a=t(91054);let i=e=>{var r=(0,o._T)(e,[]);return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},r),n.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))};var l=t(87452),d=t(13241);let s=(0,t(1153).fn)("AccordionHeader"),c=n.forwardRef((e,r)=>{let{children:t,className:c}=e,u=(0,o._T)(e,["children","className"]),{isOpen:p}=(0,n.useContext)(l.r);return n.createElement(a.pJ.Button,Object.assign({ref:r,className:(0,d.q)(s("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",c)},u),n.createElement("div",{className:(0,d.q)(s("children"),"flex flex-1 text-inherit mr-4")},t),n.createElement("div",null,n.createElement(i,{className:(0,d.q)(s("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",p?"transition-all":"transition-all -rotate-180")})))});c.displayName="AccordionHeader"},12514:function(e,r,t){"use strict";t.d(r,{Z:function(){return u}});var o=t(5853),n=t(2265),a=t(7084),i=t(26898),l=t(13241),d=t(1153);let s=(0,d.fn)("Card"),c=e=>{if(!e)return"";switch(e){case a.zS.Left:return"border-l-4";case a.m.Top:return"border-t-4";case a.zS.Right:return"border-r-4";case a.m.Bottom:return"border-b-4";default:return""}},u=n.forwardRef((e,r)=>{let{decoration:t="",decorationColor:a,children:u,className:p}=e,m=(0,o._T)(e,["decoration","decorationColor","children","className"]);return n.createElement("div",Object.assign({ref:r,className:(0,l.q)(s("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",a?(0,d.bM)(a,i.K.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",c(t),p)},m),u)});u.displayName="Card"},84264:function(e,r,t){"use strict";t.d(r,{Z:function(){return l}});var o=t(26898),n=t(13241),a=t(1153),i=t(2265);let l=i.forwardRef((e,r)=>{let{color:t,className:l,children:d}=e;return i.createElement("p",{ref:r,className:(0,n.q)("text-tremor-default",t?(0,a.bM)(t,o.K.text).textColor:(0,n.q)("text-tremor-content","dark:text-dark-tremor-content"),l)},d)});l.displayName="Text"},23910:function(e,r,t){var o=t(74288).Symbol;e.exports=o},54506:function(e,r,t){var o=t(23910),n=t(4479),a=t(80910),i=o?o.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?n(e):a(e)}},41087:function(e,r,t){var o=t(5035),n=/^\s+/;e.exports=function(e){return e?e.slice(0,o(e)+1).replace(n,""):e}},17071:function(e,r,t){var o="object"==typeof t.g&&t.g&&t.g.Object===Object&&t.g;e.exports=o},4479:function(e,r,t){var o=t(23910),n=Object.prototype,a=n.hasOwnProperty,i=n.toString,l=o?o.toStringTag:void 0;e.exports=function(e){var r=a.call(e,l),t=e[l];try{e[l]=void 0;var o=!0}catch(e){}var n=i.call(e);return o&&(r?e[l]=t:delete e[l]),n}},80910:function(e){var r=Object.prototype.toString;e.exports=function(e){return r.call(e)}},74288:function(e,r,t){var o=t(17071),n="object"==typeof self&&self&&self.Object===Object&&self,a=o||n||Function("return this")();e.exports=a},5035:function(e){var r=/\s/;e.exports=function(e){for(var t=e.length;t--&&r.test(e.charAt(t)););return t}},7310:function(e,r,t){var o=t(28302),n=t(11121),a=t(6660),i=Math.max,l=Math.min;e.exports=function(e,r,t){var d,s,c,u,p,m,b=0,g=!1,f=!1,h=!0;if("function"!=typeof e)throw TypeError("Expected a function");function v(r){var t=d,o=s;return d=s=void 0,b=r,u=e.apply(o,t)}function x(e){var t=e-m,o=e-b;return void 0===m||t>=r||t<0||f&&o>=c}function k(){var e,t,o,a=n();if(x(a))return w(a);p=setTimeout(k,(e=a-m,t=a-b,o=r-e,f?l(o,c-t):o))}function w(e){return(p=void 0,h&&d)?v(e):(d=s=void 0,u)}function C(){var e,t=n(),o=x(t);if(d=arguments,s=this,m=t,o){if(void 0===p)return b=e=m,p=setTimeout(k,r),g?v(e):u;if(f)return clearTimeout(p),p=setTimeout(k,r),v(m)}return void 0===p&&(p=setTimeout(k,r)),u}return r=a(r)||0,o(t)&&(g=!!t.leading,c=(f="maxWait"in t)?i(a(t.maxWait)||0,r):c,h="trailing"in t?!!t.trailing:h),C.cancel=function(){void 0!==p&&clearTimeout(p),b=0,d=m=s=p=void 0},C.flush=function(){return void 0===p?u:w(n())},C}},28302:function(e){e.exports=function(e){var r=typeof e;return null!=e&&("object"==r||"function"==r)}},10303:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},78371:function(e,r,t){var o=t(54506),n=t(10303);e.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==o(e)}},11121:function(e,r,t){var o=t(74288);e.exports=function(){return o.Date.now()}},6660:function(e,r,t){var o=t(41087),n=t(28302),a=t(78371),i=0/0,l=/^[-+]0x[0-9a-f]+$/i,d=/^0b[01]+$/i,s=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(a(e))return i;if(n(e)){var r="function"==typeof e.valueOf?e.valueOf():e;e=n(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=o(e);var t=d.test(e);return t||s.test(e)?c(e.slice(2),t?2:8):l.test(e)?i:+e}},44643:function(e,r,t){"use strict";var o=t(2265);let n=o.forwardRef(function(e,r){return o.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),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"}))});r.Z=n},51853:function(e,r,t){"use strict";var o=t(2265);let n=o.forwardRef(function(e,r){return o.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),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"}))});r.Z=n},23628:function(e,r,t){"use strict";var o=t(2265);let n=o.forwardRef(function(e,r){return o.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),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",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"}))});r.Z=n},71157:function(e,r,t){"use strict";var o=t(2265);let n=o.forwardRef(function(e,r){return o.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),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"}))});r.Z=n},91054:function(e,r,t){"use strict";let o,n;t.d(r,{pJ:function(){return z}});var a,i=t(71049),l=t(11323),d=t(2265),s=t(66797),c=t(93980),u=t(65573),p=t(67561),m=t(98218),b=t(33443),g=t(28294),f=t(31370),h=t(72468),v=t(5664),x=t(38929);let k=null!=(a=d.startTransition)?a:function(e){e()};var w=t(52724),C=((o=C||{})[o.Open=0]="Open",o[o.Closed=1]="Closed",o),y=((n=y||{})[n.ToggleDisclosure=0]="ToggleDisclosure",n[n.CloseDisclosure=1]="CloseDisclosure",n[n.SetButtonId=2]="SetButtonId",n[n.SetPanelId=3]="SetPanelId",n[n.SetButtonElement=4]="SetButtonElement",n[n.SetPanelElement=5]="SetPanelElement",n);let E={0:e=>({...e,disclosureState:(0,h.E)(e.disclosureState,{0:1,1:0})}),1:e=>1===e.disclosureState?e:{...e,disclosureState:1},2:(e,r)=>e.buttonId===r.buttonId?e:{...e,buttonId:r.buttonId},3:(e,r)=>e.panelId===r.panelId?e:{...e,panelId:r.panelId},4:(e,r)=>e.buttonElement===r.element?e:{...e,buttonElement:r.element},5:(e,r)=>e.panelElement===r.element?e:{...e,panelElement:r.element}},S=(0,d.createContext)(null);function M(e){let r=(0,d.useContext)(S);if(null===r){let r=Error("<".concat(e," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(r,M),r}return r}S.displayName="DisclosureContext";let N=(0,d.createContext)(null);N.displayName="DisclosureAPIContext";let T=(0,d.createContext)(null);function j(e,r){return(0,h.E)(r.type,E,e,r)}T.displayName="DisclosurePanelContext";let I=d.Fragment,O=x.VN.RenderStrategy|x.VN.Static,z=Object.assign((0,x.yV)(function(e,r){let{defaultOpen:t=!1,...o}=e,n=(0,d.useRef)(null),a=(0,p.T)(r,(0,p.h)(e=>{n.current=e},void 0===e.as||e.as===d.Fragment)),i=(0,d.useReducer)(j,{disclosureState:t?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:l,buttonId:s},u]=i,m=(0,c.z)(e=>{u({type:1});let r=(0,v.r)(n);if(!r||!s)return;let t=e?e instanceof HTMLElement?e:e.current instanceof HTMLElement?e.current:r.getElementById(s):r.getElementById(s);null==t||t.focus()}),f=(0,d.useMemo)(()=>({close:m}),[m]),k=(0,d.useMemo)(()=>({open:0===l,close:m}),[l,m]),w=(0,x.L6)();return d.createElement(S.Provider,{value:i},d.createElement(N.Provider,{value:f},d.createElement(b.Z,{value:m},d.createElement(g.up,{value:(0,h.E)(l,{0:g.ZM.Open,1:g.ZM.Closed})},w({ourProps:{ref:a},theirProps:o,slot:k,defaultTag:I,name:"Disclosure"})))))}),{Button:(0,x.yV)(function(e,r){let t=(0,d.useId)(),{id:o="headlessui-disclosure-button-".concat(t),disabled:n=!1,autoFocus:a=!1,...m}=e,[b,g]=M("Disclosure.Button"),h=(0,d.useContext)(T),v=null!==h&&h===b.panelId,k=(0,d.useRef)(null),C=(0,p.T)(k,r,(0,c.z)(e=>{if(!v)return g({type:4,element:e})}));(0,d.useEffect)(()=>{if(!v)return g({type:2,buttonId:o}),()=>{g({type:2,buttonId:null})}},[o,g,v]);let y=(0,c.z)(e=>{var r;if(v){if(1===b.disclosureState)return;switch(e.key){case w.R.Space:case w.R.Enter:e.preventDefault(),e.stopPropagation(),g({type:0}),null==(r=b.buttonElement)||r.focus()}}else switch(e.key){case w.R.Space:case w.R.Enter:e.preventDefault(),e.stopPropagation(),g({type:0})}}),E=(0,c.z)(e=>{e.key===w.R.Space&&e.preventDefault()}),S=(0,c.z)(e=>{var r;(0,f.P)(e.currentTarget)||n||(v?(g({type:0}),null==(r=b.buttonElement)||r.focus()):g({type:0}))}),{isFocusVisible:N,focusProps:j}=(0,i.F)({autoFocus:a}),{isHovered:I,hoverProps:O}=(0,l.X)({isDisabled:n}),{pressed:z,pressProps:P}=(0,s.x)({disabled:n}),q=(0,d.useMemo)(()=>({open:0===b.disclosureState,hover:I,active:z,disabled:n,focus:N,autofocus:a}),[b,I,z,N,n,a]),B=(0,u.f)(e,b.buttonElement),R=v?(0,x.dG)({ref:C,type:B,disabled:n||void 0,autoFocus:a,onKeyDown:y,onClick:S},j,O,P):(0,x.dG)({ref:C,id:o,type:B,"aria-expanded":0===b.disclosureState,"aria-controls":b.panelElement?b.panelId:void 0,disabled:n||void 0,autoFocus:a,onKeyDown:y,onKeyUp:E,onClick:S},j,O,P);return(0,x.L6)()({ourProps:R,theirProps:m,slot:q,defaultTag:"button",name:"Disclosure.Button"})}),Panel:(0,x.yV)(function(e,r){let t=(0,d.useId)(),{id:o="headlessui-disclosure-panel-".concat(t),transition:n=!1,...a}=e,[i,l]=M("Disclosure.Panel"),{close:s}=function e(r){let t=(0,d.useContext)(N);if(null===t){let t=Error("<".concat(r," /> is missing a parent component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,e),t}return t}("Disclosure.Panel"),[u,b]=(0,d.useState)(null),f=(0,p.T)(r,(0,c.z)(e=>{k(()=>l({type:5,element:e}))}),b);(0,d.useEffect)(()=>(l({type:3,panelId:o}),()=>{l({type:3,panelId:null})}),[o,l]);let h=(0,g.oJ)(),[v,w]=(0,m.Y)(n,u,null!==h?(h&g.ZM.Open)===g.ZM.Open:0===i.disclosureState),C=(0,d.useMemo)(()=>({open:0===i.disclosureState,close:s}),[i.disclosureState,s]),y={ref:f,id:o,...(0,m.X)(w)},E=(0,x.L6)();return d.createElement(g.uu,null,d.createElement(T.Provider,{value:i.panelId},E({ourProps:y,theirProps:a,slot:C,defaultTag:"div",features:O,visible:v,name:"Disclosure.Panel"})))})})},33443:function(e,r,t){"use strict";t.d(r,{Z:function(){return a}});var o=t(2265);let n=(0,o.createContext)(()=>{});function a(e){let{value:r,children:t}=e;return o.createElement(n.Provider,{value:r},t)}},61994:function(e,r,t){"use strict";function o(){for(var e,r,t=0,o="",n=arguments.length;t{let t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t}))}catch(e){return atob(r)}}(a)}catch(e){throw new o(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(t)}catch(e){throw new o(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}o.prototype.name="InvalidTokenError"}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5105-2998cbe1c9fc8ee4.js b/litellm/proxy/_experimental/out/_next/static/chunks/5105-2998cbe1c9fc8ee4.js new file mode 100644 index 0000000000..021cd8e246 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5105-2998cbe1c9fc8ee4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5105],{37527:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),r={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"},c=n(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:r}))})},9775:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),r={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"},c=n(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:r}))})},49634:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z"}}]},name:"calendar",theme:"outlined"},c=n(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:r}))})},5540:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),r={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:"M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z"}}]},name:"clock-circle",theme:"outlined"},c=n(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:r}))})},64739:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z"}}]},name:"global",theme:"outlined"},c=n(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:r}))})},48231:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),r={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"},c=n(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:r}))})},69993:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),r={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=n(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:r}))})},40312:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),r={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M922.9 701.9H327.4l29.9-60.9 496.8-.9c16.8 0 31.2-12 34.2-28.6l68.8-385.1c1.8-10.1-.9-20.5-7.5-28.4a34.99 34.99 0 00-26.6-12.5l-632-2.1-5.4-25.4c-3.4-16.2-18-28-34.6-28H96.5a35.3 35.3 0 100 70.6h125.9L246 312.8l58.1 281.3-74.8 122.1a34.96 34.96 0 00-3 36.8c6 11.9 18.1 19.4 31.5 19.4h62.8a102.43 102.43 0 00-20.6 61.7c0 56.6 46 102.6 102.6 102.6s102.6-46 102.6-102.6c0-22.3-7.4-44-20.6-61.7h161.1a102.43 102.43 0 00-20.6 61.7c0 56.6 46 102.6 102.6 102.6s102.6-46 102.6-102.6c0-22.3-7.4-44-20.6-61.7H923c19.4 0 35.3-15.8 35.3-35.3a35.42 35.42 0 00-35.4-35.2zM305.7 253l575.8 1.9-56.4 315.8-452.3.8L305.7 253zm96.9 612.7c-17.4 0-31.6-14.2-31.6-31.6 0-17.4 14.2-31.6 31.6-31.6s31.6 14.2 31.6 31.6a31.6 31.6 0 01-31.6 31.6zm325.1 0c-17.4 0-31.6-14.2-31.6-31.6 0-17.4 14.2-31.6 31.6-31.6s31.6 14.2 31.6 31.6a31.6 31.6 0 01-31.6 31.6z"}}]},name:"shopping-cart",theme:"outlined"},c=n(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:r}))})},71891:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),r={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"},c=n(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:r}))})},41361:function(e,t,n){n.d(t,{Z:function(){return l}});var a=n(1119),o=n(2265),r={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"},c=n(55015),l=o.forwardRef(function(e,t){return o.createElement(c.Z,(0,a.Z)({},e,{ref:t,icon:r}))})},59664:function(e,t,n){n.d(t,{Z:function(){return N}});var a=n(5853),o=n(2265),r=n(47625),c=n(93765),l=n(54061),i=n(97059),s=n(62994),d=n(25311),u=(0,c.z)({chartName:"LineChart",GraphicalChild:l.x,axisComponents:[{axisType:"xAxis",AxisComp:i.K},{axisType:"yAxis",AxisComp:s.B}],formatAxisMap:d.t9}),m=n(56940),p=n(26680),f=n(8147),b=n(22190),g=n(81889),v=n(65278),h=n(98593),y=n(92666),x=n(32644),k=n(7084),C=n(26898),w=n(13241),E=n(1153);let N=o.forwardRef((e,t)=>{let{data:n=[],categories:c=[],index:d,colors:N=C.s,valueFormatter:O=E.Cj,startEndOnly:Z=!1,showXAxis:j=!0,showYAxis:z=!0,yAxisWidth:S=56,intervalType:I="equidistantPreserveStart",animationDuration:M=900,showAnimation:R=!1,showTooltip:A=!0,showLegend:T=!0,showGridLines:L=!0,autoMinValue:B=!1,curveType:P="linear",minValue:H,maxValue:K,connectNulls:V=!1,allowDecimals:D=!0,noDataText:W,className:q,onValueChange:F,enableLegendSlider:G=!1,customTooltip:_,rotateLabelX:X,padding:Y=j||z?{left:20,right:20}:{left:0,right:0},tickGap:$=5,xAxisLabel:Q,yAxisLabel:J}=e,U=(0,a._T)(e,["data","categories","index","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","animationDuration","showAnimation","showTooltip","showLegend","showGridLines","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),[ee,et]=(0,o.useState)(60),[en,ea]=(0,o.useState)(void 0),[eo,er]=(0,o.useState)(void 0),ec=(0,x.me)(c,N),el=(0,x.i4)(B,H,K),ei=!!F;function es(e){ei&&(e===eo&&!en||(0,x.FB)(n,e)&&en&&en.dataKey===e?(er(void 0),null==F||F(null)):(er(e),null==F||F({eventType:"category",categoryClicked:e})),ea(void 0))}return o.createElement("div",Object.assign({ref:t,className:(0,w.q)("w-full h-80",q)},U),o.createElement(r.h,{className:"h-full w-full"},(null==n?void 0:n.length)?o.createElement(u,{data:n,onClick:ei&&(eo||en)?()=>{ea(void 0),er(void 0),null==F||F(null)}:void 0,margin:{bottom:Q?30:void 0,left:J?20:void 0,right:J?5:void 0,top:5}},L?o.createElement(m.q,{className:(0,w.q)("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,o.createElement(i.K,{padding:Y,hide:!j,dataKey:d,interval:Z?"preserveStartEnd":I,tick:{transform:"translate(0, 6)"},ticks:Z?[n[0][d],n[n.length-1][d]]:void 0,fill:"",stroke:"",className:(0,w.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,minTickGap:$,angle:null==X?void 0:X.angle,dy:null==X?void 0:X.verticalShift,height:null==X?void 0:X.xAxisHeight},Q&&o.createElement(p._,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},Q)),o.createElement(s.B,{width:S,hide:!z,axisLine:!1,tickLine:!1,type:"number",domain:el,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:(0,w.q)("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:O,allowDecimals:D},J&&o.createElement(p._,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},J)),o.createElement(f.u,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:A?e=>{let{active:t,payload:n,label:a}=e;return _?o.createElement(_,{payload:null==n?void 0:n.map(e=>{var t;return Object.assign(Object.assign({},e),{color:null!==(t=ec.get(e.dataKey))&&void 0!==t?t:k.fr.Gray})}),active:t,label:a}):o.createElement(h.ZP,{active:t,payload:n,label:a,valueFormatter:O,categoryColors:ec})}:o.createElement(o.Fragment,null),position:{y:0}}),T?o.createElement(b.D,{verticalAlign:"top",height:ee,content:e=>{let{payload:t}=e;return(0,v.Z)({payload:t},ec,et,eo,ei?e=>es(e):void 0,G)}}):null,c.map(e=>{var t;return o.createElement(l.x,{className:(0,w.q)((0,E.bM)(null!==(t=ec.get(e))&&void 0!==t?t:k.fr.Gray,C.K.text).strokeColor),strokeOpacity:en||eo&&eo!==e?.3:1,activeDot:e=>{var t;let{cx:a,cy:r,stroke:c,strokeLinecap:l,strokeLinejoin:i,strokeWidth:s,dataKey:d}=e;return o.createElement(g.o,{className:(0,w.q)("stroke-tremor-background dark:stroke-dark-tremor-background",F?"cursor-pointer":"",(0,E.bM)(null!==(t=ec.get(d))&&void 0!==t?t:k.fr.Gray,C.K.text).fillColor),cx:a,cy:r,r:5,fill:"",stroke:c,strokeLinecap:l,strokeLinejoin:i,strokeWidth:s,onClick:(t,a)=>{a.stopPropagation(),ei&&(e.index===(null==en?void 0:en.index)&&e.dataKey===(null==en?void 0:en.dataKey)||(0,x.FB)(n,e.dataKey)&&eo&&eo===e.dataKey?(er(void 0),ea(void 0),null==F||F(null)):(er(e.dataKey),ea({index:e.index,dataKey:e.dataKey}),null==F||F(Object.assign({eventType:"dot",categoryClicked:e.dataKey},e.payload))))}})},dot:t=>{var a;let{stroke:r,strokeLinecap:c,strokeLinejoin:l,strokeWidth:i,cx:s,cy:d,dataKey:u,index:m}=t;return(0,x.FB)(n,e)&&!(en||eo&&eo!==e)||(null==en?void 0:en.index)===m&&(null==en?void 0:en.dataKey)===e?o.createElement(g.o,{key:m,cx:s,cy:d,r:5,stroke:r,fill:"",strokeLinecap:c,strokeLinejoin:l,strokeWidth:i,className:(0,w.q)("stroke-tremor-background dark:stroke-dark-tremor-background",F?"cursor-pointer":"",(0,E.bM)(null!==(a=ec.get(u))&&void 0!==a?a:k.fr.Gray,C.K.text).fillColor)}):o.createElement(o.Fragment,{key:m})},key:e,name:e,type:P,dataKey:e,stroke:"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:R,animationDuration:M,connectNulls:V})}),F?c.map(e=>o.createElement(l.x,{className:(0,w.q)("cursor-pointer"),strokeOpacity:0,key:e,name:e,type:P,dataKey:e,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:V,onClick:(e,t)=>{t.stopPropagation();let{name:n}=e;es(n)}})):null):o.createElement(y.Z,{noDataText:W})))});N.displayName="LineChart"},94789:function(e,t,n){n.d(t,{Z:function(){return s}});var a=n(5853),o=n(2265),r=n(26898),c=n(13241),l=n(1153);let i=(0,l.fn)("Callout"),s=o.forwardRef((e,t)=>{let{title:n,icon:s,color:d,className:u,children:m}=e,p=(0,a._T)(e,["title","icon","color","className","children"]);return o.createElement("div",Object.assign({ref:t,className:(0,c.q)(i("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",d?(0,c.q)((0,l.bM)(d,r.K.background).bgColor,(0,l.bM)(d,r.K.darkBorder).borderColor,(0,l.bM)(d,r.K.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):(0,c.q)("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),u)},p),o.createElement("div",{className:(0,c.q)(i("header"),"flex items-start")},s?o.createElement(s,{className:(0,c.q)(i("icon"),"flex-none h-5 w-5 mr-1.5")}):null,o.createElement("h4",{className:(0,c.q)(i("title"),"font-semibold")},n)),o.createElement("p",{className:(0,c.q)(i("body"),"overflow-y-auto",m?"mt-2":"")},m))});s.displayName="Callout"},35829:function(e,t,n){n.d(t,{Z:function(){return i}});var a=n(5853),o=n(26898),r=n(13241),c=n(1153),l=n(2265);let i=l.forwardRef((e,t)=>{let{color:n,children:i,className:s}=e,d=(0,a._T)(e,["color","children","className"]);return l.createElement("p",Object.assign({ref:t,className:(0,r.q)("font-semibold text-tremor-metric",n?(0,c.bM)(n,o.K.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",s)},d),i)});i.displayName="Metric"},33866:function(e,t,n){n.d(t,{Z:function(){return R}});var a=n(2265),o=n(36760),r=n.n(o),c=n(66632),l=n(93350),i=n(19722),s=n(71744),d=n(93463),u=n(12918),m=n(18536),p=n(71140),f=n(99320);let b=new d.E4("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),g=new d.E4("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),v=new d.E4("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),h=new d.E4("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),y=new d.E4("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),x=new d.E4("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),k=e=>{let{componentCls:t,iconCls:n,antCls:a,badgeShadowSize:o,textFontSize:r,textFontSizeSM:c,statusSize:l,dotSize:i,textFontWeight:s,indicatorHeight:p,indicatorHeightSM:f,marginXS:k,calc:C}=e,w="".concat(a,"-scroll-number"),E=(0,m.Z)(e,(e,n)=>{let{darkColor:a}=n;return{["&".concat(t," ").concat(t,"-color-").concat(e)]:{background:a,["&:not(".concat(t,"-count)")]:{color:a},"a:hover &":{background:a}}}});return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,u.Wf)(e)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,["".concat(t,"-count")]:{display:"inline-flex",justifyContent:"center",zIndex:e.indicatorZIndex,minWidth:p,height:p,color:e.badgeTextColor,fontWeight:s,fontSize:r,lineHeight:(0,d.bf)(p),whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:C(p).div(2).equal(),boxShadow:"0 0 0 ".concat((0,d.bf)(o)," ").concat(e.badgeShadowColor),transition:"background ".concat(e.motionDurationMid),a:{color:e.badgeTextColor},"a:hover":{color:e.badgeTextColor},"a:hover &":{background:e.badgeColorHover}},["".concat(t,"-count-sm")]:{minWidth:f,height:f,fontSize:c,lineHeight:(0,d.bf)(f),borderRadius:C(f).div(2).equal()},["".concat(t,"-multiple-words")]:{padding:"0 ".concat((0,d.bf)(e.paddingXS)),bdi:{unicodeBidi:"plaintext"}},["".concat(t,"-dot")]:{zIndex:e.indicatorZIndex,width:i,minWidth:i,height:i,background:e.badgeColor,borderRadius:"100%",boxShadow:"0 0 0 ".concat((0,d.bf)(o)," ").concat(e.badgeShadowColor)},["".concat(t,"-count, ").concat(t,"-dot, ").concat(w,"-custom-component")]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",["&".concat(n,"-spin")]:{animationName:x,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},["&".concat(t,"-status")]:{lineHeight:"inherit",verticalAlign:"baseline",["".concat(t,"-status-dot")]:{position:"relative",top:-1,display:"inline-block",width:l,height:l,verticalAlign:"middle",borderRadius:"50%"},["".concat(t,"-status-success")]:{backgroundColor:e.colorSuccess},["".concat(t,"-status-processing")]:{overflow:"visible",color:e.colorInfo,backgroundColor:e.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:o,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:b,animationDuration:e.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},["".concat(t,"-status-default")]:{backgroundColor:e.colorTextPlaceholder},["".concat(t,"-status-error")]:{backgroundColor:e.colorError},["".concat(t,"-status-warning")]:{backgroundColor:e.colorWarning},["".concat(t,"-status-text")]:{marginInlineStart:k,color:e.colorText,fontSize:e.fontSize}}}),E),{["".concat(t,"-zoom-appear, ").concat(t,"-zoom-enter")]:{animationName:g,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},["".concat(t,"-zoom-leave")]:{animationName:v,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},["&".concat(t,"-not-a-wrapper")]:{["".concat(t,"-zoom-appear, ").concat(t,"-zoom-enter")]:{animationName:h,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},["".concat(t,"-zoom-leave")]:{animationName:y,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},["&:not(".concat(t,"-status)")]:{verticalAlign:"middle"},["".concat(w,"-custom-component, ").concat(t,"-count")]:{transform:"none"},["".concat(w,"-custom-component, ").concat(w)]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[w]:{overflow:"hidden",transition:"all ".concat(e.motionDurationMid," ").concat(e.motionEaseOutBack),["".concat(w,"-only")]:{position:"relative",display:"inline-block",height:p,transition:"all ".concat(e.motionDurationSlow," ").concat(e.motionEaseOutBack),WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",["> p".concat(w,"-only-unit")]:{height:p,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},["".concat(w,"-symbol")]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",["".concat(t,"-count, ").concat(t,"-dot, ").concat(w,"-custom-component")]:{transform:"translate(-50%, -50%)"}}})}},C=e=>{let{fontHeight:t,lineWidth:n,marginXS:a,colorBorderBg:o}=e,r=e.colorTextLightSolid,c=e.colorError,l=e.colorErrorHover;return(0,p.IX)(e,{badgeFontHeight:t,badgeShadowSize:n,badgeTextColor:r,badgeColor:c,badgeColorHover:l,badgeShadowColor:o,badgeProcessingDuration:"1.2s",badgeRibbonOffset:a,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},w=e=>{let{fontSize:t,lineHeight:n,fontSizeSM:a,lineWidth:o}=e;return{indicatorZIndex:"auto",indicatorHeight:Math.round(t*n)-2*o,indicatorHeightSM:t,dotSize:a/2,textFontSize:a,textFontSizeSM:a,textFontWeight:"normal",statusSize:a/2}};var E=(0,f.I$)("Badge",e=>k(C(e)),w);let N=e=>{let{antCls:t,badgeFontHeight:n,marginXS:a,badgeRibbonOffset:o,calc:r}=e,c="".concat(t,"-ribbon"),l=(0,m.Z)(e,(e,t)=>{let{darkColor:n}=t;return{["&".concat(c,"-color-").concat(e)]:{background:n,color:n}}});return{["".concat(t,"-ribbon-wrapper")]:{position:"relative"},[c]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,u.Wf)(e)),{position:"absolute",top:a,padding:"0 ".concat((0,d.bf)(e.paddingXS)),color:e.colorPrimary,lineHeight:(0,d.bf)(n),whiteSpace:"nowrap",backgroundColor:e.colorPrimary,borderRadius:e.borderRadiusSM,["".concat(c,"-text")]:{color:e.badgeTextColor},["".concat(c,"-corner")]:{position:"absolute",top:"100%",width:o,height:o,color:"currentcolor",border:"".concat((0,d.bf)(r(o).div(2).equal())," solid"),transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),l),{["&".concat(c,"-placement-end")]:{insetInlineEnd:r(o).mul(-1).equal(),borderEndEndRadius:0,["".concat(c,"-corner")]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},["&".concat(c,"-placement-start")]:{insetInlineStart:r(o).mul(-1).equal(),borderEndStartRadius:0,["".concat(c,"-corner")]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}};var O=(0,f.I$)(["Badge","Ribbon"],e=>N(C(e)),w);let Z=e=>{let t;let{prefixCls:n,value:o,current:c,offset:l=0}=e;return l&&(t={position:"absolute",top:"".concat(l,"00%"),left:0}),a.createElement("span",{style:t,className:r()("".concat(n,"-only-unit"),{current:c})},o)};var j=e=>{let t,n;let{prefixCls:o,count:r,value:c}=e,l=Number(c),i=Math.abs(r),[s,d]=a.useState(l),[u,m]=a.useState(i),p=()=>{d(l),m(i)};if(a.useEffect(()=>{let e=setTimeout(p,1e3);return()=>clearTimeout(e)},[l]),s===l||Number.isNaN(l)||Number.isNaN(s))t=[a.createElement(Z,Object.assign({},e,{key:l,current:!0}))],n={transition:"none"};else{t=[];let o=l+10,r=[];for(let e=l;e<=o;e+=1)r.push(e);let c=ue%10===s);t=(c<0?r.slice(0,d+1):r.slice(d)).map((t,n)=>a.createElement(Z,Object.assign({},e,{key:t,value:t%10,offset:c<0?n-d:n,current:n===d}))),n={transform:"translateY(".concat(-function(e,t,n){let a=e,o=0;for(;(a+10)%10!==t;)a+=n,o+=n;return o}(s,l,c),"00%)")}}return a.createElement("span",{className:"".concat(o,"-only"),style:n,onTransitionEnd:p},t)},z=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[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])&&(n[a[o]]=e[a[o]]);return n};let S=a.forwardRef((e,t)=>{let{prefixCls:n,count:o,className:c,motionClassName:l,style:d,title:u,show:m,component:p="sup",children:f}=e,b=z(e,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:g}=a.useContext(s.E_),v=g("scroll-number",n),h=Object.assign(Object.assign({},b),{"data-show":m,style:d,className:r()(v,c,l),title:u}),y=o;if(o&&Number(o)%1==0){let e=String(o).split("");y=a.createElement("bdi",null,e.map((t,n)=>a.createElement(j,{prefixCls:v,count:Number(o),value:t,key:e.length-n})))}return((null==d?void 0:d.borderColor)&&(h.style=Object.assign(Object.assign({},d),{boxShadow:"0 0 0 1px ".concat(d.borderColor," inset")})),f)?(0,i.Tm)(f,e=>({className:r()("".concat(v,"-custom-component"),null==e?void 0:e.className,l)})):a.createElement(p,Object.assign({},h,{ref:t}),y)});var I=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(n[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])&&(n[a[o]]=e[a[o]]);return n};let M=a.forwardRef((e,t)=>{var n,o,d,u,m;let{prefixCls:p,scrollNumberPrefixCls:f,children:b,status:g,text:v,color:h,count:y=null,overflowCount:x=99,dot:k=!1,size:C="default",title:w,offset:N,style:O,className:Z,rootClassName:j,classNames:z,styles:M,showZero:R=!1}=e,A=I(e,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:T,direction:L,badge:B}=a.useContext(s.E_),P=T("badge",p),[H,K,V]=E(P),D=y>x?"".concat(x,"+"):y,W="0"===D||0===D||"0"===v||0===v,q=null===y||W&&!R,F=(null!=g||null!=h)&&q,G=null!=g||!W,_=k&&!W,X=_?"":D,Y=(0,a.useMemo)(()=>((null==X||""===X)&&(null==v||""===v)||W&&!R)&&!_,[X,W,R,_,v]),$=(0,a.useRef)(y);Y||($.current=y);let Q=$.current,J=(0,a.useRef)(X);Y||(J.current=X);let U=J.current,ee=(0,a.useRef)(_);Y||(ee.current=_);let et=(0,a.useMemo)(()=>{if(!N)return Object.assign(Object.assign({},null==B?void 0:B.style),O);let e={marginTop:N[1]};return"rtl"===L?e.left=Number.parseInt(N[0],10):e.right=-Number.parseInt(N[0],10),Object.assign(Object.assign(Object.assign({},e),null==B?void 0:B.style),O)},[L,N,O,null==B?void 0:B.style]),en=null!=w?w:"string"==typeof Q||"number"==typeof Q?Q:void 0,ea=!Y&&(0===v?R:!!v&&!0!==v),eo=ea?a.createElement("span",{className:"".concat(P,"-status-text")},v):null,er=Q&&"object"==typeof Q?(0,i.Tm)(Q,e=>({style:Object.assign(Object.assign({},et),e.style)})):void 0,ec=(0,l.o2)(h,!1),el=r()(null==z?void 0:z.indicator,null===(n=null==B?void 0:B.classNames)||void 0===n?void 0:n.indicator,{["".concat(P,"-status-dot")]:F,["".concat(P,"-status-").concat(g)]:!!g,["".concat(P,"-color-").concat(h)]:ec}),ei={};h&&!ec&&(ei.color=h,ei.background=h);let es=r()(P,{["".concat(P,"-status")]:F,["".concat(P,"-not-a-wrapper")]:!b,["".concat(P,"-rtl")]:"rtl"===L},Z,j,null==B?void 0:B.className,null===(o=null==B?void 0:B.classNames)||void 0===o?void 0:o.root,null==z?void 0:z.root,K,V);if(!b&&F&&(v||G||!q)){let e=et.color;return H(a.createElement("span",Object.assign({},A,{className:es,style:Object.assign(Object.assign(Object.assign({},null==M?void 0:M.root),null===(d=null==B?void 0:B.styles)||void 0===d?void 0:d.root),et)}),a.createElement("span",{className:el,style:Object.assign(Object.assign(Object.assign({},null==M?void 0:M.indicator),null===(u=null==B?void 0:B.styles)||void 0===u?void 0:u.indicator),ei)}),ea&&a.createElement("span",{style:{color:e},className:"".concat(P,"-status-text")},v)))}return H(a.createElement("span",Object.assign({ref:t},A,{className:es,style:Object.assign(Object.assign({},null===(m=null==B?void 0:B.styles)||void 0===m?void 0:m.root),null==M?void 0:M.root)}),b,a.createElement(c.ZP,{visible:!Y,motionName:"".concat(P,"-zoom"),motionAppear:!1,motionDeadline:1e3},e=>{var t,n;let{className:o}=e,c=T("scroll-number",f),l=ee.current,i=r()(null==z?void 0:z.indicator,null===(t=null==B?void 0:B.classNames)||void 0===t?void 0:t.indicator,{["".concat(P,"-dot")]:l,["".concat(P,"-count")]:!l,["".concat(P,"-count-sm")]:"small"===C,["".concat(P,"-multiple-words")]:!l&&U&&U.toString().length>1,["".concat(P,"-status-").concat(g)]:!!g,["".concat(P,"-color-").concat(h)]:ec}),s=Object.assign(Object.assign(Object.assign({},null==M?void 0:M.indicator),null===(n=null==B?void 0:B.styles)||void 0===n?void 0:n.indicator),et);return h&&!ec&&((s=s||{}).background=h),a.createElement(S,{prefixCls:c,show:!Y,motionClassName:o,className:i,count:U,title:en,style:s,key:"scrollNumber"},er)}),eo))});M.Ribbon=e=>{let{className:t,prefixCls:n,style:o,color:c,children:i,text:d,placement:u="end",rootClassName:m}=e,{getPrefixCls:p,direction:f}=a.useContext(s.E_),b=p("ribbon",n),g="".concat(b,"-wrapper"),[v,h,y]=O(b,g),x=(0,l.o2)(c,!1),k=r()(b,"".concat(b,"-placement-").concat(u),{["".concat(b,"-rtl")]:"rtl"===f,["".concat(b,"-color-").concat(c)]:x},t),C={},w={};return c&&!x&&(C.background=c,w.color=c),v(a.createElement("div",{className:r()(g,m,h,y)},i,a.createElement("div",{className:r()(k,h),style:Object.assign(Object.assign({},C),o)},a.createElement("span",{className:"".concat(b,"-text")},d),a.createElement("div",{className:"".concat(b,"-corner"),style:w}))))};var R=M},44851:function(e,t,n){n.d(t,{default:function(){return q}});var a=n(2265),o=n(77565),r=n(36760),c=n.n(r),l=n(1119),i=n(83145),s=n(26365),d=n(41154),u=n(50506),m=n(32559),p=n(6989),f=n(45287),b=n(31686),g=n(11993),v=n(66632),h=n(95814),y=a.forwardRef(function(e,t){var n=e.prefixCls,o=e.forceRender,r=e.className,l=e.style,i=e.children,d=e.isActive,u=e.role,m=e.classNames,p=e.styles,f=a.useState(d||o),b=(0,s.Z)(f,2),v=b[0],h=b[1];return(a.useEffect(function(){(o||d)&&h(!0)},[o,d]),v)?a.createElement("div",{ref:t,className:c()("".concat(n,"-content"),(0,g.Z)((0,g.Z)({},"".concat(n,"-content-active"),d),"".concat(n,"-content-inactive"),!d),r),style:l,role:u},a.createElement("div",{className:c()("".concat(n,"-content-box"),null==m?void 0:m.body),style:null==p?void 0:p.body},i)):null});y.displayName="PanelContent";var x=["showArrow","headerClass","isActive","onItemClick","forceRender","className","classNames","styles","prefixCls","collapsible","accordion","panelKey","extra","header","expandIcon","openMotion","destroyInactivePanel","children"],k=a.forwardRef(function(e,t){var n=e.showArrow,o=e.headerClass,r=e.isActive,i=e.onItemClick,s=e.forceRender,d=e.className,u=e.classNames,m=void 0===u?{}:u,f=e.styles,k=void 0===f?{}:f,C=e.prefixCls,w=e.collapsible,E=e.accordion,N=e.panelKey,O=e.extra,Z=e.header,j=e.expandIcon,z=e.openMotion,S=e.destroyInactivePanel,I=e.children,M=(0,p.Z)(e,x),R="disabled"===w,A=(0,g.Z)((0,g.Z)((0,g.Z)({onClick:function(){null==i||i(N)},onKeyDown:function(e){("Enter"===e.key||e.keyCode===h.Z.ENTER||e.which===h.Z.ENTER)&&(null==i||i(N))},role:E?"tab":"button"},"aria-expanded",r),"aria-disabled",R),"tabIndex",R?-1:0),T="function"==typeof j?j(e):a.createElement("i",{className:"arrow"}),L=T&&a.createElement("div",(0,l.Z)({className:"".concat(C,"-expand-icon")},["header","icon"].includes(w)?A:{}),T),B=c()("".concat(C,"-item"),(0,g.Z)((0,g.Z)({},"".concat(C,"-item-active"),r),"".concat(C,"-item-disabled"),R),d),P=c()(o,"".concat(C,"-header"),(0,g.Z)({},"".concat(C,"-collapsible-").concat(w),!!w),m.header),H=(0,b.Z)({className:P,style:k.header},["header","icon"].includes(w)?{}:A);return a.createElement("div",(0,l.Z)({},M,{ref:t,className:B}),a.createElement("div",H,(void 0===n||n)&&L,a.createElement("span",(0,l.Z)({className:"".concat(C,"-header-text")},"header"===w?A:{}),Z),null!=O&&"boolean"!=typeof O&&a.createElement("div",{className:"".concat(C,"-extra")},O)),a.createElement(v.ZP,(0,l.Z)({visible:r,leavedClassName:"".concat(C,"-content-hidden")},z,{forceRender:s,removeOnLeave:S}),function(e,t){var n=e.className,o=e.style;return a.createElement(y,{ref:t,prefixCls:C,className:n,classNames:m,style:o,styles:k,isActive:r,forceRender:s,role:E?"tabpanel":void 0},I)}))}),C=["children","label","key","collapsible","onItemClick","destroyInactivePanel"],w=function(e,t){var n=t.prefixCls,o=t.accordion,r=t.collapsible,c=t.destroyInactivePanel,i=t.onItemClick,s=t.activeKey,d=t.openMotion,u=t.expandIcon;return e.map(function(e,t){var m=e.children,f=e.label,b=e.key,g=e.collapsible,v=e.onItemClick,h=e.destroyInactivePanel,y=(0,p.Z)(e,C),x=String(null!=b?b:t),w=null!=g?g:r,E=!1;return E=o?s[0]===x:s.indexOf(x)>-1,a.createElement(k,(0,l.Z)({},y,{prefixCls:n,key:x,panelKey:x,isActive:E,accordion:o,openMotion:d,expandIcon:u,header:f,collapsible:w,onItemClick:function(e){"disabled"!==w&&(i(e),null==v||v(e))},destroyInactivePanel:null!=h?h:c}),m)})},E=function(e,t,n){if(!e)return null;var o=n.prefixCls,r=n.accordion,c=n.collapsible,l=n.destroyInactivePanel,i=n.onItemClick,s=n.activeKey,d=n.openMotion,u=n.expandIcon,m=e.key||String(t),p=e.props,f=p.header,b=p.headerClass,g=p.destroyInactivePanel,v=p.collapsible,h=p.onItemClick,y=!1;y=r?s[0]===m:s.indexOf(m)>-1;var x=null!=v?v:c,k={key:m,panelKey:m,header:f,headerClass:b,isActive:y,prefixCls:o,destroyInactivePanel:null!=g?g:l,openMotion:d,accordion:r,children:e.props.children,onItemClick:function(e){"disabled"!==x&&(i(e),null==h||h(e))},expandIcon:u,collapsible:x};return"string"==typeof e.type?e:(Object.keys(k).forEach(function(e){void 0===k[e]&&delete k[e]}),a.cloneElement(e,k))},N=n(18242);function O(e){var t=e;if(!Array.isArray(t)){var n=(0,d.Z)(t);t="number"===n||"string"===n?[t]:[]}return t.map(function(e){return String(e)})}var Z=Object.assign(a.forwardRef(function(e,t){var n,o=e.prefixCls,r=void 0===o?"rc-collapse":o,d=e.destroyInactivePanel,p=e.style,b=e.accordion,g=e.className,v=e.children,h=e.collapsible,y=e.openMotion,x=e.expandIcon,k=e.activeKey,C=e.defaultActiveKey,Z=e.onChange,j=e.items,z=c()(r,g),S=(0,u.Z)([],{value:k,onChange:function(e){return null==Z?void 0:Z(e)},defaultValue:C,postState:O}),I=(0,s.Z)(S,2),M=I[0],R=I[1];(0,m.ZP)(!v,"[rc-collapse] `children` will be removed in next major version. Please use `items` instead.");var A=(n={prefixCls:r,accordion:b,openMotion:y,expandIcon:x,collapsible:h,destroyInactivePanel:void 0!==d&&d,onItemClick:function(e){return R(function(){return b?M[0]===e?[]:[e]:M.indexOf(e)>-1?M.filter(function(t){return t!==e}):[].concat((0,i.Z)(M),[e])})},activeKey:M},Array.isArray(j)?w(j,n):(0,f.Z)(v).map(function(e,t){return E(e,t,n)}));return a.createElement("div",(0,l.Z)({ref:t,className:z,style:p,role:b?"tablist":void 0},(0,N.Z)(e,{aria:!0,data:!0})),A)}),{Panel:k});Z.Panel;var j=n(18694),z=n(68710),S=n(19722),I=n(71744),M=n(33759);let R=a.forwardRef((e,t)=>{let{getPrefixCls:n}=a.useContext(I.E_),{prefixCls:o,className:r,showArrow:l=!0}=e,i=n("collapse",o),s=c()({["".concat(i,"-no-arrow")]:!l},r);return a.createElement(Z.Panel,Object.assign({ref:t},e,{prefixCls:i,className:s}))});var A=n(93463),T=n(12918),L=n(63074),B=n(99320),P=n(71140);let H=e=>{let{componentCls:t,contentBg:n,padding:a,headerBg:o,headerPadding:r,collapseHeaderPaddingSM:c,collapseHeaderPaddingLG:l,collapsePanelBorderRadius:i,lineWidth:s,lineType:d,colorBorder:u,colorText:m,colorTextHeading:p,colorTextDisabled:f,fontSizeLG:b,lineHeight:g,lineHeightLG:v,marginSM:h,paddingSM:y,paddingLG:x,paddingXS:k,motionDurationSlow:C,fontSizeIcon:w,contentPadding:E,fontHeight:N,fontHeightLG:O}=e,Z="".concat((0,A.bf)(s)," ").concat(d," ").concat(u);return{[t]:Object.assign(Object.assign({},(0,T.Wf)(e)),{backgroundColor:o,border:Z,borderRadius:i,"&-rtl":{direction:"rtl"},["& > ".concat(t,"-item")]:{borderBottom:Z,"&:first-child":{["\n &,\n & > ".concat(t,"-header")]:{borderRadius:"".concat((0,A.bf)(i)," ").concat((0,A.bf)(i)," 0 0")}},"&:last-child":{["\n &,\n & > ".concat(t,"-header")]:{borderRadius:"0 0 ".concat((0,A.bf)(i)," ").concat((0,A.bf)(i))}},["> ".concat(t,"-header")]:Object.assign(Object.assign({position:"relative",display:"flex",flexWrap:"nowrap",alignItems:"flex-start",padding:r,color:p,lineHeight:g,cursor:"pointer",transition:"all ".concat(C,", visibility 0s")},(0,T.Qy)(e)),{["> ".concat(t,"-header-text")]:{flex:"auto"},["".concat(t,"-expand-icon")]:{height:N,display:"flex",alignItems:"center",paddingInlineEnd:h},["".concat(t,"-arrow")]:Object.assign(Object.assign({},(0,T.Ro)()),{fontSize:w,transition:"transform ".concat(C),svg:{transition:"transform ".concat(C)}}),["".concat(t,"-header-text")]:{marginInlineEnd:"auto"}}),["".concat(t,"-collapsible-header")]:{cursor:"default",["".concat(t,"-header-text")]:{flex:"none",cursor:"pointer"},["".concat(t,"-expand-icon")]:{cursor:"pointer"}},["".concat(t,"-collapsible-icon")]:{cursor:"unset",["".concat(t,"-expand-icon")]:{cursor:"pointer"}}},["".concat(t,"-content")]:{color:m,backgroundColor:n,borderTop:Z,["& > ".concat(t,"-content-box")]:{padding:E},"&-hidden":{display:"none"}},"&-small":{["> ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{padding:c,paddingInlineStart:k,["> ".concat(t,"-expand-icon")]:{marginInlineStart:e.calc(y).sub(k).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:y}}},"&-large":{["> ".concat(t,"-item")]:{fontSize:b,lineHeight:v,["> ".concat(t,"-header")]:{padding:l,paddingInlineStart:a,["> ".concat(t,"-expand-icon")]:{height:O,marginInlineStart:e.calc(x).sub(a).equal()}},["> ".concat(t,"-content > ").concat(t,"-content-box")]:{padding:x}}},["".concat(t,"-item:last-child")]:{borderBottom:0,["> ".concat(t,"-content")]:{borderRadius:"0 0 ".concat((0,A.bf)(i)," ").concat((0,A.bf)(i))}},["& ".concat(t,"-item-disabled > ").concat(t,"-header")]:{"\n &,\n & > .arrow\n ":{color:f,cursor:"not-allowed"}},["&".concat(t,"-icon-position-end")]:{["& > ".concat(t,"-item")]:{["> ".concat(t,"-header")]:{["".concat(t,"-expand-icon")]:{order:1,paddingInlineEnd:0,paddingInlineStart:h}}}}})}},K=e=>{let{componentCls:t}=e,n="> ".concat(t,"-item > ").concat(t,"-header ").concat(t,"-arrow");return{["".concat(t,"-rtl")]:{[n]:{transform:"rotate(180deg)"}}}},V=e=>{let{componentCls:t,headerBg:n,borderlessContentPadding:a,borderlessContentBg:o,colorBorder:r}=e;return{["".concat(t,"-borderless")]:{backgroundColor:n,border:0,["> ".concat(t,"-item")]:{borderBottom:"1px solid ".concat(r)},["\n > ".concat(t,"-item:last-child,\n > ").concat(t,"-item:last-child ").concat(t,"-header\n ")]:{borderRadius:0},["> ".concat(t,"-item:last-child")]:{borderBottom:0},["> ".concat(t,"-item > ").concat(t,"-content")]:{backgroundColor:o,borderTop:0},["> ".concat(t,"-item > ").concat(t,"-content > ").concat(t,"-content-box")]:{padding:a}}}},D=e=>{let{componentCls:t,paddingSM:n}=e;return{["".concat(t,"-ghost")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-item")]:{borderBottom:0,["> ".concat(t,"-content")]:{backgroundColor:"transparent",border:0,["> ".concat(t,"-content-box")]:{paddingBlock:n}}}}}};var W=(0,B.I$)("Collapse",e=>{let t=(0,P.IX)(e,{collapseHeaderPaddingSM:"".concat((0,A.bf)(e.paddingXS)," ").concat((0,A.bf)(e.paddingSM)),collapseHeaderPaddingLG:"".concat((0,A.bf)(e.padding)," ").concat((0,A.bf)(e.paddingLG)),collapsePanelBorderRadius:e.borderRadiusLG});return[H(t),V(t),D(t),K(t),(0,L.Z)(t)]},e=>({headerPadding:"".concat(e.paddingSM,"px ").concat(e.padding,"px"),headerBg:e.colorFillAlter,contentPadding:"".concat(e.padding,"px 16px"),contentBg:e.colorBgContainer,borderlessContentPadding:"".concat(e.paddingXXS,"px 16px ").concat(e.padding,"px"),borderlessContentBg:"transparent"})),q=Object.assign(a.forwardRef((e,t)=>{let{getPrefixCls:n,direction:r,expandIcon:l,className:i,style:s}=(0,I.dj)("collapse"),{prefixCls:d,className:u,rootClassName:m,style:p,bordered:b=!0,ghost:g,size:v,expandIconPosition:h="start",children:y,destroyInactivePanel:x,destroyOnHidden:k,expandIcon:C}=e,w=(0,M.Z)(e=>{var t;return null!==(t=null!=v?v:e)&&void 0!==t?t:"middle"}),E=n("collapse",d),N=n(),[O,R,A]=W(E),T=a.useMemo(()=>"left"===h?"start":"right"===h?"end":h,[h]),L=null!=C?C:l,B=a.useCallback(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="function"==typeof L?L(e):a.createElement(o.Z,{rotate:e.isActive?"rtl"===r?-90:90:void 0,"aria-label":e.isActive?"expanded":"collapsed"});return(0,S.Tm)(t,()=>{var e;return{className:c()(null===(e=t.props)||void 0===e?void 0:e.className,"".concat(E,"-arrow"))}})},[L,E,r]),P=c()("".concat(E,"-icon-position-").concat(T),{["".concat(E,"-borderless")]:!b,["".concat(E,"-rtl")]:"rtl"===r,["".concat(E,"-ghost")]:!!g,["".concat(E,"-").concat(w)]:"middle"!==w},i,u,m,R,A),H=a.useMemo(()=>Object.assign(Object.assign({},(0,z.Z)(N)),{motionAppear:!1,leavedClassName:"".concat(E,"-content-hidden")}),[N,E]),K=a.useMemo(()=>y?(0,f.Z)(y).map((e,t)=>{var n,a;let o=e.props;if(null==o?void 0:o.disabled){let r=null!==(n=e.key)&&void 0!==n?n:String(t),c=Object.assign(Object.assign({},(0,j.Z)(e.props,["disabled"])),{key:r,collapsible:null!==(a=o.collapsible)&&void 0!==a?a:"disabled"});return(0,S.Tm)(e,c)}return e}):null,[y]);return O(a.createElement(Z,Object.assign({ref:t,openMotion:H},(0,j.Z)(e,["rootClassName"]),{expandIcon:B,prefixCls:E,className:P,style:Object.assign(Object.assign({},s),p),destroyInactivePanel:null!=k?k:x}),K))}),{Panel:R})}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5144-568f2e27c5fa36d1.js b/litellm/proxy/_experimental/out/_next/static/chunks/5144-568f2e27c5fa36d1.js deleted file mode 100644 index 3dcb603a78..0000000000 --- a/litellm/proxy/_experimental/out/_next/static/chunks/5144-568f2e27c5fa36d1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5144],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return r.Z},SC:function(){return c.Z},Zb:function(){return s.Z},iA:function(){return l.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return o.Z},xv:function(){return d.Z}});var s=a(12514),l=a(21626),r=a(97214),n=a(28241),i=a(58834),o=a(69552),c=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return l.Z},x:function(){return s.Z}});var s=a(84264),l=a(49566)},90246:function(e,t,a){a.d(t,{n:function(){return s}});function s(e){let t=[e];return{all:t,lists:()=>[...t,"list"],list:e=>[...t,"list",{params:e}],details:()=>[...t,"detail"],detail:e=>[...t,"detail",e]}}},68474:function(e,t,a){a.d(t,{F:function(){return o}});var s=a(11713),l=a(90246),r=a(19250),n=a(39760);let i=(0,l.n)("mcpServers"),o=()=>{let{accessToken:e}=(0,n.Z)();return(0,s.a)({queryKey:i.list({}),queryFn:async()=>await (0,r.fetchMCPServers)(e),enabled:!!e})}},76191:function(e,t,a){a.d(t,{p:function(){return n}});var s=a(19250),l=a(11713);let r=(0,a(90246).n)("uiConfig"),n=()=>(0,l.a)({queryKey:r.list({}),queryFn:async()=>await (0,s.getUiConfig)(),staleTime:864e5,gcTime:864e5})},39760:function(e,t,a){var s=a(19250),l=a(3914),r=a(14474),n=a(99376),i=a(2265),o=a(76191);t.Z=()=>{var e,t,a,c,d,u;let m=(0,n.useRouter)(),{data:p,isLoading:g}=(0,o.p)(),x="undefined"!=typeof document?(0,l.e)("token"):null;(0,i.useEffect)(()=>{!g&&(!x||(null==p?void 0:p.admin_ui_disabled))&&m.replace("".concat((0,s.getProxyBaseUrl)(),"/ui/login"))},[x,m,g,p]);let h=(0,i.useMemo)(()=>{if(!x)return null;try{return(0,r.o)(x)}catch(e){return(0,l.b)(),m.replace("".concat((0,s.getProxyBaseUrl)(),"/ui/login")),null}},[x,m]);return{token:x,accessToken:null!==(e=null==h?void 0:h.key)&&void 0!==e?e:null,userId:null!==(t=null==h?void 0:h.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==h?void 0:h.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(c=null==h?void 0:h.user_role)&&void 0!==c?c:null),premiumUser:null!==(d=null==h?void 0:h.premium_user)&&void 0!==d?d:null,disabledPersonalKeyCreation:null!==(u=null==h?void 0:h.disabled_non_admin_personal_key_creation)&&void 0!==u?u:null,showSSOBanner:(null==h?void 0:h.login_method)==="username_password"}}},82586:function(e,t,a){var s=a(57437),l=a(2265),r=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select agents",disabled:d=!1}=e,[u,m]=(0,l.useState)([]),[p,g]=(0,l.useState)([]),[x,h]=(0,l.useState)(!1);(0,l.useEffect)(()=>{(async()=>{if(o){h(!0);try{let e=await (0,n.getAgentsList)(o),t=(null==e?void 0:e.agents)||[];m(t);let a=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>a.add(e))}),g(Array.from(a))}catch(e){console.error("Error fetching agents:",e)}finally{h(!1)}}})()},[o]);let f=[...p.map(e=>({label:e,value:"group:".concat(e),isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.agent_name||e.agent_id),value:e.agent_id,isAccessGroup:!1,searchText:"".concat(e.agent_name||e.agent_id," ").concat(e.agent_id," Agent")}))],v=[...(null==a?void 0:a.agents)||[],...((null==a?void 0:a.accessGroups)||[]).map(e=>"group:".concat(e))];return(0,s.jsx)("div",{children:(0,s.jsx)(r.default,{mode:"multiple",placeholder:c,onChange:e=>{t({agents:e.filter(e=>!e.startsWith("group:")),accessGroups:e.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:v,loading:x,className:i,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(r.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}},97434:function(e,t,a){a.d(t,{Dg:function(){return r},Lo:function(){return n},PA:function(){return c},RD:function(){return i},Z3:function(){return o}});let s="../ui/assets/logos/",l=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],r=l.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=l.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=l.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),o=e=>e.map(e=>n[e]||e),c=e=>e.map(e=>i[e]||e)},95096:function(e,t,a){var s=a(57437),l=a(2265),r=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,p]=(0,l.useState)([]),[g,x]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(o){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(o,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);p(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[o,u]),(0,s.jsx)(r.default,{mode:"tags",placeholder:c,onChange:t,value:a,loading:g,className:i,allowClear:!0,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return l},Ob:function(){return n},W0:function(){return r}});var s=a(19250);let l=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let l=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),r=[],n=[];return l.forEach(e=>{e.endsWith("/*")?r.push(e):n.push(e)}),[...r,...n]}}catch(e){console.error("Error fetching user models:",e)}},r=e=>{if("all-proxy-models"===e)return"All Proxy Models";if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let l=e.replace("/*",""),r=t.filter(e=>e.startsWith(l+"/"));s.push(...r),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},97492:function(e,t,a){a.d(t,{Z:function(){return m}});var s=a(57437),l=a(11713),r=a(90246),n=a(19250),i=a(39760);let o=(0,r.n)("mcpAccessGroups"),c=()=>{let{accessToken:e}=(0,i.Z)();return(0,l.a)({queryKey:o.list({}),queryFn:async()=>await (0,n.fetchMCPAccessGroups)(e),enabled:!!e})};var d=a(68474),u=a(37592);a(2265);var m=e=>{let{onChange:t,value:a,className:l,accessToken:r,placeholder:n="Select MCP servers",disabled:i=!1}=e,{data:o=[],isLoading:m}=(0,d.F)(),{data:p=[],isLoading:g}=c(),x=[...p.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...o.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],h=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(u.default,{mode:"multiple",placeholder:n,onChange:e=>{t({servers:e.filter(e=>!p.includes(e)),accessGroups:e.filter(e=>p.includes(e))})},value:h,loading:m||g,className:l,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:i,filterOption:(e,t)=>{var a;return((null===(a=x.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:x.map(e=>(0,s.jsx)(u.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),l=a(2265),r=a(19250),n=a(92280),i=a(10353),o=a(61994),c=a(32489),d=a(68474);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:u,onChange:m,disabled:p=!1}=e,{data:g=[]}=(0,d.F)(),[x,h]=(0,l.useState)({}),[f,v]=(0,l.useState)({}),[_,y]=(0,l.useState)({}),b=(0,l.useMemo)(()=>0===a.length?[]:g.filter(e=>a.includes(e.server_id)),[g,a]),j=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,r.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,l.useEffect)(()=>{b.forEach(e=>{x[e.server_id]||f[e.server_id]||j(e.server_id)})},[b]);let w=(e,t)=>{let a=u[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];m({...u,[e]:s})},N=e=>{let t=x[e]||[];m({...u,[e]:t.map(e=>e.name)})},k=e=>{m({...u,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:b.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],l=u[e.server_id]||[],r=f[e.server_id],d=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:p||r,children:"Select All"}),(0,s.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>k(e.server_id),disabled:p||r,children:"Deselect All"}),(0,s.jsx)("button",{type:"button",className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(c.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),r&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),d&&!r&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:d})]}),!r&&!d&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=l.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(o.Z,{checked:a,onChange:()=>w(e.server_id,t.name),disabled:p}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!r&&!d&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},10703:function(e,t,a){a.d(t,{p:function(){return l}});var s=a(19250);let l=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0: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}}},24199:function(e,t,a){a.d(t,{Z:function(){return r}});var s=a(57437);a(2265);var l=a(30150),r=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:r="Enter a numerical value",min:n,max:i,onChange:o,...c}=e;return(0,s.jsx)(l.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:r,min:n,max:i,onChange:o,...c})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var l=a(37592),r=a(99981),n=a(23496),i=a(15424),o=a(78489),c=a(12514),d=a(49566),u=a(91777),m=a(82182),p=a(22452),g=a(74998),x=a(97434),h=a(24199);let{Option:f}=l.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},w=e=>{j(t.filter((t,a)=>a!==e))},N=(e,a,s)=>{let l=[...t];if("callback_name"===a){let t=x.Lo[s]||s;l[e]={...l[e],[a]:t,callback_vars:{}}}else l[e]={...l[e],[a]:s};j(l)},k=(e,a,s)=>{let l=[...t];l[e]={...l[e],callback_vars:{...l[e].callback_vars,[a]:s}},j(l)},C=(e,t)=>{var a,l;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let o=(null===(l=x.Dg[n])||void 0===l?void 0:l.dynamic_params)||{};return 0===Object.keys(o).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(o).map(a=>{let[l,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:l.replace(/_/g," ")}),(0,s.jsx)(r.Z,{title:"Environment variable reference recommended: os.environ/".concat(l.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(l.toUpperCase()),value:e.callback_vars[l]||"",onChange:e=>k(t,l,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(l.toUpperCase()),value:e.callback_vars[l]||"",onChange:e=>k(t,l,e.target.value)})]},l)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(r.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(l.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let l=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(r.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[l&&(0,s.jsx)("img",{src:l,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(r.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(o.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:p.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(c.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(o.Z,{variant:"light",onClick:()=>w(t),icon:g.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(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.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(l.default,{value:i,placeholder:"Select integration",onChange:e=>N(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let l=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(r.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[l&&(0,s.jsx)("img",{src:l,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(l.default,{value:e.callback_type,onChange:e=>N(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),l=a(2265),r=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select vector stores",disabled:d=!1}=e,[u,m]=(0,l.useState)([]),[p,g]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(o){g(!0);try{let e=await (0,n.vectorStoreListCall)(o);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{g(!1)}}})()},[o]),(0,s.jsx)("div",{children:(0,s.jsx)(r.default,{mode:"multiple",placeholder:c,onChange:t,value:a,loading:p,className:i,allowClear:!0,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{GS:function(){return n},nl:function(){return l},pw:function(){return r},vQ:function(){return i}});var s=a(9114);function l(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=!(arguments.length>3)||void 0===arguments[3]||arguments[3];if(null==e||!Number.isFinite(e)||0===e&&!s)return"-";let l={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",l);let r=Math.abs(e),n=r,i="";return r>=1e6?(n=r/1e6,i="M"):r>=1e3&&(n=r/1e3,i="K"),"".concat(e<0?"-":"").concat(n.toLocaleString("en-US",l)).concat(i)},n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6;if(null==e||!Number.isFinite(e)||0===e)return"-";let a=r(e,t,!1,!1);if(0===Number(a.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return"< $".concat(e)}return"$".concat(a)},i=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return o(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),o(e,t)}},o=(e,t)=>{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 s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return r},P4:function(){return i},ZL:function(){return s},_p:function(){return c},lo:function(){return l},tY:function(){return n},yV:function(){return o}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],l=["Internal User","Internal Viewer"],r=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e),i=e=>"proxy_admin"===e||"Admin"===e,o=(e,t)=>null!=e&&e.some(e=>c(e,t)),c=(e,t)=>null!=e&&null!=e.members_with_roles&&e.members_with_roles.some(e=>e.user_id===t&&"admin"===e.role)}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5144-bbc18c43eade9aef.js b/litellm/proxy/_experimental/out/_next/static/chunks/5144-bbc18c43eade9aef.js new file mode 100644 index 0000000000..c94a176fb2 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5144-bbc18c43eade9aef.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5144],{95704:function(e,t,a){a.d(t,{Dx:function(){return u.Z},RM:function(){return r.Z},SC:function(){return c.Z},Zb:function(){return s.Z},iA:function(){return l.Z},pj:function(){return n.Z},ss:function(){return i.Z},xs:function(){return o.Z},xv:function(){return d.Z}});var s=a(12514),l=a(21626),r=a(97214),n=a(28241),i=a(58834),o=a(69552),c=a(71876),d=a(84264),u=a(96761)},92280:function(e,t,a){a.d(t,{x:function(){return s.Z}});var s=a(84264)},56522:function(e,t,a){a.d(t,{o:function(){return l.Z},x:function(){return s.Z}});var s=a(84264),l=a(49566)},90246:function(e,t,a){a.d(t,{n:function(){return s}});function s(e){let t=[e];return{all:t,lists:()=>[...t,"list"],list:e=>[...t,"list",{params:e}],details:()=>[...t,"detail"],detail:e=>[...t,"detail",e]}}},68474:function(e,t,a){a.d(t,{F:function(){return o}});var s=a(11713),l=a(90246),r=a(19250),n=a(80443);let i=(0,l.n)("mcpServers"),o=()=>{let{accessToken:e}=(0,n.Z)();return(0,s.a)({queryKey:i.list({}),queryFn:async()=>await (0,r.fetchMCPServers)(e),enabled:!!e})}},76191:function(e,t,a){a.d(t,{p:function(){return n}});var s=a(19250),l=a(11713);let r=(0,a(90246).n)("uiConfig"),n=()=>(0,l.a)({queryKey:r.list({}),queryFn:async()=>await (0,s.getUiConfig)(),staleTime:864e5,gcTime:864e5})},80443:function(e,t,a){var s=a(19250),l=a(3914),r=a(14474),n=a(99376),i=a(2265),o=a(76191);t.Z=()=>{var e,t,a,c,d,u;let m=(0,n.useRouter)(),{data:p,isLoading:g}=(0,o.p)(),x="undefined"!=typeof document?(0,l.e)("token"):null;(0,i.useEffect)(()=>{!g&&(!x||(null==p?void 0:p.admin_ui_disabled))&&m.replace("".concat((0,s.getProxyBaseUrl)(),"/ui/login"))},[x,m,g,p]);let h=(0,i.useMemo)(()=>{if(!x)return null;try{return(0,r.o)(x)}catch(e){return(0,l.b)(),m.replace("".concat((0,s.getProxyBaseUrl)(),"/ui/login")),null}},[x,m]);return{token:x,accessToken:null!==(e=null==h?void 0:h.key)&&void 0!==e?e:null,userId:null!==(t=null==h?void 0:h.user_id)&&void 0!==t?t:null,userEmail:null!==(a=null==h?void 0:h.user_email)&&void 0!==a?a:null,userRole:function(e){if(!e)return"Undefined Role";switch(e.toLowerCase()){case"app_owner":case"demo_app_owner":return"App Owner";case"app_admin":case"proxy_admin":return"Admin";case"proxy_admin_viewer":return"Admin Viewer";case"org_admin":return"Org Admin";case"internal_user":return"Internal User";case"internal_user_viewer":case"internal_viewer":return"Internal Viewer";case"app_user":return"App User";default:return"Unknown Role"}}(null!==(c=null==h?void 0:h.user_role)&&void 0!==c?c:null),premiumUser:null!==(d=null==h?void 0:h.premium_user)&&void 0!==d?d:null,disabledPersonalKeyCreation:null!==(u=null==h?void 0:h.disabled_non_admin_personal_key_creation)&&void 0!==u?u:null,showSSOBanner:(null==h?void 0:h.login_method)==="username_password"}}},82586:function(e,t,a){var s=a(57437),l=a(2265),r=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select agents",disabled:d=!1}=e,[u,m]=(0,l.useState)([]),[p,g]=(0,l.useState)([]),[x,h]=(0,l.useState)(!1);(0,l.useEffect)(()=>{(async()=>{if(o){h(!0);try{let e=await (0,n.getAgentsList)(o),t=(null==e?void 0:e.agents)||[];m(t);let a=new Set;t.forEach(e=>{let t=e.agent_access_groups;t&&Array.isArray(t)&&t.forEach(e=>a.add(e))}),g(Array.from(a))}catch(e){console.error("Error fetching agents:",e)}finally{h(!1)}}})()},[o]);let f=[...p.map(e=>({label:e,value:"group:".concat(e),isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...u.map(e=>({label:"".concat(e.agent_name||e.agent_id),value:e.agent_id,isAccessGroup:!1,searchText:"".concat(e.agent_name||e.agent_id," ").concat(e.agent_id," Agent")}))],v=[...(null==a?void 0:a.agents)||[],...((null==a?void 0:a.accessGroups)||[]).map(e=>"group:".concat(e))];return(0,s.jsx)("div",{children:(0,s.jsx)(r.default,{mode:"multiple",placeholder:c,onChange:e=>{t({agents:e.filter(e=>!e.startsWith("group:")),accessGroups:e.filter(e=>e.startsWith("group:")).map(e=>e.replace("group:",""))})},value:v,loading:x,className:i,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:d,filterOption:(e,t)=>{var a;return((null===(a=f.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:f.map(e=>(0,s.jsx)(r.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#722ed1",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#722ed1",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"Agent"})]})},e.value))})})}},97434:function(e,t,a){a.d(t,{Dg:function(){return r},Lo:function(){return n},PA:function(){return c},RD:function(){return i},Z3:function(){return o}});let s="../ui/assets/logos/",l=[{id:"arize",displayName:"Arize",logo:"".concat(s,"arize.png"),supports_key_team_logging:!0,dynamic_params:{arize_api_key:"password",arize_space_id:"password"},description:"Arize Logging Integration"},{id:"braintrust",displayName:"Braintrust",logo:"".concat(s,"braintrust.png"),supports_key_team_logging:!1,dynamic_params:{braintrust_api_key:"password",braintrust_project_name:"text"},description:"Braintrust Logging Integration"},{id:"custom_callback_api",displayName:"Custom Callback API",logo:"".concat(s,"custom.svg"),supports_key_team_logging:!0,dynamic_params:{custom_callback_api_url:"text",custom_callback_api_headers:"text"},description:"Custom Callback API Logging Integration"},{id:"datadog",displayName:"Datadog",logo:"".concat(s,"datadog.png"),supports_key_team_logging:!1,dynamic_params:{dd_api_key:"password",dd_site:"text"},description:"Datadog Logging Integration"},{id:"lago",displayName:"Lago",logo:"".concat(s,"lago.svg"),supports_key_team_logging:!1,dynamic_params:{lago_api_url:"text",lago_api_key:"password"},description:"Lago Billing Logging Integration"},{id:"langfuse",displayName:"Langfuse",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v2 Logging Integration"},{id:"langfuse_otel",displayName:"Langfuse OTEL",logo:"".concat(s,"langfuse.png"),supports_key_team_logging:!0,dynamic_params:{langfuse_public_key:"text",langfuse_secret_key:"password",langfuse_host:"text"},description:"Langfuse v3 OTEL Logging Integration"},{id:"langsmith",displayName:"LangSmith",logo:"".concat(s,"langsmith.png"),supports_key_team_logging:!0,dynamic_params:{langsmith_api_key:"password",langsmith_project:"text",langsmith_base_url:"text",langsmith_sampling_rate:"number"},description:"Langsmith Logging Integration"},{id:"openmeter",displayName:"OpenMeter",logo:"".concat(s,"openmeter.png"),supports_key_team_logging:!1,dynamic_params:{openmeter_api_key:"password",openmeter_base_url:"text"},description:"OpenMeter Logging Integration"},{id:"otel",displayName:"Open Telemetry",logo:"".concat(s,"otel.png"),supports_key_team_logging:!1,dynamic_params:{otel_endpoint:"text",otel_headers:"text"},description:"OpenTelemetry Logging Integration"},{id:"s3",displayName:"S3",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{s3_bucket_name:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"S3 Bucket (AWS) Logging Integration"},{id:"SQS",displayName:"SQS",logo:"".concat(s,"aws.svg"),supports_key_team_logging:!1,dynamic_params:{sqs_queue_url:"text",aws_access_key_id:"password",aws_secret_access_key:"password",aws_region:"text"},description:"SQS Queue (AWS) Logging Integration"}],r=l.reduce((e,t)=>(e[t.displayName]=t,e),{}),n=l.reduce((e,t)=>(e[t.displayName]=t.id,e),{}),i=l.reduce((e,t)=>(e[t.id]=t.displayName,e),{}),o=e=>e.map(e=>n[e]||e),c=e=>e.map(e=>i[e]||e)},95096:function(e,t,a){var s=a(57437),l=a(2265),r=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select pass through routes",disabled:d=!1,teamId:u}=e,[m,p]=(0,l.useState)([]),[g,x]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(o){x(!0);try{let e=await (0,n.getPassThroughEndpointsCall)(o,u);if(e.endpoints){let t=e.endpoints.map(e=>e.path);p(t)}}catch(e){console.error("Error fetching pass through routes:",e)}finally{x(!1)}}})()},[o,u]),(0,s.jsx)(r.default,{mode:"tags",placeholder:c,onChange:t,value:a,loading:g,className:i,allowClear:!0,options:m.map(e=>({label:e,value:e})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})}},46468:function(e,t,a){a.d(t,{K2:function(){return l},Ob:function(){return n},W0:function(){return r}});var s=a(19250);let l=async(e,t,a)=>{try{if(null===e||null===t)return;if(null!==a){let l=(await (0,s.modelAvailableCall)(a,e,t,!0,null,!0)).data.map(e=>e.id),r=[],n=[];return l.forEach(e=>{e.endsWith("/*")?r.push(e):n.push(e)}),[...r,...n]}}catch(e){console.error("Error fetching user models:",e)}},r=e=>{if("all-proxy-models"===e)return"All Proxy Models";if(e.endsWith("/*")){let t=e.replace("/*","");return"All ".concat(t," models")}return e},n=(e,t)=>{let a=[],s=[];return console.log("teamModels",e),console.log("allModels",t),e.forEach(e=>{if(e.endsWith("/*")){let l=e.replace("/*",""),r=t.filter(e=>e.startsWith(l+"/"));s.push(...r),a.push(e)}else s.push(e)}),[...a,...s].filter((e,t,a)=>a.indexOf(e)===t)}},97492:function(e,t,a){a.d(t,{Z:function(){return m}});var s=a(57437),l=a(11713),r=a(90246),n=a(19250),i=a(80443);let o=(0,r.n)("mcpAccessGroups"),c=()=>{let{accessToken:e}=(0,i.Z)();return(0,l.a)({queryKey:o.list({}),queryFn:async()=>await (0,n.fetchMCPAccessGroups)(e),enabled:!!e})};var d=a(68474),u=a(37592);a(2265);var m=e=>{let{onChange:t,value:a,className:l,accessToken:r,placeholder:n="Select MCP servers",disabled:i=!1}=e,{data:o=[],isLoading:m}=(0,d.F)(),{data:p=[],isLoading:g}=c(),x=[...p.map(e=>({label:e,value:e,isAccessGroup:!0,searchText:"".concat(e," Access Group")})),...o.map(e=>({label:"".concat(e.server_name||e.server_id," (").concat(e.server_id,")"),value:e.server_id,isAccessGroup:!1,searchText:"".concat(e.server_name||e.server_id," ").concat(e.server_id," MCP Server")}))],h=[...(null==a?void 0:a.servers)||[],...(null==a?void 0:a.accessGroups)||[]];return(0,s.jsx)("div",{children:(0,s.jsx)(u.default,{mode:"multiple",placeholder:n,onChange:e=>{t({servers:e.filter(e=>!p.includes(e)),accessGroups:e.filter(e=>p.includes(e))})},value:h,loading:m||g,className:l,allowClear:!0,showSearch:!0,style:{width:"100%"},disabled:i,filterOption:(e,t)=>{var a;return((null===(a=x.find(e=>e.value===(null==t?void 0:t.value)))||void 0===a?void 0:a.searchText)||"").toLowerCase().includes(e.toLowerCase())},children:x.map(e=>(0,s.jsx)(u.default.Option,{value:e.value,label:e.label,children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,s.jsx)("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:e.isAccessGroup?"#52c41a":"#1890ff",flexShrink:0}}),(0,s.jsx)("span",{style:{flex:1},children:e.label}),(0,s.jsx)("span",{style:{color:e.isAccessGroup?"#52c41a":"#1890ff",fontSize:"12px",fontWeight:500,opacity:.8},children:e.isAccessGroup?"Access Group":"MCP Server"})]})},e.value))})})}},68473:function(e,t,a){var s=a(57437),l=a(2265),r=a(19250),n=a(92280),i=a(10353),o=a(4156),c=a(32489),d=a(68474);t.Z=e=>{let{accessToken:t,selectedServers:a,toolPermissions:u,onChange:m,disabled:p=!1}=e,{data:g=[]}=(0,d.F)(),[x,h]=(0,l.useState)({}),[f,v]=(0,l.useState)({}),[_,y]=(0,l.useState)({}),b=(0,l.useMemo)(()=>0===a.length?[]:g.filter(e=>a.includes(e.server_id)),[g,a]),j=async e=>{v(t=>({...t,[e]:!0})),y(t=>({...t,[e]:""}));try{let a=await (0,r.listMCPTools)(t,e);a.error?(y(t=>({...t,[e]:a.message||"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))):h(t=>({...t,[e]:a.tools||[]}))}catch(t){console.error("Error fetching tools for server ".concat(e,":"),t),y(t=>({...t,[e]:"Failed to fetch tools"})),h(t=>({...t,[e]:[]}))}finally{v(t=>({...t,[e]:!1}))}};(0,l.useEffect)(()=>{b.forEach(e=>{x[e.server_id]||f[e.server_id]||j(e.server_id)})},[b]);let w=(e,t)=>{let a=u[e]||[],s=a.includes(t)?a.filter(e=>e!==t):[...a,t];m({...u,[e]:s})},N=e=>{let t=x[e]||[];m({...u,[e]:t.map(e=>e.name)})},k=e=>{m({...u,[e]:[]})};return 0===a.length?null:(0,s.jsx)("div",{className:"space-y-4",children:b.map(e=>{let t=e.server_name||e.alias||e.server_id,a=x[e.server_id]||[],l=u[e.server_id]||[],r=f[e.server_id],d=_[e.server_id];return(0,s.jsxs)("div",{className:"border rounded-lg bg-gray-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b bg-white rounded-t-lg",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)(n.x,{className:"font-semibold text-gray-900",children:t}),e.description&&(0,s.jsx)(n.x,{className:"text-sm text-gray-500",children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>N(e.server_id),disabled:p||r,children:"Select All"}),(0,s.jsx)("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 font-medium",onClick:()=>k(e.server_id),disabled:p||r,children:"Deselect All"}),(0,s.jsx)("button",{type:"button",className:"text-gray-400 hover:text-gray-600",onClick:()=>{},children:(0,s.jsx)(c.Z,{className:"w-4 h-4"})})]})]}),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)(n.x,{className:"text-sm font-medium text-gray-700 mb-3",children:"Available Tools"}),r&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(i.Z,{size:"large"}),(0,s.jsx)(n.x,{className:"ml-3 text-gray-500",children:"Loading tools..."})]}),d&&!r&&(0,s.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg text-center",children:[(0,s.jsx)(n.x,{className:"text-red-600 font-medium",children:"Unable to load tools"}),(0,s.jsx)(n.x,{className:"text-sm text-red-500 mt-1",children:d})]}),!r&&!d&&a.length>0&&(0,s.jsx)("div",{className:"space-y-2",children:a.map(t=>{let a=l.includes(t.name);return(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(o.Z,{checked:a,onChange:()=>w(e.server_id,t.name),disabled:p}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.x,{className:"font-medium text-gray-900",children:t.name}),(0,s.jsxs)(n.x,{className:"text-sm text-gray-500",children:["- ",t.description||"No description"]})]})})]},t.name)})}),!r&&!d&&0===a.length&&(0,s.jsx)("div",{className:"text-center py-6",children:(0,s.jsx)(n.x,{className:"text-gray-500",children:"No tools available"})})]})]},e.server_id)})})}},10703:function(e,t,a){a.d(t,{p:function(){return l}});var s=a(19250);let l=async e=>{try{let t=await (0,s.modelHubCall)(e);if(console.log("model_info:",t),(null==t?void 0:t.data.length)>0){let e=t.data.map(e=>({model_group:e.model_group,mode:null==e?void 0: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}}},24199:function(e,t,a){a.d(t,{Z:function(){return r}});var s=a(57437);a(2265);var l=a(30150),r=e=>{let{step:t=.01,style:a={width:"100%"},placeholder:r="Enter a numerical value",min:n,max:i,onChange:o,...c}=e;return(0,s.jsx)(l.Z,{onWheel:e=>e.currentTarget.blur(),step:t,style:a,placeholder:r,min:n,max:i,onChange:o,...c})}},54507:function(e,t,a){a.d(t,{Z:function(){return v}});var s=a(57437);a(2265);var l=a(37592),r=a(99981),n=a(23496),i=a(15424),o=a(78489),c=a(12514),d=a(49566),u=a(91777),m=a(82182),p=a(22452),g=a(74998),x=a(97434),h=a(24199);let{Option:f}=l.default;var v=e=>{let{value:t=[],onChange:a,disabledCallbacks:v=[],onDisabledCallbacksChange:_}=e,y=Object.entries(x.Dg).filter(e=>{let[t,a]=e;return a.supports_key_team_logging}).map(e=>{let[t,a]=e;return t}),b=Object.keys(x.Dg),j=e=>{null==a||a(e)},w=e=>{j(t.filter((t,a)=>a!==e))},N=(e,a,s)=>{let l=[...t];if("callback_name"===a){let t=x.Lo[s]||s;l[e]={...l[e],[a]:t,callback_vars:{}}}else l[e]={...l[e],[a]:s};j(l)},k=(e,a,s)=>{let l=[...t];l[e]={...l[e],callback_vars:{...l[e].callback_vars,[a]:s}},j(l)},C=(e,t)=>{var a,l;if(!e.callback_name)return null;let n=null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0];if(!n)return null;let o=(null===(l=x.Dg[n])||void 0===l?void 0:l.dynamic_params)||{};return 0===Object.keys(o).length?null:(0,s.jsxs)("div",{className:"mt-6 pt-4 border-t border-gray-100",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2 mb-4",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-blue-100 rounded-full flex items-center justify-center",children:(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-500 rounded-full"})}),(0,s.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Integration Parameters"})]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-4",children:Object.entries(o).map(a=>{let[l,n]=a;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"text-sm font-medium text-gray-700 capitalize flex items-center space-x-1",children:[(0,s.jsx)("span",{children:l.replace(/_/g," ")}),(0,s.jsx)(r.Z,{title:"Environment variable reference recommended: os.environ/".concat(l.toUpperCase()),children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help text-xs"})}),"password"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Sensitive"}),"number"===n&&(0,s.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800",children:"Number"})]}),"number"===n&&(0,s.jsx)("span",{className:"text-xs text-gray-500",children:"Value must be between 0 and 1"}),"number"===n?(0,s.jsx)(h.Z,{step:.01,width:400,placeholder:"os.environ/".concat(l.toUpperCase()),value:e.callback_vars[l]||"",onChange:e=>k(t,l,e.target.value)}):(0,s.jsx)(d.Z,{type:"password"===n?"password":"text",placeholder:"os.environ/".concat(l.toUpperCase()),value:e.callback_vars[l]||"",onChange:e=>k(t,l,e.target.value)})]},l)})})]})};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(u.Z,{className:"w-5 h-5 text-red-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Disabled Callbacks"}),(0,s.jsx)(r.Z,{title:"Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Disabled Callbacks"}),(0,s.jsx)(l.default,{mode:"multiple",placeholder:"Select callbacks to disable",value:v,onChange:e=>{let t=(0,x.Z3)(e);null==_||_(t)},style:{width:"100%"},optionLabelProp:"label",children:b.map(e=>{var t,a;let l=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(r.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[l&&(0,s.jsx)("img",{src:l,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})}),(0,s.jsx)("div",{className:"text-xs text-gray-500",children:"Select callbacks that should be disabled for this key. These callbacks will not receive any logging data."})]})]}),(0,s.jsx)(n.Z,{}),(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 text-blue-500"}),(0,s.jsx)("span",{className:"text-base font-semibold text-gray-800",children:"Logging Integrations"}),(0,s.jsx)(r.Z,{title:"Configure callback logging integrations for this team.",children:(0,s.jsx)(i.Z,{className:"text-gray-400 cursor-help"})})]}),(0,s.jsx)(o.Z,{variant:"secondary",onClick:()=>{j([...t,{callback_name:"",callback_type:"success",callback_vars:{}}])},icon:p.Z,size:"sm",className:"hover:border-blue-400 hover:text-blue-500",type:"button",children:"Add Integration"})]}),(0,s.jsx)("div",{className:"space-y-4",children:t.map((e,t)=>{var a,n;let i=e.callback_name?null===(a=Object.entries(x.Lo).find(t=>{let[a,s]=t;return s===e.callback_name}))||void 0===a?void 0:a[0]:void 0,d=i?null===(n=x.Dg[i])||void 0===n?void 0:n.logo:null;return(0,s.jsxs)(c.Z,{className:"border border-gray-200 shadow-sm hover:shadow-md transition-shadow duration-200",decoration:"top",decorationColor:"blue",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[d&&(0,s.jsx)("img",{src:d,alt:i,className:"w-5 h-5 object-contain"}),(0,s.jsxs)("span",{className:"text-sm font-medium",children:[i||"New Integration"," Configuration"]})]}),(0,s.jsx)(o.Z,{variant:"light",onClick:()=>w(t),icon:g.Z,size:"xs",color:"red",className:"hover:bg-red-50",type:"button",children:"Remove"})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(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.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Integration Type"}),(0,s.jsx)(l.default,{value:i,placeholder:"Select integration",onChange:e=>N(t,"callback_name",e),className:"w-full",optionLabelProp:"label",children:y.map(e=>{var t,a;let l=null===(t=x.Dg[e])||void 0===t?void 0:t.logo,n=null===(a=x.Dg[e])||void 0===a?void 0:a.description;return(0,s.jsx)(f,{value:e,label:e,children:(0,s.jsx)(r.Z,{title:n,placement:"right",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[l&&(0,s.jsx)("img",{src:l,alt:e,className:"w-4 h-4 object-contain",onError:t=>{let a=t.target,s=a.parentElement;if(s){let t=document.createElement("div");t.className="w-4 h-4 rounded-full bg-gray-200 flex items-center justify-center text-xs",t.textContent=e.charAt(0),s.replaceChild(t,a)}}}),(0,s.jsx)("span",{children:e})]})})},e)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Event Type"}),(0,s.jsxs)(l.default,{value:e.callback_type,onChange:e=>N(t,"callback_type",e),className:"w-full",children:[(0,s.jsx)(f,{value:"success",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),(0,s.jsx)("span",{children:"Success Only"})]})}),(0,s.jsx)(f,{value:"failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full"}),(0,s.jsx)("span",{children:"Failure Only"})]})}),(0,s.jsx)(f,{value:"success_and_failure",children:(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),(0,s.jsx)("span",{children:"Success & Failure"})]})})]})]})]}),C(e,t)]})]},t)})}),0===t.length&&(0,s.jsxs)("div",{className:"text-center py-12 text-gray-500 border-2 border-dashed border-gray-200 rounded-lg bg-gray-50/50",children:[(0,s.jsx)(m.Z,{className:"w-12 h-12 text-gray-300 mb-3 mx-auto"}),(0,s.jsx)("div",{className:"text-base font-medium mb-1",children:"No logging integrations configured"}),(0,s.jsx)("div",{className:"text-sm text-gray-400",children:'Click "Add Integration" to configure logging for this team'})]})]})}},97415:function(e,t,a){var s=a(57437),l=a(2265),r=a(37592),n=a(19250);t.Z=e=>{let{onChange:t,value:a,className:i,accessToken:o,placeholder:c="Select vector stores",disabled:d=!1}=e,[u,m]=(0,l.useState)([]),[p,g]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{(async()=>{if(o){g(!0);try{let e=await (0,n.vectorStoreListCall)(o);e.data&&m(e.data)}catch(e){console.error("Error fetching vector stores:",e)}finally{g(!1)}}})()},[o]),(0,s.jsx)("div",{children:(0,s.jsx)(r.default,{mode:"multiple",placeholder:c,onChange:t,value:a,loading:p,className:i,allowClear:!0,options:u.map(e=>({label:"".concat(e.vector_store_name||e.vector_store_id," (").concat(e.vector_store_id,")"),value:e.vector_store_id,title:e.vector_store_description||e.vector_store_id})),optionFilterProp:"label",showSearch:!0,style:{width:"100%"},disabled:d})})}},59872:function(e,t,a){a.d(t,{GS:function(){return n},nl:function(){return l},pw:function(){return r},vQ:function(){return i}});var s=a(9114);function l(e,t){let a=structuredClone(e);for(let[e,s]of Object.entries(t))e in a&&(a[e]=s);return a}let r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=!(arguments.length>3)||void 0===arguments[3]||arguments[3];if(null==e||!Number.isFinite(e)||0===e&&!s)return"-";let l={minimumFractionDigits:t,maximumFractionDigits:t};if(!a)return e.toLocaleString("en-US",l);let r=Math.abs(e),n=r,i="";return r>=1e6?(n=r/1e6,i="M"):r>=1e3&&(n=r/1e3,i="K"),"".concat(e<0?"-":"").concat(n.toLocaleString("en-US",l)).concat(i)},n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6;if(null==e||!Number.isFinite(e)||0===e)return"-";let a=r(e,t,!1,!1);if(0===Number(a.replace(/,/g,""))){let e=(1/10**t).toFixed(t);return"< $".concat(e)}return"$".concat(a)},i=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Copied to clipboard";if(!e)return!1;if(!navigator||!navigator.clipboard||!navigator.clipboard.writeText)return o(e,t);try{return await navigator.clipboard.writeText(e),s.Z.success(t),!0}catch(a){return console.error("Clipboard API failed: ",a),o(e,t)}},o=(e,t)=>{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 s.Z.success(t),!0;throw Error("execCommand failed")}catch(e){return s.Z.fromBackend("Failed to copy to clipboard"),console.error("Failed to copy: ",e),!1}}},20347:function(e,t,a){a.d(t,{LQ:function(){return r},P4:function(){return i},ZL:function(){return s},_p:function(){return c},lo:function(){return l},tY:function(){return n},yV:function(){return o}});let s=["Admin","Admin Viewer","proxy_admin","proxy_admin_viewer","org_admin"],l=["Internal User","Internal Viewer"],r=["Internal User","Admin","proxy_admin"],n=e=>s.includes(e),i=e=>"proxy_admin"===e||"Admin"===e,o=(e,t)=>null!=e&&e.some(e=>c(e.members_with_roles,t)),c=(e,t)=>null!=e&&e.some(e=>e.user_id===t&&"admin"===e.role)}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5202-60292daf4bc5c8fb.js b/litellm/proxy/_experimental/out/_next/static/chunks/5202-60292daf4bc5c8fb.js new file mode 100644 index 0000000000..a3b75a9b46 --- /dev/null +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5202-60292daf4bc5c8fb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5202,7688],{69993:function(t,e,n){n.d(e,{Z:function(){return c}});var o=n(1119),r=n(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"},i=n(55015),c=r.forwardRef(function(t,e){return r.createElement(i.Z,(0,o.Z)({},t,{ref:e,icon:a}))})},49804:function(t,e,n){n.d(e,{Z:function(){return s}});var o=n(5853),r=n(13241),a=n(1153),i=n(2265),c=n(9496);let l=(0,a.fn)("Col"),s=i.forwardRef((t,e)=>{let{numColSpan:n=1,numColSpanSm:a,numColSpanMd:s,numColSpanLg:u,children:d,className:m}=t,f=(0,o._T)(t,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),g=(t,e)=>t&&Object.keys(e).includes(String(t))?e[t]:"";return i.createElement("div",Object.assign({ref:e,className:(0,r.q)(l("root"),(()=>{let t=g(n,c.PT),e=g(a,c.SP),o=g(s,c.VS),i=g(u,c._w);return(0,r.q)(t,e,o,i)})(),m)},f),d)});s.displayName="Col"},44140:function(t,e,n){n.d(e,{Z:function(){return r}});var o=n(2265);let r=(t,e)=>{let n=void 0!==e,[r,a]=(0,o.useState)(t);return[n?e:r,t=>{n||a(t)}]}},33866:function(t,e,n){n.d(e,{Z:function(){return B}});var o=n(2265),r=n(36760),a=n.n(r),i=n(66632),c=n(93350),l=n(19722),s=n(71744),u=n(93463),d=n(12918),m=n(18536),f=n(71140),g=n(99320);let b=new u.E4("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),p=new u.E4("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),v=new u.E4("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),h=new u.E4("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),w=new u.E4("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),k=new u.E4("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),O=t=>{let{componentCls:e,iconCls:n,antCls:o,badgeShadowSize:r,textFontSize:a,textFontSizeSM:i,statusSize:c,dotSize:l,textFontWeight:s,indicatorHeight:f,indicatorHeightSM:g,marginXS:O,calc:E}=t,j="".concat(o,"-scroll-number"),y=(0,m.Z)(t,(t,n)=>{let{darkColor:o}=n;return{["&".concat(e," ").concat(e,"-color-").concat(t)]:{background:o,["&:not(".concat(e,"-count)")]:{color:o},"a:hover &":{background:o}}}});return{[e]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,d.Wf)(t)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,["".concat(e,"-count")]:{display:"inline-flex",justifyContent:"center",zIndex:t.indicatorZIndex,minWidth:f,height:f,color:t.badgeTextColor,fontWeight:s,fontSize:a,lineHeight:(0,u.bf)(f),whiteSpace:"nowrap",textAlign:"center",background:t.badgeColor,borderRadius:E(f).div(2).equal(),boxShadow:"0 0 0 ".concat((0,u.bf)(r)," ").concat(t.badgeShadowColor),transition:"background ".concat(t.motionDurationMid),a:{color:t.badgeTextColor},"a:hover":{color:t.badgeTextColor},"a:hover &":{background:t.badgeColorHover}},["".concat(e,"-count-sm")]:{minWidth:g,height:g,fontSize:i,lineHeight:(0,u.bf)(g),borderRadius:E(g).div(2).equal()},["".concat(e,"-multiple-words")]:{padding:"0 ".concat((0,u.bf)(t.paddingXS)),bdi:{unicodeBidi:"plaintext"}},["".concat(e,"-dot")]:{zIndex:t.indicatorZIndex,width:l,minWidth:l,height:l,background:t.badgeColor,borderRadius:"100%",boxShadow:"0 0 0 ".concat((0,u.bf)(r)," ").concat(t.badgeShadowColor)},["".concat(e,"-count, ").concat(e,"-dot, ").concat(j,"-custom-component")]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",["&".concat(n,"-spin")]:{animationName:k,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},["&".concat(e,"-status")]:{lineHeight:"inherit",verticalAlign:"baseline",["".concat(e,"-status-dot")]:{position:"relative",top:-1,display:"inline-block",width:c,height:c,verticalAlign:"middle",borderRadius:"50%"},["".concat(e,"-status-success")]:{backgroundColor:t.colorSuccess},["".concat(e,"-status-processing")]:{overflow:"visible",color:t.colorInfo,backgroundColor:t.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:r,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:b,animationDuration:t.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},["".concat(e,"-status-default")]:{backgroundColor:t.colorTextPlaceholder},["".concat(e,"-status-error")]:{backgroundColor:t.colorError},["".concat(e,"-status-warning")]:{backgroundColor:t.colorWarning},["".concat(e,"-status-text")]:{marginInlineStart:O,color:t.colorText,fontSize:t.fontSize}}}),y),{["".concat(e,"-zoom-appear, ").concat(e,"-zoom-enter")]:{animationName:p,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},["".concat(e,"-zoom-leave")]:{animationName:v,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},["&".concat(e,"-not-a-wrapper")]:{["".concat(e,"-zoom-appear, ").concat(e,"-zoom-enter")]:{animationName:h,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},["".concat(e,"-zoom-leave")]:{animationName:w,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},["&:not(".concat(e,"-status)")]:{verticalAlign:"middle"},["".concat(j,"-custom-component, ").concat(e,"-count")]:{transform:"none"},["".concat(j,"-custom-component, ").concat(j)]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[j]:{overflow:"hidden",transition:"all ".concat(t.motionDurationMid," ").concat(t.motionEaseOutBack),["".concat(j,"-only")]:{position:"relative",display:"inline-block",height:f,transition:"all ".concat(t.motionDurationSlow," ").concat(t.motionEaseOutBack),WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",["> p".concat(j,"-only-unit")]:{height:f,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},["".concat(j,"-symbol")]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",["".concat(e,"-count, ").concat(e,"-dot, ").concat(j,"-custom-component")]:{transform:"translate(-50%, -50%)"}}})}},E=t=>{let{fontHeight:e,lineWidth:n,marginXS:o,colorBorderBg:r}=t,a=t.colorTextLightSolid,i=t.colorError,c=t.colorErrorHover;return(0,f.IX)(t,{badgeFontHeight:e,badgeShadowSize:n,badgeTextColor:a,badgeColor:i,badgeColorHover:c,badgeShadowColor:r,badgeProcessingDuration:"1.2s",badgeRibbonOffset:o,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},j=t=>{let{fontSize:e,lineHeight:n,fontSizeSM:o,lineWidth:r}=t;return{indicatorZIndex:"auto",indicatorHeight:Math.round(e*n)-2*r,indicatorHeightSM:e,dotSize:o/2,textFontSize:o,textFontSizeSM:o,textFontWeight:"normal",statusSize:o/2}};var y=(0,g.I$)("Badge",t=>O(E(t)),j);let C=t=>{let{antCls:e,badgeFontHeight:n,marginXS:o,badgeRibbonOffset:r,calc:a}=t,i="".concat(e,"-ribbon"),c=(0,m.Z)(t,(t,e)=>{let{darkColor:n}=e;return{["&".concat(i,"-color-").concat(t)]:{background:n,color:n}}});return{["".concat(e,"-ribbon-wrapper")]:{position:"relative"},[i]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,d.Wf)(t)),{position:"absolute",top:o,padding:"0 ".concat((0,u.bf)(t.paddingXS)),color:t.colorPrimary,lineHeight:(0,u.bf)(n),whiteSpace:"nowrap",backgroundColor:t.colorPrimary,borderRadius:t.borderRadiusSM,["".concat(i,"-text")]:{color:t.badgeTextColor},["".concat(i,"-corner")]:{position:"absolute",top:"100%",width:r,height:r,color:"currentcolor",border:"".concat((0,u.bf)(a(r).div(2).equal())," solid"),transform:t.badgeRibbonCornerTransform,transformOrigin:"top",filter:t.badgeRibbonCornerFilter}}),c),{["&".concat(i,"-placement-end")]:{insetInlineEnd:a(r).mul(-1).equal(),borderEndEndRadius:0,["".concat(i,"-corner")]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},["&".concat(i,"-placement-start")]:{insetInlineStart:a(r).mul(-1).equal(),borderEndStartRadius:0,["".concat(i,"-corner")]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}};var x=(0,g.I$)(["Badge","Ribbon"],t=>C(E(t)),j);let N=t=>{let e;let{prefixCls:n,value:r,current:i,offset:c=0}=t;return c&&(e={position:"absolute",top:"".concat(c,"00%"),left:0}),o.createElement("span",{style:e,className:a()("".concat(n,"-only-unit"),{current:i})},r)};var S=t=>{let e,n;let{prefixCls:r,count:a,value:i}=t,c=Number(i),l=Math.abs(a),[s,u]=o.useState(c),[d,m]=o.useState(l),f=()=>{u(c),m(l)};if(o.useEffect(()=>{let t=setTimeout(f,1e3);return()=>clearTimeout(t)},[c]),s===c||Number.isNaN(c)||Number.isNaN(s))e=[o.createElement(N,Object.assign({},t,{key:c,current:!0}))],n={transition:"none"};else{e=[];let r=c+10,a=[];for(let t=c;t<=r;t+=1)a.push(t);let i=dt%10===s);e=(i<0?a.slice(0,u+1):a.slice(u)).map((e,n)=>o.createElement(N,Object.assign({},t,{key:e,value:e%10,offset:i<0?n-u:n,current:n===u}))),n={transform:"translateY(".concat(-function(t,e,n){let o=t,r=0;for(;(o+10)%10!==e;)o+=n,r+=n;return r}(s,c,i),"00%)")}}return o.createElement("span",{className:"".concat(r,"-only"),style:n,onTransitionEnd:f},e)},M=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(t);re.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]]);return n};let L=o.forwardRef((t,e)=>{let{prefixCls:n,count:r,className:i,motionClassName:c,style:u,title:d,show:m,component:f="sup",children:g}=t,b=M(t,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:p}=o.useContext(s.E_),v=p("scroll-number",n),h=Object.assign(Object.assign({},b),{"data-show":m,style:u,className:a()(v,i,c),title:d}),w=r;if(r&&Number(r)%1==0){let t=String(r).split("");w=o.createElement("bdi",null,t.map((e,n)=>o.createElement(S,{prefixCls:v,count:Number(r),value:e,key:t.length-n})))}return((null==u?void 0:u.borderColor)&&(h.style=Object.assign(Object.assign({},u),{boxShadow:"0 0 0 1px ".concat(u.borderColor," inset")})),g)?(0,l.Tm)(g,t=>({className:a()("".concat(v,"-custom-component"),null==t?void 0:t.className,c)})):o.createElement(f,Object.assign({},h,{ref:e}),w)});var z=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(t);re.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]]);return n};let R=o.forwardRef((t,e)=>{var n,r,u,d,m;let{prefixCls:f,scrollNumberPrefixCls:g,children:b,status:p,text:v,color:h,count:w=null,overflowCount:k=99,dot:O=!1,size:E="default",title:j,offset:C,style:x,className:N,rootClassName:S,classNames:M,styles:R,showZero:B=!1}=t,Z=z(t,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:I,direction:T,badge:W}=o.useContext(s.E_),D=I("badge",f),[H,P,F]=y(D),_=w>k?"".concat(k,"+"):w,A="0"===_||0===_||"0"===v||0===v,V=null===w||A&&!B,q=(null!=p||null!=h)&&V,Q=null!=p||!A,Y=O&&!A,X=Y?"":_,$=(0,o.useMemo)(()=>((null==X||""===X)&&(null==v||""===v)||A&&!B)&&!Y,[X,A,B,Y,v]),G=(0,o.useRef)(w);$||(G.current=w);let J=G.current,K=(0,o.useRef)(X);$||(K.current=X);let U=K.current,tt=(0,o.useRef)(Y);$||(tt.current=Y);let te=(0,o.useMemo)(()=>{if(!C)return Object.assign(Object.assign({},null==W?void 0:W.style),x);let t={marginTop:C[1]};return"rtl"===T?t.left=Number.parseInt(C[0],10):t.right=-Number.parseInt(C[0],10),Object.assign(Object.assign(Object.assign({},t),null==W?void 0:W.style),x)},[T,C,x,null==W?void 0:W.style]),tn=null!=j?j:"string"==typeof J||"number"==typeof J?J:void 0,to=!$&&(0===v?B:!!v&&!0!==v),tr=to?o.createElement("span",{className:"".concat(D,"-status-text")},v):null,ta=J&&"object"==typeof J?(0,l.Tm)(J,t=>({style:Object.assign(Object.assign({},te),t.style)})):void 0,ti=(0,c.o2)(h,!1),tc=a()(null==M?void 0:M.indicator,null===(n=null==W?void 0:W.classNames)||void 0===n?void 0:n.indicator,{["".concat(D,"-status-dot")]:q,["".concat(D,"-status-").concat(p)]:!!p,["".concat(D,"-color-").concat(h)]:ti}),tl={};h&&!ti&&(tl.color=h,tl.background=h);let ts=a()(D,{["".concat(D,"-status")]:q,["".concat(D,"-not-a-wrapper")]:!b,["".concat(D,"-rtl")]:"rtl"===T},N,S,null==W?void 0:W.className,null===(r=null==W?void 0:W.classNames)||void 0===r?void 0:r.root,null==M?void 0:M.root,P,F);if(!b&&q&&(v||Q||!V)){let t=te.color;return H(o.createElement("span",Object.assign({},Z,{className:ts,style:Object.assign(Object.assign(Object.assign({},null==R?void 0:R.root),null===(u=null==W?void 0:W.styles)||void 0===u?void 0:u.root),te)}),o.createElement("span",{className:tc,style:Object.assign(Object.assign(Object.assign({},null==R?void 0:R.indicator),null===(d=null==W?void 0:W.styles)||void 0===d?void 0:d.indicator),tl)}),to&&o.createElement("span",{style:{color:t},className:"".concat(D,"-status-text")},v)))}return H(o.createElement("span",Object.assign({ref:e},Z,{className:ts,style:Object.assign(Object.assign({},null===(m=null==W?void 0:W.styles)||void 0===m?void 0:m.root),null==R?void 0:R.root)}),b,o.createElement(i.ZP,{visible:!$,motionName:"".concat(D,"-zoom"),motionAppear:!1,motionDeadline:1e3},t=>{var e,n;let{className:r}=t,i=I("scroll-number",g),c=tt.current,l=a()(null==M?void 0:M.indicator,null===(e=null==W?void 0:W.classNames)||void 0===e?void 0:e.indicator,{["".concat(D,"-dot")]:c,["".concat(D,"-count")]:!c,["".concat(D,"-count-sm")]:"small"===E,["".concat(D,"-multiple-words")]:!c&&U&&U.toString().length>1,["".concat(D,"-status-").concat(p)]:!!p,["".concat(D,"-color-").concat(h)]:ti}),s=Object.assign(Object.assign(Object.assign({},null==R?void 0:R.indicator),null===(n=null==W?void 0:W.styles)||void 0===n?void 0:n.indicator),te);return h&&!ti&&((s=s||{}).background=h),o.createElement(L,{prefixCls:i,show:!$,motionClassName:r,className:l,count:U,title:tn,style:s,key:"scrollNumber"},ta)}),tr))});R.Ribbon=t=>{let{className:e,prefixCls:n,style:r,color:i,children:l,text:u,placement:d="end",rootClassName:m}=t,{getPrefixCls:f,direction:g}=o.useContext(s.E_),b=f("ribbon",n),p="".concat(b,"-wrapper"),[v,h,w]=x(b,p),k=(0,c.o2)(i,!1),O=a()(b,"".concat(b,"-placement-").concat(d),{["".concat(b,"-rtl")]:"rtl"===g,["".concat(b,"-color-").concat(i)]:k},e),E={},j={};return i&&!k&&(E.background=i,j.color=i),v(o.createElement("div",{className:a()(p,m,h,w)},l,o.createElement("div",{className:a()(O,h),style:Object.assign(Object.assign({},E),r)},o.createElement("span",{className:"".concat(b,"-text")},u),o.createElement("div",{className:"".concat(b,"-corner"),style:j}))))};var B=R},32489:function(t,e,n){n.d(e,{Z:function(){return o}});let o=(0,n(79205).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},10900:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 19l-7-7m0 0l7-7m-7 7h18"}))});e.Z=r},91777:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"}))});e.Z=r},47686:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"}))});e.Z=r},58710:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.Z=r},82182:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}))});e.Z=r},79814:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"}))});e.Z=r},93416:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.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.Z=r},77355:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}))});e.Z=r},22452:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4v16m8-8H4"}))});e.Z=r},25327:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"}))});e.Z=r},49084:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"}))});e.Z=r},3497:function(t,e,n){var o=n(2265);let r=o.forwardRef(function(t,e){return o.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:e},t),o.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"}))});e.Z=r},92668:function(t,e,n){n.d(e,{I:function(){return c}});var o=n(59121),r=n(31091),a=n(63497),i=n(99649);function c(t,e){let{years:n=0,months:c=0,weeks:l=0,days:s=0,hours:u=0,minutes:d=0,seconds:m=0}=e,f=(0,i.Q)(t),g=c||n?(0,r.z)(f,c+12*n):f,b=s||l?(0,o.E)(g,s+7*l):g;return(0,a.L)(t,b.getTime()+1e3*(m+60*(d+60*u)))}},59121:function(t,e,n){n.d(e,{E:function(){return a}});var o=n(99649),r=n(63497);function a(t,e){let n=(0,o.Q)(t);return isNaN(e)?(0,r.L)(t,NaN):(e&&n.setDate(n.getDate()+e),n)}},31091:function(t,e,n){n.d(e,{z:function(){return a}});var o=n(99649),r=n(63497);function a(t,e){let n=(0,o.Q)(t);if(isNaN(e))return(0,r.L)(t,NaN);if(!e)return n;let a=n.getDate(),i=(0,r.L)(t,n.getTime());return(i.setMonth(n.getMonth()+e+1,0),a>=i.getDate())?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}},63497:function(t,e,n){n.d(e,{L:function(){return o}});function o(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}},99649:function(t,e,n){n.d(e,{Q:function(){return o}});function o(t){let e=Object.prototype.toString.call(t);return t instanceof Date||"object"==typeof t&&"[object Date]"===e?new t.constructor(+t):new Date("number"==typeof t||"[object Number]"===e||"string"==typeof t||"[object String]"===e?t:NaN)}}}]); \ No newline at end of file diff --git a/litellm/proxy/_experimental/out/_next/static/chunks/5333-e9bc197d1822e3ad.js b/litellm/proxy/_experimental/out/_next/static/chunks/5333-1540faf81c7d7006.js similarity index 99% rename from litellm/proxy/_experimental/out/_next/static/chunks/5333-e9bc197d1822e3ad.js rename to litellm/proxy/_experimental/out/_next/static/chunks/5333-1540faf81c7d7006.js index 5e4051ca90..2a03ddfa5f 100644 --- a/litellm/proxy/_experimental/out/_next/static/chunks/5333-e9bc197d1822e3ad.js +++ b/litellm/proxy/_experimental/out/_next/static/chunks/5333-1540faf81c7d7006.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5333],{57365:function(e,t,n){n.d(t,{Z:function(){return a}});var r=n(5853),o=n(2265),l=n(51975),i=n(13241);let u=(0,n(1153).fn)("SelectItem"),a=o.forwardRef((e,t)=>{let{value:n,icon:a,className:s,children:c}=e,d=(0,r._T)(e,["value","icon","className","children"]);return o.createElement(l.wt,Object.assign({className:(0,i.q)(u("root"),"flex justify-start items-center cursor-default text-tremor-default px-2.5 py-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[selected]:text-tremor-content-strong data-[selected]:bg-tremor-background-muted text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[selected]:text-dark-tremor-content-strong dark:data-[selected]:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",s),ref:t,key:n,value:n},d),a&&o.createElement(a,{className:(0,i.q)(u("icon"),"flex-none w-5 h-5 mr-1.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}),o.createElement("span",{className:"whitespace-nowrap truncate"},null!=c?c:n))});a.displayName="SelectItem"},67101:function(e,t,n){n.d(t,{Z:function(){return c}});var r=n(5853),o=n(13241),l=n(1153),i=n(2265),u=n(9496);let a=(0,l.fn)("Grid"),s=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",c=i.forwardRef((e,t)=>{let{numItems:n=1,numItemsSm:l,numItemsMd:c,numItemsLg:d,children:f,className:p}=e,m=(0,r._T)(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),g=s(n,u._m),v=s(l,u.LH),h=s(c,u.l5),b=s(d,u.N4),x=(0,o.q)(g,v,h,b);return i.createElement("div",Object.assign({ref:t,className:(0,o.q)(a("root"),"grid",x,p)},m),f)});c.displayName="Grid"},9496:function(e,t,n){n.d(t,{LH:function(){return o},N4:function(){return i},PT:function(){return u},SP:function(){return a},VS:function(){return s},_m:function(){return r},_w:function(){return c},l5:function(){return l}});let r={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"},l={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"},i={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"},u={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"},a={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"},c={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"}},64803:function(e,t,n){n.d(t,{RR:function(){return m},YF:function(){return d},cv:function(){return f},dp:function(){return g},uY:function(){return p}});var r=n(51050),o=n(2265),l=n(54887),i="undefined"!=typeof document?o.useLayoutEffect:function(){};function u(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(!u(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(!({}).hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){let n=o[r];if(("_owner"!==n||!e.$$typeof)&&!u(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function a(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function s(e,t){let n=a(e);return Math.round(t*n)/n}function c(e){let t=o.useRef(e);return i(()=>{t.current=e}),t}function d(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:d=[],platform:f,elements:{reference:p,floating:m}={},transform:g=!0,whileElementsMounted:v,open:h}=e,[b,x]=o.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[E,y]=o.useState(d);u(E,d)||y(d);let[S,O]=o.useState(null),[R,w]=o.useState(null),C=o.useCallback(e=>{e!==M.current&&(M.current=e,O(e))},[]),P=o.useCallback(e=>{e!==k.current&&(k.current=e,w(e))},[]),L=p||S,T=m||R,M=o.useRef(null),k=o.useRef(null),I=o.useRef(b),F=null!=v,A=c(v),N=c(f),D=c(h),z=o.useCallback(()=>{if(!M.current||!k.current)return;let e={placement:t,strategy:n,middleware:E};N.current&&(e.platform=N.current),(0,r.oo)(M.current,k.current,e).then(e=>{let t={...e,isPositioned:!1!==D.current};H.current&&!u(I.current,t)&&(I.current=t,l.flushSync(()=>{x(t)}))})},[E,t,n,N,D]);i(()=>{!1===h&&I.current.isPositioned&&(I.current.isPositioned=!1,x(e=>({...e,isPositioned:!1})))},[h]);let H=o.useRef(!1);i(()=>(H.current=!0,()=>{H.current=!1}),[]),i(()=>{if(L&&(M.current=L),T&&(k.current=T),L&&T){if(A.current)return A.current(L,T,z);z()}},[L,T,z,A,F]);let _=o.useMemo(()=>({reference:M,floating:k,setReference:C,setFloating:P}),[C,P]),V=o.useMemo(()=>({reference:L,floating:T}),[L,T]),B=o.useMemo(()=>{let e={position:n,left:0,top:0};if(!V.floating)return e;let t=s(V.floating,b.x),r=s(V.floating,b.y);return g?{...e,transform:"translate("+t+"px, "+r+"px)",...a(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,g,V.floating,b.x,b.y]);return o.useMemo(()=>({...b,update:z,refs:_,elements:V,floatingStyles:B}),[b,z,_,V,B])}let f=(e,t)=>({...(0,r.cv)(e),options:[e,t]}),p=(e,t)=>({...(0,r.uY)(e),options:[e,t]}),m=(e,t)=>({...(0,r.RR)(e),options:[e,t]}),g=(e,t)=>({...(0,r.dp)(e),options:[e,t]})},52307:function(e,t,n){n.d(t,{dk:function(){return f},fw:function(){return d},zH:function(){return c}});var r=n(2265),o=n(93980),l=n(73389),i=n(67561),u=n(87550),a=n(38929);let s=(0,r.createContext)(null);function c(){var e,t;return null!=(t=null==(e=(0,r.useContext)(s))?void 0:e.value)?t:void 0}function d(){let[e,t]=(0,r.useState)([]);return[e.length>0?e.join(" "):void 0,(0,r.useMemo)(()=>function(e){let n=(0,o.z)(e=>(t(t=>[...t,e]),()=>t(t=>{let n=t.slice(),r=n.indexOf(e);return -1!==r&&n.splice(r,1),n}))),l=(0,r.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 r.createElement(s.Provider,{value:l},e.children)},[t])]}s.displayName="DescriptionContext";let f=Object.assign((0,a.yV)(function(e,t){let n=(0,r.useId)(),o=(0,u.B)(),{id:c="headlessui-description-".concat(n),...d}=e,f=function e(){let t=(0,r.useContext)(s);if(null===t){let t=Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,e),t}return t}(),p=(0,i.T)(t);(0,l.e)(()=>f.register(c),[c,f.register]);let m=o||!1,g=(0,r.useMemo)(()=>({...f.slot,disabled:m}),[f.slot,m]),v={ref:p,...f.props,id:c};return(0,a.L6)()({ourProps:v,theirProps:d,slot:g,defaultTag:"p",name:f.name||"Description"})}),{})},7935:function(e,t,n){n.d(t,{__:function(){return p},bE:function(){return f},wp:function(){return d}});var r=n(2265),o=n(93980),l=n(73389),i=n(67561),u=n(87550),a=n(80281),s=n(38929);let c=(0,r.createContext)(null);function d(e){var t,n,o;let l=null!=(n=null==(t=(0,r.useContext)(c))?void 0:t.value)?n:void 0;return(null!=(o=null==e?void 0:e.length)?o:0)>0?[l,...e].filter(Boolean).join(" "):l}function f(){let{inherit:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=d(),[n,l]=(0,r.useState)([]),i=e?[t,...n].filter(Boolean):n;return[i.length>0?i.join(" "):void 0,(0,r.useMemo)(()=>function(e){let t=(0,o.z)(e=>(l(t=>[...t,e]),()=>l(t=>{let n=t.slice(),r=n.indexOf(e);return -1!==r&&n.splice(r,1),n}))),n=(0,r.useMemo)(()=>({register:t,slot:e.slot,name:e.name,props:e.props,value:e.value}),[t,e.slot,e.name,e.props,e.value]);return r.createElement(c.Provider,{value:n},e.children)},[l])]}c.displayName="LabelContext";let p=Object.assign((0,s.yV)(function(e,t){var n;let d=(0,r.useId)(),f=function e(){let t=(0,r.useContext)(c);if(null===t){let t=Error("You used a